This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
host dependency in remote-sim's debug output (was: Re: [COMMIT PATCH] remote-sim.c: Send debug output to gdb_stdlog.)
- From: Pedro Alves <palves at redhat dot com>
- To: gdb-patches at sourceware dot org
- Date: Fri, 06 Sep 2013 19:36:54 +0100
- Subject: host dependency in remote-sim's debug output (was: Re: [COMMIT PATCH] remote-sim.c: Send debug output to gdb_stdlog.)
- Authentication-results: sourceware.org; auth=none
- References: <20130906182949 dot 28085 dot 54947 dot stgit at brno dot lan>
On 09/06/2013 07:29 PM, Pedro Alves wrote:
> --- a/gdb/remote-sim.c
> +++ b/gdb/remote-sim.c
> @@ -271,26 +271,26 @@ sim_inferior_data_cleanup (struct inferior *inf, void *data)
> static void
> dump_mem (const gdb_byte *buf, int len)
> {
> - printf_filtered ("\t");
> + fputs_unfiltered ("\t", gdb_stdlog);
>
> if (len == 8 || len == 4)
> {
> uint32_t l[2];
>
> memcpy (l, buf, len);
> - printf_filtered ("0x%08x", l[0]);
> + fprintf_unfiltered (gdb_stdlog, "0x%08x", l[0]);
> if (len == 8)
> - printf_filtered (" 0x%08x", l[1]);
> + fprintf_unfiltered (gdb_stdlog, " 0x%08x", l[1]);
> }
BTW, I noticed there's a host endianness dependency here...
This is dumping memory with a space at every 4 bytes, instead
of a space after each byte (to make it pretty?), but then it only
does that of len is 4 or 8, so it could also be trying to
interpret the bytes as 32-bit target integers, in which case it
should be looking at the target's endianness...
> else
> {
> int i;
>
> for (i = 0; i < len; i++)
> - printf_filtered ("0x%02x ", buf[i]);
> + fprintf_unfiltered (gdb_stdlog, "0x%02x ", buf[i]);
> }
>
> - printf_filtered ("\n");
> + fputs_unfiltered ("\n", gdb_stdlog);
> }
--
Pedro Alves