aboutsummaryrefslogtreecommitdiff
path: root/gdb/mingw-hdep.c
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2013-04-06 06:52:06 +0000
committerEli Zaretskii <eliz@gnu.org>2013-04-06 06:52:06 +0000
commitd9ac066415a91fee34d4b4f9646189e740a5e42b (patch)
tree153525a237ce5ae0cf140fb34d6e958fe2ea0db4 /gdb/mingw-hdep.c
parent198f1157c95708c10f213c3b5146a25d542b9775 (diff)
downloadgdb-d9ac066415a91fee34d4b4f9646189e740a5e42b.zip
gdb-d9ac066415a91fee34d4b4f9646189e740a5e42b.tar.gz
gdb-d9ac066415a91fee34d4b4f9646189e740a5e42b.tar.bz2
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.
Diffstat (limited to 'gdb/mingw-hdep.c')
-rw-r--r--gdb/mingw-hdep.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/gdb/mingw-hdep.c b/gdb/mingw-hdep.c
index 2613495..efc9848 100644
--- a/gdb/mingw-hdep.c
+++ b/gdb/mingw-hdep.c
@@ -18,6 +18,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#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.