Fix relocation of directories in the MinGW build.

windows-nat.c (windows_get_absolute_argv0): New function.
 windows-nat.h: Add its prototype.
 main.c (get_init_files): Use filename_ncmp instead of strncmp.
 Use IS_DIR_SEPARATOR instead of looking for a character inside
 SLASH_STRING.  Include filenames.h.
 (captured_main) [__MINGW32__]: Make argv[0] absolute, so that
 relocate_gdb_directory works when passed gdb_program_name.
 Include windows-nat.h.
This commit is contained in:
Eli Zaretskii
2013-03-23 10:48:23 +00:00
parent 8a56bd0251
commit b5981e5adf
4 changed files with 44 additions and 5 deletions

View File

@@ -597,6 +597,18 @@ 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