50 lines · python
1"""2Test things related to the fission debug information style where the main object3file contains a skeleton compile unit and the main debug info is in .dwo files.4"""5 6import lldb7from lldbsuite.test.decorators import *8from lldbsuite.test.lldbtest import *9from lldbsuite.test import lldbutil10import os11 12 13class ExecTestCase(TestBase):14 NO_DEBUG_INFO_TESTCASE = True15 16 def test_zero_dwo_id(self):17 """18 Test that we can load a .o file that has a skeleton compile unit19 with a DWO ID of zero. We do this by hacking up the yaml to emit20 zero as a DWO ID is both the .o file and .dwo file. Then we make21 sure we can resolve something in the debug information to verify22 that we were able to load the .dwo file corrrectly since that is23 the only place that has this information.24 """25 src_dir = self.getSourceDir()26 dwo_yaml_path = os.path.join(src_dir, "main.dwo.yaml")27 obj_yaml_path = os.path.join(src_dir, "main.o.yaml")28 dwo_path = self.getBuildArtifact("main.dwo")29 obj_path = self.getBuildArtifact("main.o")30 self.yaml2obj(dwo_yaml_path, dwo_path)31 self.yaml2obj(obj_yaml_path, obj_path)32 33 # We need the current working directory to be set to the build directory34 os.chdir(self.getBuildDir())35 # Create a target with the object file we just created from YAML36 target = self.dbg.CreateTarget(obj_path)37 self.assertTrue(target, VALID_TARGET)38 39 # Set a breakpoint by file and line, this doesn't require anything from40 # the .dwo file.41 bp = target.BreakpointCreateByLocation("main.cpp", 6)42 self.assertEqual(bp.GetNumLocations(), 1)43 bp_loc = bp.GetLocationAtIndex(0)44 self.assertTrue(bp_loc.IsValid())45 46 # We will use the address of the location to resolve the function "main"47 # to make sure we were able to open the .dwo file since this is the only48 # place that contains debug info for the function.49 self.assertTrue(bp_loc.GetAddress().GetFunction().IsValid())50