This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[RFA] info (break|watch|trace), use get_number_or_range
- From: Michael Snyder <msnyder at vmware dot com>
- To: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Fri, 18 Feb 2011 18:18:19 -0800
- Subject: [RFA] info (break|watch|trace), use get_number_or_range
I've always thought that info break should accept a list and/or a range.
Since this is an enhancement, I'll wait for review. OK?
Eli, I'll wait on the docs change until we agree what it should look like.
2011-02-18 Michael Snyder <msnyder@vmware.com>
* breakpoint.c (breakpoints_info): Re-implement using
get_number_or_range.
(watchpoints_info): Ditto.
(tracepoints_info): Ditto.
Index: breakpoint.c
===================================================================
RCS file: /cvs/src/src/gdb/breakpoint.c,v
retrieving revision 1.537
diff -u -p -u -p -r1.537 breakpoint.c
--- breakpoint.c 18 Feb 2011 16:43:53 -0000 1.537
+++ breakpoint.c 19 Feb 2011 02:15:26 -0000
@@ -5400,35 +5400,44 @@ default_collect_info (void)
}
static void
-breakpoints_info (char *bnum_exp, int from_tty)
+breakpoints_info (char *args, int from_tty)
{
- int bnum = -1;
-
- if (bnum_exp)
- bnum = parse_and_eval_long (bnum_exp);
+ if (args == NULL || *args == '\0')
+ breakpoint_1 (-1, 0, NULL);
+ else
+ while (args != NULL && *args != '\0')
+ {
+ int bnum = get_number_or_range (&args);
- breakpoint_1 (bnum, 0, NULL);
+ breakpoint_1 (bnum, 0, NULL);
+ }
default_collect_info ();
}
static void
-watchpoints_info (char *wpnum_exp, int from_tty)
+watchpoints_info (char *args, int from_tty)
{
- int wpnum = -1, num_printed;
-
- if (wpnum_exp)
- wpnum = parse_and_eval_long (wpnum_exp);
-
- num_printed = breakpoint_1 (wpnum, 0, is_watchpoint);
+ int wpnum = -1, num_printed = 0, thisnum;
- if (num_printed == 0)
+ if (args == NULL || *args == '\0')
{
- if (wpnum == -1)
+ num_printed = breakpoint_1 (-1, 0, is_watchpoint);
+ if (num_printed == 0)
ui_out_message (uiout, 0, "No watchpoints.\n");
- else
- ui_out_message (uiout, 0, "No watchpoint number %d.\n", wpnum);
}
+ else
+ while (args != NULL && *args != '\0')
+ {
+ wpnum = get_number_or_range (&args);
+ thisnum = breakpoint_1 (wpnum, 0, is_watchpoint);
+ num_printed += thisnum;
+ if (thisnum == 0)
+ ui_out_message (uiout, 0, "No watchpoint number %d.\n", wpnum);
+ }
+
+ if (num_printed == 0 && wpnum != -1)
+ ui_out_message (uiout, 0, "No watchpoints matched.\n");
}
static void
@@ -11682,22 +11691,28 @@ create_tracepoint_from_upload (struct up
omitted. */
static void
-tracepoints_info (char *tpnum_exp, int from_tty)
+tracepoints_info (char *args, int from_tty)
{
- int tpnum = -1, num_printed;
+ int tpnum = -1, num_printed = 0, thisnum;
- if (tpnum_exp)
- tpnum = parse_and_eval_long (tpnum_exp);
-
- num_printed = breakpoint_1 (tpnum, 0, is_tracepoint);
-
- if (num_printed == 0)
+ if (args == NULL || *args == '\0')
{
- if (tpnum == -1)
+ num_printed = breakpoint_1 (-1, 0, is_tracepoint);
+ if (num_printed == 0)
ui_out_message (uiout, 0, "No tracepoints.\n");
- else
- ui_out_message (uiout, 0, "No tracepoint number %d.\n", tpnum);
}
+ else
+ while (args != NULL && *args != '\0')
+ {
+ tpnum = get_number_or_range (&args);
+ thisnum = breakpoint_1 (tpnum, 0, is_tracepoint);
+ num_printed += thisnum;
+ if (thisnum == 0)
+ ui_out_message (uiout, 0, "No tracepoint number %d.\n", tpnum);
+ }
+
+ if (num_printed == 0 && tpnum != -1)
+ ui_out_message (uiout, 0, "No tracepoints matched.\n");
default_collect_info ();
}
@@ -12369,7 +12384,7 @@ Break in function/address or break at a
add_cmd ("at", class_breakpoint, stopat_command,
_("Break at a line in the current file."), &stoplist);
add_com ("status", class_info, breakpoints_info, _("\
-Status of user-settable breakpoints, or breakpoint number NUMBER.\n\
+Status of all user-settable breakpoints, or a list or range of breakpoints.\n\
The \"Type\" column indicates one of:\n\
\tbreakpoint - normal breakpoint\n\
\twatchpoint - watchpoint\n\