public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Peter Bergner <bergner@vnet.ibm.com>
Cc: gdb-patches@sourceware.org, Yao Qi <qiyaoltc@gmail.com>,
	       Alan Modra <amodra@gmail.com>,
	Ulrich Weigand <uweigand@de.ibm.com>,
	       binutils <binutils@sourceware.org>
Subject: Re: [PATCH, v17] Add support for setting disassembler-options in GDB for POWER, ARM and S390
Date: Fri, 24 Feb 2017 15:06:00 -0000	[thread overview]
Message-ID: <46d6c25a-3d33-8e2a-043a-b46ae004d8b3@redhat.com> (raw)
In-Reply-To: <98f0a8a0-ed6d-10b6-08be-2dd86cc7af44@vnet.ibm.com>

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

  reply	other threads:[~2017-02-24 15:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-22 21:23 Peter Bergner
2017-02-23 12:26 ` Pedro Alves
2017-02-24  4:58   ` Peter Bergner
2017-02-24 15:06     ` Pedro Alves [this message]
2017-02-24 17:13       ` Peter Bergner
2017-02-24 17:25         ` Pedro Alves
2017-02-24 17:28           ` Peter Bergner
2017-02-28 11:24             ` Yao Qi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=46d6c25a-3d33-8e2a-043a-b46ae004d8b3@redhat.com \
    --to=palves@redhat.com \
    --cc=amodra@gmail.com \
    --cc=bergner@vnet.ibm.com \
    --cc=binutils@sourceware.org \
    --cc=gdb-patches@sourceware.org \
    --cc=qiyaoltc@gmail.com \
    --cc=uweigand@de.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).