Skip to content
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

[lldb] Various crashlog improvements and bug fixes #8755

Merged
merged 5 commits into from
May 23, 2024

Conversation

medismailben
Copy link
Member

This PR addresses many issues on the lldb crashlog lldb script.

This patch fixes the various crashlog test failures following
ec456ba, which renamed the process member variable in the Scripted
Thread python base class.

This patch updates the crashlog scripted process implementation to
reflect that change.

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
(cherry picked from commit 4ec9cda)
In `27f27d1`, we changed the image loading logic to conform to the
various options (`-a|--load-all` & `-c|--crashed-only`) and loaded them
concurrently.

However, instead of the subset of images that matched the user option,
the thread pool would always run on all the crashlog images, causing
them to be all loaded in the target everytime.

This matches the `-a|--load-all` option behaviour but depending on the
report, it can cause lldb to load thousands of images, which can take a
very long time if the images are downloaded over the network.

This patch fixes that issue by keeping a list of `images_to_load` based
of
the user-provided option. This list will be used with our executor
thread pool to load the images according to the user selection, and
reinstates
the expected default behaviour, by only loading the crashed thread
images and
skipping all the others.

This patch also unifies the way we load images into a single method
that's shared by both the batch mode & the interactive scripted process.

rdar://123694062

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
(cherry picked from commit 785b143)
… option (llvm#91162)

This patch rephrases the crashlog `--no-crashed-only` option help
message. This option is mainly used in batch mode to symbolicate and
dump all the threads backtraces, instead of only doing it for the
crashed thread which is the default behavior.

rdar://127391524

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
(cherry picked from commit 8585bf7)
This patch fixes a bug in when resolving and loading modules from the
binary image list.

When loading a module, we would first use the UUID from the binary image
list with `dsymForUUID` to fetch the dSYM bundle from our remote build
records and copy the executable locally.

If we failed to find a matching dSYM bundle for that UUID on the build
record, let's say if that module was built locally, we use Spotlight
(`mdfind`) to find the dSYM bundle once again using the UUID.

Prior to this patch, we would set the image path to be the same as the
symbol file. This resulted in trying to load the dSYM as a module in
lldb, which isn't allowed.

This patch address that by looking for a binary matching the image
identifier, next to the dSYM bundle and try to load that instead.

rdar://127433616

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
(cherry picked from commit f4a7e1f)
… options (llvm#91653)

This should fix the various crashlog test failures on the bots:

```
  lldb-shell :: ScriptInterpreter/Python/Crashlog/app_specific_backtrace_crashlog.test
  lldb-shell :: ScriptInterpreter/Python/Crashlog/interactive_crashlog_json.test
  lldb-shell :: ScriptInterpreter/Python/Crashlog/interactive_crashlog_legacy.test
  lldb-shell :: ScriptInterpreter/Python/Crashlog/last_exception_backtrace_crashlog.test
  lldb-shell :: ScriptInterpreter/Python/Crashlog/skipped_status_interactive_crashlog.test
```

When we create a target by using the command option, we don't set it in
the crashlog object which later on cause us to fail loading the images.

rdar://127832961

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
(cherry picked from commit db94213)
@medismailben
Copy link
Member Author

@swift-ci test

@JDevlieghere JDevlieghere merged commit 74f34b6 into apple:swift/release/6.0 May 23, 2024
3 checks passed
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.

None yet

2 participants