Issue |
101710
|
Summary |
Inconsistent behavior in lldb-shell :: Unwind/windows-unaligned-x86_64.test
|
Labels |
new issue
|
Assignees |
|
Reporter |
kendalharland
|
## Overview
My local build of this test produces a binary whose `realign_stack` and `call_func` symbols are not visible to `lldb` so the test fails to match to the expected output of `thread backtrace` as these symbol names appear as empty strings in the stack trace output.
To make this test pass, I had to create [this local patch](https://github.com/llvm/llvm-project/compare/main...kendalharland:llvm-project:kendal/fix-win-unaligned-test) which is certainly not the correct way to fix things but demonstrates my problem well.
## Background
In particular, here are the problems I observe:
1. lld-link does not produce a binary that exports the `realign_stack` and `call_func` symbols which are defined as `.globl` in [windows-unaligned-x86_64-asm.s](https://github.com/llvm/llvm-project/blob/90065da6d5a5f661b60c2f75b0f2dc094d27f4f5/lldb/test/Shell/Unwind/Inputs/windows-unaligned-x86_64-asm.s), even though `lldb-pdbutil` indicates that these symbols are “public” in the final executable:
```
PS C:\workspace\llvm-project> C:\workspace\llvm-project\build\bin\llvm-pdbutil.exe pretty --externals C:\workspace\llvm-project\build\tools\lldb\test\Shell\Unwind\Output\windows-unaligned-x86_64.test.pdb | Select-String -Pattern realign_stack
public [0x0000104e] realign_stack
PS C:\workspace\llvm-project> C:\workspace\llvm-project\build\bin\llvm-pdbutil.exe pretty --externals C:\workspace\llvm-project\build\tools\lldb\test\Shell\Unwind\Output\windows-unaligned-x86_64.test.pdb | Select-String -Pattern call_func
public [0x00001040] call_func
```
As a workaround I’ve manually exported the symbols in build.py using e.g. `/EXPORT:realign_stack`
2. LLDB doesn’t appear to load PDB symbols from a separate `.pdb` file automatically. It’s unclear if the original test author ran into this problem from their [PR discussion](https://reviews.llvm.org/D129455) so as a workaround I added an explicit `add-dysm ...` call to load the symbols.
3. LLDB seems to have a hard time parsing PDB files and crashes when `add-dsym` is called. I believe this is a known issue [[1]](https://github.com/ziglang/zig/issues/13095), [[2]](https://github.com/llvm/llvm-project/issues/91060)]. Given that there are 2 PDB readers to choose from: LLDB’s implementation (default) and the Windows Native reader, as a workaround I’ve used the native one by setting `LLDB_USE_NATIVE_PDB_READER=1`.
## Questions
1. Is there any contributor that is currently running this test in their CI, and if so does it pass? (Perhaps @dzhidzhoev).
2. What toolchain differences would cause the `realign_stack` and `call_func` symbols not to exported in one build vs another? Different assembler? Compiler version? Linker version? I would like to fix this locally and then update the test's `REQUIRES` statement if possible.
3. What needs to be done to make LLDB's build in PDB reader function locally? If this test is running in someone's CI without LLDB_USE_NATIVE_PBD_READER=1, there must be some steps I skipped in setting up PDB support and I'd like to document these.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs