[all-commits] [llvm/llvm-project] c0a872: [LLDB] Show exit code on Windows if process can't ...
nerix via All-commits
all-commits at lists.llvm.org
Tue May 27 13:16:24 PDT 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: c0a87231069452dfeaf9f2601bb30a3f5e7eb840
https://github.com/llvm/llvm-project/commit/c0a87231069452dfeaf9f2601bb30a3f5e7eb840
Author: nerix <nerixdev at outlook.de>
Date: 2025-05-27 (Tue, 27 May 2025)
Changed paths:
M lldb/source/Plugins/Process/Windows/Common/ProcessDebugger.cpp
A lldb/test/API/windows/launch/missing-dll/Makefile
A lldb/test/API/windows/launch/missing-dll/TestMissingDll.py
A lldb/test/API/windows/launch/missing-dll/dummy_dll.c
A lldb/test/API/windows/launch/missing-dll/main.c
Log Message:
-----------
[LLDB] Show exit code on Windows if process can't launch (#141290)
When running a process that would exit before LLDB could stop the
target, it would try to interpret (and subsequently format) the exit
code as a Win32 error. However, processes on Windows won't return Win32
errors in that case. They will often return an
[NTSTATUS](https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-erref/596a1078-e883-4972-9bbc-49e60bebca55).
One common case for this to occur is when a DLL is missing. In that
case, the process will start successfully, but it will exit with
`STATUS_DLL_NOT_FOUND`.
LLDB would previously return "unknown error", because it tried to
[`FormatMessage`](https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-formatmessage)
`0xC0000135` which doesn't work, so it fell back to "unknown error".
This PR changes the error to be the string "Process prematurely exited
with {0:x}" and doesn't try to format the exit code. One could
`FormatMessage` an `NTSTATUS` by passing `FORMAT_MESSAGE_FROM_HMODULE`
and a handle to `ntdll.dll`, however, I don't think we can get the
required format arguments (e.g. the missing DLL name - `%hs`).
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list