From: "Jafa" <jafa@silicondust.com>
To: <gdb@sources.redhat.com>
Subject: Re: ignore helper no longer works?
Date: Thu, 03 Jul 2003 02:27:00 -0000 [thread overview]
Message-ID: <00db01c3410a$684b0050$0a02a8c0@scenix.com> (raw)
Ok, thinking about this further...
The problem is that theses epilogue stubs are responsibe for storting out
the return address (typically poping off the stack after poping a variable
number of other stuff). They are executed by jumping to them thus I have no
idea how it got there or what the return address is unless I simulate the
remainder of the stub to see what it does to sort out the return address.
So I can two options:
1) Say it is my responsibility to determine the return address anywhere in
code, even if it means writing a whole lot of code in gdb to simulate the
execution of these stubs.
2) Fix gdb at a higher level so that it doesn't try to obtain a return
address from a helper function - instead keep stepping (like it gdb used to
do).
I can figure out the FP ok (all be it that it is painful without being able
to see the prologue) - the old system only asked for the FP and after
detecting that it was the same frame, kept stepping.
BTW - I have also noticed that gdb now does not call ignore_helper for any
step-over operations, instead relying on the tdep to supply the return
address for the stub. It think it always used to call ignore_helper and if
it was a helper then it stepped rather that setting a breakpoint as if it
was a function.
I don't want to be too quick to butcher infrun - I would appreciate your
advice.
Thanks
Nick
----- Original Message -----
From: "Jafa" <jafa@silicondust.com>
To: <gdb@sources.redhat.com>
Sent: Wednesday, July 02, 2003 5:25 PM
Subject: ignore helper no longer works?
Hi guys,
I now have the ip2k frame handling code working using the new scheme
including giving valid results in any position within the prologue. Stack
backtraces and finish both work reliably.
Gcc for the ip2k has a habit of using a lot of stub functions - typically
3-4 instruction sequences which are just snippits of code with a return
instruction (not valid functions).
From the user's point-of-view, if they click step-into they want to step
into the c-level function - not an invisible stub that happens to have been
inserted by gcc to set up the parameters to that function.
The solution has been to register a IGNORE_HELPER_CALL function that tells
gdb that it has just stepped into a helper/stub and to treat it as an
extension of the current function (ie just keep stepping).
The problem is that gcc also tends to use a stub for the epilogue of
functions (jump to a stub that cleans up the stack and returns).
With the old frame handling system this worked fine - gdb just kept stepping
through the epilogue stub.
With the new system it fails... it asks for the frame information of the
epilogue stub (which is not a function). There are a large number of stubs
and it would pose quite a problem to attempt to get gdb understand them all
(not to mention keeping up with our gcc guy thinking up new stubs).
I am fully open to ideas :-)
BTW - MIPS will have the same problem as it uses epilogue stubs as well.
Thanks
Nick
Trace of 'next' at the end of a function leading into an epilogue stub...
(gdb) n
{ frame_register_unwind (frame=-1,regnum="sp",...) -> *optimizedp=0 *lvalp=2
*addrp=0x102 *bufferp=[0ff3] }
{ flush_cached_frames () }
{ create_sentinel_frame (...) ->
{level=-1,type=NORMAL_FRAME,unwind=0x4dd1d4,pc=<unknown>,id={stack=0x0,code=
0x0},func=<unknown>} }
{ get_prev_frame (this_frame=-1) { frame_register_unwind
(frame=-1,regnum="pc",...) -> *optimizedp=0 *lvalp=2 *addrp=0x100
*bufferp=[8047] }
{ frame_pc_unwind (this_frame=-1) -> 0x201008e }
->
{level=0,type=UNKNOWN_FRAME,unwind=<unknown>,pc=0x201008e,id=<unknown>,func=
<unknown>} }
{ frame_register_unwind (frame=-1,regnum="sp",...) -> *optimizedp=0 *lvalp=2
*addrp=0x102 *bufferp=[0ff3] }
{ flush_cached_frames () }
{ create_sentinel_frame (...) ->
{level=-1,type=NORMAL_FRAME,unwind=0x4dd1d4,pc=<unknown>,id={stack=0x0,code=
0x0},func=<unknown>} }
{ get_prev_frame (this_frame=-1) { frame_register_unwind
(frame=-1,regnum="pc",...) -> *optimizedp=0 *lvalp=2 *addrp=0x100
*bufferp=[0a56] }
{ frame_pc_unwind (this_frame=-1) -> 0x20014ac }
->
{level=0,type=UNKNOWN_FRAME,unwind=<unknown>,pc=0x20014ac,id=<unknown>,func=
<unknown>} }
{ frame_register_unwind (frame=-1,regnum="sp",...) -> *optimizedp=0 *lvalp=2
*addrp=0x102 *bufferp=[0ff3] }
{ frame_register_unwind (frame=0,regnum="pc",...) ip2k_frame_unwind_cache:
{ frame_func_unwind (fi=-1) -> 0x20014ac }
{ frame_register_unwind (frame=-1,regnum="sp",...) -> *optimizedp=0 *lvalp=2
*addrp=0x102 *bufferp=[0ff3] }
entry_pc = 0x020014ac
current_pc = 0x020014ac
return_pc = 0x02011836
entry_sp = 0x01000ff3
normal_sp = 0x01000ff3
current_sp = 0x01000ff3
-> *optimizedp=0 *lvalp=0 *addrp=0x0 *bufferp=[8c1b] }
{ frame_pc_unwind (this_frame=0) -> 0x2011836 }
{ get_frame_id (fi=0) ip2k_frame_this_id
-> {stack=0x1000ff3,code=0x0} }
{ frame_id_p (l={stack=0x1000ff5,code=0x0}) -> 1 }
{ frame_register_unwind (frame=-1,regnum="sp",...) -> *optimizedp=0 *lvalp=2
*addrp=0x102 *bufferp=[0ff3] }
{ flush_cached_frames () }
{ frame_id_p (l={stack=0x1000ff5,code=0x0}) -> 1 }
{ create_sentinel_frame (...) ->
{level=-1,type=NORMAL_FRAME,unwind=0x4dd1d4,pc=<unknown>,id={stack=0x0,code=
0x0},func=<unknown>} }
{ get_prev_frame (this_frame=-1) { frame_register_unwind
(frame=-1,regnum="pc",...) -> *optimizedp=0 *lvalp=2 *addrp=0x100
*bufferp=[8c1b] }
{ frame_pc_unwind (this_frame=-1) -> 0x2011836 }
->
{level=0,type=UNKNOWN_FRAME,unwind=<unknown>,pc=0x2011836,id=<unknown>,func=
<unknown>} }
{ get_frame_id (fi=0) ip2k_frame_this_id
ip2k_frame_unwind_cache:
{ frame_func_unwind (fi=-1) -> 0x2011804 }
{ frame_register_unwind (frame=-1,regnum="sp",...) -> *optimizedp=0 *lvalp=2
*addrp=0x102 *bufferp=[0ff5] }
correction of 8 applied
entry_pc = 0x02011804
current_pc = 0x02011836
return_pc = 0x020114b0
entry_sp = 0x01000fff
normal_sp = 0x01000ffd
current_sp = 0x01000ff5
-> {stack=0x1000fff,code=0x0} }
{ frame_id_eq (l={stack=0x1000ff5,code=0x0},r={stack=0x1000fff,code=0x0}) ->
0 }
{ flush_cached_frames () }
next reply other threads:[~2003-07-03 2:27 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-07-03 2:27 Jafa [this message]
2003-07-03 15:10 ` Andrew Cagney
2003-07-03 17:27 ` Jafa
-- strict thread matches above, loose matches on Subject: below --
2003-07-03 18:36 Jafa
2003-07-03 0:33 Jafa
2003-07-03 0:27 Jafa
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='00db01c3410a$684b0050$0a02a8c0@scenix.com' \
--to=jafa@silicondust.com \
--cc=gdb@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox