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
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,8 @@ void ProcessDebugger::OnExitProcess(uint32_t exit_code) {
// of the error otherwise WaitForDebuggerConnection() will be blocked.
// An example of this issue is when a process fails to load a dependent DLL.
if (m_session_data && !m_session_data->m_initial_stop_received) {
Status error(exit_code, eErrorTypeWin32);
Status error = Status::FromErrorStringWithFormatv(
"Process prematurely exited with {0:x}", exit_code);
OnDebuggerError(error, 0);
}
}
Expand Down
5 changes: 5 additions & 0 deletions lldb/test/API/windows/launch/missing-dll/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
C_SOURCES := main.c
DYLIB_C_SOURCES := dummy_dll.c
DYLIB_NAME := dummy_dll

include Makefile.rules
27 changes: 27 additions & 0 deletions lldb/test/API/windows/launch/missing-dll/TestMissingDll.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil


class MissingDllTestCase(TestBase):
@skipUnlessWindows
def test(self):
"""
Test that lldb reports the application's exit code (STATUS_DLL_NOT_FOUND),
rather than trying to treat it as a Win32 error number.
"""

self.build()
exe = self.getBuildArtifact("a.out")
dll = self.getBuildArtifact("dummy_dll.dll")
self.assertTrue(remove_file(dll))
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)

launch_info = lldb.SBLaunchInfo(None)
launch_info.SetWorkingDirectory(self.get_process_working_directory())

error = lldb.SBError()
target.Launch(launch_info, error)
self.assertFailure(error, "Process prematurely exited with 0xc0000135")
1 change: 1 addition & 0 deletions lldb/test/API/windows/launch/missing-dll/dummy_dll.c
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__declspec(dllexport) void SomeFunction(void) {}
6 changes: 6 additions & 0 deletions lldb/test/API/windows/launch/missing-dll/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
__declspec(dllimport) void SomeFunction(void);

int main(void) {
SomeFunction();
return 0;
}
Loading