Page MenuHomePhabricator

[lldb-vscode] Correctly propagate errors back to VS Code
AcceptedPublic

Authored by zturner on Mar 6 2019, 1:22 PM.

Details

Reviewers
clayborg
Summary

I tried installing this, and I couldn't get it working. VS Code would launch the adapter and then it would get stuck waiting for something to happen.

Eventually, I tracked this down to the fact that it couldn't locate lldb-server, and I fixed this by symlinking lldb-server in the extension's bin directory. However, it would have saved me a lot of time if VS Code had told me about this. So then I started investigating why it didn't tell me about this, and it turns out that the reason is that in FillResponse we initialize the success field to true, and then when an error occurs, we use try_emplace to set it to false. However, the semantics of this function are that if the value is already set, don't do anything, so ultimately this resulted in us sending back a response message saying we had succeeded even though we had failed. So VS Code would think that we were fine and was just waiting on us to launch the process, even though we couldn't.

So, for the failure case, we shouldn't be using try_emplace, we should just clobber the old value. After this, I've confirmed that if lldb-server is missing, VS Code reports an appropriate error message to me.

Diff Detail

Event Timeline

zturner created this revision.Mar 6 2019, 1:22 PM
clayborg accepted this revision.Mar 6 2019, 2:22 PM
This revision is now accepted and ready to land.Mar 6 2019, 2:22 PM