1418 return 0; |
1418 return 0; |
1419 } |
1419 } |
1420 |
1420 |
1421 bool os::dll_address_to_library_name(address addr, char* buf, |
1421 bool os::dll_address_to_library_name(address addr, char* buf, |
1422 int buflen, int* offset) { |
1422 int buflen, int* offset) { |
|
1423 // buf is not optional, but offset is optional |
|
1424 assert(buf != NULL, "sanity check"); |
|
1425 |
1423 // NOTE: the reason we don't use SymGetModuleInfo() is it doesn't always |
1426 // NOTE: the reason we don't use SymGetModuleInfo() is it doesn't always |
1424 // return the full path to the DLL file, sometimes it returns path |
1427 // return the full path to the DLL file, sometimes it returns path |
1425 // to the corresponding PDB file (debug info); sometimes it only |
1428 // to the corresponding PDB file (debug info); sometimes it only |
1426 // returns partial path, which makes life painful. |
1429 // returns partial path, which makes life painful. |
1427 |
1430 |
1428 struct _modinfo mi; |
1431 struct _modinfo mi; |
1429 mi.addr = addr; |
1432 mi.addr = addr; |
1430 mi.full_path = buf; |
1433 mi.full_path = buf; |
1431 mi.buflen = buflen; |
1434 mi.buflen = buflen; |
1432 int pid = os::current_process_id(); |
1435 int pid = os::current_process_id(); |
1433 if (enumerate_modules(pid, _locate_module_by_addr, (void *)&mi)) { |
1436 if (enumerate_modules(pid, _locate_module_by_addr, (void *)&mi)) { |
1434 // buf already contains path name |
1437 // buf already contains path name |
1435 if (offset) *offset = addr - mi.base_addr; |
1438 if (offset) *offset = addr - mi.base_addr; |
1436 return true; |
1439 return true; |
1437 } else { |
1440 } |
1438 if (buf) buf[0] = '\0'; |
1441 |
1439 if (offset) *offset = -1; |
1442 buf[0] = '\0'; |
1440 return false; |
1443 if (offset) *offset = -1; |
1441 } |
1444 return false; |
1442 } |
1445 } |
1443 |
1446 |
1444 bool os::dll_address_to_function_name(address addr, char *buf, |
1447 bool os::dll_address_to_function_name(address addr, char *buf, |
1445 int buflen, int *offset) { |
1448 int buflen, int *offset) { |
|
1449 // buf is not optional, but offset is optional |
|
1450 assert(buf != NULL, "sanity check"); |
|
1451 |
1446 if (Decoder::decode(addr, buf, buflen, offset)) { |
1452 if (Decoder::decode(addr, buf, buflen, offset)) { |
1447 return true; |
1453 return true; |
1448 } |
1454 } |
1449 if (offset != NULL) *offset = -1; |
1455 if (offset != NULL) *offset = -1; |
1450 if (buf != NULL) buf[0] = '\0'; |
1456 buf[0] = '\0'; |
1451 return false; |
1457 return false; |
1452 } |
1458 } |
1453 |
1459 |
1454 // save the start and end address of jvm.dll into param[0] and param[1] |
1460 // save the start and end address of jvm.dll into param[0] and param[1] |
1455 static int _locate_jvm_dll(int pid, char* mod_fname, address base_addr, |
1461 static int _locate_jvm_dll(int pid, char* mod_fname, address base_addr, |