[PATCH v2 1/2] Introduce wrapper for CreateProcess
Jon Turney
jon.turney@dronecode.org.uk
Sun Jun 12 16:08:00 GMT 2022
On 11/03/2022 18:57, Tom Tromey via Gdb-patches wrote:
> This is a small refactoring that introduces a wrapper for the Windows
> CreateProcess function. This is done to make the next patch a bit
> simpler.
> ---
> gdb/nat/windows-nat.c | 51 ++++++++++++++++++++++++++++++++++++++++++
> gdb/nat/windows-nat.h | 15 +++++++++++++
> gdb/windows-nat.c | 22 ++++--------------
> gdbserver/win32-low.cc | 5 +----
> 4 files changed, 71 insertions(+), 22 deletions(-)
>
> diff --git a/gdb/nat/windows-nat.c b/gdb/nat/windows-nat.c
> index 21445f3f859..fdfc8e702f8 100644
> --- a/gdb/nat/windows-nat.c
> +++ b/gdb/nat/windows-nat.c
> @@ -579,6 +579,57 @@ wait_for_debug_event (DEBUG_EVENT *event, DWORD timeout)
[...]
> +#ifdef __CYGWIN__
> +
> +/* See nat/windows-nat.h. */
> +
> +BOOL
> +create_process (const wchar_t *image, wchar_t *command_line, DWORD flags,
> + void *environment, const wchar_t *cur_dir,
> + STARTUPINFOW *startup_info,
> + PROCESS_INFORMATION *process_info);
> +{
Stray semicolon
> + return create_process_wrapper (CreateProcessW, image, command_line, flags,
> + environment, cur_dir,
> + startup_info, process_info);
> +}
> +
> +#endif /* __CYGWIN__ */
[...]
> diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
> index 81e26fe4759..251876c7022 100644
> --- a/gdb/windows-nat.c
> +++ b/gdb/windows-nat.c
> windows_init_thread_list ();
> - ret = CreateProcess (0,
> - args, /* command line */
> - NULL, /* Security */
> - NULL, /* thread */
> - TRUE, /* inherit handles */
> - flags, /* start flags */
> - w32_env, /* environment */
> - inferior_cwd != NULL ? infcwd : NULL, /* current
> - directory */
> - &si,
> - &pi);
> + ret = create_process (args, flags, w32_env,
> + inferior_cwd != nullptr ? infcwd : nullptr,
> + &si, &pi);
This use of create_process() under CYGWIN has one less argument that the
prototype as the NULL program argument was dropped.
I pushed a patch to fix these cygwin build issues as trivial.
More information about the Gdb-patches
mailing list