[lldb][AIX] AIX pthread debugging in LLDB: need lldb-server to obtain symbol addresses
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
Hi Community,
I hope you are doing well.
As some of you may already know, I have been working on an AIX support fork for LLDB:
[`https://github.com/DhruvSrivastavaX/lldb-for-aix`](https://github.com/DhruvSrivastavaX/lldb-for-aix)
At the moment, live debugging support is working for single-threaded processes, and I am now trying to extend this to live multi-threaded debugging on AIX. I would be very grateful for your guidance on the best architectural direction for this.
On AIX, pthread-aware debugging relies on the system library `libpthdebug`. This library does not discover thread state on its own; instead, it expects the debugger to provide a set of callbacks for:
- resolving required runtime symbols
- reading inferior memory
- writing inferior memory
- reading thread registers
- writing thread registers
- allocation
- reallocation
- deallocation
- optional printing/logging
From LLDB's pov, this integration naturally belongs on the server side, inside the native process layer, Memory/register-related callbacks therefore map reasonably well to the existing design.
The current blocker is symbol resolution.
Before `libpthdebug` can initialize meaningfully, it needs the addresses of a few pthread runtime data symbols from the inferior process. My concern is that implementing full symbol parsing inside lldb-server would duplicate functionality that already exists on the LLDB client side, and more importantly, it does not seem very aligned with lldb-server's nature as it is not expected to be symbol-aware.
Because of that, I am considering whether the better approach would be to let the server request symbol resolution from the LLDB client. However, that would likely require extending the communication channel between client and server.
I would sincerely appreciate any suggestions on how best to approach this while staying aligned with LLDB’s architecture and design principles.
In particular, I would be grateful for thoughts on:
- whether symbol lookup should remain client-side
- whether adding a dedicated client/server request for symbol resolution would be acceptable
- or whether there is an existing LLDB pattern that would fit this problem better
@DavidSpickett @labath since you are already familiar with much of this fork and the AIX work so far, I would especially value your suggestions on this.
Thank you very much for your time and guidance.
Edit: Added reference links:
https://www.ibm.com/docs/en/aix/7.3.0?topic=programming-developing-multithreaded-program-debuggers
https://www.ibm.com/docs/en/aix/7.3.0?topic=mp-developing-multithreaded-programs-examine-modify-pthread-library-objects
Contributor guide
Assessment
This issue has not been assessed yet.