This change adds the MI equivalent for the "info sharedlibrary"
command. The command was already partially documented but ignored as
it was not implemented. The new MI command works similarly to the CLI
command, taking an optional regular expression as an argument and
outputting the library information.
I included a test for the new command in mi-solib.exp.
gdb/doc/ChangeLog:
* gdb.texinfo (gdb/mi Symbol Query Commands): Document new MI
command file-list-shared-libraries
(GDB/MI Async Records): Update documentation of library-loaded with new
field.
gdb/ChangeLog:
* NEWS: Add an entry about new '-file-list-shared-libraries' command.
* mi/mi-cmd-file.c (mi_cmd_file_list_shared_libraries):
New function definition.
* mi/mi-cmds.c (mi_cmds): Add -file-list-shared-libraries command.
* mi/mi-cmds.h (mi_cmd_file_list_shared_libraries):
New function declaration.
* mi/mi-interp.c (mi_output_solib_attribs): New Function.
* mi/mi-interp.h: New file.
* solib.c (info_sharedlibrary_command): Replace for loop with
ALL_SO_LIBS macro
* solib.h (update_solib_list): New function declaration.
(so_list_head): Move macro.
* solist.h (ALL_SO_LIBS): New macro.
gdb/testsuite/ChangeLog:
* gdb.mi/mi-solib.exp (test_file_list_shared_libraries):
New procedure.
Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
Changes in v4:
- Replaced phex call with hex_string.
Changes in v3:
- Addressed comments by Pedro.
- Output of memory region size now in hex format.
- Misc formatting fixups.
- Addressed Simon's comments on formatting.
- Adjusted command text in the manual entry.
- Fixed up ChangeLog.
- Renamed flash_erase_all_command to flash_erase_command.
Changes in v2:
- Added NEWS entry.
- Fixed long lines.
- Address printing with paddress.
Years ago we contributed flash programming patches upstream. The following
patch is a leftover one that complements that functionality by adding a new
command to erase all reported flash memory blocks.
The command is most useful when we're dealing with flash-enabled targets
(mostly bare-metal) and we need to reset the board for some reason.
The wiping out of flash memory regions should help the target come up with a
known clean state from which the user can load a new image and resume
debugging. It is convenient enough to do this from the debugger, and there is
also an MI command to expose this functionality to the IDE's.
gdb/doc/ChangeLog:
2017-01-20 Mike Wrighton <mike_wrighton@codesourcery.com>
Luis Machado <lgustavo@codesourcery.com>
* gdb.texinfo (-target-flash-erase): New MI command description.
(flash-erase): New CLI command description.
gdb/ChangeLog:
2017-01-20 Mike Wrighton <mike_wrighton@codesourcery.com>
Luis Machado <lgustavo@codesourcery.com>
* NEWS (New commands): Mention flash-erase.
(New MI commands): Mention target-flash-erase.
* mi/mi-cmds.c (mi_cmd_target_flash_erase): Add target-flash-erase MI
command.
* mi/mi-cmds.h (mi_cmd_target_flash_erase): New declaration.
* mi/mi-main.c (mi_cmd_target_flash_erase): New function.
* target.c (flash_erase_command): New function.
(initialize_targets): Add new flash-erase command.
* target.h (flash_erase_command): New declaration.
This applies the second part of GDB's End of Year Procedure, which
updates the copyright year range in all of GDB's files.
gdb/ChangeLog:
Update copyright year range in all GDB files.
Each MI instance should obviously have its own raw output channel,
along with save_raw_stdout.
gdb/ChangeLog:
2016-06-21 Pedro Alves <palves@redhat.com>
* interps.c (current_interpreter): New function.
* interps.h (current_interpreter): New declaration.
* mi/mi-cmds.h (raw_stdout): Delete declaration.
* mi/mi-common.h (struct mi_interp) <raw_stdout,
saved_raw_stdout>: New field.
* mi/mi-interp.c (display_mi_prompt): New parameter 'mi'. Adjust
to per-UI raw_stdout.
(mi_interpreter_init): Adjust to per-UI raw_stdout.
(mi_on_sync_execution_done, mi_execute_command_input_handler)
(mi_command_loop): Pass MI instance to display_mi_prompt.
(mi_on_normal_stop_1, mi_output_running_pid, mi_on_resume_1)
(mi_on_resume): Adjust to per-UI raw_stdout.
(saved_raw_stdout): Delete.
(mi_set_logging): Adjust to per-UI raw_stdout and
saved_raw_stdout.
* mi/mi-main.c (raw_stdout): Delete.
(mi_cmd_gdb_exit, captured_mi_execute_command)
(mi_print_exception, mi_load_progress): Adjust to per-UI
raw_stdout.
(print_diff_now, mi_print_timing_maybe): New ui_file parameter.
Pass it along.
(print_diff): New ui_file parameter. Send output there instead of
raw_stdout.
* mi/mi-main.h (struct ui_file): Forward declare.
(mi_print_timing_maybe): Add ui_file parameter.
This patch adds a new GDB/MI command meant for graphical frontends
trying to determine whether a given GDB/MI command exists or not.
Examples:
-info-gdb-mi-command unsupported-command
^done,command={exists="false"}
(gdb)
-info-gdb-mi-command symbol-list-lines
^done,command={exists="true"}
(gdb)
At the moment, this is the only piece of information that this
command returns.
Eventually, and if needed, we can extend it to provide
command-specific pieces of information, such as updates to
the command's syntax since inception. This could become,
for instance:
-info-gdb-mi-command symbol-list-lines
^done,command={exists="true",features=[]}
(gdb)
-info-gdb-mi-command catch-assert
^done,command={exists="true",features=["conditions"]}
In the first case, it would mean that no extra features,
while in the second, it announces that the -catch-assert
command in this version of the debugger supports a feature
called "condition" - exact semantics to be documented with
combined with the rest of the queried command's documentation.
But for now, we start small, and only worry about existance.
And to bootstrap the process, I have added an entry in the
output of the -list-features command as well ("info-gdb-mi-command"),
allowing the graphical frontends to go through the following process:
1. Send -list-features, collect info from there as before;
2. Check if the output contains "info-gdb-mi-command".
If it does, then support for various commands can be
queried though -info-gdb-mi-command. Newer commands
will be expected to always be checked via this new
-info-gdb-mi-command.
gdb/ChangeLog:
* mi/mi-cmds.h (mi_cmd_info_gdb_mi_command): Declare.
* mi/mi-cmd-info.c (mi_cmd_info_gdb_mi_command): New function.
* mi/mi-cmds.c (mi_cmds): Add -info-gdb-mi-command command.
* mi/mi-main.c (mi_cmd_list_features): Add "info-gdb-mi-command"
field to output of "-list-features".
* NEWS: Add entry for new -info-gdb-mi-command.
gdb/doc/ChangeLog:
* gdb.texinfo (GDB/MI Miscellaneous Commands): Document
the new -info-gdb-mi-command GDB/MI command. Document
the meaning of "-info-gdb-mi-command" in the output of
-list-features.
gdb/testsuite/ChangeLog:
* gdb.mi/mi-i-cmd.exp: New file.
This patch implements a new GDB/MI command implementing the equivalent
of the "info exceptions" CLI command. The command syntax is:
-info-ada-exceptions [REGEXP]
Here is an example of usage (slightly formatted by hand to make it
easier to read):
-info-ada-exceptions ions\.a_
^done,ada-exceptions=
{nr_rows="2",nr_cols="2",
hdr=[{width="1",alignment="-1",col_name="name",colhdr="Name"},
{width="1",alignment="-1",col_name="address",colhdr="Address"}],
body=[{name="global_exceptions.a_global_exception",
address="0x0000000000613a80"},
{name="global_exceptions.a_private_exception",
address="0x0000000000613ac0"}]}
Also, in order to allow graphical frontends to easily determine
whether this command is available or not, the output of the
"-list-features" command has been augmented to contain
"info-ada-exceptions".
gdb/Changelog:
* mi/mi-cmds.h (mi_cmd_info_ada_exceptions): Add declaration.
* mi/mi-cmds.c (mi_cmds): Add entry for -info-ada-exceptions
command.
* mi/mi-cmd-info.c: #include "ada-lang.c" and "arch-utils.c".
(mi_cmd_info_ada_exceptions): New function.
* mi/mi-main.c (mi_cmd_list_features): Add "info-ada-exceptions".
gdb/testsuite/ChangeLog:
* gdb.ada/mi_exc_info: New testcase.
This patch introduces two new GDB/MI commands implementing the equivalent
of the "catch exception" and "catch assert" GDB/CLI commands.
gdb/ChangeLog:
* breakpoint.h (init_ada_exception_breakpoint): Add parameter
"enabled".
* breakpoint.c (init_ada_exception_breakpoint): Add parameter
"enabled". Set B->ENABLE_STATE accordingly.
* ada-lang.h (ada_exception_catchpoint_kind): Move here from
ada-lang.c.
(create_ada_exception_catchpoint): Add declaration.
* ada-lang.c (ada_exception_catchpoint_kind): Move to ada-lang.h.
(create_ada_exception_catchpoint): Make non-static. Add new
parameter "disabled". Use it in call to
init_ada_exception_breakpoint.
(catch_ada_exception_command): Add parameter "enabled" in call
to create_ada_exception_catchpoint.
(catch_assert_command): Likewise.
* mi/mi-cmds.h (mi_cmd_catch_assert, mi_cmd_catch_exception):
Add declarations.
* mi/mi-cmds.c (mi_cmds): Add the "catch-assert" and
"catch-exception" commands.
* mi/mi-cmd-catch.c: Add #include "ada-lang.h".
(mi_cmd_catch_assert, mi_cmd_catch_exception): New functions.
2013-06-26 Pedro Alves <pedro@codesourcery.com>
Yao Qi <yao@codesourcery.com>
* gdb.texinfo (GDB/MI Tracepoint Commands): Document
-trace-frame-collected.
gdb:
2013-06-26 Pedro Alves <pedro@codesourcery.com>
Yao Qi <yao@codesourcery.com>
* mi/mi-cmds.c (mi_cmds): Register -trace-frame-collected.
* mi/mi-cmds.h (mi_cmd_trace_frame_collected): Declare.
* mi/mi-main.c (print_variable_or_computed): New function.
(mi_cmd_trace_frame_collected): New function.
* tracepoint.c (find_trace_state_variable_by_number): New.
(struct traceframe_info): Move to tracepoint.h
(struct collection_list): Likewise.
(do_collect_symbol): Include locals and arguments in the wholly
collected variables list.
(clear_collection_list): Clear wholly collected variables list
and computed variables list.
(append_exp): New function.
(encode_actions_1): Include variables in the wholly
collected variables list. Include memory ranges and
full-fledged expressions in the computed expressions list.
(encode_actions): Move some code to ...
Return the cleanup chain.
(encode_actions_rsp): ... here. New function.
(get_traceframe_location, get_traceframe_info): Remove static.
* tracepoint.h (struct memrange): Moved from tracepoint.c.
(struct collection_list): Moved from tracepoint.c. Add two
new fields 'wholly_collected' and 'computed'.
(find_trace_state_variable_by_number): Declare.
(encode_actions): Adjust declaration.
(encode_actions_rsp): Declare.
(get_traceframe_info, get_traceframe_location): Declare.
* NEWS: Mention new MI command -trace-frame-collected.
* mi/mi-cmd-var.c (mi_no_values, mi_simple_values): Move to
mi-parse.c. Make them static.
(mi_all_values): Likewise.
(mi_parse_values_option): Move to mi-parse.c. Rename it to
mi_parse_print_values. Make it external.
* mi/mi-cmds.h (mi_no_values, mi_simple_values, mi_all_values):
Remove the declarations.
* mi/mi-parse.c (mi_parse_print_values): Moved from mi-cmd-var.c.
* mi/mi-parse.h (mi_parse_print_values): Declare.
* mi/mi-cmd-stack.c: Include mi-parse.h.
(parse_print_values): Remove
(mi_cmd_stack_list_locals): Call mi_parse_print_values instead
of parse_print_values.
(mi_cmd_stack_list_args, mi_cmd_stack_list_variables): Likewise.
* mi/mi-interp.c (mi_interpreter_exec): Make "command" const.
Remove temporary copy of input string.
(mi_execute_command_wrapper): Make "cmd" const.
* mi/mi-main.c (mi_execute_command): Make "string_ptr" const.
* mi/mi-parse.c (mi_parse_argv): Make "args" const.
Use const strings.
(mi_parse): Make "cmd" const.
Use const strings.
* mi/mi-parse.h (mi_parse): Make "cmd" const.
Two modifications:
1. The addition of 2013 to the copyright year range for every file;
2. The use of a single year range, instead of potentially multiple
year ranges, as approved by the FSF.
They are equivalent to "catch load" and "catch unload" from CLI.
Rationale: GUIs might be interested in catching solib load or
unload events.
2012-11-16 Mircea Gherzan <mircea.gherzan@intel.com>
* Makefile.in (SUBDIR_MI_OBS): Add mi-cmd-catch.o.
(SUBDIR_MI_SRCS): Add mi/mi-cmd-catch.c.
* breakpoint.c (add_solib_catchpoint): New function that
can be used by both CLI and MI, factored out from
catch_load_or_unload.
(catch_load_or_unload): Strip it down and make it use the
new add_solib_catchpoint.
* breakpoint.h (add_solib_catchpoint): Declare it.
* mi/mi-cmd-break.h: New file.
* mi/mi-cmd-break.c: Include mi-cmd-break.h.
(setup_breakpoint_reporting): New function used for both
catchpoints and breakpoints.
(mi_cmd_break_insert): Use setup_breakpoint_reporting.
* mi/mi-cmd-catch.c: New file.
* mi/mi-cmds.c (mi_cmds): Add the handlers for -catch-load
and -catch-unload.
* mi/mi-cmds.h: Declare the handlers for -catch-load and
-catch-unload.
* mi/mi-cmds.c (mi_cmds): New macros DEF_MI_CMD_CLI
DEF_MI_CMD_MI DEF_MI_CMD_CLI_1 and DEF_MI_CMD_CLI_1.
Update some commands.
* mi/mi-cmds.h (struct mi_cmd) <suppress_notification>: New field.
* mi/mi-main.c (mi_cmd_execute): Set '*parse->cmd->suppress_notification'
to 1.
This patch introduces a new GDB/MI command: -ada-tasks-info,
which is meant to be the MI equivalent of the CLI `info tasks'
command.
This new command returns an array, with each row corresponding
to one task. For now, the columns of the array corresponds to
the columns displayed in the CLI output.
gdb/ChangeLog:
* ada-lang.h (struct inferior): Declare.
(print_ada_task_info): Add declaration.
* ada-tasks.c (print_ada_task_info): Make non-static.
* mi/mi-cmds.c (mi_cmds): Add "ada-task-info".
* mi/mi-cmds.h (mi_cmd_ada_task_info): Add declaration.
* mi/mi-main.c: #include "ada-lang.h".
(mi_cmd_list_features): Add "ada-task-info" to the list
of supported features.
(mi_cmd_ada_task_info): New function.
* 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.
* mi/mi-cmds.c (mi_cmds): Register -stack-list-variables.
* mi/mi-cmd-stack.c (enum what_to_list): New.
(list_args_or_locals): Accept what_to_list parameter.
Use 'variables' as output name of all are requested.
(mi_cmd_stack_list_variables): New.
(mi_cmd_stack_list_locals, mi_cmd_stack_list_args): Adjust.
-target-download and -target-select via CLI, so that
the quoting rules are the same as they were (unfortunately)
in all prior gdb releases.
* mi/mi-cmds.h (mi_cmd_exec_run, mi_cmd_exec_until)
(mi_cmd_target_download, mi_cmd_target_select): Remove.
* mi/mi-main.c (mi_cmd_exec_run, mi_cmd_exec_until)
(mi_cmd_target_download, mi_cmd_target_select): Remove.
(mi_cmd_execute): Set current_token even for commands
routed via CLI.
Adjust all prototypes using mi_cmd_args_ftype to use
mi_cmd_argv_ftype.
(struct mi_cmd): Remove the args_func field.
* mi/mi-cmds.c: Don't provide value for the args_func field.
* mi/mi-main.c (mi_execute_async_cli_command)
(mi_cmd_exec_run, mi_cmd_exec_next, mi_cmd_exec_next_instruction)
(mi_cmd_exec_step, mi_cmd_exec_step_instruction)
(mi_cmd_exec_finish, mi_cmd_exec_until, mi_cmd_exec_return)
(mi_cmd_exec_continue, mi_cmd_exec_interrupt)
(mi_cmd_target_download): Adjust.
(mi_cmd_target_select): Adjust. Pass 0 for from_tty parameter.
(mi_cmd_execute): Do not check for args_func.
(mi_execute_async_cli_command): Adjust.
* mi/mi-parse.c: Don't check for args_func.
* gdbthread.h (print_thread_info): Declare.
* thread.c (print_thread_info): New, extracted
from info_threads_command and adjusted to
work for CLI and MI.
(info_threads_command): Use print_thread_info.
* Makefile.in: Update dependencies.
* mi/mi-cmds.c (mi_cmds): Specify a handler
for -thread-info.
* mi/mi-cmds.h (mi_cmd_thread_info): Declare.
* mi/mi-main.c (mi_cmd_thread_info): New.
(mi_cmd_list_features): Include 'thread-info'.