Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Michael Snyder <msnyder@vmware.com>
To: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: [RFA] info (break|watch|trace), use get_number_or_range
Date: Sat, 19 Feb 2011 08:21:00 -0000	[thread overview]
Message-ID: <4D5F286B.3060207@vmware.com> (raw)

[-- 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\

             reply	other threads:[~2011-02-19  2:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-19  8:21 Michael Snyder [this message]
2011-02-19 12:15 ` Pedro Alves
2011-02-19 19:12 msnyder
2011-02-20 21:34 ` Pedro Alves
2011-02-21 20:05   ` Michael Snyder

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=4D5F286B.3060207@vmware.com \
    --to=msnyder@vmware.com \
    --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