[RFC] Improve amd64 prologue analysis

Joel Brobecker brobecker@adacore.com
Fri Nov 19 17:20:00 GMT 2010


>   Does this means that we should only use that code if no dwarf debug
>   info is available?

If the DWARF *frame* information is available, then it will
automaticallly be used over prologue-parsing.

>   The problem currently on Windows-64bit generated code is that dwarf
>   debug information is more deeply broken than stabs, so that I am
>   still mainly using stabs (especially to debug dwarf problems...).

I completely understand the predicament you are in. I would do the same.
I don't know the compiler switches all that well, but isn't there a way
for us to force it to generate the DWARF frame info alone? This info
is used for unwinding during exceptions (unless one uses an exception
mechanism based on setjmp/longjmp).  If you had that, then you would
still be using stabs for symbolic debugging, and the DWARF unwinder
for backtracing.

> In any case it, this code would still be useful for frames that have
> no debug information at all, as it allows for frame that do not uses
> RBP to figure out the correct offset for RSP, and thus the correct
> caller frame position.

I'd have no problem with that either. In fact, I can contribute some
code as well that seems to deal with most of the prologues found in
system code (patch attached). There is one bit where I was lazy and
couldn't figure out how to disassemble some intructions, but that can
be fixed as well.

However, with that being said, the reason why I never contributed this
code is that eventually we will probably have to use the pdata/xdata
stuff.  This is the equivalent of the DWARF frame info.

In retrospect, I think that was a little silly of me to hold that code
and not make things better while waiting for pdata/xdata support
(Tristan expressed interest in that (so did I), but got stuck on VMS).
This part of the code is maintained by MarkK, so he has the final word.
But I'm OK with improving the prologue analyzer in the way that you
are suggesting.

-- 
Joel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: amd64-windows-prologue.diff
Type: text/x-diff
Size: 9816 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20101119/94efcfa1/attachment.bin>


More information about the Gdb-patches mailing list