Skip to content

Commit d24bce5

Browse files
committed
Add a testcase for .dSYM path remapping dictionaries.
rdar://problem/56924558
1 parent e0f1d9d commit d24bce5

File tree

3 files changed

+69
-0
lines changed

3 files changed

+69
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
void stop() {}
2+
3+
int main()
4+
{
5+
stop();
6+
// Hello World!
7+
return 0;
8+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
BOTDIR = $(BUILDDIR)/buildbot
2+
USERDIR = $(BUILDDIR)/user
3+
C_SOURCES = $(BOTDIR)/main.c
4+
5+
include Makefile.rules
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import lldb
2+
from lldbsuite.test.decorators import *
3+
import lldbsuite.test.lldbtest as lldbtest
4+
import lldbsuite.test.lldbutil as lldbutil
5+
import os
6+
import unittest2
7+
8+
9+
class TestDSYMSourcePathRemapping(lldbtest.TestBase):
10+
11+
mydir = lldbtest.TestBase.compute_mydir(__file__)
12+
13+
def build(self):
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)
19+
import shutil
20+
for f in ['main.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))
23+
24+
super(TestDSYMSourcePathRemapping, self).build()
25+
26+
# Remove the build sources.
27+
self.assertTrue(os.path.isdir(botdir))
28+
shutil.rmtree(botdir)
29+
30+
# Create a plist.
31+
import subprocess
32+
dsym = self.getBuildArtifact('a.out.dSYM')
33+
uuid = subprocess.check_output(["/usr/bin/dwarfdump", "--uuid", dsym]
34+
).decode("utf-8").split(" ")[1]
35+
import re
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')
42+
f.write('<dict>\n')
43+
f.write(' <key>DBGSourcePathRemapping</key>\n')
44+
f.write(' <dict>\n')
45+
f.write(' <key>' + botdir + '</key>\n')
46+
f.write(' <string>' + userdir + '</string>\n')
47+
f.write(' </dict>\n')
48+
f.write('</dict>\n')
49+
f.write('</plist>\n')
50+
51+
52+
@skipIf(debug_info=no_match("dsym"))
53+
def test(self):
54+
self.build()
55+
lldbutil.run_to_name_breakpoint(self, 'main')
56+
self.expect("source list", substrs=["Hello World"])

0 commit comments

Comments
 (0)