Re: [RFC] breakpoints and function prologues...

Jim Blandy
2002-07-30T06:52:28Z

Joel Brobecker <brobecker@gnat.com> writes:
> Another alternative that has been discussed at ACT is to move the line
> where the function declaration is located to an address immediately
> past the function prologue. And the prologue would get a separate line
> info entry with a line number set to 0. The rationale behind modifying
> the compiler is that the compiler knows much better than GDB what part
> of the code is the prologue, and therefore should be in a better
> position of to provide accurate line information.

There's already a convention for this, I think. Now, where was it
described??? Here it is:

int
in_prologue (CORE_ADDR pc, CORE_ADDR func_start)
{
struct symtab_and_line sal;
CORE_ADDR func_addr, func_end;

/* We have several sources of information we can consult to figure
this out.
- Compilers usually emit line number info that marks the prologue
as its own "source line". So the ending address of that "line"
is the end of the prologue. If available, this is the most
reliable method.
- The minimal symbols and partial symbols, which can usually tell
us the starting and ending addresses of a function.
- If we know the function's start address, we can call the
architecture-defined SKIP_PROLOGUE function to analyze the
instruction stream and guess where the prologue ends.
- Our `func_start' argument; if non-zero, this is the caller's
best guess as to the function's entry point. At the time of
this writing, handle_inferior_event doesn't get this right, so
it should be our last resort. */

So, just emit an extra line entry for the prologue.