2012-03-01 Pedro Alves <palves@redhat.com>
[deliverable/binutils-gdb.git] / gdb / arm-linux-nat.c
index f64c37c263670f3c03df9de476c4a593cac534b6..d5016196be9cfdfb75bfff48e09cd2c178bd5438 100644 (file)
@@ -1,6 +1,5 @@
 /* GNU/Linux on ARM native support.
-   Copyright (C) 1999, 2000, 2001, 2002, 2004, 2005, 2006, 2007, 2008, 2009,
-   2010, 2011 Free Software Foundation, Inc.
+   Copyright (C) 1999-2002, 2004-2012 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -72,22 +71,6 @@ static int arm_linux_vfp_register_count;
 
 extern int arm_apcs_32;
 
-/* The following variables are used to determine the version of the
-   underlying GNU/Linux operating system.  Examples:
-
-   GNU/Linux 2.0.35             GNU/Linux 2.2.12
-   os_version = 0x00020023      os_version = 0x0002020c
-   os_major = 2                 os_major = 2
-   os_minor = 0                 os_minor = 2
-   os_release = 35              os_release = 12
-
-   Note: os_version = (os_major << 16) | (os_minor << 8) | os_release
-
-   These are initialized using get_linux_version() from
-   _initialize_arm_linux_nat().  */
-
-static unsigned int os_version, os_major, os_minor, os_release;
-
 /* On GNU/Linux, threads are implemented as pseudo-processes, in which
    case we may be tracing more than one process at a time.  In that
    case, inferior_ptid will contain the main process ID and the
@@ -644,31 +627,6 @@ ps_get_thread_area (const struct ps_prochandle *ph,
   return PS_OK;
 }
 
-static unsigned int
-get_linux_version (unsigned int *vmajor,
-                  unsigned int *vminor,
-                  unsigned int *vrelease)
-{
-  struct utsname info;
-  char *pmajor, *pminor, *prelease, *tail;
-
-  if (-1 == uname (&info))
-    {
-      warning (_("Unable to determine GNU/Linux version."));
-      return -1;
-    }
-
-  pmajor = strtok (info.release, ".");
-  pminor = strtok (NULL, ".");
-  prelease = strtok (NULL, ".");
-
-  *vmajor = (unsigned int) strtoul (pmajor, &tail, 0);
-  *vminor = (unsigned int) strtoul (pminor, &tail, 0);
-  *vrelease = (unsigned int) strtoul (prelease, &tail, 0);
-
-  return ((*vmajor << 16) | (*vminor << 8) | *vrelease);
-}
-
 static const struct target_desc *
 arm_linux_read_description (struct target_ops *ops)
 {
@@ -1075,7 +1033,6 @@ static int
 arm_linux_insert_hw_breakpoint (struct gdbarch *gdbarch, 
                                struct bp_target_info *bp_tgt)
 {
-  ptid_t ptid;
   struct lwp_info *lp;
   struct arm_linux_hw_breakpoint p;
 
@@ -1083,8 +1040,8 @@ arm_linux_insert_hw_breakpoint (struct gdbarch *gdbarch,
     return -1;
 
   arm_linux_hw_breakpoint_initialize (gdbarch, bp_tgt, &p);
-  ALL_LWPS (lp, ptid)
-    arm_linux_insert_hw_breakpoint1 (&p, TIDGET (ptid), 0);
+  ALL_LWPS (lp)
+    arm_linux_insert_hw_breakpoint1 (&p, TIDGET (lp->ptid), 0);
 
   return 0;
 }
@@ -1094,7 +1051,6 @@ static int
 arm_linux_remove_hw_breakpoint (struct gdbarch *gdbarch, 
                                struct bp_target_info *bp_tgt)
 {
-  ptid_t ptid;
   struct lwp_info *lp;
   struct arm_linux_hw_breakpoint p;
 
@@ -1102,8 +1058,8 @@ arm_linux_remove_hw_breakpoint (struct gdbarch *gdbarch,
     return -1;
 
   arm_linux_hw_breakpoint_initialize (gdbarch, bp_tgt, &p);
-  ALL_LWPS (lp, ptid)
-    arm_linux_remove_hw_breakpoint1 (&p, TIDGET (ptid), 0);
+  ALL_LWPS (lp)
+    arm_linux_remove_hw_breakpoint1 (&p, TIDGET (lp->ptid), 0);
 
   return 0;
 }
@@ -1146,7 +1102,6 @@ static int
 arm_linux_insert_watchpoint (CORE_ADDR addr, int len, int rw,
                             struct expression *cond)
 {
-  ptid_t ptid;
   struct lwp_info *lp;
   struct arm_linux_hw_breakpoint p;
 
@@ -1154,8 +1109,8 @@ arm_linux_insert_watchpoint (CORE_ADDR addr, int len, int rw,
     return -1;
 
   arm_linux_hw_watchpoint_initialize (addr, len, rw, &p);
-  ALL_LWPS (lp, ptid)
-    arm_linux_insert_hw_breakpoint1 (&p, TIDGET (ptid), 1);
+  ALL_LWPS (lp)
+    arm_linux_insert_hw_breakpoint1 (&p, TIDGET (lp->ptid), 1);
 
   return 0;
 }
@@ -1165,7 +1120,6 @@ static int
 arm_linux_remove_watchpoint (CORE_ADDR addr, int len, int rw,
                             struct expression *cond)
 {
-  ptid_t ptid;
   struct lwp_info *lp;
   struct arm_linux_hw_breakpoint p;
 
@@ -1173,8 +1127,8 @@ arm_linux_remove_watchpoint (CORE_ADDR addr, int len, int rw,
     return -1;
 
   arm_linux_hw_watchpoint_initialize (addr, len, rw, &p);
-  ALL_LWPS (lp, ptid)
-    arm_linux_remove_hw_breakpoint1 (&p, TIDGET (ptid), 1);
+  ALL_LWPS (lp)
+    arm_linux_remove_hw_breakpoint1 (&p, TIDGET (lp->ptid), 1);
 
   return 0;
 }
@@ -1223,9 +1177,9 @@ arm_linux_watchpoint_addr_within_range (struct target_ops *target,
 /* Handle thread creation.  We need to copy the breakpoints and watchpoints
    in the parent thread to the child thread.  */
 static void
-arm_linux_new_thread (ptid_t ptid)
+arm_linux_new_thread (struct lwp_info *lp)
 {
-  int tid = TIDGET (ptid);
+  int tid = TIDGET (lp->ptid);
   const struct arm_linux_hwbp_cap *info = arm_linux_get_hwbp_cap ();
 
   if (info != NULL)
@@ -1291,8 +1245,6 @@ _initialize_arm_linux_nat (void)
 {
   struct target_ops *t;
 
-  os_version = get_linux_version (&os_major, &os_minor, &os_release);
-
   /* Fill in the generic GNU/Linux methods.  */
   t = linux_target ();
 
This page took 0.038462 seconds and 4 git commands to generate.