[Lldb-commits] [PATCH] D123025: [lldb-vscode] Implement stderr/stdout on win32 and redirect lldb log to VSCode

Michael Hept via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Apr 5 09:00:44 PDT 2022


nidefawl marked 2 inline comments as done.
nidefawl added inline comments.


================
Comment at: lldb/tools/lldb-vscode/OutputRedirector.cpp:55
       }
-      callback(StringRef(buffer, bytes_count).str());
+      callback(StringRef(buffer, bytes_count));
     }
----------------
mstorsjo wrote:
> This change looks unrelated (although I'm not familiar with this piece of code), although it's probably correct
The reference to the StringRef is never stored, so this avoids a copy. 
VSCode::SendOutput takes a StringRef and explicitly converts it to std::string before emplacing it in the json message.


================
Comment at: lldb/tools/lldb-vscode/lldb-vscode.cpp:1444-1449
+  auto log_cb = [](const char *buf, void *baton) -> void {
+    g_vsc.SendOutput(OutputType::Console, llvm::StringRef{buf});
+  };
+  g_vsc.debugger =
+      lldb::SBDebugger::Create(true /*source_init_files*/, log_cb, nullptr);
   g_vsc.progress_event_thread = std::thread(ProgressEventThreadFunction);
----------------
wallace wrote:
> could you test by creating a .lldbinit file with garbage so that the debugger prints error messages during initialization, and then make sure that they are properly redirected to the console of the IDE?
Yes, I can see the error messages in the VSCode debugger console. Both on windows and linux.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D123025/new/

https://reviews.llvm.org/D123025



More information about the lldb-commits mailing list