From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14686 invoked by alias); 19 Feb 2011 02:18:30 -0000 Received: (qmail 14671 invoked by uid 22791); 19 Feb 2011 02:18:28 -0000 X-SWARE-Spam-Status: No, hits=-4.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp-outbound-1.vmware.com (HELO smtp-outbound-1.vmware.com) (65.115.85.69) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 19 Feb 2011 02:18:23 +0000 Received: from mailhost2.vmware.com (mailhost2.vmware.com [10.16.67.167]) by smtp-outbound-1.vmware.com (Postfix) with ESMTP id E80D04D001 for ; Fri, 18 Feb 2011 18:18:19 -0800 (PST) Received: from msnyder-server.eng.vmware.com (promd-2s-dhcp138.eng.vmware.com [10.20.124.138]) by mailhost2.vmware.com (Postfix) with ESMTP id D77998EEAE for ; Fri, 18 Feb 2011 18:18:19 -0800 (PST) Message-ID: <4D5F286B.3060207@vmware.com> Date: Sat, 19 Feb 2011 08:21:00 -0000 From: Michael Snyder User-Agent: Thunderbird 2.0.0.24 (X11/20101201) MIME-Version: 1.0 To: "gdb-patches@sourceware.org" Subject: [RFA] info (break|watch|trace), use get_number_or_range Content-Type: multipart/mixed; boundary="------------030304030007080008080203" X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-02/txt/msg00507.txt.bz2 This is a multi-part message in MIME format. --------------030304030007080008080203 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 208 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. --------------030304030007080008080203 Content-Type: text/plain; name="getnum3.txt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="getnum3.txt" Content-length: 3673 2011-02-18 Michael Snyder * 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\ --------------030304030007080008080203--