[Lldb-commits] [lldb] [lldb-dap] Removing the debugger log callback, instead use the default behavior. (PR #78343)

John Harrison via lldb-commits lldb-commits at lists.llvm.org
Tue Jan 16 12:40:01 PST 2024


https://github.com/ashgti created https://github.com/llvm/llvm-project/pull/78343

The logging callback prevents `lldb> log enable -f <file> lldb api` from writing to a file and instead redirects all logging to the callback.

Fixes [issues/78334](https://github.com/llvm/llvm-project/issues/78334).

>From b9a063fc504ea77da2ef07121f74fa062ff793a0 Mon Sep 17 00:00:00 2001
From: John Harrison <harjohn at google.com>
Date: Tue, 16 Jan 2024 12:36:21 -0800
Subject: [PATCH] [lldb-dap] Removing the debugger log callback, instead use
 the default behavior.

The logging callback prevents `lldb> log enable -f <file> lldb api` from
writing to a file and instead redirects all logging to the callback.
---
 lldb/tools/lldb-dap/lldb-dap.cpp | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/lldb/tools/lldb-dap/lldb-dap.cpp b/lldb/tools/lldb-dap/lldb-dap.cpp
index 8c8e92146e63c0a..a51fc8326b9eb3e 100644
--- a/lldb/tools/lldb-dap/lldb-dap.cpp
+++ b/lldb/tools/lldb-dap/lldb-dap.cpp
@@ -1516,17 +1516,13 @@ void request_modules(const llvm::json::Object &request) {
 //   }]
 // }
 void request_initialize(const llvm::json::Object &request) {
-  auto log_cb = [](const char *buf, void *baton) -> void {
-    g_dap.SendOutput(OutputType::Console, llvm::StringRef{buf});
-  };
-
   auto arguments = request.getObject("arguments");
   // sourceInitFile option is not from formal DAP specification. It is only
   // used by unit tests to prevent sourcing .lldbinit files from environment
   // which may affect the outcome of tests.
   bool source_init_file = GetBoolean(arguments, "sourceInitFile", true);
 
-  g_dap.debugger = lldb::SBDebugger::Create(source_init_file, log_cb, nullptr);
+  g_dap.debugger = lldb::SBDebugger::Create(source_init_file);
   auto cmd = g_dap.debugger.GetCommandInterpreter().AddMultiwordCommand(
       "lldb-dap", "Commands for managing lldb-dap.");
   if (GetBoolean(arguments, "supportsStartDebuggingRequest", false)) {



More information about the lldb-commits mailing list