bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug binutils/25543] New: Wrong 'readelf -p' output


From: holger.hopp at sap dot com
Subject: [Bug binutils/25543] New: Wrong 'readelf -p' output
Date: Thu, 13 Feb 2020 11:29:24 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=25543

            Bug ID: 25543
           Summary: Wrong 'readelf -p' output
           Product: binutils
           Version: 2.34
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: binutils
          Assignee: unassigned at sourceware dot org
          Reporter: holger.hopp at sap dot com
  Target Milestone: ---

readelf -p should "display the contents of the indicated section as
printable strings" (manpage).
IMHO this includes also newline characters.
Unfortunately, binutils as of 2.25 prints ugly ^J instead of newline.
Additionally, some characters are cut off (in example xyz is missing).

Exapmple:

$ cat tst.c
static const char info[] __attribute__ ((section (".mysection"))) =
        "line1 : 1235\n"
        "line2 : 5678\n"
        "line3 : abcdefg\n"
        "line4 : hijklmnop\n"
        "line5 : qrstu\n"
        "line6 : vwxyz\n";

$ gcc -c tst.c -o tst.o
$ readelf -p .mysection tst.o

String dump of section '.mysection':
  [     0]  line1 : 1235^Jline2 : 5678^Jline3 : abcdefg^Jline4 :
hijklmnop^Jline5 : qrstu^Jline6 : vw

With old binutils-2.24 newline is printed well (better human readable).
Also the end of the string "xyz" is printed correctly.
$ readelf-2.24 -p .mysection tst.o

String dump of section '.mysection':
  [     0]  line1 : 1235
line2 : 5678
line3 : abcdefg
line4 : hijklmnop
line5 : qrstu
line6 : vwxyz


1. The length calculation should be fixed.
2. If the non-human-readable ^J is really necessary, then maybe an additional
option or an environment variable could help to have both ^J and newline output
available.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]