blob: 45c845ac26eaf9c0ddede05f26025580516b5149 [file] [log] [blame]
Alexander Potapenko8c07f552012-11-12 11:33:29 +00001//===-- llvm-symbolizer.cpp - Simple addr2line-like symbolizer ------------===//
2//
Chandler Carruth2946cd72019-01-19 08:50:56 +00003// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
Alexander Potapenko8c07f552012-11-12 11:33:29 +00006//
7//===----------------------------------------------------------------------===//
8//
9// This utility works much like "addr2line". It is able of transforming
10// tuples (module name, module offset) to code locations (function name,
11// file, line number, column number). It is targeted for compiler-rt tools
12// (especially AddressSanitizer and ThreadSanitizer) that can use it
13// to symbolize stack traces in their error reports.
14//
15//===----------------------------------------------------------------------===//
16
Alexander Potapenko8c07f552012-11-12 11:33:29 +000017#include "llvm/ADT/StringRef.h"
Alexey Samsonovd6aa8202015-11-03 22:20:52 +000018#include "llvm/DebugInfo/Symbolize/DIPrinter.h"
Alexey Samsonov57f88372015-10-26 17:56:12 +000019#include "llvm/DebugInfo/Symbolize/Symbolize.h"
Zachary Turner20dbd0d2015-04-27 17:19:51 +000020#include "llvm/Support/COM.h"
Alexander Potapenko8c07f552012-11-12 11:33:29 +000021#include "llvm/Support/CommandLine.h"
22#include "llvm/Support/Debug.h"
Alexander Potapenko7aaf5142014-10-17 00:50:19 +000023#include "llvm/Support/FileSystem.h"
Rui Ueyama197194b2018-04-13 18:26:06 +000024#include "llvm/Support/InitLLVM.h"
Benjamin Kramer16132e62015-03-23 18:07:13 +000025#include "llvm/Support/Path.h"
Alexander Potapenko8c07f552012-11-12 11:33:29 +000026#include "llvm/Support/raw_ostream.h"
Alexander Potapenko8c07f552012-11-12 11:33:29 +000027#include <cstdio>
28#include <cstring>
Alexander Potapenko8c07f552012-11-12 11:33:29 +000029#include <string>
30
31using namespace llvm;
Alexey Samsonovea83baf2013-01-22 14:21:19 +000032using namespace symbolize;
Alexander Potapenko8c07f552012-11-12 11:33:29 +000033
34static cl::opt<bool>
Alexey Samsonovea83baf2013-01-22 14:21:19 +000035ClUseSymbolTable("use-symbol-table", cl::init(true),
Alexey Samsonovd5d7bb52013-02-15 08:54:47 +000036 cl::desc("Prefer names in symbol table to names "
37 "in debug info"));
Alexander Potapenko8c07f552012-11-12 11:33:29 +000038
Alexey Samsonovcd014722014-05-17 00:07:48 +000039static cl::opt<FunctionNameKind> ClPrintFunctions(
40 "functions", cl::init(FunctionNameKind::LinkageName),
James Henderson96526522019-02-04 16:17:57 +000041 cl::desc("Print function name for a given address"), cl::ValueOptional,
Alexey Samsonovcd014722014-05-17 00:07:48 +000042 cl::values(clEnumValN(FunctionNameKind::None, "none", "omit function name"),
43 clEnumValN(FunctionNameKind::ShortName, "short",
44 "print short function name"),
45 clEnumValN(FunctionNameKind::LinkageName, "linkage",
Igor Kudrin99f641c2019-04-19 10:17:52 +000046 "print function linkage name"),
James Henderson25ce5962019-01-23 17:27:48 +000047 // Sentinel value for unspecified value.
48 clEnumValN(FunctionNameKind::LinkageName, "", "")));
49static cl::alias ClPrintFunctionsShort("f", cl::desc("Alias for -functions"),
50 cl::NotHidden, cl::Grouping,
51 cl::aliasopt(ClPrintFunctions));
Alexander Potapenko8c07f552012-11-12 11:33:29 +000052
53static cl::opt<bool>
Zachary Turnerc007aa42015-05-06 22:26:30 +000054 ClUseRelativeAddress("relative-address", cl::init(false),
55 cl::desc("Interpret addresses as relative addresses"),
56 cl::ReallyHidden);
57
Peter Collingbournea56d81f2019-08-05 20:59:25 +000058static cl::opt<bool> ClUntagAddresses(
59 "untag-addresses", cl::init(true),
60 cl::desc("Remove memory tags from addresses before symbolization"));
61
Zachary Turnerc007aa42015-05-06 22:26:30 +000062static cl::opt<bool>
63 ClPrintInlining("inlining", cl::init(true),
64 cl::desc("Print all inlined frames for a given address"));
Douglas Yung7876c0e2019-01-24 00:34:09 +000065static cl::alias
66 ClPrintInliningAliasI("i", cl::desc("Alias for -inlining"),
67 cl::NotHidden, cl::aliasopt(ClPrintInlining),
68 cl::Grouping);
69static cl::alias
70 ClPrintInliningAliasInlines("inlines", cl::desc("Alias for -inlining"),
71 cl::NotHidden, cl::aliasopt(ClPrintInlining));
Alexander Potapenko8c07f552012-11-12 11:33:29 +000072
James Henderson33c16a32019-01-22 10:24:32 +000073// -basenames, -s
74static cl::opt<bool> ClBasenames("basenames", cl::init(false),
75 cl::desc("Strip directory names from paths"));
76static cl::alias ClBasenamesShort("s", cl::desc("Alias for -basenames"),
77 cl::NotHidden, cl::aliasopt(ClBasenames));
78
Dmitry Venikov119cf662019-01-21 10:00:57 +000079// -demangle, -C, -no-demangle
Alexander Potapenko8c07f552012-11-12 11:33:29 +000080static cl::opt<bool>
Alexey Samsonovd5d7bb52013-02-15 08:54:47 +000081ClDemangle("demangle", cl::init(true), cl::desc("Demangle function names"));
Dmitry Venikovd3f21d32019-01-16 07:05:58 +000082static cl::alias
83ClDemangleShort("C", cl::desc("Alias for -demangle"),
Dmitry Venikovcce66872019-01-23 09:49:37 +000084 cl::NotHidden, cl::aliasopt(ClDemangle), cl::Grouping);
Dmitry Venikov119cf662019-01-21 10:00:57 +000085static cl::opt<bool>
86ClNoDemangle("no-demangle", cl::init(false),
87 cl::desc("Don't demangle function names"));
Alexander Potapenko8c07f552012-11-12 11:33:29 +000088
Alexey Samsonov2ca65362013-06-28 08:15:40 +000089static cl::opt<std::string> ClDefaultArch("default-arch", cl::init(""),
90 cl::desc("Default architecture "
91 "(for multi-arch objects)"));
92
Dmitry Venikov37c1e2e2019-01-11 11:51:52 +000093// -obj, -exe, -e
Alexey Samsonov60e59e22013-12-24 19:33:22 +000094static cl::opt<std::string>
95ClBinaryName("obj", cl::init(""),
96 cl::desc("Path to object file to be symbolized (if not provided, "
97 "object file should be specified for each input line)"));
Dmitry Venikov37c1e2e2019-01-11 11:51:52 +000098static cl::alias
99ClBinaryNameAliasExe("exe", cl::desc("Alias for -obj"),
100 cl::NotHidden, cl::aliasopt(ClBinaryName));
Igor Kudrin734a2bc2019-04-04 08:45:06 +0000101static cl::alias ClBinaryNameAliasE("e", cl::desc("Alias for -obj"),
102 cl::NotHidden, cl::Grouping, cl::Prefix,
103 cl::aliasopt(ClBinaryName));
Alexey Samsonov60e59e22013-12-24 19:33:22 +0000104
David Blaikiee5adb682017-07-30 01:34:08 +0000105static cl::opt<std::string>
106 ClDwpName("dwp", cl::init(""),
107 cl::desc("Path to DWP file to be use for any split CUs"));
108
Alexander Potapenko7aaf5142014-10-17 00:50:19 +0000109static cl::list<std::string>
110ClDsymHint("dsym-hint", cl::ZeroOrMore,
111 cl::desc("Path to .dSYM bundles to search for debug info for the "
112 "object files"));
Dmitry Venikov5c1768f2019-01-14 10:10:51 +0000113
114// -print-address, -addresses, -a
Hemant Kulkarni80f82fb2015-10-12 19:26:44 +0000115static cl::opt<bool>
Dmitry Venikov5c1768f2019-01-14 10:10:51 +0000116ClPrintAddress("print-address", cl::init(false),
117 cl::desc("Show address before line information"));
118static cl::alias
119ClPrintAddressAliasAddresses("addresses", cl::desc("Alias for -print-address"),
120 cl::NotHidden, cl::aliasopt(ClPrintAddress));
121static cl::alias
122ClPrintAddressAliasA("a", cl::desc("Alias for -print-address"),
Dmitry Venikovcce66872019-01-23 09:49:37 +0000123 cl::NotHidden, cl::aliasopt(ClPrintAddress), cl::Grouping);
Alexander Potapenko7aaf5142014-10-17 00:50:19 +0000124
Dmitry Venikov60d71e42019-01-10 15:33:35 +0000125// -pretty-print, -p
Hemant Kulkarnibdce12a2015-11-11 20:41:43 +0000126static cl::opt<bool>
127 ClPrettyPrint("pretty-print", cl::init(false),
128 cl::desc("Make the output more human friendly"));
Dmitry Venikov60d71e42019-01-10 15:33:35 +0000129static cl::alias ClPrettyPrintShort("p", cl::desc("Alias for -pretty-print"),
130 cl::NotHidden,
Dmitry Venikovcce66872019-01-23 09:49:37 +0000131 cl::aliasopt(ClPrettyPrint), cl::Grouping);
Hemant Kulkarnibdce12a2015-11-11 20:41:43 +0000132
Mike Aizatsky17dbc282016-01-09 00:14:35 +0000133static cl::opt<int> ClPrintSourceContextLines(
134 "print-source-context-lines", cl::init(0),
135 cl::desc("Print N number of source file context"));
136
David Blaikie0012dd52017-01-31 22:19:38 +0000137static cl::opt<bool> ClVerbose("verbose", cl::init(false),
138 cl::desc("Print verbose line info"));
139
James Henderson759d5e62019-01-25 11:49:21 +0000140// -adjust-vma
Fangrui Songb5f39842019-04-24 02:40:20 +0000141static cl::opt<uint64_t>
James Henderson759d5e62019-01-25 11:49:21 +0000142 ClAdjustVMA("adjust-vma", cl::init(0), cl::value_desc("offset"),
143 cl::desc("Add specified offset to object file addresses"));
144
James Henderson3a6a5a32019-01-10 14:10:02 +0000145static cl::list<std::string> ClInputAddresses(cl::Positional,
146 cl::desc("<input addresses>..."),
147 cl::ZeroOrMore);
148
Jordan Rupprecht5b7ad422019-02-11 18:05:48 +0000149static cl::opt<std::string>
150 ClFallbackDebugPath("fallback-debug-path", cl::init(""),
151 cl::desc("Fallback path for debug binaries."));
152
Petr Hosek00e436f2019-11-26 17:18:42 -0800153static cl::list<std::string>
154 ClDebugFileDirectory("debug-file-directory", cl::ZeroOrMore,
155 cl::value_desc("dir"),
156 cl::desc("Path to directory where to look for debug "
157 "files."));
158
Igor Kudrin0fed7b02019-04-04 08:39:40 +0000159static cl::opt<DIPrinter::OutputStyle>
160 ClOutputStyle("output-style", cl::init(DIPrinter::OutputStyle::LLVM),
Igor Kudrin1b71b7f2019-04-19 10:14:18 +0000161 cl::desc("Specify print style"),
Igor Kudrin0fed7b02019-04-04 08:39:40 +0000162 cl::values(clEnumValN(DIPrinter::OutputStyle::LLVM, "LLVM",
163 "LLVM default style"),
164 clEnumValN(DIPrinter::OutputStyle::GNU, "GNU",
165 "GNU addr2line style")));
166
James Henderson9485b262019-06-21 11:49:20 +0000167static cl::extrahelp
168 HelpResponse("\nPass @FILE as argument to read options from FILE.\n");
169
Reid Klecknerf27f3f82016-06-03 20:25:09 +0000170template<typename T>
171static bool error(Expected<T> &ResOrErr) {
172 if (ResOrErr)
Alexey Samsonov884adda2015-11-04 00:30:24 +0000173 return false;
Reid Klecknerf27f3f82016-06-03 20:25:09 +0000174 logAllUnhandledErrors(ResOrErr.takeError(), errs(),
175 "LLVMSymbolizer: error reading file: ");
Alexey Samsonov884adda2015-11-04 00:30:24 +0000176 return true;
177}
178
Peter Collingbourne9c8282a2019-06-24 20:03:23 +0000179enum class Command {
180 Code,
181 Data,
182 Frame,
183};
184
185static bool parseCommand(StringRef InputString, Command &Cmd,
Mike Aizatsky54a7c692016-01-07 23:57:41 +0000186 std::string &ModuleName, uint64_t &ModuleOffset) {
Mike Aizatsky54a7c692016-01-07 23:57:41 +0000187 const char kDelimiters[] = " \n\r";
Alexander Potapenko8c07f552012-11-12 11:33:29 +0000188 ModuleName = "";
Fangrui Song3b7499d2018-05-25 00:11:15 +0000189 if (InputString.consume_front("CODE ")) {
Peter Collingbourne9c8282a2019-06-24 20:03:23 +0000190 Cmd = Command::Code;
Fangrui Song3b7499d2018-05-25 00:11:15 +0000191 } else if (InputString.consume_front("DATA ")) {
Peter Collingbourne9c8282a2019-06-24 20:03:23 +0000192 Cmd = Command::Data;
193 } else if (InputString.consume_front("FRAME ")) {
194 Cmd = Command::Frame;
Dmitry Vyukovd08bd132013-01-11 07:16:20 +0000195 } else {
196 // If no cmd, assume it's CODE.
Peter Collingbourne9c8282a2019-06-24 20:03:23 +0000197 Cmd = Command::Code;
Dmitry Vyukovd08bd132013-01-11 07:16:20 +0000198 }
Fangrui Song3b7499d2018-05-25 00:11:15 +0000199 const char *pos = InputString.data();
Alexey Samsonov60e59e22013-12-24 19:33:22 +0000200 // Skip delimiters and parse input filename (if needed).
Fangrui Songffebfe12018-05-26 02:29:14 +0000201 if (ClBinaryName.empty()) {
Alexey Samsonov60e59e22013-12-24 19:33:22 +0000202 pos += strspn(pos, kDelimiters);
203 if (*pos == '"' || *pos == '\'') {
204 char quote = *pos;
205 pos++;
Mike Aizatsky54a7c692016-01-07 23:57:41 +0000206 const char *end = strchr(pos, quote);
Craig Toppere6cb63e2014-04-25 04:24:47 +0000207 if (!end)
Alexey Samsonov60e59e22013-12-24 19:33:22 +0000208 return false;
209 ModuleName = std::string(pos, end - pos);
210 pos = end + 1;
211 } else {
212 int name_length = strcspn(pos, kDelimiters);
213 ModuleName = std::string(pos, name_length);
214 pos += name_length;
215 }
Alexey Samsonovd2069322013-04-05 09:22:24 +0000216 } else {
Alexey Samsonov60e59e22013-12-24 19:33:22 +0000217 ModuleName = ClBinaryName;
Alexander Potapenko8c07f552012-11-12 11:33:29 +0000218 }
Alexey Samsonovd2069322013-04-05 09:22:24 +0000219 // Skip delimiters and parse module offset.
220 pos += strspn(pos, kDelimiters);
221 int offset_length = strcspn(pos, kDelimiters);
Rafael Espindola2c5bcc52015-10-24 23:23:25 +0000222 return !StringRef(pos, offset_length).getAsInteger(0, ModuleOffset);
Alexander Potapenko8c07f552012-11-12 11:33:29 +0000223}
224
James Henderson3a6a5a32019-01-10 14:10:02 +0000225static void symbolizeInput(StringRef InputString, LLVMSymbolizer &Symbolizer,
226 DIPrinter &Printer) {
Peter Collingbourne9c8282a2019-06-24 20:03:23 +0000227 Command Cmd;
James Henderson3a6a5a32019-01-10 14:10:02 +0000228 std::string ModuleName;
Alexey Lapshin77fc1f62019-02-27 13:17:36 +0000229 uint64_t Offset = 0;
Peter Collingbourne9c8282a2019-06-24 20:03:23 +0000230 if (!parseCommand(StringRef(InputString), Cmd, ModuleName, Offset)) {
James Henderson3a6a5a32019-01-10 14:10:02 +0000231 outs() << InputString;
232 return;
233 }
234
235 if (ClPrintAddress) {
236 outs() << "0x";
Alexey Lapshin77fc1f62019-02-27 13:17:36 +0000237 outs().write_hex(Offset);
James Henderson3a6a5a32019-01-10 14:10:02 +0000238 StringRef Delimiter = ClPrettyPrint ? ": " : "\n";
239 outs() << Delimiter;
240 }
Alexey Lapshin77fc1f62019-02-27 13:17:36 +0000241 Offset -= ClAdjustVMA;
Peter Collingbourne9c8282a2019-06-24 20:03:23 +0000242 if (Cmd == Command::Data) {
Alexey Lapshinb2c4b8b2019-03-23 08:08:40 +0000243 auto ResOrErr = Symbolizer.symbolizeData(
244 ModuleName, {Offset, object::SectionedAddress::UndefSection});
James Henderson3a6a5a32019-01-10 14:10:02 +0000245 Printer << (error(ResOrErr) ? DIGlobal() : ResOrErr.get());
Peter Collingbourne9c8282a2019-06-24 20:03:23 +0000246 } else if (Cmd == Command::Frame) {
247 auto ResOrErr = Symbolizer.symbolizeFrame(
248 ModuleName, {Offset, object::SectionedAddress::UndefSection});
249 if (!error(ResOrErr)) {
250 for (DILocal Local : *ResOrErr)
251 Printer << Local;
252 if (ResOrErr->empty())
253 outs() << "??\n";
254 }
James Henderson3a6a5a32019-01-10 14:10:02 +0000255 } else if (ClPrintInlining) {
Alexey Lapshinb2c4b8b2019-03-23 08:08:40 +0000256 auto ResOrErr = Symbolizer.symbolizeInlinedCode(
Peter Collingbournee5bdeda2019-06-11 02:32:27 +0000257 ModuleName, {Offset, object::SectionedAddress::UndefSection});
James Henderson3a6a5a32019-01-10 14:10:02 +0000258 Printer << (error(ResOrErr) ? DIInliningInfo() : ResOrErr.get());
Igor Kudrin4bc29cb2019-04-19 10:12:56 +0000259 } else if (ClOutputStyle == DIPrinter::OutputStyle::GNU) {
260 // With ClPrintFunctions == FunctionNameKind::LinkageName (default)
261 // and ClUseSymbolTable == true (also default), Symbolizer.symbolizeCode()
262 // may override the name of an inlined function with the name of the topmost
263 // caller function in the inlining chain. This contradicts the existing
264 // behavior of addr2line. Symbolizer.symbolizeInlinedCode() overrides only
265 // the topmost function, which suits our needs better.
266 auto ResOrErr = Symbolizer.symbolizeInlinedCode(
Peter Collingbournee5bdeda2019-06-11 02:32:27 +0000267 ModuleName, {Offset, object::SectionedAddress::UndefSection});
Igor Kudrin4bc29cb2019-04-19 10:12:56 +0000268 Printer << (error(ResOrErr) ? DILineInfo() : ResOrErr.get().getFrame(0));
James Henderson3a6a5a32019-01-10 14:10:02 +0000269 } else {
Alexey Lapshinb2c4b8b2019-03-23 08:08:40 +0000270 auto ResOrErr = Symbolizer.symbolizeCode(
Peter Collingbournee5bdeda2019-06-11 02:32:27 +0000271 ModuleName, {Offset, object::SectionedAddress::UndefSection});
James Henderson3a6a5a32019-01-10 14:10:02 +0000272 Printer << (error(ResOrErr) ? DILineInfo() : ResOrErr.get());
273 }
Igor Kudrin4bc29cb2019-04-19 10:12:56 +0000274 if (ClOutputStyle == DIPrinter::OutputStyle::LLVM)
275 outs() << "\n";
James Henderson3a6a5a32019-01-10 14:10:02 +0000276}
277
Alexander Potapenko8c07f552012-11-12 11:33:29 +0000278int main(int argc, char **argv) {
Rui Ueyama197194b2018-04-13 18:26:06 +0000279 InitLLVM X(argc, argv);
Alexander Potapenko8c07f552012-11-12 11:33:29 +0000280
Igor Kudrin99f641c2019-04-19 10:17:52 +0000281 bool IsAddr2Line = sys::path::stem(argv[0]).contains("addr2line");
282
283 if (IsAddr2Line) {
284 ClDemangle.setInitialValue(false);
285 ClPrintFunctions.setInitialValue(FunctionNameKind::None);
286 ClPrintInlining.setInitialValue(false);
Peter Collingbournea56d81f2019-08-05 20:59:25 +0000287 ClUntagAddresses.setInitialValue(false);
Igor Kudrin99f641c2019-04-19 10:17:52 +0000288 ClOutputStyle.setInitialValue(DIPrinter::OutputStyle::GNU);
289 }
290
Zachary Turner20dbd0d2015-04-27 17:19:51 +0000291 llvm::sys::InitializeCOMRAII COM(llvm::sys::COMThreadingMode::MultiThreaded);
Petr Hosekdedad082019-12-18 10:19:47 -0800292 cl::ParseCommandLineOptions(
293 argc, argv, IsAddr2Line ? "llvm-addr2line\n" : "llvm-symbolizer\n",
294 /*Errs=*/nullptr,
295 IsAddr2Line ? "LLVM_ADDR2LINE_OPTS" : "LLVM_SYMBOLIZER_OPTS");
Dmitry Venikov119cf662019-01-21 10:00:57 +0000296
297 // If both --demangle and --no-demangle are specified then pick the last one.
298 if (ClNoDemangle.getPosition() > ClDemangle.getPosition())
299 ClDemangle = !ClNoDemangle;
300
Peter Collingbournea2048f82019-06-11 02:31:54 +0000301 LLVMSymbolizer::Options Opts;
302 Opts.PrintFunctions = ClPrintFunctions;
303 Opts.UseSymbolTable = ClUseSymbolTable;
304 Opts.Demangle = ClDemangle;
305 Opts.RelativeAddresses = ClUseRelativeAddress;
Peter Collingbournea56d81f2019-08-05 20:59:25 +0000306 Opts.UntagAddresses = ClUntagAddresses;
Peter Collingbournea2048f82019-06-11 02:31:54 +0000307 Opts.DefaultArch = ClDefaultArch;
308 Opts.FallbackDebugPath = ClFallbackDebugPath;
Peter Collingbournee5bdeda2019-06-11 02:32:27 +0000309 Opts.DWPName = ClDwpName;
Petr Hosek00e436f2019-11-26 17:18:42 -0800310 Opts.DebugFileDirectory = ClDebugFileDirectory;
Hemant Kulkarnibdce12a2015-11-11 20:41:43 +0000311
Alexander Potapenko7aaf5142014-10-17 00:50:19 +0000312 for (const auto &hint : ClDsymHint) {
313 if (sys::path::extension(hint) == ".dSYM") {
314 Opts.DsymHints.push_back(hint);
315 } else {
316 errs() << "Warning: invalid dSYM hint: \"" << hint <<
317 "\" (must have the '.dSYM' extension).\n";
318 }
319 }
Alexey Samsonovea83baf2013-01-22 14:21:19 +0000320 LLVMSymbolizer Symbolizer(Opts);
Alexander Potapenko8c07f552012-11-12 11:33:29 +0000321
Hemant Kulkarnibdce12a2015-11-11 20:41:43 +0000322 DIPrinter Printer(outs(), ClPrintFunctions != FunctionNameKind::None,
James Henderson33c16a32019-01-22 10:24:32 +0000323 ClPrettyPrint, ClPrintSourceContextLines, ClVerbose,
Igor Kudrin0fed7b02019-04-04 08:39:40 +0000324 ClBasenames, ClOutputStyle);
Alexey Samsonovd6aa8202015-11-03 22:20:52 +0000325
James Henderson3a6a5a32019-01-10 14:10:02 +0000326 if (ClInputAddresses.empty()) {
327 const int kMaxInputStringLength = 1024;
328 char InputString[kMaxInputStringLength];
Mike Aizatsky54a7c692016-01-07 23:57:41 +0000329
James Henderson7f313502019-06-04 15:34:58 +0000330 while (fgets(InputString, sizeof(InputString), stdin)) {
James Henderson3a6a5a32019-01-10 14:10:02 +0000331 symbolizeInput(InputString, Symbolizer, Printer);
James Henderson7f313502019-06-04 15:34:58 +0000332 outs().flush();
333 }
James Henderson3a6a5a32019-01-10 14:10:02 +0000334 } else {
335 for (StringRef Address : ClInputAddresses)
336 symbolizeInput(Address, Symbolizer, Printer);
Alexander Potapenko8c07f552012-11-12 11:33:29 +0000337 }
Zachary Turner20dbd0d2015-04-27 17:19:51 +0000338
Alexander Potapenko8c07f552012-11-12 11:33:29 +0000339 return 0;
340}