591 extern "C" 592 JNIEXPORT jstring JNICALL Java_sun_jvm_hotspot_debugger_linux_LinuxDebuggerLocal_demangle 593 (JNIEnv *env, jobject this_obj, jstring jsym) { 594 int status; 595 jstring result = NULL; 596 597 const char *sym = env->GetStringUTFChars(jsym, JNI_FALSE); 598 char *demangled = abi::__cxa_demangle(sym, NULL, 0, &status); 599 env->ReleaseStringUTFChars(jsym, sym); 600 if ((demangled != NULL) && (status == 0)) { 601 result = env->NewStringUTF(demangled); 602 free(demangled); 603 } else if (status == -2) { // not C++ ABI mangling rules - maybe C style 604 result = jsym; 605 } else { 606 THROW_NEW_DEBUGGER_EXCEPTION_("Could not demangle", NULL); 607 } 608 609 return result; 610 } | 591 extern "C" 592 JNIEXPORT jstring JNICALL Java_sun_jvm_hotspot_debugger_linux_LinuxDebuggerLocal_demangle 593 (JNIEnv *env, jobject this_obj, jstring jsym) { 594 int status; 595 jstring result = NULL; 596 597 const char *sym = env->GetStringUTFChars(jsym, JNI_FALSE); 598 char *demangled = abi::__cxa_demangle(sym, NULL, 0, &status); 599 env->ReleaseStringUTFChars(jsym, sym); 600 if ((demangled != NULL) && (status == 0)) { 601 result = env->NewStringUTF(demangled); 602 free(demangled); 603 } else if (status == -2) { // not C++ ABI mangling rules - maybe C style 604 result = jsym; 605 } else { 606 THROW_NEW_DEBUGGER_EXCEPTION_("Could not demangle", NULL); 607 } 608 609 return result; 610 } 611 612 /* 613 * Class: sun_jvm_hotspot_debugger_linux_LinuxDebuggerLocal 614 * Method: findLibPtrByAddress0 615 * Signature: (J)J 616 */ 617 extern "C" 618 JNIEXPORT jlong JNICALL Java_sun_jvm_hotspot_debugger_linux_LinuxDebuggerLocal_findLibPtrByAddress0 619 (JNIEnv *env, jobject this_obj, jlong pc) { 620 struct ps_prochandle* ph = get_proc_handle(env, this_obj); 621 return reinterpret_cast<jlong>(find_lib_by_address(ph, pc)); 622 } |