Skip to content

Commit 241060f

Browse files
committed
[lldb] Pass the target triple when determining the DWARF version
When targeting iOS, the default dwarf version is 2 and not 4. Currently, the test suite does not pick up on that because it invokes the test compiler without a target triple. This patch fixes that and now correctly skips tests that have a dwarf version specified in a skipIf decorator. rdar://84530477 Differential revision: https://reviews.llvm.org/D112325 (cherry picked from commit 0f12cf7)
1 parent ccd5c84 commit 241060f

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

lldb/packages/Python/lldbsuite/test/builders/builder.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ def getCompiler(self):
2020
compiler = lldbutil.which(compiler)
2121
return os.path.abspath(compiler)
2222

23+
def getTriple(self, arch):
24+
"""Returns the triple for the given architecture or None."""
25+
return None
26+
2327
def getExtraMakeArgs(self):
2428
"""
2529
Helper function to return extra argumentsfor the make system. This

lldb/packages/Python/lldbsuite/test/builders/darwin.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,13 @@ def get_triple():
5555

5656

5757
class BuilderDarwin(Builder):
58+
def getTriple(self, arch):
59+
vendor, os, version, env = get_triple()
60+
components = [arch, vendor, os, version, env]
61+
if None in components:
62+
return None
63+
return '-'.join(components)
64+
5865
def getExtraMakeArgs(self):
5966
"""
6067
Helper function to return extra argumentsfor the make system. This

lldb/packages/Python/lldbsuite/test/lldbtest.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1370,15 +1370,18 @@ def getDwarfVersion(self):
13701370
return str(configuration.dwarf_version)
13711371
if 'clang' in self.getCompiler():
13721372
try:
1373+
triple = builder_module().getTriple(self.getArchitecture())
1374+
target = ['-target', triple] if triple else []
13731375
driver_output = check_output(
1374-
[self.getCompiler()] + '-g -c -x c - -o - -###'.split(),
1376+
[self.getCompiler()] + target + '-g -c -x c - -o - -###'.split(),
13751377
stderr=STDOUT)
13761378
driver_output = driver_output.decode("utf-8")
13771379
for line in driver_output.split(os.linesep):
13781380
m = re.search('dwarf-version=([0-9])', line)
13791381
if m:
13801382
return m.group(1)
1381-
except: pass
1383+
except CalledProcessError:
1384+
pass
13821385
return '0'
13831386

13841387
def platformIsDarwin(self):

0 commit comments

Comments
 (0)