summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjdp <jdp@FreeBSD.org>1998-09-14 22:49:02 +0000
committerjdp <jdp@FreeBSD.org>1998-09-14 22:49:02 +0000
commitfc9aaf05cb202389253e68adb663bc897e276ac6 (patch)
tree8dc51b50eb4a56f1b0a27bcb451669fbf1c59f7e
parent1dd90694f47793b9c96c46d0934e76c50b6e78ca (diff)
downloadFreeBSD-src-fc9aaf05cb202389253e68adb663bc897e276ac6.zip
FreeBSD-src-fc9aaf05cb202389253e68adb663bc897e276ac6.tar.gz
Fix GDB so that it can handle ELF core dumps.
-rw-r--r--gnu/usr.bin/binutils/gdb/Makefile4
-rw-r--r--gnu/usr.bin/binutils/gdb/config.h6
-rw-r--r--gnu/usr.bin/binutils/gdb/i386/freebsd-nat.c43
-rw-r--r--gnu/usr.bin/binutils/libbfd/alpha/config.h2
-rw-r--r--gnu/usr.bin/binutils/libbfd/i386/config.h2
-rw-r--r--gnu/usr.bin/gdb/bfd/config.h2
-rw-r--r--gnu/usr.bin/gdb/gdb/Makefile4
-rw-r--r--gnu/usr.bin/gdb/gdb/config.h6
-rw-r--r--gnu/usr.bin/gdb/gdb/freebsd-nat.c43
9 files changed, 97 insertions, 15 deletions
diff --git a/gnu/usr.bin/binutils/gdb/Makefile b/gnu/usr.bin/binutils/gdb/Makefile
index 640f1cc..b4a2442 100644
--- a/gnu/usr.bin/binutils/gdb/Makefile
+++ b/gnu/usr.bin/binutils/gdb/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.35 1998/08/30 02:01:07 jb Exp $
+# $Id: Makefile,v 1.36 1998/08/30 02:46:35 jb Exp $
PROG = gdb
@@ -18,7 +18,7 @@ CFLAGS+= -DFREEBSD_ELF
XSRCS = annotate.c blockframe.c breakpoint.c buildsym.c c-lang.c \
c-typeprint.c c-valprint.c ch-lang.c ch-typeprint.c \
ch-valprint.c coffread.c command.c complaints.c copying.c \
- corelow.c cp-valprint.c \
+ core-regset.c corelow.c cp-valprint.c \
dcache.c dbxread.c demangle.c dwarfread.c \
elfread.c environ.c eval.c exec.c expprint.c \
findvar.c fork-child.c freebsd-nat.c gdbtypes.c \
diff --git a/gnu/usr.bin/binutils/gdb/config.h b/gnu/usr.bin/binutils/gdb/config.h
index 29f0a3c..6010886 100644
--- a/gnu/usr.bin/binutils/gdb/config.h
+++ b/gnu/usr.bin/binutils/gdb/config.h
@@ -31,10 +31,10 @@
#define STDC_HEADERS 1
/* Define if fpregset_t type is available. */
-/* #undef HAVE_FPREGSET_T */
+#define HAVE_FPREGSET_T 1
/* Define if gregset_t type is available. */
-/* #undef HAVE_GREGSET_T */
+#define HAVE_GREGSET_T 1
/* Define if the "%Lg" format works to print long doubles. */
#define PRINTF_HAS_LONG_DOUBLE 1
@@ -76,7 +76,7 @@
#define HAVE_STRINGS_H 1
/* Define if you have the <sys/procfs.h> header file. */
-/* #undef HAVE_SYS_PROCFS_H */
+#define HAVE_SYS_PROCFS_H 1
/* Define if you have the <termio.h> header file. */
/* #undef HAVE_TERMIO_H */
diff --git a/gnu/usr.bin/binutils/gdb/i386/freebsd-nat.c b/gnu/usr.bin/binutils/gdb/i386/freebsd-nat.c
index e73f402..1c926cb 100644
--- a/gnu/usr.bin/binutils/gdb/i386/freebsd-nat.c
+++ b/gnu/usr.bin/binutils/gdb/i386/freebsd-nat.c
@@ -29,6 +29,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "value.h"
#include "inferior.h"
+#if defined(HAVE_GREGSET_T) || defined(HAVE_FPREGSET_T)
+#include <sys/procfs.h>
+#endif
+
/* this table must line up with REGISTER_NAMES in tm-i386v.h */
/* symbols like 'tEAX' come from <machine/reg.h> */
static int tregmap[] =
@@ -341,7 +345,7 @@ i386_float_info ()
extern int inferior_pid;
uaddr = (char *)&U_FPSTATE(u) - (char *)&u;
- if (inferior_pid)
+ if (inferior_pid != 0 && core_bfd == NULL)
{
int *ip;
@@ -384,6 +388,43 @@ setup_arbitrary_frame (argc, argv)
return create_new_frame (argv[0], argv[1]);
}
#endif /* SETUP_ARBITRARY_FRAME */
+
+#ifdef HAVE_GREGSET_T
+void
+supply_gregset (gp)
+ gregset_t *gp;
+{
+ int regno = 0;
+
+ /* These must be ordered the same as REGISTER_NAMES in
+ config/i386/tm-i386.h. */
+ supply_register (regno++, (char *)&gp->r_eax);
+ supply_register (regno++, (char *)&gp->r_ecx);
+ supply_register (regno++, (char *)&gp->r_edx);
+ supply_register (regno++, (char *)&gp->r_ebx);
+ supply_register (regno++, (char *)&gp->r_esp);
+ supply_register (regno++, (char *)&gp->r_ebp);
+ supply_register (regno++, (char *)&gp->r_esi);
+ supply_register (regno++, (char *)&gp->r_edi);
+ supply_register (regno++, (char *)&gp->r_eip);
+ supply_register (regno++, (char *)&gp->r_eflags);
+ supply_register (regno++, (char *)&gp->r_cs);
+ supply_register (regno++, (char *)&gp->r_ss);
+ supply_register (regno++, (char *)&gp->r_ds);
+ supply_register (regno++, (char *)&gp->r_es);
+ supply_register (regno++, (char *)&gp->r_fs);
+ supply_register (regno++, (char *)&gp->r_gs);
+}
+#endif /* HAVE_GREGSET_T */
+
+#ifdef HAVE_FPREGSET_T
+void
+supply_fpregset (fp)
+ fpregset_t *fp;
+{
+ memcpy (&pcb_savefpu, fp, sizeof pcb_savefpu);
+}
+#endif /* HAVE_FPREGSET_T */
/* Register that we are able to handle aout (trad-core) file formats. */
diff --git a/gnu/usr.bin/binutils/libbfd/alpha/config.h b/gnu/usr.bin/binutils/libbfd/alpha/config.h
index dcea308..b14ec9f 100644
--- a/gnu/usr.bin/binutils/libbfd/alpha/config.h
+++ b/gnu/usr.bin/binutils/libbfd/alpha/config.h
@@ -38,7 +38,7 @@
/* #undef TRAD_HEADER */
/* Define only if <sys/procfs.h> is available *and* it defines prstatus_t. */
-/* #undef HAVE_SYS_PROCFS_H */
+#define HAVE_SYS_PROCFS_H 1
/* Do we really want to use mmap if it's available? */
/* #undef USE_MMAP */
diff --git a/gnu/usr.bin/binutils/libbfd/i386/config.h b/gnu/usr.bin/binutils/libbfd/i386/config.h
index 0dc9970..1e1ede9 100644
--- a/gnu/usr.bin/binutils/libbfd/i386/config.h
+++ b/gnu/usr.bin/binutils/libbfd/i386/config.h
@@ -38,7 +38,7 @@
#define TRAD_HEADER "hosts/i386bsd.h"
/* Define only if <sys/procfs.h> is available *and* it defines prstatus_t. */
-/* #undef HAVE_SYS_PROCFS_H */
+#define HAVE_SYS_PROCFS_H 1
/* Do we really want to use mmap if it's available? */
/* #undef USE_MMAP */
diff --git a/gnu/usr.bin/gdb/bfd/config.h b/gnu/usr.bin/gdb/bfd/config.h
index e039382..20406d4 100644
--- a/gnu/usr.bin/gdb/bfd/config.h
+++ b/gnu/usr.bin/gdb/bfd/config.h
@@ -20,7 +20,7 @@
#define TRAD_HEADER "i386freebsd.h"
/* Define only if <sys/procfs.h> is available *and* it defines prstatus_t. */
-/* #undef HAVE_SYS_PROCFS_H */
+#define HAVE_SYS_PROCFS_H 1
/* Do we really want to use mmap if it's available? */
/* #undef USE_MMAP */
diff --git a/gnu/usr.bin/gdb/gdb/Makefile b/gnu/usr.bin/gdb/gdb/Makefile
index 640f1cc..b4a2442 100644
--- a/gnu/usr.bin/gdb/gdb/Makefile
+++ b/gnu/usr.bin/gdb/gdb/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.35 1998/08/30 02:01:07 jb Exp $
+# $Id: Makefile,v 1.36 1998/08/30 02:46:35 jb Exp $
PROG = gdb
@@ -18,7 +18,7 @@ CFLAGS+= -DFREEBSD_ELF
XSRCS = annotate.c blockframe.c breakpoint.c buildsym.c c-lang.c \
c-typeprint.c c-valprint.c ch-lang.c ch-typeprint.c \
ch-valprint.c coffread.c command.c complaints.c copying.c \
- corelow.c cp-valprint.c \
+ core-regset.c corelow.c cp-valprint.c \
dcache.c dbxread.c demangle.c dwarfread.c \
elfread.c environ.c eval.c exec.c expprint.c \
findvar.c fork-child.c freebsd-nat.c gdbtypes.c \
diff --git a/gnu/usr.bin/gdb/gdb/config.h b/gnu/usr.bin/gdb/gdb/config.h
index 29f0a3c..6010886 100644
--- a/gnu/usr.bin/gdb/gdb/config.h
+++ b/gnu/usr.bin/gdb/gdb/config.h
@@ -31,10 +31,10 @@
#define STDC_HEADERS 1
/* Define if fpregset_t type is available. */
-/* #undef HAVE_FPREGSET_T */
+#define HAVE_FPREGSET_T 1
/* Define if gregset_t type is available. */
-/* #undef HAVE_GREGSET_T */
+#define HAVE_GREGSET_T 1
/* Define if the "%Lg" format works to print long doubles. */
#define PRINTF_HAS_LONG_DOUBLE 1
@@ -76,7 +76,7 @@
#define HAVE_STRINGS_H 1
/* Define if you have the <sys/procfs.h> header file. */
-/* #undef HAVE_SYS_PROCFS_H */
+#define HAVE_SYS_PROCFS_H 1
/* Define if you have the <termio.h> header file. */
/* #undef HAVE_TERMIO_H */
diff --git a/gnu/usr.bin/gdb/gdb/freebsd-nat.c b/gnu/usr.bin/gdb/gdb/freebsd-nat.c
index e73f402..1c926cb 100644
--- a/gnu/usr.bin/gdb/gdb/freebsd-nat.c
+++ b/gnu/usr.bin/gdb/gdb/freebsd-nat.c
@@ -29,6 +29,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "value.h"
#include "inferior.h"
+#if defined(HAVE_GREGSET_T) || defined(HAVE_FPREGSET_T)
+#include <sys/procfs.h>
+#endif
+
/* this table must line up with REGISTER_NAMES in tm-i386v.h */
/* symbols like 'tEAX' come from <machine/reg.h> */
static int tregmap[] =
@@ -341,7 +345,7 @@ i386_float_info ()
extern int inferior_pid;
uaddr = (char *)&U_FPSTATE(u) - (char *)&u;
- if (inferior_pid)
+ if (inferior_pid != 0 && core_bfd == NULL)
{
int *ip;
@@ -384,6 +388,43 @@ setup_arbitrary_frame (argc, argv)
return create_new_frame (argv[0], argv[1]);
}
#endif /* SETUP_ARBITRARY_FRAME */
+
+#ifdef HAVE_GREGSET_T
+void
+supply_gregset (gp)
+ gregset_t *gp;
+{
+ int regno = 0;
+
+ /* These must be ordered the same as REGISTER_NAMES in
+ config/i386/tm-i386.h. */
+ supply_register (regno++, (char *)&gp->r_eax);
+ supply_register (regno++, (char *)&gp->r_ecx);
+ supply_register (regno++, (char *)&gp->r_edx);
+ supply_register (regno++, (char *)&gp->r_ebx);
+ supply_register (regno++, (char *)&gp->r_esp);
+ supply_register (regno++, (char *)&gp->r_ebp);
+ supply_register (regno++, (char *)&gp->r_esi);
+ supply_register (regno++, (char *)&gp->r_edi);
+ supply_register (regno++, (char *)&gp->r_eip);
+ supply_register (regno++, (char *)&gp->r_eflags);
+ supply_register (regno++, (char *)&gp->r_cs);
+ supply_register (regno++, (char *)&gp->r_ss);
+ supply_register (regno++, (char *)&gp->r_ds);
+ supply_register (regno++, (char *)&gp->r_es);
+ supply_register (regno++, (char *)&gp->r_fs);
+ supply_register (regno++, (char *)&gp->r_gs);
+}
+#endif /* HAVE_GREGSET_T */
+
+#ifdef HAVE_FPREGSET_T
+void
+supply_fpregset (fp)
+ fpregset_t *fp;
+{
+ memcpy (&pcb_savefpu, fp, sizeof pcb_savefpu);
+}
+#endif /* HAVE_FPREGSET_T */
/* Register that we are able to handle aout (trad-core) file formats. */
OpenPOWER on IntegriCloud