aboutsummaryrefslogtreecommitdiff
path: root/gdb/mi
diff options
context:
space:
mode:
authorYao Qi <yao@codesourcery.com>2012-08-09 12:53:46 +0000
committerYao Qi <yao@codesourcery.com>2012-08-09 12:53:46 +0000
commit5b9afe8a3531f45255ee97465b52d2769a9a8ab5 (patch)
tree7d475e24cb1da1640836ae4b9ed9840f07291ef8 /gdb/mi
parentd21911eaddba472db273e212ae6047186974f394 (diff)
downloadgdb-5b9afe8a3531f45255ee97465b52d2769a9a8ab5.zip
gdb-5b9afe8a3531f45255ee97465b52d2769a9a8ab5.tar.gz
gdb-5b9afe8a3531f45255ee97465b52d2769a9a8ab5.tar.bz2
gdb/
* cli/cli-decode.c (set_cmd_prefix): New. (lookup_cmd_for_prefixlist): New. (add_prefix_cmd): Call set_cmd_prefix and update field 'prefix' of each cmd_list_element in *prefixlist. (add_setshow_cmd_full): set_cmd_prefix. (add_alias_cmd): Likewise. * cli/cli-decode.h (struct cmd_list_element) <prefix>: New field. Declare 'auto_boolean_enums'. * cli/cli-setshow.c: Include "observer.h". (notify_command_param_changed_p): New. (add_setshow_auto_boolean_cmd): Move auto_boolean_enums out. Remove 'static'. (do_setshow_command): Split it to ... (do_set_command, do_show_command): ... them. New. (do_set_command): Call observer_notify_command_param_changed if notify_command_param_changed_p returns true. (cmd_show_list): Caller update. * auto-load.c (set_auto_load_cmd): Likewise. * remote.c (show_remote_cmd): Likewise. * cli/cli-setshow.h: Update declarations. * top.c (execute_command): Call do_set_command and do_show_command. * NEWS: Mention new MI notification. * mi/mi-interp.c: Declare mi_command_param_changed. (mi_interpreter_init): Attach mi_command_param_changed to observer command_param_changed. (mi_command_param_changed): New. Remove mi_suppress_breakpoint_notifications. Define global variable mi_suppress_notification. (mi_breakpoint_created): Update. (mi_breakpoint_deleted): Likewise. (mi_breakpoint_modified): Likewise. * mi/mi-main.c (mi_cmd_execute): Likewise. Check command 'gdb-set' and set mi_suppress_notification. * mi/mi-main.h: (mi_suppress_notification): New struct. gdb/doc/ * observer.texi: New observer command_param_changed. * gdb.texinfo (GDB/MI Async Records): Doc for '=cmd-param-changed'. gdb/testsuite/ * gdb.mi/mi-cmd-param-changed.exp: New. * gdb.mi/mi-cli.exp: Update for MI notification "=cmd-param-changed". * gdb.mi/mi-var-rtti.exp, gdb.mi/mi2-cli.exp: Likewise. * gdb.mi/mi2-prompt.exp: Likewise.
Diffstat (limited to 'gdb/mi')
-rw-r--r--gdb/mi/mi-interp.c44
-rw-r--r--gdb/mi/mi-main.c11
-rw-r--r--gdb/mi/mi-main.h10
3 files changed, 56 insertions, 9 deletions
diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c
index b487136..94df818 100644
--- a/gdb/mi/mi-interp.c
+++ b/gdb/mi/mi-interp.c
@@ -71,6 +71,7 @@ static void mi_about_to_proceed (void);
static void mi_breakpoint_created (struct breakpoint *b);
static void mi_breakpoint_deleted (struct breakpoint *b);
static void mi_breakpoint_modified (struct breakpoint *b);
+static void mi_command_param_changed (const char *param, const char *value);
static int report_initial_inferior (struct inferior *inf, void *closure);
@@ -128,6 +129,7 @@ mi_interpreter_init (struct interp *interp, int top_level)
observer_attach_breakpoint_created (mi_breakpoint_created);
observer_attach_breakpoint_deleted (mi_breakpoint_deleted);
observer_attach_breakpoint_modified (mi_breakpoint_modified);
+ observer_attach_command_param_changed (mi_command_param_changed);
/* The initial inferior is created before this function is
called, so we need to report it explicitly. Use iteration in
@@ -501,10 +503,14 @@ mi_about_to_proceed (void)
mi_proceeded = 1;
}
-/* When non-zero, no MI notifications will be emitted in
- response to breakpoint change observers. */
+/* When the element is non-zero, no MI notifications will be emitted in
+ response to the corresponding observers. */
-int mi_suppress_breakpoint_notifications = 0;
+struct mi_suppress_notification mi_suppress_notification =
+ {
+ 0,
+ 0,
+ };
/* Emit notification about a created breakpoint. */
@@ -515,7 +521,7 @@ mi_breakpoint_created (struct breakpoint *b)
struct ui_out *mi_uiout = interp_ui_out (top_level_interpreter ());
volatile struct gdb_exception e;
- if (mi_suppress_breakpoint_notifications)
+ if (mi_suppress_notification.breakpoint)
return;
if (b->number <= 0)
@@ -546,7 +552,7 @@ mi_breakpoint_deleted (struct breakpoint *b)
{
struct mi_interp *mi = top_level_interpreter_data ();
- if (mi_suppress_breakpoint_notifications)
+ if (mi_suppress_notification.breakpoint)
return;
if (b->number <= 0)
@@ -569,7 +575,7 @@ mi_breakpoint_modified (struct breakpoint *b)
struct ui_out *mi_uiout = interp_ui_out (top_level_interpreter ());
volatile struct gdb_exception e;
- if (mi_suppress_breakpoint_notifications)
+ if (mi_suppress_notification.breakpoint)
return;
if (b->number <= 0)
@@ -730,6 +736,32 @@ mi_solib_unloaded (struct so_list *solib)
gdb_flush (mi->event_channel);
}
+/* Emit notification about the command parameter change. */
+
+static void
+mi_command_param_changed (const char *param, const char *value)
+{
+ struct mi_interp *mi = top_level_interpreter_data ();
+ struct ui_out *mi_uiout = interp_ui_out (top_level_interpreter ());
+
+ if (mi_suppress_notification.cmd_param_changed)
+ return;
+
+ target_terminal_ours ();
+
+ fprintf_unfiltered (mi->event_channel,
+ "cmd-param-changed");
+
+ ui_out_redirect (mi_uiout, mi->event_channel);
+
+ ui_out_field_string (mi_uiout, "param", param);
+ ui_out_field_string (mi_uiout, "value", value);
+
+ ui_out_redirect (mi_uiout, NULL);
+
+ gdb_flush (mi->event_channel);
+}
+
static int
report_initial_inferior (struct inferior *inf, void *closure)
{
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
index dfb4892..4db3652 100644
--- a/gdb/mi/mi-main.c
+++ b/gdb/mi/mi-main.c
@@ -2099,8 +2099,15 @@ mi_cmd_execute (struct mi_parse *parse)
if (strncmp (parse->command, "break-", sizeof ("break-") - 1 ) == 0)
{
- make_cleanup_restore_integer (&mi_suppress_breakpoint_notifications);
- mi_suppress_breakpoint_notifications = 1;
+ make_cleanup_restore_integer (&mi_suppress_notification.breakpoint);
+ mi_suppress_notification.breakpoint = 1;
+ }
+ else if (strncmp (parse->command, "gdb-set", sizeof ("gdb-set") - 1) == 0)
+ {
+ int *p = &mi_suppress_notification.cmd_param_changed;
+
+ make_cleanup_restore_integer (p);
+ mi_suppress_notification.cmd_param_changed = 1;
}
if (parse->cmd->argv_func != NULL)
diff --git a/gdb/mi/mi-main.h b/gdb/mi/mi-main.h
index beac2cd..f4268c2 100644
--- a/gdb/mi/mi-main.h
+++ b/gdb/mi/mi-main.h
@@ -32,7 +32,15 @@ extern char *current_token;
extern int running_result_record_printed;
extern int mi_proceeded;
-extern int mi_suppress_breakpoint_notifications;
+
+struct mi_suppress_notification
+{
+ /* Breakpoint notification suppressed? */
+ int breakpoint;
+ /* Command param changed notification suppressed? */
+ int cmd_param_changed;
+};
+extern struct mi_suppress_notification mi_suppress_notification;
#endif