aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2013-09-06 17:41:50 +0000
committerPedro Alves <palves@redhat.com>2013-09-06 17:41:50 +0000
commitfcde0081d9ab56137d740a528d2c833998b18dba (patch)
tree06958ac9103d064e4c4e39cc0fab9dcec4ff2fea
parentfb71d39e8c2c323a523c7b608ffdc3e9c4276737 (diff)
downloadgdb-fcde0081d9ab56137d740a528d2c833998b18dba.zip
gdb-fcde0081d9ab56137d740a528d2c833998b18dba.tar.gz
gdb-fcde0081d9ab56137d740a528d2c833998b18dba.tar.bz2
remote-sim.c: cleanup debug output code.
Manually tested with a --target=arm-eabi build, and doing $ arm-eabi-gcc ~/gdb/tests/main.c -o a.out -c -g $ ./gdb a.out ... (gdb) tar sim (gdb) load (gdb) set debug remote 1 (gdb) disassemble 0 Dump of assembler code for function main: gdbsim_xfer_inferior_memory: myaddr 0x7fffffffd400, memaddr 0x0, len 4, write 0 0x00000000 <+0>: 0xe1a0c00d mov r12, sp gdbsim_xfer_inferior_memory: myaddr 0x7fffffffd400, memaddr 0x4, len 4, write 0 0x00000004 <+4>: 0xe92dd800 push {r11, r12, lr, pc} gdbsim_xfer_inferior_memory: myaddr 0x7fffffffd400, memaddr 0x8, len 4, write 0 0x00000008 <+8>: 0xe24cb004 sub r11, r12, #4 gdbsim_xfer_inferior_memory: myaddr 0x7fffffffd400, memaddr 0xc, len 4, write 0 0x0000000c <+12>: 0xe24dd008 sub sp, sp, #8 gdbsim_xfer_inferior_memory: myaddr 0x7fffffffd400, memaddr 0x10, len 4, write 0 0x00000010 <+16>: 0xe50b0010 str r0, [r11, #-16] gdbsim_xfer_inferior_memory: myaddr 0x7fffffffd400, memaddr 0x14, len 4, write 0 0x00000014 <+20>: 0xe50b1014 str r1, [r11, #-20] gdbsim_xfer_inferior_memory: myaddr 0x7fffffffd400, memaddr 0x18, len 4, write 0 0x00000018 <+24>: 0xe3a03000 mov r3, #0 gdbsim_xfer_inferior_memory: myaddr 0x7fffffffd400, memaddr 0x1c, len 4, write 0 0x0000001c <+28>: 0xe1a00003 mov r0, r3 gdbsim_xfer_inferior_memory: myaddr 0x7fffffffd400, memaddr 0x20, len 4, write 0 0x00000020 <+32>: 0xe24bd00c sub sp, r11, #12 gdbsim_xfer_inferior_memory: myaddr 0x7fffffffd400, memaddr 0x24, len 4, write 0 0x00000024 <+36>: 0xe89da800 ldm sp, {r11, sp, pc} End of assembler dump. (gdb) p *0 = 1 gdbsim_xfer_inferior_memory: myaddr 0xc69bc0, memaddr 0x0, len 4, write 1 0x00000001 $1 = 1 Which happens to differ from before, I think due to stdout line buffering: (gdb) disassemble 0 Dump of assembler code for function main: 0x00000000 <+0>: gdbsim_xfer_inferior_memory: myaddr 0x0x7fffffffd400, memaddr 0x0, len 4, write 0 0xe1a0c00d But the new output looks reasonable to me, better even. gdb/ 2013-09-06 Pedro Alves <palves@redhat.com> * remote-sim.c (gdbsim_xfer_inferior_memory): Use host_address_to_string, and send debug output to gdb_stdlog.
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/remote-sim.c17
2 files changed, 13 insertions, 9 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 2dddbf3..2c7b655 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2013-09-06 Pedro Alves <palves@redhat.com>
+
+ * remote-sim.c (gdbsim_xfer_inferior_memory): Use
+ host_address_to_string, and send debug output to gdb_stdlog.
+
2013-09-06 Ricard Wanderlof <ricardw@axis.com>
* Makefile.in (ALL_TARGET_OBS): Add cris-linux-tdep.o.
diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c
index d534e56..49e2581 100644
--- a/gdb/remote-sim.c
+++ b/gdb/remote-sim.c
@@ -1086,18 +1086,17 @@ gdbsim_xfer_inferior_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len,
gdb_assert (sim_data->gdbsim_desc != NULL);
if (remote_debug)
- {
- /* FIXME: Send to something other than STDOUT? */
- printf_filtered ("gdbsim_xfer_inferior_memory: myaddr 0x");
- gdb_print_host_address (myaddr, gdb_stdout);
- printf_filtered (", memaddr %s, len %d, write %d\n",
- paddress (target_gdbarch (), memaddr), len, write);
- if (remote_debug && write)
- dump_mem (myaddr, len);
- }
+ fprintf_unfiltered (gdb_stdlog,
+ "gdbsim_xfer_inferior_memory: myaddr %s, "
+ "memaddr %s, len %d, write %d\n",
+ host_address_to_string (myaddr),
+ paddress (target_gdbarch (), memaddr),
+ len, write);
if (write)
{
+ if (remote_debug && len > 0)
+ dump_mem (myaddr, len);
len = sim_write (sim_data->gdbsim_desc, memaddr, myaddr, len);
}
else