VMThrowable.java (getStackTrace): Pass trace as-is to modified lookup().
* java/lang/VMThrowable.java (getStackTrace): Pass trace as-is to modified lookup(). * gnu/gcj/runtime/NameFinder.java (lookup): Change to take in a StackTraceElement directly. (newElement): New native helper method to create StackTraceElement bypassing Java access control. (createStackTraceElement): Use newElement() instead of directly calling StackTraceElement's constructor. * gnu/gcj/runtime/natNameFinder.cc (newElement): New method. From-SVN: r80541
This commit is contained in:
parent
886733617a
commit
84264cb69e
@ -1,3 +1,15 @@
|
|||||||
|
2004-04-09 Ranjit Mathew <rmathew@hotmail.com>
|
||||||
|
|
||||||
|
* java/lang/VMThrowable.java (getStackTrace): Pass trace as-is to
|
||||||
|
modified lookup().
|
||||||
|
* gnu/gcj/runtime/NameFinder.java (lookup): Change to take in a
|
||||||
|
StackTraceElement directly.
|
||||||
|
(newElement): New native helper method to create StackTraceElement
|
||||||
|
bypassing Java access control.
|
||||||
|
(createStackTraceElement): Use newElement() instead of directly
|
||||||
|
calling StackTraceElement's constructor.
|
||||||
|
* gnu/gcj/runtime/natNameFinder.cc (newElement): New method.
|
||||||
|
|
||||||
2004-04-01 Michael Koch <konqueror@gmx.de>
|
2004-04-01 Michael Koch <konqueror@gmx.de>
|
||||||
|
|
||||||
* java/lang/SecurityManager.java
|
* java/lang/SecurityManager.java
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* NameFinder.java -- Translates addresses to StackTraceElements.
|
/* NameFinder.java -- Translates addresses to StackTraceElements.
|
||||||
Copyright (C) 2002 Free Software Foundation, Inc.
|
Copyright (C) 2002, 2004 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of libgcj.
|
This file is part of libgcj.
|
||||||
|
|
||||||
@ -241,8 +241,11 @@ public class NameFinder
|
|||||||
* Given an Throwable and a native stacktrace returns an array of
|
* Given an Throwable and a native stacktrace returns an array of
|
||||||
* StackTraceElement containing class, method, file and linenumbers.
|
* StackTraceElement containing class, method, file and linenumbers.
|
||||||
*/
|
*/
|
||||||
public StackTraceElement[] lookup(Throwable t, RawData addrs, int length)
|
public StackTraceElement[] lookup(Throwable t, StackTrace trace)
|
||||||
{
|
{
|
||||||
|
RawData addrs = trace.stackTraceAddrs();
|
||||||
|
int length = trace.length();
|
||||||
|
|
||||||
StackTraceElement[] elements = new StackTraceElement[length];
|
StackTraceElement[] elements = new StackTraceElement[length];
|
||||||
for (int i=0; i < length; i++)
|
for (int i=0; i < length; i++)
|
||||||
elements[i] = lookup(addrs, i);
|
elements[i] = lookup(addrs, i);
|
||||||
@ -352,6 +355,16 @@ public class NameFinder
|
|||||||
return stack;
|
return stack;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Native helper method to create a StackTraceElement. Needed to work
|
||||||
|
* around normal Java access restrictions.
|
||||||
|
*/
|
||||||
|
native private StackTraceElement newElement(String fileName,
|
||||||
|
int lineNumber,
|
||||||
|
String className,
|
||||||
|
String methName,
|
||||||
|
boolean isNative);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a StackTraceElement given a string and a filename.
|
* Creates a StackTraceElement given a string and a filename.
|
||||||
* Splits the given string into the class and method part.
|
* Splits the given string into the class and method part.
|
||||||
@ -363,7 +376,7 @@ public class NameFinder
|
|||||||
private StackTraceElement createStackTraceElement(String name, String file)
|
private StackTraceElement createStackTraceElement(String name, String file)
|
||||||
{
|
{
|
||||||
if (!demangle)
|
if (!demangle)
|
||||||
return new StackTraceElement(file, -1, null, name, false);
|
return newElement(file, -1, null, name, false);
|
||||||
|
|
||||||
String s = demangleName(name);
|
String s = demangleName(name);
|
||||||
String methodName = s;
|
String methodName = s;
|
||||||
@ -409,7 +422,7 @@ public class NameFinder
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new StackTraceElement(fileName, line, className, methodName, false);
|
return newElement(fileName, line, className, methodName, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// natNameFinder.cc - native helper methods for NameFinder.java
|
// natNameFinder.cc - native helper methods for NameFinder.java
|
||||||
|
|
||||||
/* Copyright (C) 2002, 2003 Free Software Foundation, Inc
|
/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc
|
||||||
|
|
||||||
This file is part of libgcj.
|
This file is part of libgcj.
|
||||||
|
|
||||||
@ -48,6 +48,17 @@ details. */
|
|||||||
|
|
||||||
#endif /* ! __USER_LABEL_PREFIX__ */
|
#endif /* ! __USER_LABEL_PREFIX__ */
|
||||||
|
|
||||||
|
java::lang::StackTraceElement*
|
||||||
|
gnu::gcj::runtime::NameFinder::newElement (java::lang::String* fileName,
|
||||||
|
jint lineNumber,
|
||||||
|
java::lang::String* className,
|
||||||
|
java::lang::String* methName,
|
||||||
|
jboolean isNative)
|
||||||
|
{
|
||||||
|
return new java::lang::StackTraceElement( fileName, lineNumber,
|
||||||
|
className, methName, isNative);
|
||||||
|
}
|
||||||
|
|
||||||
java::lang::String*
|
java::lang::String*
|
||||||
gnu::gcj::runtime::NameFinder::getExternalLabel (java::lang::String* name)
|
gnu::gcj::runtime::NameFinder::getExternalLabel (java::lang::String* name)
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* java.lang.VMThrowable -- VM support methods for Throwable.
|
/* java.lang.VMThrowable -- VM support methods for Throwable.
|
||||||
Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
|
Copyright (C) 1998, 1999, 2002, 2004 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of GNU Classpath.
|
This file is part of GNU Classpath.
|
||||||
|
|
||||||
@ -96,8 +96,7 @@ final class VMThrowable
|
|||||||
if (trace != null)
|
if (trace != null)
|
||||||
{
|
{
|
||||||
NameFinder nameFinder = new NameFinder();
|
NameFinder nameFinder = new NameFinder();
|
||||||
result = nameFinder.lookup(t, trace.stackTraceAddrs(),
|
result = nameFinder.lookup(t, trace);
|
||||||
trace.length());
|
|
||||||
nameFinder.close();
|
nameFinder.close();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user