1a85fe12eSEd Maste.\" Copyright (c) 2009,2010 Joseph Koshy <jkoshy@users.sourceforge.net> 2a85fe12eSEd Maste.\" All rights reserved. 3a85fe12eSEd Maste.\" 4a85fe12eSEd Maste.\" Redistribution and use in source and binary forms, with or without 5a85fe12eSEd Maste.\" modification, are permitted provided that the following conditions 6a85fe12eSEd Maste.\" are met: 7a85fe12eSEd Maste.\" 1. Redistributions of source code must retain the above copyright 8a85fe12eSEd Maste.\" notice, this list of conditions and the following disclaimer 9a85fe12eSEd Maste.\" in this position and unchanged. 10a85fe12eSEd Maste.\" 2. Redistributions in binary form must reproduce the above copyright 11a85fe12eSEd Maste.\" notice, this list of conditions and the following disclaimer in the 12a85fe12eSEd Maste.\" documentation and/or other materials provided with the distribution. 13a85fe12eSEd Maste.\" 14a85fe12eSEd Maste.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR 15a85fe12eSEd Maste.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16a85fe12eSEd Maste.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17a85fe12eSEd Maste.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 18a85fe12eSEd Maste.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19a85fe12eSEd Maste.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20a85fe12eSEd Maste.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21a85fe12eSEd Maste.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22a85fe12eSEd Maste.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23a85fe12eSEd Maste.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24a85fe12eSEd Maste.\" 25*ae500c1fSEd Maste.\" $Id: addr2line.1 3642 2018-10-14 14:24:28Z jkoshy $ 26a85fe12eSEd Maste.\" 2795fd7f26SEd Maste.Dd November 30, 2015 28a85fe12eSEd Maste.Dt ADDR2LINE 1 29*ae500c1fSEd Maste.Os 30a85fe12eSEd Maste.Sh NAME 31a85fe12eSEd Maste.Nm addr2line 32a85fe12eSEd Maste.Nd translate program addresses to source file names and line numbers 33a85fe12eSEd Maste.Sh SYNOPSIS 34a85fe12eSEd Maste.Nm 3595fd7f26SEd Maste.Op Fl a | Fl -addresses 36a85fe12eSEd Maste.Op Fl b Ar target | Fl -target Ns = Ns Ar target 37a85fe12eSEd Maste.Op Fl e Ar pathname | Fl -exe Ns = Ns Ar pathname 38a85fe12eSEd Maste.Op Fl f | Fl -functions 3995fd7f26SEd Maste.Op Fl i | Fl -inlines 40a85fe12eSEd Maste.Op Fl j Ar sectionname | Fl -section Ns = Ns Ar sectionname 4195fd7f26SEd Maste.Op Fl p | Fl -pretty-print 42a85fe12eSEd Maste.Op Fl s | Fl -basename 43a85fe12eSEd Maste.Op Fl C | Fl -demangle 44a85fe12eSEd Maste.Op Fl H | Fl -help 45a85fe12eSEd Maste.Op Fl V | Fl -version 46a85fe12eSEd Maste.Op Ar hexaddress Ns ... 47a85fe12eSEd Maste.Sh DESCRIPTION 48a85fe12eSEd MasteThe 49a85fe12eSEd Maste.Nm 50a85fe12eSEd Masteutility translates program addresses specified by the command line 51a85fe12eSEd Mastearguments 52a85fe12eSEd Maste.Ar hexaddress 53a85fe12eSEd Masteto their corresponding source file names and line numbers. 54a85fe12eSEd MasteIf no arguments are given to 55a85fe12eSEd Maste.Nm , 56a85fe12eSEd Masteit will read these addresses from standard input. 57a85fe12eSEd Maste.Pp 58a85fe12eSEd MasteProgram addresses specified by arguments 59a85fe12eSEd Maste.Ar hexaddress 60a85fe12eSEd Masteare encoded using the conventions accepted by 61a85fe12eSEd Maste.Xr strtoull 3 . 62a85fe12eSEd Maste.Pp 63a85fe12eSEd MasteBy default, 64a85fe12eSEd Maste.Nm 65a85fe12eSEd Mastewill use the executable 66a85fe12eSEd Maste.Dq Pa a.out . 67a85fe12eSEd MasteThe 68a85fe12eSEd Maste.Fl e 69a85fe12eSEd Masteoption may be used to specified a different ELF object. 70a85fe12eSEd Maste.Pp 71a85fe12eSEd MasteThe 72a85fe12eSEd Maste.Nm 73a85fe12eSEd Masteutility recognizes the following options: 74a85fe12eSEd Maste.Bl -tag -width indent 7595fd7f26SEd Maste.It Fl a | Fl -addresses 7695fd7f26SEd MasteDisplay the address prior to the line number information. 77a85fe12eSEd Maste.It Fl b Ar target | Fl -target Ns = Ns Ar target 78a85fe12eSEd MasteThis option is recognized by 79a85fe12eSEd Maste.Nm 80a85fe12eSEd Mastebut is ignored. 81a85fe12eSEd MasteIt is supported for compatibility with GNU binutils. 82a85fe12eSEd Maste.It Fl e Ar pathname | Fl -exe Ns = Ns Ar pathname 83a85fe12eSEd MasteUse the ELF object specified by argument 84a85fe12eSEd Maste.Ar pathname 85a85fe12eSEd Masteto translate addresses. 86a85fe12eSEd MasteIf this option is not specified, 87a85fe12eSEd Maste.Nm 88a85fe12eSEd Mastewill use the file 89a85fe12eSEd Maste.Dq Pa a.out . 90a85fe12eSEd Maste.It Fl f | Fl -functions 91a85fe12eSEd MasteDisplay function names in addition to file and line number information. 9295fd7f26SEd Maste.It Fl i | Fl -inlines 9395fd7f26SEd MasteIf the address specified belongs to an inlined function, also display the line 9495fd7f26SEd Mastenumber information for its caller, recursively until the first non-inlined 9595fd7f26SEd Mastecaller. 96a85fe12eSEd Maste.It Fl j Ar sectionname | Fl -section Ns = Ns Ar sectionname 97a85fe12eSEd MasteThe values specified by arguments 98a85fe12eSEd Maste.Ar hexaddress 99a85fe12eSEd Masteare to be treated as offsets into the section named 100a85fe12eSEd Maste.Ar sectionname . 10195fd7f26SEd Maste.It Fl p | -pretty-print 10295fd7f26SEd MasteDisplay the line number information on one line, in human readable manner. 103a85fe12eSEd Maste.It Fl s | -basename 104a85fe12eSEd MasteDisplay only the base name for each file name. 105a85fe12eSEd Maste.It Fl C | Fl -demangle 106a85fe12eSEd MasteDemangle C++ names. 107a85fe12eSEd Maste.It Fl H | Fl -help 108a85fe12eSEd MastePrint a help message. 109a85fe12eSEd Maste.It Fl V | Fl -version 110a85fe12eSEd MastePrint a version identifier and exit. 111a85fe12eSEd Maste.El 112a85fe12eSEd Maste.Sh OUTPUT FORMAT 113a85fe12eSEd MasteIf the 114a85fe12eSEd Maste.Fl f 115a85fe12eSEd Masteoption was not specified, 116a85fe12eSEd Maste.Nm 117a85fe12eSEd Mastewill print the file name and line number for each address specified 118a85fe12eSEd Masteon a separate line. 119a85fe12eSEd Maste.Pp 120a85fe12eSEd MasteIf the 121a85fe12eSEd Maste.Fl f 122a85fe12eSEd Masteoption was specified, 123a85fe12eSEd Maste.Nm 124a85fe12eSEd Mastewill print a line containing the name of the function corresponding 125a85fe12eSEd Masteto program address 126a85fe12eSEd Maste.Ar hexaddress , 127a85fe12eSEd Mastefollowed by a line with the file name and line number. 128a85fe12eSEd Maste.Pp 12995fd7f26SEd MasteIf the 13095fd7f26SEd Maste.Fl p 13195fd7f26SEd Masteoption was specified, 13295fd7f26SEd Maste.Nm 13395fd7f26SEd Mastewill print line number information and function name on one line in 13495fd7f26SEd Mastehuman readable manner. If the 13595fd7f26SEd Maste.Fl i 13695fd7f26SEd Masteoption was also specified, 13795fd7f26SEd Maste.Nm 13895fd7f26SEd Mastewill print the caller function information prefixed with 13995fd7f26SEd Maste.Dq (inlined by) . 14095fd7f26SEd Maste.Pp 141a85fe12eSEd MasteThe 142a85fe12eSEd Maste.Nm 143a85fe12eSEd Masteutility prints the file name and line number using the format 144a85fe12eSEd Maste.Dq FILENAME:LINENUMBER . 145a85fe12eSEd Maste.Pp 146a85fe12eSEd MasteIf a file or function name could not be determined, 147a85fe12eSEd Maste.Nm 148a85fe12eSEd Mastewill print a question mark in their place. 149a85fe12eSEd MasteIf the line number could not be determined, 150a85fe12eSEd Maste.Nm 151a85fe12eSEd Mastewill print a zero in its place. 152a85fe12eSEd Maste.Sh EXAMPLES 153a85fe12eSEd MasteTo map address 080483c4 in the default executable 154a85fe12eSEd Maste.Pa a.out 155a85fe12eSEd Masteto a source file name and line number use: 156a85fe12eSEd Maste.D1 "% addr2line 080483c4" 157a85fe12eSEd Maste.Pp 158a85fe12eSEd MasteTo map address 080483c4 in executable 159a85fe12eSEd Maste.Pa helloworld , 160a85fe12eSEd Masteuse: 161a85fe12eSEd Maste.D1 "% addr2line -e helloworld 080483c4" 162a85fe12eSEd Maste.Pp 163a85fe12eSEd MasteTo have 164a85fe12eSEd Maste.Nm 165a85fe12eSEd Masteact as a filter reading addresses from its standard input use: 166a85fe12eSEd Maste.D1 "% addr2line" 167a85fe12eSEd Maste.Pp 168a85fe12eSEd MasteTo print the function name corresponding to an address in addition to 169a85fe12eSEd Masteits source file and line number use: 170a85fe12eSEd Maste.D1 "% addr2line -f 080483c4" 171a85fe12eSEd Maste.Sh EXIT STATUS 172a85fe12eSEd Maste.Ex -std 173a85fe12eSEd Maste.Sh SEE ALSO 174a85fe12eSEd Maste.Xr nm 1 , 175a85fe12eSEd Maste.Xr elfdump 1 , 176a85fe12eSEd Maste.Xr elfcopy 1 , 177a85fe12eSEd Maste.Xr strtoull 3 178a85fe12eSEd Maste.Sh AUTHORS 179a85fe12eSEd MasteThe 180a85fe12eSEd Maste.Nm 181a85fe12eSEd Masteutility was written by 182b00fe64fSEd Maste.An Kai Wang Aq Mt kaiwang27@users.sourceforge.net . 183