diff options
author | Maciej W. Rozycki <macro@linux-mips.org> | 2007-06-21 15:18:51 +0000 |
---|---|---|
committer | Maciej W. Rozycki <macro@linux-mips.org> | 2007-06-21 15:18:51 +0000 |
commit | a131cc65aba4bc97c6da3ae6e253678f975feef2 (patch) | |
tree | 809dcfb39f3b60191abe35f4848cb53fb3c21b02 /gdb | |
parent | b28da0ad5f4461c8cd028be8183e3fb489a3cb1f (diff) | |
download | gdb-a131cc65aba4bc97c6da3ae6e253678f975feef2.tar.gz |
gdb/:
* disasm.c (gdb_print_insn): Return the number of branch delay
slot instructions too.
* disasm.h (gdb_print_insn): Update prototype.
* printcmd.c (branch_delay_insns): New variable to record the
number of delay slot instructions after disassembling a branch.
(print_formatted): Record the number of branch delay slot
instructions.
(do_examine): When disassembling, if the last instruction
disassembled has any branch delay slots, then bump the count so
that they get disassembled too.
* tui/tui-disasm.c (tui_disassemble): Update the call to
gdb_print_insn().
* NEWS: Document the new behaviour.
gdb/doc/:
* gdb.texinfo (Examining Memory): Document the new behaviour.
gdb/gdbtk/:
* generic/gdbtk-cmds.c (gdbtk_load_asm): Update the call to
gdb_print_insn().
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 17 | ||||
-rw-r--r-- | gdb/NEWS | 3 | ||||
-rw-r--r-- | gdb/disasm.c | 21 | ||||
-rw-r--r-- | gdb/disasm.h | 9 | ||||
-rw-r--r-- | gdb/doc/ChangeLog | 4 | ||||
-rw-r--r-- | gdb/doc/gdb.texinfo | 9 | ||||
-rw-r--r-- | gdb/gdbtk/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/gdbtk/generic/gdbtk-cmds.c | 2 | ||||
-rw-r--r-- | gdb/printcmd.c | 13 | ||||
-rw-r--r-- | gdb/tui/tui-disasm.c | 2 |
10 files changed, 71 insertions, 14 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index a32a2ca0a84..dbe57a91f4e 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,20 @@ +2007-06-21 Nigel Stephens <nigel@mips.com> + Maciej W. Rozycki <macro@mips.com> + + * disasm.c (gdb_print_insn): Return the number of branch delay + slot instructions too. + * disasm.h (gdb_print_insn): Update prototype. + * printcmd.c (branch_delay_insns): New variable to record the + number of delay slot instructions after disassembling a branch. + (print_formatted): Record the number of branch delay slot + instructions. + (do_examine): When disassembling, if the last instruction + disassembled has any branch delay slots, then bump the count so + that they get disassembled too. + * tui/tui-disasm.c (tui_disassemble): Update the call to + gdb_print_insn(). + * NEWS: Document the new behaviour. + 2007-06-21 Andreas Schwab <schwab@suse.de> * regcache.c (write_pc_pid): Restore missing else. @@ -41,6 +41,9 @@ has been rewritten to use the standard GDB remote protocol. layout. It also supports a TextSeg= and DataSeg= response when only segment base addresses (rather than offsets) are available. +* The /i format now outputs any trailing branch delay slot instructions +immediately following the last instruction within the count specified. + * New commands set remoteflow diff --git a/gdb/disasm.c b/gdb/disasm.c index 168d7ee04a1..ed885c6a5b4 100644 --- a/gdb/disasm.c +++ b/gdb/disasm.c @@ -387,11 +387,24 @@ gdb_disassembly (struct ui_out *uiout, } /* Print the instruction at address MEMADDR in debugged memory, - on STREAM. Returns length of the instruction, in bytes. */ + on STREAM. Returns the length of the instruction, in bytes, + and, if requested, the number of branch delay slot instructions. */ int -gdb_print_insn (CORE_ADDR memaddr, struct ui_file *stream) +gdb_print_insn (CORE_ADDR memaddr, struct ui_file *stream, + int *branch_delay_insns) { - struct disassemble_info di = gdb_disassemble_info (current_gdbarch, stream); - return gdbarch_print_insn (current_gdbarch, memaddr, &di); + struct disassemble_info di; + int length; + + di = gdb_disassemble_info (current_gdbarch, stream); + length = gdbarch_print_insn (current_gdbarch, memaddr, &di); + if (branch_delay_insns) + { + if (di.insn_info_valid) + *branch_delay_insns = di.branch_delay_insns; + else + *branch_delay_insns = 0; + } + return length; } diff --git a/gdb/disasm.h b/gdb/disasm.h index b96ad3097ff..4dae0ba8be0 100644 --- a/gdb/disasm.h +++ b/gdb/disasm.h @@ -30,9 +30,12 @@ extern void gdb_disassembly (struct ui_out *uiout, int mixed_source_and_assembly, int how_many, CORE_ADDR low, CORE_ADDR high); -/* Print the instruction at address MEMADDR in debugged memory, on - STREAM. Returns length of the instruction, in bytes. */ +/* Print the instruction at address MEMADDR in debugged memory, + on STREAM. Returns the length of the instruction, in bytes, + and, if requested, the number of branch delay slot instructions. */ -extern int gdb_print_insn (CORE_ADDR memaddr, struct ui_file *stream); +extern int gdb_print_insn (CORE_ADDR memaddr, + struct ui_file *stream, + int *branch_delay_insns); #endif diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index d3e0cc40c8e..dbd46d6c3aa 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,7 @@ +2007-06-21 Maciej W. Rozycki <macro@mips.com> + + * gdb.texinfo (Examining Memory): Document the new behaviour. + 2007-06-21 Vladimir Prus <vladimir@codesourcery.com> * gdb.texinfo (Standard Target Features): Document diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 6edd6a6b4b7..fdbacf1152f 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -5861,9 +5861,12 @@ specifications @samp{4xw} and @samp{4wx} mean exactly the same thing. Even though the unit size @var{u} is ignored for the formats @samp{s} and @samp{i}, you might still want to use a count @var{n}; for example, @samp{3i} specifies that you want to see three machine instructions, -including any operands. The command @code{disassemble} gives an -alternative way of inspecting machine instructions; see @ref{Machine -Code,,Source and Machine Code}. +including any operands. For convenience, especially when used with +the @code{display} command, the @samp{i} format also prints branch delay +slot instructions, if any, beyond the count specified, which immediately +follow the last instruction that is within the count. The command +@code{disassemble} gives an alternative way of inspecting machine +instructions; see @ref{Machine Code,,Source and Machine Code}. All the defaults for the arguments to @code{x} are designed to make it easy to continue scanning memory with minimal specifications each time diff --git a/gdb/gdbtk/ChangeLog b/gdb/gdbtk/ChangeLog index f8888c20bdc..8029303c9a5 100644 --- a/gdb/gdbtk/ChangeLog +++ b/gdb/gdbtk/ChangeLog @@ -1,3 +1,8 @@ +2007-06-21 Maciej W. Rozycki <macro@mips.com> + + * generic/gdbtk-cmds.c (gdbtk_load_asm): Update the call to + gdb_print_insn(). + 2007-06-09 Keith Seitz <keiths@redhat.com> * generic/gdbtk-register.c get_register): Replace REGISTER_NAME diff --git a/gdb/gdbtk/generic/gdbtk-cmds.c b/gdb/gdbtk/generic/gdbtk-cmds.c index ad05956c602..f95b07f9f40 100644 --- a/gdb/gdbtk/generic/gdbtk-cmds.c +++ b/gdb/gdbtk/generic/gdbtk-cmds.c @@ -1895,7 +1895,7 @@ gdbtk_load_asm (ClientData clientData, CORE_ADDR pc, result_ptr->obj_ptr = client_data->result_obj[2]; /* FIXME: cagney/2003-09-08: This should use gdb_disassembly. */ - insn = gdb_print_insn (pc, gdb_stdout); + insn = gdb_print_insn (pc, gdb_stdout, NULL); gdb_flush (gdb_stdout); client_data->widget_line_no++; diff --git a/gdb/printcmd.c b/gdb/printcmd.c index b03c65ea094..45d7e8afd03 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -70,6 +70,10 @@ static char last_size = 'w'; static CORE_ADDR next_address; +/* Number of delay instructions following current disassembled insn. */ + +static int branch_delay_insns; + /* Last address examined. */ static CORE_ADDR last_examine_address; @@ -277,8 +281,9 @@ print_formatted (struct value *val, int format, int size, /* We often wrap here if there are long symbolic names. */ wrap_here (" "); - next_address = VALUE_ADDRESS (val) - + gdb_print_insn (VALUE_ADDRESS (val), stream); + next_address = (VALUE_ADDRESS (val) + + gdb_print_insn (VALUE_ADDRESS (val), stream, + &branch_delay_insns)); break; default: @@ -800,6 +805,10 @@ do_examine (struct format_data fmt, CORE_ADDR addr) release_value (last_examine_value); print_formatted (last_examine_value, format, size, gdb_stdout); + + /* Display any branch delay slots following the final insn. */ + if (format == 'i' && count == 1) + count += branch_delay_insns; } printf_filtered ("\n"); gdb_flush (gdb_stdout); diff --git a/gdb/tui/tui-disasm.c b/gdb/tui/tui-disasm.c index e7bf2d13758..a256b5ab534 100644 --- a/gdb/tui/tui-disasm.c +++ b/gdb/tui/tui-disasm.c @@ -72,7 +72,7 @@ tui_disassemble (struct tui_asm_line* asm_lines, CORE_ADDR pc, int count) ui_file_rewind (gdb_dis_out); - pc = pc + gdb_print_insn (pc, gdb_dis_out); + pc = pc + gdb_print_insn (pc, gdb_dis_out, NULL); asm_lines->insn = xstrdup (tui_file_get_strbuf (gdb_dis_out)); |