58 #include "runtime/threadCritical.hpp" |
58 #include "runtime/threadCritical.hpp" |
59 #include "runtime/timer.hpp" |
59 #include "runtime/timer.hpp" |
60 #include "services/attachListener.hpp" |
60 #include "services/attachListener.hpp" |
61 #include "services/runtimeService.hpp" |
61 #include "services/runtimeService.hpp" |
62 #include "thread_linux.inline.hpp" |
62 #include "thread_linux.inline.hpp" |
|
63 #include "utilities/decoder.hpp" |
63 #include "utilities/defaultStream.hpp" |
64 #include "utilities/defaultStream.hpp" |
64 #include "utilities/events.hpp" |
65 #include "utilities/events.hpp" |
65 #include "utilities/growableArray.hpp" |
66 #include "utilities/growableArray.hpp" |
66 #include "utilities/vmError.hpp" |
67 #include "utilities/vmError.hpp" |
67 #ifdef TARGET_ARCH_x86 |
68 #ifdef TARGET_ARCH_x86 |
1669 bool os::dll_address_to_function_name(address addr, char *buf, |
1670 bool os::dll_address_to_function_name(address addr, char *buf, |
1670 int buflen, int *offset) { |
1671 int buflen, int *offset) { |
1671 Dl_info dlinfo; |
1672 Dl_info dlinfo; |
1672 |
1673 |
1673 if (dladdr((void*)addr, &dlinfo) && dlinfo.dli_sname != NULL) { |
1674 if (dladdr((void*)addr, &dlinfo) && dlinfo.dli_sname != NULL) { |
1674 if (buf) jio_snprintf(buf, buflen, "%s", dlinfo.dli_sname); |
1675 if (buf != NULL) { |
1675 if (offset) *offset = addr - (address)dlinfo.dli_saddr; |
1676 if(!Decoder::demangle(dlinfo.dli_sname, buf, buflen)) { |
|
1677 jio_snprintf(buf, buflen, "%s", dlinfo.dli_sname); |
|
1678 } |
|
1679 } |
|
1680 if (offset != NULL) *offset = addr - (address)dlinfo.dli_saddr; |
1676 return true; |
1681 return true; |
1677 } else { |
1682 } else if (dlinfo.dli_fname != NULL && dlinfo.dli_fbase != 0) { |
1678 if (buf) buf[0] = '\0'; |
1683 if (Decoder::decode((address)(addr - (address)dlinfo.dli_fbase), |
1679 if (offset) *offset = -1; |
1684 dlinfo.dli_fname, buf, buflen, offset) == Decoder::no_error) { |
1680 return false; |
1685 return true; |
1681 } |
1686 } |
|
1687 } |
|
1688 |
|
1689 if (buf != NULL) buf[0] = '\0'; |
|
1690 if (offset != NULL) *offset = -1; |
|
1691 return false; |
1682 } |
1692 } |
1683 |
1693 |
1684 struct _address_to_library_name { |
1694 struct _address_to_library_name { |
1685 address addr; // input : memory address |
1695 address addr; // input : memory address |
1686 size_t buflen; // size of fname |
1696 size_t buflen; // size of fname |