hotspot/src/os/bsd/vm/os_bsd.cpp
changeset 46630 75aa3e39d02c
parent 46625 edefffab74e2
child 46958 a13bd8c6b7a2
equal deleted inserted replaced
46629:8eeacdc76bf2 46630:75aa3e39d02c
  1562   return dlsym(handle, name);
  1562   return dlsym(handle, name);
  1563 }
  1563 }
  1564 
  1564 
  1565 int _print_dll_info_cb(const char * name, address base_address, address top_address, void * param) {
  1565 int _print_dll_info_cb(const char * name, address base_address, address top_address, void * param) {
  1566   outputStream * out = (outputStream *) param;
  1566   outputStream * out = (outputStream *) param;
  1567   out->print_cr(PTR_FORMAT " \t%s", base_address, name);
  1567   out->print_cr(INTPTR_FORMAT " \t%s", (intptr_t)base_address, name);
  1568   return 0;
  1568   return 0;
  1569 }
  1569 }
  1570 
  1570 
  1571 void os::print_dll_info(outputStream *st) {
  1571 void os::print_dll_info(outputStream *st) {
  1572   st->print_cr("Dynamic libraries:");
  1572   st->print_cr("Dynamic libraries:");
  2116   }
  2116   }
  2117 }
  2117 }
  2118 
  2118 
  2119 static void warn_fail_commit_memory(char* addr, size_t size, bool exec,
  2119 static void warn_fail_commit_memory(char* addr, size_t size, bool exec,
  2120                                     int err) {
  2120                                     int err) {
  2121   warning("INFO: os::commit_memory(" PTR_FORMAT ", " SIZE_FORMAT
  2121   warning("INFO: os::commit_memory(" INTPTR_FORMAT ", " SIZE_FORMAT
  2122           ", %d) failed; error='%s' (errno=%d)", addr, size, exec,
  2122           ", %d) failed; error='%s' (errno=%d)", (intptr_t)addr, size, exec,
  2123           os::errno_name(err), err);
  2123            os::errno_name(err), err);
  2124 }
  2124 }
  2125 
  2125 
  2126 // NOTE: Bsd kernel does not really reserve the pages for us.
  2126 // NOTE: Bsd kernel does not really reserve the pages for us.
  2127 //       All it does is to check if there are enough free pages
  2127 //       All it does is to check if there are enough free pages
  2128 //       left at the time of mmap(). This could be a potential
  2128 //       left at the time of mmap(). This could be a potential
  3628 
  3628 
  3629 bool os::find(address addr, outputStream* st) {
  3629 bool os::find(address addr, outputStream* st) {
  3630   Dl_info dlinfo;
  3630   Dl_info dlinfo;
  3631   memset(&dlinfo, 0, sizeof(dlinfo));
  3631   memset(&dlinfo, 0, sizeof(dlinfo));
  3632   if (dladdr(addr, &dlinfo) != 0) {
  3632   if (dladdr(addr, &dlinfo) != 0) {
  3633     st->print(PTR_FORMAT ": ", addr);
  3633     st->print(INTPTR_FORMAT ": ", (intptr_t)addr);
  3634     if (dlinfo.dli_sname != NULL && dlinfo.dli_saddr != NULL) {
  3634     if (dlinfo.dli_sname != NULL && dlinfo.dli_saddr != NULL) {
  3635       st->print("%s+%#x", dlinfo.dli_sname,
  3635       st->print("%s+%#x", dlinfo.dli_sname,
  3636                 addr - (intptr_t)dlinfo.dli_saddr);
  3636                 (uint)((uintptr_t)addr - (uintptr_t)dlinfo.dli_saddr));
  3637     } else if (dlinfo.dli_fbase != NULL) {
  3637     } else if (dlinfo.dli_fbase != NULL) {
  3638       st->print("<offset %#x>", addr - (intptr_t)dlinfo.dli_fbase);
  3638       st->print("<offset %#x>", (uint)((uintptr_t)addr - (uintptr_t)dlinfo.dli_fbase));
  3639     } else {
  3639     } else {
  3640       st->print("<absolute address>");
  3640       st->print("<absolute address>");
  3641     }
  3641     }
  3642     if (dlinfo.dli_fname != NULL) {
  3642     if (dlinfo.dli_fname != NULL) {
  3643       st->print(" in %s", dlinfo.dli_fname);
  3643       st->print(" in %s", dlinfo.dli_fname);
  3644     }
  3644     }
  3645     if (dlinfo.dli_fbase != NULL) {
  3645     if (dlinfo.dli_fbase != NULL) {
  3646       st->print(" at " PTR_FORMAT, dlinfo.dli_fbase);
  3646       st->print(" at " INTPTR_FORMAT, (intptr_t)dlinfo.dli_fbase);
  3647     }
  3647     }
  3648     st->cr();
  3648     st->cr();
  3649 
  3649 
  3650     if (Verbose) {
  3650     if (Verbose) {
  3651       // decode some bytes around the PC
  3651       // decode some bytes around the PC