* resbin.c (bin_to_res_version): Correct offset
[deliverable/binutils-gdb.git] / gdb / gnu-nat.c
index 32f78be1b3a2c31b8e21f481e4f2d3f86c5b8408..1d74d0455c5fbfd69fdb71dcbfe6efa89929cc38 100644 (file)
@@ -1,6 +1,6 @@
 /* Interface GDB to the GNU Hurd.
-   Copyright (C) 1992, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2006, 2007,
-   2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+   Copyright (C) 1992, 1995-2001, 2006-2012 Free Software Foundation,
+   Inc.
 
    This file is part of GDB.
 
@@ -22,6 +22,8 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include "defs.h"
+
 #include <ctype.h>
 #include <errno.h>
 #include <limits.h>
@@ -52,7 +54,6 @@
 
 #include <portinfo.h>
 
-#include "defs.h"
 #include "inferior.h"
 #include "symtab.h"
 #include "value.h"
@@ -107,7 +108,7 @@ void inf_resume (struct inf *inf);
 void inf_set_step_thread (struct inf *inf, struct proc *proc);
 void inf_detach (struct inf *inf);
 void inf_attach (struct inf *inf, int pid);
-void inf_signal (struct inf *inf, enum target_signal sig);
+void inf_signal (struct inf *inf, enum gdb_signal sig);
 void inf_continue (struct inf *inf);
 
 #define inf_debug(_inf, msg, args...) \
@@ -1254,7 +1255,7 @@ inf_detach (struct inf *inf)
          if (inf->nomsg)
            inf_continue (inf);
          else
-           inf_signal (inf, TARGET_SIGNAL_0);
+           inf_signal (inf, GDB_SIGNAL_0);
        }
 
       proc_restore_exc_port (task);
@@ -1321,12 +1322,12 @@ inf_restore_exc_ports (struct inf *inf)
    signal 0, will continue it.  INF is assumed to be in a paused state, and
    the resume_sc's of INF's threads may be affected.  */
 void
-inf_signal (struct inf *inf, enum target_signal sig)
+inf_signal (struct inf *inf, enum gdb_signal sig)
 {
   error_t err = 0;
-  int host_sig = target_signal_to_host (sig);
+  int host_sig = gdb_signal_to_host (sig);
 
-#define NAME target_signal_to_name (sig)
+#define NAME gdb_signal_to_name (sig)
 
   if (host_sig >= _NSIG)
     /* A mach exception.  Exceptions are encoded in the signal space by
@@ -1574,7 +1575,7 @@ rewait:
                     inf->pending_execs);
        }
       else if (kind == TARGET_WAITKIND_STOPPED
-              && w->status.value.sig == TARGET_SIGNAL_TRAP)
+              && w->status.value.sig == GDB_SIGNAL_TRAP)
        /* Ah hah!  A SIGTRAP from the inferior while starting up probably
           means we've succesfully completed an exec!  */
        {
@@ -1694,7 +1695,7 @@ S_exception_raise_request (mach_port_t port, mach_port_t reply_port,
       if (exception == EXC_BREAKPOINT)
        /* GDB likes to get SIGTRAP for breakpoints.  */
        {
-         inf->wait.status.value.sig = TARGET_SIGNAL_TRAP;
+         inf->wait.status.value.sig = GDB_SIGNAL_TRAP;
          mach_port_deallocate (mach_task_self (), reply_port);
        }
       else
@@ -1728,7 +1729,7 @@ S_exception_raise_request (mach_port_t port, mach_port_t reply_port,
             them after _NSIG; this assumes they're positive (and not
             extremely large)!  */
          inf->wait.status.value.sig =
-           target_signal_from_host (_NSIG + exception);
+           gdb_signal_from_host (_NSIG + exception);
        }
     }
   else
@@ -1750,7 +1751,7 @@ inf_task_died_status (struct inf *inf)
   warning (_("Pid %d died with unknown exit status, using SIGKILL."),
           inf->pid);
   inf->wait.status.kind = TARGET_WAITKIND_SIGNALLED;
-  inf->wait.status.value.sig = TARGET_SIGNAL_KILL;
+  inf->wait.status.value.sig = GDB_SIGNAL_KILL;
 }
 
 /* Notify server routines.  The only real one is dead name notification.  */
@@ -1918,7 +1919,7 @@ S_msg_sig_post_untraced_reply (mach_port_t reply, error_t err)
        server should like).  */
     {
       inf->wait.status.kind = TARGET_WAITKIND_STOPPED;
-      inf->wait.status.value.sig = TARGET_SIGNAL_0;
+      inf->wait.status.value.sig = GDB_SIGNAL_0;
     }
   else if (err)
     warning (_("Signal delivery failed: %s"), safe_strerror (err));
@@ -1975,7 +1976,7 @@ port_msgs_queued (mach_port_t port)
 
 static void
 gnu_resume (struct target_ops *ops,
-           ptid_t ptid, int step, enum target_signal sig)
+           ptid_t ptid, int step, enum gdb_signal sig)
 {
   struct proc *step_thread = 0;
   int resume_all;
@@ -1986,9 +1987,9 @@ gnu_resume (struct target_ops *ops,
 
   inf_validate_procinfo (inf);
 
-  if (sig != TARGET_SIGNAL_0 || inf->stopped)
+  if (sig != GDB_SIGNAL_0 || inf->stopped)
     {
-      if (sig == TARGET_SIGNAL_0 && inf->nomsg)
+      if (sig == GDB_SIGNAL_0 && inf->nomsg)
        inf_continue (inf);
       else
        inf_signal (inf, sig);
@@ -2000,7 +2001,7 @@ gnu_resume (struct target_ops *ops,
       proc_abort (inf->wait.thread, 1);
       warning (_("Aborting %s with unforwarded exception %s."),
               proc_string (inf->wait.thread),
-              target_signal_to_name (inf->wait.status.value.sig));
+              gdb_signal_to_name (inf->wait.status.value.sig));
     }
 
   if (port_msgs_queued (inf->event_port))
@@ -2490,7 +2491,7 @@ gnu_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len, int write,
     {
       inf_debug (gnu_current_inf, "%s %s[%d] %s %s",
                 write ? "writing" : "reading",
-                paddress (target_gdbarch, memaddr), len,
+                paddress (target_gdbarch (), memaddr), len,
                 write ? "<--" : "-->", host_address_to_string (myaddr));
       if (write)
        return gnu_write_inferior (task, memaddr, myaddr, len);
@@ -2558,6 +2559,7 @@ gnu_find_memory_regions (find_memory_region_ftype func, void *data)
                     last_protection & VM_PROT_READ,
                     last_protection & VM_PROT_WRITE,
                     last_protection & VM_PROT_EXECUTE,
+                    1, /* MODIFIED is unknown, pass it as true.  */
                     data);
          last_region_address = region_address;
          last_region_end = region_address += region_length;
@@ -2571,6 +2573,7 @@ gnu_find_memory_regions (find_memory_region_ftype func, void *data)
             last_protection & VM_PROT_READ,
             last_protection & VM_PROT_WRITE,
             last_protection & VM_PROT_EXECUTE,
+            1, /* MODIFIED is unknown, pass it as true.  */
             data);
 
   return 0;
@@ -2584,10 +2587,10 @@ proc_string (struct proc *proc)
   static char tid_str[80];
 
   if (proc_is_task (proc))
-    sprintf (tid_str, "process %d", proc->inf->pid);
+    xsnprintf (tid_str, sizeof (tid_str), "process %d", proc->inf->pid);
   else
-    sprintf (tid_str, "Thread %d.%d",
-            proc->inf->pid, proc->tid);
+    xsnprintf (tid_str, sizeof (tid_str), "Thread %d.%d",
+              proc->inf->pid, proc->tid);
   return tid_str;
 }
 
@@ -2604,7 +2607,7 @@ gnu_pid_to_str (struct target_ops *ops, ptid_t ptid)
     {
       static char tid_str[80];
 
-      sprintf (tid_str, "bogus thread id %d", tid);
+      xsnprintf (tid_str, sizeof (tid_str), "bogus thread id %d", tid);
       return tid_str;
     }
 }
@@ -2643,8 +2646,8 @@ gnu_target (void)
 \f
 /* User task commands.  */
 
-struct cmd_list_element *set_task_cmd_list = 0;
-struct cmd_list_element *show_task_cmd_list = 0;
+static struct cmd_list_element *set_task_cmd_list = 0;
+static struct cmd_list_element *show_task_cmd_list = 0;
 /* User thread commands.  */
 
 /* Commands with a prefix of `set/show thread'.  */
This page took 0.040653 seconds and 4 git commands to generate.