[PATCH] more output from remote-sim dump_mem

Mike Frysinger vapier@gentoo.org
Tue Oct 2 21:20:00 GMT 2012


On Tuesday 02 October 2012 17:07:07 Andrew Burgess wrote:
> static void
>  dump_mem (char *buf, int len)
>  {
> -  if (len <= 8)
> +  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 ("\t0x%08x", l[0]);
> +      if (len == 8)
> +	printf_filtered (" 0x%08x", l[1]);
> +      printf_filtered ("\n");
> +    }
> +  else
> +    {
> +      int i;
> 
> -	  printf_filtered ("\t");
> -	  for (i = 0; i < len; i++)
> -	    printf_filtered ("0x%x ", buf[i]);
> -	  printf_filtered ("\n");
> -	}
> +      printf_filtered ("\t");
> +      for (i = 0; i < len; i++)
> +	printf_filtered ("0x%02x ", buf[i]);
> +      printf_filtered ("\n");
>      }
>  }

you could hoist the \t printf to the top and \n to the bottom and keep the 
center focused on the 0x output.

looks OK either way.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20121002/eb0a0fd3/attachment.sig>


More information about the Gdb-patches mailing list