aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Snyder <msnyder@vmware.com>2010-05-17 20:49:39 +0000
committerMichael Snyder <msnyder@vmware.com>2010-05-17 20:49:39 +0000
commit102040f0d08b06980adf402c17b2f039fee7d23c (patch)
treeef6558f84010ba8af6ee46b4cfddc6d5d24b5752
parentcdb27c12f30352674694895e06f615fd28ebdbec (diff)
downloadgdb-102040f0d08b06980adf402c17b2f039fee7d23c.zip
gdb-102040f0d08b06980adf402c17b2f039fee7d23c.tar.gz
gdb-102040f0d08b06980adf402c17b2f039fee7d23c.tar.bz2
2010-05-17 Michael Snyder <msnyder@vmware.com>
* mi/mi-cmd-break.c: White space. * mi/mi-cmd-env.c: White space. * mi/mi-cmds.c: White space. * mi/mi-cmd-stack.c: White space. * mi/mi-cmd-var.c: White space. * mi/mi-console.c: White space. * mi/mi-getopt.c: White space. * mi/mi-interp.c: White space. * mi/mi-main.c: White space. * mi/mi-out.c: White space. * mi/mi-parse.c: White space.
-rw-r--r--gdb/ChangeLog12
-rw-r--r--gdb/mi/mi-cmd-break.c6
-rw-r--r--gdb/mi/mi-cmd-env.c3
-rw-r--r--gdb/mi/mi-cmd-stack.c4
-rw-r--r--gdb/mi/mi-cmd-var.c11
-rw-r--r--gdb/mi/mi-cmds.c2
-rw-r--r--gdb/mi/mi-console.c5
-rw-r--r--gdb/mi/mi-getopt.c1
-rw-r--r--gdb/mi/mi-interp.c18
-rw-r--r--gdb/mi/mi-main.c40
-rw-r--r--gdb/mi/mi-out.c20
-rw-r--r--gdb/mi/mi-parse.c9
12 files changed, 122 insertions, 9 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index c5c3d7e..a05f867 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,17 @@
2010-05-17 Michael Snyder <msnyder@vmware.com>
+ * mi/mi-cmd-break.c: White space.
+ * mi/mi-cmd-env.c: White space.
+ * mi/mi-cmds.c: White space.
+ * mi/mi-cmd-stack.c: White space.
+ * mi/mi-cmd-var.c: White space.
+ * mi/mi-console.c: White space.
+ * mi/mi-getopt.c: White space.
+ * mi/mi-interp.c: White space.
+ * mi/mi-main.c: White space.
+ * mi/mi-out.c: White space.
+ * mi/mi-parse.c: White space.
+
* cli/cli-cmds.c: White space.
* cli/cli-decode.c: White space.
* cli/cli-dump.c: White space.
diff --git a/gdb/mi/mi-cmd-break.c b/gdb/mi/mi-cmd-break.c
index dcb7ed9..2d3b8b0 100644
--- a/gdb/mi/mi-cmd-break.c
+++ b/gdb/mi/mi-cmd-break.c
@@ -99,6 +99,7 @@ mi_cmd_break_insert (char *command, char **argv, int argc)
to denote the end of the option list. */
int optind = 0;
char *optarg;
+
while (1)
{
int opt = mi_getopt ("mi_cmd_break_insert", argc, argv, opts, &optind, &optarg);
@@ -217,9 +218,12 @@ mi_cmd_break_watch (char *command, char **argv, int argc)
/* Parse arguments. */
int optind = 0;
char *optarg;
+
while (1)
{
- int opt = mi_getopt ("mi_cmd_break_watch", argc, argv, opts, &optind, &optarg);
+ int opt = mi_getopt ("mi_cmd_break_watch", argc, argv,
+ opts, &optind, &optarg);
+
if (opt < 0)
break;
switch ((enum opt) opt)
diff --git a/gdb/mi/mi-cmd-env.c b/gdb/mi/mi-cmd-env.c
index cdd25f2..24f6426 100644
--- a/gdb/mi/mi-cmd-env.c
+++ b/gdb/mi/mi-cmd-env.c
@@ -52,6 +52,7 @@ env_execute_cli_command (const char *cmd, const char *args)
{
struct cleanup *old_cleanups;
char *run;
+
if (args != NULL)
run = xstrprintf ("%s %s", cmd, args);
else
@@ -141,6 +142,7 @@ mi_cmd_env_path (char *command, char **argv, int argc)
{
int opt = mi_getopt ("mi_cmd_env_path", argc, argv, opts,
&optind, &optarg);
+
if (opt < 0)
break;
switch ((enum opt) opt)
@@ -211,6 +213,7 @@ mi_cmd_env_dir (char *command, char **argv, int argc)
{
int opt = mi_getopt ("mi_cmd_env_dir", argc, argv, opts,
&optind, &optarg);
+
if (opt < 0)
break;
switch ((enum opt) opt)
diff --git a/gdb/mi/mi-cmd-stack.c b/gdb/mi/mi-cmd-stack.c
index decc5f2..6797055 100644
--- a/gdb/mi/mi-cmd-stack.c
+++ b/gdb/mi/mi-cmd-stack.c
@@ -204,6 +204,7 @@ mi_cmd_stack_list_args (char *command, char **argv, int argc)
i++, fi = get_prev_frame (fi))
{
struct cleanup *cleanup_frame;
+
QUIT;
cleanup_frame = make_cleanup_ui_out_tuple_begin_end (uiout, "frame");
ui_out_field_int (uiout, "level", i);
@@ -309,6 +310,7 @@ list_args_or_locals (enum what_to_list what, int values, struct frame_info *fi)
struct cleanup *cleanup_tuple = NULL;
struct symbol *sym2;
struct value *val;
+
if (values != PRINT_NO_VALUES || what == all)
cleanup_tuple =
make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
@@ -333,6 +335,7 @@ list_args_or_locals (enum what_to_list what, int values, struct frame_info *fi)
&& TYPE_CODE (type) != TYPE_CODE_UNION)
{
struct value_print_options opts;
+
val = read_var_value (sym2, fi);
get_raw_print_options (&opts);
opts.deref_ref = 1;
@@ -345,6 +348,7 @@ list_args_or_locals (enum what_to_list what, int values, struct frame_info *fi)
case PRINT_ALL_VALUES:
{
struct value_print_options opts;
+
val = read_var_value (sym2, fi);
get_raw_print_options (&opts);
opts.deref_ref = 1;
diff --git a/gdb/mi/mi-cmd-var.c b/gdb/mi/mi-cmd-var.c
index 023bbb5..310ade9 100644
--- a/gdb/mi/mi-cmd-var.c
+++ b/gdb/mi/mi-cmd-var.c
@@ -62,6 +62,7 @@ print_varobj (struct varobj *var, enum print_values print_values,
if (mi_print_value_p (var, print_values))
{
char *val = varobj_get_value (var);
+
ui_out_field_string (uiout, "value", val);
xfree (val);
}
@@ -435,6 +436,7 @@ mi_cmd_var_list_children (char *command, char **argv, int argc)
if (from < to)
{
struct cleanup *cleanup_children;
+
if (mi_version (uiout) == 1)
cleanup_children
= make_cleanup_ui_out_tuple_begin_end (uiout, "children");
@@ -446,6 +448,7 @@ mi_cmd_var_list_children (char *command, char **argv, int argc)
++ix)
{
struct cleanup *cleanup_child;
+
cleanup_child = make_cleanup_ui_out_tuple_begin_end (uiout, "child");
print_varobj (child, print_values, 1 /* print expression */);
do_cleanups (cleanup_child);
@@ -554,7 +557,9 @@ mi_cmd_var_evaluate_expression (char *command, char **argv, int argc)
optind = 0;
while (1)
{
- int opt = mi_getopt ("-var-evaluate-expression", argc, argv, opts, &optind, &optarg);
+ int opt = mi_getopt ("-var-evaluate-expression", argc, argv,
+ opts, &optind, &optarg);
+
if (opt < 0)
break;
switch ((enum opt) opt)
@@ -581,12 +586,14 @@ mi_cmd_var_evaluate_expression (char *command, char **argv, int argc)
if (formatFound)
{
char *val = varobj_get_formatted_value (var, format);
+
ui_out_field_string (uiout, "value", val);
xfree (val);
}
else
{
char *val = varobj_get_value (var);
+
ui_out_field_string (uiout, "value", val);
xfree (val);
}
@@ -732,6 +739,7 @@ varobj_update_one (struct varobj *var, enum print_values print_values,
if (mi_print_value_p (r->varobj, print_values))
{
char *val = varobj_get_value (r->varobj);
+
ui_out_field_string (uiout, "value", val);
xfree (val);
}
@@ -784,6 +792,7 @@ varobj_update_one (struct varobj *var, enum print_values print_values,
for (j = 0; VEC_iterate (varobj_p, r->new, j, child); ++j)
{
struct cleanup *cleanup_child;
+
cleanup_child = make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
print_varobj (child, print_values, 1 /* print_expression */);
do_cleanups (cleanup_child);
diff --git a/gdb/mi/mi-cmds.c b/gdb/mi/mi-cmds.c
index 92311e8..8441e17 100644
--- a/gdb/mi/mi-cmds.c
+++ b/gdb/mi/mi-cmds.c
@@ -164,6 +164,7 @@ lookup_table (const char *command)
{
const char *chp;
unsigned int index = 0;
+
/* compute our hash */
for (chp = command; *chp; chp++)
{
@@ -203,6 +204,7 @@ build_table (struct mi_cmd *commands)
for (command = commands; command->name != 0; command++)
{
struct mi_cmd **entry = lookup_table (command->name);
+
if (*entry)
internal_error (__FILE__, __LINE__,
_("command `%s' appears to be duplicated"),
diff --git a/gdb/mi/mi-console.c b/gdb/mi/mi-console.c
index 80596e4..eb5d074 100644
--- a/gdb/mi/mi-console.c
+++ b/gdb/mi/mi-console.c
@@ -47,6 +47,7 @@ mi_console_file_new (struct ui_file *raw,
{
struct ui_file *ui_file = ui_file_new ();
struct mi_console_file *mi_console = XMALLOC (struct mi_console_file);
+
mi_console->magic = &mi_console_file_magic;
mi_console->raw = raw;
mi_console->buffer = mem_fileopen ();
@@ -62,6 +63,7 @@ static void
mi_console_file_delete (struct ui_file *file)
{
struct mi_console_file *mi_console = ui_file_data (file);
+
if (mi_console->magic != &mi_console_file_magic)
internal_error (__FILE__, __LINE__,
_("mi_console_file_delete: bad magic number"));
@@ -73,6 +75,7 @@ mi_console_file_fputs (const char *buf,
struct ui_file *file)
{
struct mi_console_file *mi_console = ui_file_data (file);
+
if (mi_console->magic != &mi_console_file_magic)
internal_error (__FILE__, __LINE__,
"mi_console_file_fputs: bad magic number");
@@ -90,6 +93,7 @@ mi_console_raw_packet (void *data,
long length_buf)
{
struct mi_console_file *mi_console = data;
+
if (mi_console->magic != &mi_console_file_magic)
internal_error (__FILE__, __LINE__,
_("mi_console_file_transform: bad magic number"));
@@ -116,6 +120,7 @@ static void
mi_console_file_flush (struct ui_file *file)
{
struct mi_console_file *mi_console = ui_file_data (file);
+
if (mi_console->magic != &mi_console_file_magic)
internal_error (__FILE__, __LINE__,
_("mi_console_file_flush: bad magic number"));
diff --git a/gdb/mi/mi-getopt.c b/gdb/mi/mi-getopt.c
index 78301e3..19a318a 100644
--- a/gdb/mi/mi-getopt.c
+++ b/gdb/mi/mi-getopt.c
@@ -30,6 +30,7 @@ mi_getopt (const char *prefix,
{
char *arg;
struct mi_opt *opt;
+
/* We assume that argv/argc are ok. */
if (*optind > argc || *optind < 0)
internal_error (__FILE__, __LINE__,
diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c
index c6d7160..f18406b 100644
--- a/gdb/mi/mi-interp.c
+++ b/gdb/mi/mi-interp.c
@@ -113,8 +113,8 @@ static int
mi_interpreter_resume (void *data)
{
struct mi_interp *mi = data;
- /* As per hack note in mi_interpreter_init, swap in the output channels... */
+ /* As per hack note in mi_interpreter_init, swap in the output channels... */
gdb_setup_readline ();
/* These overwrite some of the initialization done in
@@ -170,6 +170,7 @@ static struct gdb_exception
mi_interpreter_exec (void *data, const char *command)
{
char *tmp = alloca (strlen (command) + 1);
+
strcpy (tmp, command);
mi_execute_command_wrapper (tmp);
return exception_none;
@@ -213,6 +214,7 @@ mi_cmd_interpreter_exec (char *command, char **argv, int argc)
for (i = 1; i < argc; i++)
{
struct gdb_exception e = interp_exec (interp_to_use, argv[i]);
+
if (e.reason < 0)
{
mi_error_message = xstrdup (e.message);
@@ -327,6 +329,7 @@ static void
mi_inferior_added (struct inferior *inf)
{
struct mi_interp *mi = top_level_interpreter_data ();
+
target_terminal_ours ();
fprintf_unfiltered (mi->event_channel,
"thread-group-added,id=\"i%d\"",
@@ -338,6 +341,7 @@ static void
mi_inferior_appeared (struct inferior *inf)
{
struct mi_interp *mi = top_level_interpreter_data ();
+
target_terminal_ours ();
fprintf_unfiltered (mi->event_channel,
"thread-group-started,id=\"i%d\",pid=\"%d\"",
@@ -349,6 +353,7 @@ static void
mi_inferior_exit (struct inferior *inf)
{
struct mi_interp *mi = top_level_interpreter_data ();
+
target_terminal_ours ();
fprintf_unfiltered (mi->event_channel, "thread-group-exited,id=\"i%d\"",
inf->num);
@@ -359,6 +364,7 @@ static void
mi_inferior_removed (struct inferior *inf)
{
struct mi_interp *mi = top_level_interpreter_data ();
+
target_terminal_ours ();
fprintf_unfiltered (mi->event_channel,
"thread-group-removed,id=\"i%d\"",
@@ -377,6 +383,7 @@ mi_on_normal_stop (struct bpstats *bs, int print_frame)
if (print_frame)
{
int core;
+
if (uiout != mi_uiout)
{
/* The normal_stop function has printed frame information into
@@ -385,6 +392,7 @@ mi_on_normal_stop (struct bpstats *bs, int print_frame)
the frame again. In practice, this can only happen when running
a CLI command in MI. */
struct ui_out *saved_uiout = uiout;
+
uiout = mi_uiout;
print_stack_frame (get_selected_frame (NULL), 0, SRC_AND_LOC);
uiout = saved_uiout;
@@ -396,8 +404,9 @@ mi_on_normal_stop (struct bpstats *bs, int print_frame)
{
struct cleanup *back_to = make_cleanup_ui_out_list_begin_end
(mi_uiout, "stopped-threads");
+
ui_out_field_int (mi_uiout, NULL,
- pid_to_thread_id (inferior_ptid));
+ pid_to_thread_id (inferior_ptid));
do_cleanups (back_to);
}
else
@@ -424,6 +433,7 @@ mi_about_to_proceed (void)
if (!ptid_equal (inferior_ptid, null_ptid))
{
struct thread_info *tp = inferior_thread ();
+
if (tp->in_infcall)
return;
}
@@ -503,6 +513,7 @@ mi_on_resume (ptid_t ptid)
else
{
struct thread_info *ti = find_thread_ptid (ptid);
+
gdb_assert (ti);
fprintf_unfiltered (raw_stdout, "*running,thread-id=\"%d\"\n", ti->num);
}
@@ -525,6 +536,7 @@ static void
mi_solib_loaded (struct so_list *solib)
{
struct mi_interp *mi = top_level_interpreter_data ();
+
target_terminal_ours ();
if (gdbarch_has_global_solist (target_gdbarch))
fprintf_unfiltered (mi->event_channel,
@@ -548,6 +560,7 @@ static void
mi_solib_unloaded (struct so_list *solib)
{
struct mi_interp *mi = top_level_interpreter_data ();
+
target_terminal_ours ();
if (gdbarch_has_global_solist (target_gdbarch))
fprintf_unfiltered (mi->event_channel,
@@ -573,6 +586,7 @@ report_initial_inferior (struct inferior *inf, void *closure)
and top_level_interpreter_data is set, we cannot call
it here. */
struct mi_interp *mi = closure;
+
target_terminal_ours ();
fprintf_unfiltered (mi->event_channel,
"thread-group-added,id=\"i%d\"",
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
index 0024830..c9472ed 100644
--- a/gdb/mi/mi-main.c
+++ b/gdb/mi/mi-main.c
@@ -218,6 +218,7 @@ static int
proceed_thread_callback (struct thread_info *thread, void *arg)
{
int pid = *(int *)arg;
+
proceed_thread (thread, pid);
return 0;
}
@@ -253,6 +254,7 @@ exec_continue (char **argv, int argc)
else
{
struct cleanup *back_to = make_cleanup_restore_integer (&sched_multi);
+
if (current_context->all)
{
sched_multi = 1;
@@ -344,6 +346,7 @@ mi_cmd_exec_interrupt (char *command, char **argv, int argc)
else if (current_context->thread_group != -1)
{
struct inferior *inf = find_inferior_id (current_context->thread_group);
+
iterate_over_threads (interrupt_thread_callback, &inf->pid);
}
else
@@ -388,6 +391,7 @@ mi_cmd_exec_run (char *command, char **argv, int argc)
if (current_context->all)
{
struct cleanup *back_to = save_current_space_and_thread ();
+
iterate_over_inferiors (run_one_inferior, NULL);
do_cleanups (back_to);
}
@@ -403,6 +407,7 @@ static int
find_thread_of_process (struct thread_info *ti, void *p)
{
int pid = *(int *)p;
+
if (PIDGET (ti->ptid) == pid && !is_exited (ti->ptid))
return 1;
@@ -420,6 +425,7 @@ mi_cmd_target_detach (char *command, char **argv, int argc)
struct thread_info *tp;
char *end = argv[0];
int pid = strtol (argv[0], &end, 10);
+
if (*end != '\0')
error (_("Cannot parse thread group id '%s'"), argv[0]);
@@ -500,6 +506,7 @@ collect_cores (struct thread_info *ti, void *xdata)
if (ptid_get_pid (ti->ptid) == data->pid)
{
int core = target_core_of_thread (ti->ptid);
+
if (core != -1)
VEC_safe_push (int, data->cores, core);
}
@@ -511,6 +518,7 @@ static int *
unique (int *b, int *e)
{
int *d = b;
+
while (++b != e)
if (*d != *b)
*++d = *b;
@@ -607,6 +615,7 @@ static void
free_vector_of_ints (void *xvector)
{
VEC (int) **vector = xvector;
+
VEC_free (int, *vector);
}
@@ -619,6 +628,7 @@ static void
free_vector_of_osdata_items (splay_tree_value xvalue)
{
VEC (osdata_item_s) *value = (VEC (osdata_item_s) *) xvalue;
+
/* We don't free the items itself, it will be done separately. */
VEC_free (osdata_item_s, value);
}
@@ -628,6 +638,7 @@ splay_tree_int_comparator (splay_tree_key xa, splay_tree_key xb)
{
int a = xa;
int b = xb;
+
return a - b;
}
@@ -644,6 +655,7 @@ list_available_thread_groups (VEC (int) *ids, int recurse)
struct osdata *data;
struct osdata_item *item;
int ix_items;
+
/* This keeps a map from integer (pid) to VEC (struct osdata_item *)*
The vector contains information about all threads for the given pid.
This is assigned an initial value to avoid "may be used uninitialized"
@@ -657,8 +669,8 @@ list_available_thread_groups (VEC (int) *ids, int recurse)
if (recurse)
{
struct osdata *threads = get_osdata ("threads");
- make_cleanup_osdata_free (threads);
+ make_cleanup_osdata_free (threads);
tree = splay_tree_new (splay_tree_int_comparator,
do_nothing,
free_vector_of_osdata_items);
@@ -741,9 +753,9 @@ list_available_thread_groups (VEC (int) *ids, int recurse)
{
struct cleanup *back_to_2 =
make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
-
const char *tid = get_osdata_column (child, "tid");
const char *tcore = get_osdata_column (child, "core");
+
ui_out_field_string (uiout, "id", tid);
if (tcore)
ui_out_field_string (uiout, "core", tcore);
@@ -783,6 +795,7 @@ mi_cmd_list_thread_groups (char *command, char **argv, int argc)
{
int opt = mi_getopt ("-list-thread-groups", argc, argv, opts,
&optind, &optarg);
+
if (opt < 0)
break;
switch ((enum opt) opt)
@@ -805,6 +818,7 @@ mi_cmd_list_thread_groups (char *command, char **argv, int argc)
{
char *end;
int inf = strtoul (argv[optind], &end, 0);
+
if (*end != '\0')
error ("invalid group id '%s'", argv[optind]);
VEC_safe_push (int, ids, inf);
@@ -824,6 +838,7 @@ mi_cmd_list_thread_groups (char *command, char **argv, int argc)
{
/* Local thread groups, single id. */
int pid = *VEC_address (int, ids);
+
if (!in_inferior_list (pid))
error ("Invalid thread group id '%d'", pid);
print_thread_info (uiout, -1, pid);
@@ -831,6 +846,7 @@ mi_cmd_list_thread_groups (char *command, char **argv, int argc)
else
{
struct print_one_inferior_data data;
+
data.recurse = recurse;
data.inferiors = ids;
@@ -1094,6 +1110,7 @@ get_register (struct frame_info *frame, int regnum, int format)
{
int idx = gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG ?
j : register_size (gdbarch, regnum) - 1 - j;
+
sprintf (ptr, "%02x", (unsigned char) buffer[idx]);
ptr += 2;
}
@@ -1103,6 +1120,7 @@ get_register (struct frame_info *frame, int regnum, int format)
else
{
struct value_print_options opts;
+
get_formatted_print_options (&opts, format);
opts.deref_ref = 1;
val_print (register_type (gdbarch, regnum), buffer, 0, 0,
@@ -1259,6 +1277,7 @@ mi_cmd_data_read_memory (char *command, char **argv, int argc)
{
int opt = mi_getopt ("mi_cmd_data_read_memory", argc, argv, opts,
&optind, &optarg);
+
if (opt < 0)
break;
switch ((enum opt) opt)
@@ -1351,6 +1370,7 @@ mi_cmd_data_read_memory (char *command, char **argv, int argc)
struct cleanup *cleanup_list_memory;
int row;
int row_byte;
+
cleanup_list_memory = make_cleanup_ui_out_list_begin_end (uiout, "memory");
for (row = 0, row_byte = 0;
row < nr_rows;
@@ -1387,6 +1407,7 @@ mi_cmd_data_read_memory (char *command, char **argv, int argc)
if (aschar)
{
int byte;
+
ui_file_rewind (stream->stream);
for (byte = row_byte; byte < row_byte + word_size * nr_cols; byte++)
{
@@ -1457,6 +1478,7 @@ mi_cmd_data_write_memory (char *command, char **argv, int argc)
{
int opt = mi_getopt ("mi_cmd_data_write_memory", argc, argv, opts,
&optind, &optarg);
+
if (opt < 0)
break;
switch ((enum opt) opt)
@@ -1525,8 +1547,8 @@ mi_cmd_list_features (char *command, char **argv, int argc)
if (argc == 0)
{
struct cleanup *cleanup = NULL;
- cleanup = make_cleanup_ui_out_list_begin_end (uiout, "features");
+ cleanup = make_cleanup_ui_out_list_begin_end (uiout, "features");
ui_out_field_string (uiout, NULL, "frozen-varobjs");
ui_out_field_string (uiout, NULL, "pending-breakpoints");
ui_out_field_string (uiout, NULL, "thread-info");
@@ -1548,8 +1570,8 @@ mi_cmd_list_target_features (char *command, char **argv, int argc)
if (argc == 0)
{
struct cleanup *cleanup = NULL;
- cleanup = make_cleanup_ui_out_list_begin_end (uiout, "features");
+ cleanup = make_cleanup_ui_out_list_begin_end (uiout, "features");
if (target_can_async_p ())
ui_out_field_string (uiout, NULL, "async");
@@ -1655,6 +1677,7 @@ captured_mi_execute_command (struct ui_out *uiout, void *data)
case CLI_COMMAND:
{
char *argv[2];
+
/* A CLI command was read from the input stream. */
/* This "feature" will be removed as soon as we have a
complete set of mi commands. */
@@ -1761,12 +1784,14 @@ mi_execute_command (char *cmd, int from_tty)
else if (!ptid_equal (inferior_ptid, null_ptid))
{
struct thread_info *ti = inferior_thread ();
+
report_change = (ti->num != command->thread);
}
if (report_change)
{
struct thread_info *ti = inferior_thread ();
+
target_terminal_ours ();
fprintf_unfiltered (mi->event_channel,
"thread-selected,id=\"%d\"",
@@ -1827,6 +1852,7 @@ mi_cmd_execute (struct mi_parse *parse)
if (parse->thread != -1)
{
struct thread_info *tp = find_thread_id (parse->thread);
+
if (!tp)
error (_("Invalid thread id: %d"), parse->thread);
@@ -1840,6 +1866,7 @@ mi_cmd_execute (struct mi_parse *parse)
{
struct frame_info *fid;
int frame = parse->frame;
+
fid = find_relative_frame (get_current_frame (), &frame);
if (frame == 0)
/* find_relative_frame was successful */
@@ -1888,6 +1915,7 @@ mi_execute_cli_command (const char *cmd, int args_p, const char *args)
{
struct cleanup *old_cleanups;
char *run;
+
if (args_p)
run = xstrprintf ("%s %s", cmd, args);
else
@@ -1977,6 +2005,7 @@ mi_load_progress (const char *section_name,
if (new_section)
{
struct cleanup *cleanup_tuple;
+
xfree (previous_sect_name);
previous_sect_name = xstrdup (section_name);
@@ -1997,6 +2026,7 @@ mi_load_progress (const char *section_name,
delta.tv_usec >= update_threshold.tv_usec)
{
struct cleanup *cleanup_tuple;
+
last_update.tv_sec = time_now.tv_sec;
last_update.tv_usec = time_now.tv_usec;
if (current_token)
@@ -2044,6 +2074,7 @@ static void
print_diff_now (struct mi_timestamp *start)
{
struct mi_timestamp now;
+
timestamp (&now);
print_diff (start, &now);
}
@@ -2093,6 +2124,7 @@ mi_cmd_trace_define_variable (char *command, char **argv, int argc)
if (expr->nelts == 3 && expr->elts[0].opcode == OP_INTERNALVAR)
{
struct internalvar *intvar = expr->elts[1].internalvar;
+
if (intvar)
name = internalvar_name (intvar);
}
diff --git a/gdb/mi/mi-out.c b/gdb/mi/mi-out.c
index 1e94175..2b6b4a5 100644
--- a/gdb/mi/mi-out.c
+++ b/gdb/mi/mi-out.c
@@ -120,6 +120,7 @@ void
mi_table_body (struct ui_out *uiout)
{
mi_out_data *data = ui_out_data (uiout);
+
if (data->suppress_output)
return;
/* close the table header line if there were any headers */
@@ -133,6 +134,7 @@ void
mi_table_end (struct ui_out *uiout)
{
mi_out_data *data = ui_out_data (uiout);
+
data->suppress_output = 0;
mi_close (uiout, ui_out_type_list); /* body */
mi_close (uiout, ui_out_type_tuple);
@@ -146,6 +148,7 @@ mi_table_header (struct ui_out *uiout, int width, enum ui_align alignment,
const char *colhdr)
{
mi_out_data *data = ui_out_data (uiout);
+
if (data->suppress_output)
return;
mi_open (uiout, NULL, ui_out_type_tuple);
@@ -165,6 +168,7 @@ mi_begin (struct ui_out *uiout,
const char *id)
{
mi_out_data *data = ui_out_data (uiout);
+
if (data->suppress_output)
return;
mi_open (uiout, id, type);
@@ -178,6 +182,7 @@ mi_end (struct ui_out *uiout,
int level)
{
mi_out_data *data = ui_out_data (uiout);
+
if (data->suppress_output)
return;
mi_close (uiout, type);
@@ -189,8 +194,9 @@ void
mi_field_int (struct ui_out *uiout, int fldno, int width,
enum ui_align alignment, const char *fldname, int value)
{
- char buffer[20]; /* FIXME: how many chars long a %d can become? */
+ char buffer[20]; /* FIXME: how many chars long a %d can become? */
mi_out_data *data = ui_out_data (uiout);
+
if (data->suppress_output)
return;
@@ -205,6 +211,7 @@ mi_field_skip (struct ui_out *uiout, int fldno, int width,
enum ui_align alignment, const char *fldname)
{
mi_out_data *data = ui_out_data (uiout);
+
if (data->suppress_output)
return;
mi_field_string (uiout, fldno, width, alignment, fldname, "");
@@ -222,6 +229,7 @@ mi_field_string (struct ui_out *uiout,
const char *string)
{
mi_out_data *data = ui_out_data (uiout);
+
if (data->suppress_output)
return;
field_separator (uiout);
@@ -243,6 +251,7 @@ mi_field_fmt (struct ui_out *uiout, int fldno,
va_list args)
{
mi_out_data *data = ui_out_data (uiout);
+
if (data->suppress_output)
return;
field_separator (uiout);
@@ -281,6 +290,7 @@ void
mi_flush (struct ui_out *uiout)
{
mi_out_data *data = ui_out_data (uiout);
+
gdb_flush (data->buffer);
}
@@ -292,6 +302,7 @@ static void
field_separator (struct ui_out *uiout)
{
mi_out_data *data = ui_out_data (uiout);
+
if (data->suppress_field_separator)
data->suppress_field_separator = 0;
else
@@ -304,6 +315,7 @@ mi_open (struct ui_out *uiout,
enum ui_out_type type)
{
mi_out_data *data = ui_out_data (uiout);
+
field_separator (uiout);
data->suppress_field_separator = 1;
if (name)
@@ -326,6 +338,7 @@ mi_close (struct ui_out *uiout,
enum ui_out_type type)
{
mi_out_data *data = ui_out_data (uiout);
+
switch (type)
{
case ui_out_type_tuple:
@@ -346,6 +359,7 @@ void
mi_out_buffered (struct ui_out *uiout, char *string)
{
mi_out_data *data = ui_out_data (uiout);
+
fprintf_unfiltered (data->buffer, "%s", string);
}
@@ -355,6 +369,7 @@ void
mi_out_rewind (struct ui_out *uiout)
{
mi_out_data *data = ui_out_data (uiout);
+
ui_file_rewind (data->buffer);
}
@@ -371,6 +386,7 @@ mi_out_put (struct ui_out *uiout,
struct ui_file *stream)
{
mi_out_data *data = ui_out_data (uiout);
+
ui_file_put (data->buffer, do_write, stream);
ui_file_rewind (data->buffer);
}
@@ -381,6 +397,7 @@ int
mi_version (struct ui_out *uiout)
{
mi_out_data *data = ui_out_data (uiout);
+
return data->mi_version;
}
@@ -390,6 +407,7 @@ struct ui_out *
mi_out_new (int mi_version)
{
int flags = 0;
+
mi_out_data *data = XMALLOC (mi_out_data);
data->suppress_field_separator = 0;
data->suppress_output = 0;
diff --git a/gdb/mi/mi-parse.c b/gdb/mi/mi-parse.c
index c3f5eeb..a5a4e75 100644
--- a/gdb/mi/mi-parse.c
+++ b/gdb/mi/mi-parse.c
@@ -35,6 +35,7 @@ static int
mi_parse_escape (char **string_ptr)
{
int c = *(*string_ptr)++;
+
switch (c)
{
case '\n':
@@ -54,6 +55,7 @@ mi_parse_escape (char **string_ptr)
{
int i = host_hex_value (c);
int count = 0;
+
while (++count < 3)
{
c = (**string_ptr);
@@ -106,10 +108,12 @@ mi_parse_argv (char *args, struct mi_parse *parse)
char *chp = args;
int argc = 0;
char **argv = xmalloc ((argc + 1) * sizeof (char *));
+
argv[argc] = NULL;
while (1)
{
char *arg;
+
/* skip leading white space */
while (isspace (*chp))
chp++;
@@ -125,6 +129,7 @@ mi_parse_argv (char *args, struct mi_parse *parse)
/* A quoted string. */
int len;
char *start = chp + 1;
+
/* Determine the buffer size. */
chp = start;
len = 0;
@@ -182,6 +187,7 @@ mi_parse_argv (char *args, struct mi_parse *parse)
characters into a buffer. */
int len;
char *start = chp;
+
while (*chp != '\0' && !isspace (*chp))
{
chp++;
@@ -223,6 +229,7 @@ mi_parse (char *cmd)
{
char *chp;
struct mi_parse *parse = XMALLOC (struct mi_parse);
+
memset (parse, 0, sizeof (*parse));
parse->all = 0;
parse->thread_group = -1;
@@ -253,6 +260,7 @@ mi_parse (char *cmd)
/* Extract the command. */
{
char *tmp = chp + 1; /* discard ``-'' */
+
for (; *chp && !isspace (*chp); chp++)
;
parse->command = xmalloc ((chp - tmp + 1) * sizeof (char *));
@@ -289,6 +297,7 @@ mi_parse (char *cmd)
size_t tgs = sizeof ("--thread-group ") - 1;
size_t ts = sizeof ("--thread ") - 1;
size_t fs = sizeof ("--frame ") - 1;
+
if (strncmp (chp, "--all ", as) == 0)
{
parse->all = 1;