diff options
Diffstat (limited to 'llvm/tools/llvm-symbolizer')
| -rw-r--r-- | llvm/tools/llvm-symbolizer/Opts.td | 1 | ||||
| -rw-r--r-- | llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp | 15 |
2 files changed, 10 insertions, 6 deletions
diff --git a/llvm/tools/llvm-symbolizer/Opts.td b/llvm/tools/llvm-symbolizer/Opts.td index edc80bfe5967..d0b227af9db4 100644 --- a/llvm/tools/llvm-symbolizer/Opts.td +++ b/llvm/tools/llvm-symbolizer/Opts.td @@ -55,6 +55,7 @@ def pretty_print : F<"pretty-print", "Make the output more human friendly">; defm print_source_context_lines : Eq<"print-source-context-lines", "Print N lines of source file context">; def relative_address : F<"relative-address", "Interpret addresses as addresses relative to the image base">; def relativenames : F<"relativenames", "Strip the compilation directory from paths">; +def skip_line_zero : F<"skip-line-zero","If an address does not have an associated line number, use the last line number from the current sequence in the line-table">; defm untag_addresses : B<"untag-addresses", "", "Remove memory tags from addresses before symbolization">; def use_dia: F<"dia", "Use the DIA library to access symbols (Windows only)">; def verbose : F<"verbose", "Print verbose line info">; diff --git a/llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp b/llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp index 6d7953f3109a..3ba7f59d5b84 100644 --- a/llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp +++ b/llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp @@ -56,12 +56,13 @@ enum ID { #undef OPTION }; -#define PREFIX(NAME, VALUE) \ - static constexpr StringLiteral NAME##_init[] = VALUE; \ - static constexpr ArrayRef<StringLiteral> NAME(NAME##_init, \ - std::size(NAME##_init) - 1); +#define OPTTABLE_STR_TABLE_CODE #include "Opts.inc" -#undef PREFIX +#undef OPTTABLE_STR_TABLE_CODE + +#define OPTTABLE_PREFIXES_TABLE_CODE +#include "Opts.inc" +#undef OPTTABLE_PREFIXES_TABLE_CODE using namespace llvm::opt; static constexpr opt::OptTable::Info InfoTable[] = { @@ -72,7 +73,8 @@ static constexpr opt::OptTable::Info InfoTable[] = { class SymbolizerOptTable : public opt::GenericOptTable { public: - SymbolizerOptTable() : GenericOptTable(InfoTable) { + SymbolizerOptTable() + : GenericOptTable(OptionStrTable, OptionPrefixesTable, InfoTable) { setGroupedShortOptions(true); } }; @@ -490,6 +492,7 @@ int llvm_symbolizer_main(int argc, char **argv, const llvm::ToolContext &) { } else { Opts.PathStyle = DILineInfoSpecifier::FileLineInfoKind::AbsoluteFilePath; } + Opts.SkipLineZero = Args.hasArg(OPT_skip_line_zero); Opts.DebugFileDirectory = Args.getAllArgValues(OPT_debug_file_directory_EQ); Opts.DefaultArch = Args.getLastArgValue(OPT_default_arch_EQ).str(); Opts.Demangle = Args.hasFlag(OPT_demangle, OPT_no_demangle, !IsAddr2Line); |
