Skip to content

Skip GNU backtrace test on Arm 32-bit without unwind tables#149493

Open
diegorusso wants to merge 4 commits intopython:mainfrom
diegorusso:backtrace-arm
Open

Skip GNU backtrace test on Arm 32-bit without unwind tables#149493
diegorusso wants to merge 4 commits intopython:mainfrom
diegorusso:backtrace-arm

Conversation

@diegorusso
Copy link
Copy Markdown
Contributor

@diegorusso diegorusso commented May 7, 2026

backtrace() and GDB use different unwinding paths.

On AArch64, runtime unwinding normally uses DWARF CFI in .eh_frame / .eh_frame_hdr.
On 32-bit ARM EABI, the runtime unwind format is .ARM.exidx / .ARM.extab, as specified by the Arm EHABI (https://github.com/ARM-software/abi-aa/blob/main/ehabi32/ehabi32.rst#the-object-producer-interface)

GDB can still unwind the 32-bit ARM binary because it can read debugger-only DWARF CFI from .debug_frame, while glibc backtrace() runs inside the process and needs runtime unwind metadata.

Without -funwind-tables, the 32-bit ARM build has effectively empty runtime unwind metadata:

  .ARM.exidx contains 1 entry:
    _start: cantunwind

With -funwind-tables, GCC emits the ARM EHABI runtime unwind tables needed by backtrace().
GCC documents -funwind-tables as generating the needed static unwind data without otherwise changing generated code.

This PR skips the GNU backtrace unwind test only on 32-bit Arm builds that lack -funwind-tables, instead of skipping all 32-bit Arm builds.

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.
@encukou
Copy link
Copy Markdown
Member

encukou commented May 7, 2026

!buildbot ARM Raspbian

@bedevere-bot
Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @encukou for commit 3358e2d 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F149493%2Fmerge

The command will test the builders whose names match following regular expression: ARM Raspbian

The builders matched are:

  • ARM Raspbian PR

@diegorusso
Copy link
Copy Markdown
Contributor Author

still failing...

Comment thread Lib/test/test_frame_pointer_unwind.py Outdated


def _gnu_backtrace_requires_unwind_tables(machine):
if not (sys.maxsize < 2**32 and machine.startswith("arm")):
Copy link
Copy Markdown
Member

@encukou encukou May 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIK it's an aarch64 machine, with a 32-bit Python build?

Suggested change
if not (sys.maxsize < 2**32 and machine.startswith("arm")):
if not (sys.maxsize < 2**32 and machine.startswith(("arm", "aarch"))):

But we're deep into overfitting to Buildbot workers here :/

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mmm I don't think this is the right approach. We need to base the condition about the build of Python

@diegorusso
Copy link
Copy Markdown
Contributor Author

!buildbot ARM Raspbian

@bedevere-bot
Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @diegorusso for commit cb52a24 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F149493%2Fmerge

The command will test the builders whose names match following regular expression: ARM Raspbian

The builders matched are:

  • ARM Raspbian PR

Comment thread Lib/test/test_frame_pointer_unwind.py Outdated
Comment on lines +118 to +130
for option in options:
if option == "-funwind-tables":
unwind_tables = True
elif option == "-fno-unwind-tables":
unwind_tables = False
elif option == "-fasynchronous-unwind-tables":
asynchronous_unwind_tables = True
elif option == "-fno-asynchronous-unwind-tables":
asynchronous_unwind_tables = False
elif option == "-fexceptions":
exceptions = True
elif option == "-fno-exceptions":
exceptions = False
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a lot of untested logic.
Should we skip the test for any 32-bit Arm?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tend to agree with you. On Arm 32bit you can have unwind data with any of these flags: -funwind-tables, -fasynchronous-unwind-tables, -fexceptions

GNU backtrace() can return an empty stack on 32-bit Arm
when the build lacks suitable runtime unwind tables.
Rather than trying to infer the effective unwind-table
compiler flags in the test, skip the GNU backtrace tests
on all 32-bit Arm builds.
@diegorusso
Copy link
Copy Markdown
Contributor Author

!buildbot ARM Raspbian

@bedevere-bot
Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @diegorusso for commit 61015e1 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F149493%2Fmerge

The command will test the builders whose names match following regular expression: ARM Raspbian

The builders matched are:

  • ARM Raspbian PR

@diegorusso
Copy link
Copy Markdown
Contributor Author

!buildbot ARM Raspbian

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants