Bug 15026 - addr2line pretty-print for unknown symbols
Summary: addr2line pretty-print for unknown symbols
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: binutils (show other bugs)
Version: 2.23
: P2 enhancement
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-01-17 14:37 UTC by dhekir
Modified: 2013-01-18 13:14 UTC (History)
1 user (show)

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


Attachments
When pretty printing print unknown function names on the same line as unknown file names. (294 bytes, patch)
2013-01-18 11:40 UTC, Nick Clifton
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description dhekir 2013-01-17 14:37:37 UTC
addr2line, when used with options -f and -p combined, does not output a single line for unknown symbols. Instead, it outputs two lines:

??
??:0

Which is in contrast with the output of other symbols (in a single line).

The man page does not precisely define this behavior:

"If the -p option is used then the output for each input address is displayed on one, possibly quite long, line.  If -p is not used then the output is broken up into multiple lines, based on the paragraphs above."

"If the file name or function name can not be determined, addr2line will print two question marks in their place.  If the line number can not be determined, addr2line will print 0."

However, this is quite annoying when producing scripts, since the unknown symbol is the only exception that requires a particular processing. It seems it would be more coherent to only output a single line containing "??:0" in this case.
Comment 1 Nick Clifton 2013-01-18 11:40:39 UTC
Created attachment 6822 [details]
When pretty printing print unknown function names on the same line as unknown file names.
Comment 2 Nick Clifton 2013-01-18 11:41:38 UTC
Hi,

  I have uploaded a potential patch to fix this behaviour.  Please let me know if you are happy with it, and if so, I will check the patch in.

Cheers
  Nick
Comment 3 dhekir 2013-01-18 12:23:39 UTC
Perfect, for me it's fine! Thanks!
Comment 4 Sourceware Commits 2013-01-18 13:14:44 UTC
CVSROOT:	/cvs/src
Module name:	src
Changes by:	nickc@sourceware.org	2013-01-18 13:14:35

Modified files:
	binutils       : ChangeLog addr2line.c 

Log message:
	PR binutils/15026
	* addr2line.c (translate_addresses): When pretty printing, print
	unknown function names on the same line as unknown symbol names.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/binutils/ChangeLog.diff?cvsroot=src&r1=1.1976&r2=1.1977
http://sourceware.org/cgi-bin/cvsweb.cgi/src/binutils/addr2line.c.diff?cvsroot=src&r1=1.42&r2=1.43