Skip to content

Commit 287ca7b

Browse files
authored
[LLDB] Use native PDB reader by default (llvm#165363)
All PDB tests now pass when compiled without DIA on Windows, so they pass with the native reader. With this PR, the default reader changes to the native reader. The plan is to eventually remove the DIA reader (see https://discourse.llvm.org/t/rfc-removing-the-dia-pdb-plugin-from-lldb/87827 and llvm#114906). For now, DIA can be used by setting `plugin.symbol-file.pdb.reader` to `dia` or by setting `LLDB_USE_NATIVE_PDB_READER=0` (mostly undocumented, but used in tests).
1 parent 9b818af commit 287ca7b

File tree

4 files changed

+17
-19
lines changed

4 files changed

+17
-19
lines changed

lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ constexpr OptionEnumValueElement g_pdb_reader_enums[] = {
8383
{
8484
ePDBReaderDefault,
8585
"default",
86-
"Use DIA PDB reader unless LLDB_USE_NATIVE_PDB_READER environment "
87-
"variable is set",
86+
"Use native PDB reader unless LLDB_USE_NATIVE_PDB_READER environment "
87+
"is set to 0",
8888
},
8989
{
9090
ePDBReaderDIA,
@@ -109,16 +109,10 @@ enum {
109109
static const bool g_should_use_native_reader_by_default = [] {
110110
llvm::StringRef env_value = ::getenv("LLDB_USE_NATIVE_PDB_READER");
111111

112-
#if !LLVM_ENABLE_DIA_SDK || !defined(_WIN32)
113-
// if the environment value is unset, the native reader is requested
114-
if (env_value.empty())
115-
return true;
116-
#endif
117-
118-
return env_value.equals_insensitive("on") ||
119-
env_value.equals_insensitive("yes") ||
120-
env_value.equals_insensitive("1") ||
121-
env_value.equals_insensitive("true");
112+
return !env_value.equals_insensitive("off") &&
113+
!env_value.equals_insensitive("no") &&
114+
!env_value.equals_insensitive("0") &&
115+
!env_value.equals_insensitive("false");
122116
}();
123117

124118
class PluginProperties : public Properties {

lldb/test/Shell/SymbolFile/NativePDB/native-setting.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
// RUN: env LLDB_USE_NATIVE_PDB_READER=0 %lldb %t.exe -o 'target modules dump symfile' 2>&1 | FileCheck --check-prefix=ENV0 %s
99
// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb %t.exe -o 'target modules dump symfile' 2>&1 | FileCheck --check-prefix=ENV1 %s
1010

11-
// RUN: env LLDB_USE_NATIVE_PDB_READER=foo %lldb %t.exe -o 'target modules dump symfile' 2>&1 | FileCheck --check-prefix=ENV0 %s
12-
// RUN: env LLDB_USE_NATIVE_PDB_READER=42 %lldb %t.exe -o 'target modules dump symfile' 2>&1 | FileCheck --check-prefix=ENV0 %s
13-
// RUN: env LLDB_USE_NATIVE_PDB_READER=-1 %lldb %t.exe -o 'target modules dump symfile' 2>&1 | FileCheck --check-prefix=ENV0 %s
11+
// RUN: env LLDB_USE_NATIVE_PDB_READER=foo %lldb %t.exe -o 'target modules dump symfile' 2>&1 | FileCheck --check-prefix=ENV1 %s
12+
// RUN: env LLDB_USE_NATIVE_PDB_READER=42 %lldb %t.exe -o 'target modules dump symfile' 2>&1 | FileCheck --check-prefix=ENV1 %s
13+
// RUN: env LLDB_USE_NATIVE_PDB_READER=-1 %lldb %t.exe -o 'target modules dump symfile' 2>&1 | FileCheck --check-prefix=ENV1 %s
1414

1515
// RUN: env LLDB_USE_NATIVE_PDB_READER=0 %lldb \
1616
// RUN: -o 'settings set plugin.symbol-file.pdb.reader dia' \

lldb/test/Shell/SymbolFile/PDB/native-setting.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
// RUN: env LLDB_USE_NATIVE_PDB_READER=0 %lldb %t.exe -o 'target modules dump symfile' 2>&1 | FileCheck --check-prefix=ENV0 %s
99
// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb %t.exe -o 'target modules dump symfile' 2>&1 | FileCheck --check-prefix=ENV1 %s
1010

11-
// RUN: env LLDB_USE_NATIVE_PDB_READER=foo %lldb %t.exe -o 'target modules dump symfile' 2>&1 | FileCheck --check-prefix=ENV0 %s
12-
// RUN: env LLDB_USE_NATIVE_PDB_READER=42 %lldb %t.exe -o 'target modules dump symfile' 2>&1 | FileCheck --check-prefix=ENV0 %s
13-
// RUN: env LLDB_USE_NATIVE_PDB_READER=-1 %lldb %t.exe -o 'target modules dump symfile' 2>&1 | FileCheck --check-prefix=ENV0 %s
11+
// RUN: env LLDB_USE_NATIVE_PDB_READER=foo %lldb %t.exe -o 'target modules dump symfile' 2>&1 | FileCheck --check-prefix=ENV1 %s
12+
// RUN: env LLDB_USE_NATIVE_PDB_READER=42 %lldb %t.exe -o 'target modules dump symfile' 2>&1 | FileCheck --check-prefix=ENV1 %s
13+
// RUN: env LLDB_USE_NATIVE_PDB_READER=-1 %lldb %t.exe -o 'target modules dump symfile' 2>&1 | FileCheck --check-prefix=ENV1 %s
1414

1515
// RUN: env LLDB_USE_NATIVE_PDB_READER=0 %lldb \
1616
// RUN: -o 'settings set plugin.symbol-file.pdb.reader dia' \
@@ -36,7 +36,7 @@
3636
// NO-ENV-NOT: warning:
3737
// NO-ENV: (lldb) target modules dump symfile
3838
// NO-ENV: Dumping debug symbols for 1 modules.
39-
// NO-ENV: SymbolFile pdb
39+
// NO-ENV: SymbolFile native-pdb
4040

4141
// ENV0-NOT: warning:
4242
// ENV0: (lldb) target modules dump symfile

llvm/docs/ReleaseNotes.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,10 @@ Changes to LLDB
191191
* The `show-progress` setting, which became a NOOP with the introduction of the
192192
statusline, now defaults to off and controls using OSC escape codes to show a
193193
native progress bar in supporting terminals like Ghostty and ConEmu.
194+
* The default PDB reader on Windows was changed from DIA to native, which uses
195+
LLVM's PDB and CodeView support. You can switch back to the DIA reader with
196+
`settings set plugin.symbol-file.pdb.reader dia`. Note that support for the
197+
DIA reader will be removed in a future version of LLDB.
194198

195199
Changes to BOLT
196200
---------------------------------

0 commit comments

Comments
 (0)