Fix GDB so that it can handle ELF core dumps.

This commit is contained in:
jdp 1998-09-14 22:49:02 +00:00
parent 1fe27d6671
commit 426b033aca
9 changed files with 97 additions and 15 deletions

View File

@ -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 \

View File

@ -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 */

View File

@ -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. */

View File

@ -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 */

View File

@ -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 */

View File

@ -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 */

View File

@ -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 \

View File

@ -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 */

View File

@ -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. */