ruby-elf 1.0.7 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +64 -0
- data/lib/elf.rb +1 -1
- data/ruby-elf.gemspec +29 -0
- metadata +38 -74
- data/bin/cowstats +0 -266
- data/bin/elfgrep +0 -246
- data/bin/missingstatic +0 -113
- data/bin/rbelf-nm +0 -113
- data/bin/rbelf-read +0 -146
- data/bin/rbelf-size +0 -184
- data/bin/verify-lfs +0 -125
- data/extras/README.extras +0 -5
- data/extras/bindings-parsers.rb +0 -157
- data/manpages/cowstats.1.xml +0 -234
- data/manpages/elfgrep.1.xml +0 -423
- data/manpages/missingstatic.1.xml +0 -290
- data/manpages/rbelf-nm.1.xml +0 -339
- data/manpages/rbelf-size.1.xml +0 -345
- data/manpages/verify-lfs.1.xml +0 -136
- data/tools/link-collisions/known-broken +0 -154
- data/tools/link-collisions/multimplementations +0 -170
- data/tools/link-collisions/suppressions +0 -287
data/extras/README.extras
DELETED
data/extras/bindings-parsers.rb
DELETED
@@ -1,157 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# -*- coding: utf-8 -*-
|
3
|
-
# Copyright © 2006-2008, Diego Elio Pettenò <flameeyes@flameeyes.eu>
|
4
|
-
#
|
5
|
-
# This program is free software; you can redistribute it and/or modify
|
6
|
-
# it under the terms of the GNU General Public License as published by
|
7
|
-
# the Free Software Foundation; either version 2 of the License, or
|
8
|
-
# (at your option) any later version.
|
9
|
-
#
|
10
|
-
# This program is distributed in the hope that it will be useful,
|
11
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
-
# GNU General Public License for more details.
|
14
|
-
#
|
15
|
-
# You should have received a copy of the GNU General Public License
|
16
|
-
# along with this generator; if not, write to the Free Software
|
17
|
-
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
18
|
-
|
19
|
-
# == Synopsis
|
20
|
-
#
|
21
|
-
# bindings-parser: parses the LD_DEBUG=bindings output
|
22
|
-
#
|
23
|
-
# == Usage
|
24
|
-
#
|
25
|
-
# bindings-parser [-S] [-b] [-l library] [-f file]
|
26
|
-
#
|
27
|
-
# -h, --help:
|
28
|
-
# show help
|
29
|
-
#
|
30
|
-
# -S, --sort
|
31
|
-
# Sort the statistics by amount of entries.
|
32
|
-
#
|
33
|
-
# -b, --basename-only
|
34
|
-
# Report only the basename of libraries (shorter).
|
35
|
-
#
|
36
|
-
# -l <basename>, --library <basename>
|
37
|
-
# Report only the statistics for the given library.
|
38
|
-
#
|
39
|
-
# -f <inputfile>, --file <inputfile>
|
40
|
-
# Reads the output to parse from file rather than standard input.
|
41
|
-
#
|
42
|
-
# Feed the standard input (or the file) with the outptu created by
|
43
|
-
# LD_DEBUG=bindings somecommand
|
44
|
-
# You can use LD_DEBUG_OUTPUT to write the output to a file rather than
|
45
|
-
# stderr.
|
46
|
-
|
47
|
-
pid = nil
|
48
|
-
|
49
|
-
require 'getoptlong'
|
50
|
-
require 'rdoc/usage'
|
51
|
-
|
52
|
-
opts = GetoptLong.new(
|
53
|
-
["--help", "-h", GetoptLong::NO_ARGUMENT],
|
54
|
-
["--sort", "-S", GetoptLong::NO_ARGUMENT],
|
55
|
-
["--basename-only", "-b", GetoptLong::NO_ARGUMENT],
|
56
|
-
["--library", "-l", GetoptLong::REQUIRED_ARGUMENT],
|
57
|
-
["--file", "-f", GetoptLong::REQUIRED_ARGUMENT]
|
58
|
-
)
|
59
|
-
|
60
|
-
sort = false
|
61
|
-
basename = false
|
62
|
-
library = nil
|
63
|
-
input = $stdin
|
64
|
-
|
65
|
-
opts.each do |opt, arg|
|
66
|
-
case opt
|
67
|
-
when "--help"
|
68
|
-
RDoc::usage
|
69
|
-
when "--sort"
|
70
|
-
sort = true
|
71
|
-
when "--basename-only"
|
72
|
-
basename = true
|
73
|
-
when "--library"
|
74
|
-
library = arg
|
75
|
-
when "--file"
|
76
|
-
input = File.new(arg, "r")
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
bindings = []
|
81
|
-
|
82
|
-
input.each_line { |line|
|
83
|
-
if line =~ /\s+(\d+):\s+binding file ([^\s]+) \[0\] to ([^\s]+) \[0\]: (\w+) symbol .*/
|
84
|
-
|
85
|
-
pid = $1.to_i unless pid
|
86
|
-
|
87
|
-
if basename or library
|
88
|
-
bindings << { :origin => File.basename($2), :destination => File.basename($3), :type => $4 }
|
89
|
-
else
|
90
|
-
bindings << { :origin => $2, :destination => $3, :type => $4 }
|
91
|
-
end
|
92
|
-
|
93
|
-
end
|
94
|
-
}
|
95
|
-
|
96
|
-
maxlen = 0
|
97
|
-
|
98
|
-
bindings.each { |b| maxlen = [maxlen, b[:origin].size, b[:destination].size, b[:type].size].max }
|
99
|
-
|
100
|
-
maxlen += 4
|
101
|
-
|
102
|
-
origins = bindings.collect { |b| b[:origin] }.uniq.sort
|
103
|
-
destinations = bindings.collect { |b| b[:destination] }.uniq.sort
|
104
|
-
bindtypes = bindings.collect { |b| b[:type] }.uniq.sort
|
105
|
-
|
106
|
-
origcount = origins.collect { |key| [ key, bindings.clone.delete_if { |e| e[:origin] != key }.size ] }
|
107
|
-
destcount = destinations.collect { |key| [ key, bindings.clone.delete_if { |e| e[:destination] != key }.size ] }
|
108
|
-
typescount = bindtypes.collect { |key| [ key, bindings.clone.delete_if { |e| e[:type] != key }.size ] }
|
109
|
-
selfcount = origins.collect { |key| [ key, bindings.clone.delete_if { |e| e[:origin] != key or e[:destination] != key }.size ] }
|
110
|
-
|
111
|
-
if sort
|
112
|
-
[origcount, destcount, typescount, selfcount].each { |countarray|
|
113
|
-
countarray.sort! { |k1, k2| k2[1] <=> k1[1] } # [1] is the count
|
114
|
-
}
|
115
|
-
else
|
116
|
-
[origcount, destcount, typescount, selfcount].each { |countarray|
|
117
|
-
countarray.sort! { |k1, k2| k2[0] <=> k1[0] } # [0] is the name
|
118
|
-
}
|
119
|
-
end
|
120
|
-
|
121
|
-
if not library
|
122
|
-
puts "Statistics"
|
123
|
-
|
124
|
-
puts " Origins"
|
125
|
-
origcount.each { |key, count|
|
126
|
-
print " #{key}"
|
127
|
-
(maxlen-key.size).times { print " " }
|
128
|
-
puts "#{count}"
|
129
|
-
}
|
130
|
-
|
131
|
-
puts " Destinations"
|
132
|
-
destcount.each { |key, count|
|
133
|
-
print " #{key}"
|
134
|
-
(maxlen-key.size).times { print " " }
|
135
|
-
puts "#{count}"
|
136
|
-
}
|
137
|
-
|
138
|
-
puts " Bindtypes"
|
139
|
-
typescount.each { |key, count|
|
140
|
-
print " #{key}"
|
141
|
-
(maxlen-key.size).times { print " " }
|
142
|
-
puts "#{count}"
|
143
|
-
}
|
144
|
-
|
145
|
-
puts " Self-loops (candidate for protected visibility)"
|
146
|
-
selfcount.each { |key, count|
|
147
|
-
next if count == 0
|
148
|
-
print " #{key}"
|
149
|
-
(maxlen-key.size).times { print " " }
|
150
|
-
puts "#{count}"
|
151
|
-
}
|
152
|
-
else
|
153
|
-
puts "Statistics for #{library}"
|
154
|
-
puts " Origin: #{origcount.assoc(library)[1].to_s.rjust(8)}" if origcount.assoc(library)
|
155
|
-
puts " Destination: #{destcount.assoc(library)[1].to_s.rjust(8)}" if destcount.assoc(library)
|
156
|
-
puts " Self-loops: #{selfcount.assoc(library)[1].to_s.rjust(8)}" if selfcount.assoc(library)
|
157
|
-
end
|
data/manpages/cowstats.1.xml
DELETED
@@ -1,234 +0,0 @@
|
|
1
|
-
<?xml version='1.0'?>
|
2
|
-
<!--
|
3
|
-
Copyright © 2008-2011, Diego Elio Pettenò <flameeyes@flameeyes.eu>
|
4
|
-
|
5
|
-
This program is free software; you can redistribute it and/or modify
|
6
|
-
it under the terms of the GNU General Public License as published by
|
7
|
-
the Free Software Foundation; either version 2 of the License, or
|
8
|
-
(at your option) any later version.
|
9
|
-
|
10
|
-
This program is distributed in the hope that it will be useful,
|
11
|
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
-
GNU General Public License for more details.
|
14
|
-
|
15
|
-
You should have received a copy of the GNU General Public License
|
16
|
-
along with this generator; if not, write to the Free Software
|
17
|
-
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
18
|
-
-->
|
19
|
-
<article xmlns="http://docbook.org/ns/docbook"
|
20
|
-
xmlns:xl="http://www.w3.org/1999/xlink"
|
21
|
-
xmlns:xi="http://www.w3.org/2001/XInclude"
|
22
|
-
version="5.0" xml:lang="en">
|
23
|
-
<info>
|
24
|
-
<title>cowstats</title>
|
25
|
-
|
26
|
-
<xi:include parse="xml" href="author.xmli" />
|
27
|
-
</info>
|
28
|
-
|
29
|
-
<section>
|
30
|
-
<title>Reference</title>
|
31
|
-
|
32
|
-
<refentry>
|
33
|
-
<info>
|
34
|
-
<date>October 2008</date>
|
35
|
-
<productname>ruby-elf</productname>
|
36
|
-
</info>
|
37
|
-
<refmeta>
|
38
|
-
<refentrytitle>cowstats</refentrytitle>
|
39
|
-
<manvolnum>1</manvolnum>
|
40
|
-
</refmeta>
|
41
|
-
<refnamediv>
|
42
|
-
<refname>cowstats</refname>
|
43
|
-
<refpurpose>ELF Copy-on-Write analyzer</refpurpose>
|
44
|
-
</refnamediv>
|
45
|
-
<refsynopsisdiv>
|
46
|
-
<cmdsynopsis>
|
47
|
-
<command>cowstats</command>
|
48
|
-
<arg choice="opt"><option>--statistics</option></arg>
|
49
|
-
<arg choice="opt"><option>--total</option></arg>
|
50
|
-
<arg choice="opt"><option>--ignore-cxx</option></arg>
|
51
|
-
<arg choice="opt"><option>--ignore-profiling</option></arg>
|
52
|
-
<arg choice="opt"><option>--ignore-data-rel-ro</option></arg>
|
53
|
-
<arg choice="opt">
|
54
|
-
<option>--sort-by</option>
|
55
|
-
<replaceable>section-column</replaceable>
|
56
|
-
</arg>
|
57
|
-
|
58
|
-
<xi:include href="common.xmli" xpointer="xpointer(id('filelist.synopsis')/*)" />
|
59
|
-
</cmdsynopsis>
|
60
|
-
</refsynopsisdiv>
|
61
|
-
|
62
|
-
<refsect1>
|
63
|
-
<title>Description</title>
|
64
|
-
<para>
|
65
|
-
<command>cowstats</command> is a script that analyses ELF object files, results of
|
66
|
-
compilation of C, C++ or other languages on an Unix system, and reports about the
|
67
|
-
variables that enter Copy-on-Write sections.
|
68
|
-
</para>
|
69
|
-
|
70
|
-
<para>
|
71
|
-
Static variables (initialised and not) and constant pointers on PIC or PIE enabled object
|
72
|
-
files are emitted in the so-called Copy-on-Write sections, which require copying over
|
73
|
-
pages from the original ELF executable file to a private resident area of memory at
|
74
|
-
runtime.
|
75
|
-
</para>
|
76
|
-
|
77
|
-
<para>
|
78
|
-
<command>cowstats</command> reports the possible symbols that were emitted in
|
79
|
-
Copy-on-Write sections so that they can be looked after to see if they can be made
|
80
|
-
constant and/or removed or reworked.
|
81
|
-
</para>
|
82
|
-
</refsect1>
|
83
|
-
|
84
|
-
<refsect1>
|
85
|
-
<title>Options</title>
|
86
|
-
|
87
|
-
<variablelist>
|
88
|
-
<varlistentry>
|
89
|
-
<term><option>-s</option></term>
|
90
|
-
<term><option>--statistics</option></term>
|
91
|
-
<listitem>
|
92
|
-
<para>
|
93
|
-
Instead of reporting all the variables found in Copy-on-Write sections, only
|
94
|
-
generate a table showing the sie of data in Copy-on-Write sections per each file,
|
95
|
-
divided into <constant>.data</constant>, <constant>.bss</constant> and
|
96
|
-
<constant>.data.rel</constant> (for variables, uninitialised variables, and
|
97
|
-
relocated variables and constants).
|
98
|
-
</para>
|
99
|
-
</listitem>
|
100
|
-
</varlistentry>
|
101
|
-
|
102
|
-
<varlistentry>
|
103
|
-
<term><option>-t</option></term>
|
104
|
-
<term><option>--total</option></term>
|
105
|
-
<listitem>
|
106
|
-
<para>
|
107
|
-
Shows some rough totals for the amount of data in Copy-on-Write sections for the
|
108
|
-
program, assuming all the object files given are linked in the same executable. This
|
109
|
-
will also show a rough page-based total, which bases itself on 4K-sized pages.
|
110
|
-
</para>
|
111
|
-
</listitem>
|
112
|
-
</varlistentry>
|
113
|
-
|
114
|
-
<varlistentry>
|
115
|
-
<term><option>-x</option></term>
|
116
|
-
<term><option>--ignore-cxx</option></term>
|
117
|
-
<listitem>
|
118
|
-
<para>
|
119
|
-
Ignore some C++ entries that could be considered false positives. C++ object files
|
120
|
-
will report as CoW data the vtables and typeinfo objects for C++ classes, since they
|
121
|
-
are actually emitted in Copy-on-Write sections. Since they cannot be moved from
|
122
|
-
thre, this option hides them on the output, to reduce clutter and noise.
|
123
|
-
</para>
|
124
|
-
</listitem>
|
125
|
-
</varlistentry>
|
126
|
-
|
127
|
-
<varlistentry>
|
128
|
-
<term><option>-p</option></term>
|
129
|
-
<term><option>--ignore-profiling</option></term>
|
130
|
-
<listitem>
|
131
|
-
<para>
|
132
|
-
Similarly to C++, also profiling (with <command>gcov</command>) will add some
|
133
|
-
symbols that would be identified as CoW data. Use this option to avoid reporting
|
134
|
-
those symbols.
|
135
|
-
</para>
|
136
|
-
</listitem>
|
137
|
-
</varlistentry>
|
138
|
-
|
139
|
-
<varlistentry>
|
140
|
-
<term><option>-r</option></term>
|
141
|
-
<term><option>--ignore-data-rel-ro</option></term>
|
142
|
-
<listitem>
|
143
|
-
<para>
|
144
|
-
Don't report constants found in the .data.rel.ro section, and consider it as
|
145
|
-
non-relocated. This is helpful to reduce the noise when looking for writable data
|
146
|
-
symbols, or when analysing non-PIC builds.
|
147
|
-
</para>
|
148
|
-
</listitem>
|
149
|
-
</varlistentry>
|
150
|
-
|
151
|
-
<varlistentry>
|
152
|
-
<term>
|
153
|
-
<option>-S</option>
|
154
|
-
<replaceable>section-column</replaceable>
|
155
|
-
</term>
|
156
|
-
<term>
|
157
|
-
<option>--sort-by</option>
|
158
|
-
<replaceable>section-column</replaceable>
|
159
|
-
</term>
|
160
|
-
|
161
|
-
<listitem>
|
162
|
-
<para>
|
163
|
-
Sort the output of <option>--statistics</option> by the given column. Useful when
|
164
|
-
looking for which objects have the most hit for one particular CoW problem. The
|
165
|
-
column can be one of the following section names:
|
166
|
-
</para>
|
167
|
-
|
168
|
-
<itemizedlist>
|
169
|
-
<listitem><para>.bss</para></listitem>
|
170
|
-
<listitem><para>.data</para></listitem>
|
171
|
-
<listitem><para>.data.rel</para></listitem>
|
172
|
-
<listitem><para>.data.rel.ro</para></listitem>
|
173
|
-
</itemizedlist>
|
174
|
-
</listitem>
|
175
|
-
</varlistentry>
|
176
|
-
|
177
|
-
<xi:include href="common.xmli" xpointer="xpointer(id('filelist.option')/*)" />
|
178
|
-
|
179
|
-
</variablelist>
|
180
|
-
</refsect1>
|
181
|
-
|
182
|
-
<refsect1>
|
183
|
-
<title>Bugs</title>
|
184
|
-
|
185
|
-
<para>
|
186
|
-
<command>cowstats</command> is still an experiment, and is
|
187
|
-
not yet entirely complete, there are thus a number of bugs
|
188
|
-
that haven't been discovered or well tested yet.
|
189
|
-
</para>
|
190
|
-
|
191
|
-
<para>
|
192
|
-
A known "bug" or misbehaviour is that <command>cowstats</command> cannot know whether
|
193
|
-
multple object files will be linked together in the same module (executable or shared
|
194
|
-
object) or not. For this reason the output of <option>--total</option> might not be
|
195
|
-
consistent with the runtime behaviour of the module itself.
|
196
|
-
</para>
|
197
|
-
|
198
|
-
<xi:include href="common.xmli" xpointer="xpointer(id('filelist.bugpara')/*)" />
|
199
|
-
</refsect1>
|
200
|
-
|
201
|
-
<refsect1>
|
202
|
-
<title>See Also</title>
|
203
|
-
<para>
|
204
|
-
<citation xl:href="http://blog.flameeyes.eu/">Flameeyes's Weblog</citation>
|
205
|
-
http://blog.flameeyes.eu/
|
206
|
-
</para>
|
207
|
-
|
208
|
-
<para>
|
209
|
-
Related tools:
|
210
|
-
|
211
|
-
<citerefentry>
|
212
|
-
<refentrytitle>rbelf-size</refentrytitle>
|
213
|
-
<manvolnum>1</manvolnum>
|
214
|
-
</citerefentry>,
|
215
|
-
|
216
|
-
<citerefentry>
|
217
|
-
<refentrytitle>objdump</refentrytitle>
|
218
|
-
<manvolnum>1</manvolnum>
|
219
|
-
</citerefentry>.
|
220
|
-
</para>
|
221
|
-
</refsect1>
|
222
|
-
</refentry>
|
223
|
-
</section>
|
224
|
-
</article>
|
225
|
-
<!--
|
226
|
-
Local Variables:
|
227
|
-
mode: nxml
|
228
|
-
mode: auto-fill
|
229
|
-
mode: flyspell
|
230
|
-
ispell-local-dictionary: "english"
|
231
|
-
fill-column: 100
|
232
|
-
indent-tabs-mode: nil
|
233
|
-
End:
|
234
|
-
-->
|
data/manpages/elfgrep.1.xml
DELETED
@@ -1,423 +0,0 @@
|
|
1
|
-
<?xml version='1.0'?>
|
2
|
-
<!--
|
3
|
-
Copyright © 2011, Diego Elio Pettenò <flameeyes@flameeyes.eu>
|
4
|
-
|
5
|
-
This program is free software; you can redistribute it and/or modify
|
6
|
-
it under the terms of the GNU General Public License as published by
|
7
|
-
the Free Software Foundation; either version 2 of the License, or
|
8
|
-
(at your option) any later version.
|
9
|
-
|
10
|
-
This program is distributed in the hope that it will be useful,
|
11
|
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
-
GNU General Public License for more details.
|
14
|
-
|
15
|
-
You should have received a copy of the GNU General Public License
|
16
|
-
along with this generator; if not, write to the Free Software
|
17
|
-
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
18
|
-
-->
|
19
|
-
<article xmlns="http://docbook.org/ns/docbook"
|
20
|
-
xmlns:xl="http://www.w3.org/1999/xlink"
|
21
|
-
xmlns:xi="http://www.w3.org/2001/XInclude"
|
22
|
-
version="5.0" xml:lang="en">
|
23
|
-
<info>
|
24
|
-
<title>elfgrep</title>
|
25
|
-
|
26
|
-
<xi:include parse="xml" href="author.xmli" />
|
27
|
-
</info>
|
28
|
-
|
29
|
-
<section>
|
30
|
-
<title>Reference</title>
|
31
|
-
|
32
|
-
<refentry>
|
33
|
-
<info>
|
34
|
-
<date>November 2011</date>
|
35
|
-
<productname>ruby-elf</productname>
|
36
|
-
</info>
|
37
|
-
<refmeta>
|
38
|
-
<refentrytitle>elfgrep</refentrytitle>
|
39
|
-
<manvolnum>1</manvolnum>
|
40
|
-
</refmeta>
|
41
|
-
<refnamediv>
|
42
|
-
<refname>elfgrep</refname>
|
43
|
-
<refpurpose>Search for symbols matching an expression in ELF files</refpurpose>
|
44
|
-
</refnamediv>
|
45
|
-
<refsynopsisdiv>
|
46
|
-
<cmdsynopsis>
|
47
|
-
<command>elfgrep</command>
|
48
|
-
|
49
|
-
<arg choice="opt">
|
50
|
-
<option>--fixed-strings</option>
|
51
|
-
</arg>
|
52
|
-
|
53
|
-
<arg choice="opt">
|
54
|
-
<option>--ignore-case</option>
|
55
|
-
</arg>
|
56
|
-
|
57
|
-
<arg choice="opt">
|
58
|
-
<option>--match-version</option>
|
59
|
-
</arg>
|
60
|
-
|
61
|
-
<group choice="opt">
|
62
|
-
<arg choice="plain">
|
63
|
-
<option>--match-undefined</option>
|
64
|
-
</arg>
|
65
|
-
|
66
|
-
<arg choice="plain">
|
67
|
-
<option>--match-defined</option>
|
68
|
-
</arg>
|
69
|
-
</group>
|
70
|
-
|
71
|
-
<arg choice="opt">
|
72
|
-
<option>--invert-match</option>
|
73
|
-
</arg>
|
74
|
-
|
75
|
-
<arg choice="opt">
|
76
|
-
<option>--count</option>
|
77
|
-
</arg>
|
78
|
-
|
79
|
-
<group choice="opt">
|
80
|
-
<arg choice="plain">
|
81
|
-
<option>--files-without-match</option>
|
82
|
-
</arg>
|
83
|
-
|
84
|
-
<arg choice="plain">
|
85
|
-
<option>--files-with-matches</option>
|
86
|
-
</arg>
|
87
|
-
</group>
|
88
|
-
|
89
|
-
<group choice="opt">
|
90
|
-
<arg choice="plain">
|
91
|
-
<option>--with-filename</option>
|
92
|
-
</arg>
|
93
|
-
|
94
|
-
<arg choice="plain">
|
95
|
-
<option>--no-filename</option>
|
96
|
-
</arg>
|
97
|
-
</group>
|
98
|
-
|
99
|
-
<arg choice="opt">
|
100
|
-
<option>--null</option>
|
101
|
-
</arg>
|
102
|
-
|
103
|
-
<arg choice="opt">
|
104
|
-
<option>--symbol-regexp</option>
|
105
|
-
</arg>
|
106
|
-
|
107
|
-
<xi:include href="common.xmli" xpointer="xpointer(id('filelist.synopsis.options')/*)" />
|
108
|
-
|
109
|
-
<group choice="req">
|
110
|
-
<arg choice="plain" rep="repeat">
|
111
|
-
<option>--regexp</option>
|
112
|
-
<replaceable>PATTERN</replaceable>
|
113
|
-
</arg>
|
114
|
-
|
115
|
-
<arg choice="plain" rep="repeat">
|
116
|
-
<option>--file</option>
|
117
|
-
<replaceable>FILE</replaceable>
|
118
|
-
</arg>
|
119
|
-
|
120
|
-
<arg choice="plain">
|
121
|
-
<replaceable>PATTERN</replaceable>
|
122
|
-
</arg>
|
123
|
-
</group>
|
124
|
-
|
125
|
-
<xi:include href="common.xmli" xpointer="xpointer(id('filelist.synopsis.arguments')/*)" />
|
126
|
-
</cmdsynopsis>
|
127
|
-
</refsynopsisdiv>
|
128
|
-
|
129
|
-
<refsect1>
|
130
|
-
<title>Description</title>
|
131
|
-
<para>
|
132
|
-
<command>elfgrep</command> is a simple script that allows to earch for particular symbols
|
133
|
-
within a file, by matching regular expression on their name. It is insipired by the common
|
134
|
-
Unix
|
135
|
-
<citerefentry><refentrytitle>grep</refentrytitle><manvolnum>1</manvolnum></citerefentry>
|
136
|
-
tool.
|
137
|
-
</para>
|
138
|
-
</refsect1>
|
139
|
-
|
140
|
-
<refsect1>
|
141
|
-
<title>Options</title>
|
142
|
-
|
143
|
-
<refsect2>
|
144
|
-
<title>Matching Control</title>
|
145
|
-
|
146
|
-
<variablelist>
|
147
|
-
<varlistentry>
|
148
|
-
<term><option>-F</option></term>
|
149
|
-
<term><option>--fixed-strings</option></term>
|
150
|
-
<listitem>
|
151
|
-
<para>
|
152
|
-
Interpret <replaceable>PATTERN</replaceable> as a list of fixed strings, separated
|
153
|
-
by newlines, any of which is to be matched.
|
154
|
-
</para>
|
155
|
-
</listitem>
|
156
|
-
</varlistentry>
|
157
|
-
|
158
|
-
<varlistentry>
|
159
|
-
<term>
|
160
|
-
<option>-e</option>
|
161
|
-
<replaceable>PATTERN</replaceable>
|
162
|
-
</term>
|
163
|
-
<term>
|
164
|
-
<option>--regexp</option>
|
165
|
-
<replaceable>PATTERN</replaceable>
|
166
|
-
</term>
|
167
|
-
|
168
|
-
<listitem>
|
169
|
-
<para>
|
170
|
-
Use <replaceable>PATTERN</replaceable> as the pattern. This can be used to specify
|
171
|
-
multiple search patterns, or to protect a pattern beginning with a hyphen
|
172
|
-
(<literal>-</literal>).
|
173
|
-
</para>
|
174
|
-
</listitem>
|
175
|
-
</varlistentry>
|
176
|
-
|
177
|
-
<varlistentry>
|
178
|
-
<term>
|
179
|
-
<option>-f</option>
|
180
|
-
<replaceable>FILE</replaceable>
|
181
|
-
</term>
|
182
|
-
<term>
|
183
|
-
<option>--file</option>
|
184
|
-
<replaceable>FILE</replaceable>
|
185
|
-
</term>
|
186
|
-
|
187
|
-
<listitem>
|
188
|
-
<para>
|
189
|
-
Obtain patterns from <replaceable>FILE</replaceable>, one per line.
|
190
|
-
</para>
|
191
|
-
|
192
|
-
<note>
|
193
|
-
<title>Behaviour difference from <application>grep</application> semantics</title>
|
194
|
-
|
195
|
-
<para>
|
196
|
-
For <application>grep</application>'s <option>--file</option> option, an empty
|
197
|
-
line (with only a newline character) is a “match all” pattern, while a totally
|
198
|
-
empty file (zero bytes sized) is a “match none” pattern. This doesn't make much
|
199
|
-
sense, especially for <application>elfgrep</application>, so both empty lines
|
200
|
-
and empty files are simply skipped over. Passing <option>--file</option>
|
201
|
-
pointing to a file that gets totally ignored (zero bytes sized, or a sequence of
|
202
|
-
newline characters) will still stop <application>elfgrep</application> from
|
203
|
-
looking for a pattern in the first non-option argument.
|
204
|
-
</para>
|
205
|
-
</note>
|
206
|
-
</listitem>
|
207
|
-
</varlistentry>
|
208
|
-
|
209
|
-
<varlistentry>
|
210
|
-
<term><option>-i</option></term>
|
211
|
-
<term><option>--ignore-case</option></term>
|
212
|
-
<listitem>
|
213
|
-
<para>
|
214
|
-
Ignore case distinction in both the <replaceable>PATTERN</replaceable> and the
|
215
|
-
symbols' names.
|
216
|
-
</para>
|
217
|
-
</listitem>
|
218
|
-
</varlistentry>
|
219
|
-
|
220
|
-
<varlistentry>
|
221
|
-
<term><option>-V</option></term>
|
222
|
-
<term><option>--match-version</option></term>
|
223
|
-
<listitem>
|
224
|
-
<para>
|
225
|
-
Append the ELF version information for the symbol, separated by an @ symbol, before
|
226
|
-
testing the expression for match. This allows to match only symbols that are defined
|
227
|
-
with a particular version.
|
228
|
-
</para>
|
229
|
-
</listitem>
|
230
|
-
</varlistentry>
|
231
|
-
|
232
|
-
<varlistentry>
|
233
|
-
<term><option>-U</option></term>
|
234
|
-
<term><option>--match-undefined</option></term>
|
235
|
-
<listitem>
|
236
|
-
<para>
|
237
|
-
Report matches on undefined symbols. By default <command>elfgrep</command> will
|
238
|
-
report matches on both defined and undefined symbols. This switch makes it ignore
|
239
|
-
matches on defined symbols.
|
240
|
-
</para>
|
241
|
-
</listitem>
|
242
|
-
</varlistentry>
|
243
|
-
|
244
|
-
<varlistentry>
|
245
|
-
<term><option>-D</option></term>
|
246
|
-
<term><option>--no-match-defined</option></term>
|
247
|
-
<listitem>
|
248
|
-
<para>
|
249
|
-
Report matches on defined symbols. By default <command>elfgrep</command> will
|
250
|
-
report matches on both defined and undefined symbols. This switch makes it ignore
|
251
|
-
matches on undefined symbols.
|
252
|
-
</para>
|
253
|
-
</listitem>
|
254
|
-
</varlistentry>
|
255
|
-
|
256
|
-
<varlistentry>
|
257
|
-
<term><option>-v</option></term>
|
258
|
-
<term><option>--invert-match</option></term>
|
259
|
-
<listitem>
|
260
|
-
<para>
|
261
|
-
Invert the sense of matching, to select non-matching symbols. This does not invert
|
262
|
-
the sense of <option>--no-match-undefined</option> and
|
263
|
-
<option>--no-match-defined</option>.
|
264
|
-
</para>
|
265
|
-
</listitem>
|
266
|
-
</varlistentry>
|
267
|
-
|
268
|
-
<varlistentry>
|
269
|
-
<term><option>-s</option></term>
|
270
|
-
<term><option>--symbol-regexp</option></term>
|
271
|
-
<listitem>
|
272
|
-
<para>
|
273
|
-
Select only those matches that exactly match the whole line.
|
274
|
-
</para>
|
275
|
-
</listitem>
|
276
|
-
</varlistentry>
|
277
|
-
</variablelist>
|
278
|
-
</refsect2>
|
279
|
-
|
280
|
-
<refsect2>
|
281
|
-
<title>Output Control</title>
|
282
|
-
|
283
|
-
<variablelist>
|
284
|
-
|
285
|
-
<varlistentry>
|
286
|
-
<term><option>-c</option></term>
|
287
|
-
<term><option>--count</option></term>
|
288
|
-
<listitem>
|
289
|
-
<para>
|
290
|
-
Suppress normal output; instead print a count of matching lines for each input
|
291
|
-
file. With the <option>--invert-match</option> option, count non-matching lines.
|
292
|
-
</para>
|
293
|
-
</listitem>
|
294
|
-
</varlistentry>
|
295
|
-
|
296
|
-
<varlistentry>
|
297
|
-
<term><option>-L</option></term>
|
298
|
-
<term><option>--files-without-match</option></term>
|
299
|
-
|
300
|
-
<listitem>
|
301
|
-
<para>
|
302
|
-
Suppress normal output; instead print the name of each input file from which no
|
303
|
-
output would normally have been printed.
|
304
|
-
</para>
|
305
|
-
</listitem>
|
306
|
-
</varlistentry>
|
307
|
-
|
308
|
-
<varlistentry>
|
309
|
-
<term><option>-l</option></term>
|
310
|
-
<term><option>--files-with-matches</option></term>
|
311
|
-
|
312
|
-
<listitem>
|
313
|
-
<para>
|
314
|
-
Suppress normal output; instead print the name of each input file from which output
|
315
|
-
would normally have been printed. The scalling will stop on the first match.
|
316
|
-
</para>
|
317
|
-
</listitem>
|
318
|
-
</varlistentry>
|
319
|
-
|
320
|
-
<varlistentry>
|
321
|
-
<term><option>-H</option></term>
|
322
|
-
<term><option>--with-filename</option></term>
|
323
|
-
|
324
|
-
<listitem>
|
325
|
-
<para>
|
326
|
-
Print the file name for each match. This is the default when there is more than one
|
327
|
-
file to search.
|
328
|
-
</para>
|
329
|
-
</listitem>
|
330
|
-
</varlistentry>
|
331
|
-
|
332
|
-
<varlistentry>
|
333
|
-
<term><option>-h</option></term>
|
334
|
-
<term><option>--no-filename</option></term>
|
335
|
-
|
336
|
-
<listitem>
|
337
|
-
<para>
|
338
|
-
Suppress the prefixing of file names on output. This is the default when there is
|
339
|
-
only one file to search.
|
340
|
-
</para>
|
341
|
-
</listitem>
|
342
|
-
</varlistentry>
|
343
|
-
|
344
|
-
<varlistentry>
|
345
|
-
<term><option>-Z</option></term>
|
346
|
-
<term><option>--null</option></term>
|
347
|
-
|
348
|
-
<listitem>
|
349
|
-
<para>
|
350
|
-
Output a zero byte (the ASCII <literal>NUL</literal> character) instead of the
|
351
|
-
character that normally follows a file name. For example <command>elfgrep
|
352
|
-
-lZ</command> outputs a zero byte after each file name instead of the usual
|
353
|
-
newline. This option makes the output unambiguous, even in presence of file names
|
354
|
-
containing unusual characters like newlines, so that it can be used with commands
|
355
|
-
like <command>xargs -0</command>.
|
356
|
-
</para>
|
357
|
-
</listitem>
|
358
|
-
</varlistentry>
|
359
|
-
</variablelist>
|
360
|
-
</refsect2>
|
361
|
-
|
362
|
-
<refsect2>
|
363
|
-
<title>General Options</title>
|
364
|
-
|
365
|
-
<variablelist>
|
366
|
-
<xi:include href="common.xmli" xpointer="xpointer(id('filelist.option')/*)" />
|
367
|
-
</variablelist>
|
368
|
-
</refsect2>
|
369
|
-
</refsect1>
|
370
|
-
|
371
|
-
<refsect1>
|
372
|
-
<title>Bugs and Missing Features</title>
|
373
|
-
|
374
|
-
<para>
|
375
|
-
By default, <application>elfgrep</application> uses standard Ruby regular expressions,
|
376
|
-
which are neither the basic or extended regular expressions as implemented by
|
377
|
-
<citerefentry><refentrytitle>grep</refentrytitle><manvolnum>1</manvolnum></citerefentry>
|
378
|
-
nor the Perl (or compatible) regular expressions.
|
379
|
-
</para>
|
380
|
-
|
381
|
-
<xi:include href="common.xmli" xpointer="xpointer(id('filelist.bugpara')/*)" />
|
382
|
-
</refsect1>
|
383
|
-
|
384
|
-
<refsect1>
|
385
|
-
<title>See Also</title>
|
386
|
-
<para>
|
387
|
-
<citation xl:href="http://blog.flameeyes.eu/">Flameeyes's Weblog</citation>
|
388
|
-
http://blog.flameeyes.eu/
|
389
|
-
</para>
|
390
|
-
|
391
|
-
<para>
|
392
|
-
Related tools:
|
393
|
-
|
394
|
-
<citerefentry>
|
395
|
-
<refentrytitle>grep</refentrytitle>
|
396
|
-
<manvolnum>1</manvolnum>
|
397
|
-
</citerefentry>,
|
398
|
-
|
399
|
-
<citerefentry>
|
400
|
-
<refentrytitle>rbelf-nm</refentrytitle>
|
401
|
-
<manvolnum>1</manvolnum>
|
402
|
-
</citerefentry>.
|
403
|
-
</para>
|
404
|
-
|
405
|
-
<para>
|
406
|
-
Lots of description of options above are lifted directly from the
|
407
|
-
<application>grep</application> man page, to avoid confusing with different
|
408
|
-
wordings.
|
409
|
-
</para>
|
410
|
-
</refsect1>
|
411
|
-
</refentry>
|
412
|
-
</section>
|
413
|
-
</article>
|
414
|
-
<!--
|
415
|
-
Local Variables:
|
416
|
-
mode: nxml
|
417
|
-
mode: auto-fill
|
418
|
-
mode: flyspell
|
419
|
-
ispell-local-dictionary: "english"
|
420
|
-
fill-column: 100
|
421
|
-
indent-tabs-mode: nil
|
422
|
-
End:
|
423
|
-
-->
|