Skip to content

[lldb] Don't crash when attaching to pid and no binaries found (#100287) #9188

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

Conversation

jasonmolenda
Copy link

There is a narrow window during process launch on macOS where lldb can attach and no binaries will be seen as loaded in the process (none reported by libdyld SPI). A year ago I made changes to set the new-binary-loaded breakpoint correctly despite this. But we've seen a crash when this combination is seen, where
CommandObjectProcessAttach::DoExecute assumed there was at least one binary registered in the Target. Fix that.

Also fix two FileSpec API uses from when we didn't have a GetPath() method that returned a std::string, and was copying the filepaths into fixed length buffers. All of this code was from ~14 years ago when we didn't have that API.

rdar://131631627
(cherry picked from commit 56535a0)

…100287)

There is a narrow window during process launch on macOS where lldb can
attach and no binaries will be seen as loaded in the process (none
reported by libdyld SPI). A year ago I made changes to set the
new-binary-loaded breakpoint correctly despite this. But we've seen a
crash when this combination is seen, where
CommandObjectProcessAttach::DoExecute assumed there was at least one
binary registered in the Target. Fix that.

Also fix two FileSpec API uses from when we didn't have a GetPath()
method that returned a std::string, and was copying the filepaths into
fixed length buffers. All of this code was from ~14 years ago when we
didn't have that API.

rdar://131631627
(cherry picked from commit 56535a0)
@jasonmolenda jasonmolenda merged commit 908692b into swiftlang:stable/20240723 Aug 27, 2024
@jasonmolenda jasonmolenda deleted the cp/r131631627-no-binaries-found-dont-crash branch August 27, 2024 22:11
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.

1 participant