Wed, 14 Jan 2009 19:45:01 -0800
6786948: SA on core file fails on solaris-amd64 if vm started with -XX:+StartAttachListener
Reviewed-by: jjh, dcubed
agent/src/os/linux/ps_core.c | file | annotate | diff | comparison | revisions | |
agent/src/os/solaris/proc/saproc.cpp | file | annotate | diff | comparison | revisions |
1.1 --- a/agent/src/os/linux/ps_core.c Tue Jan 13 17:39:03 2009 -0800 1.2 +++ b/agent/src/os/linux/ps_core.c Wed Jan 14 19:45:01 2009 -0800 1.3 @@ -238,8 +238,8 @@ 1.4 // Ignore the rest of the FileMapHeader. We don't need those fields here. 1.5 }; 1.6 1.7 -static bool read_int(struct ps_prochandle* ph, uintptr_t addr, int* pvalue) { 1.8 - int i; 1.9 +static bool read_jboolean(struct ps_prochandle* ph, uintptr_t addr, jboolean* pvalue) { 1.10 + jboolean i; 1.11 if (ps_pdread(ph, (psaddr_t) addr, &i, sizeof(i)) == PS_OK) { 1.12 *pvalue = i; 1.13 return true; 1.14 @@ -295,7 +295,7 @@ 1.15 int fd = -1, m = 0; 1.16 uintptr_t base = 0, useSharedSpacesAddr = 0; 1.17 uintptr_t sharedArchivePathAddrAddr = 0, sharedArchivePathAddr = 0; 1.18 - int useSharedSpaces = 0; 1.19 + jboolean useSharedSpaces = 0; 1.20 map_info* mi = 0; 1.21 1.22 memset(classes_jsa, 0, sizeof(classes_jsa)); 1.23 @@ -306,12 +306,15 @@ 1.24 return false; 1.25 } 1.26 1.27 - if (read_int(ph, useSharedSpacesAddr, &useSharedSpaces) != true) { 1.28 + // Hotspot vm types are not exported to build this library. So 1.29 + // using equivalent type jboolean to read the value of 1.30 + // UseSharedSpaces which is same as hotspot type "bool". 1.31 + if (read_jboolean(ph, useSharedSpacesAddr, &useSharedSpaces) != true) { 1.32 print_debug("can't read the value of 'UseSharedSpaces' flag\n"); 1.33 return false; 1.34 } 1.35 1.36 - if (useSharedSpaces == 0) { 1.37 + if ((int)useSharedSpaces == 0) { 1.38 print_debug("UseSharedSpaces is false, assuming -Xshare:off!\n"); 1.39 return true; 1.40 }
2.1 --- a/agent/src/os/solaris/proc/saproc.cpp Tue Jan 13 17:39:03 2009 -0800 2.2 +++ b/agent/src/os/solaris/proc/saproc.cpp Wed Jan 14 19:45:01 2009 -0800 2.3 @@ -502,8 +502,8 @@ 2.4 }; 2.5 2.6 static bool 2.7 -read_int(struct ps_prochandle* ph, psaddr_t addr, int* pvalue) { 2.8 - int i; 2.9 +read_jboolean(struct ps_prochandle* ph, psaddr_t addr, jboolean* pvalue) { 2.10 + jboolean i; 2.11 if (ps_pread(ph, addr, &i, sizeof(i)) == PS_OK) { 2.12 *pvalue = i; 2.13 return true; 2.14 @@ -575,10 +575,13 @@ 2.15 } 2.16 2.17 // read the value of the flag "UseSharedSpaces" 2.18 - int value = 0; 2.19 - if (read_int(ph, useSharedSpacesAddr, &value) != true) { 2.20 + // Since hotspot types are not available to build this library. So 2.21 + // equivalent type "jboolean" is used to read the value of "UseSharedSpaces" 2.22 + // which is same as hotspot type "bool". 2.23 + jboolean value = 0; 2.24 + if (read_jboolean(ph, useSharedSpacesAddr, &value) != true) { 2.25 THROW_NEW_DEBUGGER_EXCEPTION_("can't read 'UseSharedSpaces' flag", 1); 2.26 - } else if (value == 0) { 2.27 + } else if ((int)value == 0) { 2.28 print_debug("UseSharedSpaces is false, assuming -Xshare:off!\n"); 2.29 return 1; 2.30 }