summaryrefslogtreecommitdiff
path: root/gdb/remote-sim.c
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
commit5ba68fd23f49d8e775c7ade5ab9b38ae1aff54f4 (patch)
tree7402c59da36d95571442808d4204d2b7f781ca21 /gdb/remote-sim.c
parent4074c648c2897e318e5fd2ace9ea7b7818a38280 (diff)
downloadgdb-5ba68fd23f49d8e775c7ade5ab9b38ae1aff54f4.tar.gz
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.
Diffstat (limited to 'gdb/remote-sim.c')
-rw-r--r--gdb/remote-sim.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c
index d534e566be8..49e2581bb20 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