Skip to content

Skip GNU backtrace test on Arm 32-bit#149493

Merged
diegorusso merged 5 commits intopython:mainfrom
diegorusso:backtrace-arm
May 8, 2026
Merged

Skip GNU backtrace test on Arm 32-bit#149493
diegorusso merged 5 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

@StanFromIreland
Copy link
Copy Markdown
Member

Updating to fix some errors we introduced on the main branch.

@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 42177ce 🤖

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 diegorusso requested a review from markshannon May 8, 2026 10:36
Copy link
Copy Markdown
Member

@markshannon markshannon left a comment

Choose a reason for hiding this comment

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

Looks good, and much simpler now

@diegorusso diegorusso changed the title Skip GNU backtrace test on Arm 32-bit without unwind tables Skip GNU backtrace test on Arm 32-bit May 8, 2026
@diegorusso diegorusso merged commit 2a8cece into python:main May 8, 2026
54 checks passed
@diegorusso diegorusso added the needs backport to 3.15 pre-release feature fixes, bugs and security fixes label May 8, 2026
@miss-islington-app
Copy link
Copy Markdown

Thanks @diegorusso for the PR 🌮🎉.. I'm working now to backport this PR to: 3.15.
🐍🍒⛏🤖

@bedevere-app
Copy link
Copy Markdown

bedevere-app Bot commented May 8, 2026

GH-149562 is a backport of this pull request to the 3.15 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 pre-release feature fixes, bugs and security fixes label May 8, 2026
@diegorusso diegorusso deleted the backtrace-arm branch May 8, 2026 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip issue skip news tests Tests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants