From: Nick Roberts <nickrob@snap.net.nz>
To: dodji@seketeli.org, gdb-patches@sourceware.org
Subject: [PATCH] Re: bug in mi when setting breakpoint
Date: Wed, 16 Jan 2008 22:37:00 -0000 [thread overview]
Message-ID: <18318.34560.237450.362651@kahikatea.snap.net.nz> (raw)
In-Reply-To: <18316.10856.89097.335103@kahikatea.snap.net.nz>
[continued from gdb mailing list]
> How about doing something similar in FSF GDB?
Like below?
Apple also have a MI command called -break-commands which I want to add to FSF
GDB to avoid similar prompting problems in MI with "commands".
--
Nick http://www.inet.net.nz/~nickrob
2008-01-17 Nick Roberts <nickrob@snap.net.nz>
Based on work by Apple Computer, Inc.
* linespec.c: Include mi/mi-cmds.h.
(decode_objc, find_method): When using MI, set accept_all to 1.
(decode_line_2): Add argument accept_all. Accept all breakpoints
when non-zero.
* mi/mi-interp.c (mi_underlying): New variable
(mi_insert_notify_hooks, mi_remove_notify_hooks): Use it.
* mi/mi-cmds.h (mi_underlying): New extern.
*** mi-cmds.h.~1.27.~ 2008-01-04 10:24:35.000000000 +1300
--- mi-cmds.h 2008-01-15 17:25:11.000000000 +1300
*************** extern struct ui_file *raw_stdout;
*** 158,161 ****
--- 158,164 ----
extern char *mi_error_message;
extern void mi_execute_command (char *cmd, int from_tty);
+ /* From mi-interp.c */
+ extern int mi_underlying;
+
#endif
*** mi-interp.c.~1.23.~ 2008-01-04 10:24:35.000000000 +1300
--- mi-interp.c 2008-01-17 11:12:57.000000000 +1300
*************** struct mi_interp
*** 47,52 ****
--- 47,55 ----
struct interp *mi_interp;
};
+ /* Set to 1 to make CLI commands behave as MI would like. */
+ int mi_underlying = 0;
+
/* These are the interpreter setup, etc. functions for the MI interpreter */
static void mi_execute_command_wrapper (char *cmd);
static void mi_command_loop (int mi_version);
*************** static void
*** 264,275 ****
--- 267,280 ----
mi_insert_notify_hooks (void)
{
deprecated_query_hook = mi_interp_query_hook;
+ mi_underlying = 1;
}
static void
mi_remove_notify_hooks (void)
{
deprecated_query_hook = NULL;
+ mi_underlying = 0;
}
static int
*** linespec.c.~1.74.~ 2008-01-04 10:24:14.000000000 +1300
--- linespec.c 2008-01-15 17:42:11.000000000 +1300
***************
*** 36,41 ****
--- 36,42 ----
#include "linespec.h"
#include "exceptions.h"
#include "language.h"
+ #include "mi/mi-cmds.h"
/* We share this one with symtab.c, but it is not exported widely. */
*************** static char *find_toplevel_char (char *s
*** 102,108 ****
static int is_objc_method_format (const char *s);
static struct symtabs_and_lines decode_line_2 (struct symbol *[],
! int, int, char ***);
static struct symtab *symtab_from_filename (char **argptr,
char *p, int is_quote_enclosed,
--- 103,109 ----
static int is_objc_method_format (const char *s);
static struct symtabs_and_lines decode_line_2 (struct symbol *[],
! int, int, int, char ***);
static struct symtab *symtab_from_filename (char **argptr,
char *p, int is_quote_enclosed,
*************** is_objc_method_format (const char *s)
*** 482,487 ****
--- 483,489 ----
static struct symtabs_and_lines
decode_line_2 (struct symbol *sym_arr[], int nelts, int funfirstline,
+ int accept_all,
char ***canonical)
{
struct symtabs_and_lines values, return_values;
*************** decode_line_2 (struct symbol *sym_arr[],
*** 507,512 ****
--- 509,515 ----
}
i = 0;
+ if (!accept_all)
printf_unfiltered (_("[0] cancel\n[1] all\n"));
while (i < nelts)
{
*************** decode_line_2 (struct symbol *sym_arr[],
*** 515,547 ****
if (sym_arr[i] && SYMBOL_CLASS (sym_arr[i]) == LOC_BLOCK)
{
values.sals[i] = find_function_start_sal (sym_arr[i], funfirstline);
! if (values.sals[i].symtab)
! printf_unfiltered ("[%d] %s at %s:%d\n",
! (i + 2),
! SYMBOL_PRINT_NAME (sym_arr[i]),
! values.sals[i].symtab->filename,
! values.sals[i].line);
! else
! printf_unfiltered (_("[%d] %s at ?FILE:%d [No symtab? Probably broken debug info...]\n"),
! (i + 2),
! SYMBOL_PRINT_NAME (sym_arr[i]),
! values.sals[i].line);
!
}
else
printf_unfiltered (_("?HERE\n"));
i++;
}
! prompt = getenv ("PS2");
! if (prompt == NULL)
{
! prompt = "> ";
}
! args = command_line_input (prompt, 0, "overload-choice");
!
! if (args == 0 || *args == 0)
! error_no_arg (_("one or more choice numbers"));
i = 0;
while (*args)
--- 518,565 ----
if (sym_arr[i] && SYMBOL_CLASS (sym_arr[i]) == LOC_BLOCK)
{
values.sals[i] = find_function_start_sal (sym_arr[i], funfirstline);
! if (!accept_all)
! {
! if (values.sals[i].symtab)
! printf_unfiltered ("[%d] %s at %s:%d\n",
! (i + 2),
! SYMBOL_PRINT_NAME (sym_arr[i]),
! values.sals[i].symtab->filename,
! values.sals[i].line);
! else
! printf_unfiltered ("[%d] %s at ?FILE:%d [No symtab? Probably broken debug info...]\n",
! (i + 2),
! SYMBOL_PRINT_NAME (sym_arr[i]),
! values.sals[i].line);
! }
! }
! else if (!accept_all)
! {
! /* APPLE LOCAL: We can do a little better than just printing ?HERE?... */
! printf_filtered ("[%d] %s\n",
! (i + 2),
! (sym_arr[i] && SYMBOL_PRINT_NAME (sym_arr[i])) ?
! SYMBOL_PRINT_NAME (sym_arr[i]) : "?HERE?");
}
else
printf_unfiltered (_("?HERE\n"));
i++;
}
! if (!accept_all)
{
! prompt = getenv ("PS2");
! if (prompt == NULL)
! {
! prompt = "> ";
! }
! args = command_line_input (prompt, 0, "overload-choice");
!
! if (args == 0 || *args == 0)
! error_no_arg ("one or more choice numbers");
}
! else
! args = "1";
i = 0;
while (*args)
*************** decode_objc (char **argptr, int funfirst
*** 1154,1161 ****
if (i1 > 1)
{
/* More than one match. The user must choose one or more. */
! return decode_line_2 (sym_arr, i2, funfirstline, canonical);
}
return values;
--- 1172,1184 ----
if (i1 > 1)
{
+ int accept_all;
+ if (mi_underlying == 1 || ui_out_is_mi_like_p (uiout))
+ accept_all = 1;
+ else
+ accept_all = 0;
/* More than one match. The user must choose one or more. */
! return decode_line_2 (sym_arr, i2, funfirstline, accept_all, canonical);
}
return values;
*************** find_method (int funfirstline, char ***c
*** 1442,1450 ****
}
if (i1 > 0)
{
/* There is more than one field with that name
(overloaded). Ask the user which one to use. */
! return decode_line_2 (sym_arr, i1, funfirstline, canonical);
}
else
{
--- 1465,1479 ----
}
if (i1 > 0)
{
+ int accept_all;
+ if (mi_underlying == 1 || ui_out_is_mi_like_p (uiout))
+ accept_all = 1;
+ else
+ accept_all = 0;
+
/* There is more than one field with that name
(overloaded). Ask the user which one to use. */
! return decode_line_2 (sym_arr, i1, funfirstline, accept_all, canonical);
}
else
{
next parent reply other threads:[~2008-01-16 22:37 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20071216125625.GE4783@coin>
[not found] ` <18277.36237.521792.245470@kahikatea.snap.net.nz>
[not found] ` <18316.10856.89097.335103@kahikatea.snap.net.nz>
2008-01-16 22:37 ` Nick Roberts [this message]
2008-01-17 14:26 ` Vladimir Prus
2008-01-17 20:35 ` Nick Roberts
2008-01-19 11:52 ` Vladimir Prus
2008-01-19 21:45 ` Nick Roberts
2008-01-20 10:08 ` Vladimir Prus
2008-01-20 10:38 ` Nick Roberts
2008-01-20 11:09 ` Vladimir Prus
2008-01-20 20:32 ` Nick Roberts
2008-01-21 7:28 ` Vladimir Prus
2008-01-21 8:41 ` Nick Roberts
2008-01-29 20:15 ` Daniel Jacobowitz
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=18318.34560.237450.362651@kahikatea.snap.net.nz \
--to=nickrob@snap.net.nz \
--cc=dodji@seketeli.org \
--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