[Lldb-commits] [lldb] [lldb-dap] support moduleId in the stackTrace response (PR #149774)
via lldb-commits
lldb-commits at lists.llvm.org
Mon Jul 21 02:22:05 PDT 2025
https://github.com/woruyu updated https://github.com/llvm/llvm-project/pull/149774
>From 33c94346ac2b96d9f68fd1b8d62aebfa7b273499 Mon Sep 17 00:00:00 2001
From: woruyu <1214539920 at qq.com>
Date: Mon, 21 Jul 2025 15:52:50 +0800
Subject: [PATCH 1/3] [lldb-dap] support moduleId in the stackTrace response
---
lldb/tools/lldb-dap/JSONUtils.cpp | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/lldb/tools/lldb-dap/JSONUtils.cpp b/lldb/tools/lldb-dap/JSONUtils.cpp
index 41ca29a405ac9..7abd9618cc71f 100644
--- a/lldb/tools/lldb-dap/JSONUtils.cpp
+++ b/lldb/tools/lldb-dap/JSONUtils.cpp
@@ -550,6 +550,15 @@ llvm::json::Value CreateStackFrame(DAP &dap, lldb::SBFrame &frame,
if (frame.IsArtificial() || frame.IsHidden())
object.try_emplace("presentationHint", "subtle");
+ lldb::SBModule module = frame.GetModule();
+ if (module.IsValid()) {
+ std::string uuid = module.GetUUIDString();
+ if (!uuid.empty())
+ object.try_emplace("moduleId", uuid);
+ else
+ object.try_emplace("moduleId", module.GetFileSpec().GetFilename());
+ }
+
return llvm::json::Value(std::move(object));
}
>From 3c47de26e1e680e7d14727b6068da99963c21b2e Mon Sep 17 00:00:00 2001
From: woruyu <1214539920 at qq.com>
Date: Mon, 21 Jul 2025 17:09:08 +0800
Subject: [PATCH 2/3] fix: ci test for moduleId
---
lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py | 3 +++
1 file changed, 3 insertions(+)
diff --git a/lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py b/lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py
index db43dbaf515cf..2743fca58e81d 100644
--- a/lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py
+++ b/lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py
@@ -26,6 +26,7 @@ def test_core_file(self):
"column": 0,
"id": 524288,
"line": 4,
+ "moduleId":"01DF54A6-045E-657D-3F8F-FB9CE1118789-14F8BD6D",
"name": "bar",
"source": {"name": "main.c", "path": "/home/labath/test/main.c"},
"instructionPointerReference": "0x40011C",
@@ -34,6 +35,7 @@ def test_core_file(self):
"column": 0,
"id": 524289,
"line": 10,
+ "moduleId":"01DF54A6-045E-657D-3F8F-FB9CE1118789-14F8BD6D",
"name": "foo",
"source": {"name": "main.c", "path": "/home/labath/test/main.c"},
"instructionPointerReference": "0x400142",
@@ -42,6 +44,7 @@ def test_core_file(self):
"column": 0,
"id": 524290,
"line": 16,
+ "moduleId":"01DF54A6-045E-657D-3F8F-FB9CE1118789-14F8BD6D",
"name": "_start",
"source": {"name": "main.c", "path": "/home/labath/test/main.c"},
"instructionPointerReference": "0x40015F",
>From 5359fd9fe54326f9820cc0c1a0b23f1b7e06fc93 Mon Sep 17 00:00:00 2001
From: woruyu <1214539920 at qq.com>
Date: Mon, 21 Jul 2025 17:21:39 +0800
Subject: [PATCH 3/3] fix: python format
---
lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py b/lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py
index 2743fca58e81d..1143cd93a70b3 100644
--- a/lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py
+++ b/lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py
@@ -26,7 +26,7 @@ def test_core_file(self):
"column": 0,
"id": 524288,
"line": 4,
- "moduleId":"01DF54A6-045E-657D-3F8F-FB9CE1118789-14F8BD6D",
+ "moduleId": "01DF54A6-045E-657D-3F8F-FB9CE1118789-14F8BD6D",
"name": "bar",
"source": {"name": "main.c", "path": "/home/labath/test/main.c"},
"instructionPointerReference": "0x40011C",
@@ -35,7 +35,7 @@ def test_core_file(self):
"column": 0,
"id": 524289,
"line": 10,
- "moduleId":"01DF54A6-045E-657D-3F8F-FB9CE1118789-14F8BD6D",
+ "moduleId": "01DF54A6-045E-657D-3F8F-FB9CE1118789-14F8BD6D",
"name": "foo",
"source": {"name": "main.c", "path": "/home/labath/test/main.c"},
"instructionPointerReference": "0x400142",
@@ -44,7 +44,7 @@ def test_core_file(self):
"column": 0,
"id": 524290,
"line": 16,
- "moduleId":"01DF54A6-045E-657D-3F8F-FB9CE1118789-14F8BD6D",
+ "moduleId": "01DF54A6-045E-657D-3F8F-FB9CE1118789-14F8BD6D",
"name": "_start",
"source": {"name": "main.c", "path": "/home/labath/test/main.c"},
"instructionPointerReference": "0x40015F",
More information about the lldb-commits
mailing list