This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Adjust formatting of "display" disassembly
- From: "Maciej W. Rozycki" <macro at mips dot com>
- To: gdb-patches at sourceware dot org
- Cc: Chris Dearman <chris at mips dot com>, "Maciej W. Rozycki" <macro at linux-mips dot org>
- Date: Fri, 18 May 2007 17:07:55 +0100 (BST)
- Subject: Adjust formatting of "display" disassembly
Hello,
Here is a patch that complements the change for the automatic disassembly
of branch delay slots -- it affects the "display" command and changes the
output from one like this:
(gdb) display /i $pc
1: x/i $pc 0x413020 <_ftext>: move zero,ra
(gdb) stepi
0x00413024 in _ftext ()
1: x/i $pc 0x413024 <_ftext+4>: bal 0x41302c <_ftext+12>
0x413028 <_ftext+8>: nop
to one like this:
(gdb) display /i $pc
1: x/i $pc
0x413020 <_ftext>: move zero,ra
(gdb) stepi
0x00413024 in _ftext ()
1: x/i $pc
0x413024 <_ftext+4>: bal 0x41302c <_ftext+12>
0x413028 <_ftext+8>: nop
This change has been tested natively for mips-unknown-linux-gnu and
remotely for mipsisa32-sde-elf, using mips-sim-sde32/-EB and
mips-sim-sde32/-EL as the targets, with no regressions.
gdb/:
2007-05-18 Chris Dearman <chris@mips.com>
* printcmd.c (do_one_display): If display/i, start with an initial
line feed to avoid bad layout if there is a branch delay slot.
gdb/testsuite/:
2007-05-18 Chris Dearman <chris@mips.com>
Maciej W. Rozycki <macro@mips.com>
* gdb.base/display.exp: Allow a newline after display/i.
* gdb.base/pc-fp.exp: Likewise.
* gdb.base/sigbpt.exp: Likewise.
OK to apply?
Maciej
12237.diff
Index: binutils-quilt/src/gdb/printcmd.c
===================================================================
--- binutils-quilt.orig/src/gdb/printcmd.c 2007-05-17 13:17:50.000000000 +0100
+++ binutils-quilt/src/gdb/printcmd.c 2007-05-17 13:18:26.000000000 +0100
@@ -1527,7 +1527,7 @@
print_expression (d->exp, gdb_stdout);
annotate_display_expression_end ();
- if (d->format.count != 1)
+ if (d->format.count != 1 || d->format.format == 'i')
printf_filtered ("\n");
else
printf_filtered (" ");
Index: binutils-quilt/src/gdb/testsuite/gdb.base/display.exp
===================================================================
--- binutils-quilt.orig/src/gdb/testsuite/gdb.base/display.exp 2007-05-17 12:52:34.000000000 +0100
+++ binutils-quilt/src/gdb/testsuite/gdb.base/display.exp 2007-05-17 13:18:26.000000000 +0100
@@ -95,7 +95,7 @@
gdb_test "info disp" ".*There are no auto-display expressions now..*" "inf disp"
gdb_test "disp i" ".*1: i = 0.*" "display i"
gdb_test "disp/x j" ".*2: /x j = 0x0.*" "display j"
-gdb_test "disp/i &k" ".*3: x/i &k $hex:.*" "display &k"
+gdb_test "disp/i &k" ".*3: x/i &k(\r\n| )$hex:.*" "display &k"
gdb_test "disp/f f" ".*4: /f f = 3.1415*" "display/f f"
gdb_test "disp/s &sum" ".*5: x/s &sum $hex.*sum.:.*" "display/s &sum"
Index: binutils-quilt/src/gdb/testsuite/gdb.base/pc-fp.exp
===================================================================
--- binutils-quilt.orig/src/gdb/testsuite/gdb.base/pc-fp.exp 2007-05-17 12:52:34.000000000 +0100
+++ binutils-quilt/src/gdb/testsuite/gdb.base/pc-fp.exp 2007-05-17 13:18:26.000000000 +0100
@@ -82,7 +82,7 @@
# display since that encodes and then decodes the expression parameter
# (and hence uses the mechanisms we're trying to test).
-gdb_test "display/i \$pc" "1: x/i +\\\$pc +${valueof_pc}.*"
+gdb_test "display/i \$pc" "1: x/i +\\\$pc( +|\r\n)${valueof_pc}.*"
gdb_test "display/w \$fp" "2: x/xw +\\\$fp +${valueof_fp}.*"
# FIXME: cagney/2002-09-04: Should also check that ``info registers
Index: binutils-quilt/src/gdb/testsuite/gdb.base/sigbpt.exp
===================================================================
--- binutils-quilt.orig/src/gdb/testsuite/gdb.base/sigbpt.exp 2007-05-17 13:17:51.000000000 +0100
+++ binutils-quilt/src/gdb/testsuite/gdb.base/sigbpt.exp 2007-05-17 13:18:26.000000000 +0100
@@ -91,12 +91,12 @@
gdb_test "advance *bowler" "bowler.*" "advance to the bowler"
set test "stepping to SIGSEGV"
gdb_test_multiple "stepi" "$test" {
- -re "Program received signal SIGSEGV.*pc *(0x\[0-9a-f\]*).*$gdb_prompt $" {
- set segv_addr $expect_out(1,string)
+ -re "Program received signal SIGSEGV.*pc(\r\n| *) *(0x\[0-9a-f\]*).*$gdb_prompt $" {
+ set segv_addr $expect_out(2,string)
pass "$test"
}
- -re " .*pc *(0x\[0-9a-f\]*).*bowler.*$gdb_prompt $" {
- set bowler_addrs [concat $expect_out(1,string) $bowler_addrs]
+ -re " .*pc(\r\n| *)(0x\[0-9a-f\]*).*bowler.*$gdb_prompt $" {
+ set bowler_addrs [concat $expect_out(2,string) $bowler_addrs]
send_gdb "stepi\n"
exp_continue
}
@@ -183,19 +183,19 @@
-re "Program received signal SIGSEGV.*$gdb_prompt $" {
kfail gdb/1702 "$test (executed fault insn)"
}
- -re "Breakpoint.*pc *[at_segv] .*bowler.*$gdb_prompt $" {
+ -re "Breakpoint.*pc(\r\n| *)[at_segv] .*bowler.*$gdb_prompt $" {
pass "$test (at breakpoint)"
}
- -re "Breakpoint.*pc *[after_segv] .*bowler.*$gdb_prompt $" {
+ -re "Breakpoint.*pc(\r\n| *)[after_segv] .*bowler.*$gdb_prompt $" {
kfail gdb/1702 "$test (executed breakpoint)"
}
- -re "pc *[at_segv] .*bowler.*$gdb_prompt $" {
+ -re "pc(\r\n| *)[at_segv] .*bowler.*$gdb_prompt $" {
pass "$test"
}
- -re "pc *[after_segv] .*bowler.*$gdb_prompt $" {
+ -re "pc(\r\n| *)[after_segv] .*bowler.*$gdb_prompt $" {
kfail gdb/1702 "$test (skipped fault insn)"
}
- -re "pc *0x\[a-z0-9\]* .*bowler.*$gdb_prompt $" {
+ -re "pc(\r\n| *)0x\[a-z0-9\]* .*bowler.*$gdb_prompt $" {
kfail gdb/1702 "$test (corrupt pc)"
}
}
@@ -239,12 +239,12 @@
# inserted at the faulting instruction. Note that the breakpoint
# instruction wasn't executed, rather the inferior was SIGTRAPed
# with the PC at the breakpoint.
- gdb_test "continue" "Breakpoint.*pc *[at_segv] .*" \
+ gdb_test "continue" "Breakpoint.*pc(\r\n| *)[at_segv] .*" \
"${name}; continue to breakpoint at fault"
# Now single step the faulted instrction at that breakpoint.
gdb_test "stepi" \
- "Program received signal SIGSEGV.*pc *[at_segv] .*" \
+ "Program received signal SIGSEGV.*pc(\r\n| *)[at_segv] .*" \
"${name}; stepi fault"
# Clear any breakpoints