2 Test symbol table access for main.m.
6 from lldbsuite
.test
.decorators
import *
7 from lldbsuite
.test
.lldbtest
import *
8 from lldbsuite
.test
import lldbutil
11 class FoundationSymtabTestCase(TestBase
):
13 "-[MyString initWithNSString:]",
14 "-[MyString dealloc]",
15 "-[MyString description]",
16 "-[MyString descriptionPauses]", # synthesized property
17 "-[MyString setDescriptionPauses:]", # synthesized property
25 @add_test_categories(["pyapi"])
26 def test_with_python_api(self
):
27 """Test symbol table access with Python APIs."""
29 exe
= self
.getBuildArtifact("a.out")
30 target
= self
.dbg
.CreateTarget(exe
)
31 self
.assertTrue(target
, VALID_TARGET
)
33 # Launch the process, and do not stop at the entry point.
34 process
= target
.LaunchSimple(None, None, self
.get_process_working_directory())
35 self
.assertTrue(process
, PROCESS_IS_VALID
)
37 # Create the filespec by which to locate our a.out module. Use the
38 # absolute path to get the module for the current variant.
39 filespec
= lldb
.SBFileSpec(exe
, False)
41 module
= target
.FindModule(filespec
)
42 self
.assertTrue(module
, VALID_MODULE
)
44 # Create the set of known symbols. As we iterate through the symbol
45 # table, remove the symbol from the set if it is a known symbol.
46 expected_symbols
= set(self
.symbols_list
)
48 self
.assertTrue(symbol
, VALID_SYMBOL
)
49 self
.trace("symbol:", symbol
)
50 name
= symbol
.GetName()
51 if name
in expected_symbols
:
53 "Removing %s from known_symbols %s" % (name
, expected_symbols
)
55 expected_symbols
.remove(name
)
57 # At this point, the known_symbols set should have become an empty set.
58 # If not, raise an error.
59 self
.trace("symbols unaccounted for:", expected_symbols
)
61 len(expected_symbols
), 0, "All the known symbols are accounted for"