1883 snprintf(buffer, buflen, "lib%s.so", fname); |
1883 snprintf(buffer, buflen, "lib%s.so", fname); |
1884 retval = true; |
1884 retval = true; |
1885 } else if (strchr(pname, *os::path_separator()) != NULL) { |
1885 } else if (strchr(pname, *os::path_separator()) != NULL) { |
1886 int n; |
1886 int n; |
1887 char** pelements = split_path(pname, &n); |
1887 char** pelements = split_path(pname, &n); |
|
1888 if (pelements == NULL) { |
|
1889 return false; |
|
1890 } |
1888 for (int i = 0 ; i < n ; i++) { |
1891 for (int i = 0 ; i < n ; i++) { |
1889 // really shouldn't be NULL but what the heck, check can't hurt |
1892 // really shouldn't be NULL but what the heck, check can't hurt |
1890 if (pelements[i] == NULL || strlen(pelements[i]) == 0) { |
1893 if (pelements[i] == NULL || strlen(pelements[i]) == 0) { |
1891 continue; // skip the empty path values |
1894 continue; // skip the empty path values |
1892 } |
1895 } |
5785 } |
5788 } |
5786 } |
5789 } |
5787 |
5790 |
5788 //--------------------------------------------------------------------------------- |
5791 //--------------------------------------------------------------------------------- |
5789 |
5792 |
5790 static address same_page(address x, address y) { |
|
5791 intptr_t page_bits = -os::vm_page_size(); |
|
5792 if ((intptr_t(x) & page_bits) == (intptr_t(y) & page_bits)) |
|
5793 return x; |
|
5794 else if (x > y) |
|
5795 return (address)(intptr_t(y) | ~page_bits) + 1; |
|
5796 else |
|
5797 return (address)(intptr_t(y) & page_bits); |
|
5798 } |
|
5799 |
|
5800 bool os::find(address addr, outputStream* st) { |
5793 bool os::find(address addr, outputStream* st) { |
5801 Dl_info dlinfo; |
5794 Dl_info dlinfo; |
5802 memset(&dlinfo, 0, sizeof(dlinfo)); |
5795 memset(&dlinfo, 0, sizeof(dlinfo)); |
5803 if (dladdr(addr, &dlinfo)) { |
5796 if (dladdr(addr, &dlinfo)) { |
5804 #ifdef _LP64 |
5797 #ifdef _LP64 |
5820 #endif |
5813 #endif |
5821 st->cr(); |
5814 st->cr(); |
5822 |
5815 |
5823 if (Verbose) { |
5816 if (Verbose) { |
5824 // decode some bytes around the PC |
5817 // decode some bytes around the PC |
5825 address begin = same_page(addr-40, addr); |
5818 address begin = clamp_address_in_page(addr-40, addr, os::vm_page_size()); |
5826 address end = same_page(addr+40, addr); |
5819 address end = clamp_address_in_page(addr+40, addr, os::vm_page_size()); |
5827 address lowest = (address) dlinfo.dli_sname; |
5820 address lowest = (address) dlinfo.dli_sname; |
5828 if (!lowest) lowest = (address) dlinfo.dli_fbase; |
5821 if (!lowest) lowest = (address) dlinfo.dli_fbase; |
5829 if (begin < lowest) begin = lowest; |
5822 if (begin < lowest) begin = lowest; |
5830 Dl_info dlinfo2; |
5823 Dl_info dlinfo2; |
5831 if (dladdr(end, &dlinfo2) && dlinfo2.dli_saddr != dlinfo.dli_saddr |
5824 if (dladdr(end, &dlinfo2) && dlinfo2.dli_saddr != dlinfo.dli_saddr |