From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2815 invoked by alias); 16 Sep 2006 20:39:56 -0000 Received: (qmail 2696 invoked by uid 48); 16 Sep 2006 20:39:42 -0000 Date: Sat, 16 Sep 2006 20:39:00 -0000 Message-ID: <20060916203942.2695.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug target/26792] [4.2 Regression] need to use autoconf when using newly-added libgcc functions In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "howarth at nitro dot med dot uc dot edu" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2006-09/txt/msg01567.txt.bz2 List-Id: ------- 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