test_c_stack_unwind fails on Linux LoongArch builds
Ninguém assumiu esta issue ainda.
- Linguagem predominante
- Python
- Estrelas
- 77.2k
- Forks
- 35.9k
- Métricas de merge de PRs
- Métricas de PR pendentes
Descrição
Bug report
Bug description:
On the Linux LoongArch64 platform, the test_c_stack_unwind test fails because CPython's manually implemented frame-pointer unwinding mechanism fails to recognize the LoongArch stack frame layout (as it relies on the default FRAME_POINTER_NEXT_OFFSET and FRAME_POINTER_RETURN_OFFSET). This issue affects builds using both GCC and Clang.
In the LoongArch architecture, the frame pointer points to the caller's stack pointer; the previous frame pointer is stored at fp[-2], and the return address is stored at fp[-1].
Additionally, for CPython builds compiled with Clang, unexpected failures occur in test sections involving the GNU backtrace() function. By default, Clang/LoongArch generates .debug_frame sections but does not generate the .eh_frame unwinding tables required for runtime unwinding of CPython's C objects. Consequently, glibc's backtrace() returns only a single stack frame and cannot unwind through Python stack frames.
Reproducer
GCC build:
../cpython/configure --with-pydebug CC=gcc
make -j8
PYTHON_JIT=0 ./python -m test -v test_c_stack_unwind
clang build:
../cpython/configure --with-pydebug CC=clang
make -j8
PYTHON_JIT=0 ./python -m test -v test_c_stack_unwind
Environment
- CPython main
- Linux LoongArch64
- GCC version: 15.3.0
- Clang 20.1.8
- glibc 2.42
CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux
Linked PRs
- gh-152241
- gh-152578
Guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Direção de pesquisa
Execute PYTHON_JIT=0 ./python -m test -v test_c_stack_unwind no Linux LoongArch64 com GCC e Clang, e depois inspecione o desenrolamento de frame pointer implementado manualmente no CPython e as seções de teste que usam GNU backtrace(). Está concluído quando o teste reconhecer o layout de frames do LoongArch e os testes de build aplicáveis do Clang não falharem mais; os PRs vinculados gh-152241 e gh-152578 indicam que o trabalho já está em andamento.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- c, linux, python
- Domínio
- compilers, operating-systems, testing-qa
- Tipo de issue
- Bug
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Status de atividade
- Estagnada
- Clareza
- Razoavelmente clara
- Facilidade para iniciantes
- 25/100