This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [RFA] x86 - jump instruction after the prologue
- From: Daniel Jacobowitz <drow at false dot org>
- To: Mark Kettenis <kettenis at chello dot nl>
- Cc: guitton at act-europe dot fr, gdb-patches at sources dot redhat dot com
- Date: Mon, 10 May 2004 16:27:21 -0400
- Subject: Re: [RFA] x86 - jump instruction after the prologue
- References: <20040419173249.GA22201@act-europe.fr> <20040427163725.GA7319@act-europe.fr> <200404291624.i3TGO7PP003462@elgar.kettenis.dyndns.org>
On Thu, Apr 29, 2004 at 06:24:07PM +0200, Mark Kettenis wrote:
> Date: Tue, 27 Apr 2004 18:37:25 +0200
> From: Jerome Guitton <guitton@act-europe.fr>
>
> Ping? Still waiting for approval...
>
> Sorry about that. I've reviewed your patch. I've tweaked the comment
> a bit and checked in the attached.
The testcase, unfortunately, fails on i386-linux using GCC 3.3 and
dwarf2 (it succeeds with stabs).
The failure occurs because we set the breakpoint in main() instead of
in jump_at_beginning. Here's the relevant line info, in minsym_found:
(top-gdb) p/x msymbol.ginfo.value.address
$10 = 0x80483a8
(top-gdb) p/x values.sals[0]
$11 = {symtab = 0x82f4e78, section = 0x0, line = 0xc, pc = 0x804838c, end = 0x80483b2}
We use the start of the line, which is before the beginning of the
function we want to skip. If funfirstline, should we ignore lines
which start before the beginning of the function?
Also, should we write i386-prologue.c in assembly to avoid this
problem? That's what Fred did for SH to avoid a similar difficulty.
>
> Thanks,
>
> Mark
>
>
> Index: ChangeLog
> from Jerome Guitton <guitton@gnat.com>
> Mark Kettenis <kettenis@gnu.org>
>
> * i386-tdep.c (i386_skip_prologue): follow the last jump only if
> the function begins with a branch instruction.
>
> Index: i386-tdep.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/i386-tdep.c,v
> retrieving revision 1.188
> diff -u -p -r1.188 i386-tdep.c
> --- i386-tdep.c 29 Apr 2004 16:13:21 -0000 1.188
> +++ i386-tdep.c 29 Apr 2004 16:20:47 -0000
> @@ -750,7 +750,13 @@ i386_skip_prologue (CORE_ADDR start_pc)
> }
> }
>
> - return i386_follow_jump (pc);
> + /* If the function starts with a branch (to startup code at the end)
> + the last instruction should bring us back to the first
> + instruction of the real code. */
> + if (i386_follow_jump (start_pc) != start_pc)
> + pc = i386_follow_jump (pc);
> +
> + return pc;
> }
>
> /* This function is 64-bit safe. */
>
--
Daniel Jacobowitz