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, v17] Add support for setting disassembler-options in GDB for POWER, ARM and S390


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


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