aboutsummaryrefslogtreecommitdiff
path: root/gdb/mi/mi-cmd-disas.c
diff options
context:
space:
mode:
authorAndrew Burgess <aburgess@broadcom.com>2011-01-12 15:02:12 +0000
committerAndrew Burgess <aburgess@broadcom.com>2011-01-12 15:02:12 +0000
commitb716877b54891ba162293f5ec6b6cd222f711e4d (patch)
tree3ff206d4d5431c44ee4327eeac78a40d2567248f /gdb/mi/mi-cmd-disas.c
parent13fd8b81f0460839d154c769d8ef004f41b29c55 (diff)
downloadgdb-b716877b54891ba162293f5ec6b6cd222f711e4d.zip
gdb-b716877b54891ba162293f5ec6b6cd222f711e4d.tar.gz
gdb-b716877b54891ba162293f5ec6b6cd222f711e4d.tar.bz2
http://sourceware.org/ml/gdb-patches/2010-12/msg00299.html
gdb/ * disasm.c (dump_insns): Support dumping opcodes for MI. * mi/mi-cmd-disas.c (mi_cmd_disassemble): Allow mode to control dumping of instruction opcodes. gdb/doc/ * gdb.texinfo (GDB/MI Data Manipulation): Update to reflect changes in mi/mi-cmd-disas.c gdb/testsuite/ * gdb.mi/mi-disassemble.exp, gdb.mi/mi2-disassemble.exp: Update expected output to reflect changes in gdb/mi/mi-cmd-disas.c and add new tests for opcode dumping.
Diffstat (limited to 'gdb/mi/mi-cmd-disas.c')
-rw-r--r--gdb/mi/mi-cmd-disas.c30
1 files changed, 20 insertions, 10 deletions
diff --git a/gdb/mi/mi-cmd-disas.c b/gdb/mi/mi-cmd-disas.c
index 1932ae2..e5ce66f 100644
--- a/gdb/mi/mi-cmd-disas.c
+++ b/gdb/mi/mi-cmd-disas.c
@@ -40,21 +40,24 @@
FILENAME: The name of the file where we want disassemble from.
LINE: The line around which we want to disassemble. It will
disassemble the function that contins that line.
- HOW_MANY: Number of disassembly lines to display. In mixed mode, it
+ HOW_MANY: Number of disassembly lines to display. With source, it
is the number of disassembly lines only, not counting the source
lines.
always required:
- MODE: 0 or 1 for disassembly only, or mixed source and disassembly,
- respectively. */
+ MODE: 0 -- disassembly.
+ 1 -- disassembly and source.
+ 2 -- disassembly and opcodes.
+ 3 -- disassembly, source and opcodes.
+*/
void
mi_cmd_disassemble (char *command, char **argv, int argc)
{
struct gdbarch *gdbarch = get_current_arch ();
CORE_ADDR start;
- int mixed_source_and_assembly;
+ int mode, disasm_flags;
struct symtab *s;
/* Which options have we processed ... */
@@ -129,16 +132,23 @@ mi_cmd_disassemble (char *command, char **argv, int argc)
|| (line_seen && file_seen && !num_seen && !start_seen && !end_seen)
|| (!line_seen && !file_seen && !num_seen && start_seen && end_seen)))
error (_("mi_cmd_disassemble: Usage: ( [-f filename -l linenum [-n "
- "howmany]] | [-s startaddr -e endaddr]) [--] mixed_mode."));
+ "howmany]] | [-s startaddr -e endaddr]) [--] mode."));
if (argc != 1)
error (_("mi_cmd_disassemble: Usage: [-f filename -l linenum "
- "[-n howmany]] [-s startaddr -e endaddr] [--] mixed_mode."));
+ "[-n howmany]] [-s startaddr -e endaddr] [--] mode."));
- mixed_source_and_assembly = atoi (argv[0]);
- if ((mixed_source_and_assembly != 0) && (mixed_source_and_assembly != 1))
- error (_("mi_cmd_disassemble: Mixed_mode argument must be 0 or 1."));
+ mode = atoi (argv[0]);
+ if (mode < 0 || mode > 3)
+ error (_("mi_cmd_disassemble: Mode argument must be 0, 1, 2, or 3."));
+ /* Convert the mode into a set of disassembly flags */
+
+ disasm_flags = 0;
+ if (mode & 0x1)
+ disasm_flags |= DISASSEMBLY_SOURCE;
+ if (mode & 0x2)
+ disasm_flags |= DISASSEMBLY_RAW_INSN;
/* We must get the function beginning and end where line_num is
contained. */
@@ -157,6 +167,6 @@ mi_cmd_disassemble (char *command, char **argv, int argc)
gdb_disassembly (gdbarch, uiout,
file_string,
- mixed_source_and_assembly? DISASSEMBLY_SOURCE : 0,
+ disasm_flags,
how_many, low, high);
}