This is the mail archive of the gdb-patches@sourceware.org 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]
Other format: [Raw text]

Re: [RFC] Enhance backtrace for microsoft system DLL calls


Hi Pierre,

Pierre Muller wrote:
>   I had troubles when trying to backtrace
> when the debugge was stopped
> inside the windows DLL's.
>
>   After some investigation, I
> found out that many exported routines
> from the Microsoft operating system
> start with a no-op assembler instruction
> 'mov %edi,%edi'.

That's placed there for hot patching, together with 5 bytes of slack before the
function (the idea is to be able to replace that 2 byte op with a jump to
5 bytes back, and patch the 5 bytes with a jump into anywhere in the
32-bit address space.)

Something like:

    nop                            |
    nop                            |
    nop                            |  hot patching
    nop                            |  support
    nop                            |
    mov    %edi,%edi               |   <-- function start
-----------------------------------+
    push   %ebp                    |
    mov    %esp,%ebp               |  frame setup
    sub    $0x18,%esp              |  locals, ...

Could you add a comment explaining that as well?

>   The main question is whether this patch is acceptable
> for gdb as it is in a i386 common file, while
> it most probably only applies to MS operating system.
>
>   The problem is that I found no other location where
> this could be done, but maybe someone in the list
> has a better overview and a good idea where to put that.
>

You can put a flag in i386's gdbarch_tdep (look in
i386-tdep.h, and i386-cygwin-tdep.c).

-- 
Pedro Alves


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