From: Andrew Haley <aph@redhat.com>
To: Ranjit Mathew <rmathew@gmail.com>
Cc: GCJ Patches <java-patches@gcc.gnu.org>, mckinlay@redhat.com
Subject: Re: [MinGW] RFC/RFA: Get Partial Stack Traces on Windows
Date: Mon, 26 Jun 2006 19:06:00 -0000 [thread overview]
Message-ID: <17568.12296.591741.9873@dell.pink> (raw)
In-Reply-To: <44A02481.207@gmail.com>
Ranjit Mathew writes:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> [Bryce, CC-ing you explicitly to get your opinion on the
> fallback_backtrace() changes.]
>
> iD8DBQFEoCSBYb1hx2wRS48RAqBeAJ4+nJapJ8bjLC3WS8v2YiM0UHHXRQCgiC4o
> Iay49ETYGKAZocPmjAmujvo=
> =mGTH
> -----END PGP SIGNATURE-----
> Index: ChangeLog
> from Ranjit Mathew <rmathew@gcc.gnu.org>
>
> * sysdep/i386/backtrace.h (fallback_backtrace): Check that a potential
> frame pointer value is 32-bit word-aligned. Use operand of the CALL
> instruction calling the current function to find its starting address.
> * stacktrace.cc: Include platform.h.
> (_Jv_StackTrace::getLineNumberForFrame): Use VirtualQuery() trick on
> Windows to find the module containing a given address.
> (_Jv_StackTrace::GetStackTraceElements): Use nCodeMap even for Windows.
> (_Jv_StackTrace::GetClassContext): Use fallback_backtrace() for
> targets with SJLJ exceptions instead of using _Unwind_Backtrace().
> (_Jv_StackTrace::GetFirstNonSystemClassLoader): Likewise.
What happens with -findirect-dispatch?
> Index: sysdep/i386/backtrace.h
> ===================================================================
> --- sysdep/i386/backtrace.h (revision 114838)
> +++ sysdep/i386/backtrace.h (working copy)
> @@ -1,6 +1,6 @@
> // backtrace.h - Fallback backtrace implementation. i386 implementation.
>
> -/* Copyright (C) 2005 Free Software Foundation
> +/* Copyright (C) 2005, 2006 Free Software Foundation
>
> This file is part of libgcj.
>
> @@ -29,12 +29,37 @@ fallback_backtrace (_Jv_UnwindState *sta
> rfp && i < state->length;
> rfp = *(unsigned int **)rfp)
> {
> + /* Sanity checks to eliminate dubious-looking frame pointer chains.
> + The frame pointer should be a 32-bit word-aligned stack address.
> + Since the stack grows downwards on x86, the frame pointer must have
> + a value greater than the current value of the stack pointer, it
> + should not be below the supposed next frame pointer and it should
> + not be too far off from the supposed next frame pointer. */
> int diff = *rfp - (unsigned int)rfp;
> - if ((void*)rfp < _esp || diff > 4 * 1024 || diff < 0)
> + if (((unsigned int)rfp & 0x00000003) != 0 || (void*)rfp < _esp
Don't use unsigned int for a pointer; instead use
int __attribute__((mode(pointer))). This is an int that is exactly the
same size as a pointer.
Andrew.
next prev parent reply other threads:[~2006-06-26 19:06 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-06-26 18:16 Ranjit Mathew
2006-06-26 18:38 ` Bryce McKinlay
2006-06-27 2:23 ` Ranjit Mathew
2006-06-27 11:27 ` Marco Trudel
2006-06-27 11:38 ` Ranjit Mathew
2006-06-27 12:37 ` Marco Trudel
2006-06-27 13:14 ` Ranjit Mathew
2006-06-27 21:20 ` Bryce McKinlay
2006-06-26 19:06 ` Andrew Haley [this message]
2006-06-26 19:15 ` Tom Tromey
2006-06-26 19:20 ` Andrew Haley
2006-06-27 1:29 ` Ranjit Mathew
2006-06-27 8:33 ` Andrew Haley
2006-06-27 9:11 ` Ranjit Mathew
2006-06-27 9:29 ` Andrew Haley
2006-06-27 21:57 ` Bryce McKinlay
2006-07-05 9:22 ` Ranjit Mathew
2006-07-05 15:08 ` Bryce McKinlay
2006-07-05 15:51 ` Ranjit Mathew
2006-07-05 16:07 ` Bryce McKinlay
2006-07-05 17:13 ` Ranjit Mathew
2006-07-05 17:20 ` Andrew Haley
2006-07-05 17:35 ` Ranjit Mathew
2006-07-05 17:39 ` Andrew Haley
2006-06-27 15:28 ` Ranjit Mathew
2006-06-27 19:57 ` Tom Tromey
2006-06-28 2:51 ` Ranjit Mathew
2006-06-28 13:56 ` Ranjit Mathew
2006-06-28 15:02 ` Bryce McKinlay
2006-06-28 15:15 ` Andrew Haley
2006-06-28 15:45 ` Bryce McKinlay
2006-06-28 15:49 ` Bryce McKinlay
2006-06-28 16:11 ` Andrew Haley
2006-06-29 4:06 ` Ranjit Mathew
2006-06-29 16:27 ` Ranjit Mathew
2006-06-29 18:27 ` Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=17568.12296.591741.9873@dell.pink \
--to=aph@redhat.com \
--cc=java-patches@gcc.gnu.org \
--cc=mckinlay@redhat.com \
--cc=rmathew@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).