From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15616 invoked by alias); 18 Sep 2011 16:17:18 -0000 Received: (qmail 15603 invoked by uid 22791); 18 Sep 2011 16:17:17 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,TW_BP,TW_TB X-Spam-Check-By: sourceware.org Received: from mail-fx0-f41.google.com (HELO mail-fx0-f41.google.com) (209.85.161.41) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 18 Sep 2011 16:17:02 +0000 Received: by fxh17 with SMTP id 17so3575755fxh.0 for ; Sun, 18 Sep 2011 09:17:00 -0700 (PDT) Received: by 10.223.44.89 with SMTP id z25mr2341243fae.42.1316362600067; Sun, 18 Sep 2011 09:16:40 -0700 (PDT) MIME-Version: 1.0 Received: by 10.223.123.2 with HTTP; Sun, 18 Sep 2011 09:16:00 -0700 (PDT) From: Hui Zhu Date: Mon, 19 Sep 2011 03:50:00 -0000 Message-ID: Subject: [PATCH] Add command resetbpnum for reset $bpnum To: gdb-patches ml Content-Type: text/plain; charset=ISO-8859-1 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-09/txt/msg00350.txt.bz2 Hi, I found we never set the breakpoint number back in GDB. And sometime, I fount that user need reset $bpnum to the current last number. So I make a patch add command resetbpnum for reset $bpnum to the last number of the current breakpoints. Then we can got: (gdb) b *0 Breakpoint 1 at 0x0 (gdb) b *0 Note: breakpoint 1 also set at pc 0x0. Breakpoint 2 at 0x0 (gdb) b *0 Note: breakpoints 1 and 2 also set at pc 0x0. Breakpoint 3 at 0x0 (gdb) info b Num Type Disp Enb Address What 1 breakpoint keep y 0x00000000 2 breakpoint keep y 0x00000000 3 breakpoint keep y 0x00000000 (gdb) d 3 (gdb) info b Num Type Disp Enb Address What 1 breakpoint keep y 0x00000000 2 breakpoint keep y 0x00000000 (gdb) resetbpnum (gdb) b *0 Note: breakpoints 1 and 2 also set at pc 0x0. Breakpoint 3 at 0x0 (gdb) info b Num Type Disp Enb Address What 1 breakpoint keep y 0x00000000 2 breakpoint keep y 0x00000000 3 breakpoint keep y 0x00000000 Please help me review it. Best, Hui 2011-09-19 Hui Zhu * breakpoint.c (resetbpnum_command): New function. (_initialize_breakpoint): Register resetbpnum_command. --- breakpoint.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) --- a/breakpoint.c +++ b/breakpoint.c @@ -13272,6 +13272,20 @@ iterate_over_breakpoints (int (*callback return NULL; } +static void +resetbpnum_command (char *args, int from_tty) +{ + struct breakpoint *b; + int num = 0; + + ALL_BREAKPOINTS (b) + { + if (b->number > num) + num = b->number; + } + set_breakpoint_count (num); +} + void initialize_breakpoint_ops (void) { @@ -13955,6 +13969,9 @@ The breakpoint will stop execution of th an instruction at any address within the [START-LOCATION, END-LOCATION]\n\ range (including START-LOCATION and END-LOCATION).")); + add_com ("resetbpnum", class_breakpoint, resetbpnum_command, _("\ +Reset $bpnum to the last number of the current breakpoints.")); + automatic_hardware_breakpoints = 1; observer_attach_about_to_proceed (breakpoint_about_to_proceed);