1 """ Testing explicit symbol loading via target symbols add. """
3 from lldbsuite
.test
.decorators
import *
4 from lldbsuite
.test
.lldbtest
import *
5 from lldbsuite
.test
import lldbutil
8 class TargetSymbolsAddCommand(TestBase
):
11 self
.source
= "main.c"
13 @no_debug_info_test # Prevent the genaration of the dwarf version of this test
14 @skipUnlessPlatform(["linux"])
15 def test_target_symbols_add(self
):
16 """Test that 'target symbols add' can load the symbols
17 even if gnu.build-id and gnu_debuglink are not present in the module.
18 Similar to test_add_dsym_mid_execution test for macos."""
20 exe
= self
.getBuildArtifact("stripped.out")
22 self
.target
= self
.dbg
.CreateTarget(exe
)
23 self
.assertTrue(self
.target
, VALID_TARGET
)
25 main_bp
= self
.target
.BreakpointCreateByName("main", "stripped.out")
26 self
.assertTrue(main_bp
, VALID_BREAKPOINT
)
28 self
.process
= self
.target
.LaunchSimple(
29 None, None, self
.get_process_working_directory()
31 self
.assertTrue(self
.process
, PROCESS_IS_VALID
)
33 # The stop reason of the thread should be breakpoint.
35 self
.process
.GetState(), lldb
.eStateStopped
, STOPPED_DUE_TO_BREAKPOINT
38 exe_module
= self
.target
.GetModuleAtIndex(0)
40 # Check that symbols are not loaded and main.c is not know to be
42 self
.expect("frame select", substrs
=["main.c"], matching
=False)
44 # Tell LLDB that a.out has symbols for stripped.out
46 "target symbols add -s %s %s" % (exe
, self
.getBuildArtifact("a.out"))
49 # Check that symbols are now loaded and main.c is in the output.
50 self
.expect("frame select", substrs
=["main.c"])