[PATCH v3 1/4] gdb/breakpoint: display "N" on MI for disabled-by-condition locations

Tankut Baris Aktemur via Gdb-patches
2021-04-21T12:18:16Z

For breakpoint locations that are disabled because of an invalid
condition, CLI displays "N*" in the 'enabled' field, where '*' refers
to the footnote below the table:

(*): Breakpoint condition is invalid at this location.

This is not necessary for MI, where we shall simply print "N" without
the footnote.

Update the document to mention the "N" value for the MI. Also remove
the line about the 'enable' field, because there is no such field for
locations.

gdb/ChangeLog:
2021-04-08 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>

* breakpoint.c (print_one_breakpoint_location): Display "N" for
disabled-by-condition locations on MI-like output.
(breakpoint_1): Do not display the disabled-by-condition footnote
if the output is MI-like.

gdb/doc/ChangeLog:
2021-04-08 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>

* gdb.texinfo (GDB/MI Breakpoint Information): Update the
description for the 'enabled' field of breakpoint locations.
---
gdb/breakpoint.c | 8 ++++++--
gdb/doc/gdb.texinfo | 13 ++++++++++---
2 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 16cf7977b62..0136019b4ae 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -6190,8 +6190,12 @@ print_one_breakpoint_location (struct breakpoint *b,

/* 4 */
annotate_field (3);
+ /* For locations that are disabled because of an invalid condition,
+ display "N*" on CLI, where "*" refers to a footnote below the
+ table. For MI, simply display a "N" without a footnote. */
+ const char *N = (uiout->is_mi_like_p ()) ? "N" : "N*";
if (part_of_multiple)
- uiout->field_string ("enabled", (loc->disabled_by_cond ? "N*"
+ uiout->field_string ("enabled", (loc->disabled_by_cond ? N
: (loc->enabled ? "y" : "n")));
else
uiout->field_fmt ("enabled", "%c", bpenables[(int) b->enable_state]);
@@ -6716,7 +6720,7 @@ breakpoint_1 (const char *bp_num_list, bool show_internal,
if (last_loc && !server_command)
set_next_address (last_loc->gdbarch, last_loc->address);

- if (has_disabled_by_cond_location)
+ if (has_disabled_by_cond_location && !uiout->is_mi_like_p ())
uiout->message (_("(*): Breakpoint condition is invalid at this "
"location.\n"));
}
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 51e1c64a98a..ec15654ba58 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -30047,9 +30047,16 @@ number of the parent breakpoint. The second digit is the number of the
location within that breakpoint.

@item enabled
-This indicates whether the location is enabled, in which case the
-value is @samp{y}, or disabled, in which case the value is @samp{n}.
-Note that this is not the same as the field @code{enable}.
+There are three possible values, with the following meanings:
+@table @code
+@item y
+The location is enabled.
+@item n
+The location is disabled by the user.
+@item N
+The location is disabled because the breakpoint condition is invalid
+at this location.
+@end table

@item addr
The address of this location as an hexidecimal number.
--
2.17.1