From: "Aktemur, Tankut Baris via Gdb-patches" <gdb-patches@sourceware.org>
To: Simon Marchi <simark@simark.ca>,
"gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: RE: [PATCH v2 1/2] gdb/breakpoint: disable a bp location if condition is invalid at that location
Date: Fri, 25 Sep 2020 18:15:18 +0000 [thread overview]
Message-ID: <SN6PR11MB2893891D70BAE9DA57E037F3C4360@SN6PR11MB2893.namprd11.prod.outlook.com> (raw)
In-Reply-To: <1414acbd-293a-3af4-3540-a75c2f70d25c@simark.ca>
On Friday, September 25, 2020 6:10 PM, Simon Marchi wrote:
> On 2020-09-25 11:49 a.m., Aktemur, Tankut Baris via Gdb-patches wrote:
> > While revising the code, I noticed that when the breakpoint is being defined for
> > the first time using "break" command, the locations are re-ordered according to
> > their addresses. So, tracking and reporting the location number as we iterate over
> > SALs is useless. Instead, we can report the location address.
> >
> > Based on this, how about the first option you gave above, but using "validate" instead
> > of "resolve"? For the "break" command, it reports the address in hex:
> >
> > warning: failed to validate condition at location 0x1120, disabling: No symbol "a" in
> current context.
>
> Ok, it would be nicer if we could refer to location numbers at the point
> where we validate the conditions, it would make a more consistent
> experience, but that works for now.
We can skip printing the warning but save the exception message inside the loc object.
Once we are done iterating the locations, we can go over the now-ordered list to print
the warnings together with the location numbers. How does that sound?
> > But for the "cond" command, the location number is used because it's stable.
> >
> > warning: failed to validate condition at location 2, disabling: No symbol "a" in current
> context.
> >
> > Perhaps we can break the message at the comma to avoid this long line.
>
> I don't mind... as long as it's clear that it's one message broken on
> two lines, not two message.
OK, I'll check the GDB doc to see how it looks and will break the line
if necessary.
> >>> Breakpoint 1 at 0x117d: included.c:1. (3 locations)
> >>> (gdb) break included.c:1 if c == 30
> >>> Note: breakpoint 1 also set at pc 0x117d.
> >>> warning: disabling breakpoint location 1: No symbol "c" in current context.
> >>> Note: breakpoint 1 also set at pc 0x119c.
> >>> warning: disabling breakpoint location 2: No symbol "c" in current context.
> >>> Note: breakpoint 1 also set at pc 0x11cf.
> >>> Breakpoint 2 at 0x117d: included.c:1. (3 locations)
> >>> (gdb) info break
> >>> Num Type Disp Enb Address What
> >>> 1 breakpoint keep y <MULTIPLE>
> >>> stop only if a == 10
> >>> 1.1 y 0x000000000000117d in func1 at included.c:1
> >>> 1.2 n 0x000000000000119c in func2 at included.c:1
> >>> 1.3 n 0x00000000000011cf in func3 at included.c:1
> >>> 2 breakpoint keep y <MULTIPLE>
> >>> stop only if c == 30
> >>> 2.1 n 0x000000000000117d in func1 at included.c:1
> >>> 2.2 n 0x000000000000119c in func2 at included.c:1
> >>> 2.3 y 0x00000000000011cf in func3 at included.c:1
> >>
> >> Should we somehow show in the listing that the locations disabled
> >> because of the condition are disabled and can't be enabled? For
> >> example, a capital N in the "Enb" column?
> >
> > I like the capital N notation. Patch is updated.
>
> Ok. Honestly, I find it a bit a bit cryptic, but I don't see a better
> way without being overly verbose. Perhaps a legend like we have on info
> shared would help?
>
> (*): Shared library is missing debugging information.
I don't have a strong preference. The legend approach would be fine, too.
> > Done, with a small change:
> >
> > Breakpoint 1's condition is invalid at location 2, cannot enable.
> >
> > OK with this?
>
> Sounds good!
>
> >>>
> >>> Resetting the condition enables the locations back:
> >>>
> >>> ...
> >>> (gdb) cond 1
> >>> Breakpoint 1.2 is now enabled.
> >>> Breakpoint 1.3 is now enabled.
> >>
> >> Likewise, this doesn't say why these locations suddenly get enabled.
> >> Should it? Something like "Breakpoint condition now resolves at
> >> location 1.2, enabling.". Or is it obvious, because the user is already
> >> using the "condition" command?
> >
> > I think it's useful to say a bit more because the user may have forgotten about
> > the condition. To be consistent with the message above, how about this:
> >
> > Breakpoint 1's condition is now valid at location 2, enabling.
>
> Sounds good too.
>
> > One additional note: I noticed that the existing "Breakpoint N is now unconditional"
> > message is guarded by 'from_tty'. I added the same guard to the "...enabling"
> > messages, too.
>
> Do you see any reason for that? Even if these commands are executed in
> a script, I'd like to be notified about these changes. What do you
> think?
I had aimed to be consistent with the "... now unconditional" message, but I agree.
When hidden, such messages sometimes cost valuable time loss. I'll remove the from_tty
guards I added.
> >>> +static void
> >>> +set_breakpoint_location_condition (const char *cond_string, bp_location *loc,
> >>> + int bp_num, int loc_num)
> >>> +{
> >>> + bool has_junk = false;
> >>> + try
> >>> + {
> >>> + expression_up new_exp = parse_exp_1 (&cond_string, loc->address,
> >>> + block_for_pc (loc->address), 0);
> >>> + if (*cond_string != 0)
> >>> + has_junk = true;
> >>> + else
> >>> + {
> >>> + loc->cond = std::move (new_exp);
> >>> + if (loc->disabled_by_cond && loc->enabled)
> >>> + printf_filtered (_("Breakpoint %d.%d is now enabled.\n"),
> >>> + bp_num, loc_num);
> >>> +
> >>> + loc->disabled_by_cond = false;
> >>> + }
> >>> + }
> >>> + catch (const gdb_exception_error &e)
> >>> + {
> >>> + if (bp_num != 0)
> >>> + warning (_("disabling breakpoint %d.%d: %s"),
> >>> + bp_num, loc_num, e.what ());
> >>> + else
> >>> + warning (_("disabling breakpoint location %d: %s"),
> >>> + loc_num, e.what ());
> >>
> >> When is bp_num 0?
> >
> > It's 0 if the breakpoint is being defined for the first time using the
> > "break ... if ..." command. It's non-zero if defined previously and is now
> > becoming conditional.
>
> Ok. And is this warning (when bp_num is 0) exercised in the tests? I
> don't remember seeing it as a test expected output, but maybe I just
> missed it.
>
> Simon
Yes, it is exercised as one of the first tests. The "break func if a == 10"
command goes through this path, while "cond 1 a == 10" goes through the bp_num != 0
path.
Thanks
-Baris
Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Gary Kershaw
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928
next prev parent reply other threads:[~2020-09-25 18:15 UTC|newest]
Thread overview: 103+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-31 15:42 [PATCH 0/2] Breakpoint conditions at locations with differing contexts Tankut Baris Aktemur
[not found] ` <cover.1596209606.git.tankut.baris.aktemur@intel.com>
2020-07-31 15:42 ` [PATCH 1/2] gdb/breakpoint: disable a bp location if condition is invalid at that location Tankut Baris Aktemur
2020-07-31 15:42 ` [RFC][PATCH 2/2] gdb/breakpoint: add a '-force' flag to the 'condition' command Tankut Baris Aktemur
2020-08-03 10:28 ` Andrew Burgess
2020-08-20 21:24 ` [PATCH v2 0/2] Breakpoint conditions at locations with differing contexts Tankut Baris Aktemur
2020-08-20 21:24 ` [PATCH v2 1/2] gdb/breakpoint: disable a bp location if condition is invalid at that location Tankut Baris Aktemur
2020-09-19 3:05 ` Simon Marchi
2020-09-25 15:49 ` Aktemur, Tankut Baris via Gdb-patches
2020-09-25 16:10 ` Simon Marchi
2020-09-25 18:15 ` Aktemur, Tankut Baris via Gdb-patches [this message]
2020-10-13 12:24 ` Aktemur, Tankut Baris via Gdb-patches
2020-08-20 21:24 ` [PATCH v2 2/2] gdb/breakpoint: add flags to 'condition' and 'break' commands to force condition Tankut Baris Aktemur
2020-09-04 11:02 ` [PATCH v2 0/2] Breakpoint conditions at locations with differing contexts Tankut Baris Aktemur
2020-09-11 11:56 ` Tankut Baris Aktemur
2020-09-18 20:36 ` [PING][PATCH " Tankut Baris Aktemur
2020-09-25 15:51 ` [PATCH v3 " Tankut Baris Aktemur via Gdb-patches
2020-09-25 15:51 ` [PATCH v3 1/2] gdb/breakpoint: disable a bp location if condition is invalid at that location Tankut Baris Aktemur via Gdb-patches
2020-09-25 15:51 ` [PATCH v3 2/2] gdb/breakpoint: add flags to 'condition' and 'break' commands to force condition Tankut Baris Aktemur via Gdb-patches
2020-10-13 12:25 ` [PATCH v4 0/2] Breakpoint conditions at locations with differing contexts Tankut Baris Aktemur via Gdb-patches
2020-10-13 12:25 ` [PATCH v4 1/2] gdb/breakpoint: disable a bp location if condition is invalid at that location Tankut Baris Aktemur via Gdb-patches
2020-10-13 15:06 ` Eli Zaretskii via Gdb-patches
2020-10-13 15:17 ` Aktemur, Tankut Baris via Gdb-patches
2020-10-16 22:20 ` Simon Marchi
2020-10-13 12:25 ` [PATCH v4 2/2] gdb/breakpoint: add flags to 'condition' and 'break' commands to force condition Tankut Baris Aktemur via Gdb-patches
2020-10-13 15:08 ` Eli Zaretskii via Gdb-patches
2020-10-13 15:46 ` Aktemur, Tankut Baris via Gdb-patches
2020-10-13 16:12 ` Eli Zaretskii via Gdb-patches
2020-10-16 22:45 ` Simon Marchi
2020-10-19 13:58 ` Aktemur, Tankut Baris via Gdb-patches
2020-10-19 14:07 ` Simon Marchi
2020-10-27 10:13 ` Aktemur, Tankut Baris via Gdb-patches
2020-10-29 10:10 ` Tom de Vries
2020-10-29 10:30 ` Aktemur, Tankut Baris via Gdb-patches
2020-10-29 17:30 ` Pedro Alves
2020-11-10 19:33 ` Aktemur, Tankut Baris via Gdb-patches
2020-12-05 17:30 ` Pedro Alves
2020-12-10 20:30 ` Tom Tromey
2020-12-15 11:20 ` Aktemur, Tankut Baris via Gdb-patches
2020-11-10 19:51 ` Aktemur, Tankut Baris via Gdb-patches
2020-10-28 16:57 ` [PATCH v4 0/2] Breakpoint conditions at locations with differing contexts Gary Benson via Gdb-patches
2020-10-29 7:43 ` Aktemur, Tankut Baris via Gdb-patches
2021-04-05 17:45 ` [PATCH " Jonah Graham
2021-04-06 14:11 ` Aktemur, Tankut Baris via Gdb-patches
2021-04-06 14:37 ` Jonah Graham
2021-04-07 7:09 ` Aktemur, Tankut Baris via Gdb-patches
2021-04-07 11:26 ` Jonah Graham
2021-04-07 14:55 ` [PATCH 0/4] Multi-context invalid breakpoint conditions and MI Tankut Baris Aktemur via Gdb-patches
2021-04-07 14:55 ` [PATCH 1/4] gdb/doc: update the 'enabled' field's description for BP locations in MI Tankut Baris Aktemur via Gdb-patches
2021-04-07 15:15 ` Eli Zaretskii via Gdb-patches
2021-04-07 21:42 ` Simon Marchi via Gdb-patches
2021-04-07 14:55 ` [PATCH 2/4] testsuite, gdb.mi: fix duplicate test names in mi-break.exp Tankut Baris Aktemur via Gdb-patches
2021-04-07 21:49 ` Simon Marchi via Gdb-patches
2021-04-07 14:55 ` [PATCH 3/4] gdb/breakpoint: add a 'force_condition' parameter to 'create_breakpoint' Tankut Baris Aktemur via Gdb-patches
2021-04-07 22:08 ` Simon Marchi via Gdb-patches
2021-04-08 7:44 ` Aktemur, Tankut Baris via Gdb-patches
2021-04-08 13:59 ` Simon Marchi via Gdb-patches
2021-04-08 14:19 ` Aktemur, Tankut Baris via Gdb-patches
2021-04-07 14:55 ` [PATCH 4/4] gdb/mi: add a '-b' flag to the '-break-insert' cmd to force the condition Tankut Baris Aktemur via Gdb-patches
2021-04-07 15:18 ` Eli Zaretskii via Gdb-patches
2021-04-07 15:27 ` Aktemur, Tankut Baris via Gdb-patches
2021-04-07 15:53 ` Eli Zaretskii via Gdb-patches
2021-04-07 16:05 ` Aktemur, Tankut Baris via Gdb-patches
2021-04-07 16:50 ` Eli Zaretskii via Gdb-patches
2021-04-07 22:26 ` Simon Marchi via Gdb-patches
2021-04-08 14:22 ` [PATCH v2 0/4] Multi-context invalid breakpoint conditions and MI Tankut Baris Aktemur via Gdb-patches
2021-04-08 14:22 ` [PATCH v2 1/4] gdb/breakpoint: display "N" on MI for disabled-by-condition locations Tankut Baris Aktemur via Gdb-patches
2021-04-08 15:04 ` Eli Zaretskii via Gdb-patches
2021-04-08 14:22 ` [PATCH v2 2/4] testsuite, gdb.mi: fix duplicate test names in mi-break.exp Tankut Baris Aktemur via Gdb-patches
2021-04-08 14:22 ` [PATCH v2 3/4] gdb/breakpoint: add a 'force_condition' parameter to 'create_breakpoint' Tankut Baris Aktemur via Gdb-patches
2021-04-08 14:22 ` [PATCH v2 4/4] gdb/mi: add a '--force-condition' flag to the '-break-insert' cmd Tankut Baris Aktemur via Gdb-patches
2021-04-08 15:06 ` Eli Zaretskii via Gdb-patches
2021-04-08 15:12 ` Aktemur, Tankut Baris via Gdb-patches
2021-04-11 1:06 ` Jonah Graham
2021-04-11 1:12 ` Simon Marchi via Gdb-patches
2021-04-21 12:06 ` Aktemur, Tankut Baris via Gdb-patches
2021-04-21 12:36 ` Simon Marchi via Gdb-patches
2021-04-11 1:13 ` [PATCH v2 0/4] Multi-context invalid breakpoint conditions and MI Jonah Graham
2021-04-21 12:17 ` [PATCH v3 " Tankut Baris Aktemur via Gdb-patches
2021-04-21 12:17 ` [PATCH v3 1/4] gdb/breakpoint: display "N" on MI for disabled-by-condition locations Tankut Baris Aktemur via Gdb-patches
2021-04-21 12:48 ` Eli Zaretskii via Gdb-patches
2021-04-21 12:17 ` [PATCH v3 2/4] testsuite, gdb.mi: fix duplicate test names in mi-break.exp Tankut Baris Aktemur via Gdb-patches
2021-04-21 12:17 ` [PATCH v3 3/4] gdb/breakpoint: add a 'force_condition' parameter to 'create_breakpoint' Tankut Baris Aktemur via Gdb-patches
2021-04-21 13:18 ` Simon Marchi via Gdb-patches
2021-04-21 13:29 ` Aktemur, Tankut Baris via Gdb-patches
2021-04-21 14:28 ` Simon Marchi via Gdb-patches
2021-04-21 12:17 ` [PATCH v3 4/4] gdb/mi: add a '--force-condition' flag to the '-break-insert' cmd Tankut Baris Aktemur via Gdb-patches
2021-04-21 12:50 ` Eli Zaretskii via Gdb-patches
2021-04-21 13:37 ` Simon Marchi via Gdb-patches
2021-04-21 13:49 ` Aktemur, Tankut Baris via Gdb-patches
2021-04-21 14:26 ` Simon Marchi via Gdb-patches
2021-04-22 14:35 ` [PATCH v4 0/2] Multi-context invalid breakpoint conditions and MI Tankut Baris Aktemur via Gdb-patches
2021-04-22 14:35 ` [PATCH v4 1/2] gdb/mi: add a '--force-condition' flag to the '-break-insert' cmd Tankut Baris Aktemur via Gdb-patches
2021-05-06 2:40 ` Simon Marchi via Gdb-patches
2021-04-22 14:35 ` [PATCH v4 2/2] gdb/mi: add a '--force' flag to the '-break-condition' command Tankut Baris Aktemur via Gdb-patches
2021-04-22 14:47 ` Aktemur, Tankut Baris via Gdb-patches
2021-05-06 2:46 ` Simon Marchi via Gdb-patches
2021-05-06 8:50 ` Aktemur, Tankut Baris via Gdb-patches
2021-07-11 18:51 ` Jonah Graham
2021-07-12 0:25 ` Jonah Graham
2021-07-12 8:33 ` Aktemur, Tankut Baris via Gdb-patches
2021-05-05 15:57 ` [PATCH v4 0/2] Multi-context invalid breakpoint conditions and MI Aktemur, Tankut Baris via Gdb-patches
2021-04-07 21:24 ` [PATCH 0/2] Breakpoint conditions at locations with differing contexts Simon Marchi via Gdb-patches
2021-04-07 21:36 ` Jonah Graham
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=SN6PR11MB2893891D70BAE9DA57E037F3C4360@SN6PR11MB2893.namprd11.prod.outlook.com \
--to=gdb-patches@sourceware.org \
--cc=simark@simark.ca \
--cc=tankut.baris.aktemur@intel.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