1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-29 01:13:08 +00:00

Patches to get FreeBSD changes working with gdb-5.3.

This commit is contained in:
Mark Peek 2002-10-13 21:22:39 +00:00
parent 46723b1c08
commit 838ce26f5f
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=67988
45 changed files with 3260 additions and 4875 deletions

View File

@ -1,9 +1,10 @@
--- 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 @@
+++ 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
+ corelow.o core-regset.o alphabsd-nat.o freebsd-uthread.o kvm-fbsd.o
NAT_FILE= nm-fbsd.h
+NAT_CLIBS= -lkvm

View File

@ -0,0 +1,11 @@
--- gdb/config/alpha/nm-fbsd.h Tue Mar 6 00:21:21 2001
+++ gdb/config/alpha/nm-fbsd.h Sun Oct 13 12:23:51 2002
@@ -22,6 +22,8 @@
#ifndef NM_FBSD_H
#define NM_FBSD_H
+#include "config/nm-fbsd.h"
+
/* Type of the third argument to the `ptrace' system call. */
#define PTRACE_ARG3_TYPE caddr_t

View File

@ -1,8 +1,10 @@
--- 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 @@
--- gdb/config/i386/fbsd.mh Sat May 11 10:22:27 2002
+++ gdb/config/i386/fbsd.mh Sun Oct 13 11:50:47 2002
@@ -4,4 +4,6 @@
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
-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 i386bsd-nat.o i386fbsd-nat.o gcore.o fbsd-proc.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 i386bsd-nat.o i386fbsd-nat.o gcore.o fbsd-proc.o kvm-fbsd.o freebsd-uthread.o
+
+NAT_CLIBS= -lkvm

View File

@ -1,35 +1,10 @@
--- 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
--- gdb/config/i386/nm-fbsd.h Fri Jun 28 11:44:49 2002
+++ gdb/config/i386/nm-fbsd.h Sun Oct 13 10:53:27 2002
@@ -26,6 +26,7 @@
#define I386_USE_GENERIC_WATCHPOINTS
#endif
#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
+#include "config/nm-fbsd.h"
#include "i386/nm-i386.h"
#endif /* NM_FBSD_H */
#ifdef HAVE_SYS_PARAM_H

View File

@ -0,0 +1,34 @@
--- gdb/config/nm-fbsd.h Wed Dec 31 16:00:00 1969
+++ gdb/config/nm-fbsd.h Sun Oct 13 10:53:14 2002
@@ -0,0 +1,31 @@
+#ifndef CONFIG_NM_FBSD_H
+#define CONFIG_NM_FBSD_H
+
+extern int kernel_debugging;
+extern int kernel_writablecore;
+
+CORE_ADDR fbsd_kern_frame_saved_pc(struct frame_info *frame);
+
+#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 /* CONFIG_NM_FBSD_H */

View File

@ -1,8 +1,6 @@
$FreeBSD$
--- 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 @@
--- gdb/freebsd-uthread.c Wed Dec 31 16:00:00 1969
+++ gdb/freebsd-uthread.c Sun Oct 13 13:10:51 2002
@@ -0,0 +1,934 @@
+/* $FreeBSD$ */
+/* Low level interface for debugging FreeBSD user threads for GDB, the GNU debugger.
+ Copyright 1996, 1999 Free Software Foundation, Inc.
@ -42,6 +40,7 @@ $FreeBSD$
+#include <sys/queue.h>
+#include <signal.h>
+#include <setjmp.h>
+#include <string.h>
+#include "gdbthread.h"
+#include "target.h"
+#include "inferior.h"
@ -50,6 +49,7 @@ $FreeBSD$
+#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 */
@ -163,7 +163,7 @@ $FreeBSD$
+
+ LIST_FOREACH(im, &map_hash[h], link)
+ if (im->uniqueid == uniqueid)
+ return MERGEPID(PIDGET(inferior_ptid), im->tid);
+ return MERGEPID(PIDGET(inferior_ptid), im->tid);
+
+ im = xmalloc(sizeof(struct idmap));
+ im->uniqueid = uniqueid;
@ -413,9 +413,12 @@ $FreeBSD$
+ return rtnval;
+}
+
+/* XXX: this needs to be selected by target, not [build] host */
+#ifdef __i386__
+
+static char sigmap[MAX_NUM_REGS] = /* map reg to sigcontext */
+#include "i386-tdep.h"
+
+static char sigmap[I386_SSE_NUM_REGS] = /* map reg to sigcontext */
+{
+ 12, /* eax */
+ 11, /* ecx */
@ -439,7 +442,7 @@ $FreeBSD$
+ -1, /* mxcsr */
+};
+
+static char jmpmap[MAX_NUM_REGS] = /* map reg to jmp_buf */
+static char jmpmap[I386_SSE_NUM_REGS] = /* map reg to jmp_buf */
+{
+ 6, /* eax */
+ -1, /* ecx */
@ -467,7 +470,9 @@ $FreeBSD$
+
+#ifdef __alpha__
+
+static char sigmap[NUM_REGS] = /* map reg to sigcontext */
+#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 */
@ -479,7 +484,7 @@ $FreeBSD$
+ 62, 63, 64, 65, 66, 67, 68, 69, /* f24 - f31 */
+ 33, -1 /* pc, vfp */
+};
+static char jmpmap[NUM_REGS] = {
+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 */
@ -493,6 +498,18 @@ $FreeBSD$
+
+#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)
+{
@ -918,4 +935,3 @@ $FreeBSD$
+
+ child_suppress_run = 1;
+}

View File

@ -0,0 +1,12 @@
--- gdb+dejagnu-5.2.90_20021011/gdb/i386-tdep.c Mon Aug 26 11:35:25 2002
+++ newgdb/gdb/i386-tdep.c Sun Oct 13 14:15:58 2002
@@ -534,6 +534,9 @@
static CORE_ADDR
i386_frame_saved_pc (struct frame_info *frame)
{
+ if (kernel_debugging)
+ return fbsd_kern_frame_saved_pc(frame);
+
if (PC_IN_CALL_DUMMY (frame->pc, 0, 0))
return generic_read_register_dummy (frame->pc, frame->frame,
PC_REGNUM);

File diff suppressed because it is too large Load Diff

View File

@ -1,14 +1,11 @@
--- 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 @@
--- gdb/target.c Mon Aug 26 12:18:33 2002
+++ gdb/target.c Sun Oct 13 10:51:32 2002
@@ -1429,7 +1429,7 @@
for (t = target_structs; t < target_structs + target_struct_size;
++t)
{
+#if defined(__FreeBSD__) && defined(__i386__)
- if ((*t)->to_stratum == core_stratum)
+ if ((*t)->to_stratum == (kernel_debugging ? kcore_stratum : core_stratum))
+#else
if ((*t)->to_stratum == core_stratum)
+#endif
{
runable = *t;
++count;

View File

@ -1,9 +1,10 @@
--- 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 @@
+++ 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
+ corelow.o core-regset.o alphabsd-nat.o freebsd-uthread.o kvm-fbsd.o
NAT_FILE= nm-fbsd.h
+NAT_CLIBS= -lkvm

View File

@ -0,0 +1,11 @@
--- gdb/config/alpha/nm-fbsd.h Tue Mar 6 00:21:21 2001
+++ gdb/config/alpha/nm-fbsd.h Sun Oct 13 12:23:51 2002
@@ -22,6 +22,8 @@
#ifndef NM_FBSD_H
#define NM_FBSD_H
+#include "config/nm-fbsd.h"
+
/* Type of the third argument to the `ptrace' system call. */
#define PTRACE_ARG3_TYPE caddr_t

View File

@ -1,8 +1,10 @@
--- 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 @@
--- gdb/config/i386/fbsd.mh Sat May 11 10:22:27 2002
+++ gdb/config/i386/fbsd.mh Sun Oct 13 11:50:47 2002
@@ -4,4 +4,6 @@
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
-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 i386bsd-nat.o i386fbsd-nat.o gcore.o fbsd-proc.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 i386bsd-nat.o i386fbsd-nat.o gcore.o fbsd-proc.o kvm-fbsd.o freebsd-uthread.o
+
+NAT_CLIBS= -lkvm

View File

@ -1,35 +1,10 @@
--- 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
--- gdb/config/i386/nm-fbsd.h Fri Jun 28 11:44:49 2002
+++ gdb/config/i386/nm-fbsd.h Sun Oct 13 10:53:27 2002
@@ -26,6 +26,7 @@
#define I386_USE_GENERIC_WATCHPOINTS
#endif
#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
+#include "config/nm-fbsd.h"
#include "i386/nm-i386.h"
#endif /* NM_FBSD_H */
#ifdef HAVE_SYS_PARAM_H

View File

@ -0,0 +1,34 @@
--- gdb/config/nm-fbsd.h Wed Dec 31 16:00:00 1969
+++ gdb/config/nm-fbsd.h Sun Oct 13 10:53:14 2002
@@ -0,0 +1,31 @@
+#ifndef CONFIG_NM_FBSD_H
+#define CONFIG_NM_FBSD_H
+
+extern int kernel_debugging;
+extern int kernel_writablecore;
+
+CORE_ADDR fbsd_kern_frame_saved_pc(struct frame_info *frame);
+
+#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 /* CONFIG_NM_FBSD_H */

View File

@ -1,8 +1,6 @@
$FreeBSD$
--- 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 @@
--- gdb/freebsd-uthread.c Wed Dec 31 16:00:00 1969
+++ gdb/freebsd-uthread.c Sun Oct 13 13:10:51 2002
@@ -0,0 +1,934 @@
+/* $FreeBSD$ */
+/* Low level interface for debugging FreeBSD user threads for GDB, the GNU debugger.
+ Copyright 1996, 1999 Free Software Foundation, Inc.
@ -42,6 +40,7 @@ $FreeBSD$
+#include <sys/queue.h>
+#include <signal.h>
+#include <setjmp.h>
+#include <string.h>
+#include "gdbthread.h"
+#include "target.h"
+#include "inferior.h"
@ -50,6 +49,7 @@ $FreeBSD$
+#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 */
@ -163,7 +163,7 @@ $FreeBSD$
+
+ LIST_FOREACH(im, &map_hash[h], link)
+ if (im->uniqueid == uniqueid)
+ return MERGEPID(PIDGET(inferior_ptid), im->tid);
+ return MERGEPID(PIDGET(inferior_ptid), im->tid);
+
+ im = xmalloc(sizeof(struct idmap));
+ im->uniqueid = uniqueid;
@ -413,9 +413,12 @@ $FreeBSD$
+ return rtnval;
+}
+
+/* XXX: this needs to be selected by target, not [build] host */
+#ifdef __i386__
+
+static char sigmap[MAX_NUM_REGS] = /* map reg to sigcontext */
+#include "i386-tdep.h"
+
+static char sigmap[I386_SSE_NUM_REGS] = /* map reg to sigcontext */
+{
+ 12, /* eax */
+ 11, /* ecx */
@ -439,7 +442,7 @@ $FreeBSD$
+ -1, /* mxcsr */
+};
+
+static char jmpmap[MAX_NUM_REGS] = /* map reg to jmp_buf */
+static char jmpmap[I386_SSE_NUM_REGS] = /* map reg to jmp_buf */
+{
+ 6, /* eax */
+ -1, /* ecx */
@ -467,7 +470,9 @@ $FreeBSD$
+
+#ifdef __alpha__
+
+static char sigmap[NUM_REGS] = /* map reg to sigcontext */
+#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 */
@ -479,7 +484,7 @@ $FreeBSD$
+ 62, 63, 64, 65, 66, 67, 68, 69, /* f24 - f31 */
+ 33, -1 /* pc, vfp */
+};
+static char jmpmap[NUM_REGS] = {
+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 */
@ -493,6 +498,18 @@ $FreeBSD$
+
+#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)
+{
@ -918,4 +935,3 @@ $FreeBSD$
+
+ child_suppress_run = 1;
+}

View File

@ -1,9 +1,10 @@
--- 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 @@
+++ 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
+ corelow.o core-regset.o alphabsd-nat.o freebsd-uthread.o kvm-fbsd.o
NAT_FILE= nm-fbsd.h
+NAT_CLIBS= -lkvm

View File

@ -0,0 +1,11 @@
--- gdb/config/alpha/nm-fbsd.h Tue Mar 6 00:21:21 2001
+++ gdb/config/alpha/nm-fbsd.h Sun Oct 13 12:23:51 2002
@@ -22,6 +22,8 @@
#ifndef NM_FBSD_H
#define NM_FBSD_H
+#include "config/nm-fbsd.h"
+
/* Type of the third argument to the `ptrace' system call. */
#define PTRACE_ARG3_TYPE caddr_t

View File

@ -1,8 +1,10 @@
--- 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 @@
--- gdb/config/i386/fbsd.mh Sat May 11 10:22:27 2002
+++ gdb/config/i386/fbsd.mh Sun Oct 13 11:50:47 2002
@@ -4,4 +4,6 @@
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
-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 i386bsd-nat.o i386fbsd-nat.o gcore.o fbsd-proc.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 i386bsd-nat.o i386fbsd-nat.o gcore.o fbsd-proc.o kvm-fbsd.o freebsd-uthread.o
+
+NAT_CLIBS= -lkvm

View File

@ -1,35 +1,10 @@
--- 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
--- gdb/config/i386/nm-fbsd.h Fri Jun 28 11:44:49 2002
+++ gdb/config/i386/nm-fbsd.h Sun Oct 13 10:53:27 2002
@@ -26,6 +26,7 @@
#define I386_USE_GENERIC_WATCHPOINTS
#endif
#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
+#include "config/nm-fbsd.h"
#include "i386/nm-i386.h"
#endif /* NM_FBSD_H */
#ifdef HAVE_SYS_PARAM_H

View File

@ -0,0 +1,34 @@
--- gdb/config/nm-fbsd.h Wed Dec 31 16:00:00 1969
+++ gdb/config/nm-fbsd.h Sun Oct 13 10:53:14 2002
@@ -0,0 +1,31 @@
+#ifndef CONFIG_NM_FBSD_H
+#define CONFIG_NM_FBSD_H
+
+extern int kernel_debugging;
+extern int kernel_writablecore;
+
+CORE_ADDR fbsd_kern_frame_saved_pc(struct frame_info *frame);
+
+#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 /* CONFIG_NM_FBSD_H */

View File

@ -1,8 +1,6 @@
$FreeBSD$
--- 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 @@
--- gdb/freebsd-uthread.c Wed Dec 31 16:00:00 1969
+++ gdb/freebsd-uthread.c Sun Oct 13 13:10:51 2002
@@ -0,0 +1,934 @@
+/* $FreeBSD$ */
+/* Low level interface for debugging FreeBSD user threads for GDB, the GNU debugger.
+ Copyright 1996, 1999 Free Software Foundation, Inc.
@ -42,6 +40,7 @@ $FreeBSD$
+#include <sys/queue.h>
+#include <signal.h>
+#include <setjmp.h>
+#include <string.h>
+#include "gdbthread.h"
+#include "target.h"
+#include "inferior.h"
@ -50,6 +49,7 @@ $FreeBSD$
+#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 */
@ -163,7 +163,7 @@ $FreeBSD$
+
+ LIST_FOREACH(im, &map_hash[h], link)
+ if (im->uniqueid == uniqueid)
+ return MERGEPID(PIDGET(inferior_ptid), im->tid);
+ return MERGEPID(PIDGET(inferior_ptid), im->tid);
+
+ im = xmalloc(sizeof(struct idmap));
+ im->uniqueid = uniqueid;
@ -413,9 +413,12 @@ $FreeBSD$
+ return rtnval;
+}
+
+/* XXX: this needs to be selected by target, not [build] host */
+#ifdef __i386__
+
+static char sigmap[MAX_NUM_REGS] = /* map reg to sigcontext */
+#include "i386-tdep.h"
+
+static char sigmap[I386_SSE_NUM_REGS] = /* map reg to sigcontext */
+{
+ 12, /* eax */
+ 11, /* ecx */
@ -439,7 +442,7 @@ $FreeBSD$
+ -1, /* mxcsr */
+};
+
+static char jmpmap[MAX_NUM_REGS] = /* map reg to jmp_buf */
+static char jmpmap[I386_SSE_NUM_REGS] = /* map reg to jmp_buf */
+{
+ 6, /* eax */
+ -1, /* ecx */
@ -467,7 +470,9 @@ $FreeBSD$
+
+#ifdef __alpha__
+
+static char sigmap[NUM_REGS] = /* map reg to sigcontext */
+#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 */
@ -479,7 +484,7 @@ $FreeBSD$
+ 62, 63, 64, 65, 66, 67, 68, 69, /* f24 - f31 */
+ 33, -1 /* pc, vfp */
+};
+static char jmpmap[NUM_REGS] = {
+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 */
@ -493,6 +498,18 @@ $FreeBSD$
+
+#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)
+{
@ -918,4 +935,3 @@ $FreeBSD$
+
+ child_suppress_run = 1;
+}

View File

@ -0,0 +1,12 @@
--- gdb+dejagnu-5.2.90_20021011/gdb/i386-tdep.c Mon Aug 26 11:35:25 2002
+++ newgdb/gdb/i386-tdep.c Sun Oct 13 14:15:58 2002
@@ -534,6 +534,9 @@
static CORE_ADDR
i386_frame_saved_pc (struct frame_info *frame)
{
+ if (kernel_debugging)
+ return fbsd_kern_frame_saved_pc(frame);
+
if (PC_IN_CALL_DUMMY (frame->pc, 0, 0))
return generic_read_register_dummy (frame->pc, frame->frame,
PC_REGNUM);

File diff suppressed because it is too large Load Diff

View File

@ -1,14 +1,11 @@
--- 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 @@
--- gdb/target.c Mon Aug 26 12:18:33 2002
+++ gdb/target.c Sun Oct 13 10:51:32 2002
@@ -1429,7 +1429,7 @@
for (t = target_structs; t < target_structs + target_struct_size;
++t)
{
+#if defined(__FreeBSD__) && defined(__i386__)
- if ((*t)->to_stratum == core_stratum)
+ if ((*t)->to_stratum == (kernel_debugging ? kcore_stratum : core_stratum))
+#else
if ((*t)->to_stratum == core_stratum)
+#endif
{
runable = *t;
++count;

View File

@ -0,0 +1,12 @@
--- gdb+dejagnu-5.2.90_20021011/gdb/i386-tdep.c Mon Aug 26 11:35:25 2002
+++ newgdb/gdb/i386-tdep.c Sun Oct 13 14:15:58 2002
@@ -534,6 +534,9 @@
static CORE_ADDR
i386_frame_saved_pc (struct frame_info *frame)
{
+ if (kernel_debugging)
+ return fbsd_kern_frame_saved_pc(frame);
+
if (PC_IN_CALL_DUMMY (frame->pc, 0, 0))
return generic_read_register_dummy (frame->pc, frame->frame,
PC_REGNUM);

File diff suppressed because it is too large Load Diff

View File

@ -1,14 +1,11 @@
--- 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 @@
--- gdb/target.c Mon Aug 26 12:18:33 2002
+++ gdb/target.c Sun Oct 13 10:51:32 2002
@@ -1429,7 +1429,7 @@
for (t = target_structs; t < target_structs + target_struct_size;
++t)
{
+#if defined(__FreeBSD__) && defined(__i386__)
- if ((*t)->to_stratum == core_stratum)
+ if ((*t)->to_stratum == (kernel_debugging ? kcore_stratum : core_stratum))
+#else
if ((*t)->to_stratum == core_stratum)
+#endif
{
runable = *t;
++count;

View File

@ -1,9 +1,10 @@
--- 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 @@
+++ 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
+ corelow.o core-regset.o alphabsd-nat.o freebsd-uthread.o kvm-fbsd.o
NAT_FILE= nm-fbsd.h
+NAT_CLIBS= -lkvm

View File

@ -0,0 +1,11 @@
--- gdb/config/alpha/nm-fbsd.h Tue Mar 6 00:21:21 2001
+++ gdb/config/alpha/nm-fbsd.h Sun Oct 13 12:23:51 2002
@@ -22,6 +22,8 @@
#ifndef NM_FBSD_H
#define NM_FBSD_H
+#include "config/nm-fbsd.h"
+
/* Type of the third argument to the `ptrace' system call. */
#define PTRACE_ARG3_TYPE caddr_t

View File

@ -1,8 +1,10 @@
--- 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 @@
--- gdb/config/i386/fbsd.mh Sat May 11 10:22:27 2002
+++ gdb/config/i386/fbsd.mh Sun Oct 13 11:50:47 2002
@@ -4,4 +4,6 @@
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
-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 i386bsd-nat.o i386fbsd-nat.o gcore.o fbsd-proc.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 i386bsd-nat.o i386fbsd-nat.o gcore.o fbsd-proc.o kvm-fbsd.o freebsd-uthread.o
+
+NAT_CLIBS= -lkvm

View File

@ -1,35 +1,10 @@
--- 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
--- gdb/config/i386/nm-fbsd.h Fri Jun 28 11:44:49 2002
+++ gdb/config/i386/nm-fbsd.h Sun Oct 13 10:53:27 2002
@@ -26,6 +26,7 @@
#define I386_USE_GENERIC_WATCHPOINTS
#endif
#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
+#include "config/nm-fbsd.h"
#include "i386/nm-i386.h"
#endif /* NM_FBSD_H */
#ifdef HAVE_SYS_PARAM_H

View File

@ -0,0 +1,34 @@
--- gdb/config/nm-fbsd.h Wed Dec 31 16:00:00 1969
+++ gdb/config/nm-fbsd.h Sun Oct 13 10:53:14 2002
@@ -0,0 +1,31 @@
+#ifndef CONFIG_NM_FBSD_H
+#define CONFIG_NM_FBSD_H
+
+extern int kernel_debugging;
+extern int kernel_writablecore;
+
+CORE_ADDR fbsd_kern_frame_saved_pc(struct frame_info *frame);
+
+#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 /* CONFIG_NM_FBSD_H */

View File

@ -1,8 +1,6 @@
$FreeBSD$
--- 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 @@
--- gdb/freebsd-uthread.c Wed Dec 31 16:00:00 1969
+++ gdb/freebsd-uthread.c Sun Oct 13 13:10:51 2002
@@ -0,0 +1,934 @@
+/* $FreeBSD$ */
+/* Low level interface for debugging FreeBSD user threads for GDB, the GNU debugger.
+ Copyright 1996, 1999 Free Software Foundation, Inc.
@ -42,6 +40,7 @@ $FreeBSD$
+#include <sys/queue.h>
+#include <signal.h>
+#include <setjmp.h>
+#include <string.h>
+#include "gdbthread.h"
+#include "target.h"
+#include "inferior.h"
@ -50,6 +49,7 @@ $FreeBSD$
+#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 */
@ -163,7 +163,7 @@ $FreeBSD$
+
+ LIST_FOREACH(im, &map_hash[h], link)
+ if (im->uniqueid == uniqueid)
+ return MERGEPID(PIDGET(inferior_ptid), im->tid);
+ return MERGEPID(PIDGET(inferior_ptid), im->tid);
+
+ im = xmalloc(sizeof(struct idmap));
+ im->uniqueid = uniqueid;
@ -413,9 +413,12 @@ $FreeBSD$
+ return rtnval;
+}
+
+/* XXX: this needs to be selected by target, not [build] host */
+#ifdef __i386__
+
+static char sigmap[MAX_NUM_REGS] = /* map reg to sigcontext */
+#include "i386-tdep.h"
+
+static char sigmap[I386_SSE_NUM_REGS] = /* map reg to sigcontext */
+{
+ 12, /* eax */
+ 11, /* ecx */
@ -439,7 +442,7 @@ $FreeBSD$
+ -1, /* mxcsr */
+};
+
+static char jmpmap[MAX_NUM_REGS] = /* map reg to jmp_buf */
+static char jmpmap[I386_SSE_NUM_REGS] = /* map reg to jmp_buf */
+{
+ 6, /* eax */
+ -1, /* ecx */
@ -467,7 +470,9 @@ $FreeBSD$
+
+#ifdef __alpha__
+
+static char sigmap[NUM_REGS] = /* map reg to sigcontext */
+#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 */
@ -479,7 +484,7 @@ $FreeBSD$
+ 62, 63, 64, 65, 66, 67, 68, 69, /* f24 - f31 */
+ 33, -1 /* pc, vfp */
+};
+static char jmpmap[NUM_REGS] = {
+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 */
@ -493,6 +498,18 @@ $FreeBSD$
+
+#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)
+{
@ -918,4 +935,3 @@ $FreeBSD$
+
+ child_suppress_run = 1;
+}

View File

@ -1,9 +1,10 @@
--- 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 @@
+++ 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
+ corelow.o core-regset.o alphabsd-nat.o freebsd-uthread.o kvm-fbsd.o
NAT_FILE= nm-fbsd.h
+NAT_CLIBS= -lkvm

View File

@ -0,0 +1,11 @@
--- gdb/config/alpha/nm-fbsd.h Tue Mar 6 00:21:21 2001
+++ gdb/config/alpha/nm-fbsd.h Sun Oct 13 12:23:51 2002
@@ -22,6 +22,8 @@
#ifndef NM_FBSD_H
#define NM_FBSD_H
+#include "config/nm-fbsd.h"
+
/* Type of the third argument to the `ptrace' system call. */
#define PTRACE_ARG3_TYPE caddr_t

View File

@ -1,8 +1,10 @@
--- 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 @@
--- gdb/config/i386/fbsd.mh Sat May 11 10:22:27 2002
+++ gdb/config/i386/fbsd.mh Sun Oct 13 11:50:47 2002
@@ -4,4 +4,6 @@
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
-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 i386bsd-nat.o i386fbsd-nat.o gcore.o fbsd-proc.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 i386bsd-nat.o i386fbsd-nat.o gcore.o fbsd-proc.o kvm-fbsd.o freebsd-uthread.o
+
+NAT_CLIBS= -lkvm

View File

@ -1,35 +1,10 @@
--- 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
--- gdb/config/i386/nm-fbsd.h Fri Jun 28 11:44:49 2002
+++ gdb/config/i386/nm-fbsd.h Sun Oct 13 10:53:27 2002
@@ -26,6 +26,7 @@
#define I386_USE_GENERIC_WATCHPOINTS
#endif
#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
+#include "config/nm-fbsd.h"
#include "i386/nm-i386.h"
#endif /* NM_FBSD_H */
#ifdef HAVE_SYS_PARAM_H

View File

@ -0,0 +1,34 @@
--- gdb/config/nm-fbsd.h Wed Dec 31 16:00:00 1969
+++ gdb/config/nm-fbsd.h Sun Oct 13 10:53:14 2002
@@ -0,0 +1,31 @@
+#ifndef CONFIG_NM_FBSD_H
+#define CONFIG_NM_FBSD_H
+
+extern int kernel_debugging;
+extern int kernel_writablecore;
+
+CORE_ADDR fbsd_kern_frame_saved_pc(struct frame_info *frame);
+
+#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 /* CONFIG_NM_FBSD_H */

View File

@ -1,8 +1,6 @@
$FreeBSD$
--- 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 @@
--- gdb/freebsd-uthread.c Wed Dec 31 16:00:00 1969
+++ gdb/freebsd-uthread.c Sun Oct 13 13:10:51 2002
@@ -0,0 +1,934 @@
+/* $FreeBSD$ */
+/* Low level interface for debugging FreeBSD user threads for GDB, the GNU debugger.
+ Copyright 1996, 1999 Free Software Foundation, Inc.
@ -42,6 +40,7 @@ $FreeBSD$
+#include <sys/queue.h>
+#include <signal.h>
+#include <setjmp.h>
+#include <string.h>
+#include "gdbthread.h"
+#include "target.h"
+#include "inferior.h"
@ -50,6 +49,7 @@ $FreeBSD$
+#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 */
@ -163,7 +163,7 @@ $FreeBSD$
+
+ LIST_FOREACH(im, &map_hash[h], link)
+ if (im->uniqueid == uniqueid)
+ return MERGEPID(PIDGET(inferior_ptid), im->tid);
+ return MERGEPID(PIDGET(inferior_ptid), im->tid);
+
+ im = xmalloc(sizeof(struct idmap));
+ im->uniqueid = uniqueid;
@ -413,9 +413,12 @@ $FreeBSD$
+ return rtnval;
+}
+
+/* XXX: this needs to be selected by target, not [build] host */
+#ifdef __i386__
+
+static char sigmap[MAX_NUM_REGS] = /* map reg to sigcontext */
+#include "i386-tdep.h"
+
+static char sigmap[I386_SSE_NUM_REGS] = /* map reg to sigcontext */
+{
+ 12, /* eax */
+ 11, /* ecx */
@ -439,7 +442,7 @@ $FreeBSD$
+ -1, /* mxcsr */
+};
+
+static char jmpmap[MAX_NUM_REGS] = /* map reg to jmp_buf */
+static char jmpmap[I386_SSE_NUM_REGS] = /* map reg to jmp_buf */
+{
+ 6, /* eax */
+ -1, /* ecx */
@ -467,7 +470,9 @@ $FreeBSD$
+
+#ifdef __alpha__
+
+static char sigmap[NUM_REGS] = /* map reg to sigcontext */
+#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 */
@ -479,7 +484,7 @@ $FreeBSD$
+ 62, 63, 64, 65, 66, 67, 68, 69, /* f24 - f31 */
+ 33, -1 /* pc, vfp */
+};
+static char jmpmap[NUM_REGS] = {
+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 */
@ -493,6 +498,18 @@ $FreeBSD$
+
+#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)
+{
@ -918,4 +935,3 @@ $FreeBSD$
+
+ child_suppress_run = 1;
+}

View File

@ -0,0 +1,12 @@
--- gdb+dejagnu-5.2.90_20021011/gdb/i386-tdep.c Mon Aug 26 11:35:25 2002
+++ newgdb/gdb/i386-tdep.c Sun Oct 13 14:15:58 2002
@@ -534,6 +534,9 @@
static CORE_ADDR
i386_frame_saved_pc (struct frame_info *frame)
{
+ if (kernel_debugging)
+ return fbsd_kern_frame_saved_pc(frame);
+
if (PC_IN_CALL_DUMMY (frame->pc, 0, 0))
return generic_read_register_dummy (frame->pc, frame->frame,
PC_REGNUM);

File diff suppressed because it is too large Load Diff

View File

@ -1,14 +1,11 @@
--- 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 @@
--- gdb/target.c Mon Aug 26 12:18:33 2002
+++ gdb/target.c Sun Oct 13 10:51:32 2002
@@ -1429,7 +1429,7 @@
for (t = target_structs; t < target_structs + target_struct_size;
++t)
{
+#if defined(__FreeBSD__) && defined(__i386__)
- if ((*t)->to_stratum == core_stratum)
+ if ((*t)->to_stratum == (kernel_debugging ? kcore_stratum : core_stratum))
+#else
if ((*t)->to_stratum == core_stratum)
+#endif
{
runable = *t;
++count;

View File

@ -0,0 +1,12 @@
--- gdb+dejagnu-5.2.90_20021011/gdb/i386-tdep.c Mon Aug 26 11:35:25 2002
+++ newgdb/gdb/i386-tdep.c Sun Oct 13 14:15:58 2002
@@ -534,6 +534,9 @@
static CORE_ADDR
i386_frame_saved_pc (struct frame_info *frame)
{
+ if (kernel_debugging)
+ return fbsd_kern_frame_saved_pc(frame);
+
if (PC_IN_CALL_DUMMY (frame->pc, 0, 0))
return generic_read_register_dummy (frame->pc, frame->frame,
PC_REGNUM);

File diff suppressed because it is too large Load Diff

View File

@ -1,14 +1,11 @@
--- 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 @@
--- gdb/target.c Mon Aug 26 12:18:33 2002
+++ gdb/target.c Sun Oct 13 10:51:32 2002
@@ -1429,7 +1429,7 @@
for (t = target_structs; t < target_structs + target_struct_size;
++t)
{
+#if defined(__FreeBSD__) && defined(__i386__)
- if ((*t)->to_stratum == core_stratum)
+ if ((*t)->to_stratum == (kernel_debugging ? kcore_stratum : core_stratum))
+#else
if ((*t)->to_stratum == core_stratum)
+#endif
{
runable = *t;
++count;