src/os/bsd/vm/os_bsd.cpp

Print this page
rev 6937 : 8055755: Information about loaded dynamic libraries is wrong on MacOSX
Summary: The information about loaded dynamic libraries printed in hs_err_pid files or by running the jcmd VM.dynlib is partly incorrect. The address printed in front of the library file name is wrong.
Reviewed-by: duke
Contributed-by:


1661   if (handle == NULL) {
1662     st->print_cr("Error: Cannot print dynamic libraries.");
1663     return;
1664   }
1665   dlinfo(handle, RTLD_DI_LINKMAP, &map);
1666   if (map == NULL) {
1667     st->print_cr("Error: Cannot print dynamic libraries.");
1668     return;
1669   }
1670 
1671   while (map->l_prev != NULL)
1672     map = map->l_prev;
1673 
1674   while (map != NULL) {
1675     st->print_cr(PTR_FORMAT " \t%s", map->l_addr, map->l_name);
1676     map = map->l_next;
1677   }
1678 
1679   dlclose(handle);
1680 #elif defined(__APPLE__)
1681   uint32_t count;
1682   uint32_t i;
1683 
1684   count = _dyld_image_count();
1685   for (i = 1; i < count; i++) {
1686     const char *name = _dyld_get_image_name(i);
1687     intptr_t slide = _dyld_get_image_vmaddr_slide(i);
1688     st->print_cr(PTR_FORMAT " \t%s", slide, name);
1689   }
1690 #else
1691   st->print_cr("Error: Cannot print dynamic libraries.");
1692 #endif
1693 }
1694 
1695 void os::print_os_info_brief(outputStream* st) {
1696   st->print("Bsd");
1697 
1698   os::Posix::print_uname_info(st);
1699 }
1700 
1701 void os::print_os_info(outputStream* st) {
1702   st->print("OS:");
1703   st->print("Bsd");
1704 
1705   os::Posix::print_uname_info(st);
1706 
1707   os::Posix::print_rlimit_info(st);
1708 




1661   if (handle == NULL) {
1662     st->print_cr("Error: Cannot print dynamic libraries.");
1663     return;
1664   }
1665   dlinfo(handle, RTLD_DI_LINKMAP, &map);
1666   if (map == NULL) {
1667     st->print_cr("Error: Cannot print dynamic libraries.");
1668     return;
1669   }
1670 
1671   while (map->l_prev != NULL)
1672     map = map->l_prev;
1673 
1674   while (map != NULL) {
1675     st->print_cr(PTR_FORMAT " \t%s", map->l_addr, map->l_name);
1676     map = map->l_next;
1677   }
1678 
1679   dlclose(handle);
1680 #elif defined(__APPLE__)
1681   for (uint32_t i = 1; i < _dyld_image_count(); i++) {
1682     st->print_cr(PTR_FORMAT " \t%s", _dyld_get_image_header(i),
1683         _dyld_get_image_name(i));





1684   }
1685 #else
1686   st->print_cr("Error: Cannot print dynamic libraries.");
1687 #endif
1688 }
1689 
1690 void os::print_os_info_brief(outputStream* st) {
1691   st->print("Bsd");
1692 
1693   os::Posix::print_uname_info(st);
1694 }
1695 
1696 void os::print_os_info(outputStream* st) {
1697   st->print("OS:");
1698   st->print("Bsd");
1699 
1700   os::Posix::print_uname_info(st);
1701 
1702   os::Posix::print_rlimit_info(st);
1703