From 3d468296579d30fe915b067fc21c108033804095 Mon Sep 17 00:00:00 2001 From: Andrew Burgess Date: Tue, 2 Oct 2012 21:52:43 +0000 Subject: [PATCH] http://sourceware.org/ml/gdb-patches/2012-10/msg00027.html gdb/ChangeLog * remote-sim.c (dump_mem): Always dump buffer contents, zero fill output and use uint32_t not long to ensure 4 byte size. --- gdb/ChangeLog | 5 +++++ gdb/remote-sim.c | 34 ++++++++++++++++------------------ 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 0333167..abb5449 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2012-10-02 Andrew Burgess + + * remote-sim.c (dump_mem): Always dump buffer contents, zero fill + output and use uint32_t not long to ensure 4 byte size. + 2012-10-02 Joel Brobecker * rs6000-nat.c (add_vmap): Set "last" to "next" after having diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c index d87f668..14e989c 100644 --- a/gdb/remote-sim.c +++ b/gdb/remote-sim.c @@ -273,28 +273,26 @@ sim_inferior_data_cleanup (struct inferior *inf, void *data) static void dump_mem (char *buf, int len) { - if (len <= 8) + printf_filtered ("\t"); + + if (len == 8 || len == 4) { - if (len == 8 || len == 4) - { - long l[2]; + uint32_t l[2]; - memcpy (l, buf, len); - printf_filtered ("\t0x%lx", l[0]); - if (len == 8) - printf_filtered (" 0x%lx", l[1]); - printf_filtered ("\n"); - } - else - { - int i; + memcpy (l, buf, len); + printf_filtered ("0x%08x", l[0]); + if (len == 8) + printf_filtered (" 0x%08x", l[1]); + } + else + { + int i; - printf_filtered ("\t"); - for (i = 0; i < len; i++) - printf_filtered ("0x%x ", buf[i]); - printf_filtered ("\n"); - } + for (i = 0; i < len; i++) + printf_filtered ("0x%02x ", buf[i]); } + + printf_filtered ("\n"); } /* Initialize gdb_callback. */ -- 2.7.4