Skip to content

Commit 3358e2d

Browse files
committed
Skip GNU backtrace test on Arm 32-bit without unwind tables
backtrace() on 32-bit ARM EABI depends on runtime unwind tables emitted as .ARM.exidx/.ARM.extab. Without -funwind-tables, glibc can return an empty stack even though GDB can still unwind using debug-only .debug_frame data. Only skip the GNU backtrace unwind test on Arm 32-bit builds that lack -funwind-tables, instead of skipping all Arm 32-bit builds.
1 parent 13188db commit 3358e2d

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

Lib/test/test_frame_pointer_unwind.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,21 @@ def _frame_pointers_expected(machine):
8989
return None
9090

9191

92+
def _gnu_backtrace_requires_unwind_tables(machine):
93+
if not (sys.maxsize < 2**32 and machine.startswith("arm")):
94+
return False
95+
96+
cflags = " ".join(
97+
value for value in (
98+
sysconfig.get_config_var("PY_CFLAGS"),
99+
sysconfig.get_config_var("PY_CORE_CFLAGS"),
100+
sysconfig.get_config_var("CFLAGS"),
101+
)
102+
if value
103+
)
104+
return "-funwind-tables" not in cflags.split()
105+
106+
92107
def _build_stack_and_unwind(unwinder):
93108
import operator
94109

@@ -295,6 +310,10 @@ def test_manual_unwind_respects_frame_pointers(self):
295310
@support.requires_gil_enabled("test requires the GIL enabled")
296311
@unittest.skipIf(support.is_wasi, "test not supported on WASI")
297312
@unittest.skipUnless(sys.platform == "linux", "GNU backtrace unwinding test requires Linux")
313+
@unittest.skipIf(
314+
_gnu_backtrace_requires_unwind_tables(platform.machine().lower()),
315+
"GNU backtrace unwinding on Arm 32-bit requires -funwind-tables",
316+
)
298317
class GnuBacktraceUnwindTests(unittest.TestCase):
299318

300319
def setUp(self):

0 commit comments

Comments
 (0)