diff options
Diffstat (limited to 'gdb/mi')
-rw-r--r-- | gdb/mi/mi-cmd-disas.c | 36 | ||||
-rw-r--r-- | gdb/mi/mi-main.c | 1 |
2 files changed, 27 insertions, 10 deletions
diff --git a/gdb/mi/mi-cmd-disas.c b/gdb/mi/mi-cmd-disas.c index e704e35..f0f2635 100644 --- a/gdb/mi/mi-cmd-disas.c +++ b/gdb/mi/mi-cmd-disas.c @@ -67,6 +67,7 @@ mi_cmd_disassemble (const char *command, char **argv, int argc) int num_seen = 0; int start_seen = 0; int end_seen = 0; + int addr_seen = 0; /* ... and their corresponding value. */ char *file_string = NULL; @@ -74,13 +75,14 @@ mi_cmd_disassemble (const char *command, char **argv, int argc) int how_many = -1; CORE_ADDR low = 0; CORE_ADDR high = 0; + CORE_ADDR addr = 0; /* Options processing stuff. */ int oind = 0; char *oarg; enum opt { - FILE_OPT, LINE_OPT, NUM_OPT, START_OPT, END_OPT + FILE_OPT, LINE_OPT, NUM_OPT, START_OPT, END_OPT, ADDR_OPT }; static const struct mi_opt opts[] = { @@ -89,6 +91,7 @@ mi_cmd_disassemble (const char *command, char **argv, int argc) {"n", NUM_OPT, 1}, {"s", START_OPT, 1}, {"e", END_OPT, 1}, + {"a", ADDR_OPT, 1}, { 0, 0, 0 } }; @@ -122,23 +125,30 @@ mi_cmd_disassemble (const char *command, char **argv, int argc) high = parse_and_eval_address (oarg); end_seen = 1; break; + case ADDR_OPT: + addr = parse_and_eval_address (oarg); + addr_seen = 1; + break; } } argv += oind; argc -= oind; /* Allow only filename + linenum (with how_many which is not - required) OR start_addr + end_addr. */ + required) OR start_addr + end_addr OR addr. */ + + if (!( + ( line_seen && file_seen && !start_seen && !end_seen + && !addr_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))) - error (_("-data-disassemble: Usage: ( [-f filename -l linenum [-n " - "howmany]] | [-s startaddr -e endaddr]) [--] mode.")); + || (!line_seen && !file_seen && !num_seen && start_seen && end_seen + && !addr_seen) - if (argc != 1) - error (_("-data-disassemble: Usage: [-f filename -l linenum " - "[-n howmany]] [-s startaddr -e endaddr] [--] mode.")); + || (!line_seen && !file_seen && !num_seen && !start_seen && !end_seen + && addr_seen)) + || argc != 1) + error (_("-data-disassemble: Usage: ( [-f filename -l linenum " + "[-n howmany]] | [-s startaddr -e endaddr] | [-a addr] ) [--] mode.")); mode = atoi (argv[0]); if (mode < 0 || mode > 5) @@ -184,6 +194,12 @@ mi_cmd_disassemble (const char *command, char **argv, int argc) error (_("-data-disassemble: " "No function contains specified address")); } + else if (addr_seen) + { + if (find_pc_partial_function (addr, NULL, &low, &high) == 0) + error (_("-data-disassemble: " + "No function contains specified address")); + } gdb_disassembly (gdbarch, uiout, disasm_flags, diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c index 2163d42..1e31040 100644 --- a/gdb/mi/mi-main.c +++ b/gdb/mi/mi-main.c @@ -1683,6 +1683,7 @@ mi_cmd_list_features (const char *command, char **argv, int argc) uiout->field_string (NULL, "info-gdb-mi-command"); uiout->field_string (NULL, "undefined-command-error-code"); uiout->field_string (NULL, "exec-run-start-option"); + uiout->field_string (NULL, "data-disassemble-a-option"); if (ext_lang_initialized_p (get_ext_lang_defn (EXT_LANG_PYTHON))) uiout->field_string (NULL, "python"); |