Skip to content

New DynamicLoaderDumpWithModuleList for coredump debugging #149019

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

satyajanga
Copy link
Contributor

Summary:
This patch adds a new DynamicLoaderDumpWithModuleList plugin which can be used for coredump debugging. It leverages NT_FILE note in coredump to get module list instead of relying on posix rdebug data structure which highly depends on having a matching main executable available. Once the module list is generated a ObjectFilePlaceholder is created for each module.

This feature is only activated by both two conditions are true:

  • use-module-list-dyld setting is true (false by default)
  • coredump having NT_FILE notes

Per my testing, Meta's internal modern Linux kernel seems to always generate NT_FILE note so this should be very useful.

With this patch, coredump can be changed from

lldb <path_to_main_executable> -c <path_to_coredump>

to

lldb -c <path_to_coredump>

Test Plan:

  • Added new unit test

Followup PR for target module replace command which enables to replace the object file place holders
#148735

Copy link

github-actions bot commented Jul 16, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

Summary:
This patch adds a new `DynamicLoaderDumpWithModuleList` plugin which can be used for coredump debugging.
It leverages NT_FILE note in coredump to get module list instead of relying on posix rdebug data structure which highly depends on having a matching main executable available. Once the module list is generated a ObjectFilePlaceholder is created for each module.

This feature is only activated by both two conditions are true:
* `use-module-list-dyld` setting is true (false by default)
* coredump having `NT_FILE` notes

Per my testing, Meta's modern Linux kernel seems to always generate `NT_FILE` note so this should be very useful.

With this patch, Meta's internal coredump can be changed from
```
lldb <path_to_main_executable> -c <path_to_coredump>
```
to
```
lldb -c <path_to_coredump>
```

Further diffs involving:
* New `target module replace` command to upgrade PlaceHolder module to real module
* Coredumper side change to generate fbpkg/rpm metadata so that `auto_debuginfo.py` can automatically locate debug info (in review)
* Implement `auto_debuginfo` to parse coredumper metadata to download fbpkg, unzip it, automatically run `target module replace` to upgrade all Placeholder modules into real modules.

I am landing this feature internally first because:
* Unblock the further work listed above
* Early beta testing from our users to get feedback and dogfooding.
* Quick turnover from open source code review

Once we got solid feedback, I will bring this to open source.

Test Plan:
* Added new unit test
* c4crasher end-to-end debugging

Reviewers: wanyi, hyubo, #lldb_team

Reviewed By: wanyi

Subscribers: jimmymalone, frd, #lldb_team

Differential Revision: https://phabricator.intern.facebook.com/D44558615
@satyajanga satyajanga force-pushed the DynamicLoaderDumpWithModuleList branch from 30c1461 to 1a8ecb9 Compare July 16, 2025 05:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants