[Lldb-commits] [lldb] [lldb] [scripting bridge] 167388 chore: add api to return arch name for target (PR #168273)

via lldb-commits lldb-commits at lists.llvm.org
Sun Nov 16 11:55:26 PST 2025


================
@@ -105,6 +105,20 @@ def test_resolve_file_address(self):
         self.assertIsNotNone(data_section2)
         self.assertEqual(data_section.name, data_section2.name)
 
+    def test_get_arch_name(self):
+        d = {"EXE": "b.out"}
+        self.build(dictionary=d)
+        self.setTearDownCleanup(dictionary=d)
+        target = self.create_simple_target("b.out")
+
+        arch_name = target.arch_name
+        self.assertNotEqual(len(arch_name), 0, "Got an arch name string")
----------------
n2h9 wrote:

Makes sense.

I tried to specify architecture when calling `self.build`, like in this commit https://github.com/llvm/llvm-project/pull/168273/commits/329aec5b1a5f619247ae64d36944885e58cba142
 but it does not work as expected, looks like the architecture is still the runtime one (if I put `arm` there GetArchName still returns `x86_64`, which is what I use to run the test). 
Or how one properly specifies the specific architecture? 

So, I used the value from `self.getArchitecture()` to assert the value from `arch_name`, it is working fine on my platform, will it be ok to use this value for assertion?  

Also we could probably just assert that the `arch_name` is eq to the first element of the `triple, as this is probably we expect from this method. 

https://github.com/llvm/llvm-project/pull/168273


More information about the lldb-commits mailing list