From: Michael Snyder <msnyder@vmware.com>
To: Pedro Alves <pedro@codesourcery.com>
Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>,
Hui Zhu <teawater@gmail.com>,
drow@false.org
Subject: Re: [RFA] Patch to fix reverse return from subroutine error
Date: Sat, 27 Jun 2009 20:59:00 -0000 [thread overview]
Message-ID: <4A4687B2.2060907@vmware.com> (raw)
In-Reply-To: <200906272049.36692.pedro@codesourcery.com>
Pedro Alves wrote:
>> - || execution_direction == EXEC_REVERSE))
>> + || (execution_direction == EXEC_REVERSE
>> + && ecs->event_thread->step_frame_id.stack_addr_p
>> + && get_frame_id (get_current_frame ()).stack_addr_p
>> + && !gdbarch_inner_than (current_gdbarch,
>> + ecs->event_thread->step_frame_id.stack_addr,
>> + get_frame_id
>
> Sorry to pitch in so late, but this doesn't look right to me.
> Common code shouldn't be accessing frame id members directly, frame ids
> are supposed to be opaque. What is this trying to do?
It's trying to answer the question "have we stepped into a
subroutine call?", in reverse. This unfortunately involves
corner cases that we don't see when we're going forward.
Originally the code just looked (approximately) like this:
/* Check for subroutine calls. The check for the current frame
equalling the step ID is not necessary - the check of the
previous frame's ID is sufficient - but it is a common case and
cheaper than checking the previous frame's ID. */
if (!frame_id_eq (get_frame_id (frame), step_frame_id)
&& frame_id_eq (frame_unwind_id (frame), step_frame_id))
The problem is that the second "frame_id_eq" test fails in
the case where we've just stepped backward to the RET instruction
of a function which, in forward-time, had just returned.
It's possible that what we're trying to do here is work around a
bug in the i386 implementation of frame_unwind_id. When I look at
the frame_id that it returns at this point, it does not match either
the caller or the callee, and its code_addr is particularly wrong.
We don't encounter this situation in forward execution, because
it is caught earler by the stepping-within-line-range code, and
we never reach this test on the RET instruction.
next prev parent reply other threads:[~2009-06-27 20:59 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-11 8:27 Hui Zhu
2009-06-27 18:59 ` Michael Snyder
2009-06-27 19:48 ` Pedro Alves
2009-06-27 19:56 ` Daniel Jacobowitz
2009-06-27 20:59 ` Michael Snyder [this message]
2009-06-27 21:12 ` Daniel Jacobowitz
2009-06-28 18:46 ` Michael Snyder
2009-06-28 21:09 ` Daniel Jacobowitz
2009-06-29 0:38 ` Hui Zhu
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=4A4687B2.2060907@vmware.com \
--to=msnyder@vmware.com \
--cc=drow@false.org \
--cc=gdb-patches@sourceware.org \
--cc=pedro@codesourcery.com \
--cc=teawater@gmail.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