From: Jim Blandy <jimb@codesourcery.com>
To: Vladimir Prus <vladimir@codesourcery.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [RFA] Clarify infrun variable naming.
Date: Wed, 05 Dec 2007 01:18:00 -0000 [thread overview]
Message-ID: <m3ve7ej5xb.fsf@codesourcery.com> (raw)
In-Reply-To: <200711231623.04823.vladimir@codesourcery.com> (Vladimir Prus's message of "Fri, 23 Nov 2007 16:23:04 +0300")
Vladimir Prus <vladimir at codesourcery.com> writes:
> The infrun.c file has a variable named trap_expected, which
> is a bit misleading -- after all, most times when we resume
> inferior, we get SIGTRAP. As it turns out, that variable
> is set when we're stepping over breakpoints, so a better
> name would be stepping_over_breakpoint. Likewise,
> ecs->another_trap also indicates that keep_going should
> be stepping over breakpoint. The attached patch clarifies
> the naming and adds comments, and has no behaviour changes.
> (The patch is on top of my previous breakpoints_inserted
> removing patch).
> OK?
Vlad and I had a conversation about this on the CodeSourcery IRC
channel, let me summarize here:
stepping_over_breakpoint would be a better name for trap_expected,
except that we already have a variable named stepping_past_breakpoint.
What is the relationship between trap_expected and
stepping_past_breakpoint?
As Vlad explains in the comments in his patch, we set trap_expected
when we do a single-thread, breakpoints-uninserted step to get a
thread past a breakpoint it has hit.
We set stepping_past_breakpoint when GDB reports a breakpoint hit, and
then the user switches to a different thread and steps that thread.
In this case, GDB needs to step the original thread across the
breakpoint it hit (a single-thread, breakpoints-uninserted step), and
then step of the thread the user selected. In effect, we set aside
the user's command until we've dealt with the thread that hit the
breakpoint.
Note that stepping_past_breakpoint is only ever set when trap_expected
is set. Thinking in terms of desired behavior, this makes sense
because there's no need to put off stepping the user's selected thread
if we can simply continue the thread the hit the breakpoint ---
trap_expected is our indication that we can't. And looking at the
code, we see this is true because prepare_to_proceed only sets
stepping_past_breakpoint if it will return non-zero, and that proceed
always sets trap_expected if prepare_to_proceed returns non-zero.
Check.
I think stepping_past_breakpoint is not a good name for this variable:
it doesn't do anything to suggest the two-thread delayed-action
situation at hand. It sounds like it'd be involved with an ordinary
step past a breakpoint.
I don't think there's any need for both stepping_past_breakpoint and
stepping_past_breakpoint_ptid. We could have a single ptid_t
variable, equal to null_ptid when no special handling is necessary.
So, my suggestions were:
- We should replace stepping_past_breakpoint and
stepping_past_breakpoint_ptid with a single ptid_t variable,
deferred_step_ptid.
- We should rename trap_expected to stepped_over_breakpoint. The past
tense 'stepped' suggests that we're talking about a step which has
already happened (which is true by the time we reach
handle_inferior_event).
(And if I meditate carefully enough on the best possible names, it'll
be quite some time before I have to look at Vlad's harder patches. :))
next prev parent reply other threads:[~2007-12-05 1:18 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-23 13:23 Vladimir Prus
2007-11-23 14:53 ` Pierre Muller
2007-11-23 15:22 ` Vladimir Prus
2007-11-23 15:41 ` Pierre Muller
2007-11-23 15:51 ` Vladimir Prus
2007-11-23 16:06 ` Daniel Jacobowitz
2007-11-23 17:03 ` Vladimir Prus
2007-11-23 17:27 ` Daniel Jacobowitz
2007-11-23 16:14 ` Pierre Muller
2007-12-05 1:18 ` Jim Blandy [this message]
2007-12-05 1:52 ` Daniel Jacobowitz
2007-12-05 2:47 ` Daniel Jacobowitz
2007-12-05 8:37 ` Vladimir Prus
2007-12-05 14:13 ` Vladimir Prus
2007-12-05 21:32 ` Jim Blandy
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=m3ve7ej5xb.fsf@codesourcery.com \
--to=jimb@codesourcery.com \
--cc=gdb-patches@sources.redhat.com \
--cc=vladimir@codesourcery.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