[multiple changes]
2003-03-10 2003-02-27 Mohan Embar <gnustuff@thisiscool.com> * include/jvm.h: removed declaration of _Jv_ThisExecutable() setter; made return value of getter const char* instead of char* * prims.cc: removed all references to _Jv_ThisExecutable(). These are in the platform-specific sections now. * posix.cc: define platform-specific _Jv_ThisExecutable(). Handle DISABLE_MAIN_ARGS and HAVE_PROC_SELF_EXE cases * win32.cc: define platform-specific _Jv_ThisExecutable() using GetModuleFilename() * java/lang/natRuntime.cc: set gnu.gcj.progname property to argv[0] instead of _Jv_ThisExecutable() 2003-03-10 Ranjit Mathew <rmathew@hotmail.com> * gnu/gcj/runtime/NameFinder.java (usingAddr2name): New flag that is set if we are using addr2name.awk instead of addr2line. (NameFinder): Set usingAddr2name if using addr2name.awk. (getExternalLabel): New native method to convert a method name to an external label. (lookup): Convert name given by addr2line to an external label before demangling. * gnu/gcj/runtime/natNameFinder.cc (LABEL_PREFIX): New string constant representing the prefix attached to method names to convert them to an external label. (gnu::gcj::runtime::NameFinder::getExternalLabel): Define using LABEL_PREFIX. From-SVN: r64111
This commit is contained in:
@@ -102,6 +102,11 @@ public class NameFinder
|
||||
private BufferedWriter addr2lineOut;
|
||||
private BufferedReader addr2lineIn;
|
||||
|
||||
/**
|
||||
* Flag set if using addr2name.awk instead of addr2line from binutils.
|
||||
*/
|
||||
private boolean usingAddr2name = false;
|
||||
|
||||
/**
|
||||
* Creates a new NameFinder. Call close to get rid of any resources
|
||||
* created while using the <code>lookup</code> methods.
|
||||
@@ -142,6 +147,7 @@ public class NameFinder
|
||||
{
|
||||
String[] exec = new String[] {"addr2name.awk", executable};
|
||||
addr2line = runtime.exec(exec);
|
||||
usingAddr2name = true;
|
||||
}
|
||||
catch (IOException ioe2) { addr2line = null; }
|
||||
}
|
||||
@@ -180,6 +186,11 @@ public class NameFinder
|
||||
*/
|
||||
native private String getAddrAsString(RawData addrs, int n);
|
||||
|
||||
/**
|
||||
* Returns the label that is exported for the given method name.
|
||||
*/
|
||||
native private String getExternalLabel(String name);
|
||||
|
||||
/**
|
||||
* If nth element of stack is an interpreted frame, return the
|
||||
* element representing the method being interpreted.
|
||||
@@ -212,6 +223,15 @@ public class NameFinder
|
||||
addr2lineOut.flush();
|
||||
name = addr2lineIn.readLine();
|
||||
file = addr2lineIn.readLine();
|
||||
|
||||
// addr2line uses symbolic debugging information instead
|
||||
// of the actually exported labels as addr2name.awk does.
|
||||
// This name might need some modification, depending on
|
||||
// the system, to make it a label like that returned
|
||||
// by addr2name.awk or dladdr.
|
||||
if (! usingAddr2name)
|
||||
if (name != null && ! "??".equals (name))
|
||||
name = getExternalLabel (name);
|
||||
}
|
||||
catch (IOException ioe) { addr2line = null; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user