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

via lldb-commits lldb-commits at lists.llvm.org
Fri Apr 19 08:39:06 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: Miro Bucko (mbucko)

<details>
<summary>Changes</summary>

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:

---
Full diff: https://github.com/llvm/llvm-project/pull/89405.diff


1 Files Affected:

- (modified) lldb/tools/lldb-dap/lldb-dap.cpp (+7) 


``````````diff
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.

``````````

</details>


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


More information about the lldb-commits mailing list