Skip to content

Commit

Permalink
[lldb] [test] Extend D55859 symbols.enable-external-lookup=false for …
Browse files Browse the repository at this point in the history
…more testcases

D55859 <https://reviews.llvm.org/D55859> has no effect for some of the
testcases so this patch extends it even for (all?) other testcases known to me.
LLDB was failing when LLDB prints errors reading system debug infos
(`*-debuginfo.rpm`, DWZ-optimized) which should never happen as LLDB testcases
should not be affected by system debug infos.

`lldb/packages/Python/lldbsuite/test/api/multithreaded/driver.cpp.template` is
using only SB API which does not expose `ModuleList` so I had to call
`HandleCommand()` there.

`lldb-test.cpp` could also use `HandleCommand` and then there would be no need
for `ModuleListProperties::SetEnableExternalLookup()` but I think it is cleaner
with API and not on based on text commands.

Differential Revision: https://reviews.llvm.org/D63339

llvm-svn: 363567
  • Loading branch information
jankratochvil committed Jun 17, 2019
1 parent 15b7f5b commit 8c82c41
Show file tree
Hide file tree
Showing 16 changed files with 48 additions and 6 deletions.
1 change: 1 addition & 0 deletions lldb/include/lldb/Core/ModuleList.h
Expand Up @@ -52,6 +52,7 @@ class ModuleListProperties : public Properties {
FileSpec GetClangModulesCachePath() const;
bool SetClangModulesCachePath(llvm::StringRef path);
bool GetEnableExternalLookup() const;
bool SetEnableExternalLookup(bool new_value);
};

/// \class ModuleList ModuleList.h "lldb/Core/ModuleList.h"
Expand Down
Expand Up @@ -7,6 +7,9 @@

# Test for enabling pending breakpoints globally

settings set symbols.enable-external-lookup false
# CHECK: ^done

-break-insert printf
# CHECK: ^error,msg="Command 'break-insert'. Breakpoint location 'printf' not found

Expand Down
3 changes: 3 additions & 0 deletions lldb/lit/tools/lldb-mi/breakpoint/break-insert.test
Expand Up @@ -6,6 +6,9 @@

# Test that a breakpoint can be inserted before creating a target.

settings set symbols.enable-external-lookup false
# CHECK: ^done

-break-insert breakpoint
# CHECK: ^done,bkpt={number="1"

Expand Down
3 changes: 3 additions & 0 deletions lldb/lit/tools/lldb-mi/data/data-info-line.test
Expand Up @@ -8,6 +8,9 @@
# Check that we have a valid target created via '%lldbmi %t'.
# CHECK: ^done

settings set symbols.enable-external-lookup false
# CHECK: ^done

-break-insert main
# CHECK: ^done,bkpt={number="1"

Expand Down
3 changes: 3 additions & 0 deletions lldb/lit/tools/lldb-mi/exec/exec-continue.test
Expand Up @@ -8,6 +8,9 @@
# Check that we have a valid target created via '%lldbmi %t'.
# CHECK: ^done

settings set symbols.enable-external-lookup false
# CHECK: ^done

-break-insert main
# CHECK: ^done,bkpt={number="1"

Expand Down
3 changes: 3 additions & 0 deletions lldb/lit/tools/lldb-mi/exec/exec-finish.test
Expand Up @@ -6,6 +6,9 @@
# Check that we have a valid target created via '%lldbmi %t'.
# CHECK: ^done

settings set symbols.enable-external-lookup false
# CHECK: ^done

-break-insert main
# CHECK: ^done,bkpt={number="1"

Expand Down
3 changes: 3 additions & 0 deletions lldb/lit/tools/lldb-mi/exec/exec-interrupt.test
Expand Up @@ -8,6 +8,9 @@
# Check that we have a valid target created via '%lldbmi %t'.
# CHECK: ^done

settings set symbols.enable-external-lookup false
# CHECK: ^done

-break-insert main
# CHECK: ^done,bkpt={number="1"

Expand Down
3 changes: 3 additions & 0 deletions lldb/lit/tools/lldb-mi/exec/exec-next-instruction.test
Expand Up @@ -8,6 +8,9 @@
# Check that we have a valid target created via '%lldbmi %t'.
# CHECK: ^done

settings set symbols.enable-external-lookup false
# CHECK: ^done

-break-insert main
# CHECK: ^done,bkpt={number="1"

Expand Down
3 changes: 3 additions & 0 deletions lldb/lit/tools/lldb-mi/exec/exec-next.test
Expand Up @@ -9,6 +9,9 @@
# Check that we have a valid target created via '%lldbmi %t'.
# CHECK: ^done

settings set symbols.enable-external-lookup false
# CHECK: ^done

-break-insert main
# CHECK: ^done,bkpt={number="1"

Expand Down
3 changes: 3 additions & 0 deletions lldb/lit/tools/lldb-mi/exec/exec-step-instruction.test
Expand Up @@ -8,6 +8,9 @@
# Check that we have a valid target created via '%lldbmi %t'.
# CHECK: ^done

settings set symbols.enable-external-lookup false
# CHECK: ^done

-break-insert main
# CHECK: ^done,bkpt={number="1"

Expand Down
3 changes: 3 additions & 0 deletions lldb/lit/tools/lldb-mi/exec/exec-step.test
Expand Up @@ -8,6 +8,9 @@
# Check that we have a valid target created via '%lldbmi %t'.
# CHECK: ^done

settings set symbols.enable-external-lookup false
# CHECK: ^done

-break-insert main
# CHECK: ^done,bkpt={number="1"

Expand Down
Expand Up @@ -31,6 +31,7 @@ int main(int argc, char** argv) {

SBDebugger::Initialize();
SBDebugger dbg = SBDebugger::Create();
dbg.HandleCommand("settings set symbols.enable-external-lookup false");

try {
if (!dbg.IsValid())
Expand Down
8 changes: 4 additions & 4 deletions lldb/packages/Python/lldbsuite/test/lldbtest.py
Expand Up @@ -729,12 +729,12 @@ def setUp(self):
else:
self.lldbVSCodeExec = None

self.lldbOption = "-o 'settings set symbols.enable-external-lookup false'"

# If we spawn an lldb process for test (via pexpect), do not load the
# init file unless told otherwise.
if "NO_LLDBINIT" in os.environ and "NO" == os.environ["NO_LLDBINIT"]:
self.lldbOption = ""
else:
self.lldbOption = "--no-lldbinit"
if os.environ.get("NO_LLDBINIT") != "NO":
self.lldbOption += " --no-lldbinit"

# Assign the test method name to self.testMethodName.
#
Expand Down
Expand Up @@ -447,8 +447,10 @@ def request_attach(self, program=None, pid=None, waitFor=None, trace=None,
args_dict['waitFor'] = waitFor
if trace:
args_dict['trace'] = trace
args_dict['initCommands'] = [
'settings set symbols.enable-external-lookup false']
if initCommands:
args_dict['initCommands'] = initCommands
args_dict['initCommands'].extend(initCommands)
if preRunCommands:
args_dict['preRunCommands'] = preRunCommands
if stopCommands:
Expand Down Expand Up @@ -582,8 +584,10 @@ def request_launch(self, program, args=None, cwd=None, env=None,
args_dict['shellExpandArguments'] = shellExpandArguments
if trace:
args_dict['trace'] = trace
args_dict['initCommands'] = [
'settings set symbols.enable-external-lookup false']
if initCommands:
args_dict['initCommands'] = initCommands
args_dict['initCommands'].extend(initCommands)
if preRunCommands:
args_dict['preRunCommands'] = preRunCommands
if stopCommands:
Expand Down
5 changes: 5 additions & 0 deletions lldb/source/Core/ModuleList.cpp
Expand Up @@ -102,6 +102,11 @@ bool ModuleListProperties::GetEnableExternalLookup() const {
nullptr, idx, g_properties[idx].default_uint_value != 0);
}

bool ModuleListProperties::SetEnableExternalLookup(bool new_value) {
return m_collection_sp->SetPropertyAtIndexAsBoolean(
nullptr, ePropertyEnableExternalLookup, new_value);
}

FileSpec ModuleListProperties::GetClangModulesCachePath() const {
return m_collection_sp
->GetPropertyAtIndexAsOptionValueFileSpec(nullptr, false,
Expand Down
1 change: 1 addition & 0 deletions lldb/tools/lldb-test/lldb-test.cpp
Expand Up @@ -975,6 +975,7 @@ int main(int argc, const char *argv[]) {
CleanUp TerminateDebugger([&] { DebuggerLifetime.Terminate(); });

auto Dbg = lldb_private::Debugger::CreateInstance();
ModuleList::GetGlobalModuleListProperties().SetEnableExternalLookup(false);

if (!opts::Log.empty())
Dbg->EnableLog("lldb", {"all"}, opts::Log, 0, errs());
Expand Down

0 comments on commit 8c82c41

Please sign in to comment.