2003-02-05 Jim Ingham <jingham@apple.com>
Keith Seitz <keiths@redhat.com>
Elena Zannoni <ezannoni@redhat.com>
Andrew Cagney <ac131313@redhat.com>
* Makefile.in (SUBDIR_CLI_OBS): Add "cli-interp.o".
(SUBDIR_CLI_SRCS): Add "cli/cli-interp.c".
(SUBDIR_MI_OBS): Add "mi-interp.o".
(SUBDIR_MI_SRCS): Add "mi/mi-interp.c".
(SFILES): Add "interps.c".
(COMMON_OBS): Add "interps.o".
(interps_h, mi_main_h): Define.
(interps.o, cli-interp.o, mi-interp.o): Add dependencies.
(mi-main.o, main.o, event-top.o): Update dependencies.
* cli/cli-interp.c: New file.
* interps.h, interps.c: New files.
* top.c: (gdb_init): Don't install the default interpreter, handed
by captured_main.
* main.c: Include "interps.h".
(interpreter_p): Note that it should malloc'ed.
(captured_command_loop): Call current_interp_command_loop.
(captured_main): Initialize interpreter_p to INTERP_CONSOLE. Use
xfree and xstrdup when updating interpreter_p. Install the
default interpreter. Add hack to stop mi1's copyright notice
being encoded.
* event-top.h (gdb_setup_readline): Declare.
(gdb_disable_readline): Declare.
* event-top.c: Include "interps.h".
(display_gdb_prompt): Call current_interp_display_prompt_p.
(gdb_setup_readline): Initialize gdb_stdout, gdb_stderr,
gdb_stdlog, and gdb_stdtarg.
(_initialize_event_loop): Don't call gdb_setup_readline.
* cli-out.c (cli_out_set_stream): New function.
* cli-out.h (cli_out_set_stream): Declare.
2003-02-06 01:19:12 +00:00
|
|
|
/* MI Command Set for GDB, the GNU debugger.
|
|
|
|
|
2012-01-04 08:17:56 +00:00
|
|
|
Copyright (C) 2000-2001, 2003, 2007-2012 Free Software Foundation,
|
|
|
|
Inc.
|
2003-02-05 Jim Ingham <jingham@apple.com>
Keith Seitz <keiths@redhat.com>
Elena Zannoni <ezannoni@redhat.com>
Andrew Cagney <ac131313@redhat.com>
* Makefile.in (SUBDIR_CLI_OBS): Add "cli-interp.o".
(SUBDIR_CLI_SRCS): Add "cli/cli-interp.c".
(SUBDIR_MI_OBS): Add "mi-interp.o".
(SUBDIR_MI_SRCS): Add "mi/mi-interp.c".
(SFILES): Add "interps.c".
(COMMON_OBS): Add "interps.o".
(interps_h, mi_main_h): Define.
(interps.o, cli-interp.o, mi-interp.o): Add dependencies.
(mi-main.o, main.o, event-top.o): Update dependencies.
* cli/cli-interp.c: New file.
* interps.h, interps.c: New files.
* top.c: (gdb_init): Don't install the default interpreter, handed
by captured_main.
* main.c: Include "interps.h".
(interpreter_p): Note that it should malloc'ed.
(captured_command_loop): Call current_interp_command_loop.
(captured_main): Initialize interpreter_p to INTERP_CONSOLE. Use
xfree and xstrdup when updating interpreter_p. Install the
default interpreter. Add hack to stop mi1's copyright notice
being encoded.
* event-top.h (gdb_setup_readline): Declare.
(gdb_disable_readline): Declare.
* event-top.c: Include "interps.h".
(display_gdb_prompt): Call current_interp_display_prompt_p.
(gdb_setup_readline): Initialize gdb_stdout, gdb_stderr,
gdb_stdlog, and gdb_stdtarg.
(_initialize_event_loop): Don't call gdb_setup_readline.
* cli-out.c (cli_out_set_stream): New function.
* cli-out.h (cli_out_set_stream): Declare.
2003-02-06 01:19:12 +00:00
|
|
|
|
2000-02-23 06:19:22 +00:00
|
|
|
Contributed by Cygnus Solutions (a Red Hat company).
|
2000-02-23 00:25:43 +00:00
|
|
|
|
|
|
|
This file is part of GDB.
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
2007-08-23 18:08:50 +00:00
|
|
|
the Free Software Foundation; either version 3 of the License, or
|
2000-02-23 00:25:43 +00:00
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
2007-08-23 18:08:50 +00:00
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
2000-02-23 00:25:43 +00:00
|
|
|
|
|
|
|
#include "defs.h"
|
|
|
|
#include "top.h"
|
|
|
|
#include "mi-cmds.h"
|
2001-01-31 15:46:36 +00:00
|
|
|
#include "gdb_string.h"
|
2000-02-23 00:25:43 +00:00
|
|
|
|
|
|
|
extern void _initialize_mi_cmds (void);
|
|
|
|
struct mi_cmd;
|
|
|
|
static struct mi_cmd **lookup_table (const char *command);
|
|
|
|
static void build_table (struct mi_cmd *commands);
|
|
|
|
|
|
|
|
|
|
|
|
struct mi_cmd mi_cmds[] =
|
|
|
|
{
|
2011-10-03 21:38:31 +00:00
|
|
|
{ "ada-task-info", { NULL, 0 }, mi_cmd_ada_task_info },
|
Multiexec MI
* breakpoint.c (clear_syscall_counts): Take struct inferior*.
* inferior.c (add_inferior_silent): Notify inferior_added
observer.
(delete_inferior_1): Notify inferior_removed observer.
(exit_inferior_1): Pass inferior, not pid, to observer.
(inferior_appeared): Likewise.
(add_inferior_with_spaces): New.
(add_inferior_command): Use the above.
* inferior.h (delete_inferior_1, add_inferior_with_spaces):
Declare.
* inflow.c (inflow_inferior_exit): Likewise.
* jit.c (jit_inferior_exit_hook): Likewise.
* mi/mi-cmds.c (mi_cmds): Register add-inferior and
remove-inferior.
* mi/mi-cmds.h (mi_cmd_add_inferior, mi_cmd_remove_inferior): New.
* mi/mi-interp.c (mi_inferior_added, mi_inferior_removed): New.
(report_initial_inferior): New.
(mi_inferior_removed): Register the above. Make sure
inferior_added observer is called on the first inferior.
(mi_new_thread, mi_thread_exit): Thread group is now identified by
inferior number, not pid.
(mi_solib_loaded, mi_solib_unloaded): Report which inferiors are
affected.
* mi/mi-main.c (current_context): New.
(proceed_thread_callback): Use typed closure.
Proceed everything if pid is 0. Most implementation split into
(proceed_thread): ... this.
(run_one_inferior): New.
(mi_cmd_exec_continue, mi_cmd_exec_interrupt, mi_cmd_exec_run):
Adjust for multiexec behaviour.
(mi_cmd_add_inferior, mi_cmd_remove_inferior): New.
(mi_cmd_execute): Handle the 'thread-group' option here.
Do some extra checks.
* mi-parse.c (mi_parse): Handle the --all and --thread-group
options.
* mi-parse.h (struct mi_parse): New fields all and thread_group.
2010-02-24 07:51:46 +00:00
|
|
|
{ "add-inferior", { NULL, 0 }, mi_cmd_add_inferior },
|
2008-04-24 13:28:06 +00:00
|
|
|
{ "break-after", { "ignore", 1 }, NULL },
|
|
|
|
{ "break-condition", { "cond", 1 }, NULL },
|
2009-08-03 12:39:01 +00:00
|
|
|
{ "break-commands", { NULL, 0 }, mi_cmd_break_commands },
|
2008-04-24 13:28:06 +00:00
|
|
|
{ "break-delete", { "delete breakpoint", 1 }, NULL },
|
|
|
|
{ "break-disable", { "disable breakpoint", 1 }, NULL },
|
|
|
|
{ "break-enable", { "enable breakpoint", 1 }, NULL },
|
|
|
|
{ "break-info", { "info break", 1 }, NULL },
|
|
|
|
{ "break-insert", { NULL, 0 }, mi_cmd_break_insert},
|
|
|
|
{ "break-list", { "info break", }, NULL },
|
2010-03-23 21:48:14 +00:00
|
|
|
{ "break-passcount", { NULL, 0 }, mi_cmd_break_passcount},
|
2008-04-24 13:28:06 +00:00
|
|
|
{ "break-watch", { NULL, 0 }, mi_cmd_break_watch},
|
|
|
|
{ "data-disassemble", { NULL, 0 }, mi_cmd_disassemble},
|
|
|
|
{ "data-evaluate-expression", { NULL, 0 }, mi_cmd_data_evaluate_expression},
|
2011-01-06 00:57:05 +00:00
|
|
|
{ "data-list-changed-registers", { NULL, 0 },
|
|
|
|
mi_cmd_data_list_changed_registers},
|
2008-04-24 13:28:06 +00:00
|
|
|
{ "data-list-register-names", { NULL, 0 }, mi_cmd_data_list_register_names},
|
2011-01-06 00:57:05 +00:00
|
|
|
{ "data-list-register-values", { NULL, 0 },
|
|
|
|
mi_cmd_data_list_register_values},
|
2008-04-24 13:28:06 +00:00
|
|
|
{ "data-read-memory", { NULL, 0 }, mi_cmd_data_read_memory},
|
2010-08-13 13:22:44 +00:00
|
|
|
{ "data-read-memory-bytes", { NULL, 0 }, mi_cmd_data_read_memory_bytes},
|
2008-04-24 13:28:06 +00:00
|
|
|
{ "data-write-memory", { NULL, 0 }, mi_cmd_data_write_memory},
|
2010-08-13 13:22:44 +00:00
|
|
|
{ "data-write-memory-bytes", {NULL, 0}, mi_cmd_data_write_memory_bytes},
|
2011-01-06 00:57:05 +00:00
|
|
|
{ "data-write-register-values", { NULL, 0 },
|
|
|
|
mi_cmd_data_write_register_values},
|
2008-04-24 13:28:06 +00:00
|
|
|
{ "enable-timings", { NULL, 0 }, mi_cmd_enable_timings},
|
gdb
* varobj.h (varobj_update_result_t) <new>: New field.
(varobj_get_child_range, varobj_set_child_range): Declare.
(varobj_list_children): Update.
(varobj_enable_pretty_printing, varobj_has_more)
(varobj_pretty_printed_p): Declare.
* varobj.c (pretty_printing): New global.
(varobj_enable_pretty_printing): New function.
(struct varobj_root) <from, to, constructor, child_iter,
saved_item>: New fields.
(varobj_create): Don't call install_default_visualizer.
(instantiate_pretty_printer): Don't use value_copy.
(varobj_has_more): New function.
(restrict_range): New function.
(install_dynamic_child): Likewise.
(dynamic_varobj_has_child_method): Likewise.
(update_dynamic_varobj_children): Remove 'new_and_unchanged'
argument; add 'new', 'unchanged', 'from', and 'to' arguments.
Rewrite.
(varobj_get_num_children): Call update_dynamic_varobj_children.
(varobj_list_children): Add 'from' and 'to' arguments. Ignore
result of update_dynamic_varobj_children. Don't call
install_default_visualizer. Restrict result range.
(varobj_add_child): Don't call install_default_visualizer.
(varobj_pretty_printed_p): New function.
(install_visualizer): Rewrite. Move earlier in file.
(install_default_visualizer): Likewise.
(construct_visualizer): New function.
(install_new_value_visualizer): Likewise.
(install_new_value): Don't call release_value. Special case
pretty-printed objects. Use value_incref. Rearrange "changed"
logic.
(varobj_get_child_range): New function.
(varobj_set_child_range): Likewise.
(varobj_set_visualizer): Rewrite.
(varobj_update): Rewrite pretty-printing logic.
(new_variable): Initialize new fields.
(free_variable): Destroy new fields.
(value_of_root): Copy 'from' and 'to'.
(my_value_of_variable): Handle pretty-printers.
(value_get_print_value): Rework pretty-printing logic.
(cplus_describe_child): Don't use release_value.
* mi/mi-cmds.h (mi_cmd_enable_pretty_printing)
(mi_cmd_var_set_update_range): Declare.
* mi/mi-cmds.c (mi_cmds): Add enable-pretty-printing and
var-set-update-range.
* mi/mi-cmd-var.c (print_varobj): Update. Emit "dynamic"
attribute.
(mi_cmd_var_create): Emit "has_more" attribute.
(mi_cmd_var_set_format): Plug memory leak.
(mi_print_value_p): Replace 'type' argument with 'var'. Handle
pretty-printed varobjs.
(mi_cmd_var_list_children): Accept 'from' and 'to' arguments.
Emit "has_more" attribute.
(mi_cmd_var_evaluate_expression): Plug memory leak.
(mi_cmd_var_assign): Likewise.
(varobj_update_one): Likewise. Emit "dynamic", "has_more", and
"new_children" attributes.
(mi_cmd_enable_pretty_printing): New function.
(mi_cmd_var_set_update_range): Likewise.
gdb/doc
* gdb.texinfo (GDB/MI Variable Objects): Document
-enable-pretty-printing, -var-set-update-range, dynamic varobjs.
Expand -var-update documentation.
gdb/testsuite
* lib/mi-support.exp (mi_create_varobj): Update.
(mi_create_floating_varobj): Likewise.
(mi_create_dynamic_varobj): New proc.
(mi_varobj_update): Update.
(mi_varobj_update_with_type_change): Likewise.
(mi_varobj_update_kv_helper): New proc.
(mi_varobj_update_dynamic_helper): Rewrite.
(mi_varobj_update_dynamic): New proc.
(mi_list_varobj_children): Update.
(mi_list_varobj_children_range): Add 'from' and 'to' arguments.
* gdb.python/python-prettyprint.py (pp_outer): New class.
(pp_nullstr): Likewise.
(lookup_function): Register new printers.
* gdb.python/python-prettyprint.c (struct substruct): New type.
(struct outerstruct): Likewise.
(substruct_test): New function.
(struct nullstr): New type.
(string_1, string_2): New globals.
(main): Add new tests.
* gdb.python/python-mi.exp: Added regression tests.
* gdb.mi/mi2-var-display.exp: Update.
* gdb.mi/mi2-var-cmd.exp: Update.
* gdb.mi/mi2-var-child.exp: Update.
* gdb.mi/mi2-var-block.exp: Update.
* gdb.mi/mi-var-invalidate.exp: Update.
* gdb.mi/mi-var-display.exp: Update.
* gdb.mi/mi-var-cmd.exp: Update.
* gdb.mi/mi-var-child.exp: Update.
* gdb.mi/mi-var-block.exp: Update.
* gdb.mi/mi-break.exp: Update.
* gdb.mi/gdb701.exp: Update.
2009-09-15 18:51:26 +00:00
|
|
|
{ "enable-pretty-printing", { NULL, 0 }, mi_cmd_enable_pretty_printing},
|
2008-04-24 13:28:06 +00:00
|
|
|
{ "environment-cd", { NULL, 0 }, mi_cmd_env_cd},
|
|
|
|
{ "environment-directory", { NULL, 0 }, mi_cmd_env_dir},
|
|
|
|
{ "environment-path", { NULL, 0 }, mi_cmd_env_path},
|
|
|
|
{ "environment-pwd", { NULL, 0 }, mi_cmd_env_pwd},
|
|
|
|
{ "exec-arguments", { "set args", 1 }, NULL },
|
2003-08-04 23:18:50 +00:00
|
|
|
{ "exec-continue", { NULL, 0 }, mi_cmd_exec_continue},
|
|
|
|
{ "exec-finish", { NULL, 0 }, mi_cmd_exec_finish},
|
2009-04-08 06:58:37 +00:00
|
|
|
{ "exec-jump", { NULL, 0 }, mi_cmd_exec_jump},
|
2003-08-04 23:18:50 +00:00
|
|
|
{ "exec-interrupt", { NULL, 0 }, mi_cmd_exec_interrupt},
|
|
|
|
{ "exec-next", { NULL, 0 }, mi_cmd_exec_next},
|
|
|
|
{ "exec-next-instruction", { NULL, 0 }, mi_cmd_exec_next_instruction},
|
|
|
|
{ "exec-return", { NULL, 0 }, mi_cmd_exec_return},
|
2010-02-24 07:33:55 +00:00
|
|
|
{ "exec-run", { NULL, 0}, mi_cmd_exec_run},
|
2003-08-04 23:18:50 +00:00
|
|
|
{ "exec-step", { NULL, 0 }, mi_cmd_exec_step},
|
|
|
|
{ "exec-step-instruction", { NULL, 0 }, mi_cmd_exec_step_instruction},
|
2008-06-29 17:36:36 +00:00
|
|
|
{ "exec-until", { "until", 1 }, NULL},
|
2008-04-24 13:28:06 +00:00
|
|
|
{ "file-exec-and-symbols", { "file", 1 }, NULL },
|
|
|
|
{ "file-exec-file", { "exec-file", 1 }, NULL },
|
2011-01-06 00:57:05 +00:00
|
|
|
{ "file-list-exec-source-file", { NULL, 0 },
|
|
|
|
mi_cmd_file_list_exec_source_file},
|
|
|
|
{ "file-list-exec-source-files", { NULL, 0 },
|
|
|
|
mi_cmd_file_list_exec_source_files },
|
2008-04-24 13:28:06 +00:00
|
|
|
{ "file-symbol-file", { "symbol-file", 1 }, NULL },
|
|
|
|
{ "gdb-exit", { NULL, 0 }, mi_cmd_gdb_exit},
|
|
|
|
{ "gdb-set", { "set", 1 }, NULL },
|
|
|
|
{ "gdb-show", { "show", 1 }, NULL },
|
2003-08-04 23:18:50 +00:00
|
|
|
{ "gdb-version", { "show version", 0 }, 0 },
|
2008-04-24 13:28:06 +00:00
|
|
|
{ "inferior-tty-set", { NULL, 0 }, mi_cmd_inferior_tty_set},
|
|
|
|
{ "inferior-tty-show", { NULL, 0 }, mi_cmd_inferior_tty_show},
|
|
|
|
{ "interpreter-exec", { NULL, 0 }, mi_cmd_interpreter_exec},
|
|
|
|
{ "list-features", { NULL, 0 }, mi_cmd_list_features},
|
2008-08-19 13:05:02 +00:00
|
|
|
{ "list-target-features", { NULL, 0 }, mi_cmd_list_target_features},
|
2008-11-17 12:13:49 +00:00
|
|
|
{ "list-thread-groups", { NULL, 0 }, mi_cmd_list_thread_groups },
|
Multiexec MI
* breakpoint.c (clear_syscall_counts): Take struct inferior*.
* inferior.c (add_inferior_silent): Notify inferior_added
observer.
(delete_inferior_1): Notify inferior_removed observer.
(exit_inferior_1): Pass inferior, not pid, to observer.
(inferior_appeared): Likewise.
(add_inferior_with_spaces): New.
(add_inferior_command): Use the above.
* inferior.h (delete_inferior_1, add_inferior_with_spaces):
Declare.
* inflow.c (inflow_inferior_exit): Likewise.
* jit.c (jit_inferior_exit_hook): Likewise.
* mi/mi-cmds.c (mi_cmds): Register add-inferior and
remove-inferior.
* mi/mi-cmds.h (mi_cmd_add_inferior, mi_cmd_remove_inferior): New.
* mi/mi-interp.c (mi_inferior_added, mi_inferior_removed): New.
(report_initial_inferior): New.
(mi_inferior_removed): Register the above. Make sure
inferior_added observer is called on the first inferior.
(mi_new_thread, mi_thread_exit): Thread group is now identified by
inferior number, not pid.
(mi_solib_loaded, mi_solib_unloaded): Report which inferiors are
affected.
* mi/mi-main.c (current_context): New.
(proceed_thread_callback): Use typed closure.
Proceed everything if pid is 0. Most implementation split into
(proceed_thread): ... this.
(run_one_inferior): New.
(mi_cmd_exec_continue, mi_cmd_exec_interrupt, mi_cmd_exec_run):
Adjust for multiexec behaviour.
(mi_cmd_add_inferior, mi_cmd_remove_inferior): New.
(mi_cmd_execute): Handle the 'thread-group' option here.
Do some extra checks.
* mi-parse.c (mi_parse): Handle the --all and --thread-group
options.
* mi-parse.h (struct mi_parse): New fields all and thread_group.
2010-02-24 07:51:46 +00:00
|
|
|
{ "remove-inferior", { NULL, 0 }, mi_cmd_remove_inferior },
|
2008-04-24 13:28:06 +00:00
|
|
|
{ "stack-info-depth", { NULL, 0 }, mi_cmd_stack_info_depth},
|
|
|
|
{ "stack-info-frame", { NULL, 0 }, mi_cmd_stack_info_frame},
|
|
|
|
{ "stack-list-arguments", { NULL, 0 }, mi_cmd_stack_list_args},
|
|
|
|
{ "stack-list-frames", { NULL, 0 }, mi_cmd_stack_list_frames},
|
|
|
|
{ "stack-list-locals", { NULL, 0 }, mi_cmd_stack_list_locals},
|
2009-09-19 09:59:29 +00:00
|
|
|
{ "stack-list-variables", { NULL, 0 }, mi_cmd_stack_list_variables},
|
2008-04-24 13:28:06 +00:00
|
|
|
{ "stack-select-frame", { NULL, 0 }, mi_cmd_stack_select_frame},
|
|
|
|
{ "symbol-list-lines", { NULL, 0 }, mi_cmd_symbol_list_lines},
|
2008-07-04 09:04:36 +00:00
|
|
|
{ "target-attach", { "attach", 1 }, NULL },
|
2008-11-17 16:37:35 +00:00
|
|
|
{ "target-detach", { NULL, 0 }, mi_cmd_target_detach },
|
2003-08-04 23:18:50 +00:00
|
|
|
{ "target-disconnect", { "disconnect", 0 }, 0 },
|
2008-06-29 17:36:36 +00:00
|
|
|
{ "target-download", { "load", 1 }, NULL},
|
2008-04-24 13:28:06 +00:00
|
|
|
{ "target-file-delete", { NULL, 0 }, mi_cmd_target_file_delete },
|
|
|
|
{ "target-file-get", { NULL, 0 }, mi_cmd_target_file_get },
|
|
|
|
{ "target-file-put", { NULL, 0 }, mi_cmd_target_file_put },
|
2008-06-29 17:36:36 +00:00
|
|
|
{ "target-select", { "target", 1 }, NULL},
|
2008-04-24 13:28:06 +00:00
|
|
|
{ "thread-info", { NULL, 0 }, mi_cmd_thread_info },
|
|
|
|
{ "thread-list-ids", { NULL, 0 }, mi_cmd_thread_list_ids},
|
|
|
|
{ "thread-select", { NULL, 0 }, mi_cmd_thread_select},
|
2010-03-23 21:50:11 +00:00
|
|
|
{ "trace-define-variable", { NULL, 0 }, mi_cmd_trace_define_variable },
|
2010-03-23 22:01:47 +00:00
|
|
|
{ "trace-find", { NULL, 0 }, mi_cmd_trace_find },
|
2010-03-23 21:50:11 +00:00
|
|
|
{ "trace-list-variables", { NULL, 0 }, mi_cmd_trace_list_variables },
|
2010-03-23 22:05:46 +00:00
|
|
|
{ "trace-save", { NULL, 0 }, mi_cmd_trace_save },
|
2010-03-23 21:46:33 +00:00
|
|
|
{ "trace-start", { NULL, 0 }, mi_cmd_trace_start },
|
|
|
|
{ "trace-status", { NULL, 0 }, mi_cmd_trace_status },
|
|
|
|
{ "trace-stop", { NULL, 0 }, mi_cmd_trace_stop },
|
2008-04-24 13:28:06 +00:00
|
|
|
{ "var-assign", { NULL, 0 }, mi_cmd_var_assign},
|
|
|
|
{ "var-create", { NULL, 0 }, mi_cmd_var_create},
|
|
|
|
{ "var-delete", { NULL, 0 }, mi_cmd_var_delete},
|
|
|
|
{ "var-evaluate-expression", { NULL, 0 }, mi_cmd_var_evaluate_expression},
|
|
|
|
{ "var-info-path-expression", { NULL, 0 }, mi_cmd_var_info_path_expression},
|
|
|
|
{ "var-info-expression", { NULL, 0 }, mi_cmd_var_info_expression},
|
|
|
|
{ "var-info-num-children", { NULL, 0 }, mi_cmd_var_info_num_children},
|
|
|
|
{ "var-info-type", { NULL, 0 }, mi_cmd_var_info_type},
|
|
|
|
{ "var-list-children", { NULL, 0 }, mi_cmd_var_list_children},
|
|
|
|
{ "var-set-format", { NULL, 0 }, mi_cmd_var_set_format},
|
|
|
|
{ "var-set-frozen", { NULL, 0 }, mi_cmd_var_set_frozen},
|
gdb
* varobj.h (varobj_update_result_t) <new>: New field.
(varobj_get_child_range, varobj_set_child_range): Declare.
(varobj_list_children): Update.
(varobj_enable_pretty_printing, varobj_has_more)
(varobj_pretty_printed_p): Declare.
* varobj.c (pretty_printing): New global.
(varobj_enable_pretty_printing): New function.
(struct varobj_root) <from, to, constructor, child_iter,
saved_item>: New fields.
(varobj_create): Don't call install_default_visualizer.
(instantiate_pretty_printer): Don't use value_copy.
(varobj_has_more): New function.
(restrict_range): New function.
(install_dynamic_child): Likewise.
(dynamic_varobj_has_child_method): Likewise.
(update_dynamic_varobj_children): Remove 'new_and_unchanged'
argument; add 'new', 'unchanged', 'from', and 'to' arguments.
Rewrite.
(varobj_get_num_children): Call update_dynamic_varobj_children.
(varobj_list_children): Add 'from' and 'to' arguments. Ignore
result of update_dynamic_varobj_children. Don't call
install_default_visualizer. Restrict result range.
(varobj_add_child): Don't call install_default_visualizer.
(varobj_pretty_printed_p): New function.
(install_visualizer): Rewrite. Move earlier in file.
(install_default_visualizer): Likewise.
(construct_visualizer): New function.
(install_new_value_visualizer): Likewise.
(install_new_value): Don't call release_value. Special case
pretty-printed objects. Use value_incref. Rearrange "changed"
logic.
(varobj_get_child_range): New function.
(varobj_set_child_range): Likewise.
(varobj_set_visualizer): Rewrite.
(varobj_update): Rewrite pretty-printing logic.
(new_variable): Initialize new fields.
(free_variable): Destroy new fields.
(value_of_root): Copy 'from' and 'to'.
(my_value_of_variable): Handle pretty-printers.
(value_get_print_value): Rework pretty-printing logic.
(cplus_describe_child): Don't use release_value.
* mi/mi-cmds.h (mi_cmd_enable_pretty_printing)
(mi_cmd_var_set_update_range): Declare.
* mi/mi-cmds.c (mi_cmds): Add enable-pretty-printing and
var-set-update-range.
* mi/mi-cmd-var.c (print_varobj): Update. Emit "dynamic"
attribute.
(mi_cmd_var_create): Emit "has_more" attribute.
(mi_cmd_var_set_format): Plug memory leak.
(mi_print_value_p): Replace 'type' argument with 'var'. Handle
pretty-printed varobjs.
(mi_cmd_var_list_children): Accept 'from' and 'to' arguments.
Emit "has_more" attribute.
(mi_cmd_var_evaluate_expression): Plug memory leak.
(mi_cmd_var_assign): Likewise.
(varobj_update_one): Likewise. Emit "dynamic", "has_more", and
"new_children" attributes.
(mi_cmd_enable_pretty_printing): New function.
(mi_cmd_var_set_update_range): Likewise.
gdb/doc
* gdb.texinfo (GDB/MI Variable Objects): Document
-enable-pretty-printing, -var-set-update-range, dynamic varobjs.
Expand -var-update documentation.
gdb/testsuite
* lib/mi-support.exp (mi_create_varobj): Update.
(mi_create_floating_varobj): Likewise.
(mi_create_dynamic_varobj): New proc.
(mi_varobj_update): Update.
(mi_varobj_update_with_type_change): Likewise.
(mi_varobj_update_kv_helper): New proc.
(mi_varobj_update_dynamic_helper): Rewrite.
(mi_varobj_update_dynamic): New proc.
(mi_list_varobj_children): Update.
(mi_list_varobj_children_range): Add 'from' and 'to' arguments.
* gdb.python/python-prettyprint.py (pp_outer): New class.
(pp_nullstr): Likewise.
(lookup_function): Register new printers.
* gdb.python/python-prettyprint.c (struct substruct): New type.
(struct outerstruct): Likewise.
(substruct_test): New function.
(struct nullstr): New type.
(string_1, string_2): New globals.
(main): Add new tests.
* gdb.python/python-mi.exp: Added regression tests.
* gdb.mi/mi2-var-display.exp: Update.
* gdb.mi/mi2-var-cmd.exp: Update.
* gdb.mi/mi2-var-child.exp: Update.
* gdb.mi/mi2-var-block.exp: Update.
* gdb.mi/mi-var-invalidate.exp: Update.
* gdb.mi/mi-var-display.exp: Update.
* gdb.mi/mi-var-cmd.exp: Update.
* gdb.mi/mi-var-child.exp: Update.
* gdb.mi/mi-var-block.exp: Update.
* gdb.mi/mi-break.exp: Update.
* gdb.mi/gdb701.exp: Update.
2009-09-15 18:51:26 +00:00
|
|
|
{ "var-set-update-range", { NULL, 0 }, mi_cmd_var_set_update_range },
|
2009-05-28 01:09:20 +00:00
|
|
|
{ "var-set-visualizer", { NULL, 0 }, mi_cmd_var_set_visualizer},
|
2008-04-24 13:28:06 +00:00
|
|
|
{ "var-show-attributes", { NULL, 0 }, mi_cmd_var_show_attributes},
|
|
|
|
{ "var-show-format", { NULL, 0 }, mi_cmd_var_show_format},
|
|
|
|
{ "var-update", { NULL, 0 }, mi_cmd_var_update},
|
2003-08-04 23:18:50 +00:00
|
|
|
{ NULL, }
|
2000-02-23 00:25:43 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Pointer to the mi command table (built at run time) */
|
|
|
|
|
|
|
|
static struct mi_cmd **mi_table;
|
|
|
|
|
|
|
|
/* A prime large enough to accomodate the entire command table */
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
MI_TABLE_SIZE = 227
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Exported function used to obtain info from the table */
|
|
|
|
struct mi_cmd *
|
|
|
|
mi_lookup (const char *command)
|
|
|
|
{
|
|
|
|
return *lookup_table (command);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* stat collecting */
|
|
|
|
struct mi_cmd_stats
|
|
|
|
{
|
|
|
|
int hit;
|
|
|
|
int miss;
|
|
|
|
int rehash;
|
|
|
|
};
|
|
|
|
struct mi_cmd_stats stats;
|
|
|
|
|
|
|
|
/* our lookup function */
|
|
|
|
static struct mi_cmd **
|
|
|
|
lookup_table (const char *command)
|
|
|
|
{
|
|
|
|
const char *chp;
|
|
|
|
unsigned int index = 0;
|
2010-05-17 20:49:39 +00:00
|
|
|
|
2000-02-23 00:25:43 +00:00
|
|
|
/* compute our hash */
|
|
|
|
for (chp = command; *chp; chp++)
|
|
|
|
{
|
|
|
|
/* some what arbitrary */
|
|
|
|
index = ((index << 6) + (unsigned int) *chp) % MI_TABLE_SIZE;
|
|
|
|
}
|
|
|
|
/* look it up */
|
|
|
|
while (1)
|
|
|
|
{
|
|
|
|
struct mi_cmd **entry = &mi_table[index];
|
|
|
|
if ((*entry) == 0)
|
|
|
|
{
|
|
|
|
/* not found, return pointer to next free. */
|
|
|
|
stats.miss++;
|
|
|
|
return entry;
|
|
|
|
}
|
|
|
|
if (strcmp (command, (*entry)->name) == 0)
|
|
|
|
{
|
|
|
|
stats.hit++;
|
|
|
|
return entry; /* found */
|
|
|
|
}
|
|
|
|
index = (index + 1) % MI_TABLE_SIZE;
|
|
|
|
stats.rehash++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
build_table (struct mi_cmd *commands)
|
|
|
|
{
|
|
|
|
int nr_rehash = 0;
|
|
|
|
int nr_entries = 0;
|
|
|
|
struct mi_cmd *command;
|
|
|
|
int sizeof_table = sizeof (struct mi_cmd **) * MI_TABLE_SIZE;
|
|
|
|
|
|
|
|
mi_table = xmalloc (sizeof_table);
|
|
|
|
memset (mi_table, 0, sizeof_table);
|
|
|
|
for (command = commands; command->name != 0; command++)
|
|
|
|
{
|
|
|
|
struct mi_cmd **entry = lookup_table (command->name);
|
2010-05-17 20:49:39 +00:00
|
|
|
|
2000-02-23 00:25:43 +00:00
|
|
|
if (*entry)
|
2001-02-08 06:03:54 +00:00
|
|
|
internal_error (__FILE__, __LINE__,
|
2005-02-11 Andrew Cagney <cagney@gnu.org>
Mark up error_no_arg, query, perror_with_name, complaint, and
internal_error.
* breakpoint.c, cp-abi.c, cp-namespace.c, cp-support.c: Update.
* cris-tdep.c, dbxread.c, dictionary.c, dsrec.c: Update.
* dummy-frame.c, dve3900-rom.c, dwarf2-frame.c, dwarf2expr.c: Update.
* dwarf2read.c, dwarfread.c, elfread.c, event-loop.c: Update.
* exceptions.c, exec.c, f-lang.c, findvar.c, fork-child.c: Update.
* frame-unwind.c, frame.c, frv-linux-tdep.c, frv-tdep.c: Update.
* gdb_assert.h, gdbarch.c, gdbtypes.c, gnu-nat.c: Update.
* go32-nat.c, hppa-tdep.c, hppabsd-nat.c, hpread.c: Update.
* i386-linux-nat.c, i386-nat.c, i386-tdep.c, i386bsd-nat.c: Update.
* i386fbsd-nat.c, inf-ptrace.c, inf-ttrace.c, infcall.c: Update.
* infcmd.c, inflow.c, infptrace.c, infrun.c, inftarg.c: Update.
* interps.c, language.c, linespec.c, linux-nat.c: Update.
* m32r-linux-nat.c, m68k-tdep.c, m68kbsd-nat.c: Update.
* m68klinux-nat.c, m88kbsd-nat.c, macroexp.c, macroscope.c: Update.
* macrotab.c, maint.c, mdebugread.c, memattr.c: Update.
* mips-linux-tdep.c, mips-tdep.c, mips64obsd-nat.c: Update.
* mipsnbsd-nat.c, mn10300-tdep.c, monitor.c, nto-procfs.c: Update.
* objc-lang.c, objfiles.c, objfiles.h, ocd.c, osabi.c: Update.
* parse.c, ppc-bdm.c, ppc-linux-nat.c, ppc-sysv-tdep.c: Update.
* ppcnbsd-nat.c, ppcobsd-nat.c, printcmd.c, procfs.c: Update.
* regcache.c, reggroups.c, remote-e7000.c, remote-mips.c: Update.
* remote-rdp.c, remote-sds.c, remote-sim.c, remote-st.c: Update.
* remote-utils.c, remote.c, rs6000-nat.c, rs6000-tdep.c: Update.
* s390-nat.c, s390-tdep.c, sentinel-frame.c, serial.c: Update.
* sh-tdep.c, sh3-rom.c, sh64-tdep.c, shnbsd-nat.c: Update.
* solib-aix5.c, solib-svr4.c, solib.c, source.c: Update.
* sparc-nat.c, stabsread.c, stack.c, symfile.c, symtab.c: Update.
* symtab.h, target.c, tracepoint.c, ui-file.c, ui-out.c: Update.
* utils.c, valops.c, valprint.c, vax-nat.c, vaxbsd-nat.c: Update.
* win32-nat.c, xcoffread.c, xstormy16-tdep.c: Update.
* cli/cli-cmds.c, cli/cli-logging.c, cli/cli-script.c: Update.
* cli/cli-setshow.c, mi/mi-cmd-break.c, mi/mi-cmds.c: Update.
* mi/mi-console.c, mi/mi-getopt.c, mi/mi-out.c: Update.
* tui/tui-file.c, tui/tui-interp.c: Update.
2005-02-11 18:13:55 +00:00
|
|
|
_("command `%s' appears to be duplicated"),
|
2000-02-23 00:25:43 +00:00
|
|
|
command->name);
|
|
|
|
*entry = command;
|
|
|
|
if (0)
|
|
|
|
{
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "%-30s %2d\n",
|
|
|
|
command->name, stats.rehash - nr_rehash);
|
|
|
|
}
|
|
|
|
nr_entries++;
|
|
|
|
nr_rehash = stats.rehash;
|
|
|
|
}
|
|
|
|
if (0)
|
|
|
|
{
|
|
|
|
fprintf_filtered (gdb_stdlog, "Average %3.1f\n",
|
|
|
|
(double) nr_rehash / (double) nr_entries);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2000-07-30 01:48:28 +00:00
|
|
|
_initialize_mi_cmds (void)
|
2000-02-23 00:25:43 +00:00
|
|
|
{
|
|
|
|
build_table (mi_cmds);
|
|
|
|
memset (&stats, 0, sizeof (stats));
|
|
|
|
}
|