2002-02-13 Michael Chastain <mec@shout.net>
[deliverable/binutils-gdb.git] / gdb / proc-api.c
index cf12d424d6559db0716bc5542c1bd6fb13d359df..986691dc83ddda970895486287ef4aa299fd251f 100644 (file)
@@ -1,5 +1,5 @@
 /* Machine independent support for SVR4 /proc (process file system) for GDB.
 /* Machine independent support for SVR4 /proc (process file system) for GDB.
-   Copyright 1999 Free Software Foundation, Inc.
+   Copyright 1999, 2000, 2001 Free Software Foundation, Inc.
    Written by Michael Snyder at Cygnus Solutions.
    Based on work by Fred Fish, Stu Grossman, Geoff Noer, and others.
 
    Written by Michael Snyder at Cygnus Solutions.
    Based on work by Fred Fish, Stu Grossman, Geoff Noer, and others.
 
@@ -27,6 +27,7 @@ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 #include "defs.h"
 #include "gdbcmd.h"
 
 #include "defs.h"
 #include "gdbcmd.h"
+#include "completer.h"
 
 #if defined (NEW_PROC_API)
 #define _STRUCTURED_PROC 1
 
 #if defined (NEW_PROC_API)
 #define _STRUCTURED_PROC 1
@@ -69,10 +70,7 @@ prepare_to_trace (void)
 }
 
 static void
 }
 
 static void
-set_procfs_trace_cmd (args, from_tty, c)
-     char *args;
-     int from_tty;
-     struct cmd_list_element *c;
+set_procfs_trace_cmd (char *args, int from_tty, struct cmd_list_element *c)
 {
 #if 0  /* not sure what I might actually need to do here, if anything */
   if (procfs_file)
 {
 #if 0  /* not sure what I might actually need to do here, if anything */
   if (procfs_file)
@@ -81,10 +79,7 @@ set_procfs_trace_cmd (args, from_tty, c)
 }
 
 static void
 }
 
 static void
-set_procfs_file_cmd (args, from_tty, c)
-     char *args;
-     int from_tty;
-     struct cmd_list_element *c;
+set_procfs_file_cmd (char *args, int from_tty, struct cmd_list_element *c)
 {
   /* Just changed the filename for procfs tracing.
      If a file was already open, close it.  */
 {
   /* Just changed the filename for procfs tracing.
      If a file was already open, close it.  */
@@ -223,14 +218,11 @@ static struct trans ioctl_table[] = {
 };
 
 int
 };
 
 int
-ioctl_with_trace (fd, opcode, ptr, file, line)
-     int  fd;
-     long opcode;
-     void *ptr;
-     char *file;
-     int  line;
+ioctl_with_trace (int fd, long opcode, void *ptr, char *file, int line)
 {
 {
-  int i, ret, arg1;
+  int i = 0;
+  int ret;
+  int arg1;
 
   prepare_to_trace ();
 
 
   prepare_to_trace ();
 
@@ -453,21 +445,16 @@ static struct trans rw_table[] = {
 static off_t lseek_offset;
 
 int
 static off_t lseek_offset;
 
 int
-write_with_trace (fd, varg, len, file, line)
-     int  fd;
-     void *varg;
-     size_t len;
-     char *file;
-     int  line;
+write_with_trace (int fd, void *varg, size_t len, char *file, int line)
 {
   int  i;
   int ret;
 {
   int  i;
   int ret;
-  long *arg = (long *) varg;
+  procfs_ctl_t *arg = (procfs_ctl_t *) varg;
 
   prepare_to_trace ();
   if (procfs_trace)
     {
 
   prepare_to_trace ();
   if (procfs_trace)
     {
-      long opcode = arg[0];
+      procfs_ctl_t opcode = arg[0];
       for (i = 0; rw_table[i].name != NULL; i++)
        if (rw_table[i].value == opcode)
          break;
       for (i = 0; rw_table[i].name != NULL; i++)
        if (rw_table[i].value == opcode)
          break;
@@ -491,7 +478,9 @@ write_with_trace (fd, varg, len, file, line)
       case PCUNSET:
 #endif
 #ifdef PCRESET
       case PCUNSET:
 #endif
 #ifdef PCRESET
+#if PCRESET != PCUNSET
       case PCRESET:
       case PCRESET:
+#endif
 #endif
        fprintf (procfs_file ? procfs_file : stdout, 
                 "write (PCRESET, %s) %s\n", 
 #endif
        fprintf (procfs_file ? procfs_file : stdout, 
                 "write (PCRESET, %s) %s\n", 
@@ -567,6 +556,7 @@ write_with_trace (fd, varg, len, file, line)
        break;
       default:
        {
        break;
       default:
        {
+#ifdef BREAKPOINT
          static unsigned char break_insn[] = BREAKPOINT;
 
          if (len == sizeof (break_insn) &&
          static unsigned char break_insn[] = BREAKPOINT;
 
          if (len == sizeof (break_insn) &&
@@ -574,7 +564,9 @@ write_with_trace (fd, varg, len, file, line)
            fprintf (procfs_file ? procfs_file : stdout, 
                     "write (<breakpoint at 0x%08lx>) \n", 
                     (unsigned long) lseek_offset);
            fprintf (procfs_file ? procfs_file : stdout, 
                     "write (<breakpoint at 0x%08lx>) \n", 
                     (unsigned long) lseek_offset);
-         else if (rw_table[i].name)
+         else 
+#endif
+         if (rw_table[i].name)
            fprintf (procfs_file ? procfs_file : stdout, 
                     "write (%s) %s\n", 
                     rw_table[i].name, 
            fprintf (procfs_file ? procfs_file : stdout, 
                     "write (%s) %s\n", 
                     rw_table[i].name, 
@@ -614,12 +606,7 @@ write_with_trace (fd, varg, len, file, line)
 }
 
 off_t
 }
 
 off_t
-lseek_with_trace (fd, offset, whence, file, line)
-     int fd;
-     off_t offset;
-     int whence;
-     char *file;
-     int line;
+lseek_with_trace (int fd, off_t offset, int whence, char *file, int line)
 {
   off_t ret;
 
 {
   off_t ret;
 
@@ -642,11 +629,7 @@ lseek_with_trace (fd, offset, whence, file, line)
 #endif /* NEW_PROC_API */
 
 int
 #endif /* NEW_PROC_API */
 
 int
-open_with_trace (filename, mode, file, line)
-     char *filename;
-     int   mode;
-     char *file;
-     int   line;
+open_with_trace (char *filename, int mode, char *file, int line)
 {
   int ret;
 
 {
   int ret;
 
@@ -687,10 +670,7 @@ open_with_trace (filename, mode, file, line)
 }
 
 int
 }
 
 int
-close_with_trace (fd, file, line)
-     int   fd;
-     char *file;
-     int   line;
+close_with_trace (int fd, char *file, int line)
 {
   int ret;
 
 {
   int ret;
 
@@ -716,10 +696,7 @@ close_with_trace (fd, file, line)
 }
 
 pid_t
 }
 
 pid_t
-wait_with_trace (wstat, file, line)
-     int  *wstat;
-     char *file;
-     int   line;
+wait_with_trace (int *wstat, char *file, int line)
 {
   int ret, lstat = 0;
 
 {
   int ret, lstat = 0;
 
@@ -754,10 +731,7 @@ wait_with_trace (wstat, file, line)
 }
 
 void
 }
 
 void
-procfs_note (msg, file, line)
-     char *msg;
-     char *file;
-     int   line;
+procfs_note (char *msg, char *file, int line)
 {
   prepare_to_trace ();
   if (procfs_trace)
 {
   prepare_to_trace ();
   if (procfs_trace)
@@ -772,11 +746,7 @@ procfs_note (msg, file, line)
 }
 
 void
 }
 
 void
-proc_prettyfprint_status (flags, why, what, thread)
-     long flags;
-     int  why;
-     int  what;
-     int  thread;
+proc_prettyfprint_status (long flags, int why, int what, int thread)
 {
   prepare_to_trace ();
   if (procfs_trace)
 {
   prepare_to_trace ();
   if (procfs_trace)
@@ -798,7 +768,7 @@ proc_prettyfprint_status (flags, why, what, thread)
 
 
 void
 
 
 void
-_initialize_proc_api ()
+_initialize_proc_api (void)
 {
   struct cmd_list_element *c;
 
 {
   struct cmd_list_element *c;
 
@@ -807,12 +777,13 @@ _initialize_proc_api ()
                   "Set tracing for /proc api calls.\n", &setlist);
 
   add_show_from_set (c, &showlist);
                   "Set tracing for /proc api calls.\n", &setlist);
 
   add_show_from_set (c, &showlist);
-  c->function.sfunc = set_procfs_trace_cmd;
+  set_cmd_sfunc (c, set_procfs_trace_cmd);
+  c->completer = filename_completer;
 
   c = add_set_cmd ("procfs-file", no_class, var_filename,
                   (char *) &procfs_filename, 
                   "Set filename for /proc tracefile.\n", &setlist);
 
   add_show_from_set (c, &showlist);
 
   c = add_set_cmd ("procfs-file", no_class, var_filename,
                   (char *) &procfs_filename, 
                   "Set filename for /proc tracefile.\n", &setlist);
 
   add_show_from_set (c, &showlist);
-  c->function.sfunc = set_procfs_file_cmd;
+  set_cmd_sfunc (c, set_procfs_file_cmd);
 }
 }
This page took 0.025371 seconds and 4 git commands to generate.