public inbox for java-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Bryce McKinlay <mckinlay@redhat.com>
To: Ranjit Mathew <rmathew@gmail.com>
Cc: java-patches@gcc.gnu.org
Subject: Re: [MinGW] RFA: Make Stack Traces Work for Interpreted Code on Windows
Date: Tue, 11 Jul 2006 17:59:00 -0000	[thread overview]
Message-ID: <44B3E70F.4070009@redhat.com> (raw)
In-Reply-To: <e8qhm9$gh7$1@sea.gmane.org>

Hi Ranjit,

Ranjit Mathew wrote:
>   When run under the interpreter, an exception-throwing programme
> crashes the interpreter on Windows since JvRunMain() does not
> occur in the call stack and we once again roam the wilderness of
> arbitrary EBP values.
>
> The fix was to change fallback_backtrace() in
> "sysdep/i386/backtrace.h" to stop on _Jv_RunMain() instead since
> this does occur in both interpreted and natively-executed call
> stacks. (Since this function is overloaded, I needed to use an
> interim variable with the appropriate cast to tell the compiler
> which of these function variants to pick up.)
>   

Only the main thread will have JvRunMain on the stack - you probably 
also need to look for the thread-start routine to handle other threads.

Note that even then there are some situations (invocation API) where 
neither _Jv_RunMain or _Jv_ThreadStart will be on the stack.
> fallback_backtrace() also does not correctly handle unwinding
> through interpreted code. The fix was as simple as copying the
> relevant bits of code from _Jv_StackTrace::Unwind_TraceFn() and
> adjusting it a little bit.
>   

This part of the patch is a bit awkward - duplicating the 
interpreter-specific code is fragile and will make maintenance more 
difficult. Couldn't we instead have fallback_backtrace call the real 
UnwindTraceFn? I believe _Unwind_context is an opaque type, so it should 
be possible to have fallback_backtrace pass its own data there.
> (I note that under the interpreter we do
> not get line numbers for the innermost call frame, even on Linux.
> I haven't investigated this issue yet.)
>   
Hmm. There shouldn't be any problems here (on Linux) - do you have a 
test case?

Bryce

  reply	other threads:[~2006-07-11 17:59 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-09  9:19 Ranjit Mathew
2006-07-11 17:59 ` Bryce McKinlay [this message]
2006-07-11 18:34   ` Ranjit Mathew
2006-07-11 21:34     ` Bryce McKinlay
2006-07-12 17:28       ` Ranjit Mathew
2006-07-12 20:05         ` Bryce McKinlay
2006-07-14 17:26           ` Ranjit Mathew
2006-07-12 20:10         ` Bryce McKinlay

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=44B3E70F.4070009@redhat.com \
    --to=mckinlay@redhat.com \
    --cc=java-patches@gcc.gnu.org \
    --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).