This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] more output from remote-sim dump_mem


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

Attachment: signature.asc
Description: This is a digitally signed message part.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]