This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [PATCH] Partial fix for PR backtrace/1718
- From: Mark Kettenis <kettenis at chello dot nl>
- To: mec dot gnu at mindspring dot com
- Cc: eliz at gnu dot org, gdb-patches at sources dot redhat dot com
- Date: Sun, 1 Aug 2004 15:54:27 +0200 (CEST)
- Subject: Re: [PATCH] Partial fix for PR backtrace/1718
[Sorry Michael and Eli, I managed to remove the Subject: line and
therefore the list didn't accept this message]
Date: Sun, 01 Aug 2004 01:35:39 -0400
From: Michael Chastain <mec.gnu@mindspring.com>
"Eli Zaretskii" <eliz@gnu.org> wrote:
> Perhaps, then, you could post a list of all the opcodes and subsequent
> bytes that we need to cover in i386_analyze_frame_setup?
The compiler could schedule just about anything into the prologue!
There are some restrictions though, given that GCC can only play with
a limited set of registers.
Let's get empirical. I ran cc1plus and gdb through "objdump -d" and
some perl fu.
Thanks! This really is the info I need. Could you post (or mail me)
the perl fu?
We have to have "mov 0xADDRESS, %reg". After that, recognizing
"cmpl $IMMEDIATE, 0xADDRESS" would help. That instruction gets scheduled
even before "push %ebp". Those two additions would cover 99.9% of cc1plus
and gdb.
On System V ABI conforming systems, yes. On systems that use the
-freg-struct-return by default (FreeBSD, OpenBSD, Cygwin and a few
others) I guess there are a bit more possibilities. I'll try to
address -freg-struct-return too.
Anyway, I've got some ideas to make the prologue analyzer easily
extendable.
[snip]
The 10 truly freaky prologues are:
.plt : pushl 0x86039e8 | jmp *0x86039ec | add %al, (%eax) | add %al, (%eax) | jmp *0x86039f0 | push $0x0 | jmp 80494cc <_init+0x18>
That's the PLT. GDB should already handle that one, and otherwise
it'd deserve (and need) a special frame unwinder anyway like I did for
SPARC.
_start : xor %ebp, %ebp | pop %esi | mov %esp, %ecx | and $0xfffffff0, %esp | push %eax | push %esp | push %edx
This one is rather special since it's the entry point.
Thanks!
Mark