Add a symbol's value to the computed frag offset, rather than overwriting it.
[deliverable/binutils-gdb.git] / gdb / procfs.c
index d1763869eff7c789f11a543b21ce3ae49dded904..b108078349871da592b9351d324a68511c3809b6 100644 (file)
@@ -24,6 +24,7 @@ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #include "target.h"
 #include "gdbcore.h"
 #include "gdbcmd.h"
+#include "gdbthread.h"
 
 #if defined (NEW_PROC_API)
 #define _STRUCTURED_PROC 1     /* Should be done by configure script. */
@@ -33,6 +34,11 @@ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #include <sys/fault.h>
 #include <sys/syscall.h>
 #include <sys/errno.h>
+#include <sys/wait.h>
+#include <signal.h>
+#include <ctype.h>
+
+#include "proc-utils.h"
 
 /* 
  * PROCFS.C
@@ -287,6 +293,8 @@ typedef prstatus_t gdb_lwpstatus_t;
 #ifndef PIDGET
 #define PIDGET(PID)            (PID)
 #define TIDGET(PID)            (PID)
+#endif
+#ifndef MERGEPID
 #define MERGEPID(PID, TID)     (PID)
 #endif
 
@@ -403,11 +411,13 @@ find_procinfo_or_die (pid, tid)
   procinfo *pi = find_procinfo (pid, tid);
 
   if (pi == NULL)
-    if (tid)
-      error ("procfs: couldn't find pid %d (kernel thread %d) in procinfo list.", 
-            pid, tid);
-    else
-      error ("procfs: couldn't find pid %d in procinfo list.", pid);
+    {
+      if (tid)
+       error ("procfs: couldn't find pid %d (kernel thread %d) in procinfo list.", 
+              pid, tid);
+      else
+       error ("procfs: couldn't find pid %d in procinfo list.", pid);
+    }
   return pi;
 }
 
@@ -431,7 +441,9 @@ open_procinfo_files (pi, which)
      procinfo *pi;
      int       which;
 {
+#ifdef NEW_PROC_API
   char tmp[MAX_PROC_NAME_SIZE];
+#endif
   int  fd;
 
   /* 
@@ -2627,11 +2639,14 @@ proc_iterate_over_mappings (func)
   struct prmap *map;
   procinfo *pi;
 #ifndef NEW_PROC_API   /* avoid compiler warning */
-  int nmaps = 0, i;
+  int nmaps = 0;
+  int i;
+#else
+  int map_fd;
+  char pathname[MAX_PROC_NAME_SIZE];
 #endif
   int funcstat = 0;
-  int fd, map_fd;
-  char pathname[MAX_PROC_NAME_SIZE];
+  int fd;
 
   pi = find_procinfo_or_die (PIDGET (inferior_pid), 0);
 
@@ -3762,9 +3777,9 @@ wait_again:
                    if ((nsysargs = proc_nsysarg (pi)) > 0 &&
                        (sysargs  = proc_sysargs (pi)) != NULL)
                      {
-                       printf_filtered ("%d syscall arguments:\n", nsysargs);
+                       printf_filtered ("%ld syscall arguments:\n", nsysargs);
                        for (i = 0; i < nsysargs; i++)
-                         printf_filtered ("#%d: 0x%08x\n", 
+                         printf_filtered ("#%ld: 0x%08x\n", 
                                           i, sysargs[i]);
                      }
 
@@ -3876,9 +3891,9 @@ wait_again:
                    if ((nsysargs = proc_nsysarg (pi)) > 0 &&
                        (sysargs  = proc_sysargs (pi)) != NULL)
                      {
-                       printf_filtered ("%d syscall arguments:\n", nsysargs);
+                       printf_filtered ("%ld syscall arguments:\n", nsysargs);
                        for (i = 0; i < nsysargs; i++)
-                         printf_filtered ("#%d: 0x%08x\n", 
+                         printf_filtered ("#%ld: 0x%08x\n", 
                                           i, sysargs[i]);
                      }
                  }
@@ -4141,6 +4156,7 @@ invalidate_cache (parent, pi, ptr)
   return 0;
 }
 
+#if 0
 /*
  * Function: make_signal_thread_runnable
  *
@@ -4165,6 +4181,7 @@ make_signal_thread_runnable (process, pi, ptr)
 #endif
   return 0;
 }
+#endif
 
 /*
  * Function: target_resume
@@ -4216,7 +4233,7 @@ procfs_resume (pid, step, signo)
 
   /* Convert signal to host numbering.  */
   if (signo == 0 ||
-      signo == TARGET_SIGNAL_STOP && pi->ignore_next_sigstop)
+      (signo == TARGET_SIGNAL_STOP && pi->ignore_next_sigstop))
     native_signo = 0;
   else
     native_signo = target_signal_to_host (signo);
@@ -4603,7 +4620,6 @@ procfs_set_exec_trap ()
 
   procinfo *pi;
   sysset_t exitset;
-  sysset_t entryset;
 
   if ((pi = create_procinfo (getpid (), 0)) == NULL)
     perror_with_name ("procfs: create_procinfo failed in child.");
@@ -5027,11 +5043,12 @@ info_proc_cmd (args, from_tty)
 
   old_chain = make_cleanup (null_cleanup, 0);
   if (args)
-    if ((argv = buildargv (args)) == NULL)
-      nomem (0);
-    else
-      make_cleanup ((make_cleanup_func) freeargv, argv);
-
+    {
+      if ((argv = buildargv (args)) == NULL)
+       nomem (0);
+      else
+       make_cleanup ((make_cleanup_func) freeargv, argv);
+    }
   while (argv != NULL && *argv != NULL)
     {
       if (isdigit (argv[0][0]))
This page took 0.024795 seconds and 4 git commands to generate.