* frameless_look_for_prologue
@ 2001-03-09 6:50 David Taylor
2001-03-09 12:55 ` frameless_look_for_prologue Andrew Cagney
0 siblings, 1 reply; 4+ messages in thread
From: David Taylor @ 2001-03-09 6:50 UTC (permalink / raw)
To: gdb-patches
I believe that every target that does:
set_gdbarch_frameless_function_invocation (gdbarch,
frameless_look_for_prologue);
has a bug.
The function frameless_look_for_prologue invokes PROLOGUE_FRAMELESS_P
with one argument -- the pc of the *START* of the function.
For backtraces, get_prev_frame wants to know not "does this function
eventually set up a frame if I execute far enough into it", but rather
"does this function have a frame at the point where the program has
currently stopped".
If the function has to execute some instructions to set up the frame
(and if it doesn't, why are you setting FRAMELESS_FUNCTION_INVOCATION
to frameless_look_for_prologue?), then those questions potentially
have different answers.
Potential solutions include:
. change the interface of PROLOGUE_FRAMELESS_P --
==> invoke it with the current pc, not the start pc
have it call get_pc_function_start
Pro: no namespace pollution; don't need to create yet
another macro / multi-arch function
Con: need to change the PROLOGUE_FRAMELESS_P functions for all
of the targets that currently set FRAMELESS_FUNCTION_INVOCATION
to frameless_look_for_prologue.
. create a new variant of PROLOGUE_FRAMELESS_P
==> either the new variant takes one argument (the current or
'limit' pc) and calls get_pc_function_start or it takes two
arguments (the start pc and the current/limit pc).
Pro: don't need to change existing targets
Con: creates yet another multi-arch macro / function; doesn't fix
a known bug in several existing targets.
My personal preference would be --
. a new variant of PROLOGUE_FRAMELESS_P which takes two arguments
. put a comment next to the old method saying that it is deprecated
and why and suggesting that people use the new method instead
. 'encourage' maintainers to fix existing targets
If people agree, I'll try to find the time in the next few days to put
together a patch.
Comments?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: frameless_look_for_prologue
2001-03-09 6:50 frameless_look_for_prologue David Taylor
@ 2001-03-09 12:55 ` Andrew Cagney
2001-03-09 13:48 ` frameless_look_for_prologue Michael Snyder
0 siblings, 1 reply; 4+ messages in thread
From: Andrew Cagney @ 2001-03-09 12:55 UTC (permalink / raw)
To: David Taylor; +Cc: gdb-patches
David Taylor wrote:
>
> I believe that every target that does:
>
> set_gdbarch_frameless_function_invocation (gdbarch,
> frameless_look_for_prologue);
>
> has a bug.
>
> The function frameless_look_for_prologue invokes PROLOGUE_FRAMELESS_P
> with one argument -- the pc of the *START* of the function.
>
> For backtraces, get_prev_frame wants to know not "does this function
> eventually set up a frame if I execute far enough into it", but rather
> "does this function have a frame at the point where the program has
> currently stopped".
I don't think this is right. As far as I know, the behavour is:
o gdb sets a breakpoint at the end
of the function prologue
i.e. break foo
not break *foo
o the target runs through to the end of
the prologue so that the stack frame's
construction is complete.
GDB can only do correct backtraces after the frame has been
constructed. GDB doesn't handle backtraces part way through a stack
frame.
As far as I know, to make things so that GDB could re-construct a
partially built frame, GDB would need to understand things like dwarf2's
live range splitting stuff (correct name?) along with a few other dwarf2
(?) features which would, together, let GDB construct its frame frame
based on an aribtrary function address.
enjoy,
Andrew
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: frameless_look_for_prologue
2001-03-09 12:55 ` frameless_look_for_prologue Andrew Cagney
@ 2001-03-09 13:48 ` Michael Snyder
0 siblings, 0 replies; 4+ messages in thread
From: Michael Snyder @ 2001-03-09 13:48 UTC (permalink / raw)
To: Andrew Cagney; +Cc: David Taylor, gdb-patches
Andrew Cagney wrote:
>
> David Taylor wrote:
> >
> > I believe that every target that does:
> >
> > set_gdbarch_frameless_function_invocation (gdbarch,
> > frameless_look_for_prologue);
> >
> > has a bug.
> >
> > The function frameless_look_for_prologue invokes PROLOGUE_FRAMELESS_P
> > with one argument -- the pc of the *START* of the function.
> >
> > For backtraces, get_prev_frame wants to know not "does this function
> > eventually set up a frame if I execute far enough into it", but rather
> > "does this function have a frame at the point where the program has
> > currently stopped".
>
> I don't think this is right. As far as I know, the behavour is:
>
> o gdb sets a breakpoint at the end
> of the function prologue
>
> i.e. break foo
> not break *foo
>
> o the target runs through to the end of
> the prologue so that the stack frame's
> construction is complete.
>
> GDB can only do correct backtraces after the frame has been
> constructed. GDB doesn't handle backtraces part way through a stack
> frame.
>
> As far as I know, to make things so that GDB could re-construct a
> partially built frame, GDB would need to understand things like dwarf2's
> live range splitting stuff (correct name?) along with a few other dwarf2
> (?) features which would, together, let GDB construct its frame frame
> based on an aribtrary function address.
It varies from ABI to ABI, and base-port to base-port.
For some targets, backtrace can succeed even if you're
stopped at an arbitrary point in the prologue. Of course,
evaluation of the function's parameters probably won't work...
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: frameless_look_for_prologue
@ 2001-03-13 11:33 David Taylor
0 siblings, 0 replies; 4+ messages in thread
From: David Taylor @ 2001-03-13 11:33 UTC (permalink / raw)
To: Andrew Cagney; +Cc: gdb-patches
From: Andrew Cagney <ac131313@cygnus.com>
Date: Fri, 09 Mar 2001 15:33:24 -0500
David Taylor wrote:
>
> I believe that every target that does:
>
> set_gdbarch_frameless_function_invocation (gdbarch,
> frameless_look_for_prologue);
>
> has a bug.
>
> The function frameless_look_for_prologue invokes PROLOGUE_FRAMELESS_P
> with one argument -- the pc of the *START* of the function.
>
> For backtraces, get_prev_frame wants to know not "does this function
> eventually set up a frame if I execute far enough into it", but rather
> "does this function have a frame at the point where the program has
> currently stopped".
I don't think this is right. As far as I know, the behavour is:
o gdb sets a breakpoint at the end
of the function prologue
i.e. break foo
not break *foo
o the target runs through to the end of
the prologue so that the stack frame's
construction is complete.
Sometimes the inferior stops at a location prior to the end of the
prologue -- examples: on receipt of a signal or due to a watchpoint.
GDB can only do correct backtraces after the frame has been
constructed. GDB doesn't handle backtraces part way through a stack
frame.
You need a frame for all the functions other than frame 0. If frame 0
hasn't been constructed, you can still potentially do the backtrace.
As far as I know, to make things so that GDB could re-construct a
partially built frame, GDB would need to understand things like dwarf2's
live range splitting stuff (correct name?) along with a few other dwarf2
(?) features which would, together, let GDB construct its frame frame
based on an aribtrary function address.
Agreed. While a partially constructed frame can cause problems, you
can make a better decision than now by limiting the decision to the
[function start pc, current pc) range.
On the processor where I first saw the problem, the frame is
constructed in the *middle* of the prologue -- some registers are
saved before it is done and some are saved afterwards. And it was a
watchpoint that triggered the stop...
enjoy,
Andrew
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2001-03-13 11:33 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-03-09 6:50 frameless_look_for_prologue David Taylor
2001-03-09 12:55 ` frameless_look_for_prologue Andrew Cagney
2001-03-09 13:48 ` frameless_look_for_prologue Michael Snyder
2001-03-13 11:33 frameless_look_for_prologue David Taylor
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox