Mercurial > hg > truffle
comparison src/os/windows/vm/os_windows.cpp @ 11092:59b052799158
8015884: runThese crashed with SIGSEGV, hs_err has an error instead of stacktrace
Summary: Dl_info struct should only be used if dladdr() has returned non-zero (no errors) and always check the dladdr() return value; Dl_info.dli_sname and Dl_info.dli_saddr fields should only be used if non-NULL; update/improve runtime/6888954/vmerrors.sh test
Reviewed-by: dsamersoff, zgu, hseigel, coleenp
author | dcubed |
---|---|
date | Thu, 04 Jul 2013 21:10:17 -0700 |
parents | 1f4355cee9a2 |
children | a74ec8831c7b 5e3b6f79d280 |
comparison
equal
deleted
inserted
replaced
11091:a55aa67bce1a | 11092:59b052799158 |
---|---|
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, |
2687 } | 2693 } |
2688 return (address)-1; | 2694 return (address)-1; |
2689 } | 2695 } |
2690 #endif | 2696 #endif |
2691 | 2697 |
2698 #ifndef PRODUCT | |
2699 void os::win32::call_test_func_with_wrapper(void (*funcPtr)(void)) { | |
2700 // Install a win32 structured exception handler around the test | |
2701 // function call so the VM can generate an error dump if needed. | |
2702 __try { | |
2703 (*funcPtr)(); | |
2704 } __except(topLevelExceptionFilter( | |
2705 (_EXCEPTION_POINTERS*)_exception_info())) { | |
2706 // Nothing to do. | |
2707 } | |
2708 } | |
2709 #endif | |
2710 | |
2692 // Virtual Memory | 2711 // Virtual Memory |
2693 | 2712 |
2694 int os::vm_page_size() { return os::win32::vm_page_size(); } | 2713 int os::vm_page_size() { return os::win32::vm_page_size(); } |
2695 int os::vm_allocation_granularity() { | 2714 int os::vm_allocation_granularity() { |
2696 return os::win32::vm_allocation_granularity(); | 2715 return os::win32::vm_allocation_granularity(); |