aboutsummaryrefslogtreecommitdiff
path: root/lldb/test/API/python_api
diff options
context:
space:
mode:
authorn2h9 <13541181+n2h9@users.noreply.github.com>2025-11-26 16:36:19 -0300
committerGitHub <noreply@github.com>2025-11-26 11:36:19 -0800
commita4d42775b9af0d961f71934e38342a9384534022 (patch)
tree2583715f297afeaf23e2b50af60d678c2b7a72fe /lldb/test/API/python_api
parent684f64c0baca15c84e222c0f7c7455e8c505e575 (diff)
downloadllvm-a4d42775b9af0d961f71934e38342a9384534022.tar.gz
llvm-a4d42775b9af0d961f71934e38342a9384534022.tar.bz2
llvm-a4d42775b9af0d961f71934e38342a9384534022.zip
[lldb] [scripting bridge] 167388 chore: add api to return arch name for target (#168273)
This pr fixes #167388 . ## Description This pr adds new method `GetArchName` to `SBTarget` so that no need to parse triple to get arch name in client code. ## Testing ### All from `TestTargetAPI.py` run test with ``` ./build/bin/lldb-dotest -v -p TestTargetAPI.py ``` <details> <summary>existing tests (without newly added)</summary> <img width="1425" height="804" alt="image" src="https://github.com/user-attachments/assets/617e4c69-5c6b-44c4-9aeb-b751a47e253c" /> </details> <details> <summary>existing tests (with newly added)</summary> <img width="1422" height="778" alt="image" src="https://github.com/user-attachments/assets/746990a1-df88-4348-a090-224963d3c640" /> </details> ### Only `test_get_arch_name` run test with ``` ./build/bin/lldb-dotest -v -p TestTargetAPI.py -f test_get_arch_name_dwarf -f test_get_arch_name_dwo -f test_get_arch_name_dsym lldb/test/API/python_api/target ``` <details> <summary>only newly added</summary> <img width="1422" height="778" alt="image" src="https://github.com/user-attachments/assets/fcaafa5d-2622-4171-acee-e104ecee0652" /> </details> --------- Signed-off-by: Nikita B <n2h9z4@gmail.com> Co-authored-by: Jonas Devlieghere <jonas@devlieghere.com>
Diffstat (limited to 'lldb/test/API/python_api')
-rw-r--r--lldb/test/API/python_api/target/TestTargetAPI.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/lldb/test/API/python_api/target/TestTargetAPI.py b/lldb/test/API/python_api/target/TestTargetAPI.py
index d346563af18e..d3c64d87375b 100644
--- a/lldb/test/API/python_api/target/TestTargetAPI.py
+++ b/lldb/test/API/python_api/target/TestTargetAPI.py
@@ -105,6 +105,24 @@ class TargetAPITestCase(TestBase):
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.assertTrue(len(arch_name) > 0, "Got an arch name")
+
+ # Test consistency with triple.
+ triple = target.triple
+ self.assertTrue(len(triple) > 0, "Got a triple")
+ self.assertEqual(
+ triple.split("-")[0],
+ arch_name,
+ "Arch name is equal to the first item of the triple",
+ )
+
def test_get_ABIName(self):
d = {"EXE": "b.out"}
self.build(dictionary=d)