From d9ac066415a91fee34d4b4f9646189e740a5e42b Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 6 Apr 2013 06:52:06 +0000 Subject: [PATCH] Unbreak Windows-hosted cross debugger builds. * windows-nat.c (windows_get_absolute_argv0): Move from here... * mingw-hdep.c (windows_get_absolute_argv0): ...to here. Include main.h. * windows-nat.h (windows_get_absolute_argv0): Move prototype from here... * main.h (windows_get_absolute_argv0): ...to here. --- gdb/ChangeLog | 10 ++++++++++ gdb/main.c | 3 --- gdb/main.h | 6 ++++++ gdb/mingw-hdep.c | 14 ++++++++++++++ gdb/windows-nat.c | 12 ------------ gdb/windows-nat.h | 4 ---- 6 files changed, 30 insertions(+), 19 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index c5db5c46e3c..21585e2e758 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,13 @@ +2013-04-06 Eli Zaretskii + + * windows-nat.c (windows_get_absolute_argv0): Move from here... + * mingw-hdep.c (windows_get_absolute_argv0): ...to here. + Include main.h. + + * windows-nat.h (windows_get_absolute_argv0): Move prototype from + here... + * main.h (windows_get_absolute_argv0): ...to here. + 2013-04-05 Doug Evans * dwarf2read.c (struct dwarf2_per_objfile): Tweak comment. diff --git a/gdb/main.c b/gdb/main.c index 5bbfe833539..8823c8247e7 100644 --- a/gdb/main.c +++ b/gdb/main.c @@ -45,9 +45,6 @@ #include "maint.h" #include "filenames.h" -#ifdef __MINGW32__ -# include "windows-nat.h" -#endif /* The selected interpreter. This will be used as a set command variable, so it should always be malloc'ed - since diff --git a/gdb/main.h b/gdb/main.h index 49b64ee2bff..a5260b16bc6 100644 --- a/gdb/main.h +++ b/gdb/main.h @@ -36,4 +36,10 @@ extern int return_child_result_value; extern int batch_silent; extern int batch_flag; +/* From mingw-hdep.c, used by main.c. */ + +/* Return argv[0] in absolute form, if possible, or ARGV0 if not. The + return value is in malloc'ed storage. */ +extern char *windows_get_absolute_argv0 (const char *argv0); + #endif diff --git a/gdb/mingw-hdep.c b/gdb/mingw-hdep.c index 2613495a637..efc9848d3a5 100644 --- a/gdb/mingw-hdep.c +++ b/gdb/mingw-hdep.c @@ -18,6 +18,7 @@ along with this program. If not, see . */ #include "defs.h" +#include "main.h" #include "serial.h" #include "event-loop.h" @@ -80,6 +81,19 @@ safe_strerror (int errnum) return buffer; } +/* Return an absolute file name of the running GDB, if possible, or + ARGV0 if not. The return value is in malloc'ed storage. */ + +char * +windows_get_absolute_argv0 (const char *argv0) +{ + char full_name[PATH_MAX]; + + if (GetModuleFileName (NULL, full_name, PATH_MAX)) + return xstrdup (full_name); + return xstrdup (argv0); +} + /* Wrapper for select. On Windows systems, where the select interface only works for sockets, this uses the GDB serial abstraction to handle sockets, consoles, pipes, and serial ports. diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c index 805ab303187..c44314b953f 100644 --- a/gdb/windows-nat.c +++ b/gdb/windows-nat.c @@ -597,18 +597,6 @@ failed: return 0; /* failure */ } -/* Return an absolute file name of the running GDB, if possible, or - ARGV0 if not. The return value is in malloc'ed storage. */ -char * -windows_get_absolute_argv0 (const char *argv0) -{ - char full_name[PATH_MAX]; - - if (GetModuleFileName (NULL, full_name, PATH_MAX)) - return xstrdup (full_name); - return xstrdup (argv0); -} - /* Encapsulate the information required in a call to symbol_file_add_args. */ struct safe_symbol_file_add_args diff --git a/gdb/windows-nat.h b/gdb/windows-nat.h index 0691e9ec896..55624eed081 100644 --- a/gdb/windows-nat.h +++ b/gdb/windows-nat.h @@ -28,9 +28,5 @@ typedef int (segment_register_p_ftype) (int regnum); whether a given register is a segment register or not. */ extern void windows_set_segment_register_p (segment_register_p_ftype *fun); -/* Return argv[0] in absolute form, if possible, or ARGV0 if not. The - return value is in malloc'ed storage. */ -extern char *windows_get_absolute_argv0 (const char *argv0); - #endif -- 2.30.2