diff --git a/lld/test/COFF/symbolizer-inline.s b/lld/test/COFF/symbolizer-inline.s --- a/lld/test/COFF/symbolizer-inline.s +++ b/lld/test/COFF/symbolizer-inline.s @@ -1,7 +1,7 @@ # REQUIRES: x86 # RUN: llvm-mc -filetype=obj %s -o %t.obj -triple x86_64-windows-msvc # RUN: lld-link -entry:main -nodefaultlib %t.obj -out:%t.exe -pdb:%t.pdb -debug -# RUN: llvm-symbolizer --obj=%t.exe --use-native-pdb-reader --relative-address \ +# RUN: llvm-symbolizer --obj=%t.exe --relative-address \ # RUN: 0x1014 0x1018 0x101c 0x1023 0x1024 | FileCheck %s # Compiled from this cpp code, with modifications to add extra inline line and diff --git a/llvm/include/llvm/DebugInfo/Symbolize/Symbolize.h b/llvm/include/llvm/DebugInfo/Symbolize/Symbolize.h --- a/llvm/include/llvm/DebugInfo/Symbolize/Symbolize.h +++ b/llvm/include/llvm/DebugInfo/Symbolize/Symbolize.h @@ -43,7 +43,7 @@ bool Demangle = true; bool RelativeAddresses = false; bool UntagAddresses = false; - bool UseNativePDBReader = false; + bool UseDIA = false; std::string DefaultArch; std::vector DsymHints; std::string FallbackDebugPath; diff --git a/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp b/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp --- a/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp +++ b/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp @@ -557,11 +557,8 @@ using namespace pdb; std::unique_ptr Session; - PDB_ReaderType ReaderType = PDB_ReaderType::Native; -#if LLVM_ENABLE_DIA_SDK - if (!Opts.UseNativePDBReader) - ReaderType = PDB_ReaderType::DIA; -#endif + PDB_ReaderType ReaderType = + Opts.UseDIA ? PDB_ReaderType::DIA : PDB_ReaderType::Native; if (auto Err = loadDataForEXE(ReaderType, Objects.first->getFileName(), Session)) { Modules.emplace(ModuleName, std::unique_ptr()); diff --git a/llvm/test/tools/llvm-symbolizer/pdb/pdb-columns.test b/llvm/test/tools/llvm-symbolizer/pdb/pdb-columns.test --- a/llvm/test/tools/llvm-symbolizer/pdb/pdb-columns.test +++ b/llvm/test/tools/llvm-symbolizer/pdb/pdb-columns.test @@ -8,8 +8,6 @@ RUN: echo 0x140006C70 >> %t.input RUN: llvm-symbolizer -obj="%p/Inputs/test-columns.exe" < %t.input \ RUN: | FileCheck %s -RUN: llvm-symbolizer -obj="%p/Inputs/test-columns.exe" -use-native-pdb-reader < %t.input \ -RUN: | FileCheck %s This tests that the symbolizer outputs column info when it is present in the pdb. diff --git a/llvm/test/tools/llvm-symbolizer/pdb/pdb.test b/llvm/test/tools/llvm-symbolizer/pdb/pdb.test --- a/llvm/test/tools/llvm-symbolizer/pdb/pdb.test +++ b/llvm/test/tools/llvm-symbolizer/pdb/pdb.test @@ -11,12 +11,13 @@ RUN: llvm-symbolizer --obj="%p/Inputs/test.exe" --no-demangle < %t.input \ RUN: | FileCheck %s --check-prefix=CHECK-NO-DEMANGLE -Test with native pdb reader. -RUN: llvm-symbolizer -use-native-pdb-reader -obj="%p/Inputs/test.exe" < %t.input \ +; Check that -dia works +RUN: llvm-symbolizer -dia -obj="%p/Inputs/test.exe" < %t.input \ RUN: | FileCheck %s -RUN: llvm-symbolizer --use-native-pdb-reader --obj="%p/Inputs/test.exe" --no-demangle < %t.input \ +RUN: llvm-symbolizer -dia --obj="%p/Inputs/test.exe" --no-demangle < %t.input \ RUN: | FileCheck %s --check-prefix=CHECK-NO-DEMANGLE + Subtract ImageBase from all the offsets and run the test again with --relative-address. @@ -24,10 +25,6 @@ RUN: | llvm-symbolizer --obj="%p/Inputs/test.exe" --no-demangle --relative-address \ RUN: | FileCheck %s --check-prefix=CHECK-NO-DEMANGLE -RUN: %python -c 'import sys;print("\n".join([hex(int(x, 16) - 0x400000) for x in sys.stdin]))' < %t.input \ -RUN: | llvm-symbolizer --use-native-pdb-reader --obj="%p/Inputs/test.exe" --no-demangle --relative-address \ -RUN: | FileCheck %s --check-prefix=CHECK-NO-DEMANGLE - CHECK: foo(void) CHECK-NEXT: test.cpp:10 CHECK: {{^private_symbol$}} diff --git a/llvm/tools/llvm-symbolizer/Opts.td b/llvm/tools/llvm-symbolizer/Opts.td --- a/llvm/tools/llvm-symbolizer/Opts.td +++ b/llvm/tools/llvm-symbolizer/Opts.td @@ -41,7 +41,7 @@ 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">; defm untag_addresses : B<"untag-addresses", "", "Remove memory tags from addresses before symbolization">; -def use_native_pdb_reader : F<"use-native-pdb-reader", "Use native PDB functionality">; +def use_dia: F<"dia", "Use DIA for symbolization">; def verbose : F<"verbose", "Print verbose line info">; def version : F<"version", "Display the version">; diff --git a/llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp b/llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp --- a/llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp +++ b/llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp @@ -288,7 +288,7 @@ Opts.RelativeAddresses = Args.hasArg(OPT_relative_address); Opts.UntagAddresses = Args.hasFlag(OPT_untag_addresses, OPT_no_untag_addresses, !IsAddr2Line); - Opts.UseNativePDBReader = Args.hasArg(OPT_use_native_pdb_reader); + Opts.UseDIA = Args.hasArg(OPT_use_dia); Opts.UseSymbolTable = true; for (const opt::Arg *A : Args.filtered(OPT_dsym_hint_EQ)) {