* stacktrace.cc (getLineNumberForFrame): Use _Jv_GetSafeArg.

From-SVN: r99733
This commit is contained in:
Tom Tromey 2005-05-15 17:07:20 +00:00 committed by Tom Tromey
parent 099ff66cd2
commit 55c15dfc9d
2 changed files with 7 additions and 3 deletions

View File

@ -1,3 +1,7 @@
2005-05-15 Tom Tromey <tromey@redhat.com>
* stacktrace.cc (getLineNumberForFrame): Use _Jv_GetSafeArg.
2005-05-13 Bryce McKinlay <mckinlay@redhat.com>
PR libgcj/21557

View File

@ -184,13 +184,13 @@ _Jv_StackTrace::getLineNumberForFrame(_Jv_StackFrame *frame, NameFinder *finder,
#endif
// Use dladdr() to determine in which binary the address IP resides.
#if defined (HAVE_DLFCN_H) && defined (HAVE_DLADDR)
extern char **_Jv_argv;
Dl_info info;
jstring binaryName = NULL;
const char *argv0 = _Jv_GetSafeArg(0);
void *ip = frame->ip;
_Unwind_Ptr offset = 0;
if (dladdr (ip, &info))
{
if (info.dli_fname)
@ -199,7 +199,7 @@ _Jv_StackTrace::getLineNumberForFrame(_Jv_StackFrame *frame, NameFinder *finder,
return;
// addr2line expects relative addresses for shared libraries.
if (strcmp (info.dli_fname, _Jv_argv[0]) == 0)
if (strcmp (info.dli_fname, argv0) == 0)
offset = (_Unwind_Ptr) ip;
else
offset = (_Unwind_Ptr) ip - (_Unwind_Ptr) info.dli_fbase;