Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 may 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"""
Expand Down
2 changes: 2 additions & 0 deletions lldb/tools/lldb-dap/Handler/AttachRequestHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Loading