aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me+cygwin@cgf.cx>2002-03-22 05:03:22 +0000
committerChristopher Faylor <me+cygwin@cgf.cx>2002-03-22 05:03:22 +0000
commit349b409f683480775135af0a0c2450b8fe34d914 (patch)
tree970de4440b9924e63036c62850b573b3c4fc37b2
parent815b453c05b4444af0e84260c4fe539595889423 (diff)
downloadgdb-349b409f683480775135af0a0c2450b8fe34d914.zip
gdb-349b409f683480775135af0a0c2450b8fe34d914.tar.gz
gdb-349b409f683480775135af0a0c2450b8fe34d914.tar.bz2
* win32-nat.c (child_create_inferior): Check for proper shell to use here, in
case the user changes it on the fly. (_initialize_inftarg): Remove shell path considerations.
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/win32-nat.c36
-rw-r--r--gdb/windows-nat.c36
3 files changed, 32 insertions, 46 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 00ef225..5ae09a1 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2002-03-22 Christopher Faylor <cgf@redhat.com>
+
+ * win32-nat.c (child_create_inferior): Check for proper shell to use
+ here, in case the user changes it on the fly.
+ (_initialize_inftarg): Remove shell path considerations.
+
2002-03-21 Elena Zannoni <ezannoni@redhat.com>
* rs6000-tdep.c (rs6000_gdbarch_init): Use correct max size value
diff --git a/gdb/win32-nat.c b/gdb/win32-nat.c
index daca498..d519f7b 100644
--- a/gdb/win32-nat.c
+++ b/gdb/win32-nat.c
@@ -123,7 +123,8 @@ static DEBUG_EVENT current_event; /* The current debug event from
WaitForDebugEvent */
static HANDLE current_process_handle; /* Currently executing process */
static thread_info *current_thread; /* Info on currently selected thread */
-static DWORD main_thread_id; /* Thread ID of the main thread */
+static DWORD main_thread_id; /* Thread ID of the main thread */
+static pid_t cygwin_pid; /* pid of cygwin process */
/* Counts of things. */
static int exception_count = 0;
@@ -139,9 +140,6 @@ static int debug_memory = 0; /* show target memory accesses */
static int debug_exceptions = 0; /* show target exceptions */
static int useshell = 0; /* use shell for subprocesses */
-/* Path to shell */
-static char shell[MAX_PATH + 1];
-
/* This vector maps GDB's idea of a register's number into an address
in the win32 exception context vector.
@@ -1461,6 +1459,8 @@ child_create_inferior (char *exec_file, char *allargs, char **env)
char *args;
char real_path[MAXPATHLEN];
char *toexec;
+ char shell[MAX_PATH + 1]; /* Path to shell */
+ const char *sh;
if (!exec_file)
error ("No executable specified, use `target exec'.\n");
@@ -1468,7 +1468,7 @@ child_create_inferior (char *exec_file, char *allargs, char **env)
memset (&si, 0, sizeof (si));
si.cb = sizeof (si);
- if (!useshell || !shell[0])
+ if (!useshell)
{
flags = DEBUG_ONLY_THIS_PROCESS;
cygwin_conv_to_win32_path (exec_file, real_path);
@@ -1476,8 +1476,13 @@ child_create_inferior (char *exec_file, char *allargs, char **env)
}
else
{
- char *newallargs = alloca (sizeof (" -c 'exec '") + strlen (exec_file)
- + strlen (allargs) + 2);
+ char *newallargs;
+ sh = getenv ("SHELL");
+ if (!sh)
+ sh = "/bin/sh";
+ cygwin_conv_to_win32_path (sh, shell);
+ newallargs = alloca (sizeof (" -c 'exec '") + strlen (exec_file)
+ + strlen (allargs) + 2);
sprintf (newallargs, " -c 'exec %s %s'", exec_file, allargs);
allargs = newallargs;
toexec = shell;
@@ -1497,7 +1502,7 @@ child_create_inferior (char *exec_file, char *allargs, char **env)
/* Prepare the environment vars for CreateProcess. */
{
- /* This code use to assume all env vars were file names and would
+ /* This code used to assume all env vars were file names and would
translate them all to win32 style. That obviously doesn't work in the
general case. The current rule is that we only translate PATH.
We need to handle PATH because we're about to call CreateProcess and
@@ -1813,7 +1818,6 @@ void
_initialize_inftarg (void)
{
struct cmd_list_element *c;
- const char *sh;
init_child_ops ();
@@ -1821,20 +1825,6 @@ _initialize_inftarg (void)
"Load dll library symbols from FILE.");
set_cmd_completer (c, filename_completer);
- sh = getenv ("SHELL");
- if (!sh)
- sh = "/bin/sh";
- if (access (sh, X_OK) != 0)
- {
- shell[0] = '\0';
- useshell = 0;
- }
- else
- {
- cygwin_conv_to_win32_path (sh, shell);
- useshell = 1;
- }
-
add_com_alias ("sharedlibrary", "dll-symbols", class_alias, 1);
add_show_from_set (add_set_cmd ("shell", class_support, var_boolean,
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index daca498..d519f7b 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -123,7 +123,8 @@ static DEBUG_EVENT current_event; /* The current debug event from
WaitForDebugEvent */
static HANDLE current_process_handle; /* Currently executing process */
static thread_info *current_thread; /* Info on currently selected thread */
-static DWORD main_thread_id; /* Thread ID of the main thread */
+static DWORD main_thread_id; /* Thread ID of the main thread */
+static pid_t cygwin_pid; /* pid of cygwin process */
/* Counts of things. */
static int exception_count = 0;
@@ -139,9 +140,6 @@ static int debug_memory = 0; /* show target memory accesses */
static int debug_exceptions = 0; /* show target exceptions */
static int useshell = 0; /* use shell for subprocesses */
-/* Path to shell */
-static char shell[MAX_PATH + 1];
-
/* This vector maps GDB's idea of a register's number into an address
in the win32 exception context vector.
@@ -1461,6 +1459,8 @@ child_create_inferior (char *exec_file, char *allargs, char **env)
char *args;
char real_path[MAXPATHLEN];
char *toexec;
+ char shell[MAX_PATH + 1]; /* Path to shell */
+ const char *sh;
if (!exec_file)
error ("No executable specified, use `target exec'.\n");
@@ -1468,7 +1468,7 @@ child_create_inferior (char *exec_file, char *allargs, char **env)
memset (&si, 0, sizeof (si));
si.cb = sizeof (si);
- if (!useshell || !shell[0])
+ if (!useshell)
{
flags = DEBUG_ONLY_THIS_PROCESS;
cygwin_conv_to_win32_path (exec_file, real_path);
@@ -1476,8 +1476,13 @@ child_create_inferior (char *exec_file, char *allargs, char **env)
}
else
{
- char *newallargs = alloca (sizeof (" -c 'exec '") + strlen (exec_file)
- + strlen (allargs) + 2);
+ char *newallargs;
+ sh = getenv ("SHELL");
+ if (!sh)
+ sh = "/bin/sh";
+ cygwin_conv_to_win32_path (sh, shell);
+ newallargs = alloca (sizeof (" -c 'exec '") + strlen (exec_file)
+ + strlen (allargs) + 2);
sprintf (newallargs, " -c 'exec %s %s'", exec_file, allargs);
allargs = newallargs;
toexec = shell;
@@ -1497,7 +1502,7 @@ child_create_inferior (char *exec_file, char *allargs, char **env)
/* Prepare the environment vars for CreateProcess. */
{
- /* This code use to assume all env vars were file names and would
+ /* This code used to assume all env vars were file names and would
translate them all to win32 style. That obviously doesn't work in the
general case. The current rule is that we only translate PATH.
We need to handle PATH because we're about to call CreateProcess and
@@ -1813,7 +1818,6 @@ void
_initialize_inftarg (void)
{
struct cmd_list_element *c;
- const char *sh;
init_child_ops ();
@@ -1821,20 +1825,6 @@ _initialize_inftarg (void)
"Load dll library symbols from FILE.");
set_cmd_completer (c, filename_completer);
- sh = getenv ("SHELL");
- if (!sh)
- sh = "/bin/sh";
- if (access (sh, X_OK) != 0)
- {
- shell[0] = '\0';
- useshell = 0;
- }
- else
- {
- cygwin_conv_to_win32_path (sh, shell);
- useshell = 1;
- }
-
add_com_alias ("sharedlibrary", "dll-symbols", class_alias, 1);
add_show_from_set (add_set_cmd ("shell", class_support, var_boolean,