comparison agent/src/os/solaris/proc/saproc.cpp @ 10229:f6a055fcf47d

8005038: remove crufty '_g' support from SA Reviewed-by: coleenp, mgronlun, rbackman
author sla
date Tue, 07 May 2013 14:33:09 +0200
parents da91efe96a93
children de6a9e811145
comparison
equal deleted inserted replaced
10228:b5fef8013a95 10229:f6a055fcf47d
587 init_classsharing_workaround(void *cd, const prmap_t* pmap, const char* obj_name) { 587 init_classsharing_workaround(void *cd, const prmap_t* pmap, const char* obj_name) {
588 Debugger* dbg = (Debugger*) cd; 588 Debugger* dbg = (Debugger*) cd;
589 JNIEnv* env = dbg->env; 589 JNIEnv* env = dbg->env;
590 jobject this_obj = dbg->this_obj; 590 jobject this_obj = dbg->this_obj;
591 const char* jvm_name = 0; 591 const char* jvm_name = 0;
592 if ((jvm_name = strstr(obj_name, "libjvm.so")) != NULL || 592 if ((jvm_name = strstr(obj_name, "libjvm.so")) != NULL) {
593 (jvm_name = strstr(obj_name, "libjvm_g.so")) != NULL) {
594 jvm_name = obj_name; 593 jvm_name = obj_name;
595 } else { 594 } else {
596 return 0; 595 return 0;
597 } 596 }
598 597
599 struct ps_prochandle* ph = (struct ps_prochandle*) env->GetLongField(this_obj, p_ps_prochandle_ID); 598 struct ps_prochandle* ph = (struct ps_prochandle*) env->GetLongField(this_obj, p_ps_prochandle_ID);
600 599
601 // initialize classes[_g].jsa file descriptor field. 600 // initialize classes.jsa file descriptor field.
602 dbg->env->SetIntField(this_obj, classes_jsa_fd_ID, -1); 601 dbg->env->SetIntField(this_obj, classes_jsa_fd_ID, -1);
603 602
604 // check whether class sharing is on by reading variable "UseSharedSpaces" 603 // check whether class sharing is on by reading variable "UseSharedSpaces"
605 psaddr_t useSharedSpacesAddr = 0; 604 psaddr_t useSharedSpacesAddr = 0;
606 ps_pglobal_lookup(ph, jvm_name, USE_SHARED_SPACES_SYM, &useSharedSpacesAddr); 605 ps_pglobal_lookup(ph, jvm_name, USE_SHARED_SPACES_SYM, &useSharedSpacesAddr);
639 THROW_NEW_DEBUGGER_EXCEPTION_("can't get shared archive path from debuggee", 1); 638 THROW_NEW_DEBUGGER_EXCEPTION_("can't get shared archive path from debuggee", 1);
640 } 639 }
641 640
642 print_debug("looking for %s\n", classes_jsa); 641 print_debug("looking for %s\n", classes_jsa);
643 642
644 // open the classes[_g].jsa 643 // open the classes.jsa
645 int fd = libsaproc_open(classes_jsa, O_RDONLY); 644 int fd = libsaproc_open(classes_jsa, O_RDONLY);
646 if (fd < 0) { 645 if (fd < 0) {
647 char errMsg[ERR_MSG_SIZE]; 646 char errMsg[ERR_MSG_SIZE];
648 sprintf(errMsg, "can't open shared archive file %s", classes_jsa); 647 sprintf(errMsg, "can't open shared archive file %s", classes_jsa);
649 THROW_NEW_DEBUGGER_EXCEPTION_(errMsg, 1); 648 THROW_NEW_DEBUGGER_EXCEPTION_(errMsg, 1);
650 } else { 649 } else {
651 print_debug("opened shared archive file %s\n", classes_jsa); 650 print_debug("opened shared archive file %s\n", classes_jsa);
652 } 651 }
653 652
654 // parse classes[_g].jsa 653 // parse classes.jsa
655 struct FileMapHeader* pheader = (struct FileMapHeader*) malloc(sizeof(struct FileMapHeader)); 654 struct FileMapHeader* pheader = (struct FileMapHeader*) malloc(sizeof(struct FileMapHeader));
656 if (pheader == NULL) { 655 if (pheader == NULL) {
657 close(fd); 656 close(fd);
658 THROW_NEW_DEBUGGER_EXCEPTION_("can't allocate memory for shared file map header", 1); 657 THROW_NEW_DEBUGGER_EXCEPTION_("can't allocate memory for shared file map header", 1);
659 } 658 }
796 dbg.this_obj = this_obj; 795 dbg.this_obj = this_obj;
797 jthrowable exception = 0; 796 jthrowable exception = 0;
798 if (! isProcess) { 797 if (! isProcess) {
799 /* 798 /*
800 * With class sharing, shared perm. gen heap is allocated in with MAP_SHARED|PROT_READ. 799 * With class sharing, shared perm. gen heap is allocated in with MAP_SHARED|PROT_READ.
801 * These pages are mapped from the file "classes[_g].jsa". MAP_SHARED pages are not dumped 800 * These pages are mapped from the file "classes.jsa". MAP_SHARED pages are not dumped
802 * in Solaris core.To read shared heap pages, we have to read classes[_g].jsa file. 801 * in Solaris core.To read shared heap pages, we have to read classes.jsa file.
803 */ 802 */
804 Pobject_iter(ph, init_classsharing_workaround, &dbg); 803 Pobject_iter(ph, init_classsharing_workaround, &dbg);
805 exception = env->ExceptionOccurred(); 804 exception = env->ExceptionOccurred();
806 if (exception) { 805 if (exception) {
807 env->ExceptionClear(); 806 env->ExceptionClear();