xref: /llvm-project/llvm/docs/CommandGuide/llvm-strings.rst (revision 72fd1033ea577a769cc855fde6b5576b82380715)
1llvm-strings - print strings
2============================
3
4.. program:: llvm-strings
5
6SYNOPSIS
7--------
8
9:program:`llvm-strings` [*options*] [*input...*]
10
11DESCRIPTION
12-----------
13
14:program:`llvm-strings` is a tool intended as a drop-in replacement for GNU's
15:program:`strings`, which looks for printable strings in files and writes them
16to the standard output stream. A printable string is any sequence of four (by
17default) or more printable ASCII characters. The end of the file, or any other
18byte, terminates the current sequence.
19
20:program:`llvm-strings` looks for strings in each ``input`` file specified.
21Unlike GNU :program:`strings` it looks in the entire input file, regardless of
22file format, rather than restricting the search to certain sections of object
23files. If "``-``" is specified as an ``input``, or no ``input`` is specified,
24the program reads from the standard input stream.
25
26EXAMPLE
27-------
28
29.. code-block:: console
30
31 $ cat input.txt
32 bars
33 foo
34 wibble blob
35 $ llvm-strings input.txt
36 bars
37 wibble blob
38
39OPTIONS
40-------
41
42.. option:: --all, -a
43
44 Silently ignored. Present for GNU :program:`strings` compatibility.
45
46.. option:: --bytes=<length>, -n
47
48 Set the minimum number of printable ASCII characters required for a sequence of
49 bytes to be considered a string. The default value is 4.
50
51.. option:: --help, -h
52
53 Display a summary of command line options.
54
55.. option:: --help-list
56
57 Display an uncategorized summary of command line options.
58
59.. option:: --print-file-name, -f
60
61 Display the name of the containing file before each string.
62
63 Example:
64
65 .. code-block:: console
66
67  $ llvm-strings --print-file-name test.o test.elf
68  test.o: _Z5hellov
69  test.o: some_bss
70  test.o: test.cpp
71  test.o: main
72  test.elf: test.cpp
73  test.elf: test2.cpp
74  test.elf: _Z5hellov
75  test.elf: main
76  test.elf: some_bss
77
78.. option:: --radix=<radix>, -t
79
80 Display the offset within the file of each string, before the string and using
81 the specified radix. Valid ``<radix>`` values are ``o``, ``d`` and ``x`` for
82 octal, decimal and hexadecimal respectively.
83
84 Example:
85
86 .. code-block:: console
87
88  $ llvm-strings --radix=o test.o
89      1054 _Z5hellov
90      1066 .rela.text
91      1101 .comment
92      1112 some_bss
93      1123 .bss
94      1130 test.cpp
95      1141 main
96  $ llvm-strings --radix=d test.o
97      556 _Z5hellov
98      566 .rela.text
99      577 .comment
100      586 some_bss
101      595 .bss
102      600 test.cpp
103      609 main
104  $ llvm-strings -t x test.o
105      22c _Z5hellov
106      236 .rela.text
107      241 .comment
108      24a some_bss
109      253 .bss
110      258 test.cpp
111      261 main
112
113.. option:: --version
114
115 Display the version of the :program:`llvm-strings` executable.
116
117.. option:: @<FILE>
118
119 Read command-line options from response file ``<FILE>``.
120
121EXIT STATUS
122-----------
123
124:program:`llvm-strings` exits with a non-zero exit code if there is an error.
125Otherwise, it exits with code 0.
126
127BUGS
128----
129
130To report bugs, please visit <https://llvm.org/bugs/>.
131