aboutsummaryrefslogtreecommitdiff
path: root/libjava/stacktrace.cc
diff options
context:
space:
mode:
authorJack Howarth <howarth@bromo.med.uc.edu>2006-09-27 21:24:23 +0000
committerTom Tromey <tromey@gcc.gnu.org>2006-09-27 21:24:23 +0000
commitd4708d9dd4abacde115661500fe999266264dbe7 (patch)
treeb0c2bc5aedb4964cac31de895df848e4f19b09a2 /libjava/stacktrace.cc
parente48d66a949a0ea367bb3df15df5f345f46184d9f (diff)
downloadgcc-d4708d9dd4abacde115661500fe999266264dbe7.zip
gcc-d4708d9dd4abacde115661500fe999266264dbe7.tar.gz
gcc-d4708d9dd4abacde115661500fe999266264dbe7.tar.bz2
re PR target/26792 (need to use autoconf when using newly-added libgcc functions)
2006-09-26 Jack Howarth <howarth@bromo.med.uc.edu> PR target/26792: * exception.cc (PERSONALITY_FUNCTION): use _Unwind_GetIP if HAVE_GETIPINFO not defined. * stacktrace.cc (_Jv_StackTrace::UnwindTraceFn): Likewise. (_Jv_StackTrace::getLineNumberForFrame): Likewise. * configure.ac: use GCC_CHECK_UNWIND_GETIPINFO. * aclocal.m4, configure, include/config.h.in, Makefile.in: Rebuilt. From-SVN: r117259
Diffstat (limited to 'libjava/stacktrace.cc')
-rw-r--r--libjava/stacktrace.cc13
1 files changed, 12 insertions, 1 deletions
diff --git a/libjava/stacktrace.cc b/libjava/stacktrace.cc
index 3e6f04c..7f967ba 100644
--- a/libjava/stacktrace.cc
+++ b/libjava/stacktrace.cc
@@ -131,6 +131,7 @@ _Jv_StackTrace::UnwindTraceFn (struct _Unwind_Context *context, void *state_ptr)
else
#endif
{
+#ifdef HAVE_GETIPINFO
_Unwind_Ptr ip;
int ip_before_insn = 0;
ip = _Unwind_GetIPInfo (context, &ip_before_insn);
@@ -139,9 +140,13 @@ _Jv_StackTrace::UnwindTraceFn (struct _Unwind_Context *context, void *state_ptr)
// to ensure we get the correct line number for the call itself.
if (! ip_before_insn)
--ip;
-
+#endif
state->frames[pos].type = frame_native;
+#ifdef HAVE_GETIPINFO
state->frames[pos].ip = (void *) ip;
+#else
+ state->frames[pos].ip = (void *) _Unwind_GetIP (context);
+#endif
state->frames[pos].start_ip = func_addr;
}
@@ -217,6 +222,12 @@ _Jv_StackTrace::getLineNumberForFrame(_Jv_StackFrame *frame, NameFinder *finder,
else
offset = (_Unwind_Ptr) ip - (_Unwind_Ptr) info.base;
+#ifndef HAVE_GETIPINFO
+ // The unwinder gives us the return address. In order to get the right
+ // line number for the stack trace, roll it back a little.
+ offset -= 1;
+#endif
+
finder->lookup (binaryName, (jlong) offset);
*sourceFileName = finder->getSourceFile();
*lineNum = finder->getLineNum();