[Lldb-commits] [PATCH] D112325: [lldb] Pass the target triple to the compiler when determining the DWARF version
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rG0f12cf7ebaaf: [lldb] Pass the target triple when determining the DWARF version (authored by JDevlieghere). Herald added a project: LLDB. Changed prior to commit: https://reviews.llvm.org/D112325?vs=381575=381591#toc Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D112325/new/ https://reviews.llvm.org/D112325 Files: lldb/packages/Python/lldbsuite/test/builders/builder.py lldb/packages/Python/lldbsuite/test/builders/darwin.py lldb/packages/Python/lldbsuite/test/lldbtest.py Index: lldb/packages/Python/lldbsuite/test/lldbtest.py === --- lldb/packages/Python/lldbsuite/test/lldbtest.py +++ lldb/packages/Python/lldbsuite/test/lldbtest.py @@ -1347,15 +1347,18 @@ return str(configuration.dwarf_version) if 'clang' in self.getCompiler(): try: +triple = builder_module().getTriple(self.getArchitecture()) +target = ['-target', triple] if triple else [] driver_output = check_output( -[self.getCompiler()] + '-g -c -x c - -o - -###'.split(), +[self.getCompiler()] + target + '-g -c -x c - -o - -###'.split(), stderr=STDOUT) driver_output = driver_output.decode("utf-8") for line in driver_output.split(os.linesep): m = re.search('dwarf-version=([0-9])', line) if m: return m.group(1) -except: pass +except CalledProcessError: +pass return '0' def platformIsDarwin(self): Index: lldb/packages/Python/lldbsuite/test/builders/darwin.py === --- lldb/packages/Python/lldbsuite/test/builders/darwin.py +++ lldb/packages/Python/lldbsuite/test/builders/darwin.py @@ -55,6 +55,13 @@ class BuilderDarwin(Builder): +def getTriple(self, arch): +vendor, os, version, env = get_triple() +components = [arch, vendor, os, version, env] +if None in components: +return None +return '-'.join(components) + def getExtraMakeArgs(self): """ Helper function to return extra argumentsfor the make system. This Index: lldb/packages/Python/lldbsuite/test/builders/builder.py === --- lldb/packages/Python/lldbsuite/test/builders/builder.py +++ lldb/packages/Python/lldbsuite/test/builders/builder.py @@ -21,6 +21,10 @@ compiler = lldbutil.which(compiler) return os.path.abspath(compiler) +def getTriple(self, arch): +"""Returns the triple for the given architecture or None.""" +return None + def getExtraMakeArgs(self): """ Helper function to return extra argumentsfor the make system. This Index: lldb/packages/Python/lldbsuite/test/lldbtest.py === --- lldb/packages/Python/lldbsuite/test/lldbtest.py +++ lldb/packages/Python/lldbsuite/test/lldbtest.py @@ -1347,15 +1347,18 @@ return str(configuration.dwarf_version) if 'clang' in self.getCompiler(): try: +triple = builder_module().getTriple(self.getArchitecture()) +target = ['-target', triple] if triple else [] driver_output = check_output( -[self.getCompiler()] + '-g -c -x c - -o - -###'.split(), +[self.getCompiler()] + target + '-g -c -x c - -o - -###'.split(), stderr=STDOUT) driver_output = driver_output.decode("utf-8") for line in driver_output.split(os.linesep): m = re.search('dwarf-version=([0-9])', line) if m: return m.group(1) -except: pass +except CalledProcessError: +pass return '0' def platformIsDarwin(self): Index: lldb/packages/Python/lldbsuite/test/builders/darwin.py === --- lldb/packages/Python/lldbsuite/test/builders/darwin.py +++ lldb/packages/Python/lldbsuite/test/builders/darwin.py @@ -55,6 +55,13 @@ class BuilderDarwin(Builder): +def getTriple(self, arch): +vendor, os, version, env = get_triple() +components = [arch, vendor, os, version, env] +if None in components: +return None +return '-'.join(components) + def getExtraMakeArgs(self): """ Helper function to return extra argumentsfor the make system. This Index: lldb/packages/Python/lldbsuite/test/builders/builder.py
[Lldb-commits] [PATCH] D112325: [lldb] Pass the target triple to the compiler when determining the DWARF version
vsk added a comment. Thanks! Lgtm as well, but with the same nits as Raphael. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D112325/new/ https://reviews.llvm.org/D112325 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D112325: [lldb] Pass the target triple to the compiler when determining the DWARF version
teemperor accepted this revision. teemperor added a comment. This revision is now accepted and ready to land. Some nits but otherwise LGTM Comment at: lldb/packages/Python/lldbsuite/test/builders/builder.py:26 +"""Returns the triple for the given architecture or an empty string.""" +return "" + Maybe return `None`? Then the calling code crashes if it doesn't handle the value instead of silently picking the next arg as some bogus triple value. Comment at: lldb/packages/Python/lldbsuite/test/builders/darwin.py:60 +vendor, os, version, env = get_triple() +if arch is None or vendor is None or os is None or version is None or env is None: +return "" ``` lang=python values = [arch, vendor, os, version, env] if None in values: return "" return '-'.join(values) ``` CHANGES SINCE LAST ACTION https://reviews.llvm.org/D112325/new/ https://reviews.llvm.org/D112325 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D112325: [lldb] Pass the target triple to the compiler when determining the DWARF version
JDevlieghere created this revision. JDevlieghere added reviewers: labath, teemperor, vsk. JDevlieghere requested review of this revision. 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. https://reviews.llvm.org/D112325 Files: lldb/packages/Python/lldbsuite/test/builders/builder.py lldb/packages/Python/lldbsuite/test/builders/darwin.py lldb/packages/Python/lldbsuite/test/lldbtest.py Index: lldb/packages/Python/lldbsuite/test/lldbtest.py === --- lldb/packages/Python/lldbsuite/test/lldbtest.py +++ lldb/packages/Python/lldbsuite/test/lldbtest.py @@ -1347,15 +1347,19 @@ return str(configuration.dwarf_version) if 'clang' in self.getCompiler(): try: +module = builder_module() +triple = module.getTriple(self.getArchitecture()) +target = ['-target', triple] if triple else [] driver_output = check_output( -[self.getCompiler()] + '-g -c -x c - -o - -###'.split(), +[self.getCompiler()] + target + '-g -c -x c - -o - -###'.split(), stderr=STDOUT) driver_output = driver_output.decode("utf-8") for line in driver_output.split(os.linesep): m = re.search('dwarf-version=([0-9])', line) if m: return m.group(1) -except: pass +except CalledProcessError: +pass return '0' def platformIsDarwin(self): Index: lldb/packages/Python/lldbsuite/test/builders/darwin.py === --- lldb/packages/Python/lldbsuite/test/builders/darwin.py +++ lldb/packages/Python/lldbsuite/test/builders/darwin.py @@ -55,6 +55,12 @@ class BuilderDarwin(Builder): +def getTriple(self, arch): +vendor, os, version, env = get_triple() +if arch is None or vendor is None or os is None or version is None or env is None: +return "" +return '-'.join([arch, vendor, os, version, env]) + def getExtraMakeArgs(self): """ Helper function to return extra argumentsfor the make system. This Index: lldb/packages/Python/lldbsuite/test/builders/builder.py === --- lldb/packages/Python/lldbsuite/test/builders/builder.py +++ lldb/packages/Python/lldbsuite/test/builders/builder.py @@ -21,6 +21,10 @@ compiler = lldbutil.which(compiler) return os.path.abspath(compiler) +def getTriple(self, arch): +"""Returns the triple for the given architecture or an empty string.""" +return "" + def getExtraMakeArgs(self): """ Helper function to return extra argumentsfor the make system. This Index: lldb/packages/Python/lldbsuite/test/lldbtest.py === --- lldb/packages/Python/lldbsuite/test/lldbtest.py +++ lldb/packages/Python/lldbsuite/test/lldbtest.py @@ -1347,15 +1347,19 @@ return str(configuration.dwarf_version) if 'clang' in self.getCompiler(): try: +module = builder_module() +triple = module.getTriple(self.getArchitecture()) +target = ['-target', triple] if triple else [] driver_output = check_output( -[self.getCompiler()] + '-g -c -x c - -o - -###'.split(), +[self.getCompiler()] + target + '-g -c -x c - -o - -###'.split(), stderr=STDOUT) driver_output = driver_output.decode("utf-8") for line in driver_output.split(os.linesep): m = re.search('dwarf-version=([0-9])', line) if m: return m.group(1) -except: pass +except CalledProcessError: +pass return '0' def platformIsDarwin(self): Index: lldb/packages/Python/lldbsuite/test/builders/darwin.py === --- lldb/packages/Python/lldbsuite/test/builders/darwin.py +++ lldb/packages/Python/lldbsuite/test/builders/darwin.py @@ -55,6 +55,12 @@ class BuilderDarwin(Builder): +def getTriple(self, arch): +vendor, os, version, env = get_triple() +if arch is None or vendor is None or os is None or version is None or env is None: +return "" +return '-'.join([arch, vendor, os, version, env]) + def getExtraMakeArgs(self): """ Helper function to return extra argumentsfor the make system.