[PATCH, v17] Add support for setting disassembler-options in GDB for POWER, ARM and S390

Pedro Alves palves@redhat.com
Fri Feb 24 15:06:00 GMT 2017


On 02/24/2017 04:58 AM, Peter Bergner wrote:
>>> >> +      for (i = 0, col = 0; valid_options->name[i] != NULL; i++)
>>> >> +	{
>>> >> +	  /* Include the " " and "," we print below.  */
>>> >> +	  size_t len = strlen (valid_options->name[i]) + 2;
>>> >> +	  if (col + len > 80)
>> > 
>> > Is this 80 here supposed to be the screen width?  Do we
>> > really need this manual wrapping?
> The only architecture that uses this is the ppc arch and this mimics
> what print_ppc_disassembler_options() does.  We have ~60 options that
> we're emitting, so I think wrapping does make things more readable.

I see.  Well that uses 66 instead of 80, which is equally arbitrary....

The thing is that while print_ppc_disassembler_options is using
plain fprintf, the code in question in gdb is using fprintf_filtered
which knows the screen width, and wraps automatically when the line is
overflown, and knows to do that only when printing to the screen (and
not when the command is used in scripts where there's really no
screen width).

What you may want to do is call wrap_here between printing each option,
so that gdb automatically knows to break the line between options
if necessary, instead of in the middle of some option.

Thanks,
Pedro Alves



More information about the Gdb-patches mailing list