diff options
author | Michael Snyder <msnyder@vmware.com> | 2000-05-05 20:56:10 +0000 |
---|---|---|
committer | Michael Snyder <msnyder@vmware.com> | 2000-05-05 20:56:10 +0000 |
commit | 103b3ef54f8d3711039fe1dfe18b109e5dac322b (patch) | |
tree | 40b86899df0c0c1a233c429184b53327fdd2b96c /gdb/procfs.c | |
parent | b8d39351ea5eabfa364474f006b1556f40f0f636 (diff) | |
download | gdb-103b3ef54f8d3711039fe1dfe18b109e5dac322b.zip gdb-103b3ef54f8d3711039fe1dfe18b109e5dac322b.tar.gz gdb-103b3ef54f8d3711039fe1dfe18b109e5dac322b.tar.bz2 |
2000-05-05 Michael Snyder <msnyder@seadog.cygnus.com>
* procfs.c: Cleanup of procfs tracing. Move defines and
prototypes to proc-utils.h
* proc-utils.h: Define tracing macros. Declare trace functions.
* proc-api.c: Make procfs tracing a runtime option.
(prepare_to_trace): New function, abstracted out of several
places. Open a trace file if one is required.
(ioctl_with_trace, write_with_trace, open_with_trace,
close_with_trace, wait_with_trace, lseek_with_trace):
Report errno if an error occurs in a system call.
(write_with_trace): Make 2nd arg void *, to agree with write.
Diffstat (limited to 'gdb/procfs.c')
-rw-r--r-- | gdb/procfs.c | 45 |
1 files changed, 10 insertions, 35 deletions
diff --git a/gdb/procfs.c b/gdb/procfs.c index 9f1dc10..7961458 100644 --- a/gdb/procfs.c +++ b/gdb/procfs.c @@ -38,8 +38,6 @@ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include <signal.h> #include <ctype.h> -#include "proc-utils.h" - /* * PROCFS.C * @@ -85,6 +83,13 @@ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include <unistd.h> /* for "X_OK" */ #include "gdb_stat.h" /* for struct stat */ +/* Note: procfs-utils.h must be included after the above system header + files, because it redefines various system calls using macros. + This may be incompatible with the prototype declarations. */ + +#define PROCFS_TRACE +#include "proc-utils.h" + /* =================== TARGET_OPS "MODULE" =================== */ /* @@ -154,8 +159,8 @@ init_procfs_ops () procfs_ops.to_thread_alive = procfs_thread_alive; procfs_ops.to_pid_to_str = procfs_pid_to_str; - procfs_ops.to_has_all_memory = 1; - procfs_ops.to_has_memory = 1; + procfs_ops.to_has_all_memory = 1; + procfs_ops.to_has_memory = 1; procfs_ops.to_has_execution = 1; procfs_ops.to_has_stack = 1; procfs_ops.to_has_registers = 1; @@ -167,36 +172,6 @@ init_procfs_ops () /* =================== END, TARGET_OPS "MODULE" =================== */ /* - * Temporary debugging code: - * - * These macros allow me to trace the system calls that we make - * to control the child process. This is quite handy for comparing - * with the older version of procfs. - */ - -#ifdef TRACE_PROCFS -#ifdef NEW_PROC_API -extern int write_with_trace PARAMS ((int, void *, size_t, char *, int)); -extern off_t lseek_with_trace PARAMS ((int, off_t, int, char *, int)); -#define write(X,Y,Z) write_with_trace (X, Y, Z, __FILE__, __LINE__) -#define lseek(X,Y,Z) lseek_with_trace (X, Y, Z, __FILE__, __LINE__) -#else -extern int ioctl_with_trace PARAMS ((int, long, void *, char *, int)); -#define ioctl(X,Y,Z) ioctl_with_trace (X, Y, Z, __FILE__, __LINE__) -#endif -#define open(X,Y) open_with_trace (X, Y, __FILE__, __LINE__) -#define close(X) close_with_trace (X, __FILE__, __LINE__) -#define wait(X) wait_with_trace (X, __FILE__, __LINE__) -#define PROCFS_NOTE(X) procfs_note (X, __FILE__, __LINE__) -#define PROC_PRETTYFPRINT_STATUS(X,Y,Z,T) \ -proc_prettyfprint_status (X, Y, Z, T) -#else -#define PROCFS_NOTE(X) -#define PROC_PRETTYFPRINT_STATUS(X,Y,Z,T) -#endif - - -/* * World Unification: * * Put any typedefs, defines etc. here that are required for @@ -4460,7 +4435,7 @@ unconditionally_kill_inferior (pi) } #else /* PROCFS_NEED_PIOCSSIG_FOR_KILL */ if (!proc_kill (pi, SIGKILL)) - proc_warn (pi, "unconditionally_kill, proc_kill", __LINE__); + proc_error (pi, "unconditionally_kill, proc_kill", __LINE__); #endif /* PROCFS_NEED_PIOCSSIG_FOR_KILL */ destroy_procinfo (pi); |