diff options
author | garga <garga@FreeBSD.org> | 2006-06-22 01:06:12 +0800 |
---|---|---|
committer | garga <garga@FreeBSD.org> | 2006-06-22 01:06:12 +0800 |
commit | 62eed6673b1b2722ceb1a115b5fa1d89f7b6a4af (patch) | |
tree | 7df892846fd606801a396646995fa4369e0de667 | |
parent | e416f6b5179372ab8fc11462fd3228f1af4b407c (diff) | |
download | freebsd-ports-gnome-62eed6673b1b2722ceb1a115b5fa1d89f7b6a4af.tar.gz freebsd-ports-gnome-62eed6673b1b2722ceb1a115b5fa1d89f7b6a4af.tar.zst freebsd-ports-gnome-62eed6673b1b2722ceb1a115b5fa1d89f7b6a4af.zip |
After upgrade lang/fpc to 2.0.2, devel/fpc-gdb and net/fpc-inet are
obsolets, so, remove them.
24 files changed, 2 insertions, 2357 deletions
diff --git a/CVSROOT/modules b/CVSROOT/modules index 50173c5a71a1..5fdff96088b2 100644 --- a/CVSROOT/modules +++ b/CVSROOT/modules @@ -2619,7 +2619,6 @@ fpc-fcl devel/fpc-fcl fpc-forms x11-toolkits/fpc-forms fpc-fpgtk graphics/fpc-fpgtk fpc-fv ports/devel/fpc-fv -fpc-gdb ports/devel/fpc-gdb fpc-gdbint ports/devel/fpc-gdbint fpc-gdbm databases/fpc-gdbm fpc-ggi graphics/fpc-ggi @@ -2628,7 +2627,6 @@ fpc-gtk2 x11-toolkits/fpc-gtk2 fpc-ibase ports/databases/fpc-ibase fpc-ide ports/editors/fpc-ide fpc-imlib graphics/fpc-imlib -fpc-inet ports/net/fpc-inet fpc-libasync net/fpc-libasync fpc-libgd graphics/fpc-libgd fpc-libpng graphics/fpc-libpng @@ -2385,3 +2385,5 @@ devel/p5-Filesys-Statvfs_Df|sysutils/p5-Filesys-Statvfs|2006-06-19|Vendor split www/opera-devel|www/opera|2006-06-20|Merged into the stable port archivers/bsdtar|archivers/libarchive|2006-06-20|Merged into the libarchive port lang/fpc2||2006-06-21|Removed because lang/fpc will be updated to 2.x +devel/fpc-gdb||2006-06-21|Obsoleted after lang/fpc was updated to 2.0.2 +net/fpc-inet||2006-06-21|Obsoleted after lang/fpc was updated to 2.0.2 diff --git a/devel/Makefile b/devel/Makefile index b8a0df506ffe..f87a66a5a5a9 100644 --- a/devel/Makefile +++ b/devel/Makefile @@ -286,7 +286,6 @@ SUBDIR += fpc-bfd SUBDIR += fpc-fcl SUBDIR += fpc-fv - SUBDIR += fpc-gdb SUBDIR += fpc-gdbint SUBDIR += fpc-pthreads SUBDIR += fpc-regexpr diff --git a/devel/fpc-gdb/Makefile b/devel/fpc-gdb/Makefile deleted file mode 100644 index 6b8ed84b49a6..000000000000 --- a/devel/fpc-gdb/Makefile +++ /dev/null @@ -1,67 +0,0 @@ -# ex:ts=8 -# Ports collection makefile for: FPC-GDB 5.2.1 -# Date created: 8 February 2004 -# Whom: John Merryweather Cooper <coop9211@uidaho.edu> -# -# $FreeBSD$ -# - -PORTNAME= gdb -PORTVERSION= 5.2.1 -CATEGORIES= devel lang -MASTER_SITES= ${MASTER_SITE_SOURCEWARE} -MASTER_SITE_SUBDIR= gdb/old-releases -PKGNAMEPREFIX= fpc- - -PATCH_SITES= ftp://ftp.freepascal.org/pub/fpc/contrib/libgdb/old/v5.2.1/ \ - ftp://ftp.planetmirror.com/pub/fpc/contrib/libgdb/old/v5.2.1/ \ - ftp://ftp.jp.freepascal.org/mirror/fpc/contrib/libgdb/old/v5.2.1/ \ - ftp://freepascal.stack.nl/pub/fpc/contrib/libgdb/old/v5.2.1/ \ - ftp://ftp.no.freepascal.org/pub/fpc/contrib/libgdb/old/v5.2.1/ \ - ftp://ftp.us.freepascal.org/pub/fpc/contrib/libgdb/old/v5.2.1/ \ - ${MASTER_SITE_LOCAL:S/$/:local/} -PATCH_SITE_SUBDIR= obrien/:local -PATCHFILES= gdb521.dif gdb521_xfree-loadmod.diff:local - -MAINTAINER= ports@FreeBSD.org -COMMENT= GNU GDB 5.2.1 modified for Free Pascal - -.include <bsd.port.pre.mk> - -NO_LATEST_LINK= yes -USE_GMAKE= yes -GNU_CONFIGURE= yes -CONFIGURE_ARGS= --program-suffix=fpc -AR?= /usr/bin/ar - -ONLY_FOR_ARCHS= i386 - -pre-configure: - cd ${WRKSRC} ; ${RM} -rf dejagnu expect sim tcl texinfo - -post-configure: -# if devel/bison is installed, build will fail --> force yacc - @${FIND} ${WRKSRC} -name "Makefile*" | ${XARGS} \ - ${REINPLACE_CMD} 's|bison -y|yacc|g' - -do-install: - @${INSTALL_PROGRAM} ${WRKSRC}/gdb/gdb \ - ${PREFIX}/bin/gdbfpc - cd ${WRKSRC}/gdb && ${AR} -rs libgdb.a cli*.o mi*.o - cd ${WRKSRC}/bfd && ${AR} -rs libbfd.a *.o - cd ${WRKSRC}/opcodes && ${AR} -rs libopcodes.a *.o - @${MKDIR} ${PREFIX}/lib/fpc/1.0.10/units/freebsd/gdbint/libgdb - @${INSTALL_DATA} \ - ${WRKSRC}/gdb/libgdb.a \ - ${WRKSRC}/bfd/libbfd.a \ - ${WRKSRC}/opcodes/libopcodes.a \ - ${WRKSRC}/libiberty/libiberty.a \ - ${WRKSRC}/intl/libintl.a \ - ${PREFIX}/lib/fpc/1.0.10/units/freebsd/gdbint/libgdb - -cklatest: - ncftpls \ - ftp://mirrors.rcn.net/mirrors/sources.redhat.com/${MASTER_SITE_SUBDIR}/ \ - | ${GREP} gdb+dejagnu- - -.include <bsd.port.post.mk> diff --git a/devel/fpc-gdb/distinfo b/devel/fpc-gdb/distinfo deleted file mode 100644 index 820a3f948c64..000000000000 --- a/devel/fpc-gdb/distinfo +++ /dev/null @@ -1,9 +0,0 @@ -MD5 (gdb-5.2.1.tar.gz) = e9766842f1bbc6c2353de1410d8c0de0 -SHA256 (gdb-5.2.1.tar.gz) = 1c3f93cabcbd598663fbe5a844d8f0945b3e3fba5dba657abe5298cd23e0166a -SIZE (gdb-5.2.1.tar.gz) = 14715792 -MD5 (gdb521.dif) = a83edfef16ee5b78c97517588459bbe2 -SHA256 (gdb521.dif) = da0cbe7f28d3a2ce21804c9760d7e00b92086e753b7d0d8fb45440278efc488b -SIZE (gdb521.dif) = 19633 -MD5 (gdb521_xfree-loadmod.diff) = 0cafd6520d86caa207a2f7a54f981d06 -SHA256 (gdb521_xfree-loadmod.diff) = 94badeda55393a8370a4d23e151a6b852222d372a2faaf7a381c3eee82e20228 -SIZE (gdb521_xfree-loadmod.diff) = 29594 diff --git a/devel/fpc-gdb/files/patch-bfd_configure b/devel/fpc-gdb/files/patch-bfd_configure deleted file mode 100644 index c522df7b9382..000000000000 --- a/devel/fpc-gdb/files/patch-bfd_configure +++ /dev/null @@ -1,11 +0,0 @@ ---- bfd/configure.orig Fri Feb 18 00:31:38 2005 -+++ bfd/configure Fri Feb 18 00:31:40 2005 -@@ -5059,7 +5059,7 @@ - i[3456]86-*-bsdi) - COREFILE= - ;; -- i[3456]86-*-bsd* | i[34567]86-*-freebsd[123] | i[34567]86-*-freebsd[123]\.* | i[34567]86-*-freebsd4\.[01234]* | i[34567]86-*-freebsd*aout*) -+ i[3456]86-*-bsd* | i[34567]86-*-freebsd[123] | i[34567]86-*-freebsd[123]\.* | i[34567]86-*-freebsd4\.[01234] | i[34567]86-*-freebsd*aout*) - COREFILE=trad-core.lo - TRAD_HEADER='"hosts/i386bsd.h"' - ;; diff --git a/devel/fpc-gdb/files/patch-gdb_config_alpha_fbsd.mh b/devel/fpc-gdb/files/patch-gdb_config_alpha_fbsd.mh deleted file mode 100644 index cc2cca6cc779..000000000000 --- a/devel/fpc-gdb/files/patch-gdb_config_alpha_fbsd.mh +++ /dev/null @@ -1,9 +0,0 @@ ---- gdb/config/alpha/fbsd.mh Sat Jan 19 17:12:50 2002 -+++ gdb/config/alpha/fbsd.mh Mon Jun 3 08:03:39 2002 -@@ -1,5 +1,5 @@ - # 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 - NAT_FILE= nm-fbsd.h diff --git a/devel/fpc-gdb/files/patch-gdb_config_i386_fbsd.mh b/devel/fpc-gdb/files/patch-gdb_config_i386_fbsd.mh deleted file mode 100644 index c268f5c5c76e..000000000000 --- a/devel/fpc-gdb/files/patch-gdb_config_i386_fbsd.mh +++ /dev/null @@ -1,8 +0,0 @@ ---- gdb/config/i386/fbsd.mh Thu Jan 17 20:50:59 2002 -+++ gdb/config/i386/fbsd.mh Mon May 27 18:36:20 2002 -@@ -4,4 +4,4 @@ - - NAT_FILE= nm-fbsd.h - # NOTE: Do not spread NATDEPFILES over several lines - it hurts BSD make. --NATDEPFILES= fork-child.o infptrace.o inftarg.o solib.o solib-svr4.o solib-legacy.o corelow.o core-aout.o core-regset.o i386-nat.o i387-nat.o i386bsd-nat.o i386fbsd-nat.o -+NATDEPFILES= fork-child.o infptrace.o inftarg.o solib.o solib-svr4.o solib-legacy.o corelow.o core-aout.o core-regset.o i386-nat.o i387-nat.o i386bsd-nat.o i386fbsd-nat.o kvm-fbsd.o freebsd-uthread.o xfreemod.o diff --git a/devel/fpc-gdb/files/patch-gdb_config_i386_nm-fbsd.h b/devel/fpc-gdb/files/patch-gdb_config_i386_nm-fbsd.h deleted file mode 100644 index 3c33c3340f96..000000000000 --- a/devel/fpc-gdb/files/patch-gdb_config_i386_nm-fbsd.h +++ /dev/null @@ -1,35 +0,0 @@ ---- gdb/config/i386/nm-fbsd.h Sat Jul 21 13:16:44 2001 -+++ gdb/config/i386/nm-fbsd.h Mon Jun 3 10:04:54 2002 -@@ -148,5 +152,32 @@ - #define ld_2 d_sdt - - #endif /* !SVR4_SHARED_LIBS */ -+ -+extern int kernel_debugging; -+extern int kernel_writablecore; -+ -+#if __FreeBSD_version >= 500032 -+#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 /* NM_FBSD_H */ diff --git a/devel/fpc-gdb/files/patch-gdb_config_i386_tm-fbsd.h b/devel/fpc-gdb/files/patch-gdb_config_i386_tm-fbsd.h deleted file mode 100644 index ca9c982f3d71..000000000000 --- a/devel/fpc-gdb/files/patch-gdb_config_i386_tm-fbsd.h +++ /dev/null @@ -1,67 +0,0 @@ ---- gdb/config/i386/tm-fbsd.h Sat Jul 28 10:03:38 2001 -+++ gdb/config/i386/tm-fbsd.h Fri Jun 7 08:32:14 2002 -@@ -41,38 +45,42 @@ - /* Support for longjmp. */ - - /* Details about jmp_buf. It's supposed to be an array of integers. */ -- --#define JB_ELEMENT_SIZE 4 /* Size of elements in jmp_buf. */ --#define JB_PC 0 /* Array index of saved PC. */ -- --/* Figure out where the longjmp will land. Store the address that -- longjmp will jump to in *ADDR, and return non-zero if successful. */ -- - #define GET_LONGJMP_TARGET(addr) get_longjmp_target (addr) --extern int get_longjmp_target (CORE_ADDR *addr); - - --/* Support for signal handlers. */ -+/* On FreeBSD, sigtramp has size 0x18 and is immediately below the -+ ps_strings struct which has size 0x10 and is at the top of the -+ user stack. */ -+ -+#undef SIGTRAMP_START -+#undef SIGTRAMP_END -+#define SIGTRAMP_START(pc) 0xbfbfdfd8 -+#define SIGTRAMP_END(pc) 0xbfbfdff0 - --#define IN_SIGTRAMP(pc, name) i386bsd_in_sigtramp (pc, name) --extern int i386bsd_in_sigtramp (CORE_ADDR pc, char *name); -- --/* These defines allow the recognition of sigtramps as a function name -- <sigtramp>. -- -- FIXME: kettenis/2001-07-13: These should be added to the target -- vector and turned into functions when we go "multi-arch". */ -- --#define SIGTRAMP_START(pc) i386bsd_sigtramp_start --#define SIGTRAMP_END(pc) i386bsd_sigtramp_end - extern CORE_ADDR i386bsd_sigtramp_start; - extern CORE_ADDR i386bsd_sigtramp_end; -+extern CORE_ADDR fbsd_kern_frame_saved_pc(struct frame_info *fr); - - /* Override FRAME_SAVED_PC to enable the recognition of signal handlers. */ - - #undef FRAME_SAVED_PC --#define FRAME_SAVED_PC(frame) i386bsd_frame_saved_pc (frame) --extern CORE_ADDR i386bsd_frame_saved_pc (struct frame_info *frame); -+#if __FreeBSD_version >= 500032 -+#define FRAME_SAVED_PC(FRAME) \ -+ (kernel_debugging ? fbsd_kern_frame_saved_pc(FRAME) : \ -+ (((FRAME)->signal_handler_caller \ -+ ? sigtramp_saved_pc (FRAME) \ -+ : read_memory_integer ((FRAME)->frame + 4, 4)) \ -+ )) -+#else -+#define FRAME_SAVED_PC(FRAME) \ -+ (((FRAME)->signal_handler_caller \ -+ ? sigtramp_saved_pc (FRAME) \ -+ : read_memory_integer ((FRAME)->frame + 4, 4)) \ -+ ) -+#endif -+ -+/* Offset to saved PC in sigcontext, from <sys/signal.h>. */ -+#define SIGCONTEXT_PC_OFFSET 20 - - - /* Shared library support. */ diff --git a/devel/fpc-gdb/files/patch-gdb_freebsd-uthread.c b/devel/fpc-gdb/files/patch-gdb_freebsd-uthread.c deleted file mode 100644 index 6167f9129218..000000000000 --- a/devel/fpc-gdb/files/patch-gdb_freebsd-uthread.c +++ /dev/null @@ -1,921 +0,0 @@ -$FreeBSD: /tmp/pcvs/ports/devel/fpc-gdb/files/Attic/patch-gdb_freebsd-uthread.c,v 1.1 2004-02-22 01:52:20 marcus Exp $ - ---- gdb/freebsd-uthread.c.orig Sat May 25 13:05:56 2002 -+++ gdb/freebsd-uthread.c Sat May 25 13:09:09 2002 -@@ -0,0 +1,915 @@ -+/* $FreeBSD: /tmp/pcvs/ports/devel/fpc-gdb/files/Attic/patch-gdb_freebsd-uthread.c,v 1.1 2004-02-22 01:52:20 marcus Exp $ */ -+/* 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. */ -+ -+/* 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 "gdbthread.h" -+#include "target.h" -+#include "inferior.h" -+#include <fcntl.h> -+#include <ucontext.h> -+#include <unistd.h> -+#include <sys/stat.h> -+#include "gdbcore.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; -+} -+ -+#ifdef __i386__ -+ -+static char sigmap[MAX_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[MAX_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 __alpha__ -+ -+static char sigmap[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[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 -+ -+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) -+ supply_register (regno, (char*) ®base[regmap[regno]]); -+ else -+ supply_register (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 */ -+ memcpy(reg, registers + REGISTER_BYTE (regno), -+ REGISTER_RAW_SIZE (regno)); -+ -+ /* And push out to inferior */ -+ off = (char *) reg - (char *) thread; -+ write_memory (ptr + off, -+ registers + REGISTER_BYTE (regno), -+ REGISTER_RAW_SIZE (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) -+{ -+ child_ops.to_create_inferior (exec_file, allargs, env); -+ -+ 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 (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 = target_new_objfile_hook; -+ target_new_objfile_hook = freebsd_uthread_new_objfile; -+ -+ child_suppress_run = 1; -+} - diff --git a/devel/fpc-gdb/files/patch-gdb_i386bsd-nat.c b/devel/fpc-gdb/files/patch-gdb_i386bsd-nat.c deleted file mode 100644 index a6f7c0ec5524..000000000000 --- a/devel/fpc-gdb/files/patch-gdb_i386bsd-nat.c +++ /dev/null @@ -1,20 +0,0 @@ ---- gdb/i386bsd-nat.c 2003/05/19 07:22:00 1.1 -+++ gdb/i386bsd-nat.c 2003/05/19 07:22:35 -@@ -305,7 +305,7 @@ - /* For some mysterious reason, some of the reserved bits in the - debug control register get set. Mask these off, otherwise the - ptrace call below will fail. */ -- dbregs.dr7 &= ~(0x0000fc00); -+ DBREG_DRX ((&dbregs), 7) = ~(0x0000fc00); - - DBREG_DRX ((&dbregs), regnum) = value; - -@@ -354,7 +354,7 @@ - return 0; - #endif - -- return dbregs.dr6; -+ return DBREG_DRX ((&dbregs), 6); - } - - #endif /* PT_GETDBREGS */ diff --git a/devel/fpc-gdb/files/patch-gdb_kvm-fbsd.c b/devel/fpc-gdb/files/patch-gdb_kvm-fbsd.c deleted file mode 100644 index 4e8483e73a2c..000000000000 --- a/devel/fpc-gdb/files/patch-gdb_kvm-fbsd.c +++ /dev/null @@ -1,1059 +0,0 @@ ---- gdb/kvm-fbsd.c Mon Jun 3 11:32:24 2002 -+++ gdb/kvm-fbsd.c Mon Jun 3 11:30:35 2002 -@@ -0,0 +1,1056 @@ -+/* Live and postmortem kernel debugging functions for FreeBSD. -+ Copyright 1996 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: /tmp/pcvs/ports/devel/fpc-gdb/files/Attic/patch-gdb_kvm-fbsd.c,v 1.2 2005-02-18 00:12:15 pav Exp $ */ -+ -+#include "defs.h" -+ -+#include <ctype.h> -+#include <errno.h> -+#include <signal.h> -+#include <fcntl.h> -+#include <paths.h> -+#include <sys/sysctl.h> -+#include <sys/param.h> -+#include <sys/time.h> -+#include <sys/proc.h> -+#include <sys/user.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 <sys/stat.h> -+#include <unistd.h> -+#include <vm/vm.h> -+#include <vm/vm_param.h> -+ -+#include <machine/vmparam.h> -+#include <machine/pcb.h> -+#include <machine/tss.h> -+#include <machine/frame.h> -+ -+#if __FreeBSD_version >= 500032 && defined(i386) -+typedef __cpumask_t cpumask_t; -+#define _KERNEL -+#include <sys/pcpu.h> -+#undef _KERNEL -+ -+static void kcore_files_info PARAMS ((struct target_ops *)); -+ -+static void kcore_close PARAMS ((int)); -+ -+static void get_kcore_registers PARAMS ((int)); -+ -+static int kcore_xfer_kmem PARAMS ((CORE_ADDR, char *, int, int, struct mem_attrib *attrib, struct target_ops *)); -+ -+static int xfer_umem PARAMS ((CORE_ADDR, char *, int, int)); -+ -+static CORE_ADDR ksym_lookup PARAMS ((const char *)); -+ -+static int read_pcb PARAMS ((int, CORE_ADDR)); -+ -+static struct proc * curProc PARAMS ((void)); -+ -+static int set_proc_context PARAMS ((CORE_ADDR paddr)); -+ -+static void kcore_open PARAMS ((char *filename, int from_tty)); -+ -+static void kcore_detach PARAMS ((char *args, int from_tty)); -+ -+static void set_proc_cmd PARAMS ((char *arg, int from_tty)); -+ -+static void set_cpu_cmd PARAMS ((char *arg, int from_tty)); -+ -+static CORE_ADDR kvtophys PARAMS ((int, CORE_ADDR)); -+ -+static int physrd PARAMS ((int, u_int, char*, int)); -+ -+static int kvm_open PARAMS ((const char *efile, char *cfile, char *sfile, -+ int perm, char *errout)); -+ -+static int kvm_close PARAMS ((int fd)); -+ -+static int kvm_write PARAMS ((int core_kd, CORE_ADDR memaddr, -+ char *myaddr, int len)); -+ -+static int kvm_read PARAMS ((int core_kd, CORE_ADDR memaddr, -+ char *myaddr, int len)); -+ -+static int kvm_uread PARAMS ((int core_kd, struct proc *p, -+ CORE_ADDR memaddr, char *myaddr, -+ int len)); -+ -+static int kernel_core_file_hook PARAMS ((int fd, CORE_ADDR addr, -+ char *buf, int len)); -+ -+static CORE_ADDR kvm_getpcpu PARAMS ((int cfd, int cpuid)); -+ -+static struct kinfo_proc * kvm_getprocs PARAMS ((int cfd, int op, -+ CORE_ADDR proc, int *cnt)); -+ -+extern struct target_ops kcore_ops; /* Forward decl */ -+ -+/* Non-zero means we are debugging a kernel core file */ -+int kernel_debugging = 0; -+int kernel_writablecore = 0; -+ -+static char *core_file; -+static int core_kd = -1; -+static struct proc *cur_proc; -+static CORE_ADDR kernel_start; -+ -+static CORE_ADDR pcpu; -+#define PCPU_OFFSET(name) \ -+ offsetof(struct pcpu, pc_ ## name) -+ -+/* -+ * Symbol names of kernel entry points. Use special frames. -+ */ -+#define KSYM_TRAP "calltrap" -+#define KSYM_INTR "Xintr" -+#define KSYM_FASTINTR "Xfastintr" -+#define KSYM_SYSCALL "Xsyscall" -+ -+/* -+ * 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)))) -+ -+ -+ -+/* -+ * 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 (fr) -+struct frame_info *fr; -+{ -+ struct minimal_symbol *sym; -+ CORE_ADDR this_saved_pc; -+ enum frametype frametype; -+ -+ this_saved_pc = read_memory_integer (fr->frame + 4, 4); -+ sym = lookup_minimal_symbol_by_pc (this_saved_pc); -+ frametype = tf_normal; -+ if (sym != NULL) { -+ if (strcmp (SYMBOL_NAME(sym), KSYM_TRAP) == 0) -+ frametype = tf_trap; -+ else if (strncmp (SYMBOL_NAME(sym), KSYM_INTR, -+ strlen(KSYM_INTR)) == 0 || strncmp (SYMBOL_NAME(sym), -+ KSYM_FASTINTR, strlen(KSYM_FASTINTR)) == 0) -+ frametype = tf_interrupt; -+ else if (strcmp (SYMBOL_NAME(sym), KSYM_SYSCALL) == 0) -+ frametype = tf_syscall; -+ } -+ -+ switch (frametype) { -+ case tf_normal: -+ return (this_saved_pc); -+ -+#define oEIP offsetof(struct trapframe, tf_eip) -+ -+ case tf_trap: -+ return (read_memory_integer (fr->frame + 8 + oEIP, 4)); -+ -+ case tf_interrupt: -+ return (read_memory_integer (fr->frame + 12 + oEIP, 4)); -+ -+ case tf_syscall: -+ return (read_memory_integer (fr->frame + 8 + oEIP, 4)); -+#undef oEIP -+ } -+} -+ -+static CORE_ADDR -+ksym_lookup (name) -+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); -+} -+ -+static struct proc * -+curProc () -+{ -+ struct proc *p; -+ struct thread *td; -+ CORE_ADDR addr = pcpu + PCPU_OFFSET (curthread); -+ -+ if (kvread (addr, &td)) -+ error ("cannot read thread pointer at %x\n", addr); -+ addr = (CORE_ADDR)td + offsetof(struct thread, td_proc); -+ if (kvread (addr, &p)) -+ error ("cannot read proc pointer at %x\n", addr); -+ return p; -+} -+ -+/* -+ * Set the process context to that of the proc structure at -+ * system address paddr. -+ */ -+static int -+set_proc_context (paddr) -+ CORE_ADDR paddr; -+{ -+ struct proc p; -+ -+ if (paddr < kernel_start) -+ return (1); -+ -+ cur_proc = (struct proc *)paddr; -+#ifdef notyet -+ set_kernel_boundaries (cur_proc); -+#endif -+ -+ /* 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 (); -+ set_current_frame (create_new_frame (read_fp (), read_pc ())); -+ select_frame (get_current_frame (), 0); -+ return (0); -+} -+ -+/* Discard all vestiges of any previous core file -+ and mark data and stack spaces as empty. */ -+ -+/* ARGSUSED */ -+static void -+kcore_close (quitting) -+ 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 = -1; -+ } -+} -+ -+/* This routine opens and sets up the core file bfd */ -+ -+static void -+kcore_open (filename, from_tty) -+ char *filename; -+ int from_tty; -+{ -+ const char *p; -+ struct cleanup *old_chain; -+ char buf[256], *cp; -+ int ontop; -+ CORE_ADDR addr; -+ struct pcb pcb; -+ -+ target_preopen (from_tty); -+ -+ unpush_target (&kcore_ops); -+ -+ if (!filename) -+ { -+ /*error (core_kd?*/ -+ error ( (core_kd >= 0)? -+ "No core file specified. (Use `detach' to stop debugging a core file.)" -+ : "No core file specified."); -+ } -+ -+ filename = tilde_expand (filename); -+ if (filename[0] != '/') -+ { -+ cp = concat (current_directory, "/", filename, NULL); -+ free (filename); -+ filename = cp; -+ } -+ -+ old_chain = make_cleanup (free, filename); -+ -+ /* -+ * gdb doesn't really do anything if the exec-file couldn't -+ * be opened (in that case exec_bfd is NULL). Usually that's -+ * no big deal, but kvm_open needs the exec-file's name, -+ * which results in dereferencing a NULL pointer, a real NO-NO ! -+ * So, check here if the open of the exec-file succeeded. -+ */ -+ if (exec_bfd == NULL) /* the open failed */ -+ error ("kgdb could not open the exec-file, please check the name you used !"); -+ -+ core_kd = kvm_open (exec_bfd->filename, filename, NULL, -+ kernel_writablecore? O_RDWR : O_RDONLY, "kgdb: "); -+ if (core_kd < 0) -+ perror_with_name (filename); -+ -+ /* 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; -+ ontop = !push_target (&kcore_ops); -+ -+ kernel_start = bfd_get_start_address (exec_bfd); /* XXX */ -+ -+ /* 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 ("panicstr: %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; -+ } -+ -+ /* we may need this later */ -+ cur_proc = (struct proc *)curProc (); -+ /* Now, set up the frame cache, and print the top of stack */ -+ flush_cached_frames (); -+ set_current_frame (create_new_frame (read_fp (), read_pc ())); -+ select_frame (get_current_frame (), 0); -+ print_stack_frame (selected_frame, selected_frame_level, 1); -+} -+ -+static void -+kcore_detach (args, from_tty) -+ 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 (regno) -+ int regno; -+{ -+ struct pcb *pcbaddr; -+ struct thread *mainthread; -+ -+ /* find the pcb for the current process */ -+ if (cur_proc == NULL) -+ error ("get_kcore_registers no proc"); -+ if (kvread (&TAILQ_FIRST(&cur_proc->p_threads), &mainthread)) /* XXXKSE */ -+ error ("cannot read main thread for proc at %#x", cur_proc); -+ if (kvread (&mainthread->td_pcb, &pcbaddr)) /* XXXKSE */ -+ error ("cannot read pcb pointer for proc at %#x", cur_proc); -+ if (read_pcb (core_kd, (CORE_ADDR)pcbaddr) < 0) -+ error ("cannot read pcb at %#x", pcbaddr); -+} -+ -+static void -+kcore_files_info (t) -+ struct target_ops *t; -+{ -+ printf ("\t`%s'\n", core_file); -+} -+ -+static CORE_ADDR -+ksym_maxuseraddr() -+{ -+ 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; -+} -+ -+static int -+kcore_xfer_kmem (memaddr, myaddr, len, write, attrib, target) -+ CORE_ADDR memaddr; -+ char *myaddr; -+ int len; -+ int write; -+ struct mem_attrib *attrib; -+ struct target_ops *target; -+{ -+ int ns; -+ int nu; -+ -+ if (memaddr >= ksym_maxuseraddr()) -+ nu = 0; -+ else -+ { -+ nu = xfer_umem (memaddr, myaddr, len, write); -+ if (nu <= 0) -+ return (0); -+ if (nu == len) -+ return (nu); -+ memaddr += nu; -+ if (memaddr != ksym_maxuseraddr()) -+ return (nu); -+ myaddr += nu; -+ len -= nu; -+ } -+ -+ ns = (write ? kvm_write : kvm_read) (core_kd, memaddr, myaddr, len); -+ if (ns < 0) -+ ns = 0; -+ -+ return (nu + ns); -+} -+ -+static int -+xfer_umem (memaddr, myaddr, len, write) -+ CORE_ADDR memaddr; -+ char *myaddr; -+ int len; -+ int write; /* ignored */ -+{ -+ int n; -+ struct proc proc; -+ -+ if (cur_proc == NULL || kvread (cur_proc, &proc)) -+ error ("cannot read proc at %#x", cur_proc); -+ n = kvm_uread (core_kd, &proc, memaddr, myaddr, len) ; -+ -+ if (n < 0) -+ return 0; -+ return n; -+} -+ -+static CORE_ADDR -+ksym_kernbase() -+{ -+ 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) -+ -+static CORE_ADDR sbr; -+static CORE_ADDR curpcb; -+static int found_pcb; -+static int devmem; -+static int kfd; -+static struct pcb pcb; -+ -+static void -+set_proc_cmd (arg, from_tty) -+ char *arg; -+ int from_tty; -+{ -+ CORE_ADDR paddr; -+ struct kinfo_proc *kp; -+ int cnt = 0; -+ -+ if (!arg) -+ error_no_arg ("proc address for new current process"); -+ if (!kernel_debugging) -+ error ("not debugging kernel"); -+ -+ paddr = (CORE_ADDR)parse_and_eval_address (arg); -+ /* assume it's a proc pointer if it's in the kernel */ -+ if (paddr >= kernel_start) { -+ if (set_proc_context(paddr)) -+ error("invalid proc address"); -+ } else { -+ kp = kvm_getprocs(core_kd, KERN_PROC_PID, paddr, &cnt); -+ if (!cnt) -+ error("invalid pid"); -+ if (set_proc_context((CORE_ADDR)kp->ki_paddr)) -+ error("invalid proc address"); -+ } -+} -+ -+static void -+set_cpu_cmd (arg, from_tty) -+ char *arg; -+ int from_tty; -+{ -+ CORE_ADDR paddr; -+ CORE_ADDR pcaddr; -+ struct kinfo_proc *kp; -+ int cpu, cfd; -+ -+ if (!arg) -+ error_no_arg ("cpu number"); -+ if (!kernel_debugging) -+ error ("not debugging kernel"); -+ -+ cfd = core_kd; -+ cpu = (int)parse_and_eval_address (arg); -+ if ((pcaddr = kvm_getpcpu (cfd, cpu)) == NULL) -+ error ("cpu number out of range"); -+ -+ pcpu = pcaddr; -+ curpcb = kvtophys(cfd, pcpu + PCPU_OFFSET (curpcb)); -+ physrd (cfd, curpcb, (char*)&curpcb, sizeof curpcb); -+ -+ if (!devmem) -+ paddr = ksym_lookup ("dumppcb") - KERNOFF; -+ else -+ paddr = kvtophys (cfd, curpcb); -+ read_pcb (cfd, paddr); -+ printf ("initial pcb at %lx\n", (unsigned long)paddr); -+ -+ if ((cur_proc = curProc())) -+ target_fetch_registers (-1); -+ -+ /* Now, set up the frame cache, and print the top of stack */ -+ flush_cached_frames (); -+ set_current_frame (create_new_frame (read_fp (), read_pc ())); -+ select_frame (get_current_frame (), 0); -+ print_stack_frame (selected_frame, selected_frame_level, 1); -+} -+ -+/* substitutes for the stuff in libkvm which doesn't work */ -+/* most of this was taken from the old kgdb */ -+ -+/* we don't need all this stuff, but the call should look the same */ -+ -+static int -+kvm_open (efile, cfile, sfile, perm, errout) -+ const char *efile; -+ char *cfile; -+ char *sfile; /* makes this kvm_open more compatible to the one in libkvm */ -+ int perm; -+ char *errout; /* makes this kvm_open more compatible to the one in libkvm */ -+{ -+ struct stat stb; -+ int cfd; -+ CORE_ADDR paddr; -+ -+ if ((cfd = open (cfile, perm, 0)) < 0) -+ return (cfd); -+ -+ if ((pcpu = kvm_getpcpu (cfd, 0)) == NULL) -+ return (-1); -+ -+ fstat (cfd, &stb); -+ if ((stb.st_mode & S_IFMT) == S_IFCHR -+ && stb.st_rdev == makedev (2, 0)) -+ { -+ devmem = 1; -+ kfd = open (_PATH_KMEM, perm, 0); -+ } -+ -+ physrd (cfd, ksym_lookup ("IdlePTD") - KERNOFF, (char*)&sbr, sizeof sbr); -+ printf ("IdlePTD at phsyical address 0x%08lx\n", (unsigned long)sbr); -+ curpcb = kvtophys(cfd, pcpu + PCPU_OFFSET (curpcb)); -+ physrd (cfd, curpcb, (char*)&curpcb, sizeof curpcb); -+ -+ found_pcb = 1; /* for vtophys */ -+ if (!devmem) -+ paddr = ksym_lookup ("dumppcb") - KERNOFF; -+ else -+ paddr = kvtophys (cfd, curpcb); -+ read_pcb (cfd, paddr); -+ printf ("initial pcb at physical address 0x%08lx\n", (unsigned long)paddr); -+ -+ return (cfd); -+} -+ -+static int -+kvm_close (fd) -+ int fd; -+{ -+ return (close (fd)); -+} -+ -+static int -+kvm_write (core_kd, memaddr, myaddr, len) -+ int core_kd; -+ CORE_ADDR memaddr; -+ char *myaddr; -+{ -+ int cc; -+ -+ if (devmem) -+ { -+ if (kfd > 0) -+ { -+ /* -+ * Just like kvm_read, only we write. -+ */ -+ errno = 0; -+ if (lseek (kfd, (off_t)memaddr, 0) < 0 -+ && errno != 0) -+ { -+ error ("kvm_write:invalid address (%x)", memaddr); -+ return (0); -+ } -+ cc = write (kfd, myaddr, len); -+ if (cc < 0) -+ { -+ error ("kvm_write:write failed"); -+ return (0); -+ } -+ else if (cc < len) -+ error ("kvm_write:short write"); -+ return (cc); -+ } -+ else -+ return (0); -+ } -+ else -+ { -+ printf ("kvm_write not implemented for dead kernels\n"); -+ return (0); -+ } -+ /* NOTREACHED */ -+} -+ -+static int -+kvm_read (core_kd, memaddr, myaddr, len) -+ int core_kd; -+ CORE_ADDR memaddr; -+ char *myaddr; -+{ -+ return (kernel_core_file_hook (core_kd, memaddr, myaddr, len)); -+} -+ -+static int -+kvm_uread (core_kd, p, memaddr, myaddr, len) -+ int core_kd; -+ register struct proc *p; -+ CORE_ADDR memaddr; -+ char *myaddr; -+ int len; -+{ -+ register char *cp; -+ char procfile[MAXPATHLEN]; -+ ssize_t amount; -+ int fd; -+ -+ if (devmem) -+ { -+ sprintf (procfile, "/proc/%d/mem", p->p_pid); -+ fd = open (procfile, O_RDONLY, 0); -+ if (fd < 0) -+ { -+ error ("cannot open %s", procfile); -+ close (fd); -+ return (0); -+ } -+ -+ cp = myaddr; -+ while (len > 0) -+ { -+ errno = 0; -+ if (lseek (fd, (off_t)memaddr, 0) == -1 && errno != 0) -+ { -+ error ("invalid address (%x) in %s", memaddr, procfile); -+ break; -+ } -+ amount = read (fd, cp, len); -+ if (amount < 0) -+ { -+ error ("error reading %s", procfile); -+ break; -+ } -+ if (amount == 0) -+ { -+ error ("EOF reading %s", procfile); -+ break; -+ } -+ cp += amount; -+ memaddr += amount; -+ len -= amount; -+ } -+ -+ close (fd); -+ return ((ssize_t) (cp - myaddr)); -+ } -+ else -+ return (kernel_core_file_hook (core_kd, memaddr, myaddr, len)); -+} -+ -+static struct kinfo_proc kp; -+ -+/* -+ * try to do what kvm_proclist in libkvm would do -+ */ -+static int -+kvm_proclist (cfd, pid, p, cnt) -+int cfd, pid, *cnt; -+struct proc *p; -+{ -+ struct proc lp; -+ -+ for (; p != NULL; p = LIST_NEXT(&lp, p_list)) { -+ if (!kvm_read(cfd, (CORE_ADDR)p, (char *)&lp, sizeof (lp))) -+ return (0); -+ if (lp.p_pid != pid) -+ continue; -+ kp.ki_paddr = p; -+ *cnt = 1; -+ return (1); -+ } -+ *cnt = 0; -+ return (0); -+} -+ -+/* -+ * try to do what kvm_deadprocs in libkvm would do -+ */ -+static struct kinfo_proc * -+kvm_deadprocs (cfd, pid, cnt) -+int cfd, pid, *cnt; -+{ -+ CORE_ADDR allproc, zombproc; -+ struct proc *p; -+ -+ allproc = ksym_lookup("allproc"); -+ if (kvm_read(cfd, allproc, (char *)&p, sizeof (p)) == 0) -+ return (NULL); -+ kvm_proclist (cfd, pid, p, cnt); -+ if (!*cnt) { -+ zombproc = ksym_lookup("zombproc"); -+ if (kvm_read(cfd, zombproc, (char *)&p, sizeof (p)) == 0) -+ return (NULL); -+ kvm_proclist (cfd, pid, p, cnt); -+ } -+ return (&kp); -+} -+ -+static CORE_ADDR -+kvm_getpcpu (cfd, cpuid) -+int cfd, cpuid; -+{ -+ SLIST_HEAD(, pcpu) pcpu_head; -+ struct pcpu lpc; -+ struct pcpu *pc; -+ -+ physrd (cfd, ksym_lookup ("cpuhead") - KERNOFF, (char*)&pcpu_head, -+ sizeof pcpu_head); -+ pc = SLIST_FIRST (&pcpu_head); -+ for (; pc != NULL; pc = SLIST_NEXT (&lpc, pc_allcpu)) -+ { -+ kvm_read (cfd, (CORE_ADDR)pc, (char*)&lpc, sizeof lpc); -+ if (lpc.pc_cpuid == cpuid) -+ break; -+ } -+ -+ return ((CORE_ADDR)pc); -+} -+ -+/* -+ * try to do what kvm_getprocs in libkvm would do -+ */ -+static struct kinfo_proc * -+kvm_getprocs (cfd, op, proc, cnt) -+int cfd, op, *cnt; -+CORE_ADDR proc; -+{ -+ int mib[4], size; -+ -+ *cnt = 0; -+ /* assume it's a pid */ -+ if (devmem) { /* "live" kernel, use sysctl */ -+ mib[0] = CTL_KERN; -+ mib[1] = KERN_PROC; -+ mib[2] = KERN_PROC_PID; -+ mib[3] = (int)proc; -+ size = sizeof (kp); -+ if (sysctl (mib, 4, &kp, &size, NULL, 0) < 0) { -+ perror("sysctl"); -+ *cnt = 0; -+ return (NULL); -+ } -+ if (!size) -+ *cnt = 0; -+ else -+ *cnt = 1; -+ return (&kp); -+ } else -+ return (kvm_deadprocs (cfd, (int)proc, cnt)); -+} -+ -+static int -+physrd (cfd, addr, dat, len) -+ int cfd; -+ u_int addr; -+ char *dat; -+ int len; -+{ -+ if (lseek (cfd, (off_t)addr, L_SET) == -1) -+ return (-1); -+ return (read (cfd, dat, len)); -+} -+ -+static CORE_ADDR -+kvtophys (fd, addr) -+ int fd; -+ CORE_ADDR addr; -+{ -+ CORE_ADDR v; -+ unsigned int pte; -+ static CORE_ADDR PTD = -1; -+ CORE_ADDR current_ptd; -+ -+ /* -+ * We may no longer have a linear system page table... -+ * -+ * Here's the scoop. IdlePTD contains the physical address -+ * of a page table directory that always maps the kernel. -+ * IdlePTD is in memory that is mapped 1-to-1, so we can -+ * find it easily given its 'virtual' address from ksym_lookup(). -+ * For hysterical reasons, the value of IdlePTD is stored in sbr. -+ * -+ * To look up a kernel address, we first convert it to a 1st-level -+ * address and look it up in IdlePTD. This gives us the physical -+ * address of a page table page; we extract the 2nd-level part of -+ * VA and read the 2nd-level pte. Finally, we add the offset part -+ * of the VA into the physical address from the pte and return it. -+ * -+ * User addresses are a little more complicated. If we don't have -+ * a current PCB from read_pcb(), we use PTD, which is the (fixed) -+ * virtual address of the current ptd. Since it's NOT in 1-to-1 -+ * kernel space, we must look it up using IdlePTD. If we do have -+ * a pcb, we get the ptd from pcb_ptd. -+ */ -+ -+ if (INKERNEL (addr)) -+ current_ptd = sbr; -+ else if (found_pcb == 0) -+ { -+ if (PTD == -1) -+ PTD = kvtophys (fd, ksym_lookup ("PTD")); -+ current_ptd = PTD; -+ } -+ else -+ current_ptd = pcb.pcb_cr3; -+ -+ /* -+ * Read the first-level page table (ptd). -+ */ -+ v = current_ptd + ( (unsigned)addr >> PDRSHIFT) * sizeof pte; -+ if (physrd (fd, v, (char *)&pte, sizeof pte) < 0 || (pte&PG_V) == 0) -+ return (~0); -+ -+ if (pte & PG_PS) -+ { -+ /* -+ * No second-level page table; ptd describes one 4MB page. -+ * (We assume that the kernel wouldn't set PG_PS without enabling -+ * it cr0, and that the kernel doesn't support 36-bit physical -+ * addresses). -+ */ -+#define PAGE4M_MASK (NBPDR - 1) -+#define PG_FRAME4M (~PAGE4M_MASK) -+ addr = (pte & PG_FRAME4M) + (addr & PAGE4M_MASK); -+ } -+ else -+ { -+ /* -+ * Read the second-level page table. -+ */ -+ v = (pte&PG_FRAME) + ((addr >> PAGE_SHIFT)&(NPTEPG-1)) * sizeof pte; -+ if (physrd (fd, v, (char *) &pte, sizeof (pte)) < 0 || (pte&PG_V) == 0) -+ return (~0); -+ -+ addr = (pte & PG_FRAME) + (addr & PAGE_MASK); -+ } -+#if 0 -+ printf ("vtophys (%x) -> %x\n", oldaddr, addr); -+#endif -+ return (addr); -+} -+ -+static int -+read_pcb (fd, uaddr) -+ int fd; -+ CORE_ADDR uaddr; -+{ -+ int i; -+ int noreg; -+ CORE_ADDR nuaddr = uaddr; -+ -+ /* need this for the `proc' command to work */ -+ if (INKERNEL(uaddr)) -+ nuaddr = kvtophys(fd, uaddr); -+ -+ if (physrd (fd, nuaddr, (char *)&pcb, sizeof pcb) < 0) -+ { -+ error ("cannot read pcb at %x\n", uaddr); -+ return (-1); -+ } -+ -+ /* -+ * 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 */ -+ supply_register (i, (char *)&noreg); -+ supply_register (3, (char *)&pcb.pcb_ebx); -+ supply_register (SP_REGNUM, (char *)&pcb.pcb_esp); -+ supply_register (FP_REGNUM, (char *)&pcb.pcb_ebp); -+ supply_register (6, (char *)&pcb.pcb_esi); -+ supply_register (7, (char *)&pcb.pcb_edi); -+ supply_register (PC_REGNUM, (char *)&pcb.pcb_eip); -+ for (i = 9; i < 14; ++i) /* eflags, cs, ss, ds, es, fs */ -+ supply_register (i, (char *)&noreg); -+ supply_register (15, (char *)&pcb.pcb_gs); -+ -+ /* XXX 80387 registers? */ -+} -+ -+/* -+ * read len bytes from kernel virtual address 'addr' into local -+ * buffer 'buf'. Return numbert of bytes if read ok, 0 otherwise. On read -+ * errors, portion of buffer not read is zeroed. -+ */ -+ -+static int -+kernel_core_file_hook (fd, addr, buf, len) -+ int fd; -+ CORE_ADDR addr; -+ char *buf; -+ int len; -+{ -+ int i; -+ CORE_ADDR paddr; -+ register char *cp; -+ int cc; -+ -+ cp = buf; -+ -+ while (len > 0) -+ { -+ paddr = kvtophys (fd, addr); -+ if (paddr == ~0) -+ { -+ memset (buf, '\000', len); -+ break; -+ } -+ /* we can't read across a page boundary */ -+ i = min (len, PAGE_SIZE - (addr & PAGE_MASK)); -+ if ( (cc = physrd (fd, paddr, cp, i)) <= 0) -+ { -+ memset (cp, '\000', len); -+ return (cp - buf); -+ } -+ cp += cc; -+ addr += cc; -+ len -= cc; -+ } -+ return (cp - buf); -+} -+ -+static struct target_ops kcore_ops; -+ -+#else -+int kernel_debugging = 0; -+#endif -+ -+void -+_initialize_kcorelow() -+{ -+#if __FreeBSD_version >= 500032 && defined(i386) -+ 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 = kcore_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"); -+ add_com ("cpu", class_obscure, set_cpu_cmd, "Set current cpu"); -+#endif -+} diff --git a/devel/fpc-gdb/files/patch-gdb_symfile.c b/devel/fpc-gdb/files/patch-gdb_symfile.c deleted file mode 100644 index 99c75ffe04bf..000000000000 --- a/devel/fpc-gdb/files/patch-gdb_symfile.c +++ /dev/null @@ -1,15 +0,0 @@ ---- gdb/symfile.c Tue Feb 26 17:40:36 2002 -+++ gdb/symfile.c Wed May 29 11:10:17 2002 -@@ -1546,11 +1546,7 @@ - char *val = sect_opts[i].value; - char *sec = sect_opts[i].name; - -- val = sect_opts[i].value; -- if (val[0] == '0' && val[1] == 'x') -- addr = strtoul (val+2, NULL, 16); -- else -- addr = strtoul (val, NULL, 10); -+ addr = parse_and_eval_address(val); - - /* Here we store the section offsets in the order they were - entered on the command line. */ diff --git a/devel/fpc-gdb/files/patch-gdb_target.c b/devel/fpc-gdb/files/patch-gdb_target.c deleted file mode 100644 index 7a4be01dd55d..000000000000 --- a/devel/fpc-gdb/files/patch-gdb_target.c +++ /dev/null @@ -1,14 +0,0 @@ ---- gdb/target.c.orig Thu Jan 31 17:01:21 2002 -+++ gdb/target.c Fri Jun 7 16:36:06 2002 -@@ -1361,7 +1361,11 @@ - for (t = target_structs; t < target_structs + target_struct_size; - ++t) - { -+#if defined(__FreeBSD__) && defined(__i386__) -+ if ((*t)->to_stratum == (kernel_debugging ? kcore_stratum : core_stratum)) -+#else - if ((*t)->to_stratum == core_stratum) -+#endif - { - runable = *t; - ++count; diff --git a/devel/fpc-gdb/files/patch-gdb_target.h b/devel/fpc-gdb/files/patch-gdb_target.h deleted file mode 100644 index 147cfe49620f..000000000000 --- a/devel/fpc-gdb/files/patch-gdb_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 */ diff --git a/devel/fpc-gdb/files/patch-gdb_version.in b/devel/fpc-gdb/files/patch-gdb_version.in deleted file mode 100644 index b00559ee28e5..000000000000 --- a/devel/fpc-gdb/files/patch-gdb_version.in +++ /dev/null @@ -1,5 +0,0 @@ ---- gdb/version.in Fri Apr 26 18:04:22 2002 -+++ gdb/version.in Mon Jun 3 08:14:54 2002 -@@ -1 +1 @@ --5.2 -+5.2 (FreeBSD) diff --git a/devel/fpc-gdb/pkg-descr b/devel/fpc-gdb/pkg-descr deleted file mode 100644 index 4adff26abd2f..000000000000 --- a/devel/fpc-gdb/pkg-descr +++ /dev/null @@ -1,6 +0,0 @@ -GNU GDB 5.2.1 modified to work with Free Pascal. - -WWW: http://www.freepascal.org/ - --- -John Merryweather Cooper <coop9211@uidaho.edu> diff --git a/devel/fpc-gdb/pkg-plist b/devel/fpc-gdb/pkg-plist deleted file mode 100644 index 58c752475d01..000000000000 --- a/devel/fpc-gdb/pkg-plist +++ /dev/null @@ -1,12 +0,0 @@ -bin/gdbfpc -lib/fpc/1.0.10/units/freebsd/gdbint/libgdb/libbfd.a -lib/fpc/1.0.10/units/freebsd/gdbint/libgdb/libgdb.a -lib/fpc/1.0.10/units/freebsd/gdbint/libgdb/libiberty.a -lib/fpc/1.0.10/units/freebsd/gdbint/libgdb/libintl.a -lib/fpc/1.0.10/units/freebsd/gdbint/libgdb/libopcodes.a -@dirrm lib/fpc/1.0.10/units/freebsd/gdbint/libgdb -@dirrm lib/fpc/1.0.10/units/freebsd/gdbint -@dirrm lib/fpc/1.0.10/units/freebsd -@dirrm lib/fpc/1.0.10/units -@dirrm lib/fpc/1.0.10 -@dirrm lib/fpc diff --git a/net/Makefile b/net/Makefile index 3d766e57f2fe..2d0f54b6ac81 100644 --- a/net/Makefile +++ b/net/Makefile @@ -121,7 +121,6 @@ SUBDIR += findmtu SUBDIR += flowgrep SUBDIR += forg - SUBDIR += fpc-inet SUBDIR += fpc-libasync SUBDIR += fpc-netdb SUBDIR += fping diff --git a/net/fpc-inet/Makefile b/net/fpc-inet/Makefile deleted file mode 100644 index 3a566e77fcfa..000000000000 --- a/net/fpc-inet/Makefile +++ /dev/null @@ -1,70 +0,0 @@ -# New ports collection makefile for: Free Pascal Compiler -# Date created: 28 November 2001 -# Whom: John Merryweather Cooper et al -# -# $FreeBSD$ -# - -PORTNAME= inet -PORTVERSION= 1.0.10 -PORTREVISION= 1 -CATEGORIES= net -MASTER_SITES= ${MASTER_SITE_SOURCEFORGE} -MASTER_SITE_SUBDIR= freepascal -PKGNAMEPREFIX= fpc- -DISTNAME= fpc-${PORTVERSION}.ELF -EXTRACT_SUFX= .tar - -MAINTAINER= ports@FreeBSD.org -COMMENT= Free Pascal routines for internet programming - -.include <bsd.port.pre.mk> - -BUILD_DEPENDS= ppc386:${PORTSDIR}/lang/fpc -RUN_DEPENDS= ${BUILD_DEPENDS} -.if ${OSVERSION} >= 500000 -LIB_DEPENDS= c.4:${PORTSDIR}/misc/compat4x -.endif -.if ${OSVERSION} < 470000 -EXTRACT_DEPENDS= gtar:${PORTSDIR}/archivers/gtar -TAR= ${LOCALBASE}/bin/gtar -.endif -USE_GMAKE= yes -ONLY_FOR_ARCHS= i386 - -PLIST_SUB+= PORTVERSION=${PORTVERSION} - -MAKE_ENV+= PATH=${LOCALBASE}/bin:$$PATH \ - FPC=${LOCALBASE}/bin/ppc386 \ - INSTALL_BASEDIR=${PREFIX}/lib/fpc/${PORTVERSION} \ - INSTALL_BINDIR=${PREFIX}/bin \ - GCCLIBDIR=/usr/lib \ - RELEASE=1 - -do-extract: -# unpack distribution - @${MKDIR} ${WRKSRC} - @${TAR} xf ${DISTDIR}/${DISTNAME}.tar --directory ${WRKSRC} -# unpack sources distribution - @${MKDIR} ${WRKSRC}/sources - @${TAR} xf ${WRKSRC}/sources.tar --directory ${WRKSRC}/sources -# further extract base sources -# -# inet sources - @${TAR} zxf ${WRKSRC}/sources/unitsinetsrc.tar.gz \ - --directory ${WRKSRC} - -post-patch: -# change to alter amount of optimization - @${FIND} ${WRKSRC}/share/src/fpc-${PORTVERSION} -name \ - "Makefile*" | ${XARGS} ${REINPLACE_CMD} 's|-OG2p3|-OG2p1|g' - -do-build: - cd ${WRKSRC}/share/src/fpc-${PORTVERSION}/packages/base/inet && \ - ${GMAKE} ${MAKE_ENV} all - -do-install: - cd ${WRKSRC}/share/src/fpc-${PORTVERSION}/packages/base/inet && \ - ${GMAKE} ${MAKE_ENV} install - -.include <bsd.port.post.mk> diff --git a/net/fpc-inet/distinfo b/net/fpc-inet/distinfo deleted file mode 100644 index fb00975ada0c..000000000000 --- a/net/fpc-inet/distinfo +++ /dev/null @@ -1,3 +0,0 @@ -MD5 (fpc-1.0.10.ELF.tar) = 6ad56eb115152174683499da3ece7667 -SHA256 (fpc-1.0.10.ELF.tar) = 318bab9d1269dffcc5fe737d224fca939c5f130f34f12d166319b3d1ba776bfb -SIZE (fpc-1.0.10.ELF.tar) = 17448960 diff --git a/net/fpc-inet/pkg-descr b/net/fpc-inet/pkg-descr deleted file mode 100644 index 55ac2d4eb0c5..000000000000 --- a/net/fpc-inet/pkg-descr +++ /dev/null @@ -1,8 +0,0 @@ -Inet is part of the base packages of Free Pascal, a 32-bit -Turbo Pascal/Delphi compatible compiler. Inet provides -routines for internet programming. - -WWW: http://www.freepascal.org/ - --- -John Merryweather Cooper <coop9211@uidaho.edu> diff --git a/net/fpc-inet/pkg-plist b/net/fpc-inet/pkg-plist deleted file mode 100644 index 5eae3d0222f4..000000000000 --- a/net/fpc-inet/pkg-plist +++ /dev/null @@ -1,4 +0,0 @@ -lib/fpc/%%PORTVERSION%%/units/freebsd/inet/Package.fpc -lib/fpc/%%PORTVERSION%%/units/freebsd/inet/inet.o -lib/fpc/%%PORTVERSION%%/units/freebsd/inet/inet.ppu -@dirrm lib/fpc/%%PORTVERSION%%/units/freebsd/inet |