2 from lldbsuite
.test
.decorators
import *
3 import lldbsuite
.test
.lldbtest
as lldbtest
4 import lldbsuite
.test
.lldbutil
as lldbutil
9 class TestDSYMSourcePathRemapping(lldbtest
.TestBase
):
11 mydir
= lldbtest
.TestBase
.compute_mydir(__file__
)
14 botdir
= self
.getBuildArtifact('buildbot')
15 userdir
= self
.getBuildArtifact('user')
16 inputs
= self
.getSourcePath('Inputs')
17 lldbutil
.mkdir_p(botdir
)
18 lldbutil
.mkdir_p(userdir
)
20 for f
in ['main.c', 'relative.c']:
21 shutil
.copyfile(os
.path
.join(inputs
, f
), os
.path
.join(botdir
, f
))
22 shutil
.copyfile(os
.path
.join(inputs
, f
), os
.path
.join(userdir
, f
))
24 super(TestDSYMSourcePathRemapping
, self
).build()
26 # Remove the build sources.
27 self
.assertTrue(os
.path
.isdir(botdir
))
32 dsym
= self
.getBuildArtifact('a.out.dSYM')
33 uuid
= subprocess
.check_output(["/usr/bin/dwarfdump", "--uuid", dsym
]
34 ).decode("utf-8").split(" ")[1]
36 self
.assertTrue(re
.match(r
'[0-9a-fA-F-]+', uuid
))
37 plist
= os
.path
.join(dsym
, 'Contents', 'Resources', uuid
+ '.plist')
38 with
open(plist
, 'w') as f
:
39 f
.write('<?xml version="1.0" encoding="UTF-8"?>\n')
40 f
.write('<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">\n')
41 f
.write('<plist version="1.0">\n')
43 f
.write(' <key>DBGSourcePathRemapping</key>\n')
45 f
.write(' <key>' + botdir
+ '</key>\n')
46 f
.write(' <string>' + userdir
+ '</string>\n')
52 @skipIf(debug_info
=no_match("dsym"))
56 target
, process
, _
, _
= lldbutil
.run_to_name_breakpoint(
58 self
.expect("source list -n main", substrs
=["Hello Absolute"])
59 bkpt
= target
.BreakpointCreateByName('relative')
60 lldbutil
.continue_to_breakpoint(process
, bkpt
)
61 self
.expect("source list -n relative", substrs
=["Hello Relative"])