This is the mail archive of the gdb-patches@sourceware.cygnus.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: GDB 4.17 Patch for stack aligned i386 code


>>Are you handling non-leaf functions even when the stack pointer is changing?
>
> Yes.  It works by emulating instructions to figure out the stack pointer
> on entry to or exit from the function.  The opcodes library, with a few
> minor changes, provides the instruction information in an
> architecture-independent format.

Cool.

>>Does your patch handle functions where the prologue uses "andl" to align
>>the frame?
>
> I don't know.  Do you happen to have an example of how to generate such
> code?  I'd be interested in trying it.

I'm not sure what I still have laying around other than a very old patch
for GCC.  The idea is to handle a prologue which looks like:

func:
        pushl %ebp
        movl %esp,%ebp
        andl $-15,%esp
        subl $32,%esp

function arguments are relative to %ebp and local variables are relative to
%esp.  Extra alignment has been applied to the stack pointer in order to
ensure that local variables don't cross a cache boundary.

-- John
-------------------------------------------------------------------------
|   Feith Systems  |   Voice: 1-215-646-8000  |  Email: john@feith.com  |
|    John Wehle    |     Fax: 1-215-540-5495  |                         |
-------------------------------------------------------------------------


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]