[Lldb-commits] [lldb] Report exit status message in lldb-dap, same as lldb cli (PR #89405)

Miro Bucko via lldb-commits lldb-commits at lists.llvm.org
Fri Apr 19 08:38:17 PDT 2024


https://github.com/mbucko created https://github.com/llvm/llvm-project/pull/89405

Summary:
When the target inferior process that is being debugged exits in lldb command line, it emits following message:
`Process 4049526 exited with status = -1 (0xffffffff) debugserver died with signal SIGTERM`
lldb-dap on the other hand does not emit a similar message. This PR adds the same status message to lldb-dap.

Test Plan:
In VSCode debug any target and hit stop mode, kill lldb-server and observe an exit status message similar to the following: Process 2167677 exited with status = -1 (0xffffffff) debugserver died with signal SIGTERM

Reviewers:
jeffreytan81,clayborg,kusmour,

Subscribers:

Tasks:
lldb-dap

Tags:

>From 93ed3f24ce581f94820900cfa3aaa082cba6f37f Mon Sep 17 00:00:00 2001
From: Miro Bucko <mbucko at meta.com>
Date: Fri, 19 Apr 2024 08:08:02 -0700
Subject: [PATCH] Report exit status message in lldb-dap, same as lldb cli

Summary:
When the target inferior process that is being debugged exits in lldb command line, it emits following message:
Process 4049526 exited with status = -1 (0xffffffff) debugserver died with signal SIGTERM
lldb-dap on the other hand does not emit a similar message.
This PR adds the same status message to lldb-dap.

Test Plan:
In VSCode debug any target and hit stop mode, kill lldb-server and observe an exit status message similar to the following:
Process 2167677 exited with status = -1 (0xffffffff) debugserver died with signal SIGTERM

Reviewers:

Subscribers:

Tasks:
lldb-dap

Tags:
---
 lldb/tools/lldb-dap/lldb-dap.cpp | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/lldb/tools/lldb-dap/lldb-dap.cpp b/lldb/tools/lldb-dap/lldb-dap.cpp
index 25c5ad56e3d6fe..76c7fb17a793cb 100644
--- a/lldb/tools/lldb-dap/lldb-dap.cpp
+++ b/lldb/tools/lldb-dap/lldb-dap.cpp
@@ -503,6 +503,13 @@ void EventThreadFunction() {
             SendContinuedEvent();
             break;
           case lldb::eStateExited:
+            const int exit_status = process.GetExitStatus();
+            const char * const exit_description = process.GetExitDescription();
+            g_dap.SendFormattedOutput(OutputType::Console,
+              "Process %" PRIu64 " exited with status = %i (0x%8.8x) %s\n",
+              process.GetProcessID(), exit_status, exit_status,
+              exit_description ? exit_description : "");
+
             // When restarting, we can get an "exited" event for the process we
             // just killed with the old PID, or even with no PID. In that case
             // we don't have to terminate the session.



More information about the lldb-commits mailing list