From: Nick Roberts <nickrob@snap.net.nz>
To: Daniel Jacobowitz <drow@false.org>
Cc: Vladimir Prus <ghost@cs.msu.su>, gdb-patches@sources.redhat.com
Subject: Re: [BUG:MI] -break-list doesn't list multiple breakpoints
Date: Sun, 13 Jan 2008 21:26:00 -0000 [thread overview]
Message-ID: <18314.33230.101539.472963@kahikatea.snap.net.nz> (raw)
In-Reply-To: <20080111225452.GA26085@caradoc.them.org>
> > 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 <nickrob@snap.net.nz>
* 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 ----
next prev parent reply other threads:[~2008-01-13 21:26 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-10 22:08 Nick Roberts
2008-01-11 17:36 ` Vladimir Prus
2008-01-11 21:34 ` Nick Roberts
2008-01-11 22:55 ` Daniel Jacobowitz
2008-01-11 23:38 ` Nick Roberts
2008-01-15 17:08 ` Vladimir Prus
2008-01-15 21:38 ` Nick Roberts
2008-01-13 21:26 ` Nick Roberts [this message]
2008-01-29 19:16 ` Daniel Jacobowitz
2008-01-29 22:53 ` Nick Roberts
2008-01-29 23:31 ` Daniel Jacobowitz
2008-01-30 0:52 ` Nick Roberts
2008-01-30 3:04 ` Nick Roberts
2008-01-30 3:20 ` Daniel Jacobowitz
2008-01-30 5:59 ` Vladimir Prus
2008-01-30 7:14 ` Nick Roberts
2008-01-30 7:32 ` Vladimir Prus
2008-01-30 7:50 ` Nick Roberts
2008-01-30 7:58 ` Vladimir Prus
2008-02-01 20:15 ` Marc Khouzam
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=18314.33230.101539.472963@kahikatea.snap.net.nz \
--to=nickrob@snap.net.nz \
--cc=drow@false.org \
--cc=gdb-patches@sources.redhat.com \
--cc=ghost@cs.msu.su \
/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