Bug 21235 - The filename and the full path are truncated in "objdump --dwarf=decodedline --wide"
Summary: The filename and the full path are truncated in "objdump --dwarf=decodedline ...
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: binutils (show other bugs)
Version: 2.29
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-03-08 16:53 UTC by fcamel
Modified: 2017-03-10 16:35 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments
The patch which fixes the reported bug. (235 bytes, patch)
2017-03-08 16:53 UTC, fcamel
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description fcamel 2017-03-08 16:53:27 UTC
Created attachment 9886 [details]
The patch which fixes the reported bug.

When the filename or the full path is too long, "objdump --dwarf=decodedline"
truncates the filename or the full path. In theory, "--wide" should prevent the
truncation. However, that doesn't work. 
Btw, "readelf --debug-dump=decodedline" works well with "--wide".

Here is the example of output:

$ binutils/readelf --debug-dump=decodedline --wide ~/dev/tmp/a.out
Decoded dump of debug contents of section .debug_line:

CU: my_very_very_very_very_very_very_very_very_long.c:
File name                            Line number    Starting address
my_very_very_very_very_very_very_very_very_long.c            3            0x4004ed
my_very_very_very_very_very_very_very_very_long.c            4            0x4004f1
my_very_very_very_very_very_very_very_very_long.c            5            0x4004f6

$ binutils/objdump --dwarf=decodedline --wide ~/dev/tmp/a.out

/home/fcamel/dev/tmp/a.out:     file format elf64-x86-64

Decoded dump of debug contents of section .debug_line:

CU: my_very_very_very_very_very_very_very_very_long.c:
File name                            Line number    Starting address
ery_very_very_very_very_very_long.c            3            0x4004ed
ery_very_very_very_very_very_long.c            4            0x4004f1
ery_very_very_very_very_very_long.c            5            0x4004f6


The attachment is a patch to fix this issue. After applying the patch:

$ binutils/objdump --dwarf=decodedline --wide ~/dev/tmp/a.out

/home/fcamel/dev/tmp/a.out:     file format elf64-x86-64

Decoded dump of debug contents of section .debug_line:

CU: my_very_very_very_very_very_very_very_very_long.c:
File name                            Line number    Starting address
my_very_very_very_very_very_very_very_very_long.c            3            0x4004ed
my_very_very_very_very_very_very_very_very_long.c            4            0x4004f1
my_very_very_very_very_very_very_very_very_long.c            5            0x4004f6
Comment 1 fcamel 2017-03-08 16:57:42 UTC
Forgot to mention my testing revision: 15c22686d0e33d87262bc9075296eeddd7d955f7
Comment 2 Sourceware Commits 2017-03-10 16:31:15 UTC
The master branch has been updated by Nick Clifton <nickc@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=7b5d48229b7faa16f69e87fb269f17db0291d89f

commit 7b5d48229b7faa16f69e87fb269f17db0291d89f
Author: Chia-Hao Lo <fcamel@gmail.com>
Date:   Fri Mar 10 16:29:58 2017 +0000

    Make objdump's --wide command line option affect its output of DWARF debug information.
    
    	PR binutils/21235
    	* objdump.c (main): Set do_wide with --wide.
Comment 3 Nick Clifton 2017-03-10 16:35:01 UTC
Hi Chia-Hao,

  Thanks for the bug report and patch.  I have applied your patch the sources and added a changelog entry as well.

Cheers
  Nick