Fri, 05 Jul 2013 08:09:40 -0700
Merge
1.1 --- a/src/os/bsd/vm/os_bsd.cpp Thu Jul 04 14:56:49 2013 -0700 1.2 +++ b/src/os/bsd/vm/os_bsd.cpp Fri Jul 05 08:09:40 2013 -0700 1.3 @@ -1234,12 +1234,13 @@ 1.4 Dl_info dlinfo; 1.5 1.6 if (libjvm_base_addr == NULL) { 1.7 - dladdr(CAST_FROM_FN_PTR(void *, os::address_is_in_vm), &dlinfo); 1.8 - libjvm_base_addr = (address)dlinfo.dli_fbase; 1.9 + if (dladdr(CAST_FROM_FN_PTR(void *, os::address_is_in_vm), &dlinfo) != 0) { 1.10 + libjvm_base_addr = (address)dlinfo.dli_fbase; 1.11 + } 1.12 assert(libjvm_base_addr !=NULL, "Cannot obtain base address for libjvm"); 1.13 } 1.14 1.15 - if (dladdr((void *)addr, &dlinfo)) { 1.16 + if (dladdr((void *)addr, &dlinfo) != 0) { 1.17 if (libjvm_base_addr == (address)dlinfo.dli_fbase) return true; 1.18 } 1.19 1.20 @@ -1251,55 +1252,67 @@ 1.21 1.22 bool os::dll_address_to_function_name(address addr, char *buf, 1.23 int buflen, int *offset) { 1.24 + // buf is not optional, but offset is optional 1.25 + assert(buf != NULL, "sanity check"); 1.26 + 1.27 Dl_info dlinfo; 1.28 char localbuf[MACH_MAXSYMLEN]; 1.29 1.30 - // dladdr will find names of dynamic functions only, but does 1.31 - // it set dli_fbase with mach_header address when it "fails" ? 1.32 - if (dladdr((void*)addr, &dlinfo) && dlinfo.dli_sname != NULL) { 1.33 - if (buf != NULL) { 1.34 - if(!Decoder::demangle(dlinfo.dli_sname, buf, buflen)) { 1.35 + if (dladdr((void*)addr, &dlinfo) != 0) { 1.36 + // see if we have a matching symbol 1.37 + if (dlinfo.dli_saddr != NULL && dlinfo.dli_sname != NULL) { 1.38 + if (!Decoder::demangle(dlinfo.dli_sname, buf, buflen)) { 1.39 jio_snprintf(buf, buflen, "%s", dlinfo.dli_sname); 1.40 } 1.41 + if (offset != NULL) *offset = addr - (address)dlinfo.dli_saddr; 1.42 + return true; 1.43 } 1.44 - if (offset != NULL) *offset = addr - (address)dlinfo.dli_saddr; 1.45 - return true; 1.46 - } else if (dlinfo.dli_fname != NULL && dlinfo.dli_fbase != 0) { 1.47 - if (Decoder::decode((address)(addr - (address)dlinfo.dli_fbase), 1.48 - buf, buflen, offset, dlinfo.dli_fname)) { 1.49 - return true; 1.50 + // no matching symbol so try for just file info 1.51 + if (dlinfo.dli_fname != NULL && dlinfo.dli_fbase != NULL) { 1.52 + if (Decoder::decode((address)(addr - (address)dlinfo.dli_fbase), 1.53 + buf, buflen, offset, dlinfo.dli_fname)) { 1.54 + return true; 1.55 + } 1.56 + } 1.57 + 1.58 + // Handle non-dynamic manually: 1.59 + if (dlinfo.dli_fbase != NULL && 1.60 + Decoder::decode(addr, localbuf, MACH_MAXSYMLEN, offset, 1.61 + dlinfo.dli_fbase)) { 1.62 + if (!Decoder::demangle(localbuf, buf, buflen)) { 1.63 + jio_snprintf(buf, buflen, "%s", localbuf); 1.64 + } 1.65 + return true; 1.66 } 1.67 } 1.68 - 1.69 - // Handle non-dymanic manually: 1.70 - if (dlinfo.dli_fbase != NULL && 1.71 - Decoder::decode(addr, localbuf, MACH_MAXSYMLEN, offset, dlinfo.dli_fbase)) { 1.72 - if(!Decoder::demangle(localbuf, buf, buflen)) { 1.73 - jio_snprintf(buf, buflen, "%s", localbuf); 1.74 + buf[0] = '\0'; 1.75 + if (offset != NULL) *offset = -1; 1.76 + return false; 1.77 +} 1.78 + 1.79 +// ported from solaris version 1.80 +bool os::dll_address_to_library_name(address addr, char* buf, 1.81 + int buflen, int* offset) { 1.82 + // buf is not optional, but offset is optional 1.83 + assert(buf != NULL, "sanity check"); 1.84 + 1.85 + Dl_info dlinfo; 1.86 + 1.87 + if (dladdr((void*)addr, &dlinfo) != 0) { 1.88 + if (dlinfo.dli_fname != NULL) { 1.89 + jio_snprintf(buf, buflen, "%s", dlinfo.dli_fname); 1.90 + } 1.91 + if (dlinfo.dli_fbase != NULL && offset != NULL) { 1.92 + *offset = addr - (address)dlinfo.dli_fbase; 1.93 } 1.94 return true; 1.95 } 1.96 - if (buf != NULL) buf[0] = '\0'; 1.97 - if (offset != NULL) *offset = -1; 1.98 + 1.99 + buf[0] = '\0'; 1.100 + if (offset) *offset = -1; 1.101 return false; 1.102 } 1.103 1.104 -// ported from solaris version 1.105 -bool os::dll_address_to_library_name(address addr, char* buf, 1.106 - int buflen, int* offset) { 1.107 - Dl_info dlinfo; 1.108 - 1.109 - if (dladdr((void*)addr, &dlinfo)){ 1.110 - if (buf) jio_snprintf(buf, buflen, "%s", dlinfo.dli_fname); 1.111 - if (offset) *offset = addr - (address)dlinfo.dli_fbase; 1.112 - return true; 1.113 - } else { 1.114 - if (buf) buf[0] = '\0'; 1.115 - if (offset) *offset = -1; 1.116 - return false; 1.117 - } 1.118 -} 1.119 - 1.120 // Loads .dll/.so and 1.121 // in case of error it checks if .dll/.so was built for the 1.122 // same architecture as Hotspot is running on 1.123 @@ -1520,49 +1533,50 @@ 1.124 } 1.125 1.126 void os::print_dll_info(outputStream *st) { 1.127 - st->print_cr("Dynamic libraries:"); 1.128 + st->print_cr("Dynamic libraries:"); 1.129 #ifdef RTLD_DI_LINKMAP 1.130 - Dl_info dli; 1.131 - void *handle; 1.132 - Link_map *map; 1.133 - Link_map *p; 1.134 - 1.135 - if (!dladdr(CAST_FROM_FN_PTR(void *, os::print_dll_info), &dli)) { 1.136 - st->print_cr("Error: Cannot print dynamic libraries."); 1.137 - return; 1.138 - } 1.139 - handle = dlopen(dli.dli_fname, RTLD_LAZY); 1.140 - if (handle == NULL) { 1.141 - st->print_cr("Error: Cannot print dynamic libraries."); 1.142 - return; 1.143 - } 1.144 - dlinfo(handle, RTLD_DI_LINKMAP, &map); 1.145 - if (map == NULL) { 1.146 - st->print_cr("Error: Cannot print dynamic libraries."); 1.147 - return; 1.148 - } 1.149 - 1.150 - while (map->l_prev != NULL) 1.151 - map = map->l_prev; 1.152 - 1.153 - while (map != NULL) { 1.154 - st->print_cr(PTR_FORMAT " \t%s", map->l_addr, map->l_name); 1.155 - map = map->l_next; 1.156 - } 1.157 - 1.158 - dlclose(handle); 1.159 + Dl_info dli; 1.160 + void *handle; 1.161 + Link_map *map; 1.162 + Link_map *p; 1.163 + 1.164 + if (dladdr(CAST_FROM_FN_PTR(void *, os::print_dll_info), &dli) == 0 || 1.165 + dli.dli_fname == NULL) { 1.166 + st->print_cr("Error: Cannot print dynamic libraries."); 1.167 + return; 1.168 + } 1.169 + handle = dlopen(dli.dli_fname, RTLD_LAZY); 1.170 + if (handle == NULL) { 1.171 + st->print_cr("Error: Cannot print dynamic libraries."); 1.172 + return; 1.173 + } 1.174 + dlinfo(handle, RTLD_DI_LINKMAP, &map); 1.175 + if (map == NULL) { 1.176 + st->print_cr("Error: Cannot print dynamic libraries."); 1.177 + return; 1.178 + } 1.179 + 1.180 + while (map->l_prev != NULL) 1.181 + map = map->l_prev; 1.182 + 1.183 + while (map != NULL) { 1.184 + st->print_cr(PTR_FORMAT " \t%s", map->l_addr, map->l_name); 1.185 + map = map->l_next; 1.186 + } 1.187 + 1.188 + dlclose(handle); 1.189 #elif defined(__APPLE__) 1.190 - uint32_t count; 1.191 - uint32_t i; 1.192 - 1.193 - count = _dyld_image_count(); 1.194 - for (i = 1; i < count; i++) { 1.195 - const char *name = _dyld_get_image_name(i); 1.196 - intptr_t slide = _dyld_get_image_vmaddr_slide(i); 1.197 - st->print_cr(PTR_FORMAT " \t%s", slide, name); 1.198 - } 1.199 + uint32_t count; 1.200 + uint32_t i; 1.201 + 1.202 + count = _dyld_image_count(); 1.203 + for (i = 1; i < count; i++) { 1.204 + const char *name = _dyld_get_image_name(i); 1.205 + intptr_t slide = _dyld_get_image_vmaddr_slide(i); 1.206 + st->print_cr(PTR_FORMAT " \t%s", slide, name); 1.207 + } 1.208 #else 1.209 - st->print_cr("Error: Cannot print dynamic libraries."); 1.210 + st->print_cr("Error: Cannot print dynamic libraries."); 1.211 #endif 1.212 } 1.213 1.214 @@ -1707,8 +1721,11 @@ 1.215 bool ret = dll_address_to_library_name( 1.216 CAST_FROM_FN_PTR(address, os::jvm_path), 1.217 dli_fname, sizeof(dli_fname), NULL); 1.218 - assert(ret != 0, "cannot locate libjvm"); 1.219 - char *rp = realpath(dli_fname, buf); 1.220 + assert(ret, "cannot locate libjvm"); 1.221 + char *rp = NULL; 1.222 + if (ret && dli_fname[0] != '\0') { 1.223 + rp = realpath(dli_fname, buf); 1.224 + } 1.225 if (rp == NULL) 1.226 return; 1.227 1.228 @@ -3747,20 +3764,20 @@ 1.229 bool os::find(address addr, outputStream* st) { 1.230 Dl_info dlinfo; 1.231 memset(&dlinfo, 0, sizeof(dlinfo)); 1.232 - if (dladdr(addr, &dlinfo)) { 1.233 + if (dladdr(addr, &dlinfo) != 0) { 1.234 st->print(PTR_FORMAT ": ", addr); 1.235 - if (dlinfo.dli_sname != NULL) { 1.236 + if (dlinfo.dli_sname != NULL && dlinfo.dli_saddr != NULL) { 1.237 st->print("%s+%#x", dlinfo.dli_sname, 1.238 addr - (intptr_t)dlinfo.dli_saddr); 1.239 - } else if (dlinfo.dli_fname) { 1.240 + } else if (dlinfo.dli_fbase != NULL) { 1.241 st->print("<offset %#x>", addr - (intptr_t)dlinfo.dli_fbase); 1.242 } else { 1.243 st->print("<absolute address>"); 1.244 } 1.245 - if (dlinfo.dli_fname) { 1.246 + if (dlinfo.dli_fname != NULL) { 1.247 st->print(" in %s", dlinfo.dli_fname); 1.248 } 1.249 - if (dlinfo.dli_fbase) { 1.250 + if (dlinfo.dli_fbase != NULL) { 1.251 st->print(" at " PTR_FORMAT, dlinfo.dli_fbase); 1.252 } 1.253 st->cr(); 1.254 @@ -3773,7 +3790,7 @@ 1.255 if (!lowest) lowest = (address) dlinfo.dli_fbase; 1.256 if (begin < lowest) begin = lowest; 1.257 Dl_info dlinfo2; 1.258 - if (dladdr(end, &dlinfo2) && dlinfo2.dli_saddr != dlinfo.dli_saddr 1.259 + if (dladdr(end, &dlinfo2) != 0 && dlinfo2.dli_saddr != dlinfo.dli_saddr 1.260 && end > dlinfo2.dli_saddr && dlinfo2.dli_saddr > begin) 1.261 end = (address) dlinfo2.dli_saddr; 1.262 Disassembler::decode(begin, end, st);
2.1 --- a/src/os/linux/vm/os_linux.cpp Thu Jul 04 14:56:49 2013 -0700 2.2 +++ b/src/os/linux/vm/os_linux.cpp Fri Jul 05 08:09:40 2013 -0700 2.3 @@ -1682,12 +1682,13 @@ 2.4 Dl_info dlinfo; 2.5 2.6 if (libjvm_base_addr == NULL) { 2.7 - dladdr(CAST_FROM_FN_PTR(void *, os::address_is_in_vm), &dlinfo); 2.8 - libjvm_base_addr = (address)dlinfo.dli_fbase; 2.9 + if (dladdr(CAST_FROM_FN_PTR(void *, os::address_is_in_vm), &dlinfo) != 0) { 2.10 + libjvm_base_addr = (address)dlinfo.dli_fbase; 2.11 + } 2.12 assert(libjvm_base_addr !=NULL, "Cannot obtain base address for libjvm"); 2.13 } 2.14 2.15 - if (dladdr((void *)addr, &dlinfo)) { 2.16 + if (dladdr((void *)addr, &dlinfo) != 0) { 2.17 if (libjvm_base_addr == (address)dlinfo.dli_fbase) return true; 2.18 } 2.19 2.20 @@ -1696,24 +1697,30 @@ 2.21 2.22 bool os::dll_address_to_function_name(address addr, char *buf, 2.23 int buflen, int *offset) { 2.24 + // buf is not optional, but offset is optional 2.25 + assert(buf != NULL, "sanity check"); 2.26 + 2.27 Dl_info dlinfo; 2.28 2.29 - if (dladdr((void*)addr, &dlinfo) && dlinfo.dli_sname != NULL) { 2.30 - if (buf != NULL) { 2.31 - if(!Decoder::demangle(dlinfo.dli_sname, buf, buflen)) { 2.32 + if (dladdr((void*)addr, &dlinfo) != 0) { 2.33 + // see if we have a matching symbol 2.34 + if (dlinfo.dli_saddr != NULL && dlinfo.dli_sname != NULL) { 2.35 + if (!Decoder::demangle(dlinfo.dli_sname, buf, buflen)) { 2.36 jio_snprintf(buf, buflen, "%s", dlinfo.dli_sname); 2.37 } 2.38 + if (offset != NULL) *offset = addr - (address)dlinfo.dli_saddr; 2.39 + return true; 2.40 } 2.41 - if (offset != NULL) *offset = addr - (address)dlinfo.dli_saddr; 2.42 - return true; 2.43 - } else if (dlinfo.dli_fname != NULL && dlinfo.dli_fbase != 0) { 2.44 - if (Decoder::decode((address)(addr - (address)dlinfo.dli_fbase), 2.45 - buf, buflen, offset, dlinfo.dli_fname)) { 2.46 - return true; 2.47 + // no matching symbol so try for just file info 2.48 + if (dlinfo.dli_fname != NULL && dlinfo.dli_fbase != NULL) { 2.49 + if (Decoder::decode((address)(addr - (address)dlinfo.dli_fbase), 2.50 + buf, buflen, offset, dlinfo.dli_fname)) { 2.51 + return true; 2.52 + } 2.53 } 2.54 } 2.55 2.56 - if (buf != NULL) buf[0] = '\0'; 2.57 + buf[0] = '\0'; 2.58 if (offset != NULL) *offset = -1; 2.59 return false; 2.60 } 2.61 @@ -1764,6 +1771,9 @@ 2.62 2.63 bool os::dll_address_to_library_name(address addr, char* buf, 2.64 int buflen, int* offset) { 2.65 + // buf is not optional, but offset is optional 2.66 + assert(buf != NULL, "sanity check"); 2.67 + 2.68 Dl_info dlinfo; 2.69 struct _address_to_library_name data; 2.70 2.71 @@ -1782,15 +1792,20 @@ 2.72 // buf already contains library name 2.73 if (offset) *offset = addr - data.base; 2.74 return true; 2.75 - } else if (dladdr((void*)addr, &dlinfo)){ 2.76 - if (buf) jio_snprintf(buf, buflen, "%s", dlinfo.dli_fname); 2.77 - if (offset) *offset = addr - (address)dlinfo.dli_fbase; 2.78 - return true; 2.79 - } else { 2.80 - if (buf) buf[0] = '\0'; 2.81 - if (offset) *offset = -1; 2.82 - return false; 2.83 - } 2.84 + } 2.85 + if (dladdr((void*)addr, &dlinfo) != 0) { 2.86 + if (dlinfo.dli_fname != NULL) { 2.87 + jio_snprintf(buf, buflen, "%s", dlinfo.dli_fname); 2.88 + } 2.89 + if (dlinfo.dli_fbase != NULL && offset != NULL) { 2.90 + *offset = addr - (address)dlinfo.dli_fbase; 2.91 + } 2.92 + return true; 2.93 + } 2.94 + 2.95 + buf[0] = '\0'; 2.96 + if (offset) *offset = -1; 2.97 + return false; 2.98 } 2.99 2.100 // Loads .dll/.so and 2.101 @@ -2317,8 +2332,11 @@ 2.102 bool ret = dll_address_to_library_name( 2.103 CAST_FROM_FN_PTR(address, os::jvm_path), 2.104 dli_fname, sizeof(dli_fname), NULL); 2.105 - assert(ret != 0, "cannot locate libjvm"); 2.106 - char *rp = realpath(dli_fname, buf); 2.107 + assert(ret, "cannot locate libjvm"); 2.108 + char *rp = NULL; 2.109 + if (ret && dli_fname[0] != '\0') { 2.110 + rp = realpath(dli_fname, buf); 2.111 + } 2.112 if (rp == NULL) 2.113 return; 2.114 2.115 @@ -4730,20 +4748,20 @@ 2.116 bool os::find(address addr, outputStream* st) { 2.117 Dl_info dlinfo; 2.118 memset(&dlinfo, 0, sizeof(dlinfo)); 2.119 - if (dladdr(addr, &dlinfo)) { 2.120 + if (dladdr(addr, &dlinfo) != 0) { 2.121 st->print(PTR_FORMAT ": ", addr); 2.122 - if (dlinfo.dli_sname != NULL) { 2.123 + if (dlinfo.dli_sname != NULL && dlinfo.dli_saddr != NULL) { 2.124 st->print("%s+%#x", dlinfo.dli_sname, 2.125 addr - (intptr_t)dlinfo.dli_saddr); 2.126 - } else if (dlinfo.dli_fname) { 2.127 + } else if (dlinfo.dli_fbase != NULL) { 2.128 st->print("<offset %#x>", addr - (intptr_t)dlinfo.dli_fbase); 2.129 } else { 2.130 st->print("<absolute address>"); 2.131 } 2.132 - if (dlinfo.dli_fname) { 2.133 + if (dlinfo.dli_fname != NULL) { 2.134 st->print(" in %s", dlinfo.dli_fname); 2.135 } 2.136 - if (dlinfo.dli_fbase) { 2.137 + if (dlinfo.dli_fbase != NULL) { 2.138 st->print(" at " PTR_FORMAT, dlinfo.dli_fbase); 2.139 } 2.140 st->cr(); 2.141 @@ -4756,7 +4774,7 @@ 2.142 if (!lowest) lowest = (address) dlinfo.dli_fbase; 2.143 if (begin < lowest) begin = lowest; 2.144 Dl_info dlinfo2; 2.145 - if (dladdr(end, &dlinfo2) && dlinfo2.dli_saddr != dlinfo.dli_saddr 2.146 + if (dladdr(end, &dlinfo2) != 0 && dlinfo2.dli_saddr != dlinfo.dli_saddr 2.147 && end > dlinfo2.dli_saddr && dlinfo2.dli_saddr > begin) 2.148 end = (address) dlinfo2.dli_saddr; 2.149 Disassembler::decode(begin, end, st);
3.1 --- a/src/os/solaris/vm/os_solaris.cpp Thu Jul 04 14:56:49 2013 -0700 3.2 +++ b/src/os/solaris/vm/os_solaris.cpp Fri Jul 05 08:09:40 2013 -0700 3.3 @@ -1924,12 +1924,13 @@ 3.4 Dl_info dlinfo; 3.5 3.6 if (libjvm_base_addr == NULL) { 3.7 - dladdr(CAST_FROM_FN_PTR(void *, os::address_is_in_vm), &dlinfo); 3.8 - libjvm_base_addr = (address)dlinfo.dli_fbase; 3.9 + if (dladdr(CAST_FROM_FN_PTR(void *, os::address_is_in_vm), &dlinfo) != 0) { 3.10 + libjvm_base_addr = (address)dlinfo.dli_fbase; 3.11 + } 3.12 assert(libjvm_base_addr !=NULL, "Cannot obtain base address for libjvm"); 3.13 } 3.14 3.15 - if (dladdr((void *)addr, &dlinfo)) { 3.16 + if (dladdr((void *)addr, &dlinfo) != 0) { 3.17 if (libjvm_base_addr == (address)dlinfo.dli_fbase) return true; 3.18 } 3.19 3.20 @@ -1941,114 +1942,133 @@ 3.21 3.22 bool os::dll_address_to_function_name(address addr, char *buf, 3.23 int buflen, int * offset) { 3.24 + // buf is not optional, but offset is optional 3.25 + assert(buf != NULL, "sanity check"); 3.26 + 3.27 Dl_info dlinfo; 3.28 3.29 // dladdr1_func was initialized in os::init() 3.30 - if (dladdr1_func){ 3.31 - // yes, we have dladdr1 3.32 - 3.33 - // Support for dladdr1 is checked at runtime; it may be 3.34 - // available even if the vm is built on a machine that does 3.35 - // not have dladdr1 support. Make sure there is a value for 3.36 - // RTLD_DL_SYMENT. 3.37 - #ifndef RTLD_DL_SYMENT 3.38 - #define RTLD_DL_SYMENT 1 3.39 - #endif 3.40 + if (dladdr1_func != NULL) { 3.41 + // yes, we have dladdr1 3.42 + 3.43 + // Support for dladdr1 is checked at runtime; it may be 3.44 + // available even if the vm is built on a machine that does 3.45 + // not have dladdr1 support. Make sure there is a value for 3.46 + // RTLD_DL_SYMENT. 3.47 + #ifndef RTLD_DL_SYMENT 3.48 + #define RTLD_DL_SYMENT 1 3.49 + #endif 3.50 #ifdef _LP64 3.51 - Elf64_Sym * info; 3.52 + Elf64_Sym * info; 3.53 #else 3.54 - Elf32_Sym * info; 3.55 + Elf32_Sym * info; 3.56 #endif 3.57 - if (dladdr1_func((void *)addr, &dlinfo, (void **)&info, 3.58 - RTLD_DL_SYMENT)) { 3.59 - if ((char *)dlinfo.dli_saddr + info->st_size > (char *)addr) { 3.60 - if (buf != NULL) { 3.61 - if (!Decoder::demangle(dlinfo.dli_sname, buf, buflen)) 3.62 - jio_snprintf(buf, buflen, "%s", dlinfo.dli_sname); 3.63 - } 3.64 - if (offset != NULL) *offset = addr - (address)dlinfo.dli_saddr; 3.65 - return true; 3.66 - } 3.67 - } 3.68 - if (dlinfo.dli_fname != NULL && dlinfo.dli_fbase != 0) { 3.69 - if (Decoder::decode((address)(addr - (address)dlinfo.dli_fbase), 3.70 - buf, buflen, offset, dlinfo.dli_fname)) { 3.71 + if (dladdr1_func((void *)addr, &dlinfo, (void **)&info, 3.72 + RTLD_DL_SYMENT) != 0) { 3.73 + // see if we have a matching symbol that covers our address 3.74 + if (dlinfo.dli_saddr != NULL && 3.75 + (char *)dlinfo.dli_saddr + info->st_size > (char *)addr) { 3.76 + if (dlinfo.dli_sname != NULL) { 3.77 + if (!Decoder::demangle(dlinfo.dli_sname, buf, buflen)) { 3.78 + jio_snprintf(buf, buflen, "%s", dlinfo.dli_sname); 3.79 + } 3.80 + if (offset != NULL) *offset = addr - (address)dlinfo.dli_saddr; 3.81 return true; 3.82 } 3.83 } 3.84 - if (buf != NULL) buf[0] = '\0'; 3.85 - if (offset != NULL) *offset = -1; 3.86 - return false; 3.87 - } else { 3.88 - // no, only dladdr is available 3.89 - if (dladdr((void *)addr, &dlinfo)) { 3.90 - if (buf != NULL) { 3.91 - if (!Decoder::demangle(dlinfo.dli_sname, buf, buflen)) 3.92 - jio_snprintf(buf, buflen, dlinfo.dli_sname); 3.93 - } 3.94 - if (offset != NULL) *offset = addr - (address)dlinfo.dli_saddr; 3.95 - return true; 3.96 - } else if (dlinfo.dli_fname != NULL && dlinfo.dli_fbase != 0) { 3.97 + // no matching symbol so try for just file info 3.98 + if (dlinfo.dli_fname != NULL && dlinfo.dli_fbase != NULL) { 3.99 if (Decoder::decode((address)(addr - (address)dlinfo.dli_fbase), 3.100 - buf, buflen, offset, dlinfo.dli_fname)) { 3.101 + buf, buflen, offset, dlinfo.dli_fname)) { 3.102 return true; 3.103 } 3.104 } 3.105 - if (buf != NULL) buf[0] = '\0'; 3.106 - if (offset != NULL) *offset = -1; 3.107 - return false; 3.108 - } 3.109 + } 3.110 + buf[0] = '\0'; 3.111 + if (offset != NULL) *offset = -1; 3.112 + return false; 3.113 + } 3.114 + 3.115 + // no, only dladdr is available 3.116 + if (dladdr((void *)addr, &dlinfo) != 0) { 3.117 + // see if we have a matching symbol 3.118 + if (dlinfo.dli_saddr != NULL && dlinfo.dli_sname != NULL) { 3.119 + if (!Decoder::demangle(dlinfo.dli_sname, buf, buflen)) { 3.120 + jio_snprintf(buf, buflen, dlinfo.dli_sname); 3.121 + } 3.122 + if (offset != NULL) *offset = addr - (address)dlinfo.dli_saddr; 3.123 + return true; 3.124 + } 3.125 + // no matching symbol so try for just file info 3.126 + if (dlinfo.dli_fname != NULL && dlinfo.dli_fbase != NULL) { 3.127 + if (Decoder::decode((address)(addr - (address)dlinfo.dli_fbase), 3.128 + buf, buflen, offset, dlinfo.dli_fname)) { 3.129 + return true; 3.130 + } 3.131 + } 3.132 + } 3.133 + buf[0] = '\0'; 3.134 + if (offset != NULL) *offset = -1; 3.135 + return false; 3.136 } 3.137 3.138 bool os::dll_address_to_library_name(address addr, char* buf, 3.139 int buflen, int* offset) { 3.140 + // buf is not optional, but offset is optional 3.141 + assert(buf != NULL, "sanity check"); 3.142 + 3.143 Dl_info dlinfo; 3.144 3.145 - if (dladdr((void*)addr, &dlinfo)){ 3.146 - if (buf) jio_snprintf(buf, buflen, "%s", dlinfo.dli_fname); 3.147 - if (offset) *offset = addr - (address)dlinfo.dli_fbase; 3.148 - return true; 3.149 - } else { 3.150 - if (buf) buf[0] = '\0'; 3.151 - if (offset) *offset = -1; 3.152 - return false; 3.153 - } 3.154 + if (dladdr((void*)addr, &dlinfo) != 0) { 3.155 + if (dlinfo.dli_fname != NULL) { 3.156 + jio_snprintf(buf, buflen, "%s", dlinfo.dli_fname); 3.157 + } 3.158 + if (dlinfo.dli_fbase != NULL && offset != NULL) { 3.159 + *offset = addr - (address)dlinfo.dli_fbase; 3.160 + } 3.161 + return true; 3.162 + } 3.163 + 3.164 + buf[0] = '\0'; 3.165 + if (offset) *offset = -1; 3.166 + return false; 3.167 } 3.168 3.169 // Prints the names and full paths of all opened dynamic libraries 3.170 // for current process 3.171 void os::print_dll_info(outputStream * st) { 3.172 - Dl_info dli; 3.173 - void *handle; 3.174 - Link_map *map; 3.175 - Link_map *p; 3.176 - 3.177 - st->print_cr("Dynamic libraries:"); st->flush(); 3.178 - 3.179 - if (!dladdr(CAST_FROM_FN_PTR(void *, os::print_dll_info), &dli)) { 3.180 - st->print_cr("Error: Cannot print dynamic libraries."); 3.181 - return; 3.182 - } 3.183 - handle = dlopen(dli.dli_fname, RTLD_LAZY); 3.184 - if (handle == NULL) { 3.185 - st->print_cr("Error: Cannot print dynamic libraries."); 3.186 - return; 3.187 - } 3.188 - dlinfo(handle, RTLD_DI_LINKMAP, &map); 3.189 - if (map == NULL) { 3.190 - st->print_cr("Error: Cannot print dynamic libraries."); 3.191 - return; 3.192 - } 3.193 - 3.194 - while (map->l_prev != NULL) 3.195 - map = map->l_prev; 3.196 - 3.197 - while (map != NULL) { 3.198 - st->print_cr(PTR_FORMAT " \t%s", map->l_addr, map->l_name); 3.199 - map = map->l_next; 3.200 - } 3.201 - 3.202 - dlclose(handle); 3.203 + Dl_info dli; 3.204 + void *handle; 3.205 + Link_map *map; 3.206 + Link_map *p; 3.207 + 3.208 + st->print_cr("Dynamic libraries:"); st->flush(); 3.209 + 3.210 + if (dladdr(CAST_FROM_FN_PTR(void *, os::print_dll_info), &dli) == 0 || 3.211 + dli.dli_fname == NULL) { 3.212 + st->print_cr("Error: Cannot print dynamic libraries."); 3.213 + return; 3.214 + } 3.215 + handle = dlopen(dli.dli_fname, RTLD_LAZY); 3.216 + if (handle == NULL) { 3.217 + st->print_cr("Error: Cannot print dynamic libraries."); 3.218 + return; 3.219 + } 3.220 + dlinfo(handle, RTLD_DI_LINKMAP, &map); 3.221 + if (map == NULL) { 3.222 + st->print_cr("Error: Cannot print dynamic libraries."); 3.223 + return; 3.224 + } 3.225 + 3.226 + while (map->l_prev != NULL) 3.227 + map = map->l_prev; 3.228 + 3.229 + while (map != NULL) { 3.230 + st->print_cr(PTR_FORMAT " \t%s", map->l_addr, map->l_name); 3.231 + map = map->l_next; 3.232 + } 3.233 + 3.234 + dlclose(handle); 3.235 } 3.236 3.237 // Loads .dll/.so and 3.238 @@ -2475,7 +2495,12 @@ 3.239 Dl_info dlinfo; 3.240 int ret = dladdr(CAST_FROM_FN_PTR(void *, os::jvm_path), &dlinfo); 3.241 assert(ret != 0, "cannot locate libjvm"); 3.242 - realpath((char *)dlinfo.dli_fname, buf); 3.243 + if (ret != 0 && dlinfo.dli_fname != NULL) { 3.244 + realpath((char *)dlinfo.dli_fname, buf); 3.245 + } else { 3.246 + buf[0] = '\0'; 3.247 + return; 3.248 + } 3.249 3.250 if (Arguments::created_by_gamma_launcher()) { 3.251 // Support for the gamma launcher. Typical value for buf is 3.252 @@ -6077,24 +6102,20 @@ 3.253 bool os::find(address addr, outputStream* st) { 3.254 Dl_info dlinfo; 3.255 memset(&dlinfo, 0, sizeof(dlinfo)); 3.256 - if (dladdr(addr, &dlinfo)) { 3.257 -#ifdef _LP64 3.258 - st->print("0x%016lx: ", addr); 3.259 -#else 3.260 - st->print("0x%08x: ", addr); 3.261 -#endif 3.262 - if (dlinfo.dli_sname != NULL) 3.263 + if (dladdr(addr, &dlinfo) != 0) { 3.264 + st->print(PTR_FORMAT ": ", addr); 3.265 + if (dlinfo.dli_sname != NULL && dlinfo.dli_saddr != NULL) { 3.266 st->print("%s+%#lx", dlinfo.dli_sname, addr-(intptr_t)dlinfo.dli_saddr); 3.267 - else if (dlinfo.dli_fname) 3.268 + } else if (dlinfo.dli_fbase != NULL) 3.269 st->print("<offset %#lx>", addr-(intptr_t)dlinfo.dli_fbase); 3.270 else 3.271 st->print("<absolute address>"); 3.272 - if (dlinfo.dli_fname) st->print(" in %s", dlinfo.dli_fname); 3.273 -#ifdef _LP64 3.274 - if (dlinfo.dli_fbase) st->print(" at 0x%016lx", dlinfo.dli_fbase); 3.275 -#else 3.276 - if (dlinfo.dli_fbase) st->print(" at 0x%08x", dlinfo.dli_fbase); 3.277 -#endif 3.278 + if (dlinfo.dli_fname != NULL) { 3.279 + st->print(" in %s", dlinfo.dli_fname); 3.280 + } 3.281 + if (dlinfo.dli_fbase != NULL) { 3.282 + st->print(" at " PTR_FORMAT, dlinfo.dli_fbase); 3.283 + } 3.284 st->cr(); 3.285 3.286 if (Verbose) { 3.287 @@ -6105,7 +6126,7 @@ 3.288 if (!lowest) lowest = (address) dlinfo.dli_fbase; 3.289 if (begin < lowest) begin = lowest; 3.290 Dl_info dlinfo2; 3.291 - if (dladdr(end, &dlinfo2) && dlinfo2.dli_saddr != dlinfo.dli_saddr 3.292 + if (dladdr(end, &dlinfo2) != 0 && dlinfo2.dli_saddr != dlinfo.dli_saddr 3.293 && end > dlinfo2.dli_saddr && dlinfo2.dli_saddr > begin) 3.294 end = (address) dlinfo2.dli_saddr; 3.295 Disassembler::decode(begin, end, st);
4.1 --- a/src/os/windows/vm/os_windows.cpp Thu Jul 04 14:56:49 2013 -0700 4.2 +++ b/src/os/windows/vm/os_windows.cpp Fri Jul 05 08:09:40 2013 -0700 4.3 @@ -1420,34 +1420,40 @@ 4.4 4.5 bool os::dll_address_to_library_name(address addr, char* buf, 4.6 int buflen, int* offset) { 4.7 + // buf is not optional, but offset is optional 4.8 + assert(buf != NULL, "sanity check"); 4.9 + 4.10 // NOTE: the reason we don't use SymGetModuleInfo() is it doesn't always 4.11 // return the full path to the DLL file, sometimes it returns path 4.12 // to the corresponding PDB file (debug info); sometimes it only 4.13 // returns partial path, which makes life painful. 4.14 4.15 - struct _modinfo mi; 4.16 - mi.addr = addr; 4.17 - mi.full_path = buf; 4.18 - mi.buflen = buflen; 4.19 - int pid = os::current_process_id(); 4.20 - if (enumerate_modules(pid, _locate_module_by_addr, (void *)&mi)) { 4.21 - // buf already contains path name 4.22 - if (offset) *offset = addr - mi.base_addr; 4.23 - return true; 4.24 - } else { 4.25 - if (buf) buf[0] = '\0'; 4.26 - if (offset) *offset = -1; 4.27 - return false; 4.28 - } 4.29 + struct _modinfo mi; 4.30 + mi.addr = addr; 4.31 + mi.full_path = buf; 4.32 + mi.buflen = buflen; 4.33 + int pid = os::current_process_id(); 4.34 + if (enumerate_modules(pid, _locate_module_by_addr, (void *)&mi)) { 4.35 + // buf already contains path name 4.36 + if (offset) *offset = addr - mi.base_addr; 4.37 + return true; 4.38 + } 4.39 + 4.40 + buf[0] = '\0'; 4.41 + if (offset) *offset = -1; 4.42 + return false; 4.43 } 4.44 4.45 bool os::dll_address_to_function_name(address addr, char *buf, 4.46 int buflen, int *offset) { 4.47 + // buf is not optional, but offset is optional 4.48 + assert(buf != NULL, "sanity check"); 4.49 + 4.50 if (Decoder::decode(addr, buf, buflen, offset)) { 4.51 return true; 4.52 } 4.53 if (offset != NULL) *offset = -1; 4.54 - if (buf != NULL) buf[0] = '\0'; 4.55 + buf[0] = '\0'; 4.56 return false; 4.57 } 4.58 4.59 @@ -2689,6 +2695,19 @@ 4.60 } 4.61 #endif 4.62 4.63 +#ifndef PRODUCT 4.64 +void os::win32::call_test_func_with_wrapper(void (*funcPtr)(void)) { 4.65 + // Install a win32 structured exception handler around the test 4.66 + // function call so the VM can generate an error dump if needed. 4.67 + __try { 4.68 + (*funcPtr)(); 4.69 + } __except(topLevelExceptionFilter( 4.70 + (_EXCEPTION_POINTERS*)_exception_info())) { 4.71 + // Nothing to do. 4.72 + } 4.73 +} 4.74 +#endif 4.75 + 4.76 // Virtual Memory 4.77 4.78 int os::vm_page_size() { return os::win32::vm_page_size(); }
5.1 --- a/src/os/windows/vm/os_windows.hpp Thu Jul 04 14:56:49 2013 -0700 5.2 +++ b/src/os/windows/vm/os_windows.hpp Fri Jul 05 08:09:40 2013 -0700 5.3 @@ -1,5 +1,5 @@ 5.4 /* 5.5 - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 5.6 + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 5.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 5.8 * 5.9 * This code is free software; you can redistribute it and/or modify it 5.10 @@ -94,6 +94,10 @@ 5.11 static address fast_jni_accessor_wrapper(BasicType); 5.12 #endif 5.13 5.14 +#ifndef PRODUCT 5.15 + static void call_test_func_with_wrapper(void (*funcPtr)(void)); 5.16 +#endif 5.17 + 5.18 // filter function to ignore faults on serializations page 5.19 static LONG WINAPI serialize_fault_filter(struct _EXCEPTION_POINTERS* e); 5.20 };
6.1 --- a/src/os/windows/vm/os_windows.inline.hpp Thu Jul 04 14:56:49 2013 -0700 6.2 +++ b/src/os/windows/vm/os_windows.inline.hpp Fri Jul 05 08:09:40 2013 -0700 6.3 @@ -106,4 +106,10 @@ 6.4 inline int os::close(int fd) { 6.5 return ::close(fd); 6.6 } 6.7 + 6.8 +#ifndef PRODUCT 6.9 + #define CALL_TEST_FUNC_WITH_WRAPPER_IF_NEEDED(f) \ 6.10 + os::win32::call_test_func_with_wrapper(f) 6.11 +#endif 6.12 + 6.13 #endif // OS_WINDOWS_VM_OS_WINDOWS_INLINE_HPP
7.1 --- a/src/share/vm/prims/jni.cpp Thu Jul 04 14:56:49 2013 -0700 7.2 +++ b/src/share/vm/prims/jni.cpp Fri Jul 05 08:09:40 2013 -0700 7.3 @@ -5097,7 +5097,7 @@ 7.4 // function used to determine this will always return false. Atomic::xchg 7.5 // does not have this problem. 7.6 if (Atomic::xchg(1, &vm_created) == 1) { 7.7 - return JNI_ERR; // already created, or create attempt in progress 7.8 + return JNI_EEXIST; // already created, or create attempt in progress 7.9 } 7.10 if (Atomic::xchg(0, &safe_to_recreate_vm) == 0) { 7.11 return JNI_ERR; // someone tried and failed and retry not allowed. 7.12 @@ -5138,9 +5138,21 @@ 7.13 event.commit(); 7.14 } 7.15 7.16 +#ifndef PRODUCT 7.17 + #ifndef TARGET_OS_FAMILY_windows 7.18 + #define CALL_TEST_FUNC_WITH_WRAPPER_IF_NEEDED(f) f() 7.19 + #endif 7.20 + 7.21 // Check if we should compile all classes on bootclasspath 7.22 - NOT_PRODUCT(if (CompileTheWorld) ClassLoader::compile_the_world();) 7.23 - NOT_PRODUCT(if (ReplayCompiles) ciReplay::replay(thread);) 7.24 + if (CompileTheWorld) ClassLoader::compile_the_world(); 7.25 + if (ReplayCompiles) ciReplay::replay(thread); 7.26 + 7.27 + // Some platforms (like Win*) need a wrapper around these test 7.28 + // functions in order to properly handle error conditions. 7.29 + CALL_TEST_FUNC_WITH_WRAPPER_IF_NEEDED(test_error_handler); 7.30 + CALL_TEST_FUNC_WITH_WRAPPER_IF_NEEDED(execute_internal_vm_tests); 7.31 +#endif 7.32 + 7.33 // Since this is not a JVM_ENTRY we have to set the thread state manually before leaving. 7.34 ThreadStateTransition::transition_and_fence(thread, _thread_in_vm, _thread_in_native); 7.35 } else { 7.36 @@ -5157,8 +5169,6 @@ 7.37 OrderAccess::release_store(&vm_created, 0); 7.38 } 7.39 7.40 - NOT_PRODUCT(test_error_handler(ErrorHandlerTest)); 7.41 - NOT_PRODUCT(execute_internal_vm_tests()); 7.42 return result; 7.43 } 7.44
8.1 --- a/src/share/vm/runtime/os.hpp Thu Jul 04 14:56:49 2013 -0700 8.2 +++ b/src/share/vm/runtime/os.hpp Fri Jul 05 08:09:40 2013 -0700 8.3 @@ -507,16 +507,16 @@ 8.4 8.5 // Symbol lookup, find nearest function name; basically it implements 8.6 // dladdr() for all platforms. Name of the nearest function is copied 8.7 - // to buf. Distance from its base address is returned as offset. 8.8 + // to buf. Distance from its base address is optionally returned as offset. 8.9 // If function name is not found, buf[0] is set to '\0' and offset is 8.10 - // set to -1. 8.11 + // set to -1 (if offset is non-NULL). 8.12 static bool dll_address_to_function_name(address addr, char* buf, 8.13 int buflen, int* offset); 8.14 8.15 // Locate DLL/DSO. On success, full path of the library is copied to 8.16 - // buf, and offset is set to be the distance between addr and the 8.17 - // library's base address. On failure, buf[0] is set to '\0' and 8.18 - // offset is set to -1. 8.19 + // buf, and offset is optionally set to be the distance between addr 8.20 + // and the library's base address. On failure, buf[0] is set to '\0' 8.21 + // and offset is set to -1 (if offset is non-NULL). 8.22 static bool dll_address_to_library_name(address addr, char* buf, 8.23 int buflen, int* offset); 8.24
9.1 --- a/src/share/vm/services/memTracker.hpp Thu Jul 04 14:56:49 2013 -0700 9.2 +++ b/src/share/vm/services/memTracker.hpp Fri Jul 05 08:09:40 2013 -0700 9.3 @@ -470,7 +470,21 @@ 9.4 static void check_NMT_load(Thread* thr) { 9.5 assert(thr != NULL, "Sanity check"); 9.6 if (_slowdown_calling_thread && thr != _worker_thread) { 9.7 +#ifdef _WINDOWS 9.8 + // On Windows, os::NakedYield() does not work as well 9.9 + // as os::yield_all() 9.10 os::yield_all(); 9.11 +#else 9.12 + // On Solaris, os::yield_all() depends on os::sleep() 9.13 + // which requires JavaTherad in _thread_in_vm state. 9.14 + // Transits thread to _thread_in_vm state can be dangerous 9.15 + // if caller holds lock, as it may deadlock with Threads_lock. 9.16 + // So use NaKedYield instead. 9.17 + // 9.18 + // Linux and BSD, NakedYield() and yield_all() implementations 9.19 + // are the same. 9.20 + os::NakedYield(); 9.21 +#endif 9.22 } 9.23 } 9.24
10.1 --- a/src/share/vm/utilities/debug.cpp Thu Jul 04 14:56:49 2013 -0700 10.2 +++ b/src/share/vm/utilities/debug.cpp Fri Jul 05 08:09:40 2013 -0700 10.3 @@ -314,8 +314,8 @@ 10.4 #ifndef PRODUCT 10.5 #include <signal.h> 10.6 10.7 -void test_error_handler(size_t test_num) 10.8 -{ 10.9 +void test_error_handler() { 10.10 + uintx test_num = ErrorHandlerTest; 10.11 if (test_num == 0) return; 10.12 10.13 // If asserts are disabled, use the corresponding guarantee instead. 10.14 @@ -327,6 +327,8 @@ 10.15 10.16 const char* const eol = os::line_separator(); 10.17 const char* const msg = "this message should be truncated during formatting"; 10.18 + char * const dataPtr = NULL; // bad data pointer 10.19 + const void (*funcPtr)(void) = (const void(*)()) 0xF; // bad function pointer 10.20 10.21 // Keep this in sync with test/runtime/6888954/vmerrors.sh. 10.22 switch (n) { 10.23 @@ -348,11 +350,16 @@ 10.24 case 9: ShouldNotCallThis(); 10.25 case 10: ShouldNotReachHere(); 10.26 case 11: Unimplemented(); 10.27 - // This is last because it does not generate an hs_err* file on Windows. 10.28 - case 12: os::signal_raise(SIGSEGV); 10.29 + // There's no guarantee the bad data pointer will crash us 10.30 + // so "break" out to the ShouldNotReachHere(). 10.31 + case 12: *dataPtr = '\0'; break; 10.32 + // There's no guarantee the bad function pointer will crash us 10.33 + // so "break" out to the ShouldNotReachHere(). 10.34 + case 13: (*funcPtr)(); break; 10.35 10.36 - default: ShouldNotReachHere(); 10.37 + default: tty->print_cr("ERROR: %d: unexpected test_num value.", n); 10.38 } 10.39 + ShouldNotReachHere(); 10.40 } 10.41 #endif // !PRODUCT 10.42
11.1 --- a/src/share/vm/utilities/debug.hpp Thu Jul 04 14:56:49 2013 -0700 11.2 +++ b/src/share/vm/utilities/debug.hpp Fri Jul 05 08:09:40 2013 -0700 11.3 @@ -1,5 +1,5 @@ 11.4 /* 11.5 - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 11.6 + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 11.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 11.8 * 11.9 * This code is free software; you can redistribute it and/or modify it 11.10 @@ -243,7 +243,7 @@ 11.11 void set_error_reported(); 11.12 11.13 /* Test assert(), fatal(), guarantee(), etc. */ 11.14 -NOT_PRODUCT(void test_error_handler(size_t test_num);) 11.15 +NOT_PRODUCT(void test_error_handler();) 11.16 11.17 void pd_ps(frame f); 11.18 void pd_obfuscate_location(char *buf, size_t buflen);
12.1 --- a/src/share/vm/utilities/vmError.cpp Thu Jul 04 14:56:49 2013 -0700 12.2 +++ b/src/share/vm/utilities/vmError.cpp Fri Jul 05 08:09:40 2013 -0700 12.3 @@ -908,10 +908,11 @@ 12.4 // This is not the first error, see if it happened in a different thread 12.5 // or in the same thread during error reporting. 12.6 if (first_error_tid != mytid) { 12.7 - jio_snprintf(buffer, sizeof(buffer), 12.8 + char msgbuf[64]; 12.9 + jio_snprintf(msgbuf, sizeof(msgbuf), 12.10 "[thread " INT64_FORMAT " also had an error]", 12.11 mytid); 12.12 - out.print_raw_cr(buffer); 12.13 + out.print_raw_cr(msgbuf); 12.14 12.15 // error reporting is not MT-safe, block current thread 12.16 os::infinite_sleep();
13.1 --- a/test/runtime/6888954/vmerrors.sh Thu Jul 04 14:56:49 2013 -0700 13.2 +++ b/test/runtime/6888954/vmerrors.sh Fri Jul 05 08:09:40 2013 -0700 13.3 @@ -1,5 +1,6 @@ 13.4 # @test 13.5 # @bug 6888954 13.6 +# @bug 8015884 13.7 # @summary exercise HotSpot error handling code 13.8 # @author John Coomes 13.9 # @run shell vmerrors.sh 13.10 @@ -27,9 +28,24 @@ 13.11 rc=0 13.12 13.13 assert_re='(assert|guarantee)[(](str|num).*failed: *' 13.14 +# for bad_data_ptr_re: 13.15 +# EXCEPTION_ACCESS_VIOLATION - Win-* 13.16 +# SIGILL - MacOS X 13.17 +# SIGSEGV - Linux-*, Solaris SPARC-*, Solaris X86-* 13.18 +# 13.19 +bad_data_ptr_re='(SIGILL|SIGSEGV|EXCEPTION_ACCESS_VIOLATION).* at pc=' 13.20 +# 13.21 +# for bad_func_ptr_re: 13.22 +# EXCEPTION_ACCESS_VIOLATION - Win-* 13.23 +# SIGBUS - Solaris SPARC-64 13.24 +# SIGSEGV - Linux-*, Solaris SPARC-32, Solaris X86-* 13.25 +# 13.26 +# Note: would like to use "pc=0x00*0f," in the pattern, but Solaris SPARC-* 13.27 +# gets its signal at a PC in test_error_handler(). 13.28 +# 13.29 +bad_func_ptr_re='(SIGBUS|SIGSEGV|EXCEPTION_ACCESS_VIOLATION).* at pc=' 13.30 guarantee_re='guarantee[(](str|num).*failed: *' 13.31 fatal_re='fatal error: *' 13.32 -signal_re='(SIGSEGV|EXCEPTION_ACCESS_VIOLATION).* at pc=' 13.33 tail_1='.*expected null' 13.34 tail_2='.*num=' 13.35 13.36 @@ -39,8 +55,9 @@ 13.37 "${fatal_re}${tail_1}" "${fatal_re}${tail_2}" \ 13.38 "${fatal_re}.*truncated" "ChunkPool::allocate" \ 13.39 "ShouldNotCall" "ShouldNotReachHere" \ 13.40 - "Unimplemented" "$signal_re" 13.41 - 13.42 + "Unimplemented" "$bad_data_ptr_re" \ 13.43 + "$bad_func_ptr_re" 13.44 + 13.45 do 13.46 i2=$i 13.47 [ $i -lt 10 ] && i2=0$i