This is the mail archive of the binutils@sourceware.org mailing list for the binutils 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: The "-W|--wide" option?


On 9/26/2011 11:22 AM, Nick Clifton wrote:
> You are presumably considering altering the default output of one or
> more of these tools.  Adding new, non-default, command line options
> to improve or change the formatting of the output is OK.  Why is this
> important to you ?

I apologize, I failed to clearly explain the problem.

In the course of fixing one or more bugs in the dwarf display
code (there is one in the example below that someone should
be submitting at some point) we noticed that  some of the 
do_wide checks were not quite accurate.

However, without a clear statement about *what* to do with
long lines, the correct fix is unclear.

To give a concrete example:

~~~ binutils/dwarf.c (display_debug_lines_decided) ~~~
...
          /* Print the Compilation Unit's name and a header.  */
          if (directory_table == NULL)
            {
              printf (_("CU: %s:\n"), file_table[0].name);
              printf (_("File name                            Line number    Starting address\n"));
            }
          else
            {
              if (do_wide || strlen ((char *) directory_table[0]) < 76)
                printf (_("CU: %s/%s:\n"), directory_table[0],
                        file_table[0].name);
              else
                printf ("%s:\n", file_table[0].name);

              printf (_("File name                            Line number    Starting address\n"));
            }
...
~~~

Say directory_table[0] is 75, the printf is at least 81,
that's assuming the second %s is null, and it's not likely
to be null because it's the file name. Therefore this is
a non-wide printout exceeding 80 columns.

It was suggested that asprintf could be used to construct 
the string check the length and *then* make the 
narrow/wide choice.

However, in hindsight it would appear that the choice itself
is part of the output "ABI" and consumers which previously
expected a full filename output would then only get the
short version.

The manual page isn't strictly clear about the default
behaviour when -W is not in effect.

How strict are we going to be? Must this code remain as-is?

Cheers,
Carlos.
-- 
Carlos O'Donell
Mentor Graphics / CodeSourcery
carlos@codesourcery.com
+1 (613) 963 1026


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