[Lldb-commits] [lldb] [lldb-dap] Report any errors during attach request (PR #165270)
Ebuka Ezike via lldb-commits
lldb-commits at lists.llvm.org
Tue Oct 28 06:29:57 PDT 2025
https://github.com/da-viper updated https://github.com/llvm/llvm-project/pull/165270
>From d31dae6d626dd2c17dcfd5c00e3d909fa925cbf1 Mon Sep 17 00:00:00 2001
From: Ebuka Ezike <yerimyah1 at gmail.com>
Date: Sun, 26 Oct 2025 21:13:13 +0000
Subject: [PATCH 1/2] [lldb-dap] Report any errors during attach request
---
lldb/tools/lldb-dap/Handler/AttachRequestHandler.cpp | 2 ++
1 file changed, 2 insertions(+)
diff --git a/lldb/tools/lldb-dap/Handler/AttachRequestHandler.cpp b/lldb/tools/lldb-dap/Handler/AttachRequestHandler.cpp
index 371349a26866e..490513fe8a0b8 100644
--- a/lldb/tools/lldb-dap/Handler/AttachRequestHandler.cpp
+++ b/lldb/tools/lldb-dap/Handler/AttachRequestHandler.cpp
@@ -124,6 +124,8 @@ Error AttachRequestHandler::Run(const AttachRequestArguments &args) const {
attach_info.SetWaitForLaunch(args.waitFor, /*async=*/false);
dap.target.Attach(attach_info, error);
}
+ if (error.Fail())
+ return ToError(error);
}
// Make sure the process is attached and stopped.
>From 1b1f24be3f37d5439e948e8436388f1dc6b3bffb Mon Sep 17 00:00:00 2001
From: Ebuka Ezike <yerimyah1 at gmail.com>
Date: Tue, 28 Oct 2025 13:29:32 +0000
Subject: [PATCH 2/2] [lldb-dap] add test case
---
.../tools/lldb-dap/coreFile/TestDAP_coreFile.py | 15 +++++++++++++++
1 file changed, 15 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 1143cd93a70b3..d4652d2a23440 100644
--- a/lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py
+++ b/lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py
@@ -61,6 +61,21 @@ def test_core_file(self):
self.dap_server.request_next(threadId=32259)
self.assertEqual(self.get_stackFrames(), expected_frames)
+ def test_wrong_core_file(self):
+ exe_file = self.getSourcePath("linux-x86_64.out")
+ wrong_core_file = self.getSourcePath("main.c")
+
+ self.create_debug_adapter()
+ resp = self.attach(
+ program=exe_file, coreFile=wrong_core_file, expectFailure=True
+ )
+ self.assertIsNotNone(resp)
+ self.assertFalse(resp["success"], "Expected failure in response {resp!r}")
+ error_msg = resp["body"]["error"]["format"]
+
+ # attach my fail for mutilple reasons.
+ self.assertEqual(error_msg, "Failed to create the process")
+
@skipIfLLVMTargetMissing("X86")
def test_core_file_source_mapping_array(self):
"""Test that sourceMap property is correctly applied when loading a core"""
More information about the lldb-commits
mailing list