diff options
author | Eli Zaretskii <eliz@gnu.org> | 2000-08-06 07:19:38 +0000 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2000-08-06 07:19:38 +0000 |
commit | 045401e7e89115cd596b595bf531eec71ea24711 (patch) | |
tree | 92b1b356f339b24dcddcc956d094846c7507ba29 | |
parent | 8ec683c772f6538a354cda8130ca47ad75d4749e (diff) | |
download | gdb-045401e7e89115cd596b595bf531eec71ea24711.tar.gz |
* go32-nat.c: (go32_wait): If child_cwd[] is empty, initialize
it to GDB's current directory.
(go32_create_inferior, init_go32_ops): Initialize child_cwd[] to
an empty string, to signal an uninitialized value.
From Robert Hoehne <robert.hoehne@gmx.net>.
-rw-r--r-- | gdb/ChangeLog | 8 | ||||
-rw-r--r-- | gdb/go32-nat.c | 17 |
2 files changed, 23 insertions, 2 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index bdaaa2ae717..3e711dcf9f0 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,11 @@ +2000-08-05 Eli Zaretskii <eliz@is.elta.co.il> + + * go32-nat.c: (go32_wait): If child_cwd[] is empty, initialize + it to GDB's current directory. + (go32_create_inferior, init_go32_ops): Initialize child_cwd[] to + an empty string, to signal an uninitialized value. + From Robert Hoehne <robert.hoehne@gmx.net>. + 2000-08-04 Kevin Buettner <kevinb@redhat.com> * symtab.h (fixup_psymbol_section): Declare. diff --git a/gdb/go32-nat.c b/gdb/go32-nat.c index 6668f06e4e4..41170066ce2 100644 --- a/gdb/go32-nat.c +++ b/gdb/go32-nat.c @@ -389,6 +389,13 @@ go32_wait (int pid ATTRIBUTE_UNUSED, struct target_waitstatus *status) point of changing back to where GDB thinks is its cwd, when we return control to the debugger, but restore child's cwd before we run it. */ + /* Initialize child_cwd, before the first call to run_child and not + in the initialization, so the child get also the changed directory + set with the gdb-command "cd ..." */ + if (!*child_cwd) + /* Initialize child's cwd with the current one. */ + getcwd (child_cwd, sizeof (child_cwd)); + chdir (child_cwd); #if __DJGPP_MINOR__ < 3 @@ -603,6 +610,11 @@ go32_create_inferior (char *exec_file, char *args, char **env) } resume_signal = -1; resume_is_step = 0; + + /* Initialize child's cwd as empty to be initialized when starting + the child. */ + *child_cwd = 0; + /* Init command line storage. */ if (redir_debug_init (&child_cmd) == -1) internal_error ("Cannot allocate redirection storage: not enough memory.\n"); @@ -1224,8 +1236,9 @@ init_go32_ops (void) go32_ops.to_has_execution = 1; go32_ops.to_magic = OPS_MAGIC; - /* Initialize child's cwd with the current one. */ - getcwd (child_cwd, sizeof (child_cwd)); + /* Initialize child's cwd as empty to be initialized when starting + the child. */ + *child_cwd = 0; /* Initialize child's command line storage. */ if (redir_debug_init (&child_cmd) == -1) |