提交 ef0a0f52 编写于 作者: S sla

8005038: remove crufty '_g' support from SA

Reviewed-by: coleenp, mgronlun, rbackman
上级 62c157b5
...@@ -199,10 +199,10 @@ static map_info* core_lookup(struct ps_prochandle *ph, uintptr_t addr) ...@@ -199,10 +199,10 @@ static map_info* core_lookup(struct ps_prochandle *ph, uintptr_t addr)
//--------------------------------------------------------------- //---------------------------------------------------------------
// Part of the class sharing workaround: // Part of the class sharing workaround:
// //
// With class sharing, pages are mapped from classes[_g].jsa file. // With class sharing, pages are mapped from classes.jsa file.
// The read-only class sharing pages are mapped as MAP_SHARED, // The read-only class sharing pages are mapped as MAP_SHARED,
// PROT_READ pages. These pages are not dumped into core dump. // PROT_READ pages. These pages are not dumped into core dump.
// With this workaround, these pages are read from classes[_g].jsa. // With this workaround, these pages are read from classes.jsa.
// FIXME: !HACK ALERT! // FIXME: !HACK ALERT!
// The format of sharing achive file header is needed to read shared heap // The format of sharing achive file header is needed to read shared heap
...@@ -298,14 +298,12 @@ static bool init_classsharing_workaround(struct ps_prochandle* ph) { ...@@ -298,14 +298,12 @@ static bool init_classsharing_workaround(struct ps_prochandle* ph) {
lib_info* lib = ph->libs; lib_info* lib = ph->libs;
while (lib != NULL) { while (lib != NULL) {
// we are iterating over shared objects from the core dump. look for // we are iterating over shared objects from the core dump. look for
// libjvm[_g].so. // libjvm.so.
const char *jvm_name = 0; const char *jvm_name = 0;
#ifdef __APPLE__ #ifdef __APPLE__
if ((jvm_name = strstr(lib->name, "/libjvm.dylib")) != 0 || if ((jvm_name = strstr(lib->name, "/libjvm.dylib")) != 0)
(jvm_name = strstr(lib->name, "/libjvm_g.dylib")) != 0)
#else #else
if ((jvm_name = strstr(lib->name, "/libjvm.so")) != 0 || if ((jvm_name = strstr(lib->name, "/libjvm.so")) != 0)
(jvm_name = strstr(lib->name, "/libjvm_g.so")) != 0)
#endif // __APPLE__ #endif // __APPLE__
{ {
char classes_jsa[PATH_MAX]; char classes_jsa[PATH_MAX];
...@@ -389,7 +387,7 @@ static bool init_classsharing_workaround(struct ps_prochandle* ph) { ...@@ -389,7 +387,7 @@ static bool init_classsharing_workaround(struct ps_prochandle* ph) {
} }
ph->core->classes_jsa_fd = fd; ph->core->classes_jsa_fd = fd;
// add read-only maps from classes[_g].jsa to the list of maps // add read-only maps from classes.jsa to the list of maps
for (m = 0; m < NUM_SHARED_MAPS; m++) { for (m = 0; m < NUM_SHARED_MAPS; m++) {
if (header._space[m]._read_only) { if (header._space[m]._read_only) {
base = (uintptr_t) header._space[m]._base; base = (uintptr_t) header._space[m]._base;
......
...@@ -195,10 +195,10 @@ static map_info* core_lookup(struct ps_prochandle *ph, uintptr_t addr) ...@@ -195,10 +195,10 @@ static map_info* core_lookup(struct ps_prochandle *ph, uintptr_t addr)
//--------------------------------------------------------------- //---------------------------------------------------------------
// Part of the class sharing workaround: // Part of the class sharing workaround:
// //
// With class sharing, pages are mapped from classes[_g].jsa file. // With class sharing, pages are mapped from classes.jsa file.
// The read-only class sharing pages are mapped as MAP_SHARED, // The read-only class sharing pages are mapped as MAP_SHARED,
// PROT_READ pages. These pages are not dumped into core dump. // PROT_READ pages. These pages are not dumped into core dump.
// With this workaround, these pages are read from classes[_g].jsa. // With this workaround, these pages are read from classes.jsa.
// FIXME: !HACK ALERT! // FIXME: !HACK ALERT!
// The format of sharing achive file header is needed to read shared heap // The format of sharing achive file header is needed to read shared heap
...@@ -284,10 +284,9 @@ static bool init_classsharing_workaround(struct ps_prochandle* ph) { ...@@ -284,10 +284,9 @@ static bool init_classsharing_workaround(struct ps_prochandle* ph) {
lib_info* lib = ph->libs; lib_info* lib = ph->libs;
while (lib != NULL) { while (lib != NULL) {
// we are iterating over shared objects from the core dump. look for // we are iterating over shared objects from the core dump. look for
// libjvm[_g].so. // libjvm.so.
const char *jvm_name = 0; const char *jvm_name = 0;
if ((jvm_name = strstr(lib->name, "/libjvm.so")) != 0 || if ((jvm_name = strstr(lib->name, "/libjvm.so")) != 0) {
(jvm_name = strstr(lib->name, "/libjvm_g.so")) != 0) {
char classes_jsa[PATH_MAX]; char classes_jsa[PATH_MAX];
struct FileMapHeader header; struct FileMapHeader header;
size_t n = 0; size_t n = 0;
...@@ -371,7 +370,7 @@ static bool init_classsharing_workaround(struct ps_prochandle* ph) { ...@@ -371,7 +370,7 @@ static bool init_classsharing_workaround(struct ps_prochandle* ph) {
} }
ph->core->classes_jsa_fd = fd; ph->core->classes_jsa_fd = fd;
// add read-only maps from classes[_g].jsa to the list of maps // add read-only maps from classes.jsa to the list of maps
for (m = 0; m < NUM_SHARED_MAPS; m++) { for (m = 0; m < NUM_SHARED_MAPS; m++) {
if (header._space[m]._read_only) { if (header._space[m]._read_only) {
base = (uintptr_t) header._space[m]._base; base = (uintptr_t) header._space[m]._base;
......
...@@ -589,8 +589,7 @@ init_classsharing_workaround(void *cd, const prmap_t* pmap, const char* obj_name ...@@ -589,8 +589,7 @@ init_classsharing_workaround(void *cd, const prmap_t* pmap, const char* obj_name
JNIEnv* env = dbg->env; JNIEnv* env = dbg->env;
jobject this_obj = dbg->this_obj; jobject this_obj = dbg->this_obj;
const char* jvm_name = 0; const char* jvm_name = 0;
if ((jvm_name = strstr(obj_name, "libjvm.so")) != NULL || if ((jvm_name = strstr(obj_name, "libjvm.so")) != NULL) {
(jvm_name = strstr(obj_name, "libjvm_g.so")) != NULL) {
jvm_name = obj_name; jvm_name = obj_name;
} else { } else {
return 0; return 0;
...@@ -598,7 +597,7 @@ init_classsharing_workaround(void *cd, const prmap_t* pmap, const char* obj_name ...@@ -598,7 +597,7 @@ init_classsharing_workaround(void *cd, const prmap_t* pmap, const char* obj_name
struct ps_prochandle* ph = (struct ps_prochandle*) env->GetLongField(this_obj, p_ps_prochandle_ID); struct ps_prochandle* ph = (struct ps_prochandle*) env->GetLongField(this_obj, p_ps_prochandle_ID);
// initialize classes[_g].jsa file descriptor field. // initialize classes.jsa file descriptor field.
dbg->env->SetIntField(this_obj, classes_jsa_fd_ID, -1); dbg->env->SetIntField(this_obj, classes_jsa_fd_ID, -1);
// check whether class sharing is on by reading variable "UseSharedSpaces" // check whether class sharing is on by reading variable "UseSharedSpaces"
...@@ -641,7 +640,7 @@ init_classsharing_workaround(void *cd, const prmap_t* pmap, const char* obj_name ...@@ -641,7 +640,7 @@ init_classsharing_workaround(void *cd, const prmap_t* pmap, const char* obj_name
print_debug("looking for %s\n", classes_jsa); print_debug("looking for %s\n", classes_jsa);
// open the classes[_g].jsa // open the classes.jsa
int fd = libsaproc_open(classes_jsa, O_RDONLY); int fd = libsaproc_open(classes_jsa, O_RDONLY);
if (fd < 0) { if (fd < 0) {
char errMsg[ERR_MSG_SIZE]; char errMsg[ERR_MSG_SIZE];
...@@ -651,7 +650,7 @@ init_classsharing_workaround(void *cd, const prmap_t* pmap, const char* obj_name ...@@ -651,7 +650,7 @@ init_classsharing_workaround(void *cd, const prmap_t* pmap, const char* obj_name
print_debug("opened shared archive file %s\n", classes_jsa); print_debug("opened shared archive file %s\n", classes_jsa);
} }
// parse classes[_g].jsa // parse classes.jsa
struct FileMapHeader* pheader = (struct FileMapHeader*) malloc(sizeof(struct FileMapHeader)); struct FileMapHeader* pheader = (struct FileMapHeader*) malloc(sizeof(struct FileMapHeader));
if (pheader == NULL) { if (pheader == NULL) {
close(fd); close(fd);
...@@ -798,8 +797,8 @@ static void attach_internal(JNIEnv* env, jobject this_obj, jstring cmdLine, jboo ...@@ -798,8 +797,8 @@ static void attach_internal(JNIEnv* env, jobject this_obj, jstring cmdLine, jboo
if (! isProcess) { if (! isProcess) {
/* /*
* With class sharing, shared perm. gen heap is allocated in with MAP_SHARED|PROT_READ. * With class sharing, shared perm. gen heap is allocated in with MAP_SHARED|PROT_READ.
* These pages are mapped from the file "classes[_g].jsa". MAP_SHARED pages are not dumped * These pages are mapped from the file "classes.jsa". MAP_SHARED pages are not dumped
* in Solaris core.To read shared heap pages, we have to read classes[_g].jsa file. * in Solaris core.To read shared heap pages, we have to read classes.jsa file.
*/ */
Pobject_iter(ph, init_classsharing_workaround, &dbg); Pobject_iter(ph, init_classsharing_workaround, &dbg);
exception = env->ExceptionOccurred(); exception = env->ExceptionOccurred();
......
...@@ -24,20 +24,29 @@ ...@@ -24,20 +24,29 @@
package sun.jvm.hotspot; package sun.jvm.hotspot;
import java.io.PrintStream; import java.rmi.RemoteException;
import java.net.*;
import java.rmi.*; import sun.jvm.hotspot.debugger.Debugger;
import sun.jvm.hotspot.debugger.*; import sun.jvm.hotspot.debugger.DebuggerException;
import sun.jvm.hotspot.debugger.bsd.*; import sun.jvm.hotspot.debugger.JVMDebugger;
import sun.jvm.hotspot.debugger.proc.*; import sun.jvm.hotspot.debugger.MachineDescription;
import sun.jvm.hotspot.debugger.remote.*; import sun.jvm.hotspot.debugger.MachineDescriptionAMD64;
import sun.jvm.hotspot.debugger.windbg.*; import sun.jvm.hotspot.debugger.MachineDescriptionIA64;
import sun.jvm.hotspot.debugger.linux.*; import sun.jvm.hotspot.debugger.MachineDescriptionIntelX86;
import sun.jvm.hotspot.memory.*; import sun.jvm.hotspot.debugger.MachineDescriptionSPARC32Bit;
import sun.jvm.hotspot.oops.*; import sun.jvm.hotspot.debugger.MachineDescriptionSPARC64Bit;
import sun.jvm.hotspot.runtime.*; import sun.jvm.hotspot.debugger.NoSuchSymbolException;
import sun.jvm.hotspot.types.*; import sun.jvm.hotspot.debugger.bsd.BsdDebuggerLocal;
import sun.jvm.hotspot.utilities.*; import sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal;
import sun.jvm.hotspot.debugger.proc.ProcDebuggerLocal;
import sun.jvm.hotspot.debugger.remote.RemoteDebugger;
import sun.jvm.hotspot.debugger.remote.RemoteDebuggerClient;
import sun.jvm.hotspot.debugger.remote.RemoteDebuggerServer;
import sun.jvm.hotspot.debugger.windbg.WindbgDebuggerLocal;
import sun.jvm.hotspot.runtime.VM;
import sun.jvm.hotspot.types.TypeDataBase;
import sun.jvm.hotspot.utilities.PlatformInfo;
import sun.jvm.hotspot.utilities.UnsupportedPlatformException;
/** <P> This class wraps much of the basic functionality and is the /** <P> This class wraps much of the basic functionality and is the
* highest-level factory for VM data structures. It makes it simple * highest-level factory for VM data structures. It makes it simple
...@@ -475,7 +484,7 @@ public class HotSpotAgent { ...@@ -475,7 +484,7 @@ public class HotSpotAgent {
} }
private void setupJVMLibNamesSolaris() { private void setupJVMLibNamesSolaris() {
jvmLibNames = new String[] { "libjvm.so", "libjvm_g.so", "gamma_g" }; jvmLibNames = new String[] { "libjvm.so" };
} }
// //
...@@ -507,7 +516,7 @@ public class HotSpotAgent { ...@@ -507,7 +516,7 @@ public class HotSpotAgent {
} }
private void setupJVMLibNamesWin32() { private void setupJVMLibNamesWin32() {
jvmLibNames = new String[] { "jvm.dll", "jvm_g.dll" }; jvmLibNames = new String[] { "jvm.dll" };
} }
// //
...@@ -547,7 +556,7 @@ public class HotSpotAgent { ...@@ -547,7 +556,7 @@ public class HotSpotAgent {
} }
private void setupJVMLibNamesLinux() { private void setupJVMLibNamesLinux() {
jvmLibNames = new String[] { "libjvm.so", "libjvm_g.so" }; jvmLibNames = new String[] { "libjvm.so" };
} }
// //
...@@ -572,7 +581,7 @@ public class HotSpotAgent { ...@@ -572,7 +581,7 @@ public class HotSpotAgent {
} }
private void setupJVMLibNamesBsd() { private void setupJVMLibNamesBsd() {
jvmLibNames = new String[] { "libjvm.so", "libjvm_g.so" }; jvmLibNames = new String[] { "libjvm.so" };
} }
// //
...@@ -595,7 +604,7 @@ public class HotSpotAgent { ...@@ -595,7 +604,7 @@ public class HotSpotAgent {
} }
private void setupJVMLibNamesDarwin() { private void setupJVMLibNamesDarwin() {
jvmLibNames = new String[] { "libjvm.dylib", "libjvm_g.dylib" }; jvmLibNames = new String[] { "libjvm.dylib" };
} }
/** Convenience routine which should be called by per-platform /** Convenience routine which should be called by per-platform
......
...@@ -24,9 +24,9 @@ ...@@ -24,9 +24,9 @@
package sun.jvm.hotspot; package sun.jvm.hotspot;
import sun.jvm.hotspot.debugger.*; import sun.jvm.hotspot.debugger.SymbolLookup;
import sun.jvm.hotspot.types.*; import sun.jvm.hotspot.types.Type;
import sun.jvm.hotspot.types.basic.*; import sun.jvm.hotspot.types.basic.BasicVtblAccess;
public class LinuxVtblAccess extends BasicVtblAccess { public class LinuxVtblAccess extends BasicVtblAccess {
private String vt; private String vt;
...@@ -35,8 +35,7 @@ public class LinuxVtblAccess extends BasicVtblAccess { ...@@ -35,8 +35,7 @@ public class LinuxVtblAccess extends BasicVtblAccess {
String[] dllNames) { String[] dllNames) {
super(symbolLookup, dllNames); super(symbolLookup, dllNames);
if (symbolLookup.lookup("libjvm.so", "__vt_10JavaThread") != null || if (symbolLookup.lookup("libjvm.so", "__vt_10JavaThread") != null) {
symbolLookup.lookup("libjvm_g.so", "__vt_10JavaThread") != null) {
// old C++ ABI // old C++ ABI
vt = "__vt_"; vt = "__vt_";
} else { } else {
......
...@@ -24,17 +24,28 @@ ...@@ -24,17 +24,28 @@
package sun.jvm.hotspot.debugger.bsd; package sun.jvm.hotspot.debugger.bsd;
import java.io.*; import java.io.File;
import java.net.*; import java.util.ArrayList;
import java.util.*; import java.util.List;
import sun.jvm.hotspot.debugger.*;
import sun.jvm.hotspot.debugger.x86.*; import sun.jvm.hotspot.debugger.Address;
import sun.jvm.hotspot.debugger.cdbg.*; import sun.jvm.hotspot.debugger.DebuggerBase;
import sun.jvm.hotspot.utilities.*; import sun.jvm.hotspot.debugger.DebuggerException;
import sun.jvm.hotspot.runtime.VM; import sun.jvm.hotspot.debugger.DebuggerUtilities;
import sun.jvm.hotspot.runtime.Threads; import sun.jvm.hotspot.debugger.MachineDescription;
import sun.jvm.hotspot.debugger.NotInHeapException;
import sun.jvm.hotspot.debugger.OopHandle;
import sun.jvm.hotspot.debugger.ReadResult;
import sun.jvm.hotspot.debugger.ThreadProxy;
import sun.jvm.hotspot.debugger.UnalignedAddressException;
import sun.jvm.hotspot.debugger.UnmappedAddressException;
import sun.jvm.hotspot.debugger.cdbg.CDebugger;
import sun.jvm.hotspot.debugger.cdbg.ClosestSymbol;
import sun.jvm.hotspot.debugger.cdbg.LoadObject;
import sun.jvm.hotspot.runtime.JavaThread; import sun.jvm.hotspot.runtime.JavaThread;
import java.lang.reflect.*; import sun.jvm.hotspot.runtime.Threads;
import sun.jvm.hotspot.runtime.VM;
import sun.jvm.hotspot.utilities.PlatformInfo;
/** <P> An implementation of the JVMDebugger interface. The basic debug /** <P> An implementation of the JVMDebugger interface. The basic debug
facilities are implemented through ptrace interface in the JNI code facilities are implemented through ptrace interface in the JNI code
...@@ -246,10 +257,8 @@ public class BsdDebuggerLocal extends DebuggerBase implements BsdDebugger { ...@@ -246,10 +257,8 @@ public class BsdDebuggerLocal extends DebuggerBase implements BsdDebugger {
/* called from attach methods */ /* called from attach methods */
private void findABIVersion() throws DebuggerException { private void findABIVersion() throws DebuggerException {
String libjvmName = isDarwin ? "libjvm.dylib" : "libjvm.so"; String libjvmName = isDarwin ? "libjvm.dylib" : "libjvm.so";
String libjvm_gName = isDarwin? "libjvm_g.dylib" : "libjvm_g.so";
String javaThreadVt = isDarwin ? "_vt_10JavaThread" : "__vt_10JavaThread"; String javaThreadVt = isDarwin ? "_vt_10JavaThread" : "__vt_10JavaThread";
if (lookupByName0(libjvmName, javaThreadVt) != 0 || if (lookupByName0(libjvmName, javaThreadVt) != 0) {
lookupByName0(libjvm_gName, javaThreadVt) != 0) {
// old C++ ABI // old C++ ABI
useGCC32ABI = false; useGCC32ABI = false;
} else { } else {
......
...@@ -24,14 +24,25 @@ ...@@ -24,14 +24,25 @@
package sun.jvm.hotspot.debugger.linux; package sun.jvm.hotspot.debugger.linux;
import java.io.*; import java.io.File;
import java.net.*; import java.util.ArrayList;
import java.util.*; import java.util.List;
import sun.jvm.hotspot.debugger.*;
import sun.jvm.hotspot.debugger.x86.*; import sun.jvm.hotspot.debugger.Address;
import sun.jvm.hotspot.debugger.cdbg.*; import sun.jvm.hotspot.debugger.DebuggerBase;
import sun.jvm.hotspot.utilities.*; import sun.jvm.hotspot.debugger.DebuggerException;
import java.lang.reflect.*; import sun.jvm.hotspot.debugger.DebuggerUtilities;
import sun.jvm.hotspot.debugger.MachineDescription;
import sun.jvm.hotspot.debugger.NotInHeapException;
import sun.jvm.hotspot.debugger.OopHandle;
import sun.jvm.hotspot.debugger.ReadResult;
import sun.jvm.hotspot.debugger.ThreadProxy;
import sun.jvm.hotspot.debugger.UnalignedAddressException;
import sun.jvm.hotspot.debugger.UnmappedAddressException;
import sun.jvm.hotspot.debugger.cdbg.CDebugger;
import sun.jvm.hotspot.debugger.cdbg.ClosestSymbol;
import sun.jvm.hotspot.debugger.cdbg.LoadObject;
import sun.jvm.hotspot.utilities.PlatformInfo;
/** <P> An implementation of the JVMDebugger interface. The basic debug /** <P> An implementation of the JVMDebugger interface. The basic debug
facilities are implemented through ptrace interface in the JNI code facilities are implemented through ptrace interface in the JNI code
...@@ -238,8 +249,7 @@ public class LinuxDebuggerLocal extends DebuggerBase implements LinuxDebugger { ...@@ -238,8 +249,7 @@ public class LinuxDebuggerLocal extends DebuggerBase implements LinuxDebugger {
/* called from attach methods */ /* called from attach methods */
private void findABIVersion() throws DebuggerException { private void findABIVersion() throws DebuggerException {
if (lookupByName0("libjvm.so", "__vt_10JavaThread") != 0 || if (lookupByName0("libjvm.so", "__vt_10JavaThread") != 0) {
lookupByName0("libjvm_g.so", "__vt_10JavaThread") != 0) {
// old C++ ABI // old C++ ABI
useGCC32ABI = false; useGCC32ABI = false;
} else { } else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册