diff options
Diffstat (limited to 'devel/gdb66/files')
32 files changed, 0 insertions, 2916 deletions
diff --git a/devel/gdb66/files/fbsd4.h b/devel/gdb66/files/fbsd4.h deleted file mode 100644 index 7e3bef49c737..000000000000 --- a/devel/gdb66/files/fbsd4.h +++ /dev/null @@ -1,21 +0,0 @@ -// $FreeBSD$ - -extern void _rl_set_screen_size (int, int); - -#define rl_set_screen_size _rl_set_screen_size -#define rl_filename_completion_function filename_completion_function - -extern int screenwidth, screenheight; - -static inline void -rl_get_screen_size (int *rows, int *cols) -{ - if (rows) *rows = screenheight; - if (cols) *cols = screenwidth; -} - -#if 0 -#define savestring -#include <readline/readline.h> -#undef savestring -#endif diff --git a/devel/gdb66/files/freebsd-uthread.c b/devel/gdb66/files/freebsd-uthread.c deleted file mode 100644 index e6f4a7f3be0a..000000000000 --- a/devel/gdb66/files/freebsd-uthread.c +++ /dev/null @@ -1,994 +0,0 @@ -/* Low level interface for debugging FreeBSD user threads for GDB, the GNU debugger. - Copyright 1996, 1999 Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -/* $FreeBSD$ */ - -/* This module implements a sort of half target that sits between the - machine-independent parts of GDB and the ptrace interface (infptrace.c) to - provide access to the FreeBSD user-mode thread implementation. - - FreeBSD threads are true user-mode threads, which are invoked via - the pthread_* interfaces. These are mostly implemented in - user-space, with all thread context kept in various structures that - live in the user's heap. For the most part, the kernel has no - knowlege of these threads. - - Based largely on hpux-thread.c - - */ - - -#include "defs.h" -#include <sys/queue.h> -#include <signal.h> -#include <setjmp.h> -#include <string.h> -#include "gdbthread.h" -#include "target.h" -#include "inferior.h" -#include <fcntl.h> -#include <ucontext.h> -#include <unistd.h> -#include <sys/stat.h> -#include "gdbcore.h" -#include "regcache.h" - -extern int child_suppress_run; -extern struct target_ops child_ops; /* target vector for inftarg.c */ - -extern void _initialize_freebsd_uthread PARAMS ((void)); - -/* Set to true while we are part-way through attaching */ -static int freebsd_uthread_attaching; - -static int freebsd_uthread_active = 0; -static CORE_ADDR P_thread_list; -static CORE_ADDR P_thread_run; - -/* Pointer to the next function on the objfile event chain. */ -static void (*target_new_objfile_chain) (struct objfile *objfile); - -static void freebsd_uthread_resume PARAMS ((ptid_t pid, int step, - enum target_signal signo)); - -static void init_freebsd_uthread_ops PARAMS ((void)); - -static struct target_ops freebsd_uthread_ops; - -static ptid_t find_active_ptid PARAMS ((void)); - -struct cached_pthread { - u_int64_t uniqueid; - int state; - CORE_ADDR name; - union { - ucontext_t uc; - jmp_buf jb; - } ctx; -}; - -static ptid_t cached_ptid; -static struct cached_pthread cached_pthread; -static CORE_ADDR cached_pthread_addr; - -LIST_HEAD(idmaplist, idmap); - -struct idmap { - LIST_ENTRY(idmap) link; - u_int64_t uniqueid; - int tid; -}; - -#define MAPHASH_SIZE 257 -#define TID_MIN 1 -#define TID_MAX 16383 - -static int tid_to_hash[TID_MAX + 1]; /* set to map_hash index */ -static struct idmaplist map_hash[MAPHASH_SIZE]; -static int next_free_tid = TID_MIN; /* first available tid */ -static int last_free_tid = TID_MIN; /* first unavailable */ - -static CORE_ADDR P_thread_next_offset; -static CORE_ADDR P_thread_uniqueid_offset; -static CORE_ADDR P_thread_state_offset; -static CORE_ADDR P_thread_name_offset; -static CORE_ADDR P_thread_ctx_offset; -static CORE_ADDR P_thread_PS_RUNNING_value; -static CORE_ADDR P_thread_PS_DEAD_value; - -static int next_offset; -static int uniqueid_offset; -static int state_offset; -static int name_offset; -static int ctx_offset; -static int PS_RUNNING_value; -static int PS_DEAD_value; - -#define UNIQUEID_HASH(id) (id % MAPHASH_SIZE) -#define TID_ADD1(tid) (((tid) + 1) == TID_MAX + 1 \ - ? TID_MIN : (tid) + 1) -#define IS_TID_FREE(tid) (tid_to_hash[tid] == -1) - -static int -get_new_tid(int h) -{ - int tid = next_free_tid; - - tid_to_hash[tid] = h; - next_free_tid = TID_ADD1(next_free_tid); - if (next_free_tid == last_free_tid) - { - int i; - - for (i = last_free_tid; TID_ADD1(i) != last_free_tid; i = TID_ADD1(i)) - if (IS_TID_FREE(i)) - break; - if (TID_ADD1(i) == last_free_tid) - { - error("too many threads"); - return 0; - } - next_free_tid = i; - for (i = TID_ADD1(i); IS_TID_FREE(i); i = TID_ADD1(i)) - ; - last_free_tid = i; - } - - return tid; -} - -static ptid_t -find_ptid(u_int64_t uniqueid) -{ - int h = UNIQUEID_HASH(uniqueid); - struct idmap *im; - - LIST_FOREACH(im, &map_hash[h], link) - if (im->uniqueid == uniqueid) - return MERGEPID(PIDGET(inferior_ptid), im->tid); - - im = xmalloc(sizeof(struct idmap)); - im->uniqueid = uniqueid; - im->tid = get_new_tid(h); - LIST_INSERT_HEAD(&map_hash[h], im, link); - - return MERGEPID(PIDGET(inferior_ptid), im->tid); -} - -static void -free_ptid(ptid_t ptid) -{ - int tid = TIDGET(ptid); - int h = tid_to_hash[tid]; - struct idmap *im; - - if (!tid) return; - - LIST_FOREACH(im, &map_hash[h], link) - if (im->tid == tid) - break; - - if (!im) return; - - LIST_REMOVE(im, link); - tid_to_hash[tid] = -1; - free(im); -} - -#define READ_OFFSET(field) read_memory(P_thread_##field##_offset, \ - (char *) &field##_offset, \ - sizeof(field##_offset)) - -#define READ_VALUE(name) read_memory(P_thread_##name##_value, \ - (char *) &name##_value, \ - sizeof(name##_value)) - -static void -read_thread_offsets (void) -{ - READ_OFFSET(next); - READ_OFFSET(uniqueid); - READ_OFFSET(state); - READ_OFFSET(name); - READ_OFFSET(ctx); - - READ_VALUE(PS_RUNNING); - READ_VALUE(PS_DEAD); -} - -#define READ_FIELD(ptr, T, field, result) \ - read_memory ((ptr) + field##_offset, (char *) &(result), sizeof result) - -static u_int64_t -read_pthread_uniqueid (CORE_ADDR ptr) -{ - u_int64_t uniqueid; - READ_FIELD(ptr, u_int64_t, uniqueid, uniqueid); - return uniqueid; -} - -static CORE_ADDR -read_pthread_next (CORE_ADDR ptr) -{ - CORE_ADDR next; - READ_FIELD(ptr, CORE_ADDR, next, next); - return next; -} - -static void -read_cached_pthread (CORE_ADDR ptr, struct cached_pthread *cache) -{ - READ_FIELD(ptr, u_int64_t, uniqueid, cache->uniqueid); - READ_FIELD(ptr, int, state, cache->state); - READ_FIELD(ptr, CORE_ADDR, name, cache->name); - READ_FIELD(ptr, ucontext_t, ctx, cache->ctx); -} - -static ptid_t -find_active_ptid (void) -{ - CORE_ADDR ptr; - - read_memory ((CORE_ADDR)P_thread_run, - (char *)&ptr, - sizeof ptr); - - return find_ptid(read_pthread_uniqueid(ptr)); -} - -static CORE_ADDR find_pthread_addr PARAMS ((ptid_t ptid)); -static struct cached_pthread * find_pthread PARAMS ((ptid_t ptid)); - -static CORE_ADDR -find_pthread_addr (ptid_t ptid) -{ - CORE_ADDR ptr; - - if (ptid_equal(ptid, cached_ptid)) - return cached_pthread_addr; - - read_memory ((CORE_ADDR)P_thread_list, - (char *)&ptr, - sizeof ptr); - - while (ptr != 0) - { - if (ptid_equal(find_ptid(read_pthread_uniqueid(ptr)), ptid)) - { - cached_ptid = ptid; - cached_pthread_addr = ptr; - read_cached_pthread(ptr, &cached_pthread); - return ptr; - } - ptr = read_pthread_next(ptr); - } - - return NULL; -} - -static struct cached_pthread * -find_pthread (ptid_t ptid) -{ - CORE_ADDR ptr; - - if (ptid_equal(ptid, cached_ptid)) - return &cached_pthread; - - read_memory ((CORE_ADDR)P_thread_list, - (char *)&ptr, - sizeof ptr); - - while (ptr != 0) - { - if (ptid_equal(find_ptid(read_pthread_uniqueid(ptr)), ptid)) - { - cached_ptid = ptid; - cached_pthread_addr = ptr; - read_cached_pthread(ptr, &cached_pthread); - return &cached_pthread; - } - ptr = read_pthread_next(ptr); - } - -#if 0 - error ("Can't find pthread %d,%d", PIDGET(ptid), TIDGET(ptid)); -#endif - return NULL; -} - - -/* Most target vector functions from here on actually just pass through to - inftarg.c, as they don't need to do anything specific for threads. */ - -/* ARGSUSED */ -static void -freebsd_uthread_open (char *arg, int from_tty) -{ - child_ops.to_open (arg, from_tty); -} - -/* Attach to process PID, then initialize for debugging it - and wait for the trace-trap that results from attaching. */ - -static void -freebsd_uthread_attach (char *args, int from_tty) -{ - child_ops.to_attach (args, from_tty); - push_target (&freebsd_uthread_ops); - freebsd_uthread_attaching = 1; -} - -/* After an attach, see if the target is threaded */ - -static void -freebsd_uthread_post_attach (int pid) -{ - if (freebsd_uthread_active) - { - read_thread_offsets (); - inferior_ptid = find_active_ptid (); - add_thread (inferior_ptid); - } - else - { - unpush_target (&freebsd_uthread_ops); - push_target (&child_ops); - } - - freebsd_uthread_attaching = 0; -} - -/* Take a program previously attached to and detaches it. - The program resumes execution and will no longer stop - on signals, etc. We'd better not have left any breakpoints - in the program or it'll die when it hits one. For this - to work, it may be necessary for the process to have been - previously attached. It *might* work if the program was - started via the normal ptrace (PTRACE_TRACEME). */ - -static void -freebsd_uthread_detach (char *args, int from_tty) -{ - child_ops.to_detach (args, from_tty); -} - -/* Resume execution of process PID. If STEP is nozero, then - just single step it. If SIGNAL is nonzero, restart it with that - signal activated. We may have to convert pid from a thread-id to an LWP id - for procfs. */ - -static void -freebsd_uthread_resume (ptid_t ptid, int step, enum target_signal signo) -{ - if (freebsd_uthread_attaching) - { - child_ops.to_resume (ptid, step, signo); - return; - } - - child_ops.to_resume (ptid, step, signo); - cached_ptid = MERGEPID(0, 0); -} - -/* Wait for any threads to stop. We may have to convert PID from a thread id - to a LWP id, and vice versa on the way out. */ - -static ptid_t -freebsd_uthread_wait (ptid_t ptid, struct target_waitstatus *ourstatus) -{ - ptid_t rtnval; - - if (freebsd_uthread_attaching) - { - return child_ops.to_wait (ptid, ourstatus); - } - - rtnval = child_ops.to_wait (ptid, ourstatus); - - if (PIDGET(rtnval) >= 0) - { - rtnval = find_active_ptid (); - if (!in_thread_list (rtnval)) - add_thread (rtnval); - } - - return rtnval; -} - -/* XXX: this needs to be selected by target, not [build] host */ -#ifdef __i386__ - -#include "i386-tdep.h" - -static char sigmap[I386_SSE_NUM_REGS] = /* map reg to sigcontext */ -{ - 12, /* eax */ - 11, /* ecx */ - 10, /* edx */ - 9, /* ebx */ - 8, /* esp */ - 7, /* ebp */ - 6, /* esi */ - 5, /* edi */ - 15, /* eip */ - 17, /* eflags */ - 16, /* cs */ - 19, /* ss */ - 4, /* ds */ - 3, /* es */ - 2, /* fs */ - 1, /* gs */ - -1, -1, -1, -1, -1, -1, -1, /* st0-st7 */ - -1, -1, -1, -1, -1, -1, -1, /* fctrl-fop */ - -1, -1, -1, -1, -1, -1, -1, /* xmm0-xmm7 */ - -1, /* mxcsr */ -}; - -static char jmpmap[I386_SSE_NUM_REGS] = /* map reg to jmp_buf */ -{ - 6, /* eax */ - -1, /* ecx */ - -1, /* edx */ - 1, /* ebx */ - 2, /* esp */ - 3, /* ebp */ - 4, /* esi */ - 5, /* edi */ - 0, /* eip */ - -1, /* eflags */ - -1, /* cs */ - -1, /* ss */ - -1, /* ds */ - -1, /* es */ - -1, /* fs */ - -1, /* gs */ - -1, -1, -1, -1, -1, -1, -1, /* st0-st7 */ - -1, -1, -1, -1, -1, -1, -1, /* fctrl-fop */ - -1, -1, -1, -1, -1, -1, -1, /* xmm0-xmm7 */ - -1, /* mxcsr */ -}; - -#endif - -#ifdef __amd64__ - -#include "amd64-tdep.h" - -// XXX:DEO not fully ported from i386 yet!! - -static char sigmap[AMD64_NUM_REGS_TOTAL] = /* map reg to sigcontext */ -{ - 12, /* rax */ - 11, /* rcx */ - 10, /* rdx */ - 9, /* rbx */ - 8, /* rsp */ - 7, /* rbp */ - 6, /* rsi */ - 5, /* rdi */ - 15, /* rip */ - 17, /* rflags */ - 16, /* cs */ - 19, /* ss */ - 4, /* ds */ - 3, /* es */ - 2, /* fs */ - 1, /* gs */ - -1, -1, -1, -1, -1, -1, -1, /* st0-st7 */ - -1, -1, -1, -1, -1, -1, -1, /* fctrl-fop */ - -1, -1, -1, -1, -1, -1, -1, /* xmm0-xmm7 */ - -1, /* mxcsr */ -}; - -static char jmpmap[AMD64_NUM_REGS_TOTAL] = /* map reg to jmp_buf */ -{ - 6, /* rax */ - -1, /* rcx */ - -1, /* rdx */ - 1, /* rbx */ - 2, /* rsp */ - 3, /* rbp */ - 4, /* rsi */ - 5, /* rdi */ - 0, /* rip */ - -1, /* rflags */ - -1, /* cs */ - -1, /* ss */ - -1, /* ds */ - -1, /* es */ - -1, /* fs */ - -1, /* gs */ - -1, -1, -1, -1, -1, -1, -1, /* st0-st7 */ - -1, -1, -1, -1, -1, -1, -1, /* fctrl-fop */ - -1, -1, -1, -1, -1, -1, -1, /* xmm0-xmm7 */ - -1, /* mxcsr */ -}; - -#endif - -#ifdef __alpha__ - -#include "alpha-tdep.h" - -static char sigmap[ALPHA_NUM_REGS] = /* map reg to sigcontext */ -{ - 1, 2, 3, 4, 5, 6, 7, 8, /* v0 - t6 */ - 9, 10, 11, 12, 13, 14, 15, 16, /* t7 - fp */ - 17, 18, 19, 20, 21, 22, 23, 24, /* a0 - t9 */ - 25, 26, 27, 28, 29, 30, 31, 32, /* t10 - zero */ - 38, 39, 40, 41, 42, 43, 44, 45, /* f0 - f7 */ - 46, 47, 48, 49, 50, 51, 52, 53, /* f8 - f15 */ - 54, 55, 56, 57, 58, 59, 60, 61, /* f16 - f23 */ - 62, 63, 64, 65, 66, 67, 68, 69, /* f24 - f31 */ - 33, -1 /* pc, vfp */ -}; -static char jmpmap[ALPHA_NUM_REGS] = { - 4, 5, 6, 7, 8, 9, 10, 11, /* v0 - t6 */ - 12, 13, 14, 15, 16, 17, 18, 19, /* t7 - fp */ - 20, 21, 22, 23, 24, 25, 26, 27, /* a0 - t9 */ - 28, 29, 30, 31, 32, 33, 34, 35, /* t10 - zero */ - 37, 38, 39, 40, 41, 42, 43, 44, /* f0 - f7 */ - 45, 46, 47, 48, 49, 50, 51, 52, /* f8 - f15 */ - 53, 54, 55, 56, 57, 58, 59, 60, /* f16 - f23 */ - 61, 62, 63, 64, 65, 66, 67, 68, /* f24 - f31 */ - 2, -1, /* pc, vfp */ -}; - -#endif - -#ifdef __sparc64__ - -static char sigmap[125] = /* map reg to sigcontext */ -{ - -1 -}; -static char jmpmap[125] = { - -1 -}; - -#endif - -static void -freebsd_uthread_fetch_registers (int regno) -{ - struct cached_pthread *thread; - int active; - int first_regno, last_regno; - register_t *regbase; - char *regmap; - - if (freebsd_uthread_attaching || TIDGET(inferior_ptid) == 0) - { - child_ops.to_fetch_registers (regno); - return; - } - - thread = find_pthread (inferior_ptid); - active = (ptid_equal(inferior_ptid, find_active_ptid())); - - if (active) - { - child_ops.to_fetch_registers (regno); - return; - } - - if (regno == -1) - { - first_regno = 0; - last_regno = NUM_REGS - 1; - } - else - { - first_regno = regno; - last_regno = regno; - } - - regbase = (register_t*) &thread->ctx.jb[0]; - regmap = jmpmap; - - for (regno = first_regno; regno <= last_regno; regno++) - { - if (regmap[regno] == -1) - child_ops.to_fetch_registers (regno); - else - if (thread) - regcache_raw_supply (current_regcache, regno, (char*) ®base[regmap[regno]]); - else - regcache_raw_supply (current_regcache, regno, NULL); - } -} - -static void -freebsd_uthread_store_registers (int regno) -{ - struct cached_pthread *thread; - CORE_ADDR ptr; - int first_regno, last_regno; - u_int32_t *regbase; - char *regmap; - - if (freebsd_uthread_attaching) - { - child_ops.to_store_registers (regno); - return; - } - - thread = find_pthread (inferior_ptid); - - if (thread->state == PS_RUNNING_value) - { - child_ops.to_store_registers (regno); - return; - } - - if (regno == -1) - { - first_regno = 0; - last_regno = NUM_REGS - 1; - } - else - { - first_regno = regno; - last_regno = regno; - } - - regbase = (u_int32_t*) &thread->ctx.jb[0]; - regmap = jmpmap; - - ptr = find_pthread_addr (inferior_ptid); - for (regno = first_regno; regno <= last_regno; regno++) - { - if (regmap[regno] == -1) - child_ops.to_store_registers (regno); - else - { - u_int32_t *reg = ®base[regmap[regno]]; - int off; - - /* Hang onto cached value */ -/*DEO:XXX*/ - memcpy(reg, deprecated_registers /*regcache_collect ()*/+ DEPRECATED_REGISTER_BYTE (regno), - register_size (current_gdbarch, regno)); - - /* And push out to inferior */ - off = (char *) reg - (char *) thread; - write_memory (ptr + off, -/*DEO:XXX*/ - deprecated_registers /*regcache_collect ()*/+ DEPRECATED_REGISTER_BYTE (regno), - register_size (current_gdbarch, regno)); - } - } -} - -/* Get ready to modify the registers array. On machines which store - individual registers, this doesn't need to do anything. On machines - which store all the registers in one fell swoop, this makes sure - that registers contains all the registers from the program being - debugged. */ - -static void -freebsd_uthread_prepare_to_store (void) -{ - child_ops.to_prepare_to_store (); -} - -static int -freebsd_uthread_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, - int dowrite, struct mem_attrib *attrib, - struct target_ops *target) -{ - return child_ops.to_xfer_memory (memaddr, myaddr, len, dowrite, - attrib, target); -} - -/* Print status information about what we're accessing. */ - -static void -freebsd_uthread_files_info (struct target_ops *ignore) -{ - child_ops.to_files_info (ignore); -} - -static void -freebsd_uthread_kill_inferior (void) -{ - child_ops.to_kill (); -} - -static void -freebsd_uthread_notice_signals (ptid_t ptid) -{ - child_ops.to_notice_signals (ptid); -} - -/* Fork an inferior process, and start debugging it with /proc. */ - -static void -freebsd_uthread_create_inferior (char *exec_file, char *allargs, char **env, - int from_tty) -{ - child_ops.to_create_inferior (exec_file, allargs, env, from_tty); - - if (PIDGET(inferior_ptid) && freebsd_uthread_active) - { - read_thread_offsets (); - push_target (&freebsd_uthread_ops); - inferior_ptid = find_active_ptid (); - add_thread (inferior_ptid); - } -} - -/* This routine is called to find out if the inferior is using threads. - We check for the _thread_run and _thread_list globals. */ - -void -freebsd_uthread_new_objfile (struct objfile *objfile) -{ - struct minimal_symbol *ms; - - if (!objfile) - { - freebsd_uthread_active = 0; - return; - } - - ms = lookup_minimal_symbol ("_thread_run", NULL, objfile); - - if (!ms) - return; - - P_thread_run = SYMBOL_VALUE_ADDRESS (ms); - - ms = lookup_minimal_symbol ("_thread_list", NULL, objfile); - - if (!ms) - return; - - P_thread_list = SYMBOL_VALUE_ADDRESS (ms); - -#define OFFSET_SYM(field) "_thread_" #field "_offset" -#define LOOKUP_OFFSET(field) \ - do { \ - ms = lookup_minimal_symbol (OFFSET_SYM(field), NULL, objfile); \ - if (!ms) \ - return; \ - P_thread_##field##_offset = SYMBOL_VALUE_ADDRESS (ms); \ - } while (0); - -#define VALUE_SYM(name) "_thread_" #name "_value" -#define LOOKUP_VALUE(name) \ - do { \ - ms = lookup_minimal_symbol (VALUE_SYM(name), NULL, objfile); \ - if (!ms) \ - return; \ - P_thread_##name##_value = SYMBOL_VALUE_ADDRESS (ms); \ - } while (0); - - LOOKUP_OFFSET(next); - LOOKUP_OFFSET(uniqueid); - LOOKUP_OFFSET(state); - LOOKUP_OFFSET(name); - LOOKUP_OFFSET(ctx); - - LOOKUP_VALUE(PS_RUNNING); - LOOKUP_VALUE(PS_DEAD); - - freebsd_uthread_active = 1; -} - -/* Clean up after the inferior dies. */ - -static void -freebsd_uthread_mourn_inferior () -{ - child_ops.to_mourn_inferior (); - unpush_target (&freebsd_uthread_ops); -} - -/* Mark our target-struct as eligible for stray "run" and "attach" commands. */ - -static int -freebsd_uthread_can_run () -{ - return child_suppress_run; -} - -static int -freebsd_uthread_thread_alive (ptid_t ptid) -{ - struct cached_pthread *thread; - int ret = 0; - - if (freebsd_uthread_attaching) - return 1; - - /* - * We can get called from child_ops.to_wait() which passes the underlying - * pid (without a thread number). - */ - if (TIDGET(ptid) == 0) - return 1; - - if (find_pthread_addr (ptid) != 0) - { - thread = find_pthread (ptid); - ret = (thread->state != PS_DEAD_value); - } - - if (!ret) - free_ptid(ptid); - - return ret; -} - -static void -freebsd_uthread_stop (void) -{ - child_ops.to_stop (); -} - -static void -freebsd_uthread_find_new_threads (void) -{ - CORE_ADDR ptr; - int state; - u_int64_t uniqueid; - - read_memory ((CORE_ADDR)P_thread_list, - (char *)&ptr, - sizeof ptr); - - while (ptr != 0) - { - READ_FIELD(ptr, int, state, state); - READ_FIELD(ptr, u_int64_t, uniqueid, uniqueid); - if (state != PS_DEAD_value && - !in_thread_list (find_ptid(uniqueid))) - add_thread (find_ptid(uniqueid)); - ptr = read_pthread_next(ptr); - } -} - -/* MUST MATCH enum pthread_state */ -static const char *statenames[] = { - "RUNNING", - "SIGTHREAD", - "MUTEX_WAIT", - "COND_WAIT", - "FDLR_WAIT", - "FDLW_WAIT", - "FDR_WAIT", - "FDW_WAIT", - "POLL_WAIT", - "FILE_WAIT", - "SELECT_WAIT", - "SLEEP_WAIT", - "WAIT_WAIT", - "SIGSUSPEND", - "SIGWAIT", - "SPINBLOCK", - "JOIN", - "SUSPENDED", - "DEAD", - "DEADLOCK", -}; - -#if 0 - -static int -freebsd_uthread_get_thread_info (ref, selection, info) - gdb_threadref *ref; - int selection; - struct gdb_ext_thread_info *info; -{ - int pid = *ref; - struct cached_pthread *thread = find_pthread (pid); - struct cleanup *old_chain; - - old_chain = save_inferior_pid (); - inferior_pid = main_pid; - - memset(&info->threadid, 0, OPAQUETHREADBYTES); - - memcpy(&info->threadid, ref, sizeof *ref); - info->active = thread->state == PS_RUNNING_value; - strcpy(info->display, statenames[thread->state]); - if (thread->name) - read_memory ((CORE_ADDR) thread->name, info->shortname, 32); - else - strcpy(info->shortname, ""); - - do_cleanups (old_chain); - return (0); -} - -#endif - -char * -freebsd_uthread_pid_to_str (ptid_t ptid) -{ - static char buf[30]; - - if (DEPRECATED_STREQ (current_target.to_shortname, "freebsd-uthreads")) - sprintf (buf, "Process %d, Thread %ld", - PIDGET(ptid), TIDGET(ptid)); - else - sprintf (buf, "Process %d", PIDGET(ptid)); - - return buf; -} - - -static void -init_freebsd_uthread_ops () -{ - freebsd_uthread_ops.to_shortname = "freebsd-uthreads"; - freebsd_uthread_ops.to_longname = "FreeBSD uthreads"; - freebsd_uthread_ops.to_doc = "FreeBSD user threads support."; - freebsd_uthread_ops.to_open = freebsd_uthread_open; - freebsd_uthread_ops.to_attach = freebsd_uthread_attach; - freebsd_uthread_ops.to_post_attach = freebsd_uthread_post_attach; - freebsd_uthread_ops.to_detach = freebsd_uthread_detach; - freebsd_uthread_ops.to_resume = freebsd_uthread_resume; - freebsd_uthread_ops.to_wait = freebsd_uthread_wait; - freebsd_uthread_ops.to_fetch_registers = freebsd_uthread_fetch_registers; - freebsd_uthread_ops.to_store_registers = freebsd_uthread_store_registers; - freebsd_uthread_ops.to_prepare_to_store = freebsd_uthread_prepare_to_store; - freebsd_uthread_ops.to_xfer_memory = freebsd_uthread_xfer_memory; - freebsd_uthread_ops.to_files_info = freebsd_uthread_files_info; - freebsd_uthread_ops.to_insert_breakpoint = memory_insert_breakpoint; - freebsd_uthread_ops.to_remove_breakpoint = memory_remove_breakpoint; - freebsd_uthread_ops.to_terminal_init = terminal_init_inferior; - freebsd_uthread_ops.to_terminal_inferior = terminal_inferior; - freebsd_uthread_ops.to_terminal_ours_for_output = terminal_ours_for_output; - freebsd_uthread_ops.to_terminal_ours = terminal_ours; - freebsd_uthread_ops.to_terminal_info = child_terminal_info; - freebsd_uthread_ops.to_kill = freebsd_uthread_kill_inferior; - freebsd_uthread_ops.to_create_inferior = freebsd_uthread_create_inferior; - freebsd_uthread_ops.to_mourn_inferior = freebsd_uthread_mourn_inferior; - freebsd_uthread_ops.to_can_run = freebsd_uthread_can_run; - freebsd_uthread_ops.to_notice_signals = freebsd_uthread_notice_signals; - freebsd_uthread_ops.to_thread_alive = freebsd_uthread_thread_alive; - freebsd_uthread_ops.to_stop = freebsd_uthread_stop; - freebsd_uthread_ops.to_stratum = process_stratum; - freebsd_uthread_ops.to_has_all_memory = 1; - freebsd_uthread_ops.to_has_memory = 1; - freebsd_uthread_ops.to_has_stack = 1; - freebsd_uthread_ops.to_has_registers = 1; - freebsd_uthread_ops.to_has_execution = 1; - freebsd_uthread_ops.to_has_thread_control = 0; - freebsd_uthread_ops.to_magic = OPS_MAGIC; - freebsd_uthread_ops.to_find_new_threads = freebsd_uthread_find_new_threads; - freebsd_uthread_ops.to_pid_to_str = freebsd_uthread_pid_to_str; -#if 0 - freebsd_uthread_vec.get_thread_info = freebsd_uthread_get_thread_info; -#endif -} - -void -_initialize_freebsd_uthread () -{ - init_freebsd_uthread_ops (); - add_target (&freebsd_uthread_ops); - - target_new_objfile_chain = deprecated_target_new_objfile_hook; - deprecated_target_new_objfile_hook = freebsd_uthread_new_objfile; - - child_suppress_run = 1; -} diff --git a/devel/gdb66/files/kvm-fbsd-alpha.h b/devel/gdb66/files/kvm-fbsd-alpha.h deleted file mode 100644 index 4918912b6752..000000000000 --- a/devel/gdb66/files/kvm-fbsd-alpha.h +++ /dev/null @@ -1,81 +0,0 @@ -/* Kernel core dump functions below target vector, for GDB on FreeBSD/Alpha. - Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995 - Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ - -__FBSDID("$FreeBSD$"); - -#include "alpha/tm-alpha.h" -#include "alpha-tdep.h" - -#ifndef S0_REGNUM -#define S0_REGNUM (ALPHA_T7_REGNUM+1) -#endif - -static void -fetch_kcore_registers (struct pcb *pcbp) -{ - - /* First clear out any garbage. */ - memset (deprecated_registers, '\0', DEPRECATED_REGISTER_BYTES); - - /* SP */ - *(long *) &deprecated_registers[DEPRECATED_REGISTER_BYTE (SP_REGNUM)] = - pcbp->pcb_hw.apcb_ksp; - - /* S0 through S6 */ - memcpy (&deprecated_registers[DEPRECATED_REGISTER_BYTE (S0_REGNUM)], - &pcbp->pcb_context[0], 7 * sizeof (long)); - - /* PC */ - *(long *) &deprecated_registers[DEPRECATED_REGISTER_BYTE (PC_REGNUM)] = - pcbp->pcb_context[7]; - - deprecated_registers_fetched (); -} - - -#if __FreeBSD_version >= 500032 -CORE_ADDR -fbsd_kern_frame_saved_pc (struct frame_info *fi) -{ - struct minimal_symbol *sym; - CORE_ADDR this_saved_pc; - - this_saved_pc = DEPRECATED_FRAME_SAVED_PC(fi); - - sym = lookup_minimal_symbol_by_pc (this_saved_pc); - - if (sym != NULL && - (strcmp (DEPRECATED_SYMBOL_NAME (sym), "XentArith") == 0 || - strcmp (DEPRECATED_SYMBOL_NAME (sym), "XentIF") == 0 || - strcmp (DEPRECATED_SYMBOL_NAME (sym), "XentInt") == 0 || - strcmp (DEPRECATED_SYMBOL_NAME (sym), "XentMM") == 0 || - strcmp (DEPRECATED_SYMBOL_NAME (sym), "XentSys") == 0 || - strcmp (DEPRECATED_SYMBOL_NAME (sym), "XentUna") == 0 || - strcmp (DEPRECATED_SYMBOL_NAME (sym), "XentRestart") == 0)) - { - return (read_memory_integer (get_frame_base (fi) + 32 * 8, 8)); - } - else - { - return (this_saved_pc); - } -} -#endif // __FreeBSD_version >= 500032 diff --git a/devel/gdb66/files/kvm-fbsd-amd64.h b/devel/gdb66/files/kvm-fbsd-amd64.h deleted file mode 100644 index b6ee928543a6..000000000000 --- a/devel/gdb66/files/kvm-fbsd-amd64.h +++ /dev/null @@ -1,131 +0,0 @@ -/* Kernel core dump functions below target vector, for GDB on FreeBSD/AMD64. - Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995 - Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ - -__FBSDID("$FreeBSD$"); - -#include "amd64-tdep.h" - -static CORE_ADDR -ksym_maxuseraddr (void) -{ - static CORE_ADDR maxuseraddr; - struct minimal_symbol *sym; - - if (maxuseraddr == 0) - { - sym = lookup_minimal_symbol ("PTmap", NULL, NULL); - if (sym == NULL) { - maxuseraddr = VM_MAXUSER_ADDRESS; - } else { - maxuseraddr = SYMBOL_VALUE_ADDRESS (sym); - } - } - return maxuseraddr; -} - - -/* Symbol names of kernel entry points. Use special frames. */ -#define KSYM_TRAP "calltrap" -#define KSYM_INTR "Xintr" -#define KSYM_FASTINTR "Xfastintr" -#define KSYM_OLDSYSCALL "Xlcall_syscall" -#define KSYM_SYSCALL "Xint0x80_syscall" - -/* The following is FreeBSD-specific hackery to decode special frames - and elide the assembly-language stub. This could be made faster by - defining a frame_type field in the machine-dependent frame information, - but we don't think that's too important right now. */ -enum frametype { tf_normal, tf_trap, tf_interrupt, tf_syscall }; - -CORE_ADDR -fbsd_kern_frame_saved_pc (struct frame_info *fi) -{ - struct minimal_symbol *sym; - CORE_ADDR this_saved_pc; - enum frametype frametype; - - this_saved_pc = read_memory_integer (get_frame_base (fi) + 4, 4); - sym = lookup_minimal_symbol_by_pc (this_saved_pc); - frametype = tf_normal; - if (sym != NULL) - { - if (strcmp (DEPRECATED_SYMBOL_NAME (sym), KSYM_TRAP) == 0) - frametype = tf_trap; - else - if (strncmp (DEPRECATED_SYMBOL_NAME (sym), KSYM_INTR, - strlen (KSYM_INTR)) == 0 || strncmp (DEPRECATED_SYMBOL_NAME(sym), - KSYM_FASTINTR, strlen (KSYM_FASTINTR)) == 0) - frametype = tf_interrupt; - else - if (strcmp (DEPRECATED_SYMBOL_NAME (sym), KSYM_SYSCALL) == 0 || - strcmp (DEPRECATED_SYMBOL_NAME (sym), KSYM_OLDSYSCALL) == 0) - frametype = tf_syscall; - } - - switch (frametype) - { - default: - case tf_normal: - return (this_saved_pc); -#define oEIP offsetof (struct trapframe, tf_rip) - - case tf_trap: - return (read_memory_integer (get_frame_base (fi) + 8 + oEIP, 4)); - - case tf_interrupt: - return (read_memory_integer (get_frame_base (fi) + 12 + oEIP, 4)); - - case tf_syscall: - return (read_memory_integer (get_frame_base (fi) + 8 + oEIP, 4)); -#undef oEIP - } -} - -static void -fetch_kcore_registers (struct pcb *pcb) -{ - int i; - int noreg; - - /* Get the register values out of the sys pcb and store them where - `read_register' will find them. */ - /* - * XXX many registers aren't available. - * XXX for the non-core case, the registers are stale - they are for - * the last context switch to the debugger. - * XXX gcc's register numbers aren't all #defined in tm-amd64.h. - */ - noreg = 0; - for (i = 0; i < 3; ++i) /* eax,ecx,edx */ - regcache_raw_supply (current_regcache, i, (char *)&noreg); - - /* DEO:XXX use SP_REGNUM and PC_REGNUM -- this is GDB_MULTI_ARCH */ - regcache_raw_supply (current_regcache, 3, (char *) &pcb->pcb_rbx); - regcache_raw_supply (current_regcache, SP_REGNUM, (char *) &pcb->pcb_rsp); - regcache_raw_supply (current_regcache, AMD64_RBP_REGNUM, (char *) &pcb->pcb_rbp); - regcache_raw_supply (current_regcache, PC_REGNUM, (char *) &pcb->pcb_rip); - - for (i = 9; i < 14; ++i) /* rflags, cs, ss, ds, es, fs */ - regcache_raw_supply (current_regcache, i, (char *) &noreg); - regcache_raw_supply (current_regcache, 15, (char *) &pcb->pcb_gs); - - /* XXX 80387 registers? */ -} diff --git a/devel/gdb66/files/kvm-fbsd-i386.h b/devel/gdb66/files/kvm-fbsd-i386.h deleted file mode 100644 index e85fb1c695e2..000000000000 --- a/devel/gdb66/files/kvm-fbsd-i386.h +++ /dev/null @@ -1,136 +0,0 @@ -/* Kernel core dump functions below target vector, for GDB on FreeBSD/i386. - Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995 - Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ - -__FBSDID("$FreeBSD$"); - -#include <machine/frame.h> -#include "i386-tdep.h" - -static CORE_ADDR -ksym_maxuseraddr (void) -{ - static CORE_ADDR maxuseraddr; - struct minimal_symbol *sym; - - if (maxuseraddr == 0) - { - sym = lookup_minimal_symbol ("PTmap", NULL, NULL); - if (sym == NULL) { - maxuseraddr = VM_MAXUSER_ADDRESS; - } else { - maxuseraddr = SYMBOL_VALUE_ADDRESS (sym); - } - } - return maxuseraddr; -} - - -/* Symbol names of kernel entry points. Use special frames. */ -#define KSYM_TRAP "calltrap" -#define KSYM_INTR "Xintr" -#define KSYM_FASTINTR "Xfastintr" -#define KSYM_OLDSYSCALL "Xlcall_syscall" -#define KSYM_SYSCALL "Xint0x80_syscall" - -/* The following is FreeBSD-specific hackery to decode special frames - and elide the assembly-language stub. This could be made faster by - defining a frame_type field in the machine-dependent frame information, - but we don't think that's too important right now. */ -enum frametype { tf_normal, tf_trap, tf_interrupt, tf_syscall }; - -#if __FreeBSD_version >= 500032 -CORE_ADDR -fbsd_kern_frame_saved_pc (struct frame_info *fi) -{ - struct minimal_symbol *sym; - CORE_ADDR this_saved_pc; - enum frametype frametype; - - this_saved_pc = read_memory_integer (get_frame_base (fi) + 4, 4); - sym = lookup_minimal_symbol_by_pc (this_saved_pc); - frametype = tf_normal; - if (sym != NULL) - { - if (strcmp (DEPRECATED_SYMBOL_NAME (sym), KSYM_TRAP) == 0) - frametype = tf_trap; - else - if (strncmp (DEPRECATED_SYMBOL_NAME (sym), KSYM_INTR, - strlen (KSYM_INTR)) == 0 || strncmp (DEPRECATED_SYMBOL_NAME(sym), - KSYM_FASTINTR, strlen (KSYM_FASTINTR)) == 0) - frametype = tf_interrupt; - else - if (strcmp (DEPRECATED_SYMBOL_NAME (sym), KSYM_SYSCALL) == 0 || - strcmp (DEPRECATED_SYMBOL_NAME (sym), KSYM_OLDSYSCALL) == 0) - frametype = tf_syscall; - } - - switch (frametype) - { - default: - case tf_normal: - return (this_saved_pc); -#define oEIP offsetof (struct trapframe, tf_eip) - - case tf_trap: - return (read_memory_integer (get_frame_base (fi) + 8 + oEIP, 4)); - - case tf_interrupt: - return (read_memory_integer (get_frame_base (fi) + 12 + oEIP, 4)); - - case tf_syscall: - return (read_memory_integer (get_frame_base (fi) + 8 + oEIP, 4)); -#undef oEIP - } -} -#endif // __FreeBSD_version >= 500032 - -static void -fetch_kcore_registers (struct pcb *pcb) -{ - int i; - int noreg; - - /* Get the register values out of the sys pcb and store them where - `read_register' will find them. */ - /* - * XXX many registers aren't available. - * XXX for the non-core case, the registers are stale - they are for - * the last context switch to the debugger. - * XXX gcc's register numbers aren't all #defined in tm-i386.h. - */ - noreg = 0; - for (i = 0; i < 3; ++i) /* eax,ecx,edx */ - regcache_raw_supply (current_regcache, i, (char *)&noreg); - - /* DEO:XXX use SP_REGNUM and PC_REGNUM -- this is GDB_MULTI_ARCH */ - regcache_raw_supply (current_regcache, 3, (char *) &pcb->pcb_ebx); - regcache_raw_supply (current_regcache, SP_REGNUM, (char *) &pcb->pcb_esp); - regcache_raw_supply (current_regcache, I386_EBP_REGNUM, (char *) &pcb->pcb_ebp); - regcache_raw_supply (current_regcache, 6, (char *) &pcb->pcb_esi); - regcache_raw_supply (current_regcache, 7, (char *) &pcb->pcb_edi); - regcache_raw_supply (current_regcache, PC_REGNUM, (char *) &pcb->pcb_eip); - - for (i = 9; i < 14; ++i) /* eflags, cs, ss, ds, es, fs */ - regcache_raw_supply (current_regcache, i, (char *) &noreg); - regcache_raw_supply (current_regcache, 15, (char *) &pcb->pcb_gs); - - /* XXX 80387 registers? */ -} diff --git a/devel/gdb66/files/kvm-fbsd-sparc64.h b/devel/gdb66/files/kvm-fbsd-sparc64.h deleted file mode 100644 index 48c4be4fc32d..000000000000 --- a/devel/gdb66/files/kvm-fbsd-sparc64.h +++ /dev/null @@ -1,98 +0,0 @@ -/* Kernel core dump functions below target vector, for GDB on FreeBSD/sparc64. - Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995 - Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ - -__FBSDID("$FreeBSD$"); - -#include "sparc-tdep.h" - -#define SPARC_INTREG_SIZE 8 - -static void -fetch_kcore_registers (struct pcb *pcbp) -{ - static struct frame top; - CORE_ADDR f_addr; - int i; - - /* Get the register values out of the sys pcb and store them where - `read_register' will find them. */ - /* - * XXX many registers aren't available. - * XXX for the non-core case, the registers are stale - they are for - * the last context switch to the debugger. - * XXX do something with the floating-point registers? - */ - regcache_raw_supply (current_regcache, SP_REGNUM, &pcbp->pcb_sp); - regcache_raw_supply (current_regcache, PC_REGNUM, &pcbp->pcb_pc); - f_addr = extract_unsigned_integer (&pcbp->pcb_sp, SPARC_INTREG_SIZE); - /* Load the previous frame by hand (XXX) and supply it. */ - read_memory (f_addr + SPOFF, (char *)&top, sizeof (top)); - for (i = 0; i < 8; i++) - regcache_raw_supply (current_regcache, i + SPARC_L0_REGNUM, &top.fr_local[i]); - for (i = 0; i < 8; i++) - regcache_raw_supply (current_regcache, i + SPARC_I0_REGNUM, &top.fr_in[i]); -} - -CORE_ADDR -fbsd_kern_frame_saved_pc (struct frame_info *fi) -{ - struct minimal_symbol *sym; - CORE_ADDR frame, pc_addr, pc; - char *buf; - - buf = alloca (MAX_REGISTER_SIZE); //or use DEPRECATED_MAX_REGISTER_RAW_SIZE - /* XXX: duplicates fi->extra_info->bottom. */ - frame = (get_next_frame (fi) != NULL) ? get_frame_base (get_next_frame (fi)) : read_sp (); - pc_addr = frame + offsetof (struct frame, fr_in[7]); - -#define READ_PC(pc, a, b) do { \ - read_memory (a, b, SPARC_INTREG_SIZE); \ - pc = extract_unsigned_integer (b, SPARC_INTREG_SIZE); \ -} while (0) - - READ_PC (pc, pc_addr, buf); - - sym = lookup_minimal_symbol_by_pc (pc); - if (sym != NULL) - { - if (strncmp (DEPRECATED_SYMBOL_NAME (sym), "tl0_", 4) == 0 || - strcmp (DEPRECATED_SYMBOL_NAME (sym), "btext") == 0 || - strcmp (DEPRECATED_SYMBOL_NAME (sym), "mp_startup") == 0 || - strcmp (DEPRECATED_SYMBOL_NAME (sym), "fork_trampoline") == 0) - { - /* - * Ugly kluge: user space addresses aren't separated from kernel - * ones by range; if encountering a trap from user space, just - * return a 0 to stop the trace. - * Do the same for entry points of kernel processes to avoid - * printing garbage. - */ - pc = 0; - } - if (strncmp (DEPRECATED_SYMBOL_NAME (sym), "tl1_", 4) == 0) - { - pc_addr = get_frame_base (fi) + sizeof (struct frame) + - offsetof (struct trapframe, tf_tpc); - READ_PC (pc, pc_addr, buf); - } - } - return (pc); -} diff --git a/devel/gdb66/files/kvm-fbsd.c b/devel/gdb66/files/kvm-fbsd.c deleted file mode 100644 index c4899e66907f..000000000000 --- a/devel/gdb66/files/kvm-fbsd.c +++ /dev/null @@ -1,523 +0,0 @@ -/* Kernel core dump functions below target vector, for GDB. - Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995 - Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -/* - * This works like "remote" but, you use it like this: - * target kcore /dev/mem - * or - * target kcore /var/crash/host/core.0 - * - * This way makes it easy to short-circut the whole bfd monster, - * and direct the inferior stuff to our libkvm implementation. - * - */ - -#include <sys/param.h> -#include <sys/user.h> -#include <machine/frame.h> -//#include <sys/proc.h> -//#include <sys/sysctl.h> -//#include <sys/time.h> -//#include <sys/user.h> - -#include <ctype.h> -//#include <errno.h> -//#include <signal.h> -#include <fcntl.h> -#include <kvm.h> -#include <sys/sysctl.h> -#include <paths.h> - -#include "defs.h" -#include "gdb_string.h" -#include "frame.h" /* required by inferior.h */ -#include "inferior.h" -//#include "symtab.h" -#include "symfile.h" -#include "objfiles.h" -#include "command.h" -#include "bfd.h" -//#include "target.h" -#include "gdbcore.h" -#include "solist.h" -#include "regcache.h" -#include <readline/tilde.h> - -#include "kvm-fbsd.h" - -#if __FreeBSD_version >= 500032 -static void -kcore_files_info (struct target_ops *); - -static void -kcore_close (int); - -static void -get_kcore_registers (int); - - - /* -static int -xfer_mem (CORE_ADDR, char *, int, int, struct mem_attrib *, - struct target_ops *); - */ - -static int -xfer_umem (CORE_ADDR, char *, int, int); - -static char *core_file; -static kvm_t *core_kd; -static struct pcb cur_pcb; -static struct kinfo_proc *cur_proc; - -static struct target_ops kcore_ops; - -int kernel_debugging; -int kernel_writablecore; - -/* Read the "thing" at kernel address 'addr' into the space pointed to - by point. The length of the "thing" is determined by the type of p. - Result is non-zero if transfer fails. */ - -#define kvread(addr, p) \ - (target_read_memory ((CORE_ADDR) (addr), (char *) (p), sizeof (*(p)))) - -static CORE_ADDR -ksym_kernbase (void) -{ - static CORE_ADDR kernbase; - struct minimal_symbol *sym; - - if (kernbase == 0) - { - sym = lookup_minimal_symbol ("kernbase", NULL, NULL); - if (sym == NULL) { - kernbase = KERNBASE; - } else { - kernbase = SYMBOL_VALUE_ADDRESS (sym); - } - } - return kernbase; -} - -#define KERNOFF (ksym_kernbase ()) -#define INKERNEL(x) ((x) >= KERNOFF) - -CORE_ADDR -ksym_lookup(const char *name) -{ - struct minimal_symbol *sym; - - sym = lookup_minimal_symbol (name, NULL, NULL); - if (sym == NULL) - error ("kernel symbol `%s' not found.", name); - - return SYMBOL_VALUE_ADDRESS (sym); -} - -/* Provide the address of an initial PCB to use. - If this is a crash dump, try for "dumppcb". - If no "dumppcb" or it's /dev/mem, use proc0. - Return the core address of the PCB we found. */ - -static CORE_ADDR -initial_pcb (void) -{ - struct minimal_symbol *sym; - CORE_ADDR addr; - void *val; - - /* Make sure things are open... */ - if (!core_kd || !core_file) - return (0); - - /* If this is NOT /dev/mem try for dumppcb. */ - if (strncmp (core_file, _PATH_DEV, sizeof _PATH_DEV - 1)) - { - sym = lookup_minimal_symbol ("dumppcb", NULL, NULL); - if (sym != NULL) - { - addr = SYMBOL_VALUE_ADDRESS (sym); - return (addr); - } - } - - /* OK, just use thread0's pcb. Note that curproc might - not exist, and if it does, it will point to gdb. - Therefore, just use proc0 and let the user set - some other context if they care about it. */ - - addr = ksym_lookup ("thread0"); - if (kvread (addr, &val)) - { - error ("cannot read thread0 pointer at %lx\n", addr); - val = 0; - } - else - { - /* Read the PCB address in thread structure. */ - addr += offsetof (struct thread, td_pcb); - if (kvread (addr, &val)) - { - error ("cannot read thread0->td_pcb pointer at %lx\n", addr); - val = 0; - } - } - - /* thread0 is wholly in the kernel and cur_proc is only used for - reading user mem, so no point in setting this up. */ - cur_proc = 0; - - return ((CORE_ADDR)val); -} - -/* Set the current context to that of the PCB struct at the system address - passed. */ - -static int -set_context (CORE_ADDR addr) -{ - CORE_ADDR procaddr = 0; - - if (kvread (addr, &cur_pcb)) - error ("cannot read pcb at %#lx", addr); - - /* Fetch all registers from core file. */ - target_fetch_registers (-1); - - /* Now, set up the frame cache, and print the top of stack. */ - flush_cached_frames (); -/*DEO XXX - set_current_frame (create_new_frame (read_fp (), read_pc ())); - set_current_frame (create_new_frame (deprecated_read_fp (), read_pc ())); - select_frame (get_current_frame ()); -*/ - print_stack_frame (get_selected_frame (), -1, 1); - return (0); -} - -/* Discard all vestiges of any previous core file and mark data and stack - spaces as empty. */ - -/* ARGSUSED */ -static void -kcore_close (int quitting) -{ - - inferior_ptid = null_ptid; /* Avoid confusion from thread stuff. */ - - if (core_kd) - { - kvm_close (core_kd); - free (core_file); - core_file = NULL; - core_kd = NULL; - } -} - -/* This routine opens and sets up the core file bfd. */ - -static void -kcore_open (char *filename /* the core file */, int from_tty) -{ - kvm_t *kd; - const char *p; - struct cleanup *old_chain; - char buf[256], *cp; - int ontop; - CORE_ADDR addr; - - target_preopen (from_tty); - - /* The exec file is required for symbols. */ - if (exec_bfd == NULL) - error ("No kernel exec file specified"); - - if (core_kd) - { - error ("No core file specified." - " (Use `detach' to stop debugging a core file.)"); - return; - } - - if (!filename) - { - error ("No core file specified."); - return; - } - - filename = tilde_expand (filename); - if (filename[0] != '/') - { - cp = concat (current_directory, "/", filename, NULL); - free (filename); - filename = cp; - } - - old_chain = make_cleanup (free, filename); - - kd = kvm_open (bfd_get_filename(exec_bfd), filename, NULL, - kernel_writablecore ? O_RDWR: O_RDONLY, 0); - if (kd == NULL) - { - perror_with_name (filename); - return; - } - - /* Looks semi-reasonable. Toss the old core file and work on the new. */ - - discard_cleanups (old_chain); /* Don't free filename any more. */ - core_file = filename; - unpush_target (&kcore_ops); - ontop = !push_target (&kcore_ops); - - /* Note unpush_target (above) calls kcore_close. */ - core_kd = kd; - - /* Print out the panic string if there is one. */ - if (kvread (ksym_lookup ("panicstr"), &addr) == 0 && - addr != 0 && - target_read_memory (addr, buf, sizeof(buf)) == 0) - { - - for (cp = buf; cp < &buf[sizeof(buf)] && *cp; cp++) - if (!isascii (*cp) || (!isprint (*cp) && !isspace (*cp))) - *cp = '?'; - *cp = '\0'; - if (buf[0] != '\0') - printf_filtered ("panic: %s\n", buf); - } - - /* Print all the panic messages if possible. */ - if (symfile_objfile != NULL) - { - printf ("panic messages:\n---\n"); - snprintf (buf, sizeof buf, - "/sbin/dmesg -N %s -M %s | \ - /usr/bin/awk '/^(panic:|Fatal trap) / { printing = 1 } \ - { if (printing) print $0 }'", - symfile_objfile->name, filename); - fflush (stdout); - system (buf); - printf ("---\n"); - } - - if (!ontop) - { - warning ("you won't be able to access this core file until you terminate\n" - "your %s; do ``info files''", target_longname); - return; - } - - /* Now, set up process context, and print the top of stack. */ - (void)set_context (initial_pcb()); - print_stack_frame (get_selected_frame (), - frame_relative_level (get_selected_frame ()), 1); -} - -static void -kcore_detach (char *args, int from_tty) -{ - if (args) - error ("Too many arguments"); - unpush_target (&kcore_ops); - reinit_frame_cache (); - if (from_tty) - printf_filtered ("No kernel core file now.\n"); -} - -/* Get the registers out of a core file. This is the machine- - independent part. Fetch_core_registers is the machine-dependent - part, typically implemented in the xm-file for each architecture. */ - -/* We just get all the registers, so we don't use regno. */ - -/* ARGSUSED */ -static void -get_kcore_registers (int regno) -{ - - /* XXX - Only read the pcb when set_context() is called. - When looking at a live kernel this may be a problem, - but the user can do another "proc" or "pcb" command to - grab a new copy of the pcb... */ - - /* Zero out register set then fill in the ones we know about. */ - fetch_kcore_registers (&cur_pcb); -} - -static void -kcore_files_info (t) - struct target_ops *t; -{ - printf_filtered ("\t`%s'\n", core_file); -} - -/* If mourn is being called in all the right places, this could be say - `gdb internal error' (since generic_mourn calls breakpoint_init_inferior). */ - - /* -static int -ignore (CORE_ADDR addr, char *contents) -{ - return 0; -} - */ - -static int -xfer_kmem (CORE_ADDR memaddr, char *myaddr, int len, int write, - struct mem_attrib *attrib, struct target_ops *target) -{ - int n; - - - if (!INKERNEL (memaddr)) - return xfer_umem (memaddr, myaddr, len, write); - - if (core_kd == NULL) - return 0; - - if (write) - n = kvm_write (core_kd, memaddr, myaddr, len); - else - n = kvm_read (core_kd, memaddr, myaddr, len) ; - if (n < 0) { - fprintf_unfiltered (gdb_stderr, "can not access 0x%lx, %s\n", - memaddr, kvm_geterr (core_kd)); - n = 0; - } - - return n; -} - - -static int -xfer_umem (CORE_ADDR memaddr, char *myaddr, int len, int write /* ignored */) -{ - int n = 0; - - if (cur_proc == 0) - { - error ("---Can't read userspace from dump, or kernel process---\n"); - return 0; - } - - if (write) - error ("kvm_uwrite unimplemented\n"); - else - n = kvm_uread (core_kd, cur_proc, memaddr, myaddr, len) ; - - if (n < 0) - return 0; - - return n; -} - -static void -set_proc_cmd (char *arg, int from_tty) -{ - CORE_ADDR addr, pid_addr, first_td; - void *val; - struct kinfo_proc *kp; - int cnt; - pid_t pid; - - if (!arg) - error_no_arg ("proc address for the new context"); - - if (core_kd == NULL) - error ("no kernel core file"); - - addr = (CORE_ADDR) parse_and_eval_address (arg); - - if (!INKERNEL (addr)) - { - kp = kvm_getprocs (core_kd, KERN_PROC_PID, addr, &cnt); - if (!cnt) - error ("invalid pid"); - addr = (CORE_ADDR)kp->ki_paddr; - cur_proc = kp; - } - else - { - /* Update cur_proc. */ - pid_addr = addr + offsetof (struct proc, p_pid); - if (kvread (pid_addr, &pid)) - error ("cannot read pid ptr"); - cur_proc = kvm_getprocs (core_kd, KERN_PROC_PID, pid, &cnt); - if (!cnt) - error("invalid pid"); - } - - /* Find the first thread in the process. XXXKSE */ - addr += offsetof (struct proc, p_threads.tqh_first); - if (kvread (addr, &first_td)) - error ("cannot read thread ptr"); - - /* Read the PCB address in thread structure. */ - addr = first_td + offsetof (struct thread, td_pcb); - if (kvread (addr, &val)) - error("cannot read pcb ptr"); - - /* Read the PCB address in proc structure. */ - if (set_context ((CORE_ADDR) val)) - error ("invalid proc address"); -} -#else -int kernel_debugging = 0; -int kernel_writablecore = 0; - -CORE_ADDR -fbsd_kern_frame_saved_pc (struct frame_info *fi) -{ - return 0; -} -#endif - -void -_initialize_kcorelow (void) -{ -#if __FreeBSD_version >= 500032 - kcore_ops.to_shortname = "kcore"; - kcore_ops.to_longname = "Kernel core dump file"; - kcore_ops.to_doc = - "Use a core file as a target. Specify the filename of the core file."; - kcore_ops.to_open = kcore_open; - kcore_ops.to_close = kcore_close; - kcore_ops.to_attach = find_default_attach; - kcore_ops.to_detach = kcore_detach; - kcore_ops.to_fetch_registers = get_kcore_registers; - kcore_ops.to_xfer_memory = xfer_kmem; - kcore_ops.to_files_info = kcore_files_info; - kcore_ops.to_create_inferior = find_default_create_inferior; - kcore_ops.to_stratum = kcore_stratum; - kcore_ops.to_has_memory = 1; - kcore_ops.to_has_stack = 1; - kcore_ops.to_has_registers = 1; - kcore_ops.to_magic = OPS_MAGIC; - - add_target (&kcore_ops); - add_com ("proc", class_obscure, set_proc_cmd, "Set current process context"); -#endif -} diff --git a/devel/gdb66/files/nm-fbsd.h b/devel/gdb66/files/nm-fbsd.h deleted file mode 100644 index b0d784f77c00..000000000000 --- a/devel/gdb66/files/nm-fbsd.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef CONFIG_NM_FBSD_H -#define CONFIG_NM_FBSD_H - -/* $FreeBSD$ */ - -#ifdef HAVE_SYS_PARAM_H -#include <sys/param.h> -#endif - -extern int kernel_debugging; -extern int kernel_writablecore; - -CORE_ADDR fbsd_kern_frame_saved_pc(struct frame_info *frame); - -#if __FreeBSD_version >= 500032 -#define KGDB 1 -#define ADDITIONAL_OPTIONS \ - {"kernel", no_argument, &kernel_debugging, 1}, \ - {"k", no_argument, &kernel_debugging, 1}, \ - {"wcore", no_argument, &kernel_writablecore, 1}, \ - {"w", no_argument, &kernel_writablecore, 1}, - -#define ADDITIONAL_OPTION_HELP \ - "\ - --kernel Enable kernel debugging.\n\ - --wcore Make core file writable (only works for /dev/mem).\n\ - This option only works while debugging a kernel !!\n\ -" - -#define DEFAULT_PROMPT kernel_debugging?"(kgdb) ":"(gdb) " - -/* misuse START_PROGRESS to test whether we're running as kgdb */ -/* START_PROGRESS is called at the top of main */ -#undef START_PROGRESS -#define START_PROGRESS(STR,N) \ - if (!strcmp (STR, "kgdb")) \ - kernel_debugging = 1; -#endif -#endif /* CONFIG_NM_FBSD_H */ diff --git a/devel/gdb66/files/patch-Makefile.in b/devel/gdb66/files/patch-Makefile.in deleted file mode 100644 index 33ed469d5ff3..000000000000 --- a/devel/gdb66/files/patch-Makefile.in +++ /dev/null @@ -1,11 +0,0 @@ ---- gdb/Makefile.in.orig Fri Oct 17 14:44:26 2003 -+++ gdb/Makefile.in Thu Jan 15 11:41:06 2004 -@@ -119,4 +119,4 @@ --READLINE_DIR = ../readline --READLINE = $(READLINE_DIR)/libreadline.a --READLINE_SRC = $(srcdir)/$(READLINE_DIR) --READLINE_CFLAGS = -I$(READLINE_SRC)/.. -+#READLINE_DIR = ../readline -+READLINE = -lreadline -+#READLINE_SRC = $(srcdir)/$(READLINE_DIR) -+#READLINE_CFLAGS = -I$(READLINE_SRC)/.. diff --git a/devel/gdb66/files/patch-amd64-tdep.c b/devel/gdb66/files/patch-amd64-tdep.c deleted file mode 100644 index 88305cc9a1cf..000000000000 --- a/devel/gdb66/files/patch-amd64-tdep.c +++ /dev/null @@ -1,15 +0,0 @@ ---- gdb/amd64-tdep.c.orig Fri Apr 9 16:24:05 2004 -+++ gdb/amd64-tdep.c Wed May 5 10:56:22 2004 -@@ -126,6 +126,12 @@ - #define AMD64_NUM_REGS \ - (sizeof (amd64_register_info) / sizeof (amd64_register_info[0])) - -+int -+amd64_num_regs(void) -+{ -+ return AMD64_NUM_REGS; -+} -+ - /* Return the name of register REGNUM. */ - - static const char * diff --git a/devel/gdb66/files/patch-amd64-tdep.h b/devel/gdb66/files/patch-amd64-tdep.h deleted file mode 100644 index 2ad017060331..000000000000 --- a/devel/gdb66/files/patch-amd64-tdep.h +++ /dev/null @@ -1,16 +0,0 @@ ---- gdb/amd64-tdep.h.orig Wed May 5 10:48:28 2004 -+++ gdb/amd64-tdep.h Wed May 5 11:02:33 2004 -@@ -59,6 +59,13 @@ - /* Number of general purpose registers. */ - #define AMD64_NUM_GREGS 24 - -+#define AMD64_NUM_FREGS 16 -+#define AMD64_NUM_XREGS 17 -+#define AMD64_NUM_REGS_TOTAL (AMD64_NUM_GREGS + AMD64_NUM_FREGS \ -+ + AMD64_NUM_XREGS) -+ -+extern int amd64_num_regs (void); -+ - extern void amd64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch); - - /* Fill register REGNUM in REGCACHE with the appropriate diff --git a/devel/gdb66/files/patch-config_alpha_fbsd.mh b/devel/gdb66/files/patch-config_alpha_fbsd.mh deleted file mode 100644 index 5d5df6b89105..000000000000 --- a/devel/gdb66/files/patch-config_alpha_fbsd.mh +++ /dev/null @@ -1,10 +0,0 @@ ---- gdb/config/alpha/fbsd.mh Sat Jan 19 17:12:50 2002 -+++ gdb/config/alpha/fbsd.mh Sun Oct 13 12:22:36 2002 -@@ -1,5 +1,6 @@ - # Host: FreeBSD/Alpha - NATDEPFILES= fork-child.o infptrace.o inftarg.o \ - solib.o solib-svr4.o solib-legacy.o \ -- corelow.o core-regset.o alphabsd-nat.o -+ corelow.o core-regset.o alphabsd-nat.o freebsd-uthread.o kvm-fbsd.o - NAT_FILE= nm-fbsd.h -+NAT_CLIBS= -lkvm diff --git a/devel/gdb66/files/patch-config_alpha_nm-fbsd.h b/devel/gdb66/files/patch-config_alpha_nm-fbsd.h deleted file mode 100644 index 2f7e710248ab..000000000000 --- a/devel/gdb66/files/patch-config_alpha_nm-fbsd.h +++ /dev/null @@ -1,10 +0,0 @@ ---- gdb/config/alpha/nm-fbsd.h.orig Sat Mar 13 05:07:19 2004 -+++ gdb/config/alpha/nm-fbsd.h Sat Apr 10 00:49:21 2004 -@@ -25,6 +25,7 @@ - - /* Get generic BSD native definitions. */ - #include "config/nm-bsd.h" -+#include "config/nm-fbsd.h" - - /* The Alpha does not step over a breakpoint. */ - #define CANNOT_STEP_BREAKPOINT 1 diff --git a/devel/gdb66/files/patch-config_i386_fbsd.mh b/devel/gdb66/files/patch-config_i386_fbsd.mh deleted file mode 100644 index 2215bd724dfe..000000000000 --- a/devel/gdb66/files/patch-config_i386_fbsd.mh +++ /dev/null @@ -1,10 +0,0 @@ ---- gdb/config/i386/fbsd.mh.orig Sun Feb 22 08:20:22 2004 -+++ gdb/config/i386/fbsd.mh Sat Apr 10 01:00:26 2004 -@@ -3,3 +3,7 @@ - i386-nat.o i386bsd-nat.o i386fbsd-nat.o gcore.o fbsd-proc.o - NAT_FILE= nm-fbsd.h - XM_FILE= xm-i386.h -+ -+# kgdb support -+NATDEPFILES+= kvm-fbsd.o freebsd-uthread.o -+NAT_CLIBS= -lkvm diff --git a/devel/gdb66/files/patch-config_i386_fbsd64.mh b/devel/gdb66/files/patch-config_i386_fbsd64.mh deleted file mode 100644 index ee00c31eb5a4..000000000000 --- a/devel/gdb66/files/patch-config_i386_fbsd64.mh +++ /dev/null @@ -1,10 +0,0 @@ ---- gdb/config/i386/fbsd64.mh.orig Sun Feb 22 08:20:22 2004 -+++ gdb/config/i386/fbsd64.mh Fri Apr 23 12:28:40 2004 -@@ -3,3 +3,7 @@ - amd64-nat.o amd64bsd-nat.o amd64fbsd-nat.o gcore.o fbsd-proc.o - NAT_FILE= nm-fbsd64.h - XM_FILE= xm-i386.h -+ -+# kgdb support -+NATDEPFILES+= kvm-fbsd.o freebsd-uthread.o -+NAT_CLIBS= -lkvm diff --git a/devel/gdb66/files/patch-config_i386_nm-fbsd.h b/devel/gdb66/files/patch-config_i386_nm-fbsd.h deleted file mode 100644 index 781f06968469..000000000000 --- a/devel/gdb66/files/patch-config_i386_nm-fbsd.h +++ /dev/null @@ -1,12 +0,0 @@ ---- gdb/config/i386/nm-fbsd.h.orig Fri Jun 28 11:44:49 2002 -+++ gdb/config/i386/nm-fbsd.h Sun Jan 18 20:50:33 2004 -@@ -26,6 +26,9 @@ - #define I386_USE_GENERIC_WATCHPOINTS - #endif - -+/* Get generic FreeBSD native definitions. */ -+#include "config/nm-fbsd.h" -+ - #include "i386/nm-i386.h" - - #ifdef HAVE_SYS_PARAM_H diff --git a/devel/gdb66/files/patch-config_powerpc_fbsd.mh b/devel/gdb66/files/patch-config_powerpc_fbsd.mh deleted file mode 100644 index 51fda881a934..000000000000 --- a/devel/gdb66/files/patch-config_powerpc_fbsd.mh +++ /dev/null @@ -1,10 +0,0 @@ - -$FreeBSD: /tmp/pcvs/ports/devel/gdb66/files/Attic/patch-config_powerpc_fbsd.mh,v 1.1 2006-08-12 20:54:37 obrien Exp $ - ---- /dev/null -+++ gdb/config/powerpc/fbsd.mh -@@ -0,0 +1,4 @@ -+# Host: FreeBSD/PowerPC -+NATDEPFILES= fbsd-nat.o fork-child.o inf-ptrace.o ppcfbsd-nat.o bsd-kvm.o gcore.o -+ -+LOADLIBES= -lkvm diff --git a/devel/gdb66/files/patch-config_powerpc_fbsd.mt b/devel/gdb66/files/patch-config_powerpc_fbsd.mt deleted file mode 100644 index 019cdde98529..000000000000 --- a/devel/gdb66/files/patch-config_powerpc_fbsd.mt +++ /dev/null @@ -1,13 +0,0 @@ - -$FreeBSD: /tmp/pcvs/ports/devel/gdb66/files/Attic/patch-config_powerpc_fbsd.mt,v 1.1 2006-08-12 20:54:37 obrien Exp $ - ---- /dev/null -+++ gdb/config/powerpc/fbsd.mt -@@ -0,0 +1,7 @@ -+# Target: FreeBSD/PowerPC -+TDEPFILES= rs6000-tdep.o ppc-sysv-tdep.o ppcfbsd-tdep.o corelow.o \ -+ solib.o solib-svr4.o -+TM_FILE= tm-ppc-eabi.h -+ -+# SIM_OBS = remote-sim.o -+# SIM = ../sim/ppc/libsim.a diff --git a/devel/gdb66/files/patch-config_sparc_fbsd.mh b/devel/gdb66/files/patch-config_sparc_fbsd.mh deleted file mode 100644 index c9c6de6e4302..000000000000 --- a/devel/gdb66/files/patch-config_sparc_fbsd.mh +++ /dev/null @@ -1,12 +0,0 @@ ---- gdb/config/sparc/fbsd.mh.orig Tue Mar 12 19:20:24 2002 -+++ gdb/config/sparc/fbsd.mh Tue Jan 20 08:28:50 2004 -@@ -23,3 +23,9 @@ - corelow.o fork-child.o infptrace.o inftarg.o \ - solib.o solib-svr4.o solib-legacy.o - NAT_FILE= nm-fbsd.h -+ -+# kgdb support -+NATDEPFILES+= kvm-fbsd.o freebsd-uthread.o -+NAT_CLIBS= -lkvm -+# /proc support -+NATDEPFILES+= fbsd-proc.o # sparc-linux-nat.o diff --git a/devel/gdb66/files/patch-config_sparc_fbsd.mt b/devel/gdb66/files/patch-config_sparc_fbsd.mt deleted file mode 100644 index a76e2c5eea9e..000000000000 --- a/devel/gdb66/files/patch-config_sparc_fbsd.mt +++ /dev/null @@ -1,7 +0,0 @@ ---- gdb/config/sparc/fbsd.mt.orig Sat Jan 3 02:08:45 2004 -+++ gdb/config/sparc/fbsd.mt Sat Jan 24 20:10:22 2004 -@@ -1,3 +1,4 @@ - # Target: FreeBSD/sparc64 - TDEPFILES= sparc-tdep.o sparc64-tdep.o sparc64fbsd-tdep.o corelow.o -+###TDEPFILES+= sparcnbsd-tdep.o nbsd-tdep.o solib.o solib-svr4.o solib-legacy.o - TM_FILE= tm-fbsd.h diff --git a/devel/gdb66/files/patch-config_sparc_nm-fbsd.h b/devel/gdb66/files/patch-config_sparc_nm-fbsd.h deleted file mode 100644 index f5e005f122c9..000000000000 --- a/devel/gdb66/files/patch-config_sparc_nm-fbsd.h +++ /dev/null @@ -1,33 +0,0 @@ ---- gdb/config/sparc/nm-fbsd.h.orig Sat Mar 13 05:07:20 2004 -+++ gdb/config/sparc/nm-fbsd.h Sat Apr 10 01:06:19 2004 -@@ -24,9 +24,30 @@ - - /* Get generic BSD native definitions. */ - #include "config/nm-bsd.h" -+/* Get generic FreeBSD native definitions. */ -+#include "config/nm-fbsd.h" - - /* Shared library support. */ - - #include "solib.h" -+ -+/* Override child_pid_to_exec_file in 'inftarg.c'. */ -+#define CHILD_PID_TO_EXEC_FILE -+ -+/* FreeBSD has a /proc. */ -+#define USE_PROC_FS -+ -+/* DEO:XXX where did the rest of this file go vs 6.0.0.90 ?? */ -+ -+/* Solaris compatability. */ -+#define R_PC r_pc -+#define R_nPC r_npc -+#define R_Y r_y -+#define R_I7 /* ?? */ -+#define pr_fr fpu_fr -+#define pr_fsr fpu_fsr -+#define regp /* ?? */ -+#if 0 -+#endif - - #endif /* nm-fbsd.h */ diff --git a/devel/gdb66/files/patch-config_sparc_tm-fbsd.h b/devel/gdb66/files/patch-config_sparc_tm-fbsd.h deleted file mode 100644 index ccca90492338..000000000000 --- a/devel/gdb66/files/patch-config_sparc_tm-fbsd.h +++ /dev/null @@ -1,12 +0,0 @@ ---- gdb/config/sparc/tm-fbsd.h.orig Sat Jan 24 20:06:31 2004 -+++ gdb/config/sparc/tm-fbsd.h Sat Jan 24 20:07:02 2004 -@@ -24,4 +24,9 @@ - - #define GDB_MULTI_ARCH GDB_MULTI_ARCH_TM - -+#if 0 -+#define SVR4_SHARED_LIBS -+#include "sparc/tm-sp64.h" /* sets GDB_MULTI_ARCH */ -+#endif -+ - #endif /* tm-fbsd.h */ diff --git a/devel/gdb66/files/patch-configure.host b/devel/gdb66/files/patch-configure.host deleted file mode 100644 index 685c2bcb05d1..000000000000 --- a/devel/gdb66/files/patch-configure.host +++ /dev/null @@ -1,13 +0,0 @@ - -$FreeBSD: /tmp/pcvs/ports/devel/gdb66/files/Attic/patch-configure.host,v 1.1 2006-08-12 20:54:37 obrien Exp $ - ---- gdb/configure.host -+++ gdb/configure.host -@@ -106,6 +106,7 @@ - powerpc-*-aix4.[0-2]*) gdb_host=aix ;; - powerpc-*-aix4.3.[0-1]*) gdb_host=aix ;; - powerpc-*-aix*) gdb_host=aix432 ;; -+powerpc-*-freebsd*) gdb_host=fbsd;; - powerpc-*-linux*) gdb_host=linux ;; - powerpc-*-netbsd*) gdb_host=nbsd ;; - powerpc-*-openbsd*) gdb_host=obsd ;; diff --git a/devel/gdb66/files/patch-i386%nm-fbsd64.h b/devel/gdb66/files/patch-i386%nm-fbsd64.h deleted file mode 100644 index 03ec32aa92e0..000000000000 --- a/devel/gdb66/files/patch-i386%nm-fbsd64.h +++ /dev/null @@ -1,12 +0,0 @@ ---- gdb/config/i386/nm-fbsd64.h.orig Sat Mar 13 05:07:20 2004 -+++ gdb/config/i386/nm-fbsd64.h Wed May 5 11:20:14 2004 -@@ -25,6 +25,9 @@ - /* Get generic BSD native definitions. */ - #include "config/nm-bsd.h" - -+/* Get generic FreeBSD native definitions. */ -+#include "config/nm-fbsd.h" -+ - /* Override child_pid_to_exec_file in 'inftarg.c'. */ - #define CHILD_PID_TO_EXEC_FILE - diff --git a/devel/gdb66/files/patch-i386fbsd-tdep.c b/devel/gdb66/files/patch-i386fbsd-tdep.c deleted file mode 100644 index b6faa20b7249..000000000000 --- a/devel/gdb66/files/patch-i386fbsd-tdep.c +++ /dev/null @@ -1,11 +0,0 @@ ---- gdb/i386fbsd-tdep.c.orig Sun Apr 15 00:24:05 2007 -+++ gdb/i386fbsd-tdep.c Sun Apr 15 00:24:26 2007 -@@ -45,7 +45,7 @@ - CORE_ADDR i386fbsd_sigtramp_end_addr = 0xbfbfdff0; - - /* From <machine/signal.h>. */ --static int i386fbsd_sc_reg_offset[] = -+int i386fbsd_sc_reg_offset[] = - { - 8 + 14 * 4, /* %eax */ - 8 + 13 * 4, /* %ecx */ diff --git a/devel/gdb66/files/patch-main.c b/devel/gdb66/files/patch-main.c deleted file mode 100644 index bd5cd4645ddf..000000000000 --- a/devel/gdb66/files/patch-main.c +++ /dev/null @@ -1,53 +0,0 @@ ---- gdb/main.c.orig Thu Apr 15 22:40:39 2004 -+++ gdb/main.c Thu Apr 15 22:47:51 2004 -@@ -66,6 +66,12 @@ - /* Whether dbx commands will be handled */ - int dbx_commands = 0; - -+#ifdef KGDB -+/* Kernel debugging support. */ -+int kernel_debugging; -+int kernel_writablecore; -+#endif -+ - /* System root path, used to find libraries etc. */ - char *gdb_sysroot = 0; - -@@ -311,6 +317,12 @@ - {"statistics", no_argument, 0, OPT_STATISTICS}, - {"write", no_argument, &write_files, 1}, - {"args", no_argument, &set_args, 1}, -+#ifdef KGDB -+ {"kernel", no_argument, &kernel_debugging, 1}, -+ {"k", no_argument, &kernel_debugging, 1}, -+ {"wcore", no_argument, &kernel_writablecore, 1}, -+ {"w", no_argument, &kernel_writablecore, 1}, -+#endif - {0, no_argument, 0, 0} - }; - -@@ -857,6 +869,11 @@ - --interpreter=INTERP\n\ - Select a specific interpreter / user interface\n\ - "), stream); -+#ifdef KGDB -+ fputs_unfiltered (_("\ -+ --kernel Enable kernel debugging.\n\ -+"), stream); -+#endif - fputs_unfiltered (_("\ - --mapped Use mapped symbol files if supported on this system.\n\ - --nw Do not use a window interface.\n\ -@@ -874,6 +891,12 @@ - #if defined(TUI) - fputs_unfiltered (_("\ - --tui Use a terminal user interface.\n\ -+"), stream); -+#endif -+#ifdef KGDB -+ fputs_unfiltered (_("\ -+ --wcore Make core file writable (only works for /dev/mem).\n\ -+ This option only works while debugging a kernel !!\n\ - "), stream); - #endif - fputs_unfiltered (_("\ diff --git a/devel/gdb66/files/patch-ppcfbsd-nat.c b/devel/gdb66/files/patch-ppcfbsd-nat.c deleted file mode 100644 index d9b79fc1000a..000000000000 --- a/devel/gdb66/files/patch-ppcfbsd-nat.c +++ /dev/null @@ -1,196 +0,0 @@ - -$FreeBSD: /tmp/pcvs/ports/devel/gdb66/files/Attic/patch-ppcfbsd-nat.c,v 1.1 2006-08-12 20:54:37 obrien Exp $ - ---- /dev/null -+++ gdb/ppcfbsd-nat.c -@@ -0,0 +1,190 @@ -+/* Native-dependent code for PowerPC's running FreeBSD, for GDB. -+ Copyright 2002, 2004 Free Software Foundation, Inc. -+ Contributed by Wasabi Systems, Inc. -+ -+ This file is part of GDB. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 2 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program; if not, write to the Free Software -+ Foundation, Inc., 59 Temple Place - Suite 330, -+ Boston, MA 02111-1307, USA. */ -+ -+#include <sys/types.h> -+#include <sys/ptrace.h> -+#include <machine/reg.h> -+#include <machine/frame.h> -+#include <machine/pcb.h> -+ -+#include "defs.h" -+#include "inferior.h" -+#include "gdb_assert.h" -+#include "gdbcore.h" -+#include "regcache.h" -+#include "bsd-kvm.h" -+ -+#include "ppc-tdep.h" -+#include "ppcfbsd-tdep.h" -+ -+#include "inf-ptrace.h" -+ -+/* Returns true if PT_GETREGS fetches this register. */ -+static int -+getregs_supplies (int regno) -+{ -+ struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); -+ -+ return ((regno >= tdep->ppc_gp0_regnum -+ && regno < tdep->ppc_gp0_regnum + ppc_num_gprs) -+ || regno == tdep->ppc_lr_regnum -+ || regno == tdep->ppc_cr_regnum -+ || regno == tdep->ppc_xer_regnum -+ || regno == tdep->ppc_ctr_regnum -+ || regno == PC_REGNUM); -+} -+ -+/* Like above, but for PT_GETFPREGS. */ -+static int -+getfpregs_supplies (int regno) -+{ -+ struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); -+ -+ /* FIXME: jimb/2004-05-05: Some PPC variants don't have floating -+ point registers. Traditionally, GDB's register set has still -+ listed the floating point registers for such machines, so this -+ code is harmless. However, the new E500 port actually omits the -+ floating point registers entirely from the register set --- they -+ don't even have register numbers assigned to them. -+ -+ It's not clear to me how best to update this code, so this assert -+ will alert the first person to encounter the NetBSD/E500 -+ combination to the problem. */ -+ gdb_assert (ppc_floating_point_unit_p (current_gdbarch)); -+ -+ return ((regno >= tdep->ppc_fp0_regnum -+ && regno < tdep->ppc_fp0_regnum + ppc_num_fprs) -+ || regno == tdep->ppc_fpscr_regnum); -+} -+ -+static void -+ppcfbsd_fetch_inferior_registers (int regno) -+{ -+ if (regno == -1 || getregs_supplies (regno)) -+ { -+ struct reg regs; -+ -+ if (ptrace (PT_GETREGS, PIDGET (inferior_ptid), -+ (PTRACE_TYPE_ARG3) ®s, 0) == -1) -+ perror_with_name (_("Couldn't get registers")); -+ -+ ppcfbsd_supply_reg ((char *) ®s, regno); -+ if (regno != -1) -+ return; -+ } -+ -+ if (regno == -1 || getfpregs_supplies (regno)) -+ { -+ struct fpreg fpregs; -+ -+ if (ptrace (PT_GETFPREGS, PIDGET (inferior_ptid), -+ (PTRACE_TYPE_ARG3) &fpregs, 0) == -1) -+ perror_with_name (_("Couldn't get FP registers")); -+ -+ ppcfbsd_supply_fpreg ((char *) &fpregs, regno); -+ if (regno != -1) -+ return; -+ } -+} -+ -+static void -+ppcfbsd_store_inferior_registers (int regno) -+{ -+ if (regno == -1 || getregs_supplies (regno)) -+ { -+ struct reg regs; -+ -+ if (ptrace (PT_GETREGS, PIDGET (inferior_ptid), -+ (PTRACE_TYPE_ARG3) ®s, 0) == -1) -+ perror_with_name (_("Couldn't get registers")); -+ -+ ppcfbsd_fill_reg ((char *) ®s, regno); -+ -+ if (ptrace (PT_SETREGS, PIDGET (inferior_ptid), -+ (PTRACE_TYPE_ARG3) ®s, 0) == -1) -+ perror_with_name (_("Couldn't write registers")); -+ -+ if (regno != -1) -+ return; -+ } -+ -+ if (regno == -1 || getfpregs_supplies (regno)) -+ { -+ struct fpreg fpregs; -+ -+ if (ptrace (PT_GETFPREGS, PIDGET (inferior_ptid), -+ (PTRACE_TYPE_ARG3) &fpregs, 0) == -1) -+ perror_with_name (_("Couldn't get FP registers")); -+ -+ ppcfbsd_fill_fpreg ((char *) &fpregs, regno); -+ -+ if (ptrace (PT_SETFPREGS, PIDGET (inferior_ptid), -+ (PTRACE_TYPE_ARG3) &fpregs, 0) == -1) -+ perror_with_name (_("Couldn't set FP registers")); -+ } -+} -+ -+static int -+ppcfbsd_supply_pcb (struct regcache *regcache, struct pcb *pcb) -+{ -+ struct switchframe sf; -+ struct callframe cf; -+ struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); -+ int i; -+ -+ /* The stack pointer shouldn't be zero. */ -+ if (pcb->pcb_sp == 0) -+ return 0; -+ -+ read_memory (pcb->pcb_sp, (char *) &sf, sizeof sf); -+ regcache_raw_supply (regcache, tdep->ppc_cr_regnum, &sf.cr); -+ regcache_raw_supply (regcache, tdep->ppc_gp0_regnum + 2, &sf.fixreg2); -+ for (i = 0 ; i < 19 ; i++) -+ regcache_raw_supply (regcache, tdep->ppc_gp0_regnum + 13 + i, -+ &sf.fixreg[i]); -+ -+ read_memory(sf.sp, (char *)&cf, sizeof(cf)); -+ regcache_raw_supply (regcache, tdep->ppc_gp0_regnum + 30, &cf.cf_arg0); -+ regcache_raw_supply (regcache, tdep->ppc_gp0_regnum + 31, &cf.cf_func); -+ regcache_raw_supply (regcache, tdep->ppc_gp0_regnum + 1, &cf.cf_dummy_fp); -+ -+ read_memory(cf.cf_dummy_fp, (char *)&cf, sizeof(cf)); -+ regcache_raw_supply (regcache, tdep->ppc_lr_regnum, &cf.cf_lr); -+ regcache_raw_supply (regcache, PC_REGNUM, &cf.cf_lr); -+ -+ return 1; -+} -+ -+/* Provide a prototype to silence -Wmissing-prototypes. */ -+void _initialize_ppcfbsd_nat (void); -+ -+void -+_initialize_ppcfbsd_nat (void) -+{ -+ struct target_ops *t; -+ /* Support debugging kernel virtual memory images. */ -+ bsd_kvm_add_target (ppcfbsd_supply_pcb); -+ /* Add in local overrides. */ -+ t = inf_ptrace_target (); -+ t->to_fetch_registers = ppcfbsd_fetch_inferior_registers; -+ t->to_store_registers = ppcfbsd_store_inferior_registers; -+ add_target (t); -+} diff --git a/devel/gdb66/files/patch-ppcfbsd-tdep.c b/devel/gdb66/files/patch-ppcfbsd-tdep.c deleted file mode 100644 index aea014227c55..000000000000 --- a/devel/gdb66/files/patch-ppcfbsd-tdep.c +++ /dev/null @@ -1,347 +0,0 @@ - -$FreeBSD: /tmp/pcvs/ports/devel/gdb66/files/Attic/patch-ppcfbsd-tdep.c,v 1.1 2006-08-12 20:54:37 obrien Exp $ - ---- /dev/null -+++ gdb/ppcfbsd-tdep.c -@@ -0,0 +1,341 @@ -+/* Target-dependent code for PowerPC systems running FreeBSD. -+ -+ Copyright 2002, 2003, 2004 Free Software Foundation, Inc. -+ -+ Contributed by Wasabi Systems, Inc. -+ -+ This file is part of GDB. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 2 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program; if not, write to the Free Software -+ Foundation, Inc., 59 Temple Place - Suite 330, -+ Boston, MA 02111-1307, USA. */ -+ -+#include "defs.h" -+#include "gdbcore.h" -+#include "regcache.h" -+#include "target.h" -+#include "breakpoint.h" -+#include "value.h" -+#include "osabi.h" -+ -+#include "ppc-tdep.h" -+#include "ppcfbsd-tdep.h" -+//#include "fbsd-tdep.h" -+#include "tramp-frame.h" -+#include "trad-frame.h" -+#include "gdb_assert.h" -+#include "solib-svr4.h" -+ -+#define REG_FIXREG_OFFSET(x) ((x) * 4) -+#define REG_LR_OFFSET (32 * 4) -+#define REG_CR_OFFSET (33 * 4) -+#define REG_XER_OFFSET (34 * 4) -+#define REG_CTR_OFFSET (35 * 4) -+#define REG_PC_OFFSET (36 * 4) -+#define SIZEOF_STRUCT_REG (37 * 4) -+ -+#define FPREG_FPR_OFFSET(x) ((x) * 8) -+#define FPREG_FPSCR_OFFSET (32 * 8) -+#define SIZEOF_STRUCT_FPREG (33 * 8) -+ -+void -+ppcfbsd_supply_reg (char *regs, int regno) -+{ -+ struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); -+ int i; -+ -+ for (i = 0; i < ppc_num_gprs; i++) -+ { -+ if (regno == tdep->ppc_gp0_regnum + i || regno == -1) -+ regcache_raw_supply (current_regcache, tdep->ppc_gp0_regnum + i, -+ regs + REG_FIXREG_OFFSET (i)); -+ } -+ -+ if (regno == tdep->ppc_lr_regnum || regno == -1) -+ regcache_raw_supply (current_regcache, tdep->ppc_lr_regnum, -+ regs + REG_LR_OFFSET); -+ -+ if (regno == tdep->ppc_cr_regnum || regno == -1) -+ regcache_raw_supply (current_regcache, tdep->ppc_cr_regnum, -+ regs + REG_CR_OFFSET); -+ -+ if (regno == tdep->ppc_xer_regnum || regno == -1) -+ regcache_raw_supply (current_regcache, tdep->ppc_xer_regnum, -+ regs + REG_XER_OFFSET); -+ -+ if (regno == tdep->ppc_ctr_regnum || regno == -1) -+ regcache_raw_supply (current_regcache, tdep->ppc_ctr_regnum, -+ regs + REG_CTR_OFFSET); -+ -+ if (regno == PC_REGNUM || regno == -1) -+ regcache_raw_supply (current_regcache, PC_REGNUM, -+ regs + REG_PC_OFFSET); -+} -+ -+void -+ppcfbsd_fill_reg (char *regs, int regno) -+{ -+ struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); -+ int i; -+ -+ for (i = 0; i < ppc_num_gprs; i++) -+ { -+ if (regno == tdep->ppc_gp0_regnum + i || regno == -1) -+ regcache_raw_collect (current_regcache, tdep->ppc_gp0_regnum + i, -+ regs + REG_FIXREG_OFFSET (i)); -+ } -+ -+ if (regno == tdep->ppc_lr_regnum || regno == -1) -+ regcache_raw_collect (current_regcache, tdep->ppc_lr_regnum, -+ regs + REG_LR_OFFSET); -+ -+ if (regno == tdep->ppc_cr_regnum || regno == -1) -+ regcache_raw_collect (current_regcache, tdep->ppc_cr_regnum, -+ regs + REG_CR_OFFSET); -+ -+ if (regno == tdep->ppc_xer_regnum || regno == -1) -+ regcache_raw_collect (current_regcache, tdep->ppc_xer_regnum, -+ regs + REG_XER_OFFSET); -+ -+ if (regno == tdep->ppc_ctr_regnum || regno == -1) -+ regcache_raw_collect (current_regcache, tdep->ppc_ctr_regnum, -+ regs + REG_CTR_OFFSET); -+ -+ if (regno == PC_REGNUM || regno == -1) -+ regcache_raw_collect (current_regcache, PC_REGNUM, regs + REG_PC_OFFSET); -+} -+ -+void -+ppcfbsd_supply_fpreg (char *fpregs, int regno) -+{ -+ struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); -+ int i; -+ -+ /* FIXME: jimb/2004-05-05: Some PPC variants don't have floating -+ point registers. Traditionally, GDB's register set has still -+ listed the floating point registers for such machines, so this -+ code is harmless. However, the new E500 port actually omits the -+ floating point registers entirely from the register set --- they -+ don't even have register numbers assigned to them. -+ -+ It's not clear to me how best to update this code, so this assert -+ will alert the first person to encounter the NetBSD/E500 -+ combination to the problem. */ -+ gdb_assert (ppc_floating_point_unit_p (current_gdbarch)); -+ -+ for (i = 0; i < ppc_num_fprs; i++) -+ { -+ if (regno == tdep->ppc_fp0_regnum + i || regno == -1) -+ regcache_raw_supply (current_regcache, tdep->ppc_fp0_regnum + i, -+ fpregs + FPREG_FPR_OFFSET (i)); -+ } -+ -+ if (regno == tdep->ppc_fpscr_regnum || regno == -1) -+ regcache_raw_supply (current_regcache, tdep->ppc_fpscr_regnum, -+ fpregs + FPREG_FPSCR_OFFSET); -+} -+ -+void -+ppcfbsd_fill_fpreg (char *fpregs, int regno) -+{ -+ struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); -+ int i; -+ -+ /* FIXME: jimb/2004-05-05: Some PPC variants don't have floating -+ point registers. Traditionally, GDB's register set has still -+ listed the floating point registers for such machines, so this -+ code is harmless. However, the new E500 port actually omits the -+ floating point registers entirely from the register set --- they -+ don't even have register numbers assigned to them. -+ -+ It's not clear to me how best to update this code, so this assert -+ will alert the first person to encounter the NetBSD/E500 -+ combination to the problem. */ -+ gdb_assert (ppc_floating_point_unit_p (current_gdbarch)); -+ -+ for (i = 0; i < ppc_num_fprs; i++) -+ { -+ if (regno == tdep->ppc_fp0_regnum + i || regno == -1) -+ regcache_raw_collect (current_regcache, tdep->ppc_fp0_regnum + i, -+ fpregs + FPREG_FPR_OFFSET (i)); -+ } -+ -+ if (regno == tdep->ppc_fpscr_regnum || regno == -1) -+ regcache_raw_collect (current_regcache, tdep->ppc_fpscr_regnum, -+ fpregs + FPREG_FPSCR_OFFSET); -+} -+ -+static void -+fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, int which, -+ CORE_ADDR ignore) -+{ -+ char *regs, *fpregs; -+ -+ /* We get everything from one section. */ -+ if (which != 0) -+ return; -+ -+ regs = core_reg_sect; -+ fpregs = core_reg_sect + SIZEOF_STRUCT_REG; -+ -+ /* Integer registers. */ -+ ppcfbsd_supply_reg (regs, -1); -+ -+ /* Floating point registers. */ -+ ppcfbsd_supply_fpreg (fpregs, -1); -+} -+ -+static void -+fetch_elfcore_registers (char *core_reg_sect, unsigned core_reg_size, int which, -+ CORE_ADDR ignore) -+{ -+ switch (which) -+ { -+ case 0: /* Integer registers. */ -+ if (core_reg_size != SIZEOF_STRUCT_REG) -+ warning (_("Wrong size register set in core file.")); -+ else -+ ppcfbsd_supply_reg (core_reg_sect, -1); -+ break; -+ -+ case 2: /* Floating point registers. */ -+ if (core_reg_size != SIZEOF_STRUCT_FPREG) -+ warning (_("Wrong size FP register set in core file.")); -+ else -+ ppcfbsd_supply_fpreg (core_reg_sect, -1); -+ break; -+ -+ default: -+ /* Don't know what kind of register request this is; just ignore it. */ -+ break; -+ } -+} -+ -+static struct core_fns ppcfbsd_core_fns = -+{ -+ bfd_target_unknown_flavour, /* core_flavour */ -+ default_check_format, /* check_format */ -+ default_core_sniffer, /* core_sniffer */ -+ fetch_core_registers, /* core_read_registers */ -+ NULL /* next */ -+}; -+ -+static struct core_fns ppcfbsd_elfcore_fns = -+{ -+ bfd_target_elf_flavour, /* core_flavour */ -+ default_check_format, /* check_format */ -+ default_core_sniffer, /* core_sniffer */ -+ fetch_elfcore_registers, /* core_read_registers */ -+ NULL /* next */ -+}; -+ -+/* NetBSD is confused. It appears that 1.5 was using the correct SVr4 -+ convention but, 1.6 switched to the below broken convention. For -+ the moment use the broken convention. Ulgh!. */ -+ -+static enum return_value_convention -+ppcfbsd_return_value (struct gdbarch *gdbarch, struct type *valtype, -+ struct regcache *regcache, void *readbuf, -+ const void *writebuf) -+{ -+ if ((TYPE_CODE (valtype) == TYPE_CODE_STRUCT -+ || TYPE_CODE (valtype) == TYPE_CODE_UNION) -+ && !((TYPE_LENGTH (valtype) == 16 || TYPE_LENGTH (valtype) == 8)) -+ && !(TYPE_LENGTH (valtype) == 1 -+ || TYPE_LENGTH (valtype) == 2 -+ || TYPE_LENGTH (valtype) == 4 -+ || TYPE_LENGTH (valtype) == 8)) -+ return RETURN_VALUE_STRUCT_CONVENTION; -+ else -+ return ppc_sysv_abi_broken_return_value (gdbarch, valtype, regcache, -+ readbuf, writebuf); -+} -+ -+static void -+ppcfbsd_sigtramp_cache_init (const struct tramp_frame *self, -+ struct frame_info *next_frame, -+ struct trad_frame_cache *this_cache, -+ CORE_ADDR func) -+{ -+ CORE_ADDR base; -+ CORE_ADDR offset; -+ int i; -+ struct gdbarch *gdbarch = get_frame_arch (next_frame); -+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); -+ -+ base = frame_unwind_register_unsigned (next_frame, SP_REGNUM); -+ offset = base + 0x18 + 2 * tdep->wordsize; -+ for (i = 0; i < ppc_num_gprs; i++) -+ { -+ int regnum = i + tdep->ppc_gp0_regnum; -+ trad_frame_set_reg_addr (this_cache, regnum, offset); -+ offset += tdep->wordsize; -+ } -+ trad_frame_set_reg_addr (this_cache, tdep->ppc_lr_regnum, offset); -+ offset += tdep->wordsize; -+ trad_frame_set_reg_addr (this_cache, tdep->ppc_cr_regnum, offset); -+ offset += tdep->wordsize; -+ trad_frame_set_reg_addr (this_cache, tdep->ppc_xer_regnum, offset); -+ offset += tdep->wordsize; -+ trad_frame_set_reg_addr (this_cache, tdep->ppc_ctr_regnum, offset); -+ offset += tdep->wordsize; -+ trad_frame_set_reg_addr (this_cache, PC_REGNUM, offset); /* SRR0? */ -+ offset += tdep->wordsize; -+ -+ /* Construct the frame ID using the function start. */ -+ trad_frame_set_id (this_cache, frame_id_build (base, func)); -+} -+ -+/* Given the NEXT frame, examine the instructions at and around this -+ frame's resume address (aka PC) to see of they look like a signal -+ trampoline. Return the address of the trampolines first -+ instruction, or zero if it isn't a signal trampoline. */ -+ -+static const struct tramp_frame ppcfbsd_sigtramp = { -+ SIGTRAMP_FRAME, -+ 4, /* insn size */ -+ { /* insn */ -+ { 0x38610018, -1 }, /* addi r3,r1,24 */ -+ { 0x38000127, -1 }, /* li r0,295 */ -+ { 0x44000002, -1 }, /* sc */ -+ { 0x38000001, -1 }, /* li r0,1 */ -+ { 0x44000002, -1 }, /* sc */ -+ { TRAMP_SENTINEL_INSN, -1 } -+ }, -+ ppcfbsd_sigtramp_cache_init -+}; -+ -+static void -+ppcfbsd_init_abi (struct gdbarch_info info, -+ struct gdbarch *gdbarch) -+{ -+ /* For NetBSD, this is an on again, off again thing. Some systems -+ do use the broken struct convention, and some don't. */ -+ set_gdbarch_return_value (gdbarch, ppcfbsd_return_value); -+ set_solib_svr4_fetch_link_map_offsets (gdbarch, -+ svr4_ilp32_fetch_link_map_offsets); -+ tramp_frame_prepend_unwinder (gdbarch, &ppcfbsd_sigtramp); -+} -+ -+void -+_initialize_ppcfbsd_tdep (void) -+{ -+ gdbarch_register_osabi (bfd_arch_rs6000, 0, GDB_OSABI_FREEBSD_ELF, -+ ppcfbsd_init_abi); -+ gdbarch_register_osabi (bfd_arch_powerpc, 0, GDB_OSABI_FREEBSD_ELF, -+ ppcfbsd_init_abi); -+ -+ deprecated_add_core_fns (&ppcfbsd_core_fns); -+ deprecated_add_core_fns (&ppcfbsd_elfcore_fns); -+} diff --git a/devel/gdb66/files/patch-ppcfbsd-tdep.h b/devel/gdb66/files/patch-ppcfbsd-tdep.h deleted file mode 100644 index 5b05e069cb3e..000000000000 --- a/devel/gdb66/files/patch-ppcfbsd-tdep.h +++ /dev/null @@ -1,36 +0,0 @@ - -$FreeBSD: /tmp/pcvs/ports/devel/gdb66/files/Attic/patch-ppcfbsd-tdep.h,v 1.1 2006-08-12 20:54:37 obrien Exp $ - ---- /dev/null -+++ gdb/ppcfbsd-tdep.h -@@ -0,0 +1,30 @@ -+/* Common target dependent code for GDB on PowerPC systems running FreeBSD. -+ Copyright 2002 Free Software Foundation, Inc. -+ -+ This file is part of GDB. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 2 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program; if not, write to the Free Software -+ Foundation, Inc., 59 Temple Place - Suite 330, -+ Boston, MA 02111-1307, USA. */ -+ -+#ifndef PPCFBSD_TDEP_H -+#define PPCFBSD_TDEP_H -+ -+void ppcfbsd_supply_reg (char *, int); -+void ppcfbsd_fill_reg (char *, int); -+ -+void ppcfbsd_supply_fpreg (char *, int); -+void ppcfbsd_fill_fpreg (char *, int); -+ -+#endif /* PPCFBSD_TDEP_H */ diff --git a/devel/gdb66/files/patch-rs6000-tdep.c b/devel/gdb66/files/patch-rs6000-tdep.c deleted file mode 100644 index 2bdebe543133..000000000000 --- a/devel/gdb66/files/patch-rs6000-tdep.c +++ /dev/null @@ -1,13 +0,0 @@ - -$FreeBSD: /tmp/pcvs/ports/devel/gdb66/files/Attic/patch-rs6000-tdep.c,v 1.1 2006-08-12 20:54:37 obrien Exp $ - ---- gdb/rs6000-tdep.c -+++ gdb/rs6000-tdep.c -@@ -3290,6 +3290,7 @@ - case GDB_OSABI_NETBSD_ELF: - case GDB_OSABI_UNKNOWN: - case GDB_OSABI_LINUX: -+ case GDB_OSABI_FREEBSD_ELF: - set_gdbarch_unwind_pc (gdbarch, rs6000_unwind_pc); - frame_unwind_append_sniffer (gdbarch, rs6000_frame_sniffer); - set_gdbarch_unwind_dummy_id (gdbarch, rs6000_unwind_dummy_id); diff --git a/devel/gdb66/files/patch-target.c b/devel/gdb66/files/patch-target.c deleted file mode 100644 index 31a2da3a9d1b..000000000000 --- a/devel/gdb66/files/patch-target.c +++ /dev/null @@ -1,21 +0,0 @@ - -$FreeBSD$ - ---- gdb/target.c.orig -+++ gdb/target.c -@@ -1487,13 +1487,14 @@ - struct target_ops **t; - struct target_ops *runable = NULL; - int count; -+ extern int kernel_debugging; - - count = 0; - - for (t = target_structs; t < target_structs + target_struct_size; - ++t) - { -- if ((*t)->to_stratum == core_stratum) -+ if ((*t)->to_stratum == (kernel_debugging ? kcore_stratum : core_stratum)) - { - runable = *t; - ++count; diff --git a/devel/gdb66/files/patch-target.h b/devel/gdb66/files/patch-target.h deleted file mode 100644 index 147cfe49620f..000000000000 --- a/devel/gdb66/files/patch-target.h +++ /dev/null @@ -1,10 +0,0 @@ ---- gdb/target.h Sat Feb 9 20:08:42 2002 -+++ gdb/target.h Fri May 24 08:38:31 2002 -@@ -52,6 +52,7 @@ - dummy_stratum, /* The lowest of the low */ - file_stratum, /* Executable files, etc */ - core_stratum, /* Core dump files */ -+ kcore_stratum, /* Kernel core files */ - download_stratum, /* Downloading of remote targets */ - process_stratum, /* Executing processes */ - thread_stratum /* Executing threads */ |