[Lldb-commits] [PATCH] D59043: [lldb-vscode] Correctly propagate errors back to VS Code

Zachary Turner via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Mar 6 13:23:30 PST 2019


zturner created this revision.
zturner added a reviewer: clayborg.

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.


https://reviews.llvm.org/D59043

Files:
  lldb/tools/lldb-vscode/lldb-vscode.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59043.189572.patch
Type: text/x-patch
Size: 4163 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190306/5c5cbac2/attachment.bin>


More information about the lldb-commits mailing list