2001-02-04 Philip Blundell <philb@gnu.org>
[deliverable/binutils-gdb.git] / gdb / go32-nat.c
index 6668f06e4e4403cd46c41e34d25cedfe618c2b91..0a84ab95d478432e53bf7c851903085ba36c4265 100644 (file)
@@ -157,7 +157,9 @@ static void store_register (int regno);
 static void go32_store_registers (int regno);
 static void go32_prepare_to_store (void);
 static int go32_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len,
-                            int write, struct target_ops *target);
+                            int write,
+                            struct mem_attrib *attrib,
+                            struct target_ops *target);
 static void go32_files_info (struct target_ops *target);
 static void go32_stop (void);
 static void go32_kill_inferior (void);
@@ -389,6 +391,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
@@ -532,6 +541,7 @@ go32_prepare_to_store (void)
 
 static int
 go32_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
+                 struct mem_attrib *attrib ATTRIBUTE_UNUSED,
                  struct target_ops *target ATTRIBUTE_UNUSED)
 {
   if (write)
@@ -603,6 +613,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 +1239,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)
This page took 0.023675 seconds and 4 git commands to generate.