Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* Re: [RFA] info (break|watch|trace), use get_number_or_range
@ 2011-02-19 19:12 msnyder
  2011-02-20 21:34 ` Pedro Alves
  0 siblings, 1 reply; 5+ messages in thread
From: msnyder @ 2011-02-19 19:12 UTC (permalink / raw)
  To: gdb-patches; +Cc: pedro


> This will break printing internal breakpoints, which are negative.

AFAIK, "info break" never supported printing internal breakpoints.
That's what "maint info break" is for.

Michael



^ permalink raw reply	[flat|nested] 5+ messages in thread
* [RFA] info (break|watch|trace), use get_number_or_range
@ 2011-02-19  8:21 Michael Snyder
  2011-02-19 12:15 ` Pedro Alves
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Snyder @ 2011-02-19  8:21 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 208 bytes --]

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.


[-- Attachment #2: getnum3.txt --]
[-- Type: text/plain, Size: 3673 bytes --]

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\

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-02-21 19:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-19 19:12 [RFA] info (break|watch|trace), use get_number_or_range msnyder
2011-02-20 21:34 ` Pedro Alves
2011-02-21 20:05   ` Michael Snyder
  -- strict thread matches above, loose matches on Subject: below --
2011-02-19  8:21 Michael Snyder
2011-02-19 12:15 ` Pedro Alves

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox