[Lldb-commits] [PATCH] D96623: [lldb-vscode] Fix lldb init file stdout issue

jeffrey tan via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Feb 12 11:30:01 PST 2021


yinghuitan created this revision.
yinghuitan added reviewers: clayborg, aadsm.
yinghuitan requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

VScode DAP client uses stdout to receive protocol message. This means any stdout/stderr from debugger would be treated as DAP packet. This means any lldb commands in init file can generate random output and break DAP client.
This diff fixes the issue by explicitly sourcing lldbinit file after stdout/stderr is redirected to dev_null instead of relying on SBDebugger::Create().
There is another issue that SBDebugger::Create() only sources the lldbinit file from home directory not debugger's cwd. This diverages from what lldb does. This diff explicitly sources init file from cwd as well.
An integration test is added.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D96623

Files:
  lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
  lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
  lldb/test/API/tools/lldb-vscode/launch/.lldbinit
  lldb/test/API/tools/lldb-vscode/launch/TestVSCode_launch.py
  lldb/tools/lldb-vscode/lldb-vscode.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D96623.323420.patch
Type: text/x-patch
Size: 11267 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20210212/5ac4a7b3/attachment.bin>


More information about the lldb-commits mailing list