Adjust all targets to new target_stop interface.
[deliverable/binutils-gdb.git] / gdb / go32-nat.c
index 9758129cd7e38537f91603fb58c0e9cbf358e395..d4744a8b5c408d518d09e18d52ba010d66fb4d20 100644 (file)
@@ -1,12 +1,13 @@
 /* Native debugging support for Intel x86 running DJGPP.
-   Copyright 1997, 1999, 2000, 2001 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1999, 2000, 2001, 2005, 2006, 2007, 2008
+   Free Software Foundation, Inc.
    Written by Robert Hoehne.
 
    This file is part of GDB.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
+   the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
 
    This program is distributed in the hope that it will be useful,
@@ -15,9 +16,7 @@
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include <fcntl.h>
 
@@ -34,6 +33,7 @@
 #include "value.h"
 #include "regcache.h"
 #include "gdb_string.h"
+#include "top.h"
 
 #include <stdio.h>             /* might be required for __DJGPP_MINOR__ */
 #include <stdlib.h>
@@ -172,16 +172,16 @@ static void go32_resume (ptid_t ptid, int step,
                          enum target_signal siggnal);
 static ptid_t go32_wait (ptid_t ptid,
                                struct target_waitstatus *status);
-static void go32_fetch_registers (int regno);
-static void store_register (int regno);
-static void go32_store_registers (int regno);
-static void go32_prepare_to_store (void);
+static void go32_fetch_registers (struct regcache *, int regno);
+static void store_register (const struct regcache *, int regno);
+static void go32_store_registers (struct regcache *, int regno);
+static void go32_prepare_to_store (struct regcache *);
 static int go32_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len,
                             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_stop (ptid_t);
 static void go32_kill_inferior (void);
 static void go32_create_inferior (char *exec_file, char *args, char **env, int from_tty);
 static void go32_mourn_inferior (void);
@@ -463,61 +463,63 @@ go32_wait (ptid_t ptid, struct target_waitstatus *status)
 }
 
 static void
-fetch_register (int regno)
+fetch_register (struct regcache *regcache, int regno)
 {
-  if (regno < FP0_REGNUM)
-    regcache_raw_supply (current_regcache, regno,
+  if (regno < gdbarch_fp0_regnum (get_regcache_arch (regcache)))
+    regcache_raw_supply (regcache, regno,
                         (char *) &a_tss + regno_mapping[regno].tss_ofs);
   else if (i386_fp_regnum_p (regno) || i386_fpc_regnum_p (regno))
-    i387_supply_fsave (current_regcache, regno, &npx);
+    i387_supply_fsave (regcache, regno, &npx);
   else
     internal_error (__FILE__, __LINE__,
                    _("Invalid register no. %d in fetch_register."), regno);
 }
 
 static void
-go32_fetch_registers (int regno)
+go32_fetch_registers (struct regcache *regcache, int regno)
 {
   if (regno >= 0)
-    fetch_register (regno);
+    fetch_register (regcache, regno);
   else
     {
-      for (regno = 0; regno < FP0_REGNUM; regno++)
-       fetch_register (regno);
-      i387_supply_fsave (current_regcache, -1, &npx);
+      for (regno = 0;
+          regno < gdbarch_fp0_regnum (get_regcache_arch (regcache));
+          regno++)
+       fetch_register (regcache, regno);
+      i387_supply_fsave (regcache, -1, &npx);
     }
 }
 
 static void
-store_register (int regno)
+store_register (const struct regcache *regcache, int regno)
 {
-  if (regno < FP0_REGNUM)
-    regcache_raw_collect (current_regcache, regno,
+  if (regno < gdbarch_fp0_regnum (get_regcache_arch (regcache)))
+    regcache_raw_collect (regcache, regno,
                          (char *) &a_tss + regno_mapping[regno].tss_ofs);
   else if (i386_fp_regnum_p (regno) || i386_fpc_regnum_p (regno))
-    i387_fill_fsave ((char *) &npx, regno);
+    i387_collect_fsave (regcache, regno, &npx);
   else
     internal_error (__FILE__, __LINE__,
                    _("Invalid register no. %d in store_register."), regno);
 }
 
 static void
-go32_store_registers (int regno)
+go32_store_registers (struct regcache *regcache, int regno)
 {
   unsigned r;
 
   if (regno >= 0)
-    store_register (regno);
+    store_register (regcache, regno);
   else
     {
-      for (r = 0; r < FP0_REGNUM; r++)
-       store_register (r);
-      i387_fill_fsave ((char *) &npx, -1);
+      for (r = 0; r < gdbarch_fp0_regnum (get_regcache_arch (regcache)); r++)
+       store_register (regcache, r);
+      i387_collect_fsave (regcache, -1, &npx);
     }
 }
 
 static void
-go32_prepare_to_store (void)
+go32_prepare_to_store (struct regcache *regcache)
 {
 }
 
@@ -558,7 +560,7 @@ go32_files_info (struct target_ops *target)
 }
 
 static void
-go32_stop (void)
+go32_stop (ptid_t ptid)
 {
   normal_stop ();
   cleanup_client ();
@@ -591,7 +593,7 @@ go32_create_inferior (char *exec_file, char *args, char **env, int from_tty)
 
   if (prog_has_started)
     {
-      go32_stop ();
+      go32_stop (inferior_ptid);
       go32_kill_inferior ();
     }
   resume_signal = -1;
@@ -656,7 +658,6 @@ go32_create_inferior (char *exec_file, char *args, char **env, int from_tty)
   push_target (&go32_ops);
   clear_proceed_status ();
   insert_breakpoints ();
-  proceed ((CORE_ADDR) -1, TARGET_SIGNAL_0, 0);
   prog_has_started = 1;
 }
 
@@ -894,6 +895,9 @@ init_go32_ops (void)
 
   /* We are always processing GCC-compiled programs.  */
   processing_gcc_compilation = 2;
+
+  /* Override the default name of the GDB init file.  */
+  strcpy (gdbinit, "gdb.ini");
 }
 
 unsigned short windows_major, windows_minor;
This page took 0.02527 seconds and 4 git commands to generate.