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