From: Luis Machado <luis_gustavo@mentor.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFC stub-side break conditions 3/5] GDB-side changes
Date: Fri, 06 Jan 2012 22:38:00 -0000 [thread overview]
Message-ID: <4F07779A.10808@mentor.com> (raw)
In-Reply-To: <83y5tlnrsx.fsf@gnu.org>
On 01/06/2012 06:44 AM, Eli Zaretskii wrote:
>> Date: Thu, 05 Jan 2012 12:56:16 -0200
>> From: Luis Machado<luis_gustavo@mentor.com>
>>
>> This machinery works by marking locations modified through the
>> "condition_changed" field. Conditions change whenever we create a new
>> location, use the "condition" command or delete an old duplicate
>> location. Furthermore, if a location at addr 0xdeadbeef had its
>> condition modified, all duplicate locations at 0xdeadbeef are marked
>> modified as well.
>>
>> The modification detection takes place inside
>> update_global_location_list (...). By calling
>> force_breakpoint_reinsertion (...), we mark every location at address
>> 0xdeadbeef as modified. When consolidating the final updated list of
>> locations, we detect these locations and mark the non-duplicate location
>> at 0xdeafbeef as "needs_update".
>>
>> The "needs_update" field is used during breakpoint insertion. It forces
>> insertion of breakpoints even if they are marked as inserted already.
>>
>> Now that we have information about locations that we should reinsert in
>> the target, we proceed to build a list of hex-encoded agent expressions.
>>
>> At this point, if any conditional expressions fail to parse to a valid
>> agent expression, we assume that the conditions will be evaluated on
>> GDB's side. Thus we don't send the conditions to the stub. Otherwise, we
>> proceed to insert the breakpoints and the remote code now attaches the
>> hex-encoded expressions to the z0/z1 packet.
>>
>> Regarding always-inserted mode, if it is "on" we must send condition
>> changes right away, or else the target will potentially miss breakpoint
>> hits. If always-inserted is "off", this isn't too critical, so we just
>> wait for the insertion call to send all the conditions to the stub. We
>> will remove them when stopping anyway.
> WIBNI these details were somewhere in the source comments or (gasp!)
> in gdbint.texinfo?
I could probably improve source documentation if it is not enough. I did
point out in some places that conditions need to be synched with the target.
Regarding the internal documentation, i can include such descriptions
there, no problem.
>> +/* Shows the current mode of breakpoint condition evaluation. Explicitly shows
>> + what "auto" is translating to. */
>> +
>> +static void
>> +show_condition_evaluation_mode (struct ui_file *file, int from_tty,
>> + struct cmd_list_element *c, const char *value)
>> +{
>> + if (condition_evaluation_mode == condition_evaluation_auto)
>> + fprintf_filtered (file,
>> + _("Breakpoint condition evaluation "
>> + "mode is %s (currently %s).\n"),
>> + value,
>> + breakpoint_condition_evaluation_mode ());
>> + else
>> + fprintf_filtered (file, _("Breakpoint condition evaluation mode is %s.\n"),
>> + value);
>> +}
>> +
> Is it a good idea to show "gdb" or "stub" rather than "auto"? After
> all, as you explained elsewhere, the translation is not 100% accurate,
> depending on the specifics of each individual condition.
This will only show what the global setting is. If "auto", it will show
"auto", but will also show what GDB is currently using given the
available features.
If the user decides to switch to either "gdb" or "stub" (or "target"),
this is what will be displayed by this function. This one does not
relate directly to what is shown in "info break".
What is displayed in "info break" depends on the global setting and on
the successful parsing of an expression into an agent expression, so it
displays exactly where each location condition will be evaluated.
If "gdb" is set, every condition will be evaluated by GDB. If "stub"
(or "target") is set, there is no guarantee everything will be handled
by the target (given the documented limitations), so the fallback is to
evaluate conditions on GDB's side.
I'm regretting the "info break" change a little, it seems to obscure
rather than clarify. :-)
>> + /* Print whether the remote stub is doing the breakpoint's condition
>> + evaluation. If GDB is doing the evaluation, don't print anything. */
>> + if (loc&& is_breakpoint (b)&& loc->cond_bytecode
>> + && breakpoint_condition_evaluation_mode ()
>> + != condition_evaluation_gdb)
>> + {
>> + ui_out_text (uiout, " (");
>> + ui_out_field_string (uiout, "condeval",
>> + breakpoint_condition_evaluation_mode ());
> I suggest "cond.eval." instead of "condeval". Better yet, how about
> "evaluated by"?
Sounds good. I'll make that change.
Fixed all the other comments.
> Btw, what happens if I set the mode to "stub" and the sub does not
> support this? Do I get any feedback, and if so, at what time?
If the target (stub) does not advertise support for condition
evaluation, nothing will happen. We will fallback to "gdb" mode
automatically.
Target-side condition evaluation only happens if:
1 - Target supports it (via ConditionalBreakpoints feature).
2 - breakpoint condition-evaluation is "auto" or "stub".
There isn't a warning message though.
I'll send an updated version of the patch with the fixes.
Thanks
--
Luis
lgustavo@codesourcery.com
next prev parent reply other threads:[~2012-01-06 22:38 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-05 14:56 Luis Machado
2012-01-06 8:47 ` Eli Zaretskii
2012-01-06 22:38 ` Luis Machado [this message]
2012-01-07 7:54 ` Eli Zaretskii
2012-01-12 19:44 ` Pedro Alves
2012-01-12 22:20 ` Tom Tromey
2012-01-13 8:08 ` Eli Zaretskii
2012-01-13 14:33 ` Tom Tromey
2012-01-13 14:44 ` Pedro Alves
2012-01-06 16:23 ` Pedro Alves
2012-01-10 11:14 ` Luis Machado
2012-01-12 19:31 ` Pedro Alves
2012-01-06 21:44 ` Tom Tromey
2012-01-10 14:51 ` Luis Machado
2012-01-13 15:36 ` Yao Qi
2012-01-13 18:13 ` Pedro Alves
2012-01-14 0:42 ` Yao Qi
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=4F07779A.10808@mentor.com \
--to=luis_gustavo@mentor.com \
--cc=eliz@gnu.org \
--cc=gdb-patches@sourceware.org \
/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