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 2/24/17 9:06 AM, Pedro Alves wrote:
> On 02/24/2017 04:58 AM, Peter Bergner wrote:
>> 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....

Well that uses 66 without the length of the option we're printing,
while this code includes the length of the option we're printing,
so it can be more accurate.  But...


> 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.

I didn't realize that fprintf_filtered could wrap the output itself.
It does simplify things, so how about using the following loop to
print out the options (for arches without descriptions) instead?
I can confirm the output wraps nicely.

Peter

  if (valid_options->description != NULL)
    {
      ...
    }
  else
    {
      size_t i;
      fprintf_filtered (file, "  ");
      for (i = 0; valid_options->name[i] != NULL; i++)
        {
          fprintf_filtered (file, "%s", valid_options->name[i]);
          if (valid_options->name[i+1] != NULL)
            fprintf_filtered (file, ", ");
          wrap_here ("  ");
        }
      fprintf_filtered (file, "\n");
    }


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