From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28622 invoked by alias); 13 Jan 2008 21:26:10 -0000 Received: (qmail 28614 invoked by uid 22791); 13 Jan 2008 21:26:09 -0000 X-Spam-Check-By: sourceware.org Received: from viper.snap.net.nz (HELO viper.snap.net.nz) (202.37.101.8) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sun, 13 Jan 2008 21:25:40 +0000 Received: from kahikatea.snap.net.nz (137.31.255.123.static.snap.net.nz [123.255.31.137]) by viper.snap.net.nz (Postfix) with ESMTP id BE2AC3D943F; Mon, 14 Jan 2008 10:25:36 +1300 (NZDT) Received: by kahikatea.snap.net.nz (Postfix, from userid 1000) id E92E18FC6D; Mon, 14 Jan 2008 10:25:34 +1300 (NZDT) From: Nick Roberts MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <18314.33230.101539.472963@kahikatea.snap.net.nz> Date: Sun, 13 Jan 2008 21:26:00 -0000 To: Daniel Jacobowitz Cc: Vladimir Prus , gdb-patches@sources.redhat.com Subject: Re: [BUG:MI] -break-list doesn't list multiple breakpoints In-Reply-To: <20080111225452.GA26085@caradoc.them.org> References: <18310.38708.144719.374963@kahikatea.snap.net.nz> <18311.57557.312425.107700@kahikatea.snap.net.nz> <20080111225452.GA26085@caradoc.them.org> X-Mailer: VM 7.19 under Emacs 23.0.50.28 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: 2008-01/txt/msg00322.txt.bz2 > > I'm not sure of the logic of committing an incomplete patch, but in any > > case I think this needs to be fixed before the next release. > > I disagree. If someone needs this functionality in MI, they are > invited to contribute it. Unless I'm completely mistaken, what > happened previously in MI was even worse. Here's a patch that fixes this but does much more. The 'fix' works by removing the frame details in the MI output: (gdb) -break-insert 10 ^done this means that the condition: && !ui_out_is_mi_like_p (uiout)) can be removed from print_one_breakpoint so that -break-list prints details of all the multiple breakpoint locations. This may seem extreme but my reasoning is that a front end can keep an up-to date breakpoint list by running -break-list behind the user's back, which is presumably relatively inxepensive. With Emacs, I currently use "info break" to do this as it easier than trying to parse the output of the breakpoint commands. I would probably never use the output of -break-insert because the user could set a breakpoint using the CLI "break" command from the GUD buffer, and commands like "enable" and "disable" (and "-break-enable"/ "break-disable") provide no output. By comparison, it's also interesting to note that frame details get printed using "--fullname" whenever they change, i.e., when execution stops or with commands like "up" and "frame", while in MI the details only get printed when execution stops: (gdb) -stack-select-frame 1 ^done (gdb) This necessitates running -stack-info-frame behind the user's back. Even if -stack-select-frame did print frame details, Emacs would still have to use -stack-info-frame because of the GUD buffer again. This patch has the added attraction of removing the last use of deprecated_set_gdb_event_hooks and clear_gdb_event_hooks, so they could also be removed from gdb-events.sh/c. -- Nick http://www.inet.net.nz/~nickrob 2008-01-14 Nick Roberts * mi/mi-cmd-break.c (breakpoint_notify, breakpoint_hooks): Delete. (mi_cmd_break_insert): Don't use deprecated_set_gdb_event_hooks. * breakpoint.c (struct captured_breakpoint_query_args) (do_captured_breakpoint_query, gdb_breakpoint_query): Delete. (print_one_breakpoint): Call print_one_breakpoint_location from MI too. *** breakpoint.c.~1.296~ 2008-01-14 09:33:18.000000000 +1300 --- breakpoint.c 2008-01-14 09:33:38.000000000 +1300 *************** print_one_breakpoint (struct breakpoint *** 3619,3626 **** represent "breakpoint enabled, location disabled" situation. */ if (b->loc ! && (b->loc->next || !b->loc->enabled) ! && !ui_out_is_mi_like_p (uiout)) { struct bp_location *loc; int n = 1; --- 3619,3625 ---- represent "breakpoint enabled, location disabled" situation. */ if (b->loc ! && (b->loc->next || !b->loc->enabled)) { struct bp_location *loc; int n = 1; *************** print_one_breakpoint (struct breakpoint *** 3631,3672 **** } - struct captured_breakpoint_query_args - { - int bnum; - }; - - static int - do_captured_breakpoint_query (struct ui_out *uiout, void *data) - { - struct captured_breakpoint_query_args *args = data; - struct breakpoint *b; - CORE_ADDR dummy_addr = 0; - ALL_BREAKPOINTS (b) - { - if (args->bnum == b->number) - { - print_one_breakpoint (b, &dummy_addr); - return GDB_RC_OK; - } - } - return GDB_RC_NONE; - } - - enum gdb_rc - gdb_breakpoint_query (struct ui_out *uiout, int bnum, char **error_message) - { - struct captured_breakpoint_query_args args; - args.bnum = bnum; - /* For the moment we don't trust print_one_breakpoint() to not throw - an error. */ - if (catch_exceptions_with_msg (uiout, do_captured_breakpoint_query, &args, - error_message, RETURN_MASK_ALL) < 0) - return GDB_RC_FAIL; - else - return GDB_RC_OK; - } - /* Return non-zero if B is user settable (breakpoints, watchpoints, catchpoints, et.al.). */ --- 3630,3635 ---- *** mi-cmd-break.c.~1.18.~ 2008-01-04 10:24:34.000000000 +1300 --- mi-cmd-break.c 2008-01-13 23:30:11.000000000 +1300 *************** enum *** 32,54 **** FROM_TTY = 0 }; - /* Output a single breakpoint. */ - - static void - breakpoint_notify (int b) - { - gdb_breakpoint_query (uiout, b, NULL); - } - - - struct gdb_events breakpoint_hooks = - { - breakpoint_notify, - breakpoint_notify, - breakpoint_notify, - }; - - enum bp_type { REG_BP, --- 32,37 ---- *************** mi_cmd_break_insert (char *command, char *** 70,76 **** char *condition = NULL; int pending = 0; enum gdb_rc rc; - struct gdb_events *old_hooks; enum opt { HARDWARE_OPT, TEMP_OPT /*, REGEXP_OPT */ , CONDITION_OPT, --- 53,58 ---- *************** mi_cmd_break_insert (char *command, char *** 131,137 **** address = argv[optind]; /* Now we have what we need, let's insert the breakpoint! */ - old_hooks = deprecated_set_gdb_event_hooks (&breakpoint_hooks); switch (type) { case REG_BP: --- 113,118 ---- *************** mi_cmd_break_insert (char *command, char *** 161,167 **** internal_error (__FILE__, __LINE__, _("mi_cmd_break_insert: Bad switch.")); } - deprecated_set_gdb_event_hooks (old_hooks); if (rc == GDB_RC_FAIL) return MI_CMD_ERROR; --- 142,147 ----