[virt-tools-list] [PATCH v2 3/3] win32: remove debug-helper.exe

Victor Toso victortoso at redhat.com
Tue Nov 14 16:46:34 UTC 2017


Hi,

On Tue, Nov 14, 2017 at 04:56:03PM +0100, marcandre.lureau at redhat.com wrote:
> From: Marc-André Lureau <marcandre.lureau at redhat.com>
> 
> This helper was useful to debug spice controller & activex plugin. Now
> that the controller is gone, it is no longer needed.
> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>

Looks fine,
Reviewed-by: Victor Toso <victortoso at redhat.com>

> ---
>  mingw-virt-viewer.spec.in |  2 --
>  src/Makefile.am           |  5 ---
>  src/debug-helper.c        | 83 -----------------------------------------------
>  3 files changed, 90 deletions(-)
>  delete mode 100644 src/debug-helper.c
> 
> diff --git a/mingw-virt-viewer.spec.in b/mingw-virt-viewer.spec.in
> index 06f1992..f4344a1 100644
> --- a/mingw-virt-viewer.spec.in
> +++ b/mingw-virt-viewer.spec.in
> @@ -138,7 +138,6 @@ rm -rf $RPM_BUILD_ROOT
>  %{mingw32_bindir}/virt-viewer.exe
>  %{mingw32_bindir}/remote-viewer.exe
>  %{mingw32_bindir}/windows-cmdline-wrapper.exe
> -%{mingw32_bindir}/debug-helper.exe
>  
>  %dir %{mingw32_datadir}/virt-viewer/
>  %{mingw32_datadir}/icons/hicolor/*/apps/*
> @@ -155,7 +154,6 @@ rm -rf $RPM_BUILD_ROOT
>  %{mingw64_bindir}/virt-viewer.exe
>  %{mingw64_bindir}/remote-viewer.exe
>  %{mingw64_bindir}/windows-cmdline-wrapper.exe
> -%{mingw64_bindir}/debug-helper.exe
>  
>  %dir %{mingw64_datadir}/virt-viewer/
>  %{mingw64_datadir}/icons/hicolor/*/apps/*
> diff --git a/src/Makefile.am b/src/Makefile.am
> index a6807b6..0a3cbbf 100644
> --- a/src/Makefile.am
> +++ b/src/Makefile.am
> @@ -210,11 +210,6 @@ virt-viewer_rc.$(OBJEXT): $(VIRT_VIEWER_RES) $(ICONDIR)/virt-viewer.ico
>  		-i $< -o $@
>  LDADD += virt-viewer_rc.$(OBJEXT)
>  MAINTAINERCLEANFILES += virt-viewer_rc.$(OBJEXT)
> -
> -bin_PROGRAMS += debug-helper
> -debug_helper_SOURCES = debug-helper.c
> -debug_helper_LDFLAGS = $(GLIB2_LIBS) -Wl,--subsystem,windows
> -debug_helper_CFLAGS = $(GLIB2_CFLAGS)
>  endif
>  
>  -include $(top_srcdir)/git.mk
> diff --git a/src/debug-helper.c b/src/debug-helper.c
> deleted file mode 100644
> index 01909da..0000000
> --- a/src/debug-helper.c
> +++ /dev/null
> @@ -1,83 +0,0 @@
> -#include <config.h>
> -#include <windows.h>
> -#include <stdio.h>
> -#include <conio.h>
> -#include <process.h>
> -#include <glib.h>
> -
> -static gchar*
> -get_program_path(void)
> -{
> -    gchar *utf8_buf, *path = NULL;
> -    wchar_t buf[MAX_PATH+1];
> -
> -    if (GetModuleFileNameW(GetModuleHandle (NULL), buf, G_N_ELEMENTS (buf)) > 0) {
> -        utf8_buf = g_utf16_to_utf8(buf, -1, NULL, NULL, NULL);
> -        path = g_path_get_dirname(utf8_buf);
> -        g_free(utf8_buf);
> -    }
> -
> -    return path;
> -}
> -
> -int
> -main(int argc, char *argv[])
> -{
> -    char pipe[2048];
> -    MSG msg;
> -    STARTUPINFO si = { 0, };
> -    PROCESS_INFORMATION pi = { 0, };
> -    gchar *program_path = get_program_path();
> -    gchar *command;
> -    int rv = 0;
> -
> -    argv[0] = "gdb -ex run --args";
> -    command = g_strjoinv(" ", argv);
> -
> -    snprintf(pipe, sizeof(pipe), "\\\\.\\pipe\\SpiceController-%lu", GetCurrentProcessId());
> -
> -    SetEnvironmentVariable("SPICE_DEBUG", "1");
> -    SetEnvironmentVariable("G_MESSAGES_DEBUG", "all");
> -    SetEnvironmentVariable("SPICE_XPI_NAMEDPIPE", pipe);
> -
> -    si.cb = sizeof(si);
> -    if (!CreateProcess(NULL,
> -                       command,
> -                       NULL,
> -                       NULL,
> -                       FALSE,
> -                       0,
> -                       NULL,
> -                       program_path,
> -                       &si,
> -                       &pi)) {
> -        printf("CreateProcess failed (%ld).\n", GetLastError());
> -        rv = 1;
> -        goto end;
> -    }
> -
> -
> -    while (1) {
> -        DWORD reason = MsgWaitForMultipleObjects(1, &pi.hProcess, FALSE,
> -                                                 INFINITE, QS_ALLINPUT);
> -        if (reason == WAIT_OBJECT_0)
> -            break;
> -        else {
> -            if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
> -                TranslateMessage(&msg);
> -                DispatchMessage(&msg);
> -            }
> -        }
> -    }
> -
> -    // Close process and thread handles
> -    CloseHandle(pi.hProcess);
> -    CloseHandle(pi.hThread);
> -
> -end:
> -    g_free(program_path);
> -    g_free(command);
> -
> -    exit(rv);
> -    return rv;
> -}
> -- 
> 2.15.0.125.g8f49766d64
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/virt-tools-list/attachments/20171114/cab79478/attachment.sig>


More information about the virt-tools-list mailing list