X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Fproc-api.c;h=2d3ca9ffbf2f560892196b437f00f79009e08925;hb=5ba2abebe76a125d8e4e3181db399e489bd63eeb;hp=cf12d424d6559db0716bc5542c1bd6fb13d359df;hpb=6e8cb14ae5bbf686d99416c8f9681d10a95e0548;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/proc-api.c b/gdb/proc-api.c index cf12d424d6..2d3ca9ffbf 100644 --- a/gdb/proc-api.c +++ b/gdb/proc-api.c @@ -1,5 +1,5 @@ /* 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. @@ -27,6 +27,7 @@ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "defs.h" #include "gdbcmd.h" +#include "completer.h" #if defined (NEW_PROC_API) #define _STRUCTURED_PROC 1 @@ -69,10 +70,7 @@ prepare_to_trace (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) @@ -81,10 +79,7 @@ set_procfs_trace_cmd (args, from_tty, c) } 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. */ @@ -223,14 +218,11 @@ static struct trans ioctl_table[] = { }; 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 (); @@ -453,21 +445,16 @@ static struct trans rw_table[] = { 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; - long *arg = (long *) varg; + procfs_ctl_t *arg = (procfs_ctl_t *) varg; 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; @@ -491,7 +478,9 @@ write_with_trace (fd, varg, len, file, line) case PCUNSET: #endif #ifdef PCRESET +#if PCRESET != PCUNSET case PCRESET: +#endif #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: { +#ifdef BREAKPOINT 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 () \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, @@ -614,12 +606,7 @@ write_with_trace (fd, varg, len, file, line) } 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; @@ -642,11 +629,7 @@ lseek_with_trace (fd, offset, whence, file, line) #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; @@ -687,10 +670,7 @@ open_with_trace (filename, mode, file, line) } int -close_with_trace (fd, file, line) - int fd; - char *file; - int line; +close_with_trace (int fd, char *file, int line) { int ret; @@ -716,10 +696,7 @@ close_with_trace (fd, file, line) } 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; @@ -754,10 +731,7 @@ wait_with_trace (wstat, file, line) } 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) @@ -772,11 +746,7 @@ procfs_note (msg, file, line) } 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) @@ -798,7 +768,7 @@ proc_prettyfprint_status (flags, why, what, thread) void -_initialize_proc_api () +_initialize_proc_api (void) { 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); - c->function.sfunc = set_procfs_trace_cmd; + set_cmd_sfunc (c, set_procfs_trace_cmd); + set_cmd_completer (c, 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->function.sfunc = set_procfs_file_cmd; + set_cmd_sfunc (c, set_procfs_file_cmd); }