diff options
author | Joel Brobecker <brobecker@adacore.com> | 2013-11-07 17:15:46 +0400 |
---|---|---|
committer | Joel Brobecker <brobecker@adacore.com> | 2013-11-12 06:47:16 +0400 |
commit | a7e332c24b77168bc61d4ee776bf29c831fbbc88 (patch) | |
tree | 180fde49796f2937620185c5e0ae2b82ecc02477 /gdb/mi | |
parent | 778865d3e288f4fcf3b293e78d52cd5dacb4b999 (diff) | |
download | gdb-a7e332c24b77168bc61d4ee776bf29c831fbbc88.zip gdb-a7e332c24b77168bc61d4ee776bf29c831fbbc88.tar.gz gdb-a7e332c24b77168bc61d4ee776bf29c831fbbc88.tar.bz2 |
Implement GDB/MI equivalent of "info exceptions" CLI command.
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.
Diffstat (limited to 'gdb/mi')
-rw-r--r-- | gdb/mi/mi-cmd-info.c | 51 | ||||
-rw-r--r-- | gdb/mi/mi-cmds.c | 1 | ||||
-rw-r--r-- | gdb/mi/mi-cmds.h | 1 | ||||
-rw-r--r-- | gdb/mi/mi-main.c | 1 |
4 files changed, 54 insertions, 0 deletions
diff --git a/gdb/mi/mi-cmd-info.c b/gdb/mi/mi-cmd-info.c index 8eb4220..aa4d210 100644 --- a/gdb/mi/mi-cmd-info.c +++ b/gdb/mi/mi-cmd-info.c @@ -19,6 +19,57 @@ #include "defs.h" #include "osdata.h" #include "mi-cmds.h" +#include "ada-lang.h" +#include "arch-utils.h" + +/* Implement the "-info-ada-exceptions" GDB/MI command. */ + +void +mi_cmd_info_ada_exceptions (char *command, char **argv, int argc) +{ + struct ui_out *uiout = current_uiout; + struct gdbarch *gdbarch = get_current_arch (); + char *regexp; + struct cleanup *old_chain; + VEC(ada_exc_info) *exceptions; + int ix; + struct ada_exc_info *info; + + switch (argc) + { + case 0: + regexp = NULL; + break; + case 1: + regexp = argv[0]; + break; + default: + error (_("Usage: -info-ada-exceptions [REGEXP]")); + break; + } + + exceptions = ada_exceptions_list (regexp); + old_chain = make_cleanup (VEC_cleanup (ada_exc_info), &exceptions); + + make_cleanup_ui_out_table_begin_end + (uiout, 2, VEC_length (ada_exc_info, exceptions), "ada-exceptions"); + ui_out_table_header (uiout, 1, ui_left, "name", "Name"); + ui_out_table_header (uiout, 1, ui_left, "address", "Address"); + ui_out_table_body (uiout); + + for (ix = 0; VEC_iterate(ada_exc_info, exceptions, ix, info); ix++) + { + struct cleanup *sub_chain; + + sub_chain = make_cleanup_ui_out_tuple_begin_end (uiout, NULL); + ui_out_field_string (uiout, "name", info->name); + ui_out_field_core_addr (uiout, "address", gdbarch, info->addr); + + do_cleanups (sub_chain); + } + + do_cleanups (old_chain); +} void mi_cmd_info_os (char *command, char **argv, int argc) diff --git a/gdb/mi/mi-cmds.c b/gdb/mi/mi-cmds.c index 1b8ec92..496a8aa 100644 --- a/gdb/mi/mi-cmds.c +++ b/gdb/mi/mi-cmds.c @@ -124,6 +124,7 @@ static struct mi_cmd mi_cmds[] = DEF_MI_CMD_CLI ("gdb-version", "show version", 0), DEF_MI_CMD_MI ("inferior-tty-set", mi_cmd_inferior_tty_set), DEF_MI_CMD_MI ("inferior-tty-show", mi_cmd_inferior_tty_show), + DEF_MI_CMD_MI ("info-ada-exceptions", mi_cmd_info_ada_exceptions), DEF_MI_CMD_MI ("info-os", mi_cmd_info_os), DEF_MI_CMD_MI ("interpreter-exec", mi_cmd_interpreter_exec), DEF_MI_CMD_MI ("list-features", mi_cmd_list_features), diff --git a/gdb/mi/mi-cmds.h b/gdb/mi/mi-cmds.h index bbca54d..cb8aac1 100644 --- a/gdb/mi/mi-cmds.h +++ b/gdb/mi/mi-cmds.h @@ -73,6 +73,7 @@ extern mi_cmd_argv_ftype mi_cmd_file_list_exec_source_files; extern mi_cmd_argv_ftype mi_cmd_gdb_exit; extern mi_cmd_argv_ftype mi_cmd_inferior_tty_set; extern mi_cmd_argv_ftype mi_cmd_inferior_tty_show; +extern mi_cmd_argv_ftype mi_cmd_info_ada_exceptions; extern mi_cmd_argv_ftype mi_cmd_info_os; extern mi_cmd_argv_ftype mi_cmd_interpreter_exec; extern mi_cmd_argv_ftype mi_cmd_list_features; diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c index 24ac1e0..bf0fce3 100644 --- a/gdb/mi/mi-main.c +++ b/gdb/mi/mi-main.c @@ -1815,6 +1815,7 @@ mi_cmd_list_features (char *command, char **argv, int argc) ui_out_field_string (uiout, NULL, "data-read-memory-bytes"); ui_out_field_string (uiout, NULL, "breakpoint-notifications"); ui_out_field_string (uiout, NULL, "ada-task-info"); + ui_out_field_string (uiout, NULL, "info-ada-exceptions"); #if HAVE_PYTHON if (gdb_python_initialized) |