Merge alpha support from src/gnu/dist. Doesn't necessarily build or work
yet, but enough to get "configure" working at this stage.
This commit is contained in:
parent
811d7372d5
commit
f8e299ca7c
246
gnu/dist/toolchain/gdb/alphanbsd-nat.c
vendored
Normal file
246
gnu/dist/toolchain/gdb/alphanbsd-nat.c
vendored
Normal file
@ -0,0 +1,246 @@
|
|||||||
|
/* Low level Alpha interface, for GDB when running native.
|
||||||
|
Copyright 1993, 1995, 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.
|
||||||
|
|
||||||
|
This file was developed by Gordon W. Ross <gwr@netbsd.org>
|
||||||
|
as a derivation from alpha-nat.c and m68knbsd-nat.c. */
|
||||||
|
|
||||||
|
#include "defs.h"
|
||||||
|
#include "inferior.h"
|
||||||
|
#include "gdbcore.h"
|
||||||
|
#include "target.h"
|
||||||
|
#include <sys/ptrace.h>
|
||||||
|
#include <sys/param.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/time.h>
|
||||||
|
#include <sys/proc.h>
|
||||||
|
#include <machine/reg.h>
|
||||||
|
#include <machine/frame.h>
|
||||||
|
#include <machine/pcb.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
/* Size of elements in jmpbuf */
|
||||||
|
|
||||||
|
#define JB_ELEMENT_SIZE 8
|
||||||
|
|
||||||
|
/* The definition for JB_PC in machine/reg.h is wrong.
|
||||||
|
And we can't get at the correct definition in setjmp.h as it is
|
||||||
|
not always available (eg. if _POSIX_SOURCE is defined which is the
|
||||||
|
default). As the defintion is unlikely to change (see comment
|
||||||
|
in <setjmp.h>, define the correct value here. */
|
||||||
|
|
||||||
|
#undef JB_PC
|
||||||
|
#define JB_PC 2
|
||||||
|
|
||||||
|
/* Figure out where the longjmp will land.
|
||||||
|
We expect the first arg to be a pointer to the jmp_buf structure from which
|
||||||
|
we extract the pc (JB_PC) that we will land at. The pc is copied into PC.
|
||||||
|
This routine returns true on success. */
|
||||||
|
|
||||||
|
int
|
||||||
|
get_longjmp_target (pc)
|
||||||
|
CORE_ADDR *pc;
|
||||||
|
{
|
||||||
|
CORE_ADDR jb_addr;
|
||||||
|
char raw_buffer[MAX_REGISTER_RAW_SIZE];
|
||||||
|
|
||||||
|
jb_addr = read_register(A0_REGNUM);
|
||||||
|
|
||||||
|
if (target_read_memory(jb_addr + JB_PC * JB_ELEMENT_SIZE, raw_buffer,
|
||||||
|
sizeof(CORE_ADDR)))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
*pc = extract_address (raw_buffer, sizeof(CORE_ADDR));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Extract the register values out of the core file and store
|
||||||
|
them where `read_register' will find them.
|
||||||
|
|
||||||
|
CORE_REG_SECT points to the register values themselves, read into memory.
|
||||||
|
CORE_REG_SIZE is the size of that area.
|
||||||
|
WHICH says which set of registers we are handling (0 = int, 2 = float
|
||||||
|
on machines where they are discontiguous).
|
||||||
|
REG_ADDR is the offset from u.u_ar0 to the register values relative to
|
||||||
|
core_reg_sect. This is used with old-fashioned core files to
|
||||||
|
locate the registers in a large upage-plus-stack ".reg" section.
|
||||||
|
Original upage address X is at location core_reg_sect+x+reg_addr.
|
||||||
|
*/
|
||||||
|
|
||||||
|
static void
|
||||||
|
fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
|
||||||
|
char *core_reg_sect;
|
||||||
|
unsigned core_reg_size;
|
||||||
|
int which;
|
||||||
|
unsigned reg_addr;
|
||||||
|
{
|
||||||
|
struct md_coredump *core_reg;
|
||||||
|
struct trapframe *tf;
|
||||||
|
struct fpreg *fs;
|
||||||
|
register int regnum;
|
||||||
|
|
||||||
|
/* Table to map a gdb regnum to an index in the trapframe regs. */
|
||||||
|
static int core_reg_mapping[ZERO_REGNUM] = {
|
||||||
|
FRAME_V0, FRAME_T0, FRAME_T1, FRAME_T2,
|
||||||
|
FRAME_T3, FRAME_T4, FRAME_T5, FRAME_T6,
|
||||||
|
FRAME_T7, FRAME_S0, FRAME_S1, FRAME_S2,
|
||||||
|
FRAME_S3, FRAME_S4, FRAME_S5, FRAME_S6,
|
||||||
|
FRAME_A0, FRAME_A1, FRAME_A2, FRAME_A3,
|
||||||
|
FRAME_A4, FRAME_A5, FRAME_T8, FRAME_T9,
|
||||||
|
FRAME_T10, FRAME_T11, FRAME_RA, FRAME_T12,
|
||||||
|
FRAME_AT, FRAME_GP, FRAME_SP };
|
||||||
|
|
||||||
|
/* We get everything from the .reg section. */
|
||||||
|
if (which != 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
core_reg = (struct md_coredump *)core_reg_sect;
|
||||||
|
tf = &core_reg->md_tf;
|
||||||
|
fs = &core_reg->md_fpstate;
|
||||||
|
|
||||||
|
if (core_reg_size < sizeof(*core_reg)) {
|
||||||
|
fprintf_unfiltered (gdb_stderr, "Couldn't read regs from core file\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Integer registers */
|
||||||
|
for (regnum = 0; regnum < ZERO_REGNUM; regnum++)
|
||||||
|
*(long *) ®isters[REGISTER_BYTE (regnum)] = tf->tf_regs[regnum];
|
||||||
|
*(long *) ®isters[REGISTER_BYTE (ZERO_REGNUM)] = 0;
|
||||||
|
|
||||||
|
/* Floating point registers */
|
||||||
|
memcpy (®isters[REGISTER_BYTE (FP0_REGNUM)],
|
||||||
|
&fs->fpr_regs[0], sizeof(fs->fpr_regs));
|
||||||
|
|
||||||
|
/* Special registers (PC, VFP) */
|
||||||
|
*(long *) ®isters[REGISTER_BYTE (PC_REGNUM)] = tf->tf_regs[FRAME_PC];
|
||||||
|
*(long *) ®isters[REGISTER_BYTE (FP_REGNUM)] = 0;
|
||||||
|
|
||||||
|
registers_fetched ();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
fetch_inferior_registers (regno)
|
||||||
|
int regno;
|
||||||
|
{
|
||||||
|
struct reg inferior_registers;
|
||||||
|
struct fpreg inferior_fp_registers;
|
||||||
|
|
||||||
|
/* Integer registers */
|
||||||
|
ptrace (PT_GETREGS, inferior_pid,
|
||||||
|
(PTRACE_ARG3_TYPE) &inferior_registers, 0);
|
||||||
|
/* The PC travels in the R_ZERO slot. */
|
||||||
|
*(long *) ®isters[REGISTER_BYTE (PC_REGNUM)] =
|
||||||
|
inferior_registers.r_regs[R_ZERO];
|
||||||
|
inferior_registers.r_regs[R_ZERO] = 0;
|
||||||
|
memcpy (®isters[REGISTER_BYTE (0)],
|
||||||
|
&inferior_registers.r_regs[0],
|
||||||
|
sizeof(inferior_registers.r_regs));
|
||||||
|
|
||||||
|
/* Floating point registers */
|
||||||
|
ptrace (PT_GETFPREGS, inferior_pid,
|
||||||
|
(PTRACE_ARG3_TYPE) &inferior_fp_registers, 0);
|
||||||
|
memcpy (®isters[REGISTER_BYTE (FP0_REGNUM)],
|
||||||
|
&inferior_fp_registers.fpr_regs[0],
|
||||||
|
sizeof(inferior_fp_registers.fpr_regs));
|
||||||
|
|
||||||
|
registers_fetched ();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
store_inferior_registers (regno)
|
||||||
|
int regno;
|
||||||
|
{
|
||||||
|
struct reg inferior_registers;
|
||||||
|
struct fpreg inferior_fp_registers;
|
||||||
|
|
||||||
|
/* Integer registers */
|
||||||
|
memcpy (&inferior_registers.r_regs[0],
|
||||||
|
®isters[REGISTER_BYTE (0)],
|
||||||
|
sizeof(inferior_registers.r_regs));
|
||||||
|
/* The PC travels in the R_ZERO slot. */
|
||||||
|
inferior_registers.r_regs[R_ZERO] =
|
||||||
|
*(long *) ®isters[REGISTER_BYTE (PC_REGNUM)];
|
||||||
|
ptrace (PT_SETREGS, inferior_pid,
|
||||||
|
(PTRACE_ARG3_TYPE) &inferior_registers, 0);
|
||||||
|
|
||||||
|
/* Floating point registers */
|
||||||
|
memcpy (&inferior_fp_registers.fpr_regs[0],
|
||||||
|
®isters[REGISTER_BYTE (FP0_REGNUM)],
|
||||||
|
sizeof(inferior_fp_registers.fpr_regs));
|
||||||
|
inferior_fp_registers.fpr_cr = 0;
|
||||||
|
ptrace (PT_SETFPREGS, inferior_pid,
|
||||||
|
(PTRACE_ARG3_TYPE) &inferior_fp_registers, 0);
|
||||||
|
|
||||||
|
registers_fetched ();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* kernel_u_size() is not helpful on NetBSD because
|
||||||
|
* the "u" struct is NOT in the core dump file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef FETCH_KCORE_REGISTERS
|
||||||
|
/*
|
||||||
|
* Get registers from a kernel crash dump or live kernel.
|
||||||
|
* Called by kcore-nbsd.c:get_kcore_registers().
|
||||||
|
*/
|
||||||
|
fetch_kcore_registers (pcbp)
|
||||||
|
struct pcb *pcbp;
|
||||||
|
{
|
||||||
|
|
||||||
|
/* First clear out any garbage. */
|
||||||
|
memset(registers, '\0', REGISTER_BYTES);
|
||||||
|
|
||||||
|
/* SP */
|
||||||
|
*(long *) ®isters[REGISTER_BYTE (SP_REGNUM)] =
|
||||||
|
pcbp->pcb_hw.apcb_ksp;
|
||||||
|
|
||||||
|
/* S0 through S6 */
|
||||||
|
memcpy (®isters[REGISTER_BYTE (S0_REGNUM)],
|
||||||
|
&pcbp->pcb_context[0], 7 * sizeof(long));
|
||||||
|
|
||||||
|
/* PC */
|
||||||
|
*(long *) ®isters[REGISTER_BYTE (PC_REGNUM)] =
|
||||||
|
pcbp->pcb_context[7];
|
||||||
|
|
||||||
|
registers_fetched ();
|
||||||
|
}
|
||||||
|
#endif /* FETCH_KCORE_REGISTERS */
|
||||||
|
|
||||||
|
static struct core_fns alphanbsd_core_fns =
|
||||||
|
{
|
||||||
|
bfd_target_ecoff_flavour,
|
||||||
|
fetch_core_registers,
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct core_fns alphanbsd_elf_core_fns =
|
||||||
|
{
|
||||||
|
bfd_target_elf_flavour,
|
||||||
|
fetch_core_registers,
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
void
|
||||||
|
_initialize_core_alphanbsd ()
|
||||||
|
{
|
||||||
|
add_core_fns (&alphanbsd_core_fns);
|
||||||
|
add_core_fns (&alphanbsd_elf_core_fns);
|
||||||
|
}
|
6
gnu/dist/toolchain/gdb/config/alpha/nbsd.mh
vendored
Normal file
6
gnu/dist/toolchain/gdb/config/alpha/nbsd.mh
vendored
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
# Host: Alpha running NetBSD
|
||||||
|
XDEPFILES= ser-tcp.o
|
||||||
|
XM_FILE= xm-nbsd.h
|
||||||
|
NAT_FILE= nm-nbsd.h
|
||||||
|
NAT_CLIBS= -lkvm
|
||||||
|
NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o kcore-nbsd.o alphanbsd-nat.o
|
3
gnu/dist/toolchain/gdb/config/alpha/nbsd.mt
vendored
Normal file
3
gnu/dist/toolchain/gdb/config/alpha/nbsd.mt
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# Target: Alpha running NetBSD
|
||||||
|
TDEPFILES= alpha-tdep.o solib.o
|
||||||
|
TM_FILE= tm-nbsd.h
|
45
gnu/dist/toolchain/gdb/config/alpha/nm-nbsd.h
vendored
Normal file
45
gnu/dist/toolchain/gdb/config/alpha/nm-nbsd.h
vendored
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
/* Native-dependent definitions for Alpha running NetBSD, for GDB.
|
||||||
|
Copyright (C) 1986, 1987, 1989, 1992, 1995, 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. */
|
||||||
|
|
||||||
|
/* Need to define this before including the common nm-nbsd.h. */
|
||||||
|
#define SVR4_SHARED_LIBS 1
|
||||||
|
#define TARGET_ELF64 1
|
||||||
|
|
||||||
|
/* Get generic NetBSD native definitions. */
|
||||||
|
#include "nm-nbsd.h"
|
||||||
|
#include <machine/alpha_cpu.h>
|
||||||
|
|
||||||
|
/* Figure out where the longjmp will land. We expect that we have just entered
|
||||||
|
longjmp and haven't yet setup the stack frame, so the args are still in the
|
||||||
|
argument regs. A0_REGNUM points at the jmp_buf structure from which we
|
||||||
|
extract the pc (JB_PC) that we will land at. The pc is copied into ADDR.
|
||||||
|
This routine returns true on success */
|
||||||
|
|
||||||
|
#define GET_LONGJMP_TARGET(ADDR) get_longjmp_target(ADDR)
|
||||||
|
extern int
|
||||||
|
get_longjmp_target PARAMS ((CORE_ADDR *));
|
||||||
|
|
||||||
|
/* The alpha does not step over a breakpoint, the manpage is lying again. */
|
||||||
|
|
||||||
|
#define CANNOT_STEP_BREAKPOINT /* ??? */
|
||||||
|
|
||||||
|
/* NetBSD/alpha has shared libraries. */
|
||||||
|
|
||||||
|
#define GDB_TARGET_HAS_SHARED_LIBS
|
@ -122,6 +122,7 @@ extern CORE_ADDR
|
|||||||
|
|
||||||
#define V0_REGNUM 0 /* Function integer return value */
|
#define V0_REGNUM 0 /* Function integer return value */
|
||||||
#define T7_REGNUM 8 /* Return address register for OSF/1 __add* */
|
#define T7_REGNUM 8 /* Return address register for OSF/1 __add* */
|
||||||
|
#define S0_REGNUM 9 /* First callee-saved register */
|
||||||
#define GCC_FP_REGNUM 15 /* Used by gcc as frame register */
|
#define GCC_FP_REGNUM 15 /* Used by gcc as frame register */
|
||||||
#define A0_REGNUM 16 /* Loc of first arg during a subr call */
|
#define A0_REGNUM 16 /* Loc of first arg during a subr call */
|
||||||
#define T9_REGNUM 23 /* Return address register for OSF/1 __div* */
|
#define T9_REGNUM 23 /* Return address register for OSF/1 __div* */
|
||||||
|
38
gnu/dist/toolchain/gdb/config/alpha/tm-nbsd.h
vendored
Normal file
38
gnu/dist/toolchain/gdb/config/alpha/tm-nbsd.h
vendored
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
/* Macro definitions for Alpha running under NetBSD.
|
||||||
|
Copyright 1994 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
This file is part of GDB.
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
|
#ifndef TM_NBSD_H
|
||||||
|
#define TM_NBSD_H
|
||||||
|
|
||||||
|
#include "alpha/tm-alpha.h"
|
||||||
|
#ifndef S0_REGNUM
|
||||||
|
#define S0_REGNUM (T7_REGNUM+1)
|
||||||
|
#endif
|
||||||
|
#include "tm-nbsd.h"
|
||||||
|
|
||||||
|
#undef START_INFERIOR_TRAPS_EXPECTED
|
||||||
|
#define START_INFERIOR_TRAPS_EXPECTED 2
|
||||||
|
|
||||||
|
#undef NO_SINGLE_STEP
|
||||||
|
#define NO_SINGLE_STEP
|
||||||
|
#undef CANNOT_STEP_BREAKPOINT
|
||||||
|
|
||||||
|
#define SOLIB_BKPT_NAME "__start"
|
||||||
|
|
||||||
|
#endif /* TM_NBSD_H */
|
21
gnu/dist/toolchain/gdb/config/alpha/xm-nbsd.h
vendored
Normal file
21
gnu/dist/toolchain/gdb/config/alpha/xm-nbsd.h
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
/* Parameters for execution on a Alpha running NetBSD, for GDB.
|
||||||
|
Copyright 1994 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. */
|
||||||
|
|
||||||
|
/* Get generic NetBSD host definitions. */
|
||||||
|
#include <xm-nbsd.h>
|
Loading…
Reference in New Issue
Block a user