summaryrefslogtreecommitdiffstats
path: root/doc/srcfiles.1
blob: c6338315e37ca12c4ce4240c0d03107f2ce23d12 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
.\" Copyright 2023 Red Hat Inc.
.\" Mon 2023-Sept 23 Housam Alamour <halamour@redhat.com>
.\" Contact elfutils-devel@sourceware.org to correct errors or typos.
.TH EU-SRCFILES 1 "2023-Sept-25" "elfutils"

.de SAMPLE
.br
.RS 0
.nf
.nh
\fB
..
.de ESAMPLE
\fP
.hy
.fi
.RE
..

.SH "NAME"
eu-srcfiles \- Lists the source files of a DWARF/ELF file.

.SH "SYNOPSIS"
eu-srcfiles [\fB\-0\fR|\fB\-\-null\fR] [\fB\-c\fR|\fB\-\-cu\-only\fR] [\fB\-v\fR|\fB\-\-verbose\fR] [\fB\-z\fR|\fB\-\-zip\fR] INPUT

.SH "DESCRIPTION"
\fBeu-srcfiles\fR lists all the source files of a given DWARF/ELF
file.  This list is based on a search of the DWARF debuginfo, which
may be automatically fetched by debuginfod if applicable.  The target
file may be an executable, a coredump, a process, or even the running
kernel.  The default input is the file 'a.out'.  The source file names are
made unique by prepending the full path name and then printed to standard output. The source files can be
placed in a zip file that is sent to stdout.

Note that all occurrences of '/./' and '/../' in the path name are canonicalized.

.SH "INPUT OPTIONS"
The long and short forms of options, shown here as alternatives, are
equivalent.
.TP
\fB--core=COREFILE\fR
Find addresses from signatures found in COREFILE.

.TP
\fB--debuginfo-path=PATH\fR
Search path for separate debuginfo files.

.TP
\fB-e FILE\fR, \fB--executable=FILE\fR
Find addresses in FILE.

.TP
\fB-k\fR, \fB--kernel\fR
Find addresses in the running kernel.

.TP
\fB-K\fR, \fB--offline-kernel[=RELEASE]\fR
Kernel with all modules.

.TP
\fB-M FILE\fR, \fB--linux-process-map=FILE\fR
Find addresses in files mapped as read from FILE in Linux /proc/PID/maps format.

.TP
\fB-p PID\fR, \fB--pid=PID\fR
Find addresses in files mapped into process PID.

.TP
\fB-?\fR, \fB--help\fR
Give this help list.

.TP
\fB--usage\fR
Give a short usage message.

.TP
\fB-V\fR, \fB--version\fR
Print program version.

.SH "OUTPUT OPTIONS"

.TP
\fB\-0, \-\-null\fR
Separate items by a null instead of a newline.

.TP
\fB\-b, \-\-no-backup\fR
Disables local source file search when 
debuginfod fails to fetch files.  This 
option is only applicable when fetching and 
zipping files.

.TP
\fB\-c, \-\-cu\-only\fR
Only list the CU (compilation unit) names.

.TP
\fB\-v, \-\-verbose\fR
Increase verbosity of logging messages.

.TP
\fB\-z, \-\-zip\fR
Zip all the source files and send to stdout. 
By default, files will be automatically fetched by 
debuginfod (if applicable) or locally as a 
backup. Any source files that were not found 
will not be archived.


.SH EXAMPLES

List all source files for a binary.
.SAMPLE
eu-srcfiles -e /bin/ls
.ESAMPLE

List all compilation units (CU) names for a given process (including shared libraries).
.SAMPLE
eu-srcfiles -c -p $$
.ESAMPLE

List source files of a binary based on its buildid, using debuginfod.
.SAMPLE
binary=`debuginfod-find executable 9c22d8d9e42bd051ffdc1064fdfd456ba781c629`
eu-srcfiles -c -e $binary
.ESAMPLE

Show the source code of the first CU of a shared library.
.SAMPLE
binary=/usr/lib64/libc.so.6
srcfile=`eu-srcfiles -c -e $binary | head -1`
cat `debuginfod-find source $binary $srcfile`
.ESAMPLE

List the source files of a kernel image.
.SAMPLE
eu-srcfiles -e /boot/vmlinuz-`uname -r`
.ESAMPLE

Zip all the source files for a binary.
.SAMPLE
eu-srcfiles -z -e /bin/ls > ls.zip
.ESAMPLE


.SH "AUTHOR"
Written by Housam Alamour.

.SH "REPORTING BUGS"
Please reports bugs at https://sourceware.org/bugzilla/

.SH "COPYRIGHT"
Copyright (c) 2023 Red Hat Inc.  License GPLv3+: GNU GPL version 3 or
later <https://gnu.org/licenses/gpl.html>.  This is free software: you
are free to change and redistribute it.  There is NO WARRANTY, to the
extent permitted by law.