This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/26792] [4.2 Regression] need to use autoconf when using newly-added libgcc functions
- From: "howarth at nitro dot med dot uc dot edu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 16 Sep 2006 20:39:42 -0000
- Subject: [Bug target/26792] [4.2 Regression] need to use autoconf when using newly-added libgcc functions
- References: <bug-26792-6528@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #16 from howarth at nitro dot med dot uc dot edu 2006-09-16 20:39 -------
Is this what we are waiting for? I came up with that by just placing
wrappers around the changes submitted on...
http://gcc.gnu.org/viewcvs/trunk/libjava/stacktrace.cc?r1=115069&r2=115235&pathrev=115235
and
http://gcc.gnu.org/bugzilla/attachment.cgi?id=10915
so that the previous code was in place when HAVE_GETIPINFO is false.
Index: exception.cc
===================================================================
--- exception.cc (revision 116995)
+++ exception.cc (working copy)
@@ -231,7 +231,11 @@ PERSONALITY_FUNCTION (int version,
// Parse the LSDA header.
p = parse_lsda_header (context, language_specific_data, &info);
+ #ifdef HAVE_GETIPINFO
ip = _Unwind_GetIPInfo (context, &ip_before_insn);
+ #else
+ ip = _Unwind_GetIP (context) - 1;
+ #endif
if (! ip_before_insn)
--ip;
landing_pad = 0;
Index: stacktrace.cc
===================================================================
--- stacktrace.cc (revision 116995)
+++ stacktrace.cc (working copy)
@@ -131,6 +131,7 @@ _Jv_StackTrace::UnwindTraceFn (struct _U
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 _U
// 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(_J
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();
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26792