Index: sparc-sol2-nat.c =================================================================== RCS file: /cvs/src/src/gdb/sparc-sol2-nat.c,v retrieving revision 1.5 diff -u -p -r1.5 sparc-sol2-nat.c --- sparc-sol2-nat.c 17 Dec 2005 22:34:02 -0000 1.5 +++ sparc-sol2-nat.c 13 Jan 2006 17:16:50 -0000 @@ -26,6 +26,8 @@ #include "gregset.h" #include "sparc-tdep.h" +#include "target.h" +#include "inf-procfs.h" /* This file provids the (temporary) glue between the Solaris SPARC target dependent code and the machine independent SVR4 /proc @@ -96,3 +98,11 @@ fill_fpregset (prfpregset_t *fpregs, int { sparc_collect_fpregset (current_regcache, regnum, fpregs); } + +void +_initialize_sparc_sol2_nat (void) +{ + struct target_ops *t = inf_procfs_target (); + + add_target (t); +} Index: config/sparc/sol2.mh =================================================================== RCS file: /cvs/src/src/gdb/config/sparc/sol2.mh,v retrieving revision 1.3 diff -u -p -r1.3 sol2.mh --- config/sparc/sol2.mh 7 Apr 2004 00:15:12 -0000 1.3 +++ config/sparc/sol2.mh 13 Jan 2006 17:17:42 -0000 @@ -2,4 +2,4 @@ NAT_FILE= nm-sol2.h NATDEPFILES= sparc-sol2-nat.o \ corelow.o core-regset.o fork-child.o gcore.o \ - procfs.o proc-api.o proc-events.o proc-flags.o proc-why.o + inf-procfs.o proc-api.o proc-events.o proc-flags.o proc-why.o Index: Makefile.in =================================================================== RCS file: /cvs/src/src/gdb/Makefile.in,v retrieving revision 1.773 diff -u -p -r1.773 Makefile.in --- Makefile.in 7 Jan 2006 14:17:16 -0000 1.773 +++ Makefile.in 13 Jan 2006 17:13:23 -0000 @@ -715,6 +715,7 @@ inf_child_h = inf-child.h inferior_h = inferior.h $(breakpoint_h) $(target_h) $(frame_h) inf_loop_h = inf-loop.h inflow_h = inflow.h $(terminal_h) +inf_procfs_h = inf-procfs.h inf_ptrace_h = inf-ptrace.h inf_ttrace_h = inf-ttrace.h interps_h = interps.h $(exceptions_h) @@ -2126,6 +2127,11 @@ inf-loop.o: inf-loop.c $(defs_h) $(infer inflow.o: inflow.c $(defs_h) $(frame_h) $(inferior_h) $(command_h) \ $(serial_h) $(terminal_h) $(target_h) $(gdbthread_h) $(gdb_string_h) \ $(inflow_h) +inf-procfs.o: inf-procfs.c $(inf_procfs_h) $(inferior_h) $(target_h) \ + $(gdbcore_h) $(elf_bfd_h) $(gdbcmd_h) $(gdbthread_h) \ + $(gdb_wait_h) $(gdb_string_h) $(gdb_assert_h) $(inflow_h) \ + $(auxv_h) $(gdb_dirent_h) $(gdb_stat_h) $(proc_utils_h) \ + $(gregset_h) inf-ptrace.o: inf-ptrace.c $(defs_h) $(command_h) $(inferior_h) $(inflow_h) \ $(gdbcore_h) $(observer_h) $(regcache_h) $(gdb_assert_h) \ $(gdb_string_h) $(gdb_ptrace_h) $(gdb_wait_h) $(inf_child_h) @@ -2637,7 +2643,7 @@ sparcobsd-tdep.o: sparcobsd-tdep.c $(def $(symtab_h) $(trad_frame_h) $(gdb_assert_h) $(obsd_tdep_h) \ $(sparc_tdep_h) $(solib_svr4_h) $(bsd_uthread_h) sparc-sol2-nat.o: sparc-sol2-nat.c $(defs_h) $(regcache_h) $(gregset_h) \ - $(sparc_tdep_h) $(sparc64_tdep_h) + $(sparc_tdep_h) $(sparc64_tdep_h) $(target_h) $(inf_procfs_h) sparc-sol2-tdep.o: sparc-sol2-tdep.c $(defs_h) $(frame_h) $(frame_unwind_h) \ $(gdbcore_h) $(symtab_h) $(objfiles_h) $(osabi_h) $(regcache_h) \ $(target_h) $(trad_frame_h) $(gdb_assert_h) $(gdb_string_h) \ Index: sol-thread.c =================================================================== RCS file: /cvs/src/src/gdb/sol-thread.c,v retrieving revision 1.51 diff -u -p -r1.51 sol-thread.c --- sol-thread.c 17 Dec 2005 22:34:02 -0000 1.51 +++ sol-thread.c 13 Jan 2006 17:16:45 -0000 @@ -69,9 +69,6 @@ #include "gdb_string.h" -extern struct target_ops sol_thread_ops; /* Forward declaration */ -extern struct target_ops sol_core_ops; /* Forward declaration */ - /* place to store core_ops before we overwrite it */ static struct target_ops orig_core_ops; @@ -79,7 +76,7 @@ struct target_ops sol_thread_ops; struct target_ops sol_core_ops; extern int procfs_suppress_run; -extern struct target_ops procfs_ops; /* target vector for procfs.c */ +extern struct target_ops *procfs_ops; /* target vector for procfs.c */ extern struct target_ops core_ops; /* target vector for corelow.c */ extern char *procfs_pid_to_str (ptid_t ptid); @@ -342,7 +339,7 @@ lwp_to_thread (ptid_t lwp) static void sol_thread_open (char *arg, int from_tty) { - procfs_ops.to_open (arg, from_tty); + procfs_ops->to_open (arg, from_tty); } /* Attach to process PID, then initialize for debugging it and wait @@ -351,7 +348,7 @@ sol_thread_open (char *arg, int from_tty static void sol_thread_attach (char *args, int from_tty) { - procfs_ops.to_attach (args, from_tty); + procfs_ops->to_attach (args, from_tty); /* Must get symbols from shared libraries before libthread_db can run! */ solib_add (NULL, from_tty, (struct target_ops *) 0, auto_solib_add); @@ -384,7 +381,7 @@ sol_thread_detach (char *args, int from_ { inferior_ptid = pid_to_ptid (PIDGET (main_ph.ptid)); unpush_target (&sol_thread_ops); - procfs_ops.to_detach (args, from_tty); + procfs_ops->to_detach (args, from_tty); } /* Resume execution of process PTID. If STEP is nozero, then just @@ -415,7 +412,7 @@ sol_thread_resume (ptid_t ptid, int step GET_THREAD (save_ptid)); } - procfs_ops.to_resume (ptid, step, signo); + procfs_ops->to_resume (ptid, step, signo); do_cleanups (old_chain); } @@ -449,7 +446,7 @@ sol_thread_wait (ptid_t ptid, struct tar GET_THREAD (save_ptid)); } - rtnval = procfs_ops.to_wait (ptid, ourstatus); + rtnval = procfs_ops->to_wait (ptid, ourstatus); if (ourstatus->kind != TARGET_WAITKIND_EXITED) { @@ -494,7 +491,7 @@ sol_thread_fetch_registers (int regnum) { /* It's an LWP; pass the request on to procfs. */ if (target_has_execution) - procfs_ops.to_fetch_registers (regnum); + procfs_ops->to_fetch_registers (regnum); else orig_core_ops.to_fetch_registers (regnum); return; @@ -568,7 +565,7 @@ sol_thread_store_registers (int regnum) if (!is_thread (inferior_ptid)) { /* It's an LWP; pass the request on to procfs.c. */ - procfs_ops.to_store_registers (regnum); + procfs_ops->to_store_registers (regnum); return; } @@ -651,7 +648,7 @@ sol_thread_store_registers (int regnum) static void sol_thread_prepare_to_store (void) { - procfs_ops.to_prepare_to_store (); + procfs_ops->to_prepare_to_store (); } /* Transfer LEN bytes between GDB address MYADDR and target address @@ -681,7 +678,7 @@ sol_thread_xfer_memory (CORE_ADDR memadd } if (target_has_execution) - retval = procfs_ops.deprecated_xfer_memory (memaddr, myaddr, len, + retval = procfs_ops->deprecated_xfer_memory (memaddr, myaddr, len, dowrite, attrib, target); else retval = orig_core_ops.deprecated_xfer_memory (memaddr, myaddr, len, @@ -718,7 +715,7 @@ sol_thread_xfer_partial (struct target_o } if (target_has_execution) - retval = procfs_ops.to_xfer_partial (ops, object, annex, + retval = procfs_ops->to_xfer_partial (ops, object, annex, readbuf, writebuf, offset, len); else retval = orig_core_ops.to_xfer_partial (ops, object, annex, @@ -734,19 +731,19 @@ sol_thread_xfer_partial (struct target_o static void sol_thread_files_info (struct target_ops *ignore) { - procfs_ops.to_files_info (ignore); + procfs_ops->to_files_info (ignore); } static void sol_thread_kill_inferior (void) { - procfs_ops.to_kill (); + procfs_ops->to_kill (); } static void sol_thread_notice_signals (ptid_t ptid) { - procfs_ops.to_notice_signals (pid_to_ptid (PIDGET (ptid))); + procfs_ops->to_notice_signals (pid_to_ptid (PIDGET (ptid))); } /* Fork an inferior process, and start debugging it with /proc. */ @@ -755,7 +752,7 @@ static void sol_thread_create_inferior (char *exec_file, char *allargs, char **env, int from_tty) { - procfs_ops.to_create_inferior (exec_file, allargs, env, from_tty); + procfs_ops->to_create_inferior (exec_file, allargs, env, from_tty); if (sol_thread_active && !ptid_equal (inferior_ptid, null_ptid)) { @@ -836,7 +833,7 @@ static void sol_thread_mourn_inferior (void) { unpush_target (&sol_thread_ops); - procfs_ops.to_mourn_inferior (); + procfs_ops->to_mourn_inferior (); } /* Mark our target-struct as eligible for stray "run" and "attach" @@ -887,7 +884,7 @@ sol_thread_alive (ptid_t ptid) { /* It's an LPW; pass the request on to procfs. */ if (target_has_execution) - return procfs_ops.to_thread_alive (ptid); + return procfs_ops->to_thread_alive (ptid); else return orig_core_ops.to_thread_alive (ptid); } @@ -896,7 +893,7 @@ sol_thread_alive (ptid_t ptid) static void sol_thread_stop (void) { - procfs_ops.to_stop (); + procfs_ops->to_stop (); } /* These routines implement the lower half of the thread_db interface, @@ -1016,7 +1013,7 @@ rw_common (int dowrite, const struct ps_ /* FIXME: passing 0 as attrib argument. */ if (target_has_execution) - cc = procfs_ops.deprecated_xfer_memory (addr, buf, size, + cc = procfs_ops->deprecated_xfer_memory (addr, buf, size, dowrite, 0, &procfs_ops); else cc = orig_core_ops.deprecated_xfer_memory (addr, buf, size, @@ -1104,7 +1101,7 @@ ps_lgetregs (gdb_ps_prochandle_t ph, lwp inferior_ptid = BUILD_LWP (lwpid, PIDGET (inferior_ptid)); if (target_has_execution) - procfs_ops.to_fetch_registers (-1); + procfs_ops->to_fetch_registers (-1); else orig_core_ops.to_fetch_registers (-1); fill_gregset ((gdb_gregset_t *) gregset, -1); @@ -1128,7 +1125,7 @@ ps_lsetregs (gdb_ps_prochandle_t ph, lwp supply_gregset ((gdb_gregset_t *) gregset); if (target_has_execution) - procfs_ops.to_store_registers (-1); + procfs_ops->to_store_registers (-1); else orig_core_ops.to_store_registers (-1); @@ -1236,7 +1233,7 @@ ps_lgetfpregs (gdb_ps_prochandle_t ph, l inferior_ptid = BUILD_LWP (lwpid, PIDGET (inferior_ptid)); if (target_has_execution) - procfs_ops.to_fetch_registers (-1); + procfs_ops->to_fetch_registers (-1); else orig_core_ops.to_fetch_registers (-1); fill_fpregset ((gdb_fpregset_t *) fpregset, -1); @@ -1260,7 +1257,7 @@ ps_lsetfpregs (gdb_ps_prochandle_t ph, l supply_fpregset ((gdb_fpregset_t *) fpregset); if (target_has_execution) - procfs_ops.to_store_registers (-1); + procfs_ops->to_store_registers (-1); else orig_core_ops.to_store_registers (-1); @@ -1389,7 +1386,7 @@ sol_find_new_threads (void) } /* First Find any new LWP's. */ - procfs_ops.to_find_new_threads (); + procfs_ops->to_find_new_threads (); /* Then find any new user-level threads. */ p_td_ta_thr_iter (main_ta, sol_find_new_threads_callback, (void *) 0, @@ -1514,13 +1511,13 @@ sol_find_memory_regions (int (*func) (CO int, int, int, void *), void *data) { - return procfs_ops.to_find_memory_regions (func, data); + return procfs_ops->to_find_memory_regions (func, data); } static char * sol_make_note_section (bfd *obfd, int *note_size) { - return procfs_ops.to_make_corefile_notes (obfd, note_size); + return procfs_ops->to_make_corefile_notes (obfd, note_size); } static int