Patchwork [pushed] Fix GDB build under msys+mingw gcc 32bit (Re: [PATCH v5 2/3] Implement "set cwd" command on GDB)

login
register
mail settings
Submitter Pedro Alves
Date Oct. 6, 2017, 10:54 a.m.
Message ID <e3a72983-5a06-71cc-5c83-5cb76817c041@redhat.com>
Download mbox | patch
Permalink /patch/23369/
State New
Headers show

Comments

Pedro Alves - Oct. 6, 2017, 10:54 a.m.
On 10/06/2017 03:37 AM, asmwarrior wrote:

> I see a build error when building GDB under msys+mingw gcc 32bit.
> 
> g++ -x c++ -std=gnu++11 -g -O2    -I. -I../../../binutils-gdb/gdb/gdbserver -I../../../binutils-gdb/gdb/gdbserver/../common -I../../../binutils-gdb/gdb/gdbserver/../regformats -I../../../binutils-gdb/gdb/gdbserver/.. -I../../../binutils-gdb/gdb/gdbserver/../../include -I../../../binutils-gdb/gdb/gdbserver/../gnulib/import -Ibuild-gnulib-gdbserver/import  -Wall -Wpointer-arith -Wno-unused -Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts -Wempty-body -Wunused-but-set-parameter -Wunused-but-set-variable -Wno-sign-compare -Wno-narrowing -Wno-error=maybe-uninitialized -Wno-format -Werror -DGDBSERVER -c -o win32-low.o -MT win32-low.o -MMD -MP -MF .deps/win32-low.Tpo ../../../binutils-gdb/gdb/gdbserver/win32-low.c
> ../../../binutils-gdb/gdb/gdbserver/win32-low.c: In function 'BOOL create_process(const char*, char*, DWORD, PROCESS_INFORMATION*)':
> ../../../binutils-gdb/gdb/gdbserver/win32-low.c:566:48: error: 'get_inferior_cwd' was not declared in this scope
>    const char *inferior_cwd = get_inferior_cwd ();
>                                                 ^
> make[4]: *** [win32-low.o] Error 1
> 
> It can be simply fixed by adding the header file:

Pushed as below.  Thanks.

From b79f7801a2c555ee4ff4bc3050141e83158f66d4 Mon Sep 17 00:00:00 2001
From: Yuanhui Zhang <asmwarrior@gmail.com>
Date: Fri, 6 Oct 2017 11:44:54 +0100
Subject: [PATCH] Fix GDB build under msys+mingw gcc 32bit

I see a build error when building GDB under msys+mingw gcc 32bit:

 g++ -x c++ -std=gnu++11 -g -O2    -I. -I../../../binutils-gdb/gdb/gdbserver -I../../../binutils-gdb/gdb/gdbserver/../common -I../../../binutils-gdb/gdb/gdbserver/../regformats -I../../../binutils-gdb/gdb/gdbserver/.. -I../../../binutils-gdb/gdb/gdbserver/../../include -I../../../binutils-gdb/gdb/gdbserver/../gnulib/import -Ibuild-gnulib-gdbserver/import  -Wall -Wpointer-arith -Wno-unused -Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts -Wempty-body -Wunused-but-set-parameter -Wunused-but-set-variable -Wno-sign-compare -Wno-narrowing -Wno-error=maybe-uninitialized -Wno-format -Werror -DGDBSERVER -c -o win32-low.o -MT win32-low.o -MMD -MP -MF .deps/win32-low.Tpo ../../../binutils-gdb/gdb/gdbserver/win32-low.c
 ../../../binutils-gdb/gdb/gdbserver/win32-low.c: In function 'BOOL create_process(const char*, char*, DWORD, PROCESS_INFORMATION*)':
 ../../../binutils-gdb/gdb/gdbserver/win32-low.c:566:48: error: 'get_inferior_cwd' was not declared in this scope
    const char *inferior_cwd = get_inferior_cwd ();
						 ^
 make[4]: *** [win32-low.o] Error 1

It can be fixed by simply including the right header file.

gdb/gdbserver/ChangeLog:
2017-10-06  Yuanhui Zhang  <asmwarrior@gmail.com>

	* win32-low.c: Include "common-inferior.h".
---
 gdb/gdbserver/ChangeLog   | 4 ++++
 gdb/gdbserver/win32-low.c | 1 +
 2 files changed, 5 insertions(+)

Patch

diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index 0bdeaba..5bcd717 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,3 +1,7 @@ 
+2017-10-06  Yuanhui Zhang  <asmwarrior@gmail.com>
+
+	* win32-low.c: Include "common-inferior.h".
+
 2017-10-04  Sergio Durigan Junior  <sergiodj@redhat.com>
 
 	* inferiors.c (set_inferior_cwd): New function.
diff --git a/gdb/gdbserver/win32-low.c b/gdb/gdbserver/win32-low.c
index c11926f..f9c890f 100644
--- a/gdb/gdbserver/win32-low.c
+++ b/gdb/gdbserver/win32-low.c
@@ -33,6 +33,7 @@ 
 #include <psapi.h>
 #include <process.h>
 #include "gdb_tilde_expand.h"
+#include "common-inferior.h"
 
 #ifndef USE_WIN32API
 #include <sys/cygwin.h>