segfault in sysdep/i386/backtrace.h
Mon Feb 19 18:38:00 GMT 2007
Marco Trudel writes:
> Andrew Haley wrote:
> > Marco Trudel writes:
> > > Marco Trudel wrote:
> > > > Andrew Haley wrote:
> > > >> Marco Trudel writes:
> > > >> > > > The segfault happens on reading scan_bytes[x]. I assume that
> > > >> there is no > "pushl %ebp; movl %esp, %ebp" function prologue in
> > > >> certain cases and > thus we go reading protected areas below the
> > > >> function.
> > > >>
> > > >> Why don't you have a look, and tell us what is there?
> > > >
> > > > Because I don't know how and what these hex values mean (how to
> > > > interpret them) when doing the backtrace...
> > >
> > > Ok, learnt it...
> > > The problem is that the code assumes that there is always a "pushl %ebp;
> > > movl %esp, %ebp" function prologue. But, from : "Note that many
> > > compilers can optimize these standard sequences away when not needed
> > > (often called "no stackframe generation")".
> > >
> > > So, when turning on maximum optimization in microsoft visual c++, there
> > > are no longer "pushl %ebp; movl %esp, %ebp" intros and thus we run into
> > > trouble (tried it). I don't know if GCC can do that too... Can it?
> > It can.
> > > I checked a couple of dll's (awt.dll, swt.dll, aBluetoothLib.dll) I had
> > > around and they all miss the intro in at least a couple of functions.
> > >
> > > So, questions:
> > > - Is this a sjlj-exception only problem?
> > Yes.
> > > Can DW EH do that better?
> > Yes.
> > > - Is there another way to reliably recognize the start of a function? I
> > > assume this only affects native libs since Java compiled apps will
> > > always have the intro?!
> > Yes. We tell gcj not to optimize away the frame generation.
> > We either have to write a ton of heuristics to figure this stuff out
> > or fix DWARF / SEH in Windows.
> Well, I think we should go for DWARF.
It's going to be hard. If you want to use DWARF and you want to
unwind through (and throw execptions though) libraries compiled with
MSVC then you have to teach gcc how to unwind through Structured
Exception Handling blocks. Perhaps there are Windows library calls to
More information about the Java