* mi/mi-cmd-break.c: Enforce coding standards, fix comments.
* mi/mi-cmd-disas.c: Ditto. * mi/mi-cmd-env.c: Ditto. * mi/mi-cmd-file.c: Ditto. * mi/mi-cmd-stack.c: Ditto. * mi/mi-cmd-target.c: Ditto. * mi/mi-cmd-var.c: Ditto. * mi/mi-cmds.c: Ditto. * mi/mi-cmds.h: Ditto. * mi/mi-console.c: Ditto. * mi/mi-getopt.c: Ditto. * mi/mi-getopt.h: Ditto. * mi/mi-interp.c: Ditto. * mi/mi-main.c: Ditto. * mi/mi-out.c: Ditto. * mi/mi-parse.c: Ditto. * mi/mi-parse.h: Ditto. * mi/mi-symbol-cmds.c: Ditto. * mi/mi-getopt.h: Move mi_opt struct up. * mi/mi-main.c (captured_mi_execute_command): Remove redundant return. * mi/mi-out.c (_initialize_mi_out): Remove empty initialize.
This commit is contained in:
parent
3ce231f8e2
commit
2b03b41d6a
19 changed files with 501 additions and 471 deletions
|
@ -1,3 +1,29 @@
|
||||||
|
2012-03-06 Stan Shebs <stan@codesourcery.com>
|
||||||
|
|
||||||
|
* mi/mi-cmd-break.c: Enforce coding standards, fix comments.
|
||||||
|
* mi/mi-cmd-disas.c: Ditto.
|
||||||
|
* mi/mi-cmd-env.c: Ditto.
|
||||||
|
* mi/mi-cmd-file.c: Ditto.
|
||||||
|
* mi/mi-cmd-stack.c: Ditto.
|
||||||
|
* mi/mi-cmd-target.c: Ditto.
|
||||||
|
* mi/mi-cmd-var.c: Ditto.
|
||||||
|
* mi/mi-cmds.c: Ditto.
|
||||||
|
* mi/mi-cmds.h: Ditto.
|
||||||
|
* mi/mi-console.c: Ditto.
|
||||||
|
* mi/mi-getopt.c: Ditto.
|
||||||
|
* mi/mi-getopt.h: Ditto.
|
||||||
|
* mi/mi-interp.c: Ditto.
|
||||||
|
* mi/mi-main.c: Ditto.
|
||||||
|
* mi/mi-out.c: Ditto.
|
||||||
|
* mi/mi-parse.c: Ditto.
|
||||||
|
* mi/mi-parse.h: Ditto.
|
||||||
|
* mi/mi-symbol-cmds.c: Ditto.
|
||||||
|
|
||||||
|
* mi/mi-getopt.h: Move mi_opt struct up.
|
||||||
|
* mi/mi-main.c (captured_mi_execute_command): Remove redundant
|
||||||
|
return.
|
||||||
|
* mi/mi-out.c (_initialize_mi_out): Remove empty initialize.
|
||||||
|
|
||||||
2012-03-06 Tom Tromey <tromey@redhat.com>
|
2012-03-06 Tom Tromey <tromey@redhat.com>
|
||||||
|
|
||||||
* proc-service.c (ps_pglobal_lookup): Set the current program
|
* proc-service.c (ps_pglobal_lookup): Set the current program
|
||||||
|
|
|
@ -43,7 +43,7 @@ static int mi_breakpoint_observers_installed;
|
||||||
|
|
||||||
static int mi_can_breakpoint_notify;
|
static int mi_can_breakpoint_notify;
|
||||||
|
|
||||||
/* Output a single breakpoint, when allowed. */
|
/* Output a single breakpoint, when allowed. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
breakpoint_notify (struct breakpoint *b)
|
breakpoint_notify (struct breakpoint *b)
|
||||||
|
@ -142,7 +142,7 @@ mi_cmd_break_insert (char *command, char **argv, int argc)
|
||||||
error (_("-break-insert: Garbage following <location>"));
|
error (_("-break-insert: Garbage following <location>"));
|
||||||
address = argv[oind];
|
address = argv[oind];
|
||||||
|
|
||||||
/* Now we have what we need, let's insert the breakpoint! */
|
/* Now we have what we need, let's insert the breakpoint! */
|
||||||
if (! mi_breakpoint_observers_installed)
|
if (! mi_breakpoint_observers_installed)
|
||||||
{
|
{
|
||||||
observer_attach_breakpoint_created (breakpoint_notify);
|
observer_attach_breakpoint_created (breakpoint_notify);
|
||||||
|
@ -209,7 +209,7 @@ mi_cmd_break_passcount (char *command, char **argv, int argc)
|
||||||
first argument:
|
first argument:
|
||||||
-break-watch <expr> --> insert a regular wp.
|
-break-watch <expr> --> insert a regular wp.
|
||||||
-break-watch -r <expr> --> insert a read watchpoint.
|
-break-watch -r <expr> --> insert a read watchpoint.
|
||||||
-break-watch -a <expr> --> insert an access wp. */
|
-break-watch -a <expr> --> insert an access wp. */
|
||||||
|
|
||||||
void
|
void
|
||||||
mi_cmd_break_watch (char *command, char **argv, int argc)
|
mi_cmd_break_watch (char *command, char **argv, int argc)
|
||||||
|
@ -254,7 +254,7 @@ mi_cmd_break_watch (char *command, char **argv, int argc)
|
||||||
error (_("-break-watch: Garbage following <expression>"));
|
error (_("-break-watch: Garbage following <expression>"));
|
||||||
expr = argv[oind];
|
expr = argv[oind];
|
||||||
|
|
||||||
/* Now we have what we need, let's insert the watchpoint! */
|
/* Now we have what we need, let's insert the watchpoint! */
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case REG_WP:
|
case REG_WP:
|
||||||
|
|
|
@ -27,8 +27,7 @@
|
||||||
#include "ui-out.h"
|
#include "ui-out.h"
|
||||||
#include "disasm.h"
|
#include "disasm.h"
|
||||||
|
|
||||||
/* The arguments to be passed on the command line and parsed here are:
|
/* The arguments to be passed on the command line and parsed here are
|
||||||
|
|
||||||
either:
|
either:
|
||||||
|
|
||||||
START-ADDRESS: address to start the disassembly at.
|
START-ADDRESS: address to start the disassembly at.
|
||||||
|
@ -50,6 +49,7 @@
|
||||||
2 -- disassembly and opcodes.
|
2 -- disassembly and opcodes.
|
||||||
3 -- disassembly, source and opcodes.
|
3 -- disassembly, source and opcodes.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
mi_cmd_disassemble (char *command, char **argv, int argc)
|
mi_cmd_disassemble (char *command, char **argv, int argc)
|
||||||
{
|
{
|
||||||
|
@ -75,24 +75,25 @@ mi_cmd_disassemble (char *command, char **argv, int argc)
|
||||||
CORE_ADDR high = 0;
|
CORE_ADDR high = 0;
|
||||||
struct cleanup *cleanups = make_cleanup (null_cleanup, NULL);
|
struct cleanup *cleanups = make_cleanup (null_cleanup, NULL);
|
||||||
|
|
||||||
/* Options processing stuff. */
|
/* Options processing stuff. */
|
||||||
int oind = 0;
|
int oind = 0;
|
||||||
char *oarg;
|
char *oarg;
|
||||||
enum opt
|
enum opt
|
||||||
{
|
{
|
||||||
FILE_OPT, LINE_OPT, NUM_OPT, START_OPT, END_OPT
|
FILE_OPT, LINE_OPT, NUM_OPT, START_OPT, END_OPT
|
||||||
};
|
};
|
||||||
static const struct mi_opt opts[] = {
|
static const struct mi_opt opts[] =
|
||||||
{"f", FILE_OPT, 1},
|
{
|
||||||
{"l", LINE_OPT, 1},
|
{"f", FILE_OPT, 1},
|
||||||
{"n", NUM_OPT, 1},
|
{"l", LINE_OPT, 1},
|
||||||
{"s", START_OPT, 1},
|
{"n", NUM_OPT, 1},
|
||||||
{"e", END_OPT, 1},
|
{"s", START_OPT, 1},
|
||||||
{ 0, 0, 0 }
|
{"e", END_OPT, 1},
|
||||||
};
|
{ 0, 0, 0 }
|
||||||
|
};
|
||||||
|
|
||||||
/* Get the options with their arguments. Keep track of what we
|
/* Get the options with their arguments. Keep track of what we
|
||||||
encountered. */
|
encountered. */
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
int opt = mi_getopt ("-data-disassemble", argc, argv, opts,
|
int opt = mi_getopt ("-data-disassemble", argc, argv, opts,
|
||||||
|
@ -128,7 +129,7 @@ mi_cmd_disassemble (char *command, char **argv, int argc)
|
||||||
argc -= oind;
|
argc -= oind;
|
||||||
|
|
||||||
/* Allow only filename + linenum (with how_many which is not
|
/* Allow only filename + linenum (with how_many which is not
|
||||||
required) OR start_addr + and_addr */
|
required) OR start_addr + end_addr. */
|
||||||
|
|
||||||
if (!((line_seen && file_seen && num_seen && !start_seen && !end_seen)
|
if (!((line_seen && file_seen && num_seen && !start_seen && !end_seen)
|
||||||
|| (line_seen && file_seen && !num_seen && !start_seen && !end_seen)
|
|| (line_seen && file_seen && !num_seen && !start_seen && !end_seen)
|
||||||
|
@ -144,7 +145,7 @@ mi_cmd_disassemble (char *command, char **argv, int argc)
|
||||||
if (mode < 0 || mode > 3)
|
if (mode < 0 || mode > 3)
|
||||||
error (_("-data-disassemble: Mode argument must be 0, 1, 2, or 3."));
|
error (_("-data-disassemble: Mode argument must be 0, 1, 2, or 3."));
|
||||||
|
|
||||||
/* Convert the mode into a set of disassembly flags */
|
/* Convert the mode into a set of disassembly flags. */
|
||||||
|
|
||||||
disasm_flags = 0;
|
disasm_flags = 0;
|
||||||
if (mode & 0x1)
|
if (mode & 0x1)
|
||||||
|
@ -153,7 +154,7 @@ mi_cmd_disassemble (char *command, char **argv, int argc)
|
||||||
disasm_flags |= DISASSEMBLY_RAW_INSN;
|
disasm_flags |= DISASSEMBLY_RAW_INSN;
|
||||||
|
|
||||||
/* We must get the function beginning and end where line_num is
|
/* We must get the function beginning and end where line_num is
|
||||||
contained. */
|
contained. */
|
||||||
|
|
||||||
if (line_seen && file_seen)
|
if (line_seen && file_seen)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
/* MI Command Set - environment commands.
|
/* MI Command Set - environment commands.
|
||||||
|
|
||||||
Copyright (C) 2002-2004, 2007-2012 Free Software Foundation, Inc.
|
Copyright (C) 2002-2004, 2007-2012 Free Software Foundation, Inc.
|
||||||
|
|
||||||
Contributed by Red Hat Inc.
|
Contributed by Red Hat Inc.
|
||||||
|
@ -36,6 +35,7 @@
|
||||||
#include "gdb_stat.h"
|
#include "gdb_stat.h"
|
||||||
|
|
||||||
static void env_mod_path (char *dirname, char **which_path);
|
static void env_mod_path (char *dirname, char **which_path);
|
||||||
|
|
||||||
extern void _initialize_mi_cmd_env (void);
|
extern void _initialize_mi_cmd_env (void);
|
||||||
|
|
||||||
static const char path_var_name[] = "PATH";
|
static const char path_var_name[] = "PATH";
|
||||||
|
@ -44,6 +44,7 @@ static char *orig_path = NULL;
|
||||||
/* The following is copied from mi-main.c so for m1 and below we can
|
/* The following is copied from mi-main.c so for m1 and below we can
|
||||||
perform old behavior and use cli commands. If ARGS is non-null,
|
perform old behavior and use cli commands. If ARGS is non-null,
|
||||||
append it to the CMD. */
|
append it to the CMD. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
env_execute_cli_command (const char *cmd, const char *args)
|
env_execute_cli_command (const char *cmd, const char *args)
|
||||||
{
|
{
|
||||||
|
@ -63,15 +64,15 @@ env_execute_cli_command (const char *cmd, const char *args)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Print working directory. */
|
/* Print working directory. */
|
||||||
|
|
||||||
void
|
void
|
||||||
mi_cmd_env_pwd (char *command, char **argv, int argc)
|
mi_cmd_env_pwd (char *command, char **argv, int argc)
|
||||||
{
|
{
|
||||||
struct ui_out *uiout = current_uiout;
|
struct ui_out *uiout = current_uiout;
|
||||||
|
|
||||||
if (argc > 0)
|
if (argc > 0)
|
||||||
error (_("-environment-pwd: No arguments required"));
|
error (_("-environment-pwd: No arguments allowed"));
|
||||||
|
|
||||||
if (mi_version (uiout) < 2)
|
if (mi_version (uiout) < 2)
|
||||||
{
|
{
|
||||||
|
@ -89,6 +90,7 @@ mi_cmd_env_pwd (char *command, char **argv, int argc)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Change working directory. */
|
/* Change working directory. */
|
||||||
|
|
||||||
void
|
void
|
||||||
mi_cmd_env_cd (char *command, char **argv, int argc)
|
mi_cmd_env_cd (char *command, char **argv, int argc)
|
||||||
{
|
{
|
||||||
|
@ -110,6 +112,7 @@ env_mod_path (char *dirname, char **which_path)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add one or more directories to start of executable search path. */
|
/* Add one or more directories to start of executable search path. */
|
||||||
|
|
||||||
void
|
void
|
||||||
mi_cmd_env_path (char *command, char **argv, int argc)
|
mi_cmd_env_path (char *command, char **argv, int argc)
|
||||||
{
|
{
|
||||||
|
@ -184,6 +187,7 @@ mi_cmd_env_path (char *command, char **argv, int argc)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add zero or more directories to the front of the source path. */
|
/* Add zero or more directories to the front of the source path. */
|
||||||
|
|
||||||
void
|
void
|
||||||
mi_cmd_env_dir (char *command, char **argv, int argc)
|
mi_cmd_env_dir (char *command, char **argv, int argc)
|
||||||
{
|
{
|
||||||
|
@ -244,13 +248,15 @@ mi_cmd_env_dir (char *command, char **argv, int argc)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the inferior terminal device name. */
|
/* Set the inferior terminal device name. */
|
||||||
|
|
||||||
void
|
void
|
||||||
mi_cmd_inferior_tty_set (char *command, char **argv, int argc)
|
mi_cmd_inferior_tty_set (char *command, char **argv, int argc)
|
||||||
{
|
{
|
||||||
set_inferior_io_terminal (argv[0]);
|
set_inferior_io_terminal (argv[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Print the inferior terminal device name */
|
/* Print the inferior terminal device name. */
|
||||||
|
|
||||||
void
|
void
|
||||||
mi_cmd_inferior_tty_show (char *command, char **argv, int argc)
|
mi_cmd_inferior_tty_show (char *command, char **argv, int argc)
|
||||||
{
|
{
|
||||||
|
@ -273,7 +279,7 @@ _initialize_mi_cmd_env (void)
|
||||||
/* We want original execution path to reset to, if desired later.
|
/* We want original execution path to reset to, if desired later.
|
||||||
At this point, current inferior is not created, so cannot use
|
At this point, current inferior is not created, so cannot use
|
||||||
current_inferior ()->environment. Also, there's no obvious
|
current_inferior ()->environment. Also, there's no obvious
|
||||||
place where this code can be moved suchs that it surely run
|
place where this code can be moved such that it surely run
|
||||||
before any code possibly mangles original PATH. */
|
before any code possibly mangles original PATH. */
|
||||||
environment = make_environ ();
|
environment = make_environ ();
|
||||||
init_environ (environment);
|
init_environ (environment);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* MI Command Set - breakpoint and watchpoint commands.
|
/* MI Command Set - file commands.
|
||||||
Copyright (C) 2000-2002, 2007-2012 Free Software Foundation, Inc.
|
Copyright (C) 2000-2002, 2007-2012 Free Software Foundation, Inc.
|
||||||
Contributed by Cygnus Solutions (a Red Hat company).
|
Contributed by Cygnus Solutions (a Red Hat company).
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@
|
||||||
#include "psymtab.h"
|
#include "psymtab.h"
|
||||||
|
|
||||||
/* Return to the client the absolute path and line number of the
|
/* Return to the client the absolute path and line number of the
|
||||||
current file being executed. */
|
current file being executed. */
|
||||||
|
|
||||||
void
|
void
|
||||||
mi_cmd_file_list_exec_source_file (char *command, char **argv, int argc)
|
mi_cmd_file_list_exec_source_file (char *command, char **argv, int argc)
|
||||||
|
@ -38,20 +38,20 @@ mi_cmd_file_list_exec_source_file (char *command, char **argv, int argc)
|
||||||
if (!mi_valid_noargs ("-file-list-exec-source-file", argc, argv))
|
if (!mi_valid_noargs ("-file-list-exec-source-file", argc, argv))
|
||||||
error (_("-file-list-exec-source-file: Usage: No args"));
|
error (_("-file-list-exec-source-file: Usage: No args"));
|
||||||
|
|
||||||
/* Set the default file and line, also get them */
|
/* Set the default file and line, also get them. */
|
||||||
set_default_source_symtab_and_line ();
|
set_default_source_symtab_and_line ();
|
||||||
st = get_current_source_symtab_and_line ();
|
st = get_current_source_symtab_and_line ();
|
||||||
|
|
||||||
/* We should always get a symtab.
|
/* We should always get a symtab. Apparently, filename does not
|
||||||
Apparently, filename does not need to be tested for NULL.
|
need to be tested for NULL. The documentation in symtab.h
|
||||||
The documentation in symtab.h suggests it will always be correct */
|
suggests it will always be correct. */
|
||||||
if (!st.symtab)
|
if (!st.symtab)
|
||||||
error (_("-file-list-exec-source-file: No symtab"));
|
error (_("-file-list-exec-source-file: No symtab"));
|
||||||
|
|
||||||
/* Extract the fullname if it is not known yet */
|
/* Extract the fullname if it is not known yet. */
|
||||||
symtab_to_fullname (st.symtab);
|
symtab_to_fullname (st.symtab);
|
||||||
|
|
||||||
/* Print to the user the line, filename and fullname */
|
/* Print to the user the line, filename and fullname. */
|
||||||
ui_out_field_int (uiout, "line", st.line);
|
ui_out_field_int (uiout, "line", st.line);
|
||||||
ui_out_field_string (uiout, "file", st.symtab->filename);
|
ui_out_field_string (uiout, "file", st.symtab->filename);
|
||||||
|
|
||||||
|
@ -63,6 +63,7 @@ mi_cmd_file_list_exec_source_file (char *command, char **argv, int argc)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* A callback for map_partial_symbol_filenames. */
|
/* A callback for map_partial_symbol_filenames. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
print_partial_file_name (const char *filename, const char *fullname,
|
print_partial_file_name (const char *filename, const char *fullname,
|
||||||
void *ignore)
|
void *ignore)
|
||||||
|
@ -89,17 +90,17 @@ mi_cmd_file_list_exec_source_files (char *command, char **argv, int argc)
|
||||||
if (!mi_valid_noargs ("-file-list-exec-source-files", argc, argv))
|
if (!mi_valid_noargs ("-file-list-exec-source-files", argc, argv))
|
||||||
error (_("-file-list-exec-source-files: Usage: No args"));
|
error (_("-file-list-exec-source-files: Usage: No args"));
|
||||||
|
|
||||||
/* Print the table header */
|
/* Print the table header. */
|
||||||
ui_out_begin (uiout, ui_out_type_list, "files");
|
ui_out_begin (uiout, ui_out_type_list, "files");
|
||||||
|
|
||||||
/* Look at all of the symtabs */
|
/* Look at all of the symtabs. */
|
||||||
ALL_SYMTABS (objfile, s)
|
ALL_SYMTABS (objfile, s)
|
||||||
{
|
{
|
||||||
ui_out_begin (uiout, ui_out_type_tuple, NULL);
|
ui_out_begin (uiout, ui_out_type_tuple, NULL);
|
||||||
|
|
||||||
ui_out_field_string (uiout, "file", s->filename);
|
ui_out_field_string (uiout, "file", s->filename);
|
||||||
|
|
||||||
/* Extract the fullname if it is not known yet */
|
/* Extract the fullname if it is not known yet. */
|
||||||
symtab_to_fullname (s);
|
symtab_to_fullname (s);
|
||||||
|
|
||||||
if (s->fullname)
|
if (s->fullname)
|
||||||
|
|
|
@ -39,11 +39,12 @@ static void list_args_or_locals (enum what_to_list what,
|
||||||
enum print_values values,
|
enum print_values values,
|
||||||
struct frame_info *fi);
|
struct frame_info *fi);
|
||||||
|
|
||||||
/* Print a list of the stack frames. Args can be none, in which case
|
/* Print a list of the stack frames. Args can be none, in which case
|
||||||
we want to print the whole backtrace, or a pair of numbers
|
we want to print the whole backtrace, or a pair of numbers
|
||||||
specifying the frame numbers at which to start and stop the
|
specifying the frame numbers at which to start and stop the
|
||||||
display. If the two numbers are equal, a single frame will be
|
display. If the two numbers are equal, a single frame will be
|
||||||
displayed. */
|
displayed. */
|
||||||
|
|
||||||
void
|
void
|
||||||
mi_cmd_stack_list_frames (char *command, char **argv, int argc)
|
mi_cmd_stack_list_frames (char *command, char **argv, int argc)
|
||||||
{
|
{
|
||||||
|
@ -64,14 +65,14 @@ mi_cmd_stack_list_frames (char *command, char **argv, int argc)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Called with no arguments, it means we want the whole
|
/* Called with no arguments, it means we want the whole
|
||||||
backtrace. */
|
backtrace. */
|
||||||
frame_low = -1;
|
frame_low = -1;
|
||||||
frame_high = -1;
|
frame_high = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Let's position fi on the frame at which to start the
|
/* Let's position fi on the frame at which to start the
|
||||||
display. Could be the innermost frame if the whole stack needs
|
display. Could be the innermost frame if the whole stack needs
|
||||||
displaying, or if frame_low is 0. */
|
displaying, or if frame_low is 0. */
|
||||||
for (i = 0, fi = get_current_frame ();
|
for (i = 0, fi = get_current_frame ();
|
||||||
fi && i < frame_low;
|
fi && i < frame_low;
|
||||||
i++, fi = get_prev_frame (fi));
|
i++, fi = get_prev_frame (fi));
|
||||||
|
@ -81,15 +82,15 @@ mi_cmd_stack_list_frames (char *command, char **argv, int argc)
|
||||||
|
|
||||||
cleanup_stack = make_cleanup_ui_out_list_begin_end (current_uiout, "stack");
|
cleanup_stack = make_cleanup_ui_out_list_begin_end (current_uiout, "stack");
|
||||||
|
|
||||||
/* Now let;s print the frames up to frame_high, or until there are
|
/* Now let's print the frames up to frame_high, or until there are
|
||||||
frames in the stack. */
|
frames in the stack. */
|
||||||
for (;
|
for (;
|
||||||
fi && (i <= frame_high || frame_high == -1);
|
fi && (i <= frame_high || frame_high == -1);
|
||||||
i++, fi = get_prev_frame (fi))
|
i++, fi = get_prev_frame (fi))
|
||||||
{
|
{
|
||||||
QUIT;
|
QUIT;
|
||||||
/* Print the location and the address always, even for level 0.
|
/* Print the location and the address always, even for level 0.
|
||||||
args == 0: don't print the arguments. */
|
If args is 0, don't print the arguments. */
|
||||||
print_frame_info (fi, 1, LOC_AND_ADDRESS, 0 /* args */ );
|
print_frame_info (fi, 1, LOC_AND_ADDRESS, 0 /* args */ );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,7 +111,7 @@ mi_cmd_stack_info_depth (char *command, char **argv, int argc)
|
||||||
frame_high = atoi (argv[0]);
|
frame_high = atoi (argv[0]);
|
||||||
else
|
else
|
||||||
/* Called with no arguments, it means we want the real depth of
|
/* Called with no arguments, it means we want the real depth of
|
||||||
the stack. */
|
the stack. */
|
||||||
frame_high = -1;
|
frame_high = -1;
|
||||||
|
|
||||||
for (i = 0, fi = get_current_frame ();
|
for (i = 0, fi = get_current_frame ();
|
||||||
|
@ -141,7 +142,8 @@ parse_print_values (char *name)
|
||||||
|
|
||||||
/* Print a list of the locals for the current frame. With argument of
|
/* Print a list of the locals for the current frame. With argument of
|
||||||
0, print only the names, with argument of 1 print also the
|
0, print only the names, with argument of 1 print also the
|
||||||
values. */
|
values. */
|
||||||
|
|
||||||
void
|
void
|
||||||
mi_cmd_stack_list_locals (char *command, char **argv, int argc)
|
mi_cmd_stack_list_locals (char *command, char **argv, int argc)
|
||||||
{
|
{
|
||||||
|
@ -157,7 +159,8 @@ mi_cmd_stack_list_locals (char *command, char **argv, int argc)
|
||||||
|
|
||||||
/* Print a list of the arguments for the current frame. With argument
|
/* Print a list of the arguments for the current frame. With argument
|
||||||
of 0, print only the names, with argument of 1 print also the
|
of 0, print only the names, with argument of 1 print also the
|
||||||
values. */
|
values. */
|
||||||
|
|
||||||
void
|
void
|
||||||
mi_cmd_stack_list_args (char *command, char **argv, int argc)
|
mi_cmd_stack_list_args (char *command, char **argv, int argc)
|
||||||
{
|
{
|
||||||
|
@ -181,7 +184,7 @@ mi_cmd_stack_list_args (char *command, char **argv, int argc)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Called with no arguments, it means we want args for the whole
|
/* Called with no arguments, it means we want args for the whole
|
||||||
backtrace. */
|
backtrace. */
|
||||||
frame_low = -1;
|
frame_low = -1;
|
||||||
frame_high = -1;
|
frame_high = -1;
|
||||||
}
|
}
|
||||||
|
@ -190,7 +193,7 @@ mi_cmd_stack_list_args (char *command, char **argv, int argc)
|
||||||
|
|
||||||
/* Let's position fi on the frame at which to start the
|
/* Let's position fi on the frame at which to start the
|
||||||
display. Could be the innermost frame if the whole stack needs
|
display. Could be the innermost frame if the whole stack needs
|
||||||
displaying, or if frame_low is 0. */
|
displaying, or if frame_low is 0. */
|
||||||
for (i = 0, fi = get_current_frame ();
|
for (i = 0, fi = get_current_frame ();
|
||||||
fi && i < frame_low;
|
fi && i < frame_low;
|
||||||
i++, fi = get_prev_frame (fi));
|
i++, fi = get_prev_frame (fi));
|
||||||
|
@ -202,7 +205,7 @@ mi_cmd_stack_list_args (char *command, char **argv, int argc)
|
||||||
= make_cleanup_ui_out_list_begin_end (uiout, "stack-args");
|
= make_cleanup_ui_out_list_begin_end (uiout, "stack-args");
|
||||||
|
|
||||||
/* Now let's print the frames up to frame_high, or until there are
|
/* Now let's print the frames up to frame_high, or until there are
|
||||||
frames in the stack. */
|
frames in the stack. */
|
||||||
for (;
|
for (;
|
||||||
fi && (i <= frame_high || frame_high == -1);
|
fi && (i <= frame_high || frame_high == -1);
|
||||||
i++, fi = get_prev_frame (fi))
|
i++, fi = get_prev_frame (fi))
|
||||||
|
@ -223,6 +226,7 @@ mi_cmd_stack_list_args (char *command, char **argv, int argc)
|
||||||
current frame. ARGC must be 1 and ARGV[0] specify if only the names,
|
current frame. ARGC must be 1 and ARGV[0] specify if only the names,
|
||||||
or both names and values of the variables must be printed. See
|
or both names and values of the variables must be printed. See
|
||||||
parse_print_value for possible values. */
|
parse_print_value for possible values. */
|
||||||
|
|
||||||
void
|
void
|
||||||
mi_cmd_stack_list_variables (char *command, char **argv, int argc)
|
mi_cmd_stack_list_variables (char *command, char **argv, int argc)
|
||||||
{
|
{
|
||||||
|
@ -236,11 +240,11 @@ mi_cmd_stack_list_variables (char *command, char **argv, int argc)
|
||||||
list_args_or_locals (all, parse_print_values (argv[0]), frame);
|
list_args_or_locals (all, parse_print_values (argv[0]), frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Print single local or argument. ARG must be already read in. For WHAT and
|
/* Print single local or argument. ARG must be already read in. For
|
||||||
VALUES see list_args_or_locals.
|
WHAT and VALUES see list_args_or_locals.
|
||||||
|
|
||||||
Errors are printed as if they would be the parameter value. Use zeroed ARG
|
Errors are printed as if they would be the parameter value. Use
|
||||||
iff it should not be printed accoring to VALUES. */
|
zeroed ARG iff it should not be printed according to VALUES. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
list_arg_or_local (const struct frame_arg *arg, enum what_to_list what,
|
list_arg_or_local (const struct frame_arg *arg, enum what_to_list what,
|
||||||
|
@ -312,7 +316,8 @@ list_arg_or_local (const struct frame_arg *arg, enum what_to_list what,
|
||||||
/* Print a list of the locals or the arguments for the currently
|
/* Print a list of the locals or the arguments for the currently
|
||||||
selected frame. If the argument passed is 0, printonly the names
|
selected frame. If the argument passed is 0, printonly the names
|
||||||
of the variables, if an argument of 1 is passed, print the values
|
of the variables, if an argument of 1 is passed, print the values
|
||||||
as well. */
|
as well. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
list_args_or_locals (enum what_to_list what, enum print_values values,
|
list_args_or_locals (enum what_to_list what, enum print_values values,
|
||||||
struct frame_info *fi)
|
struct frame_info *fi)
|
||||||
|
@ -425,6 +430,7 @@ list_args_or_locals (enum what_to_list what, enum print_values values,
|
||||||
xfree (entryarg.error);
|
xfree (entryarg.error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (BLOCK_FUNCTION (block))
|
if (BLOCK_FUNCTION (block))
|
||||||
break;
|
break;
|
||||||
else
|
else
|
||||||
|
@ -447,7 +453,7 @@ void
|
||||||
mi_cmd_stack_info_frame (char *command, char **argv, int argc)
|
mi_cmd_stack_info_frame (char *command, char **argv, int argc)
|
||||||
{
|
{
|
||||||
if (argc > 0)
|
if (argc > 0)
|
||||||
error (_("-stack-info-frame: No arguments required"));
|
error (_("-stack-info-frame: No arguments allowed"));
|
||||||
|
|
||||||
print_frame_info (get_selected_frame (NULL), 1, LOC_AND_ADDRESS, 0);
|
print_frame_info (get_selected_frame (NULL), 1, LOC_AND_ADDRESS, 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,9 +30,9 @@ mi_cmd_target_file_get (char *command, char **argv, int argc)
|
||||||
char *oarg;
|
char *oarg;
|
||||||
const char *remote_file, *local_file;
|
const char *remote_file, *local_file;
|
||||||
static const struct mi_opt opts[] =
|
static const struct mi_opt opts[] =
|
||||||
{
|
{
|
||||||
{ 0, 0, 0 }
|
{ 0, 0, 0 }
|
||||||
};
|
};
|
||||||
static const char prefix[] = "-target-file-get";
|
static const char prefix[] = "-target-file-get";
|
||||||
|
|
||||||
if (mi_getopt (prefix, argc, argv, opts, &oind, &oarg) != -1
|
if (mi_getopt (prefix, argc, argv, opts, &oind, &oarg) != -1
|
||||||
|
@ -54,9 +54,9 @@ mi_cmd_target_file_put (char *command, char **argv, int argc)
|
||||||
char *oarg;
|
char *oarg;
|
||||||
const char *remote_file, *local_file;
|
const char *remote_file, *local_file;
|
||||||
static const struct mi_opt opts[] =
|
static const struct mi_opt opts[] =
|
||||||
{
|
{
|
||||||
{ 0, 0, 0 }
|
{ 0, 0, 0 }
|
||||||
};
|
};
|
||||||
static const char prefix[] = "-target-file-put";
|
static const char prefix[] = "-target-file-put";
|
||||||
|
|
||||||
if (mi_getopt (prefix, argc, argv, opts, &oind, &oarg) != -1
|
if (mi_getopt (prefix, argc, argv, opts, &oind, &oarg) != -1
|
||||||
|
@ -78,9 +78,9 @@ mi_cmd_target_file_delete (char *command, char **argv, int argc)
|
||||||
char *oarg;
|
char *oarg;
|
||||||
const char *remote_file;
|
const char *remote_file;
|
||||||
static const struct mi_opt opts[] =
|
static const struct mi_opt opts[] =
|
||||||
{
|
{
|
||||||
{ 0, 0, 0 }
|
{ 0, 0, 0 }
|
||||||
};
|
};
|
||||||
static const char prefix[] = "-target-file-delete";
|
static const char prefix[] = "-target-file-delete";
|
||||||
|
|
||||||
if (mi_getopt (prefix, argc, argv, opts, &oind, &oarg) != -1
|
if (mi_getopt (prefix, argc, argv, opts, &oind, &oarg) != -1
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
/* MI Command Set - varobj commands.
|
/* MI Command Set - varobj commands.
|
||||||
|
|
||||||
Copyright (C) 2000, 2002, 2004-2005, 2007-2012 Free Software
|
Copyright (C) 2000, 2002, 2004-2005, 2007-2012 Free Software
|
||||||
Foundation, Inc.
|
Foundation, Inc.
|
||||||
|
|
||||||
|
@ -38,8 +37,8 @@ const char mi_all_values[] = "--all-values";
|
||||||
extern int varobjdebug; /* defined in varobj.c. */
|
extern int varobjdebug; /* defined in varobj.c. */
|
||||||
|
|
||||||
static void varobj_update_one (struct varobj *var,
|
static void varobj_update_one (struct varobj *var,
|
||||||
enum print_values print_values,
|
enum print_values print_values,
|
||||||
int explicit);
|
int explicit);
|
||||||
|
|
||||||
static int mi_print_value_p (struct varobj *var,
|
static int mi_print_value_p (struct varobj *var,
|
||||||
enum print_values print_values);
|
enum print_values print_values);
|
||||||
|
@ -47,6 +46,7 @@ static int mi_print_value_p (struct varobj *var,
|
||||||
/* Print variable object VAR. The PRINT_VALUES parameter controls
|
/* Print variable object VAR. The PRINT_VALUES parameter controls
|
||||||
if the value should be printed. The PRINT_EXPRESSION parameter
|
if the value should be printed. The PRINT_EXPRESSION parameter
|
||||||
controls if the expression should be printed. */
|
controls if the expression should be printed. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
print_varobj (struct varobj *var, enum print_values print_values,
|
print_varobj (struct varobj *var, enum print_values print_values,
|
||||||
int print_expression)
|
int print_expression)
|
||||||
|
@ -109,15 +109,11 @@ mi_cmd_var_create (char *command, char **argv, int argc)
|
||||||
enum varobj_type var_type;
|
enum varobj_type var_type;
|
||||||
|
|
||||||
if (argc != 3)
|
if (argc != 3)
|
||||||
{
|
error (_("-var-create: Usage: NAME FRAME EXPRESSION."));
|
||||||
/* mi_error_message = xstrprintf ("-var-create: Usage:
|
|
||||||
...."); return MI_CMD_ERROR; */
|
|
||||||
error (_("-var-create: Usage: NAME FRAME EXPRESSION."));
|
|
||||||
}
|
|
||||||
|
|
||||||
name = xstrdup (argv[0]);
|
name = xstrdup (argv[0]);
|
||||||
/* Add cleanup for name. Must be free_current_contents as
|
/* Add cleanup for name. Must be free_current_contents as name can
|
||||||
name can be reallocated */
|
be reallocated. */
|
||||||
old_cleanups = make_cleanup (free_current_contents, &name);
|
old_cleanups = make_cleanup (free_current_contents, &name);
|
||||||
|
|
||||||
frame = xstrdup (argv[1]);
|
frame = xstrdup (argv[1]);
|
||||||
|
@ -175,12 +171,12 @@ mi_cmd_var_delete (char *command, char **argv, int argc)
|
||||||
error (_("-var-delete: Usage: [-c] EXPRESSION."));
|
error (_("-var-delete: Usage: [-c] EXPRESSION."));
|
||||||
|
|
||||||
name = xstrdup (argv[0]);
|
name = xstrdup (argv[0]);
|
||||||
/* Add cleanup for name. Must be free_current_contents as
|
/* Add cleanup for name. Must be free_current_contents as name can
|
||||||
name can be reallocated */
|
be reallocated. */
|
||||||
old_cleanups = make_cleanup (free_current_contents, &name);
|
old_cleanups = make_cleanup (free_current_contents, &name);
|
||||||
|
|
||||||
/* If we have one single argument it cannot be '-c' or any string
|
/* If we have one single argument it cannot be '-c' or any string
|
||||||
starting with '-'. */
|
starting with '-'. */
|
||||||
if (argc == 1)
|
if (argc == 1)
|
||||||
{
|
{
|
||||||
if (strcmp (name, "-c") == 0)
|
if (strcmp (name, "-c") == 0)
|
||||||
|
@ -191,7 +187,7 @@ mi_cmd_var_delete (char *command, char **argv, int argc)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we have 2 arguments they must be '-c' followed by a string
|
/* If we have 2 arguments they must be '-c' followed by a string
|
||||||
which would be the variable name. */
|
which would be the variable name. */
|
||||||
if (argc == 2)
|
if (argc == 2)
|
||||||
{
|
{
|
||||||
if (strcmp (name, "-c") != 0)
|
if (strcmp (name, "-c") != 0)
|
||||||
|
@ -203,7 +199,7 @@ mi_cmd_var_delete (char *command, char **argv, int argc)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we didn't error out, now NAME contains the name of the
|
/* If we didn't error out, now NAME contains the name of the
|
||||||
variable. */
|
variable. */
|
||||||
|
|
||||||
var = varobj_get_handle (name);
|
var = varobj_get_handle (name);
|
||||||
|
|
||||||
|
@ -252,18 +248,18 @@ mi_cmd_var_set_format (char *command, char **argv, int argc)
|
||||||
if (argc != 2)
|
if (argc != 2)
|
||||||
error (_("-var-set-format: Usage: NAME FORMAT."));
|
error (_("-var-set-format: Usage: NAME FORMAT."));
|
||||||
|
|
||||||
/* Get varobj handle, if a valid var obj name was specified */
|
/* Get varobj handle, if a valid var obj name was specified. */
|
||||||
var = varobj_get_handle (argv[0]);
|
var = varobj_get_handle (argv[0]);
|
||||||
|
|
||||||
format = mi_parse_format (argv[1]);
|
format = mi_parse_format (argv[1]);
|
||||||
|
|
||||||
/* Set the format of VAR to given format */
|
/* Set the format of VAR to the given format. */
|
||||||
varobj_set_display_format (var, format);
|
varobj_set_display_format (var, format);
|
||||||
|
|
||||||
/* Report the new current format */
|
/* Report the new current format. */
|
||||||
ui_out_field_string (uiout, "format", varobj_format_string[(int) format]);
|
ui_out_field_string (uiout, "format", varobj_format_string[(int) format]);
|
||||||
|
|
||||||
/* Report the value in the new format */
|
/* Report the value in the new format. */
|
||||||
val = varobj_get_value (var);
|
val = varobj_get_value (var);
|
||||||
ui_out_field_string (uiout, "value", val);
|
ui_out_field_string (uiout, "value", val);
|
||||||
xfree (val);
|
xfree (val);
|
||||||
|
@ -305,12 +301,11 @@ mi_cmd_var_set_frozen (char *command, char **argv, int argc)
|
||||||
|
|
||||||
varobj_set_frozen (var, frozen);
|
varobj_set_frozen (var, frozen);
|
||||||
|
|
||||||
/* We don't automatically return the new value, or what varobjs got new
|
/* We don't automatically return the new value, or what varobjs got
|
||||||
values during unfreezing. If this information is required, client
|
new values during unfreezing. If this information is required,
|
||||||
should call -var-update explicitly. */
|
client should call -var-update explicitly. */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
mi_cmd_var_show_format (char *command, char **argv, int argc)
|
mi_cmd_var_show_format (char *command, char **argv, int argc)
|
||||||
{
|
{
|
||||||
|
@ -321,12 +316,12 @@ mi_cmd_var_show_format (char *command, char **argv, int argc)
|
||||||
if (argc != 1)
|
if (argc != 1)
|
||||||
error (_("-var-show-format: Usage: NAME."));
|
error (_("-var-show-format: Usage: NAME."));
|
||||||
|
|
||||||
/* Get varobj handle, if a valid var obj name was specified */
|
/* Get varobj handle, if a valid var obj name was specified. */
|
||||||
var = varobj_get_handle (argv[0]);
|
var = varobj_get_handle (argv[0]);
|
||||||
|
|
||||||
format = varobj_get_display_format (var);
|
format = varobj_get_display_format (var);
|
||||||
|
|
||||||
/* Report the current format */
|
/* Report the current format. */
|
||||||
ui_out_field_string (uiout, "format", varobj_format_string[(int) format]);
|
ui_out_field_string (uiout, "format", varobj_format_string[(int) format]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -339,7 +334,7 @@ mi_cmd_var_info_num_children (char *command, char **argv, int argc)
|
||||||
if (argc != 1)
|
if (argc != 1)
|
||||||
error (_("-var-info-num-children: Usage: NAME."));
|
error (_("-var-info-num-children: Usage: NAME."));
|
||||||
|
|
||||||
/* Get varobj handle, if a valid var obj name was specified */
|
/* Get varobj handle, if a valid var obj name was specified. */
|
||||||
var = varobj_get_handle (argv[0]);
|
var = varobj_get_handle (argv[0]);
|
||||||
|
|
||||||
ui_out_field_int (uiout, "numchild", varobj_get_num_children (var));
|
ui_out_field_int (uiout, "numchild", varobj_get_num_children (var));
|
||||||
|
@ -413,7 +408,7 @@ mi_cmd_var_list_children (char *command, char **argv, int argc)
|
||||||
error (_("-var-list-children: Usage: "
|
error (_("-var-list-children: Usage: "
|
||||||
"[PRINT_VALUES] NAME [FROM TO]"));
|
"[PRINT_VALUES] NAME [FROM TO]"));
|
||||||
|
|
||||||
/* Get varobj handle, if a valid var obj name was specified */
|
/* Get varobj handle, if a valid var obj name was specified. */
|
||||||
if (argc == 1 || argc == 3)
|
if (argc == 1 || argc == 3)
|
||||||
var = varobj_get_handle (argv[0]);
|
var = varobj_get_handle (argv[0]);
|
||||||
else
|
else
|
||||||
|
@ -479,7 +474,7 @@ mi_cmd_var_info_type (char *command, char **argv, int argc)
|
||||||
if (argc != 1)
|
if (argc != 1)
|
||||||
error (_("-var-info-type: Usage: NAME."));
|
error (_("-var-info-type: Usage: NAME."));
|
||||||
|
|
||||||
/* Get varobj handle, if a valid var obj name was specified */
|
/* Get varobj handle, if a valid var obj name was specified. */
|
||||||
var = varobj_get_handle (argv[0]);
|
var = varobj_get_handle (argv[0]);
|
||||||
|
|
||||||
ui_out_field_string (uiout, "type", varobj_get_type (var));
|
ui_out_field_string (uiout, "type", varobj_get_type (var));
|
||||||
|
@ -513,7 +508,7 @@ mi_cmd_var_info_expression (char *command, char **argv, int argc)
|
||||||
if (argc != 1)
|
if (argc != 1)
|
||||||
error (_("-var-info-expression: Usage: NAME."));
|
error (_("-var-info-expression: Usage: NAME."));
|
||||||
|
|
||||||
/* Get varobj handle, if a valid var obj name was specified */
|
/* Get varobj handle, if a valid var obj name was specified. */
|
||||||
var = varobj_get_handle (argv[0]);
|
var = varobj_get_handle (argv[0]);
|
||||||
|
|
||||||
lang = varobj_get_language (var);
|
lang = varobj_get_language (var);
|
||||||
|
@ -558,16 +553,16 @@ mi_cmd_var_evaluate_expression (char *command, char **argv, int argc)
|
||||||
char *oarg;
|
char *oarg;
|
||||||
|
|
||||||
enum opt
|
enum opt
|
||||||
{
|
|
||||||
OP_FORMAT
|
|
||||||
};
|
|
||||||
static const struct mi_opt opts[] =
|
|
||||||
{
|
{
|
||||||
{"f", OP_FORMAT, 1},
|
OP_FORMAT
|
||||||
{ 0, 0, 0 }
|
|
||||||
};
|
};
|
||||||
|
static const struct mi_opt opts[] =
|
||||||
|
{
|
||||||
|
{"f", OP_FORMAT, 1},
|
||||||
|
{ 0, 0, 0 }
|
||||||
|
};
|
||||||
|
|
||||||
/* Parse arguments */
|
/* Parse arguments. */
|
||||||
format = FORMAT_NATURAL;
|
format = FORMAT_NATURAL;
|
||||||
formatFound = 0;
|
formatFound = 0;
|
||||||
oind = 0;
|
oind = 0;
|
||||||
|
@ -579,7 +574,7 @@ mi_cmd_var_evaluate_expression (char *command, char **argv, int argc)
|
||||||
if (opt < 0)
|
if (opt < 0)
|
||||||
break;
|
break;
|
||||||
switch ((enum opt) opt)
|
switch ((enum opt) opt)
|
||||||
{
|
{
|
||||||
case OP_FORMAT:
|
case OP_FORMAT:
|
||||||
if (formatFound)
|
if (formatFound)
|
||||||
error (_("Cannot specify format more than once"));
|
error (_("Cannot specify format more than once"));
|
||||||
|
@ -587,7 +582,7 @@ mi_cmd_var_evaluate_expression (char *command, char **argv, int argc)
|
||||||
format = mi_parse_format (oarg);
|
format = mi_parse_format (oarg);
|
||||||
formatFound = 1;
|
formatFound = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (oind >= argc)
|
if (oind >= argc)
|
||||||
|
@ -596,7 +591,7 @@ mi_cmd_var_evaluate_expression (char *command, char **argv, int argc)
|
||||||
if (oind < argc - 1)
|
if (oind < argc - 1)
|
||||||
error (_("Garbage at end of command"));
|
error (_("Garbage at end of command"));
|
||||||
|
|
||||||
/* Get varobj handle, if a valid var obj name was specified */
|
/* Get varobj handle, if a valid var obj name was specified. */
|
||||||
var = varobj_get_handle (argv[oind]);
|
var = varobj_get_handle (argv[oind]);
|
||||||
|
|
||||||
if (formatFound)
|
if (formatFound)
|
||||||
|
@ -625,7 +620,7 @@ mi_cmd_var_assign (char *command, char **argv, int argc)
|
||||||
if (argc != 2)
|
if (argc != 2)
|
||||||
error (_("-var-assign: Usage: NAME EXPRESSION."));
|
error (_("-var-assign: Usage: NAME EXPRESSION."));
|
||||||
|
|
||||||
/* Get varobj handle, if a valid var obj name was specified */
|
/* Get varobj handle, if a valid var obj name was specified. */
|
||||||
var = varobj_get_handle (argv[0]);
|
var = varobj_get_handle (argv[0]);
|
||||||
|
|
||||||
if (!varobj_editable_p (var))
|
if (!varobj_editable_p (var))
|
||||||
|
@ -672,9 +667,9 @@ mi_cmd_var_update_iter (struct varobj *var, void *data_pointer)
|
||||||
thread_stopped = 1;
|
thread_stopped = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (thread_stopped)
|
if (thread_stopped
|
||||||
if (!data->only_floating || varobj_floating_p (var))
|
&& (!data->only_floating || varobj_floating_p (var)))
|
||||||
varobj_update_one (var, data->print_values, 0 /* implicit */);
|
varobj_update_one (var, data->print_values, 0 /* implicit */);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -691,7 +686,7 @@ mi_cmd_var_update (char *command, char **argv, int argc)
|
||||||
if (argc == 1)
|
if (argc == 1)
|
||||||
name = argv[0];
|
name = argv[0];
|
||||||
else
|
else
|
||||||
name = (argv[1]);
|
name = argv[1];
|
||||||
|
|
||||||
if (argc == 2)
|
if (argc == 2)
|
||||||
print_values = mi_parse_values_option (argv[0]);
|
print_values = mi_parse_values_option (argv[0]);
|
||||||
|
@ -703,25 +698,25 @@ mi_cmd_var_update (char *command, char **argv, int argc)
|
||||||
else
|
else
|
||||||
cleanup = make_cleanup_ui_out_list_begin_end (uiout, "changelist");
|
cleanup = make_cleanup_ui_out_list_begin_end (uiout, "changelist");
|
||||||
|
|
||||||
/* Check if the parameter is a "*" which means that we want
|
/* Check if the parameter is a "*", which means that we want to
|
||||||
to update all variables */
|
update all variables. */
|
||||||
|
|
||||||
if ((*name == '*' || *name == '@') && (*(name + 1) == '\0'))
|
if ((*name == '*' || *name == '@') && (*(name + 1) == '\0'))
|
||||||
{
|
{
|
||||||
struct mi_cmd_var_update data;
|
struct mi_cmd_var_update data;
|
||||||
|
|
||||||
data.only_floating = *name == '@';
|
data.only_floating = (*name == '@');
|
||||||
data.print_values = print_values;
|
data.print_values = print_values;
|
||||||
|
|
||||||
/* varobj_update_one automatically updates all the children of VAROBJ.
|
/* varobj_update_one automatically updates all the children of
|
||||||
Therefore update each VAROBJ only once by iterating only the root
|
VAROBJ. Therefore update each VAROBJ only once by iterating
|
||||||
VAROBJs. */
|
only the root VAROBJs. */
|
||||||
|
|
||||||
all_root_varobjs (mi_cmd_var_update_iter, &data);
|
all_root_varobjs (mi_cmd_var_update_iter, &data);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Get varobj handle, if a valid var obj name was specified */
|
/* Get varobj handle, if a valid var obj name was specified. */
|
||||||
struct varobj *var = varobj_get_handle (name);
|
struct varobj *var = varobj_get_handle (name);
|
||||||
|
|
||||||
varobj_update_one (var, print_values, 1 /* explicit */);
|
varobj_update_one (var, print_values, 1 /* explicit */);
|
||||||
|
@ -835,6 +830,7 @@ mi_cmd_enable_pretty_printing (char *command, char **argv, int argc)
|
||||||
{
|
{
|
||||||
if (argc != 0)
|
if (argc != 0)
|
||||||
error (_("-enable-pretty-printing: no arguments allowed"));
|
error (_("-enable-pretty-printing: no arguments allowed"));
|
||||||
|
|
||||||
varobj_enable_pretty_printing ();
|
varobj_enable_pretty_printing ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
/* MI Command Set for GDB, the GNU debugger.
|
/* MI Command Set for GDB, the GNU debugger.
|
||||||
|
|
||||||
Copyright (C) 2000-2001, 2003, 2007-2012 Free Software Foundation,
|
Copyright (C) 2000-2001, 2003, 2007-2012 Free Software Foundation,
|
||||||
Inc.
|
Inc.
|
||||||
|
|
||||||
|
@ -26,11 +25,11 @@
|
||||||
#include "gdb_string.h"
|
#include "gdb_string.h"
|
||||||
|
|
||||||
extern void _initialize_mi_cmds (void);
|
extern void _initialize_mi_cmds (void);
|
||||||
|
|
||||||
struct mi_cmd;
|
struct mi_cmd;
|
||||||
static struct mi_cmd **lookup_table (const char *command);
|
static struct mi_cmd **lookup_table (const char *command);
|
||||||
static void build_table (struct mi_cmd *commands);
|
static void build_table (struct mi_cmd *commands);
|
||||||
|
|
||||||
|
|
||||||
struct mi_cmd mi_cmds[] =
|
struct mi_cmd mi_cmds[] =
|
||||||
{
|
{
|
||||||
{ "ada-task-info", { NULL, 0 }, mi_cmd_ada_task_info },
|
{ "ada-task-info", { NULL, 0 }, mi_cmd_ada_task_info },
|
||||||
|
@ -140,24 +139,25 @@ struct mi_cmd mi_cmds[] =
|
||||||
{ NULL, }
|
{ NULL, }
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Pointer to the mi command table (built at run time) */
|
/* Pointer to the mi command table (built at run time). */
|
||||||
|
|
||||||
static struct mi_cmd **mi_table;
|
static struct mi_cmd **mi_table;
|
||||||
|
|
||||||
/* A prime large enough to accomodate the entire command table */
|
/* A prime large enough to accomodate the entire command table. */
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
MI_TABLE_SIZE = 227
|
MI_TABLE_SIZE = 227
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Exported function used to obtain info from the table */
|
/* Exported function used to obtain info from the table. */
|
||||||
struct mi_cmd *
|
struct mi_cmd *
|
||||||
mi_lookup (const char *command)
|
mi_lookup (const char *command)
|
||||||
{
|
{
|
||||||
return *lookup_table (command);
|
return *lookup_table (command);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* stat collecting */
|
/* Used for collecting hash hit/miss statistics. */
|
||||||
|
|
||||||
struct mi_cmd_stats
|
struct mi_cmd_stats
|
||||||
{
|
{
|
||||||
int hit;
|
int hit;
|
||||||
|
@ -166,20 +166,21 @@ struct mi_cmd_stats
|
||||||
};
|
};
|
||||||
struct mi_cmd_stats stats;
|
struct mi_cmd_stats stats;
|
||||||
|
|
||||||
/* our lookup function */
|
/* Look up a command. */
|
||||||
|
|
||||||
static struct mi_cmd **
|
static struct mi_cmd **
|
||||||
lookup_table (const char *command)
|
lookup_table (const char *command)
|
||||||
{
|
{
|
||||||
const char *chp;
|
const char *chp;
|
||||||
unsigned int index = 0;
|
unsigned int index = 0;
|
||||||
|
|
||||||
/* compute our hash */
|
/* Compute our hash. */
|
||||||
for (chp = command; *chp; chp++)
|
for (chp = command; *chp; chp++)
|
||||||
{
|
{
|
||||||
/* some what arbitrary */
|
/* We use a somewhat arbitrary formula. */
|
||||||
index = ((index << 6) + (unsigned int) *chp) % MI_TABLE_SIZE;
|
index = ((index << 6) + (unsigned int) *chp) % MI_TABLE_SIZE;
|
||||||
}
|
}
|
||||||
/* look it up */
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
struct mi_cmd **entry = &mi_table[index];
|
struct mi_cmd **entry = &mi_table[index];
|
||||||
|
@ -218,6 +219,7 @@ build_table (struct mi_cmd *commands)
|
||||||
_("command `%s' appears to be duplicated"),
|
_("command `%s' appears to be duplicated"),
|
||||||
command->name);
|
command->name);
|
||||||
*entry = command;
|
*entry = command;
|
||||||
|
/* FIXME lose these prints */
|
||||||
if (0)
|
if (0)
|
||||||
{
|
{
|
||||||
fprintf_unfiltered (gdb_stdlog, "%-30s %2d\n",
|
fprintf_unfiltered (gdb_stdlog, "%-30s %2d\n",
|
||||||
|
|
|
@ -35,7 +35,8 @@ extern const char mi_all_values[];
|
||||||
|
|
||||||
typedef void (mi_cmd_argv_ftype) (char *command, char **argv, int argc);
|
typedef void (mi_cmd_argv_ftype) (char *command, char **argv, int argc);
|
||||||
|
|
||||||
/* Function implementing each command */
|
/* Declarations of the functions implementing each command. */
|
||||||
|
|
||||||
extern mi_cmd_argv_ftype mi_cmd_ada_task_info;
|
extern mi_cmd_argv_ftype mi_cmd_ada_task_info;
|
||||||
extern mi_cmd_argv_ftype mi_cmd_add_inferior;
|
extern mi_cmd_argv_ftype mi_cmd_add_inferior;
|
||||||
extern mi_cmd_argv_ftype mi_cmd_break_insert;
|
extern mi_cmd_argv_ftype mi_cmd_break_insert;
|
||||||
|
@ -117,7 +118,7 @@ extern mi_cmd_argv_ftype mi_cmd_var_update;
|
||||||
extern mi_cmd_argv_ftype mi_cmd_enable_pretty_printing;
|
extern mi_cmd_argv_ftype mi_cmd_enable_pretty_printing;
|
||||||
extern mi_cmd_argv_ftype mi_cmd_var_set_update_range;
|
extern mi_cmd_argv_ftype mi_cmd_var_set_update_range;
|
||||||
|
|
||||||
/* Description of a single command. */
|
/* Description of a single command. */
|
||||||
|
|
||||||
struct mi_cli
|
struct mi_cli
|
||||||
{
|
{
|
||||||
|
@ -129,7 +130,7 @@ struct mi_cli
|
||||||
|
|
||||||
struct mi_cmd
|
struct mi_cmd
|
||||||
{
|
{
|
||||||
/* official name of the command. */
|
/* Official name of the command. */
|
||||||
const char *name;
|
const char *name;
|
||||||
/* The corresponding CLI command that can be used to implement this
|
/* The corresponding CLI command that can be used to implement this
|
||||||
MI command (if cli.lhs is non NULL). */
|
MI command (if cli.lhs is non NULL). */
|
||||||
|
@ -138,7 +139,7 @@ struct mi_cmd
|
||||||
mi_cmd_argv_ftype *argv_func;
|
mi_cmd_argv_ftype *argv_func;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Lookup a command in the mi comand table */
|
/* Lookup a command in the MI command table. */
|
||||||
|
|
||||||
extern struct mi_cmd *mi_lookup (const char *command);
|
extern struct mi_cmd *mi_lookup (const char *command);
|
||||||
|
|
||||||
|
|
|
@ -19,12 +19,15 @@
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
|
/* An MI console is a kind of ui_file stream that sends output to
|
||||||
|
stdout, but encapsulated and prefixed with a distinctive string;
|
||||||
|
for instance, error output is normally identified by a leading
|
||||||
|
"&". */
|
||||||
|
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
#include "mi-console.h"
|
#include "mi-console.h"
|
||||||
#include "gdb_string.h"
|
#include "gdb_string.h"
|
||||||
|
|
||||||
/* MI-console: send output to std-out but correcty encapsulated */
|
|
||||||
|
|
||||||
static ui_file_fputs_ftype mi_console_file_fputs;
|
static ui_file_fputs_ftype mi_console_file_fputs;
|
||||||
static ui_file_flush_ftype mi_console_file_flush;
|
static ui_file_flush_ftype mi_console_file_flush;
|
||||||
static ui_file_delete_ftype mi_console_file_delete;
|
static ui_file_delete_ftype mi_console_file_delete;
|
||||||
|
@ -38,11 +41,15 @@ struct mi_console_file
|
||||||
char quote;
|
char quote;
|
||||||
};
|
};
|
||||||
|
|
||||||
int mi_console_file_magic;
|
/* Use the address of this otherwise-unused global as a magic number
|
||||||
|
identifying this class of ui_file objects. */
|
||||||
|
static int mi_console_file_magic;
|
||||||
|
|
||||||
|
/* Create a console that wraps the given output stream RAW with the
|
||||||
|
string PREFIX and quoting it with QUOTE. */
|
||||||
|
|
||||||
struct ui_file *
|
struct ui_file *
|
||||||
mi_console_file_new (struct ui_file *raw,
|
mi_console_file_new (struct ui_file *raw, const char *prefix, char quote)
|
||||||
const char *prefix, char quote)
|
|
||||||
{
|
{
|
||||||
struct ui_file *ui_file = ui_file_new ();
|
struct ui_file *ui_file = ui_file_new ();
|
||||||
struct mi_console_file *mi_console = XMALLOC (struct mi_console_file);
|
struct mi_console_file *mi_console = XMALLOC (struct mi_console_file);
|
||||||
|
@ -55,6 +62,7 @@ mi_console_file_new (struct ui_file *raw,
|
||||||
set_ui_file_fputs (ui_file, mi_console_file_fputs);
|
set_ui_file_fputs (ui_file, mi_console_file_fputs);
|
||||||
set_ui_file_flush (ui_file, mi_console_file_flush);
|
set_ui_file_flush (ui_file, mi_console_file_flush);
|
||||||
set_ui_file_data (ui_file, mi_console, mi_console_file_delete);
|
set_ui_file_data (ui_file, mi_console, mi_console_file_delete);
|
||||||
|
|
||||||
return ui_file;
|
return ui_file;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,36 +74,36 @@ mi_console_file_delete (struct ui_file *file)
|
||||||
if (mi_console->magic != &mi_console_file_magic)
|
if (mi_console->magic != &mi_console_file_magic)
|
||||||
internal_error (__FILE__, __LINE__,
|
internal_error (__FILE__, __LINE__,
|
||||||
_("mi_console_file_delete: bad magic number"));
|
_("mi_console_file_delete: bad magic number"));
|
||||||
|
|
||||||
xfree (mi_console);
|
xfree (mi_console);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
mi_console_file_fputs (const char *buf,
|
mi_console_file_fputs (const char *buf, struct ui_file *file)
|
||||||
struct ui_file *file)
|
|
||||||
{
|
{
|
||||||
struct mi_console_file *mi_console = ui_file_data (file);
|
struct mi_console_file *mi_console = ui_file_data (file);
|
||||||
|
|
||||||
if (mi_console->magic != &mi_console_file_magic)
|
if (mi_console->magic != &mi_console_file_magic)
|
||||||
internal_error (__FILE__, __LINE__,
|
internal_error (__FILE__, __LINE__,
|
||||||
"mi_console_file_fputs: bad magic number");
|
"mi_console_file_fputs: bad magic number");
|
||||||
/* Append the text to our internal buffer */
|
|
||||||
|
/* Append the text to our internal buffer. */
|
||||||
fputs_unfiltered (buf, mi_console->buffer);
|
fputs_unfiltered (buf, mi_console->buffer);
|
||||||
/* Flush when an embedded \n */
|
/* Flush when an embedded newline is present anywhere in the buffer. */
|
||||||
if (strchr (buf, '\n') != NULL)
|
if (strchr (buf, '\n') != NULL)
|
||||||
gdb_flush (file);
|
gdb_flush (file);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Transform a byte sequence into a console output packet. */
|
/* Transform a byte sequence into a console output packet. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
mi_console_raw_packet (void *data,
|
mi_console_raw_packet (void *data, const char *buf, long length_buf)
|
||||||
const char *buf,
|
|
||||||
long length_buf)
|
|
||||||
{
|
{
|
||||||
struct mi_console_file *mi_console = data;
|
struct mi_console_file *mi_console = data;
|
||||||
|
|
||||||
if (mi_console->magic != &mi_console_file_magic)
|
if (mi_console->magic != &mi_console_file_magic)
|
||||||
internal_error (__FILE__, __LINE__,
|
internal_error (__FILE__, __LINE__,
|
||||||
_("mi_console_file_transform: bad magic number"));
|
_("mi_console_raw_packet: bad magic number"));
|
||||||
|
|
||||||
if (length_buf > 0)
|
if (length_buf > 0)
|
||||||
{
|
{
|
||||||
|
@ -124,6 +132,7 @@ mi_console_file_flush (struct ui_file *file)
|
||||||
if (mi_console->magic != &mi_console_file_magic)
|
if (mi_console->magic != &mi_console_file_magic)
|
||||||
internal_error (__FILE__, __LINE__,
|
internal_error (__FILE__, __LINE__,
|
||||||
_("mi_console_file_flush: bad magic number"));
|
_("mi_console_file_flush: bad magic number"));
|
||||||
|
|
||||||
ui_file_put (mi_console->buffer, mi_console_raw_packet, mi_console);
|
ui_file_put (mi_console->buffer, mi_console_raw_packet, mi_console);
|
||||||
ui_file_rewind (mi_console->buffer);
|
ui_file_rewind (mi_console->buffer);
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ mi_getopt (const char *prefix,
|
||||||
char *arg;
|
char *arg;
|
||||||
const struct mi_opt *opt;
|
const struct mi_opt *opt;
|
||||||
|
|
||||||
/* We assume that argv/argc are ok. */
|
/* We assume that argv/argc are ok. */
|
||||||
if (*oind > argc || *oind < 0)
|
if (*oind > argc || *oind < 0)
|
||||||
internal_error (__FILE__, __LINE__,
|
internal_error (__FILE__, __LINE__,
|
||||||
_("mi_getopt_long: oind out of bounds"));
|
_("mi_getopt_long: oind out of bounds"));
|
||||||
|
@ -44,20 +44,20 @@ mi_getopt (const char *prefix,
|
||||||
*oarg = NULL;
|
*oarg = NULL;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
/* End of option list. */
|
/* End of option list. */
|
||||||
if (arg[0] != '-')
|
if (arg[0] != '-')
|
||||||
{
|
{
|
||||||
*oarg = NULL;
|
*oarg = NULL;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
/* Look the option up. */
|
/* Look the option up. */
|
||||||
for (opt = opts; opt->name != NULL; opt++)
|
for (opt = opts; opt->name != NULL; opt++)
|
||||||
{
|
{
|
||||||
if (strcmp (opt->name, arg + 1) != 0)
|
if (strcmp (opt->name, arg + 1) != 0)
|
||||||
continue;
|
continue;
|
||||||
if (opt->arg_p)
|
if (opt->arg_p)
|
||||||
{
|
{
|
||||||
/* A non-simple oarg option. */
|
/* A non-simple oarg option. */
|
||||||
if (argc < *oind + 2)
|
if (argc < *oind + 2)
|
||||||
error (_("%s: Option %s requires an argument"), prefix, arg);
|
error (_("%s: Option %s requires an argument"), prefix, arg);
|
||||||
*oarg = argv[(*oind) + 1];
|
*oarg = argv[(*oind) + 1];
|
||||||
|
@ -80,9 +80,9 @@ mi_valid_noargs (const char *prefix, int argc, char **argv)
|
||||||
int oind = 0;
|
int oind = 0;
|
||||||
char *oarg;
|
char *oarg;
|
||||||
static const struct mi_opt opts[] =
|
static const struct mi_opt opts[] =
|
||||||
{
|
{
|
||||||
{ 0, 0, 0 }
|
{ 0, 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
if (mi_getopt (prefix, argc, argv, opts, &oind, &oarg) == -1)
|
if (mi_getopt (prefix, argc, argv, opts, &oind, &oarg) == -1)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -20,6 +20,16 @@
|
||||||
#ifndef MI_GETOPT_H
|
#ifndef MI_GETOPT_H
|
||||||
#define MI_GETOPT_H
|
#define MI_GETOPT_H
|
||||||
|
|
||||||
|
/* The option list. Terminated by NAME==NULL. ARG_P that the option
|
||||||
|
requires an argument. INDEX is returned to identify the option. */
|
||||||
|
|
||||||
|
struct mi_opt
|
||||||
|
{
|
||||||
|
const char *name;
|
||||||
|
int index;
|
||||||
|
int arg_p;
|
||||||
|
};
|
||||||
|
|
||||||
/* Like getopt() but with simpler semantics.
|
/* Like getopt() but with simpler semantics.
|
||||||
|
|
||||||
An option has the form ``-<name>''. The special option ``--''
|
An option has the form ``-<name>''. The special option ``--''
|
||||||
|
@ -37,30 +47,16 @@
|
||||||
to specify the non-option argument. OPTARG is set to NULL.
|
to specify the non-option argument. OPTARG is set to NULL.
|
||||||
|
|
||||||
mi_getopt() calls ``error("%s: Unknown option %c", prefix,
|
mi_getopt() calls ``error("%s: Unknown option %c", prefix,
|
||||||
option)'' if an unknown option is encountered. */
|
option)'' if an unknown option is encountered. */
|
||||||
|
|
||||||
struct mi_opt;
|
|
||||||
extern int mi_getopt (const char *prefix, int argc, char **argv,
|
extern int mi_getopt (const char *prefix, int argc, char **argv,
|
||||||
const struct mi_opt *opt, int *optind, char **optarg);
|
const struct mi_opt *opt, int *optind, char **optarg);
|
||||||
|
|
||||||
/* The option list. Terminated by NAME==NULL. ARG_P that the option
|
/* mi_valid_noargs determines if ARGC/ARGV are a valid set of
|
||||||
requires an argument. INDEX is returned to identify th option. */
|
parameters to satisfy an MI function that is not supposed to
|
||||||
|
recieve any arguments.
|
||||||
struct mi_opt
|
|
||||||
{
|
|
||||||
const char *name;
|
|
||||||
int index;
|
|
||||||
int arg_p;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct mi_opt;
|
|
||||||
|
|
||||||
/* mi_valid_noargs
|
|
||||||
|
|
||||||
Determines if ARGC/ARGV are a valid set of parameters to satisfy
|
An MI function that should not receive arguments can still be
|
||||||
an MI function that is not supposed to recieve any arguments.
|
|
||||||
|
|
||||||
An MI function that should not recieve arguments can still be
|
|
||||||
passed parameters after the special option '--' such as below.
|
passed parameters after the special option '--' such as below.
|
||||||
|
|
||||||
Example: The MI function -exec-run takes no args.
|
Example: The MI function -exec-run takes no args.
|
||||||
|
|
|
@ -36,15 +36,18 @@
|
||||||
#include "solist.h"
|
#include "solist.h"
|
||||||
#include "gdb.h"
|
#include "gdb.h"
|
||||||
|
|
||||||
/* These are the interpreter setup, etc. functions for the MI interpreter */
|
/* These are the interpreter setup, etc. functions for the MI
|
||||||
|
interpreter. */
|
||||||
|
|
||||||
static void mi_execute_command_wrapper (char *cmd);
|
static void mi_execute_command_wrapper (char *cmd);
|
||||||
static void mi_command_loop (int mi_version);
|
static void mi_command_loop (int mi_version);
|
||||||
|
|
||||||
/* These are hooks that we put in place while doing interpreter_exec
|
/* These are hooks that we put in place while doing interpreter_exec
|
||||||
so we can report interesting things that happened "behind the mi's
|
so we can report interesting things that happened "behind the MI's
|
||||||
back" in this command */
|
back" in this command. */
|
||||||
|
|
||||||
static int mi_interp_query_hook (const char *ctlstr, va_list ap)
|
static int mi_interp_query_hook (const char *ctlstr, va_list ap)
|
||||||
ATTRIBUTE_PRINTF (1, 0);
|
ATTRIBUTE_PRINTF (1, 0);
|
||||||
|
|
||||||
static void mi3_command_loop (void);
|
static void mi3_command_loop (void);
|
||||||
static void mi2_command_loop (void);
|
static void mi2_command_loop (void);
|
||||||
|
@ -77,14 +80,16 @@ mi_interpreter_init (struct interp *interp, int top_level)
|
||||||
const char *name;
|
const char *name;
|
||||||
int mi_version;
|
int mi_version;
|
||||||
|
|
||||||
/* HACK: We need to force stdout/stderr to point at the console. This avoids
|
/* HACK: We need to force stdout/stderr to point at the console.
|
||||||
any potential side effects caused by legacy code that is still
|
This avoids any potential side effects caused by legacy code that
|
||||||
using the TUI / fputs_unfiltered_hook. So we set up output channels for
|
is still using the TUI / fputs_unfiltered_hook. So we set up
|
||||||
this now, and swap them in when we are run. */
|
output channels for this now, and swap them in when we are
|
||||||
|
run. */
|
||||||
|
|
||||||
raw_stdout = stdio_fileopen (stdout);
|
raw_stdout = stdio_fileopen (stdout);
|
||||||
|
|
||||||
/* Create MI channels */
|
/* Create MI console channels, each with a different prefix so they
|
||||||
|
can be distinguished. */
|
||||||
mi->out = mi_console_file_new (raw_stdout, "~", '"');
|
mi->out = mi_console_file_new (raw_stdout, "~", '"');
|
||||||
mi->err = mi_console_file_new (raw_stdout, "&", '"');
|
mi->err = mi_console_file_new (raw_stdout, "&", '"');
|
||||||
mi->log = mi->err;
|
mi->log = mi->err;
|
||||||
|
@ -124,9 +129,10 @@ mi_interpreter_init (struct interp *interp, int top_level)
|
||||||
observer_attach_breakpoint_deleted (mi_breakpoint_deleted);
|
observer_attach_breakpoint_deleted (mi_breakpoint_deleted);
|
||||||
observer_attach_breakpoint_modified (mi_breakpoint_modified);
|
observer_attach_breakpoint_modified (mi_breakpoint_modified);
|
||||||
|
|
||||||
/* The initial inferior is created before this function is called, so we
|
/* The initial inferior is created before this function is
|
||||||
need to report it explicitly. Use iteration in case future version
|
called, so we need to report it explicitly. Use iteration in
|
||||||
of GDB creates more than one inferior up-front. */
|
case future version of GDB creates more than one inferior
|
||||||
|
up-front. */
|
||||||
iterate_over_inferiors (report_initial_inferior, mi);
|
iterate_over_inferiors (report_initial_inferior, mi);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,7 +144,8 @@ mi_interpreter_resume (void *data)
|
||||||
{
|
{
|
||||||
struct mi_interp *mi = 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 ();
|
gdb_setup_readline ();
|
||||||
|
|
||||||
/* These overwrite some of the initialization done in
|
/* These overwrite some of the initialization done in
|
||||||
|
@ -156,12 +163,12 @@ mi_interpreter_resume (void *data)
|
||||||
sync_execution = 0;
|
sync_execution = 0;
|
||||||
|
|
||||||
gdb_stdout = mi->out;
|
gdb_stdout = mi->out;
|
||||||
/* Route error and log output through the MI */
|
/* Route error and log output through the MI. */
|
||||||
gdb_stderr = mi->err;
|
gdb_stderr = mi->err;
|
||||||
gdb_stdlog = mi->log;
|
gdb_stdlog = mi->log;
|
||||||
/* Route target output through the MI. */
|
/* Route target output through the MI. */
|
||||||
gdb_stdtarg = mi->targ;
|
gdb_stdtarg = mi->targ;
|
||||||
/* Route target error through the MI as well. */
|
/* Route target error through the MI as well. */
|
||||||
gdb_stdtargerr = mi->targ;
|
gdb_stdtargerr = mi->targ;
|
||||||
|
|
||||||
/* Replace all the hooks that we know about. There really needs to
|
/* Replace all the hooks that we know about. There really needs to
|
||||||
|
@ -170,7 +177,7 @@ mi_interpreter_resume (void *data)
|
||||||
|
|
||||||
deprecated_show_load_progress = mi_load_progress;
|
deprecated_show_load_progress = mi_load_progress;
|
||||||
|
|
||||||
/* If we're _the_ interpreter, take control. */
|
/* If we're _the_ interpreter, take control. */
|
||||||
if (current_interp_named_p (INTERP_MI1))
|
if (current_interp_named_p (INTERP_MI1))
|
||||||
deprecated_command_loop_hook = mi1_command_loop;
|
deprecated_command_loop_hook = mi1_command_loop;
|
||||||
else if (current_interp_named_p (INTERP_MI2))
|
else if (current_interp_named_p (INTERP_MI2))
|
||||||
|
@ -200,7 +207,8 @@ mi_interpreter_exec (void *data, const char *command)
|
||||||
return exception_none;
|
return exception_none;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Never display the default gdb prompt in mi case. */
|
/* Never display the default GDB prompt in MI case. */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
mi_interpreter_prompt_p (void *data)
|
mi_interpreter_prompt_p (void *data)
|
||||||
{
|
{
|
||||||
|
@ -229,13 +237,14 @@ mi_cmd_interpreter_exec (char *command, char **argv, int argc)
|
||||||
"does not support command execution"),
|
"does not support command execution"),
|
||||||
argv[0]);
|
argv[0]);
|
||||||
|
|
||||||
/* Insert the MI out hooks, making sure to also call the interpreter's hooks
|
/* Insert the MI out hooks, making sure to also call the
|
||||||
if it has any. */
|
interpreter's hooks if it has any. */
|
||||||
/* KRS: We shouldn't need this... Events should be installed and they should
|
/* KRS: We shouldn't need this... Events should be installed and
|
||||||
just ALWAYS fire something out down the MI channel... */
|
they should just ALWAYS fire something out down the MI
|
||||||
|
channel. */
|
||||||
mi_insert_notify_hooks ();
|
mi_insert_notify_hooks ();
|
||||||
|
|
||||||
/* Now run the code... */
|
/* Now run the code. */
|
||||||
|
|
||||||
old_chain = make_cleanup (null_cleanup, 0);
|
old_chain = make_cleanup (null_cleanup, 0);
|
||||||
for (i = 1; i < argc; i++)
|
for (i = 1; i < argc; i++)
|
||||||
|
@ -257,14 +266,12 @@ mi_cmd_interpreter_exec (char *command, char **argv, int argc)
|
||||||
do_cleanups (old_chain);
|
do_cleanups (old_chain);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/* This inserts a number of hooks that are meant to produce
|
||||||
* mi_insert_notify_hooks - This inserts a number of hooks that are
|
async-notify ("=") MI messages while running commands in another
|
||||||
* meant to produce async-notify ("=") MI messages while running
|
interpreter using mi_interpreter_exec. The canonical use for this
|
||||||
* commands in another interpreter using mi_interpreter_exec. The
|
is to allow access to the gdb CLI interpreter from within the MI,
|
||||||
* canonical use for this is to allow access to the gdb CLI
|
while still producing MI style output when actions in the CLI
|
||||||
* interpreter from within the MI, while still producing MI style
|
command change GDB's state. */
|
||||||
* output when actions in the CLI command change gdb's state.
|
|
||||||
*/
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
mi_insert_notify_hooks (void)
|
mi_insert_notify_hooks (void)
|
||||||
|
@ -312,11 +319,13 @@ static void
|
||||||
mi_command_loop (int mi_version)
|
mi_command_loop (int mi_version)
|
||||||
{
|
{
|
||||||
/* Turn off 8 bit strings in quoted output. Any character with the
|
/* Turn off 8 bit strings in quoted output. Any character with the
|
||||||
high bit set is printed using C's octal format. */
|
high bit set is printed using C's octal format. */
|
||||||
sevenbit_strings = 1;
|
sevenbit_strings = 1;
|
||||||
/* Tell the world that we're alive */
|
|
||||||
|
/* Tell the world that we're alive. */
|
||||||
fputs_unfiltered ("(gdb) \n", raw_stdout);
|
fputs_unfiltered ("(gdb) \n", raw_stdout);
|
||||||
gdb_flush (raw_stdout);
|
gdb_flush (raw_stdout);
|
||||||
|
|
||||||
start_event_loop ();
|
start_event_loop ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -420,11 +429,11 @@ mi_on_normal_stop (struct bpstats *bs, int print_frame)
|
||||||
|
|
||||||
if (current_uiout != mi_uiout)
|
if (current_uiout != mi_uiout)
|
||||||
{
|
{
|
||||||
/* The normal_stop function has printed frame information into
|
/* The normal_stop function has printed frame information
|
||||||
CLI uiout, or some other non-MI uiout. There's no way we
|
into CLI uiout, or some other non-MI uiout. There's no
|
||||||
can extract proper fields from random uiout object, so we print
|
way we can extract proper fields from random uiout
|
||||||
the frame again. In practice, this can only happen when running
|
object, so we print the frame again. In practice, this
|
||||||
a CLI command in MI. */
|
can only happen when running a CLI command in MI. */
|
||||||
struct ui_out *saved_uiout = current_uiout;
|
struct ui_out *saved_uiout = current_uiout;
|
||||||
struct target_waitstatus last;
|
struct target_waitstatus last;
|
||||||
ptid_t last_ptid;
|
ptid_t last_ptid;
|
||||||
|
@ -483,9 +492,11 @@ mi_about_to_proceed (void)
|
||||||
|
|
||||||
/* When non-zero, no MI notifications will be emitted in
|
/* When non-zero, no MI notifications will be emitted in
|
||||||
response to breakpoint change observers. */
|
response to breakpoint change observers. */
|
||||||
|
|
||||||
int mi_suppress_breakpoint_notifications = 0;
|
int mi_suppress_breakpoint_notifications = 0;
|
||||||
|
|
||||||
/* Emit notification about a created breakpoint. */
|
/* Emit notification about a created breakpoint. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
mi_breakpoint_created (struct breakpoint *b)
|
mi_breakpoint_created (struct breakpoint *b)
|
||||||
{
|
{
|
||||||
|
@ -503,12 +514,12 @@ mi_breakpoint_created (struct breakpoint *b)
|
||||||
fprintf_unfiltered (mi->event_channel,
|
fprintf_unfiltered (mi->event_channel,
|
||||||
"breakpoint-created");
|
"breakpoint-created");
|
||||||
/* We want the output from gdb_breakpoint_query to go to
|
/* We want the output from gdb_breakpoint_query to go to
|
||||||
mi->event_channel. One approach would be to just
|
mi->event_channel. One approach would be to just call
|
||||||
call gdb_breakpoint_query, and then use mi_out_put to
|
gdb_breakpoint_query, and then use mi_out_put to send the current
|
||||||
send the current content of mi_outout into mi->event_channel.
|
content of mi_outout into mi->event_channel. However, that will
|
||||||
However, that will break if anything is output to mi_uiout
|
break if anything is output to mi_uiout prior to calling the
|
||||||
prior the calling the breakpoint_created notifications.
|
breakpoint_created notifications. So, we use
|
||||||
So, we use ui_out_redirect. */
|
ui_out_redirect. */
|
||||||
ui_out_redirect (mi_uiout, mi->event_channel);
|
ui_out_redirect (mi_uiout, mi->event_channel);
|
||||||
TRY_CATCH (e, RETURN_MASK_ERROR)
|
TRY_CATCH (e, RETURN_MASK_ERROR)
|
||||||
gdb_breakpoint_query (mi_uiout, b->number, NULL);
|
gdb_breakpoint_query (mi_uiout, b->number, NULL);
|
||||||
|
@ -518,6 +529,7 @@ mi_breakpoint_created (struct breakpoint *b)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Emit notification about deleted breakpoint. */
|
/* Emit notification about deleted breakpoint. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
mi_breakpoint_deleted (struct breakpoint *b)
|
mi_breakpoint_deleted (struct breakpoint *b)
|
||||||
{
|
{
|
||||||
|
@ -538,6 +550,7 @@ mi_breakpoint_deleted (struct breakpoint *b)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Emit notification about modified breakpoint. */
|
/* Emit notification about modified breakpoint. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
mi_breakpoint_modified (struct breakpoint *b)
|
mi_breakpoint_modified (struct breakpoint *b)
|
||||||
{
|
{
|
||||||
|
@ -555,12 +568,12 @@ mi_breakpoint_modified (struct breakpoint *b)
|
||||||
fprintf_unfiltered (mi->event_channel,
|
fprintf_unfiltered (mi->event_channel,
|
||||||
"breakpoint-modified");
|
"breakpoint-modified");
|
||||||
/* We want the output from gdb_breakpoint_query to go to
|
/* We want the output from gdb_breakpoint_query to go to
|
||||||
mi->event_channel. One approach would be to just
|
mi->event_channel. One approach would be to just call
|
||||||
call gdb_breakpoint_query, and then use mi_out_put to
|
gdb_breakpoint_query, and then use mi_out_put to send the current
|
||||||
send the current content of mi_outout into mi->event_channel.
|
content of mi_outout into mi->event_channel. However, that will
|
||||||
However, that will break if anything is output to mi_uiout
|
break if anything is output to mi_uiout prior to calling the
|
||||||
prior the calling the breakpoint_created notifications.
|
breakpoint_created notifications. So, we use
|
||||||
So, we use ui_out_redirect. */
|
ui_out_redirect. */
|
||||||
ui_out_redirect (mi_uiout, mi->event_channel);
|
ui_out_redirect (mi_uiout, mi->event_channel);
|
||||||
TRY_CATCH (e, RETURN_MASK_ERROR)
|
TRY_CATCH (e, RETURN_MASK_ERROR)
|
||||||
gdb_breakpoint_query (mi_uiout, b->number, NULL);
|
gdb_breakpoint_query (mi_uiout, b->number, NULL);
|
||||||
|
@ -569,7 +582,6 @@ mi_breakpoint_modified (struct breakpoint *b)
|
||||||
gdb_flush (mi->event_channel);
|
gdb_flush (mi->event_channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
mi_output_running_pid (struct thread_info *info, void *arg)
|
mi_output_running_pid (struct thread_info *info, void *arg)
|
||||||
{
|
{
|
||||||
|
@ -738,14 +750,14 @@ void
|
||||||
_initialize_mi_interp (void)
|
_initialize_mi_interp (void)
|
||||||
{
|
{
|
||||||
static const struct interp_procs procs =
|
static const struct interp_procs procs =
|
||||||
{
|
{
|
||||||
mi_interpreter_init, /* init_proc */
|
mi_interpreter_init, /* init_proc */
|
||||||
mi_interpreter_resume, /* resume_proc */
|
mi_interpreter_resume, /* resume_proc */
|
||||||
mi_interpreter_suspend, /* suspend_proc */
|
mi_interpreter_suspend, /* suspend_proc */
|
||||||
mi_interpreter_exec, /* exec_proc */
|
mi_interpreter_exec, /* exec_proc */
|
||||||
mi_interpreter_prompt_p, /* prompt_proc_p */
|
mi_interpreter_prompt_p, /* prompt_proc_p */
|
||||||
mi_ui_out /* ui_out_proc */
|
mi_ui_out /* ui_out_proc */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* The various interpreter levels. */
|
/* The various interpreter levels. */
|
||||||
interp_add (interp_new (INTERP_MI1, &procs));
|
interp_add (interp_new (INTERP_MI1, &procs));
|
||||||
|
|
304
gdb/mi/mi-main.c
304
gdb/mi/mi-main.c
|
@ -19,8 +19,6 @@
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
/* Work in progress. */
|
|
||||||
|
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
#include "arch-utils.h"
|
#include "arch-utils.h"
|
||||||
#include "target.h"
|
#include "target.h"
|
||||||
|
@ -71,18 +69,19 @@ enum
|
||||||
};
|
};
|
||||||
|
|
||||||
int mi_debug_p;
|
int mi_debug_p;
|
||||||
|
|
||||||
struct ui_file *raw_stdout;
|
struct ui_file *raw_stdout;
|
||||||
|
|
||||||
/* This is used to pass the current command timestamp
|
/* This is used to pass the current command timestamp down to
|
||||||
down to continuation routines. */
|
continuation routines. */
|
||||||
static struct mi_timestamp *current_command_ts;
|
static struct mi_timestamp *current_command_ts;
|
||||||
|
|
||||||
static int do_timings = 0;
|
static int do_timings = 0;
|
||||||
|
|
||||||
char *current_token;
|
char *current_token;
|
||||||
/* Few commands would like to know if options like --thread-group
|
/* Few commands would like to know if options like --thread-group were
|
||||||
were explicitly specified. This variable keeps the current
|
explicitly specified. This variable keeps the current parsed
|
||||||
parsed command including all option, and make it possible. */
|
command including all option, and make it possible. */
|
||||||
static struct mi_parse *current_context;
|
static struct mi_parse *current_context;
|
||||||
|
|
||||||
int running_result_record_printed = 1;
|
int running_result_record_printed = 1;
|
||||||
|
@ -178,7 +177,7 @@ void
|
||||||
mi_cmd_exec_return (char *command, char **argv, int argc)
|
mi_cmd_exec_return (char *command, char **argv, int argc)
|
||||||
{
|
{
|
||||||
/* This command doesn't really execute the target, it just pops the
|
/* This command doesn't really execute the target, it just pops the
|
||||||
specified number of frames. */
|
specified number of frames. */
|
||||||
if (argc)
|
if (argc)
|
||||||
/* Call return_command with from_tty argument equal to 0 so as to
|
/* Call return_command with from_tty argument equal to 0 so as to
|
||||||
avoid being queried. */
|
avoid being queried. */
|
||||||
|
@ -214,7 +213,6 @@ proceed_thread (struct thread_info *thread, int pid)
|
||||||
proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 0);
|
proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
proceed_thread_callback (struct thread_info *thread, void *arg)
|
proceed_thread_callback (struct thread_info *thread, void *arg)
|
||||||
{
|
{
|
||||||
|
@ -229,9 +227,10 @@ exec_continue (char **argv, int argc)
|
||||||
{
|
{
|
||||||
if (non_stop)
|
if (non_stop)
|
||||||
{
|
{
|
||||||
/* In non-stop mode, 'resume' always resumes a single thread. Therefore,
|
/* In non-stop mode, 'resume' always resumes a single thread.
|
||||||
to resume all threads of the current inferior, or all threads in all
|
Therefore, to resume all threads of the current inferior, or
|
||||||
inferiors, we need to iterate over threads.
|
all threads in all inferiors, we need to iterate over
|
||||||
|
threads.
|
||||||
|
|
||||||
See comment on infcmd.c:proceed_thread_callback for rationale. */
|
See comment on infcmd.c:proceed_thread_callback for rationale. */
|
||||||
if (current_context->all || current_context->thread_group != -1)
|
if (current_context->all || current_context->thread_group != -1)
|
||||||
|
@ -265,9 +264,10 @@ exec_continue (char **argv, int argc)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* In all-stop mode, -exec-continue traditionally resumed either
|
/* In all-stop mode, -exec-continue traditionally resumed
|
||||||
all threads, or one thread, depending on the 'scheduler-locking'
|
either all threads, or one thread, depending on the
|
||||||
variable. Let's continue to do the same. */
|
'scheduler-locking' variable. Let's continue to do the
|
||||||
|
same. */
|
||||||
continue_1 (1);
|
continue_1 (1);
|
||||||
}
|
}
|
||||||
do_cleanups (back_to);
|
do_cleanups (back_to);
|
||||||
|
@ -322,11 +322,12 @@ interrupt_thread_callback (struct thread_info *thread, void *arg)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Interrupt the execution of the target. Note how we must play around
|
/* Interrupt the execution of the target. Note how we must play
|
||||||
with the token variables, in order to display the current token in
|
around with the token variables, in order to display the current
|
||||||
the result of the interrupt command, and the previous execution
|
token in the result of the interrupt command, and the previous
|
||||||
token when the target finally stops. See comments in
|
execution token when the target finally stops. See comments in
|
||||||
mi_cmd_execute. */
|
mi_cmd_execute. */
|
||||||
|
|
||||||
void
|
void
|
||||||
mi_cmd_exec_interrupt (char *command, char **argv, int argc)
|
mi_cmd_exec_interrupt (char *command, char **argv, int argc)
|
||||||
{
|
{
|
||||||
|
@ -609,8 +610,9 @@ print_one_inferior (struct inferior *inferior, void *xdata)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Output a field named 'cores' with a list as the value. The elements of
|
/* Output a field named 'cores' with a list as the value. The
|
||||||
the list are obtained by splitting 'cores' on comma. */
|
elements of the list are obtained by splitting 'cores' on
|
||||||
|
comma. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
output_cores (struct ui_out *uiout, const char *field_name, const char *xcores)
|
output_cores (struct ui_out *uiout, const char *field_name, const char *xcores)
|
||||||
|
@ -797,15 +799,15 @@ mi_cmd_list_thread_groups (char *command, char **argv, int argc)
|
||||||
VEC (int) *ids = 0;
|
VEC (int) *ids = 0;
|
||||||
|
|
||||||
enum opt
|
enum opt
|
||||||
{
|
|
||||||
AVAILABLE_OPT, RECURSE_OPT
|
|
||||||
};
|
|
||||||
static const struct mi_opt opts[] =
|
|
||||||
{
|
{
|
||||||
{"-available", AVAILABLE_OPT, 0},
|
AVAILABLE_OPT, RECURSE_OPT
|
||||||
{"-recurse", RECURSE_OPT, 1},
|
|
||||||
{ 0, 0, 0 }
|
|
||||||
};
|
};
|
||||||
|
static const struct mi_opt opts[] =
|
||||||
|
{
|
||||||
|
{"-available", AVAILABLE_OPT, 0},
|
||||||
|
{"-recurse", RECURSE_OPT, 1},
|
||||||
|
{ 0, 0, 0 }
|
||||||
|
};
|
||||||
|
|
||||||
int oind = 0;
|
int oind = 0;
|
||||||
char *oarg;
|
char *oarg;
|
||||||
|
@ -861,7 +863,7 @@ mi_cmd_list_thread_groups (char *command, char **argv, int argc)
|
||||||
}
|
}
|
||||||
else if (VEC_length (int, ids) == 1)
|
else if (VEC_length (int, ids) == 1)
|
||||||
{
|
{
|
||||||
/* Local thread groups, single id. */
|
/* Local thread groups, single id. */
|
||||||
int id = *VEC_address (int, ids);
|
int id = *VEC_address (int, ids);
|
||||||
struct inferior *inf = find_inferior_id (id);
|
struct inferior *inf = find_inferior_id (id);
|
||||||
|
|
||||||
|
@ -899,10 +901,11 @@ mi_cmd_data_list_register_names (char *command, char **argv, int argc)
|
||||||
struct cleanup *cleanup;
|
struct cleanup *cleanup;
|
||||||
|
|
||||||
/* Note that the test for a valid register must include checking the
|
/* Note that the test for a valid register must include checking the
|
||||||
gdbarch_register_name because gdbarch_num_regs may be allocated for
|
gdbarch_register_name because gdbarch_num_regs may be allocated
|
||||||
the union of the register sets within a family of related processors.
|
for the union of the register sets within a family of related
|
||||||
In this case, some entries of gdbarch_register_name will change depending
|
processors. In this case, some entries of gdbarch_register_name
|
||||||
upon the particular processor being debugged. */
|
will change depending upon the particular processor being
|
||||||
|
debugged. */
|
||||||
|
|
||||||
gdbarch = get_current_arch ();
|
gdbarch = get_current_arch ();
|
||||||
numregs = gdbarch_num_regs (gdbarch) + gdbarch_num_pseudo_regs (gdbarch);
|
numregs = gdbarch_num_regs (gdbarch) + gdbarch_num_pseudo_regs (gdbarch);
|
||||||
|
@ -952,27 +955,30 @@ mi_cmd_data_list_changed_registers (char *command, char **argv, int argc)
|
||||||
int i;
|
int i;
|
||||||
struct cleanup *cleanup;
|
struct cleanup *cleanup;
|
||||||
|
|
||||||
/* The last time we visited this function, the current frame's register
|
/* The last time we visited this function, the current frame's
|
||||||
contents were saved in THIS_REGS. Move THIS_REGS over to PREV_REGS,
|
register contents were saved in THIS_REGS. Move THIS_REGS over
|
||||||
and refresh THIS_REGS with the now-current register contents. */
|
to PREV_REGS, and refresh THIS_REGS with the now-current register
|
||||||
|
contents. */
|
||||||
|
|
||||||
prev_regs = this_regs;
|
prev_regs = this_regs;
|
||||||
this_regs = frame_save_as_regcache (get_selected_frame (NULL));
|
this_regs = frame_save_as_regcache (get_selected_frame (NULL));
|
||||||
cleanup = make_cleanup_regcache_xfree (prev_regs);
|
cleanup = make_cleanup_regcache_xfree (prev_regs);
|
||||||
|
|
||||||
/* Note that the test for a valid register must include checking the
|
/* Note that the test for a valid register must include checking the
|
||||||
gdbarch_register_name because gdbarch_num_regs may be allocated for
|
gdbarch_register_name because gdbarch_num_regs may be allocated
|
||||||
the union of the register sets within a family of related processors.
|
for the union of the register sets within a family of related
|
||||||
In this case, some entries of gdbarch_register_name will change depending
|
processors. In this case, some entries of gdbarch_register_name
|
||||||
upon the particular processor being debugged. */
|
will change depending upon the particular processor being
|
||||||
|
debugged. */
|
||||||
|
|
||||||
gdbarch = get_regcache_arch (this_regs);
|
gdbarch = get_regcache_arch (this_regs);
|
||||||
numregs = gdbarch_num_regs (gdbarch) + gdbarch_num_pseudo_regs (gdbarch);
|
numregs = gdbarch_num_regs (gdbarch) + gdbarch_num_pseudo_regs (gdbarch);
|
||||||
|
|
||||||
make_cleanup_ui_out_list_begin_end (uiout, "changed-registers");
|
make_cleanup_ui_out_list_begin_end (uiout, "changed-registers");
|
||||||
|
|
||||||
if (argc == 0) /* No args, just do all the regs. */
|
if (argc == 0)
|
||||||
{
|
{
|
||||||
|
/* No args, just do all the regs. */
|
||||||
for (regnum = 0;
|
for (regnum = 0;
|
||||||
regnum < numregs;
|
regnum < numregs;
|
||||||
regnum++)
|
regnum++)
|
||||||
|
@ -1042,11 +1048,13 @@ register_changed_p (int regnum, struct regcache *prev_regs,
|
||||||
|
|
||||||
/* Return a list of register number and value pairs. The valid
|
/* Return a list of register number and value pairs. The valid
|
||||||
arguments expected are: a letter indicating the format in which to
|
arguments expected are: a letter indicating the format in which to
|
||||||
display the registers contents. This can be one of: x (hexadecimal), d
|
display the registers contents. This can be one of: x
|
||||||
(decimal), N (natural), t (binary), o (octal), r (raw). After the
|
(hexadecimal), d (decimal), N (natural), t (binary), o (octal), r
|
||||||
format argumetn there can be a sequence of numbers, indicating which
|
(raw). After the format argument there can be a sequence of
|
||||||
registers to fetch the content of. If the format is the only argument,
|
numbers, indicating which registers to fetch the content of. If
|
||||||
a list of all the registers with their values is returned. */
|
the format is the only argument, a list of all the registers with
|
||||||
|
their values is returned. */
|
||||||
|
|
||||||
void
|
void
|
||||||
mi_cmd_data_list_register_values (char *command, char **argv, int argc)
|
mi_cmd_data_list_register_values (char *command, char **argv, int argc)
|
||||||
{
|
{
|
||||||
|
@ -1058,10 +1066,11 @@ mi_cmd_data_list_register_values (char *command, char **argv, int argc)
|
||||||
struct cleanup *list_cleanup, *tuple_cleanup;
|
struct cleanup *list_cleanup, *tuple_cleanup;
|
||||||
|
|
||||||
/* Note that the test for a valid register must include checking the
|
/* Note that the test for a valid register must include checking the
|
||||||
gdbarch_register_name because gdbarch_num_regs may be allocated for
|
gdbarch_register_name because gdbarch_num_regs may be allocated
|
||||||
the union of the register sets within a family of related processors.
|
for the union of the register sets within a family of related
|
||||||
In this case, some entries of gdbarch_register_name will change depending
|
processors. In this case, some entries of gdbarch_register_name
|
||||||
upon the particular processor being debugged. */
|
will change depending upon the particular processor being
|
||||||
|
debugged. */
|
||||||
|
|
||||||
if (argc == 0)
|
if (argc == 0)
|
||||||
error (_("-data-list-register-values: Usage: "
|
error (_("-data-list-register-values: Usage: "
|
||||||
|
@ -1075,8 +1084,9 @@ mi_cmd_data_list_register_values (char *command, char **argv, int argc)
|
||||||
|
|
||||||
list_cleanup = make_cleanup_ui_out_list_begin_end (uiout, "register-values");
|
list_cleanup = make_cleanup_ui_out_list_begin_end (uiout, "register-values");
|
||||||
|
|
||||||
if (argc == 1) /* No args, beside the format: do all the regs. */
|
if (argc == 1)
|
||||||
{
|
{
|
||||||
|
/* No args, beside the format: do all the regs. */
|
||||||
for (regnum = 0;
|
for (regnum = 0;
|
||||||
regnum < numregs;
|
regnum < numregs;
|
||||||
regnum++)
|
regnum++)
|
||||||
|
@ -1113,6 +1123,7 @@ mi_cmd_data_list_register_values (char *command, char **argv, int argc)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Output one register's contents in the desired format. */
|
/* Output one register's contents in the desired format. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
get_register (struct frame_info *frame, int regnum, int format)
|
get_register (struct frame_info *frame, int regnum, int format)
|
||||||
{
|
{
|
||||||
|
@ -1150,7 +1161,6 @@ get_register (struct frame_info *frame, int regnum, int format)
|
||||||
ptr += 2;
|
ptr += 2;
|
||||||
}
|
}
|
||||||
ui_out_field_string (uiout, "value", buf);
|
ui_out_field_string (uiout, "value", buf);
|
||||||
/*fputs_filtered (buf, gdb_stdout); */
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1180,10 +1190,11 @@ mi_cmd_data_write_register_values (char *command, char **argv, int argc)
|
||||||
char format;
|
char format;
|
||||||
|
|
||||||
/* Note that the test for a valid register must include checking the
|
/* Note that the test for a valid register must include checking the
|
||||||
gdbarch_register_name because gdbarch_num_regs may be allocated for
|
gdbarch_register_name because gdbarch_num_regs may be allocated
|
||||||
the union of the register sets within a family of related processors.
|
for the union of the register sets within a family of related
|
||||||
In this case, some entries of gdbarch_register_name will change depending
|
processors. In this case, some entries of gdbarch_register_name
|
||||||
upon the particular processor being debugged. */
|
will change depending upon the particular processor being
|
||||||
|
debugged. */
|
||||||
|
|
||||||
regcache = get_current_regcache ();
|
regcache = get_current_regcache ();
|
||||||
gdbarch = get_regcache_arch (regcache);
|
gdbarch = get_regcache_arch (regcache);
|
||||||
|
@ -1229,6 +1240,7 @@ mi_cmd_data_write_register_values (char *command, char **argv, int argc)
|
||||||
/* Evaluate the value of the argument. The argument is an
|
/* Evaluate the value of the argument. The argument is an
|
||||||
expression. If the expression contains spaces it needs to be
|
expression. If the expression contains spaces it needs to be
|
||||||
included in double quotes. */
|
included in double quotes. */
|
||||||
|
|
||||||
void
|
void
|
||||||
mi_cmd_data_evaluate_expression (char *command, char **argv, int argc)
|
mi_cmd_data_evaluate_expression (char *command, char **argv, int argc)
|
||||||
{
|
{
|
||||||
|
@ -1265,7 +1277,7 @@ mi_cmd_data_evaluate_expression (char *command, char **argv, int argc)
|
||||||
do_cleanups (old_chain);
|
do_cleanups (old_chain);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* DATA-MEMORY-READ:
|
/* This is the -data-read-memory command.
|
||||||
|
|
||||||
ADDR: start address of data to be dumped.
|
ADDR: start address of data to be dumped.
|
||||||
WORD-FORMAT: a char indicating format for the ``word''. See
|
WORD-FORMAT: a char indicating format for the ``word''. See
|
||||||
|
@ -1282,7 +1294,7 @@ mi_cmd_data_evaluate_expression (char *command, char **argv, int argc)
|
||||||
{addr="...",rowN={wordN="..." ,... [,ascii="..."]}, ...}
|
{addr="...",rowN={wordN="..." ,... [,ascii="..."]}, ...}
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
The number of bytes read is SIZE*ROW*COL. */
|
The number of bytes read is SIZE*ROW*COL. */
|
||||||
|
|
||||||
void
|
void
|
||||||
mi_cmd_data_read_memory (char *command, char **argv, int argc)
|
mi_cmd_data_read_memory (char *command, char **argv, int argc)
|
||||||
|
@ -1291,9 +1303,7 @@ mi_cmd_data_read_memory (char *command, char **argv, int argc)
|
||||||
struct ui_out *uiout = current_uiout;
|
struct ui_out *uiout = current_uiout;
|
||||||
struct cleanup *cleanups = make_cleanup (null_cleanup, NULL);
|
struct cleanup *cleanups = make_cleanup (null_cleanup, NULL);
|
||||||
CORE_ADDR addr;
|
CORE_ADDR addr;
|
||||||
long total_bytes;
|
long total_bytes, nr_cols, nr_rows;
|
||||||
long nr_cols;
|
|
||||||
long nr_rows;
|
|
||||||
char word_format;
|
char word_format;
|
||||||
struct type *word_type;
|
struct type *word_type;
|
||||||
long word_size;
|
long word_size;
|
||||||
|
@ -1305,14 +1315,14 @@ mi_cmd_data_read_memory (char *command, char **argv, int argc)
|
||||||
int oind = 0;
|
int oind = 0;
|
||||||
char *oarg;
|
char *oarg;
|
||||||
enum opt
|
enum opt
|
||||||
{
|
|
||||||
OFFSET_OPT
|
|
||||||
};
|
|
||||||
static const struct mi_opt opts[] =
|
|
||||||
{
|
{
|
||||||
{"o", OFFSET_OPT, 1},
|
OFFSET_OPT
|
||||||
{ 0, 0, 0 }
|
|
||||||
};
|
};
|
||||||
|
static const struct mi_opt opts[] =
|
||||||
|
{
|
||||||
|
{"o", OFFSET_OPT, 1},
|
||||||
|
{ 0, 0, 0 }
|
||||||
|
};
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
|
@ -1340,7 +1350,7 @@ mi_cmd_data_read_memory (char *command, char **argv, int argc)
|
||||||
/* Start address of the memory dump. */
|
/* Start address of the memory dump. */
|
||||||
addr = parse_and_eval_address (argv[0]) + offset;
|
addr = parse_and_eval_address (argv[0]) + offset;
|
||||||
/* The format character to use when displaying a memory word. See
|
/* The format character to use when displaying a memory word. See
|
||||||
the ``x'' command. */
|
the ``x'' command. */
|
||||||
word_format = argv[1][0];
|
word_format = argv[1][0];
|
||||||
/* The size of the memory word. */
|
/* The size of the memory word. */
|
||||||
word_size = atol (argv[2]);
|
word_size = atol (argv[2]);
|
||||||
|
@ -1456,13 +1466,9 @@ mi_cmd_data_read_memory (char *command, char **argv, int argc)
|
||||||
byte < row_byte + word_size * nr_cols; byte++)
|
byte < row_byte + word_size * nr_cols; byte++)
|
||||||
{
|
{
|
||||||
if (byte >= nr_bytes)
|
if (byte >= nr_bytes)
|
||||||
{
|
fputc_unfiltered ('X', stream->stream);
|
||||||
fputc_unfiltered ('X', stream->stream);
|
|
||||||
}
|
|
||||||
else if (mbuf[byte] < 32 || mbuf[byte] > 126)
|
else if (mbuf[byte] < 32 || mbuf[byte] > 126)
|
||||||
{
|
fputc_unfiltered (aschar, stream->stream);
|
||||||
fputc_unfiltered (aschar, stream->stream);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
fputc_unfiltered (mbuf[byte], stream->stream);
|
fputc_unfiltered (mbuf[byte], stream->stream);
|
||||||
}
|
}
|
||||||
|
@ -1491,14 +1497,14 @@ mi_cmd_data_read_memory_bytes (char *command, char **argv, int argc)
|
||||||
int oind = 0;
|
int oind = 0;
|
||||||
char *oarg;
|
char *oarg;
|
||||||
enum opt
|
enum opt
|
||||||
{
|
|
||||||
OFFSET_OPT
|
|
||||||
};
|
|
||||||
static const struct mi_opt opts[] =
|
|
||||||
{
|
{
|
||||||
{"o", OFFSET_OPT, 1},
|
OFFSET_OPT
|
||||||
{ 0, 0, 0 }
|
|
||||||
};
|
};
|
||||||
|
static const struct mi_opt opts[] =
|
||||||
|
{
|
||||||
|
{"o", OFFSET_OPT, 1},
|
||||||
|
{ 0, 0, 0 }
|
||||||
|
};
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
|
@ -1558,8 +1564,7 @@ mi_cmd_data_read_memory_bytes (char *command, char **argv, int argc)
|
||||||
do_cleanups (cleanups);
|
do_cleanups (cleanups);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Implementation of the -data-write_memory command.
|
||||||
/* DATA-MEMORY-WRITE:
|
|
||||||
|
|
||||||
COLUMN_OFFSET: optional argument. Must be preceded by '-o'. The
|
COLUMN_OFFSET: optional argument. Must be preceded by '-o'. The
|
||||||
offset from the beginning of the memory grid row where the cell to
|
offset from the beginning of the memory grid row where the cell to
|
||||||
|
@ -1575,6 +1580,7 @@ mi_cmd_data_read_memory_bytes (char *command, char **argv, int argc)
|
||||||
Writes VALUE into ADDR + (COLUMN_OFFSET * WORD_SIZE).
|
Writes VALUE into ADDR + (COLUMN_OFFSET * WORD_SIZE).
|
||||||
|
|
||||||
Prints nothing. */
|
Prints nothing. */
|
||||||
|
|
||||||
void
|
void
|
||||||
mi_cmd_data_write_memory (char *command, char **argv, int argc)
|
mi_cmd_data_write_memory (char *command, char **argv, int argc)
|
||||||
{
|
{
|
||||||
|
@ -1592,14 +1598,14 @@ mi_cmd_data_write_memory (char *command, char **argv, int argc)
|
||||||
int oind = 0;
|
int oind = 0;
|
||||||
char *oarg;
|
char *oarg;
|
||||||
enum opt
|
enum opt
|
||||||
{
|
|
||||||
OFFSET_OPT
|
|
||||||
};
|
|
||||||
static const struct mi_opt opts[] =
|
|
||||||
{
|
{
|
||||||
{"o", OFFSET_OPT, 1},
|
OFFSET_OPT
|
||||||
{ 0, 0, 0 }
|
|
||||||
};
|
};
|
||||||
|
static const struct mi_opt opts[] =
|
||||||
|
{
|
||||||
|
{"o", OFFSET_OPT, 1},
|
||||||
|
{ 0, 0, 0 }
|
||||||
|
};
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
|
@ -1628,7 +1634,7 @@ mi_cmd_data_write_memory (char *command, char **argv, int argc)
|
||||||
/* The format character to use when displaying a memory word. See
|
/* The format character to use when displaying a memory word. See
|
||||||
the ``x'' command. */
|
the ``x'' command. */
|
||||||
word_format = argv[1][0];
|
word_format = argv[1][0];
|
||||||
/* The size of the memory word. */
|
/* The size of the memory word. */
|
||||||
word_size = atol (argv[2]);
|
word_size = atol (argv[2]);
|
||||||
|
|
||||||
/* Calculate the real address of the write destination. */
|
/* Calculate the real address of the write destination. */
|
||||||
|
@ -1646,10 +1652,11 @@ mi_cmd_data_write_memory (char *command, char **argv, int argc)
|
||||||
do_cleanups (old_chain);
|
do_cleanups (old_chain);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* DATA-MEMORY-WRITE-RAW:
|
/* Implementation of the -data-write-memory-bytes command.
|
||||||
|
|
||||||
ADDR: start address
|
ADDR: start address
|
||||||
DATA: string of bytes to write at that address. */
|
DATA: string of bytes to write at that address. */
|
||||||
|
|
||||||
void
|
void
|
||||||
mi_cmd_data_write_memory_bytes (char *command, char **argv, int argc)
|
mi_cmd_data_write_memory_bytes (char *command, char **argv, int argc)
|
||||||
{
|
{
|
||||||
|
@ -1673,7 +1680,7 @@ mi_cmd_data_write_memory_bytes (char *command, char **argv, int argc)
|
||||||
{
|
{
|
||||||
int x;
|
int x;
|
||||||
sscanf (cdata + i * 2, "%02x", &x);
|
sscanf (cdata + i * 2, "%02x", &x);
|
||||||
data[i] = (gdb_byte)x;
|
data[i] = (gdb_byte) x;
|
||||||
}
|
}
|
||||||
|
|
||||||
r = target_write_memory (addr, data, len);
|
r = target_write_memory (addr, data, len);
|
||||||
|
@ -1683,7 +1690,6 @@ mi_cmd_data_write_memory_bytes (char *command, char **argv, int argc)
|
||||||
do_cleanups (back_to);
|
do_cleanups (back_to);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
mi_cmd_enable_timings (char *command, char **argv, int argc)
|
mi_cmd_enable_timings (char *command, char **argv, int argc)
|
||||||
{
|
{
|
||||||
|
@ -1768,8 +1774,8 @@ mi_cmd_add_inferior (char *command, char **argv, int argc)
|
||||||
ui_out_field_fmt (current_uiout, "inferior", "i%d", inf->num);
|
ui_out_field_fmt (current_uiout, "inferior", "i%d", inf->num);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Callback used to find the first inferior other than the
|
/* Callback used to find the first inferior other than the current
|
||||||
current one. */
|
one. */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
get_other_inferior (struct inferior *inf, void *arg)
|
get_other_inferior (struct inferior *inf, void *arg)
|
||||||
|
@ -1825,7 +1831,7 @@ mi_cmd_remove_inferior (char *command, char **argv, int argc)
|
||||||
|
|
||||||
args->action will tell mi_execute_command what action
|
args->action will tell mi_execute_command what action
|
||||||
to perfrom after the given command has executed (display/suppress
|
to perfrom after the given command has executed (display/suppress
|
||||||
prompt, display error). */
|
prompt, display error). */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
captured_mi_execute_command (struct ui_out *uiout, struct mi_parse *context)
|
captured_mi_execute_command (struct ui_out *uiout, struct mi_parse *context)
|
||||||
|
@ -1849,15 +1855,14 @@ captured_mi_execute_command (struct ui_out *uiout, struct mi_parse *context)
|
||||||
fprintf_unfiltered (raw_stdout, " token=`%s' command=`%s' args=`%s'\n",
|
fprintf_unfiltered (raw_stdout, " token=`%s' command=`%s' args=`%s'\n",
|
||||||
context->token, context->command, context->args);
|
context->token, context->command, context->args);
|
||||||
|
|
||||||
|
|
||||||
mi_cmd_execute (context);
|
mi_cmd_execute (context);
|
||||||
|
|
||||||
/* Print the result if there were no errors.
|
/* Print the result if there were no errors.
|
||||||
|
|
||||||
Remember that on the way out of executing a command, you have
|
Remember that on the way out of executing a command, you have
|
||||||
to directly use the mi_interp's uiout, since the command could
|
to directly use the mi_interp's uiout, since the command
|
||||||
have reset the interpreter, in which case the current uiout
|
could have reset the interpreter, in which case the current
|
||||||
will most likely crash in the mi_out_* routines. */
|
uiout will most likely crash in the mi_out_* routines. */
|
||||||
if (!running_result_record_printed)
|
if (!running_result_record_printed)
|
||||||
{
|
{
|
||||||
fputs_unfiltered (context->token, raw_stdout);
|
fputs_unfiltered (context->token, raw_stdout);
|
||||||
|
@ -1871,9 +1876,9 @@ captured_mi_execute_command (struct ui_out *uiout, struct mi_parse *context)
|
||||||
fputs_unfiltered ("\n", raw_stdout);
|
fputs_unfiltered ("\n", raw_stdout);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
/* The command does not want anything to be printed. In that
|
/* The command does not want anything to be printed. In that
|
||||||
case, the command probably should not have written anything
|
case, the command probably should not have written anything
|
||||||
to uiout, but in case it has written something, discard it. */
|
to uiout, but in case it has written something, discard it. */
|
||||||
mi_out_rewind (uiout);
|
mi_out_rewind (uiout);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1911,12 +1916,9 @@ captured_mi_execute_command (struct ui_out *uiout, struct mi_parse *context)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
do_cleanups (cleanup);
|
do_cleanups (cleanup);
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Print a gdb exception to the MI output stream. */
|
/* Print a gdb exception to the MI output stream. */
|
||||||
|
@ -2028,8 +2030,6 @@ mi_execute_command (char *cmd, int from_tty)
|
||||||
|
|
||||||
fputs_unfiltered ("(gdb) \n", raw_stdout);
|
fputs_unfiltered ("(gdb) \n", raw_stdout);
|
||||||
gdb_flush (raw_stdout);
|
gdb_flush (raw_stdout);
|
||||||
/* Print any buffered hook code. */
|
|
||||||
/* ..... */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -2061,9 +2061,10 @@ mi_cmd_execute (struct mi_parse *parse)
|
||||||
|
|
||||||
set_current_inferior (inf);
|
set_current_inferior (inf);
|
||||||
/* This behaviour means that if --thread-group option identifies
|
/* This behaviour means that if --thread-group option identifies
|
||||||
an inferior with multiple threads, then a random one will be picked.
|
an inferior with multiple threads, then a random one will be
|
||||||
This is not a problem -- frontend should always provide --thread if
|
picked. This is not a problem -- frontend should always
|
||||||
it wishes to operate on a specific thread. */
|
provide --thread if it wishes to operate on a specific
|
||||||
|
thread. */
|
||||||
if (inf->pid != 0)
|
if (inf->pid != 0)
|
||||||
tp = any_thread_of_process (inf->pid);
|
tp = any_thread_of_process (inf->pid);
|
||||||
switch_to_thread (tp ? tp->ptid : null_ptid);
|
switch_to_thread (tp ? tp->ptid : null_ptid);
|
||||||
|
@ -2154,7 +2155,7 @@ mi_execute_cli_command (const char *cmd, int args_p, const char *args)
|
||||||
fprintf_unfiltered (gdb_stdout, "cli=%s run=%s\n",
|
fprintf_unfiltered (gdb_stdout, "cli=%s run=%s\n",
|
||||||
cmd, run);
|
cmd, run);
|
||||||
old_cleanups = make_cleanup (xfree, run);
|
old_cleanups = make_cleanup (xfree, run);
|
||||||
execute_command ( /*ui */ run, 0 /*from_tty */ );
|
execute_command (run, 0 /* from_tty */ );
|
||||||
do_cleanups (old_cleanups);
|
do_cleanups (old_cleanups);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -2172,7 +2173,7 @@ mi_execute_async_cli_command (char *cli_command, char **argv, int argc)
|
||||||
run = xstrprintf ("%s %s", cli_command, argc ? *argv : "");
|
run = xstrprintf ("%s %s", cli_command, argc ? *argv : "");
|
||||||
old_cleanups = make_cleanup (xfree, run);
|
old_cleanups = make_cleanup (xfree, run);
|
||||||
|
|
||||||
execute_command ( /*ui */ run, 0 /*from_tty */ );
|
execute_command (run, 0 /* from_tty */ );
|
||||||
|
|
||||||
/* Do this before doing any printing. It would appear that some
|
/* Do this before doing any printing. It would appear that some
|
||||||
print code leaves garbage around in the buffer. */
|
print code leaves garbage around in the buffer. */
|
||||||
|
@ -2273,61 +2274,61 @@ mi_load_progress (const char *section_name,
|
||||||
|
|
||||||
static void
|
static void
|
||||||
timestamp (struct mi_timestamp *tv)
|
timestamp (struct mi_timestamp *tv)
|
||||||
{
|
{
|
||||||
gettimeofday (&tv->wallclock, NULL);
|
gettimeofday (&tv->wallclock, NULL);
|
||||||
#ifdef HAVE_GETRUSAGE
|
#ifdef HAVE_GETRUSAGE
|
||||||
getrusage (RUSAGE_SELF, &rusage);
|
getrusage (RUSAGE_SELF, &rusage);
|
||||||
tv->utime.tv_sec = rusage.ru_utime.tv_sec;
|
tv->utime.tv_sec = rusage.ru_utime.tv_sec;
|
||||||
tv->utime.tv_usec = rusage.ru_utime.tv_usec;
|
tv->utime.tv_usec = rusage.ru_utime.tv_usec;
|
||||||
tv->stime.tv_sec = rusage.ru_stime.tv_sec;
|
tv->stime.tv_sec = rusage.ru_stime.tv_sec;
|
||||||
tv->stime.tv_usec = rusage.ru_stime.tv_usec;
|
tv->stime.tv_usec = rusage.ru_stime.tv_usec;
|
||||||
#else
|
#else
|
||||||
{
|
{
|
||||||
long usec = get_run_time ();
|
long usec = get_run_time ();
|
||||||
|
|
||||||
tv->utime.tv_sec = usec/1000000L;
|
tv->utime.tv_sec = usec/1000000L;
|
||||||
tv->utime.tv_usec = usec - 1000000L*tv->utime.tv_sec;
|
tv->utime.tv_usec = usec - 1000000L*tv->utime.tv_sec;
|
||||||
tv->stime.tv_sec = 0;
|
tv->stime.tv_sec = 0;
|
||||||
tv->stime.tv_usec = 0;
|
tv->stime.tv_usec = 0;
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
print_diff_now (struct mi_timestamp *start)
|
print_diff_now (struct mi_timestamp *start)
|
||||||
{
|
{
|
||||||
struct mi_timestamp now;
|
struct mi_timestamp now;
|
||||||
|
|
||||||
timestamp (&now);
|
timestamp (&now);
|
||||||
print_diff (start, &now);
|
print_diff (start, &now);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
mi_print_timing_maybe (void)
|
mi_print_timing_maybe (void)
|
||||||
{
|
{
|
||||||
/* If the command is -enable-timing then do_timings may be
|
/* If the command is -enable-timing then do_timings may be true
|
||||||
true whilst current_command_ts is not initialized. */
|
whilst current_command_ts is not initialized. */
|
||||||
if (do_timings && current_command_ts)
|
if (do_timings && current_command_ts)
|
||||||
print_diff_now (current_command_ts);
|
print_diff_now (current_command_ts);
|
||||||
}
|
}
|
||||||
|
|
||||||
static long
|
static long
|
||||||
timeval_diff (struct timeval start, struct timeval end)
|
timeval_diff (struct timeval start, struct timeval end)
|
||||||
{
|
{
|
||||||
return ((end.tv_sec - start.tv_sec) * 1000000L)
|
return ((end.tv_sec - start.tv_sec) * 1000000L)
|
||||||
+ (end.tv_usec - start.tv_usec);
|
+ (end.tv_usec - start.tv_usec);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
print_diff (struct mi_timestamp *start, struct mi_timestamp *end)
|
print_diff (struct mi_timestamp *start, struct mi_timestamp *end)
|
||||||
{
|
{
|
||||||
fprintf_unfiltered
|
fprintf_unfiltered
|
||||||
(raw_stdout,
|
(raw_stdout,
|
||||||
",time={wallclock=\"%0.5f\",user=\"%0.5f\",system=\"%0.5f\"}",
|
",time={wallclock=\"%0.5f\",user=\"%0.5f\",system=\"%0.5f\"}",
|
||||||
timeval_diff (start->wallclock, end->wallclock) / 1000000.0,
|
timeval_diff (start->wallclock, end->wallclock) / 1000000.0,
|
||||||
timeval_diff (start->utime, end->utime) / 1000000.0,
|
timeval_diff (start->utime, end->utime) / 1000000.0,
|
||||||
timeval_diff (start->stime, end->stime) / 1000000.0);
|
timeval_diff (start->stime, end->stime) / 1000000.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
mi_cmd_trace_define_variable (char *command, char **argv, int argc)
|
mi_cmd_trace_define_variable (char *command, char **argv, int argc)
|
||||||
|
@ -2371,7 +2372,7 @@ void
|
||||||
mi_cmd_trace_list_variables (char *command, char **argv, int argc)
|
mi_cmd_trace_list_variables (char *command, char **argv, int argc)
|
||||||
{
|
{
|
||||||
if (argc != 0)
|
if (argc != 0)
|
||||||
error (_("-trace-list-variables: no arguments are allowed"));
|
error (_("-trace-list-variables: no arguments allowed"));
|
||||||
|
|
||||||
tvariables_info_1 ();
|
tvariables_info_1 ();
|
||||||
}
|
}
|
||||||
|
@ -2456,9 +2457,7 @@ mi_cmd_trace_find (char *command, char **argv, int argc)
|
||||||
error (_("Invalid mode '%s'"), mode);
|
error (_("Invalid mode '%s'"), mode);
|
||||||
|
|
||||||
if (has_stack_frames () || get_traceframe_number () >= 0)
|
if (has_stack_frames () || get_traceframe_number () >= 0)
|
||||||
{
|
print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC);
|
||||||
print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -2486,7 +2485,6 @@ mi_cmd_trace_save (char *command, char **argv, int argc)
|
||||||
trace_save (filename, target_saves);
|
trace_save (filename, target_saves);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
mi_cmd_trace_start (char *command, char **argv, int argc)
|
mi_cmd_trace_start (char *command, char **argv, int argc)
|
||||||
{
|
{
|
||||||
|
@ -2506,7 +2504,7 @@ mi_cmd_trace_stop (char *command, char **argv, int argc)
|
||||||
trace_status_mi (1);
|
trace_status_mi (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Implement the "-ada-task-info" GDB/MI command. */
|
/* Implement the "-ada-task-info" command. */
|
||||||
|
|
||||||
void
|
void
|
||||||
mi_cmd_ada_task_info (char *command, char **argv, int argc)
|
mi_cmd_ada_task_info (char *command, char **argv, int argc)
|
||||||
|
|
|
@ -100,7 +100,7 @@ static void mi_open (struct ui_out *uiout, const char *name,
|
||||||
enum ui_out_type type);
|
enum ui_out_type type);
|
||||||
static void mi_close (struct ui_out *uiout, enum ui_out_type type);
|
static void mi_close (struct ui_out *uiout, enum ui_out_type type);
|
||||||
|
|
||||||
/* Mark beginning of a table */
|
/* Mark beginning of a table. */
|
||||||
|
|
||||||
void
|
void
|
||||||
mi_table_begin (struct ui_out *uiout,
|
mi_table_begin (struct ui_out *uiout,
|
||||||
|
@ -109,14 +109,12 @@ mi_table_begin (struct ui_out *uiout,
|
||||||
const char *tblid)
|
const char *tblid)
|
||||||
{
|
{
|
||||||
mi_open (uiout, tblid, ui_out_type_tuple);
|
mi_open (uiout, tblid, ui_out_type_tuple);
|
||||||
mi_field_int (uiout, -1/*fldno*/, -1/*width*/, -1/*alin*/,
|
mi_field_int (uiout, -1, -1, -1, "nr_rows", nr_rows);
|
||||||
"nr_rows", nr_rows);
|
mi_field_int (uiout, -1, -1, -1, "nr_cols", nr_cols);
|
||||||
mi_field_int (uiout, -1/*fldno*/, -1/*width*/, -1/*alin*/,
|
|
||||||
"nr_cols", nr_cols);
|
|
||||||
mi_open (uiout, "hdr", ui_out_type_list);
|
mi_open (uiout, "hdr", ui_out_type_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Mark beginning of a table body */
|
/* Mark beginning of a table body. */
|
||||||
|
|
||||||
void
|
void
|
||||||
mi_table_body (struct ui_out *uiout)
|
mi_table_body (struct ui_out *uiout)
|
||||||
|
@ -130,7 +128,7 @@ mi_table_body (struct ui_out *uiout)
|
||||||
mi_open (uiout, "body", ui_out_type_list);
|
mi_open (uiout, "body", ui_out_type_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Mark end of a table */
|
/* Mark end of a table. */
|
||||||
|
|
||||||
void
|
void
|
||||||
mi_table_end (struct ui_out *uiout)
|
mi_table_end (struct ui_out *uiout)
|
||||||
|
@ -142,17 +140,17 @@ mi_table_end (struct ui_out *uiout)
|
||||||
mi_close (uiout, ui_out_type_tuple);
|
mi_close (uiout, ui_out_type_tuple);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Specify table header */
|
/* Specify table header. */
|
||||||
|
|
||||||
void
|
void
|
||||||
mi_table_header (struct ui_out *uiout, int width, enum ui_align alignment,
|
mi_table_header (struct ui_out *uiout, int width, enum ui_align alignment,
|
||||||
const char *col_name,
|
const char *col_name, const char *colhdr)
|
||||||
const char *colhdr)
|
|
||||||
{
|
{
|
||||||
mi_out_data *data = ui_out_data (uiout);
|
mi_out_data *data = ui_out_data (uiout);
|
||||||
|
|
||||||
if (data->suppress_output)
|
if (data->suppress_output)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mi_open (uiout, NULL, ui_out_type_tuple);
|
mi_open (uiout, NULL, ui_out_type_tuple);
|
||||||
mi_field_int (uiout, 0, 0, 0, "width", width);
|
mi_field_int (uiout, 0, 0, 0, "width", width);
|
||||||
mi_field_int (uiout, 0, 0, 0, "alignment", alignment);
|
mi_field_int (uiout, 0, 0, 0, "alignment", alignment);
|
||||||
|
@ -161,38 +159,36 @@ mi_table_header (struct ui_out *uiout, int width, enum ui_align alignment,
|
||||||
mi_close (uiout, ui_out_type_tuple);
|
mi_close (uiout, ui_out_type_tuple);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Mark beginning of a list */
|
/* Mark beginning of a list. */
|
||||||
|
|
||||||
void
|
void
|
||||||
mi_begin (struct ui_out *uiout,
|
mi_begin (struct ui_out *uiout, enum ui_out_type type, int level,
|
||||||
enum ui_out_type type,
|
|
||||||
int level,
|
|
||||||
const char *id)
|
const char *id)
|
||||||
{
|
{
|
||||||
mi_out_data *data = ui_out_data (uiout);
|
mi_out_data *data = ui_out_data (uiout);
|
||||||
|
|
||||||
if (data->suppress_output)
|
if (data->suppress_output)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mi_open (uiout, id, type);
|
mi_open (uiout, id, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Mark end of a list */
|
/* Mark end of a list. */
|
||||||
|
|
||||||
void
|
void
|
||||||
mi_end (struct ui_out *uiout,
|
mi_end (struct ui_out *uiout, enum ui_out_type type, int level)
|
||||||
enum ui_out_type type,
|
|
||||||
int level)
|
|
||||||
{
|
{
|
||||||
mi_out_data *data = ui_out_data (uiout);
|
mi_out_data *data = ui_out_data (uiout);
|
||||||
|
|
||||||
if (data->suppress_output)
|
if (data->suppress_output)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mi_close (uiout, type);
|
mi_close (uiout, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* output an int field */
|
/* Output an int field. */
|
||||||
|
|
||||||
void
|
static void
|
||||||
mi_field_int (struct ui_out *uiout, int fldno, int width,
|
mi_field_int (struct ui_out *uiout, int fldno, int width,
|
||||||
enum ui_align alignment, const char *fldname, int value)
|
enum ui_align alignment, const char *fldname, int value)
|
||||||
{
|
{
|
||||||
|
@ -206,7 +202,7 @@ mi_field_int (struct ui_out *uiout, int fldno, int width,
|
||||||
mi_field_string (uiout, fldno, width, alignment, fldname, buffer);
|
mi_field_string (uiout, fldno, width, alignment, fldname, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* used to ommit a field */
|
/* Used to omit a field. */
|
||||||
|
|
||||||
void
|
void
|
||||||
mi_field_skip (struct ui_out *uiout, int fldno, int width,
|
mi_field_skip (struct ui_out *uiout, int fldno, int width,
|
||||||
|
@ -214,21 +210,18 @@ mi_field_skip (struct ui_out *uiout, int fldno, int width,
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/* other specific mi_field_* end up here so alignment and field
|
/* Other specific mi_field_* end up here so alignment and field
|
||||||
separators are both handled by mi_field_string */
|
separators are both handled by mi_field_string. */
|
||||||
|
|
||||||
void
|
void
|
||||||
mi_field_string (struct ui_out *uiout,
|
mi_field_string (struct ui_out *uiout, int fldno, int width,
|
||||||
int fldno,
|
enum ui_align align, const char *fldname, const char *string)
|
||||||
int width,
|
|
||||||
enum ui_align align,
|
|
||||||
const char *fldname,
|
|
||||||
const char *string)
|
|
||||||
{
|
{
|
||||||
mi_out_data *data = ui_out_data (uiout);
|
mi_out_data *data = ui_out_data (uiout);
|
||||||
|
|
||||||
if (data->suppress_output)
|
if (data->suppress_output)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
field_separator (uiout);
|
field_separator (uiout);
|
||||||
if (fldname)
|
if (fldname)
|
||||||
fprintf_unfiltered (data->buffer, "%s=", fldname);
|
fprintf_unfiltered (data->buffer, "%s=", fldname);
|
||||||
|
@ -238,19 +231,18 @@ mi_field_string (struct ui_out *uiout,
|
||||||
fprintf_unfiltered (data->buffer, "\"");
|
fprintf_unfiltered (data->buffer, "\"");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This is the only field function that does not align */
|
/* This is the only field function that does not align. */
|
||||||
|
|
||||||
void
|
void
|
||||||
mi_field_fmt (struct ui_out *uiout, int fldno,
|
mi_field_fmt (struct ui_out *uiout, int fldno, int width,
|
||||||
int width, enum ui_align align,
|
enum ui_align align, const char *fldname,
|
||||||
const char *fldname,
|
const char *format, va_list args)
|
||||||
const char *format,
|
|
||||||
va_list args)
|
|
||||||
{
|
{
|
||||||
mi_out_data *data = ui_out_data (uiout);
|
mi_out_data *data = ui_out_data (uiout);
|
||||||
|
|
||||||
if (data->suppress_output)
|
if (data->suppress_output)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
field_separator (uiout);
|
field_separator (uiout);
|
||||||
if (fldname)
|
if (fldname)
|
||||||
fprintf_unfiltered (data->buffer, "%s=\"", fldname);
|
fprintf_unfiltered (data->buffer, "%s=\"", fldname);
|
||||||
|
@ -272,8 +264,7 @@ mi_text (struct ui_out *uiout, const char *string)
|
||||||
|
|
||||||
void
|
void
|
||||||
mi_message (struct ui_out *uiout, int verbosity,
|
mi_message (struct ui_out *uiout, int verbosity,
|
||||||
const char *format,
|
const char *format, va_list args)
|
||||||
va_list args)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -326,9 +317,7 @@ field_separator (struct ui_out *uiout)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
mi_open (struct ui_out *uiout,
|
mi_open (struct ui_out *uiout, const char *name, enum ui_out_type type)
|
||||||
const char *name,
|
|
||||||
enum ui_out_type type)
|
|
||||||
{
|
{
|
||||||
mi_out_data *data = ui_out_data (uiout);
|
mi_out_data *data = ui_out_data (uiout);
|
||||||
|
|
||||||
|
@ -350,8 +339,7 @@ mi_open (struct ui_out *uiout,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
mi_close (struct ui_out *uiout,
|
mi_close (struct ui_out *uiout, enum ui_out_type type)
|
||||||
enum ui_out_type type)
|
|
||||||
{
|
{
|
||||||
mi_out_data *data = ui_out_data (uiout);
|
mi_out_data *data = ui_out_data (uiout);
|
||||||
|
|
||||||
|
@ -369,7 +357,7 @@ mi_close (struct ui_out *uiout,
|
||||||
data->suppress_field_separator = 0;
|
data->suppress_field_separator = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* add a string to the buffer */
|
/* Add a string to the buffer. */
|
||||||
|
|
||||||
void
|
void
|
||||||
mi_out_buffered (struct ui_out *uiout, char *string)
|
mi_out_buffered (struct ui_out *uiout, char *string)
|
||||||
|
@ -379,7 +367,7 @@ mi_out_buffered (struct ui_out *uiout, char *string)
|
||||||
fprintf_unfiltered (data->buffer, "%s", string);
|
fprintf_unfiltered (data->buffer, "%s", string);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* clear the buffer */
|
/* Clear the buffer. */
|
||||||
|
|
||||||
void
|
void
|
||||||
mi_out_rewind (struct ui_out *uiout)
|
mi_out_rewind (struct ui_out *uiout)
|
||||||
|
@ -389,7 +377,7 @@ mi_out_rewind (struct ui_out *uiout)
|
||||||
ui_file_rewind (data->buffer);
|
ui_file_rewind (data->buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* dump the buffer onto the specified stream */
|
/* Dump the buffer onto the specified stream. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
do_write (void *data, const char *buffer, long length_buffer)
|
do_write (void *data, const char *buffer, long length_buffer)
|
||||||
|
@ -398,8 +386,7 @@ do_write (void *data, const char *buffer, long length_buffer)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
mi_out_put (struct ui_out *uiout,
|
mi_out_put (struct ui_out *uiout, struct ui_file *stream)
|
||||||
struct ui_file *stream)
|
|
||||||
{
|
{
|
||||||
mi_out_data *data = ui_out_data (uiout);
|
mi_out_data *data = ui_out_data (uiout);
|
||||||
|
|
||||||
|
@ -407,7 +394,7 @@ mi_out_put (struct ui_out *uiout,
|
||||||
ui_file_rewind (data->buffer);
|
ui_file_rewind (data->buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Current MI version. */
|
/* Return the current MI version. */
|
||||||
|
|
||||||
int
|
int
|
||||||
mi_version (struct ui_out *uiout)
|
mi_version (struct ui_out *uiout)
|
||||||
|
@ -417,7 +404,7 @@ mi_version (struct ui_out *uiout)
|
||||||
return data->mi_version;
|
return data->mi_version;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* initalize private members at startup */
|
/* Initialize private members at startup. */
|
||||||
|
|
||||||
struct ui_out *
|
struct ui_out *
|
||||||
mi_out_new (int mi_version)
|
mi_out_new (int mi_version)
|
||||||
|
@ -433,10 +420,3 @@ mi_out_new (int mi_version)
|
||||||
data->buffer = mem_fileopen ();
|
data->buffer = mem_fileopen ();
|
||||||
return ui_out_new (&mi_ui_out_impl, data, flags);
|
return ui_out_new (&mi_ui_out_impl, data, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* standard gdb initialization hook */
|
|
||||||
void
|
|
||||||
_initialize_mi_out (void)
|
|
||||||
{
|
|
||||||
/* nothing happens here */
|
|
||||||
}
|
|
||||||
|
|
|
@ -113,7 +113,7 @@ mi_parse_argv (char *args, struct mi_parse *parse)
|
||||||
{
|
{
|
||||||
char *arg;
|
char *arg;
|
||||||
|
|
||||||
/* skip leading white space */
|
/* Skip leading white space. */
|
||||||
while (isspace (*chp))
|
while (isspace (*chp))
|
||||||
chp++;
|
chp++;
|
||||||
/* Three possibilities: EOF, quoted string, or other text. */
|
/* Three possibilities: EOF, quoted string, or other text. */
|
||||||
|
@ -125,11 +125,11 @@ mi_parse_argv (char *args, struct mi_parse *parse)
|
||||||
return;
|
return;
|
||||||
case '"':
|
case '"':
|
||||||
{
|
{
|
||||||
/* A quoted string. */
|
/* A quoted string. */
|
||||||
int len;
|
int len;
|
||||||
char *start = chp + 1;
|
char *start = chp + 1;
|
||||||
|
|
||||||
/* Determine the buffer size. */
|
/* Determine the buffer size. */
|
||||||
chp = start;
|
chp = start;
|
||||||
len = 0;
|
len = 0;
|
||||||
while (*chp != '\0' && *chp != '"')
|
while (*chp != '\0' && *chp != '"')
|
||||||
|
@ -139,7 +139,7 @@ mi_parse_argv (char *args, struct mi_parse *parse)
|
||||||
chp++;
|
chp++;
|
||||||
if (mi_parse_escape (&chp) <= 0)
|
if (mi_parse_escape (&chp) <= 0)
|
||||||
{
|
{
|
||||||
/* Do not allow split lines or "\000" */
|
/* Do not allow split lines or "\000". */
|
||||||
freeargv (argv);
|
freeargv (argv);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -148,21 +148,20 @@ mi_parse_argv (char *args, struct mi_parse *parse)
|
||||||
chp++;
|
chp++;
|
||||||
len++;
|
len++;
|
||||||
}
|
}
|
||||||
/* Insist on a closing quote. */
|
/* Insist on a closing quote. */
|
||||||
if (*chp != '"')
|
if (*chp != '"')
|
||||||
{
|
{
|
||||||
freeargv (argv);
|
freeargv (argv);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* Insist on trailing white space. */
|
/* Insist on trailing white space. */
|
||||||
if (chp[1] != '\0' && !isspace (chp[1]))
|
if (chp[1] != '\0' && !isspace (chp[1]))
|
||||||
{
|
{
|
||||||
freeargv (argv);
|
freeargv (argv);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* create the buffer. */
|
/* Create the buffer and copy characters in. */
|
||||||
arg = xmalloc ((len + 1) * sizeof (char));
|
arg = xmalloc ((len + 1) * sizeof (char));
|
||||||
/* And copy the characters in. */
|
|
||||||
chp = start;
|
chp = start;
|
||||||
len = 0;
|
len = 0;
|
||||||
while (*chp != '\0' && *chp != '"')
|
while (*chp != '\0' && *chp != '"')
|
||||||
|
@ -177,13 +176,13 @@ mi_parse_argv (char *args, struct mi_parse *parse)
|
||||||
len++;
|
len++;
|
||||||
}
|
}
|
||||||
arg[len] = '\0';
|
arg[len] = '\0';
|
||||||
chp++; /* that closing quote. */
|
chp++; /* That closing quote. */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
/* An unquoted string. Accumulate all non blank
|
/* An unquoted string. Accumulate all non-blank
|
||||||
characters into a buffer. */
|
characters into a buffer. */
|
||||||
int len;
|
int len;
|
||||||
char *start = chp;
|
char *start = chp;
|
||||||
|
|
||||||
|
@ -198,14 +197,13 @@ mi_parse_argv (char *args, struct mi_parse *parse)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Append arg to argv. */
|
/* Append arg to argv. */
|
||||||
argv = xrealloc (argv, (argc + 2) * sizeof (char *));
|
argv = xrealloc (argv, (argc + 2) * sizeof (char *));
|
||||||
argv[argc++] = arg;
|
argv[argc++] = arg;
|
||||||
argv[argc] = NULL;
|
argv[argc] = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
mi_parse_free (struct mi_parse *parse)
|
mi_parse_free (struct mi_parse *parse)
|
||||||
{
|
{
|
||||||
|
@ -245,18 +243,18 @@ mi_parse (char *cmd, char **token)
|
||||||
|
|
||||||
cleanup = make_cleanup (mi_parse_cleanup, parse);
|
cleanup = make_cleanup (mi_parse_cleanup, parse);
|
||||||
|
|
||||||
/* Before starting, skip leading white space. */
|
/* Before starting, skip leading white space. */
|
||||||
while (isspace (*cmd))
|
while (isspace (*cmd))
|
||||||
cmd++;
|
cmd++;
|
||||||
|
|
||||||
/* Find/skip any token and then extract it. */
|
/* Find/skip any token and then extract it. */
|
||||||
for (chp = cmd; *chp >= '0' && *chp <= '9'; chp++)
|
for (chp = cmd; *chp >= '0' && *chp <= '9'; chp++)
|
||||||
;
|
;
|
||||||
*token = xmalloc (chp - cmd + 1);
|
*token = xmalloc (chp - cmd + 1);
|
||||||
memcpy (*token, cmd, (chp - cmd));
|
memcpy (*token, cmd, (chp - cmd));
|
||||||
(*token)[chp - cmd] = '\0';
|
(*token)[chp - cmd] = '\0';
|
||||||
|
|
||||||
/* This wasn't a real MI command. Return it as a CLI_COMMAND. */
|
/* This wasn't a real MI command. Return it as a CLI_COMMAND. */
|
||||||
if (*chp != '-')
|
if (*chp != '-')
|
||||||
{
|
{
|
||||||
while (isspace (*chp))
|
while (isspace (*chp))
|
||||||
|
@ -269,7 +267,7 @@ mi_parse (char *cmd, char **token)
|
||||||
return parse;
|
return parse;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Extract the command. */
|
/* Extract the command. */
|
||||||
{
|
{
|
||||||
char *tmp = chp + 1; /* discard ``-'' */
|
char *tmp = chp + 1; /* discard ``-'' */
|
||||||
|
|
||||||
|
@ -280,20 +278,20 @@ mi_parse (char *cmd, char **token)
|
||||||
parse->command[chp - tmp] = '\0';
|
parse->command[chp - tmp] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Find the command in the MI table. */
|
/* Find the command in the MI table. */
|
||||||
parse->cmd = mi_lookup (parse->command);
|
parse->cmd = mi_lookup (parse->command);
|
||||||
if (parse->cmd == NULL)
|
if (parse->cmd == NULL)
|
||||||
error (_("Undefined MI command: %s"), parse->command);
|
error (_("Undefined MI command: %s"), parse->command);
|
||||||
|
|
||||||
/* Skip white space following the command. */
|
/* Skip white space following the command. */
|
||||||
while (isspace (*chp))
|
while (isspace (*chp))
|
||||||
chp++;
|
chp++;
|
||||||
|
|
||||||
/* Parse the --thread and --frame options, if present. At present,
|
/* Parse the --thread and --frame options, if present. At present,
|
||||||
some important commands, like '-break-*' are implemented by forwarding
|
some important commands, like '-break-*' are implemented by
|
||||||
to the CLI layer directly. We want to parse --thread and --frame
|
forwarding to the CLI layer directly. We want to parse --thread
|
||||||
here, so as not to leave those option in the string that will be passed
|
and --frame here, so as not to leave those option in the string
|
||||||
to CLI. */
|
that will be passed to CLI. */
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
const char *option;
|
const char *option;
|
||||||
|
@ -350,7 +348,7 @@ mi_parse (char *cmd, char **token)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* For new argv commands, attempt to return the parsed argument
|
/* For new argv commands, attempt to return the parsed argument
|
||||||
list. */
|
list. */
|
||||||
if (parse->cmd->argv_func != NULL)
|
if (parse->cmd->argv_func != NULL)
|
||||||
{
|
{
|
||||||
mi_parse_argv (chp, parse);
|
mi_parse_argv (chp, parse);
|
||||||
|
@ -366,7 +364,7 @@ mi_parse (char *cmd, char **token)
|
||||||
|
|
||||||
discard_cleanups (cleanup);
|
discard_cleanups (cleanup);
|
||||||
|
|
||||||
/* Fully parsed. */
|
/* Fully parsed, flag as an MI command. */
|
||||||
parse->op = MI_COMMAND;
|
parse->op = MI_COMMAND;
|
||||||
return parse;
|
return parse;
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,7 @@ struct mi_parse
|
||||||
|
|
||||||
extern struct mi_parse *mi_parse (char *cmd, char **token);
|
extern struct mi_parse *mi_parse (char *cmd, char **token);
|
||||||
|
|
||||||
/* Free a command returned by mi_parse_command. */
|
/* Free a command returned by mi_parse_command. */
|
||||||
|
|
||||||
extern void mi_parse_free (struct mi_parse *cmd);
|
extern void mi_parse_free (struct mi_parse *cmd);
|
||||||
|
|
||||||
|
|
|
@ -22,11 +22,9 @@
|
||||||
#include "objfiles.h"
|
#include "objfiles.h"
|
||||||
#include "ui-out.h"
|
#include "ui-out.h"
|
||||||
|
|
||||||
/* SYMBOL-LIST-LINES:
|
/* Print the list of all pc addresses and lines of code for the
|
||||||
|
provided (full or base) source file name. The entries are sorted
|
||||||
Print the list of all pc addresses and lines of code for
|
in ascending PC order. */
|
||||||
the provided (full or base) source file name. The entries
|
|
||||||
are sorted in ascending PC order. */
|
|
||||||
|
|
||||||
void
|
void
|
||||||
mi_cmd_symbol_list_lines (char *command, char **argv, int argc)
|
mi_cmd_symbol_list_lines (char *command, char **argv, int argc)
|
||||||
|
@ -47,9 +45,9 @@ mi_cmd_symbol_list_lines (char *command, char **argv, int argc)
|
||||||
if (s == NULL)
|
if (s == NULL)
|
||||||
error (_("-symbol-list-lines: Unknown source file name."));
|
error (_("-symbol-list-lines: Unknown source file name."));
|
||||||
|
|
||||||
/* Now, dump the associated line table. The pc addresses are already
|
/* Now, dump the associated line table. The pc addresses are
|
||||||
sorted by increasing values in the symbol table, so no need to
|
already sorted by increasing values in the symbol table, so no
|
||||||
perform any other sorting. */
|
need to perform any other sorting. */
|
||||||
|
|
||||||
gdbarch = get_objfile_arch (s->objfile);
|
gdbarch = get_objfile_arch (s->objfile);
|
||||||
cleanup_stack = make_cleanup_ui_out_list_begin_end (uiout, "lines");
|
cleanup_stack = make_cleanup_ui_out_list_begin_end (uiout, "lines");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue