This is an archive of the discontinued LLVM Phabricator instance.

[lldb-vscode] Don't hang indefinitely on invalid program
ClosedPublic

Authored by zturner on Mar 7 2019, 2:56 PM.

Details

Summary

When you configure your launch settings, if you pass a path to an invalid program, we would previously hand indefinitely. This is because a combination of two bugs working together. The first is that we did not attempt to detect when handling the request whether the file existed, and we would just pass it through to the Process::Launch method. The second is that the Process::Launch method did not properly report an error in the case where the file does not exist. It actually reported that the launch succeeded, which would then cause LLDB to wait on the broadcaster to receive some events, which would obviously never come.

Although fixing this in either place independently will get lldb-vscode working properly when an invalid executable is specified, I'm fixing it in both places because it seems like the right thing to do. Note that for the first fix (the one in lldb-vscode.cpp) we were previously checking the value of error.Fail(), but the previous call did not actually communicate an error via an SBError return, instead it communicated an error via a null SBModule return. So this condition is changed.

Diff Detail

Repository
rL LLVM

Event Timeline

zturner created this revision.Mar 7 2019, 2:56 PM
clayborg accepted this revision.Mar 7 2019, 3:53 PM
This revision is now accepted and ready to land.Mar 7 2019, 3:53 PM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptMar 7 2019, 4:12 PM
labath added a subscriber: labath.Mar 8 2019, 2:12 AM

A test case?