This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] i386_skip_prologue.
- From: Mark Kettenis <mark dot kettenis at xs4all dot nl>
- To: drow at false dot org
- Cc: pedro_alves at portugalmail dot pt, gdb-patches at sourceware dot org
- Date: Sat, 30 Dec 2006 22:20:52 +0100 (CET)
- Subject: Re: [PATCH] i386_skip_prologue.
- References: <455EE79E.6000109@portugalmail.pt> <uveldatp9.fsf@gnu.org> <455EF845.40902@portugalmail.pt> <455F2754.5060703@portugalmail.pt> <20061118163738.GA14800@nevyn.them.org> <457B1D40.7060302@portugalmail.pt> <20061230204826.GD25539@nevyn.them.org>
> Date: Sat, 30 Dec 2006 15:48:26 -0500
> From: Daniel Jacobowitz <drow@false.org>
>
> On Sat, Dec 09, 2006 at 08:32:00PM +0000, Pedro Alves wrote:
> > The i386 targets currently don't look at line number markers
> > or the symbol table at all in i386_skip_prologue.
> >
> > I used the attached patch to test the gcc side of the fix,
> > (http://gcc.gnu.org/ml/gcc-patches/2006-12/msg00633.html)
> >
> > With the gcc patch above applied, this patch fixes all the runto_main issues
> > on Cygwin. There are a few other FAILs related to breakpoints and main,
> > but those are testsuite bugs, unrelated to this. I will send patches for
> > those shortly.
>
> As this is an i386-specific change, I'd been hoping Mark Kettenis could
> take a look at it. Mark, any opinion on this?
I'm sorry. I tend to suffer from packet loss at my side.
> We've been going back and forth on prologue skipping choices for a long
> time now. We have at least four options, each with at least two users:
>
> - skip_prologue_using_sal
> - refine_prologue_limit
> - this simple approach using line numbers, i.e. what you did
> - sticking to analysis of the instructions
>
> Aside from how difficult the analysis is, there's very little target
> dependent about this. It's a shame we've got so many different ways
> to do it.
Yes, that's my general feeling. But last time I brought it up, we
didn't reach a real conclusion.
> Is there a general philosophy we could adopt that would apply to most
> or all targets?
>
> Here's a proposal to get us started: when skipping the prologue to
> place a breakpoint or finish single stepping (skip_prologue), try to
> skip to the end of the first sal. But some targets may optionally run
> their prologue analyzer and make sure it doesn't see anything it
> objects to - like jumps. That would mean the i386 prologue analyzer
> would need to know about this new call to __main. When scanning the
> prologue to build frame unwind information, ignore sals entirely.
> Scan until we hit the saved PC or until we believe we understand
> the entire frame.
The last time I tried using sals on i386, I simply encountered too
many cases where the line number information couldn't be trusted and
putting a breakpoint on a function that was defenitely called never
hit.