Files
clang-p2996/lldb/test/API/python_api/unnamed_symbol_lookup/TestUnnamedSymbolLookup.py
Jason Molenda 6d6feaf7e3 [lldb][NFC] update API tests which skip/expect-fail arm
The architectures provided to skipIf / expectedFail are regular
expressions (v. _match_decorator_property() in decorators.py
so on Darwin systems "arm64" would match the skips for "arm" (32-bit
Linux).  Update these to "arm$" to prevent this, and also update
three tests (TestBuiltinFormats.py, TestCrossDSOTailCalls.py,
TestCrossObjectTailCalls.py) that were skipped for arm64 via this
behavior, and need to be skipped or they will fail.

This was moviated by the new TestDynamicValue.py test which has
an expected-fail for arm, but the test was passing on arm64 Darwin
resulting in failure for the CIs.
2025-05-27 18:41:16 -07:00

44 lines
1.5 KiB
Python

"""
Test lookup unnamed symbols.
"""
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
# --keep-symbol causes error on Windows: llvm-strip.exe: error: option is not supported for COFF
@skipIfWindows
# Unnamed symbols don't get into the .eh_frame section on ARM, so LLDB can't find them.
@skipIf(archs=["arm$"])
class TestUnnamedSymbolLookup(TestBase):
def test_unnamed_symbol_lookup(self):
"""Test looking up unnamed symbol synthetic name"""
self.build()
(target, process, thread, bkpt) = lldbutil.run_to_name_breakpoint(
self, "main", exe_name="a.out.stripped"
)
main_frame = thread.GetFrameAtIndex(0)
# Step until reaching the unnamed symbol called from main
for _ in range(100):
thread.StepInto()
if thread.GetFrameAtIndex(0) != main_frame:
break
thread.StepInto()
self.assertEqual(
main_frame, thread.GetFrameAtIndex(1), "Expected to be called from main"
)
symbol = thread.GetFrameAtIndex(0).GetSymbol()
self.assertIsNotNone(symbol, "unnamed symbol called from main not reached")
self.assertTrue(symbol.name.startswith("___lldb_unnamed_symbol"))
exe_module = symbol.GetStartAddress().GetModule()
found_symbols = exe_module.FindSymbols(symbol.name)
self.assertIsNotNone(found_symbols)
self.assertEqual(found_symbols.GetSize(), 1)