This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFC] Enhance backtrace for microsoft system DLL calls
- From: "Pedro Alves" <pedro_alves at portugalmail dot pt>
- To: "Pierre Muller" <muller at ics dot u-strasbg dot fr>
- Cc: gdb-patches at sourceware dot org
- Date: Mon, 10 Dec 2007 17:31:35 +0000
- Subject: Re: [RFC] Enhance backtrace for microsoft system DLL calls
- References: <000001c83b4a$573b4560$05b1d020$@u-strasbg.fr>
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