From 51aa361ef8aa81812faa32a28ece7a77d8d4a39b Mon Sep 17 00:00:00 2001 From: Stan Shebs Date: Fri, 22 Jan 1999 02:30:37 +0000 Subject: [PATCH] * procfs.c (init_procfs_ops): New function, fills in procfs_ops, init only nonzero fields, leave to_require_attach and to_require_detach empty, not needed for /proc systems yet. (_initialize_procfs): Call init_procfs_ops. --- gdb/ChangeLog | 7 +++++++ gdb/procfs.c | 49 ++++++++++++++++++++++++------------------------- 2 files changed, 31 insertions(+), 25 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index f11c86cd49c..8101355b36e 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +Thu Jan 21 17:51:51 1999 Stan Shebs + + * procfs.c (init_procfs_ops): New function, fills in procfs_ops, + init only nonzero fields, leave to_require_attach and + to_require_detach empty, not needed for /proc systems yet. + (_initialize_procfs): Call init_procfs_ops. + Thu Jan 21 17:25:46 1999 Mark Alexander * mon960-rom.c (_initialize_mon960): Call init_mon960_cmds diff --git a/gdb/procfs.c b/gdb/procfs.c index 83c0c328d08..eb4cbfbf032 100644 --- a/gdb/procfs.c +++ b/gdb/procfs.c @@ -137,7 +137,7 @@ regardless of whether or not the actual target has floating point hardware. #define MAX_PROC_NAME_SIZE sizeof("/proc/1234567890/status") -extern struct target_ops procfs_ops; /* Forward declaration */ +struct target_ops procfs_ops; int procfs_suppress_run = 0; /* Non-zero if procfs should pretend not to be a runnable target. Used by targets @@ -653,6 +653,8 @@ struct procfs_syscall_handler static void procfs_resume PARAMS ((int pid, int step, enum target_signal signo)); +static void init_procfs_ops PARAMS ((void)); + /* External function prototypes that can't be easily included in any header file because the args are typedefs in system include files. */ @@ -5751,33 +5753,17 @@ procfs_pid_to_str (pid) return buf; } #endif /* TIDGET */ - -struct target_ops procfs_ops; -void -_initialize_procfs () + +static void +init_procfs_ops () { -#ifdef HAVE_OPTIONAL_PROC_FS - char procname[MAX_PROC_NAME_SIZE]; - int fd; - - /* If we have an optional /proc filesystem (e.g. under OSF/1), - don't add procfs support if we cannot access the running - GDB via /proc. */ - sprintf (procname, STATUS_PROC_NAME_FMT, getpid ()); - if ((fd = open (procname, O_RDONLY)) < 0) - return; - close (fd); -#endif procfs_ops.to_shortname = "procfs"; procfs_ops.to_longname = "Unix /proc child process"; procfs_ops.to_doc = "Unix /proc child process (started by the \"run\" command)."; procfs_ops.to_open = procfs_open; - procfs_ops.to_close = 0; procfs_ops.to_attach = procfs_attach; - procfs_ops.to_require_attach = procfs_attach; procfs_ops.to_detach = procfs_detach; - procfs_ops.to_require_detach = procfs_detach; procfs_ops.to_resume = procfs_resume; procfs_ops.to_wait = procfs_wait; procfs_ops.to_fetch_registers = procfs_fetch_registers; @@ -5793,8 +5779,6 @@ _initialize_procfs () procfs_ops.to_terminal_ours = terminal_ours; procfs_ops.to_terminal_info = child_terminal_info; procfs_ops.to_kill = procfs_kill_inferior; - procfs_ops.to_load = 0; - procfs_ops.to_lookup_symbol = 0; procfs_ops.to_create_inferior = procfs_create_inferior; procfs_ops.to_mourn_inferior = procfs_mourn_inferior; procfs_ops.to_can_run = procfs_can_run; @@ -5807,11 +5791,26 @@ _initialize_procfs () procfs_ops.to_has_stack = 1; procfs_ops.to_has_registers = 1; procfs_ops.to_has_execution = 1; - procfs_ops.to_has_thread_control = tc_none; - procfs_ops.to_sections = 0; - procfs_ops.to_sections_end = 0; procfs_ops.to_magic = OPS_MAGIC; +} + +void +_initialize_procfs () +{ +#ifdef HAVE_OPTIONAL_PROC_FS + char procname[MAX_PROC_NAME_SIZE]; + int fd; + + /* If we have an optional /proc filesystem (e.g. under OSF/1), + don't add procfs support if we cannot access the running + GDB via /proc. */ + sprintf (procname, STATUS_PROC_NAME_FMT, getpid ()); + if ((fd = open (procname, O_RDONLY)) < 0) + return; + close (fd); +#endif + init_procfs_ops (); add_target (&procfs_ops); add_info ("processes", info_proc, -- 2.30.2