[Lldb-commits] [PATCH] D70886: [lldb-vscode] capture the debuggers file handles before lldbinit runs

António Afonso via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Sun Dec 1 20:47:30 PST 2019


aadsm created this revision.
aadsm added reviewers: clayborg, lanza, wallace.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

We need to do this before we create the debugger because the commands run in the lldbinit might do output to these handlers as well.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D70886

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


Index: lldb/tools/lldb-vscode/lldb-vscode.cpp
===================================================================
--- lldb/tools/lldb-vscode/lldb-vscode.cpp
+++ lldb/tools/lldb-vscode/lldb-vscode.cpp
@@ -1194,14 +1194,6 @@
 //   }]
 // }
 void request_initialize(const llvm::json::Object &request) {
-  auto arguments = request.getObject("arguments");
-  const auto skipInitFiles = GetBoolean(arguments, "skipInitFiles", false);
-  g_vsc.debugger =
-      lldb::SBDebugger::Create(!skipInitFiles /*source_init_files*/);
-  // Create an empty target right away since we might get breakpoint requests
-  // before we are given an executable to launch in a "launch" request, or a
-  // executable when attaching to a process by process ID in a "attach"
-  // request.
   FILE *out = llvm::sys::RetryAfterSignal(nullptr, fopen, dev_null_path, "w");
   if (out) {
     // Set the output and error file handles to redirect into nothing otherwise
@@ -1212,6 +1204,14 @@
     g_vsc.debugger.SetErrorFileHandle(out, false);
   }
 
+  auto arguments = request.getObject("arguments");
+  const auto skipInitFiles = GetBoolean(arguments, "skipInitFiles", false);
+  g_vsc.debugger =
+      lldb::SBDebugger::Create(!skipInitFiles /*source_init_files*/);
+  // Create an empty target right away since we might get breakpoint requests
+  // before we are given an executable to launch in a "launch" request, or a
+  // executable when attaching to a process by process ID in a "attach"
+  // request.
   g_vsc.target = g_vsc.debugger.CreateTarget(nullptr);
   lldb::SBListener listener = g_vsc.debugger.GetListener();
   listener.StartListeningForEvents(


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70886.231634.patch
Type: text/x-patch
Size: 1641 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20191202/9c248b9c/attachment.bin>


More information about the lldb-commits mailing list