- merge changes from gdb-5.0

This commit is contained in:
christos 2003-08-14 14:22:27 +00:00
parent 88a26652e1
commit b71227cf2b
18 changed files with 406 additions and 22 deletions

View File

@ -51,6 +51,7 @@
#define ALPHA_V0_REGNUM 0 /* Function integer return value */
#define ALPHA_T7_REGNUM 8 /* Return address register for OSF/1 __add* */
#define ALPHA_S0_REGNUM 9 /* First callee-saved register */
#define ALPHA_GCC_FP_REGNUM 15 /* Used by gcc as frame register */
#define ALPHA_A0_REGNUM 16 /* Loc of first arg during a subr call */
#define ALPHA_T9_REGNUM 23 /* Return address register for OSF/1 __div* */

View File

@ -225,12 +225,57 @@ arm_pc_is_thumb_dummy (CORE_ADDR memaddr)
static CORE_ADDR
arm_addr_bits_remove (CORE_ADDR val)
{
if (arm_pc_is_thumb (val))
return (val & (arm_apcs_32 ? 0xfffffffe : 0x03fffffe));
if (!arm_apcs_32)
return (val & 0x03fffffc);
else if (arm_pc_is_thumb (val))
return (val & 0xfffffffe);
else
return (val & (arm_apcs_32 ? 0xfffffffc : 0x03fffffc));
return (val & 0xfffffffc);
}
#ifdef ARM_26BIT_R15
#define R15_PC 0x03fffffc
#define R15_PSR_DIRECT 0xf0000003 /* Bits in the same places in R15 & PSR */
#define R15_IF 0x0c000000 /* Bits which must be shifted... */
#define PSR_IF 0x000000c0
#define IF_SHIFT 20 /* ... by this much */
/* Functions to unpack and pack R15 on 26-bit ARMs. Within GDB, R15
is always stored with the program counter in PC_REGNUM, and the
flags in PS_REGNUM. PS_REGNUM has the I and F flags in their
32-bit positions. Targets can use these functions to convert
between this format and the format used on 26-bit processors, where
the PC and PSR are packed into R15. */
void
arm_supply_26bit_r15 (char *val)
{
ULONGEST r15, pc, psr;
char rawpc[4], rawpsr[4];
r15 = extract_unsigned_integer (val, 4);
pc = r15 & R15_PC;
store_unsigned_integer (rawpc, 4, pc);
supply_register (PC_REGNUM, rawpc);
psr = (r15 & R15_PSR_DIRECT) | ((r15 & R15_IF) >> IF_SHIFT);
store_unsigned_integer (rawpsr, 4, psr);
supply_register (PS_REGNUM, rawpsr);
}
void
arm_read_26bit_r15 (char *myaddr)
{
ULONGEST r15, pc, psr;
pc = read_register (PC_REGNUM);
psr = read_register (PS_REGNUM);
r15 = pc | (psr & R15_PSR_DIRECT) | ((psr & PSR_IF) << IF_SHIFT);
store_unsigned_integer (myaddr, r15, 4);
}
#endif
/* When reading symbols, we need to zap the low bit of the address,
which may be set to 1 for Thumb functions. */
static CORE_ADDR
@ -1228,7 +1273,7 @@ arm_frame_saved_pc (struct frame_info *fi)
else
{
CORE_ADDR pc = arm_find_callers_reg (fi, ARM_LR_REGNUM);
return IS_THUMB_ADDR (pc) ? UNMAKE_THUMB_ADDR (pc) : pc;
return arm_addr_bits_remove(pc);
}
}
@ -1755,6 +1800,7 @@ condition_true (unsigned long cond, unsigned long status_reg)
return 1;
}
#if SOFTWARE_SINGLE_STEP_P
/* Support routines for single stepping. Calculate the next PC value. */
#define submask(x) ((1L << ((x) + 1)) - 1)
#define bit(obj,st) (((obj) >> (st)) & 1)
@ -1815,6 +1861,32 @@ shifted_reg_val (unsigned long inst, int carry, unsigned long pc_val,
return res & 0xffffffff;
}
/* single_step() is called just before we want to resume the inferior,
if we want to single-step it but there is no hardware or kernel
single-step support. We find the target of the coming instruction
and breakpoint it.
single_step is also called just after the inferior stops. If we had
set up a simulated single-step, we undo our damage. */
void
arm_software_single_step (ignore, insert_bpt)
int ignore; /* Signal, not needed */
int insert_bpt;
{
static int next_pc; /* State between setting and unsetting. */
static char break_mem[BREAKPOINT_MAX]; /* Temporary storage for mem@bpt */
if (insert_bpt)
{
next_pc = arm_get_next_pc (read_register (PC_REGNUM));
target_insert_breakpoint (next_pc, break_mem);
}
else
target_remove_breakpoint (next_pc, break_mem);
}
#endif /* SOFTWARE_SINGLE_STEP_P */
/* Return number of 1-bits in VAL. */
static int

View File

@ -83,4 +83,15 @@ extern void alpha_print_extra_frame_info (struct frame_info *);
alpha_setup_arbitrary_frame (argc, argv)
extern struct frame_info *alpha_setup_arbitrary_frame (int, CORE_ADDR *);
/* Provide a default for sofware single-stepping (off by default). */
#ifndef SOFTWARE_SINGLE_STEP_P
#define SOFTWARE_SINGLE_STEP_P 0
#endif
#if SOFTWARE_SINGLE_STEP_P
#define SOFTWARE_SINGLE_STEP(sig,bpt) alpha_software_single_step((sig), (bpt))
void alpha_software_single_step PARAMS((int, int));
#endif
CORE_ADDR alpha_next_pc (CORE_ADDR pc);
#endif /* TM_ALPHA_H */

View File

@ -26,6 +26,22 @@
#define GDB_MULTI_ARCH 1
#endif
#ifdef ARM_26BIT_R15
/* Functions to unpack and pack R15 on 26-bit ARMs. */
void arm_supply_26bit_r15 (char *);
void arm_read_26bit_r15 (char *);
#endif
/* Most ARMs don't have single stepping capability, so provide a
single-stepping mechanism by default */
#ifndef SOFTWARE_SINGLE_STEP_P
#define SOFTWARE_SINGLE_STEP_P 1
#endif
#if SOFTWARE_SINGLE_STEP_P
#define SOFTWARE_SINGLE_STEP(sig,bpt) arm_software_single_step((sig), (bpt))
void arm_software_single_step PARAMS((int, int));
#endif
/* Specify that for the native compiler variables for a particular
lexical context are listed after the beginning LBRAC instead of
before in the executables list of symbols. */

View File

@ -25,4 +25,61 @@
/* Get generic NetBSD native definitions. */
#include "config/nm-nbsd.h"
#ifdef __ELF__
#define SVR4_SHARED_LIBS
#endif
/* make structure definitions match up with those expected in solib.c */
#define link_object sod
#define lo_name sod_name
#define lo_library sod_library
#define lo_unused sod_reserved
#define lo_major sod_major
#define lo_minor sod_minor
#define lo_next sod_next
#define link_map so_map
#define lm_addr som_addr
#define lm_name som_path
#define lm_next som_next
#define lm_lop som_sod
#define lm_lob som_sodbase
#define lm_rwt som_write
#define lm_ld som_dynamic
#define lm_lpd som_spd
#define link_dynamic_2 section_dispatch_table
#define ld_loaded sdt_loaded
#define ld_need sdt_sods
#define ld_rules sdt_rules
#define ld_got sdt_got
#define ld_plt sdt_plt
#define ld_rel sdt_rel
#define ld_hash sdt_hash
#define ld_stab sdt_nzlist
#define ld_stab_hash sdt_filler2
#define ld_buckets sdt_buckets
#define ld_symbols sdt_strings
#define ld_symb_size sdt_str_sz
#define ld_text sdt_text_sz
#define ld_plt_sz sdt_plt_sz
#define rtc_symb rt_symbol
#define rtc_sp rt_sp
#define rtc_next rt_next
#define ld_debug so_debug
#define ldd_version dd_version
#define ldd_in_debugger dd_in_debugger
#define ldd_sym_loaded dd_sym_loaded
#define ldd_bp_addr dd_bpt_addr
#define ldd_bp_inst dd_bpt_shadow
#define ldd_cp dd_cc
#define link_dynamic _dynamic
#define ld_version d_version
#define ldd d_debug
#define ld_un d_un
#define ld_2 d_sdt
#endif /* NM_NBSD_H */

View File

@ -24,4 +24,8 @@
#define ATTACH_DETACH
#include "solib.h" /* Support for shared libraries. */
#define FETCH_KCORE_REGISTERS
#if !defined(NO_SOLIB)
#include "solib.h" /* Support for shared libraries. */
#endif

View File

@ -36,6 +36,7 @@
on the Sparc, the stack frames are offset by +2047 (and the arguments
are 8 bytes instead of 4). */
/* Instructions are:
save %sp, -320, %sp
std %f10, [ %fp + 0x7a7 ]
std %f8, [ %fp + 0x79f ]
std %f6, [ %fp + 0x797 ]
@ -67,7 +68,7 @@
ldx [ %sp + 0x897 ], %o3
ldx [ %sp + 0x88f ], %o2
ldx [ %sp + 0x887 ], %o1
call %g0
jmpl %g1, %o7
ldx [ %sp + 0x87f ], %o0
nop
ta 1

View File

@ -135,6 +135,7 @@ powerpc-*-aix4.3.[0-1]*) gdb_host=aix ;;
powerpc-*-aix*) gdb_host=aix432 ;;
powerpc-*-linux*) gdb_host=linux ;;
powerpc-*-netbsd*) gdb_host=nbsd ;;
powerpc-*-darwin*) gdb_host=darwin ;;
rs6000-*-lynxos*) gdb_host=rs6000lynx ;;
rs6000-*-aix4*) gdb_host=aix4 ;;

View File

@ -530,6 +530,18 @@ aix*)
])
CONFIG_LDFLAGS="${CONFIG_LDFLAGS} ${gdb_cv_bigtoc}"
;;
netbsd*)
AC_MSG_CHECKING(for NetBSD thread debugging library)
if test -f /usr/include/pthread_dbg.h ; then
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_THREAD_DB_LIB)
CONFIG_OBS="${CONFIG_OBS} nbsd-thread.o"
CONFIG_SRCS="${CONFIG_SRCS} nbsd-thread.c"
CONFIG_LDFLAGS="${CONFIG_LDFLAGS} -lpthread_dbg"
else
AC_MSG_RESULT(no)
fi
;;
esac

View File

@ -201,6 +201,8 @@ mips*-sony-*) gdb_target=bigmips ;;
mips*-*-linux*) gdb_target=linux
build_gdbserver=yes
;;
mipseb-*-netbsd*) gdb_target=nbsdeb ;;
mipsel-*-netbsd*) gdb_target=nbsdel ;;
mips*-*-netbsd*) gdb_target=nbsd ;;
mips*-*-mach3*) gdb_target=mipsm3 ;;
mips*-*-sysv4*) gdb_target=mipsv4 ;;
@ -276,6 +278,8 @@ sparcv9-*-* | sparc64-*-*) gdb_target=sp64 ;;
xstormy16-*-*) gdb_target=xstormy16 ;;
vax-*-netbsd*) gdb_target=nbsd ;;
vax-*-*) gdb_target=vax ;;
# OBSOLETE fr30-*-*) gdb_target=fr30

View File

@ -347,8 +347,10 @@ core_open (char *filename, int from_tty)
/* Build up thread list from BFD sections. */
init_thread_list ();
#if 0 /* XXX nathanw */
bfd_map_over_sections (core_bfd, add_to_thread_list,
bfd_get_section_by_name (core_bfd, ".reg"));
#endif
if (ontop)
{

View File

@ -2151,6 +2151,8 @@ read_dbx_symtab (struct objfile *objfile)
case N_NSYMS: /* Ultrix 4.0: symbol count */
case N_DEFD: /* GNU Modula-2 */
case N_ALIAS: /* SunPro F77: alias name, ignore for now. */
case N_WARNING: /* Linker warning message; ignore. */
case N_OBJ: /* useless types from Solaris */
case N_OPT:

View File

@ -3203,7 +3203,10 @@ decode_modified_type (char *modifiers, unsigned int modcount, int mtype)
break;
default:
if (!(MOD_lo_user <= (unsigned char) modifier
&& (unsigned char) modifier <= MOD_hi_user))
#if MOD_hi_user != 0xff
&& (unsigned char) modifier <= MOD_hi_user
#endif
))
{
complain (&unknown_type_modifier, DIE_ID, DIE_NAME, modifier);
}

View File

@ -1066,6 +1066,33 @@ m68k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
return gdbarch;
}
/* For NetBSD, sigtramp is 32 bytes before STACK_END_ADDR,
but we don't know where that is until run-time! */
#ifdef TM_NBSD_H
int
nbsd_in_sigtramp (pc)
CORE_ADDR pc;
{
static CORE_ADDR stack_end_addr;
struct minimal_symbol *msymbol;
CORE_ADDR pssaddr;
int rv;
if (stack_end_addr == 0) {
msymbol = lookup_minimal_symbol("__ps_strings", NULL, NULL);
if (msymbol == NULL)
pssaddr = 0x40a0; /* XXX return 0? */
else
pssaddr = SYMBOL_VALUE_ADDRESS(msymbol);
stack_end_addr = read_memory_integer (pssaddr, 4);
stack_end_addr = (stack_end_addr + 0xFF) & ~0xFF;
}
rv = ((pc >= (stack_end_addr - 32)) &&
(pc < stack_end_addr));
return rv;
}
#endif /* TM_NBSD_H */
static void
m68k_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file)

View File

@ -20,31 +20,99 @@
Boston, MA 02111-1307, USA. */
#include "defs.h"
#include <sys/types.h>
#include <sys/ptrace.h>
#include <machine/reg.h>
#include <machine/frame.h>
#include <machine/pcb.h>
#include "inferior.h"
#include "gdbcore.h"
#include "regcache.h"
/* Map GDB register index to ptrace register buffer offset. */
static const int regmap[] =
{
0x00, /* d0 */
0x04, /* d1 */
0x08, /* d2 */
0x0c, /* d3 */
0x10, /* d4 */
0x14, /* d5 */
0x18, /* d6 */
0x1c, /* d7 */
0x20, /* a0 */
0x24, /* a1 */
0x28, /* a2 */
0x2c, /* a3 */
0x30, /* a4 */
0x34, /* a5 */
0x38, /* a6 */
0x3c, /* a7 */
0x40, /* sr */
0x44, /* pc */
};
/* Map GDB FP register index to ptrace FP register buffer offset. */
static const int fpregmap[] =
{
0x00, /* fp0 */
0x0c, /* fp1 *
0x18, /* fp2 */
0x24, /* fp3 */
0x30, /* fp4 */
0x3c, /* fp5 */
0x48, /* fp6 */
0x54, /* fp7 */
0x60, /* fpcr */
0x64, /* fpsr */
0x68, /* fpiar */
};
/* Determine if PT_GETREGS fetches this register. */
#define GETREGS_SUPPLIES(regno) \
((regno) >= D0_REGNUM && (regno) <= PC_REGNUM)
static void
supply_regs (regs)
char *regs;
{
int i;
for (i = D0_REGNUM; i <= PC_REGNUM; i++)
supply_register (i, regs + regmap[i - D0_REGNUM]);
}
static void
supply_fpregs (freg)
char *freg;
{
int i;
for (i = FP0_REGNUM; i <= FPI_REGNUM; i++)
supply_register (i, freg + fpregmap[i - FP0_REGNUM]);
}
void
fetch_inferior_registers (int regno)
{
struct reg inferior_registers;
struct fpreg inferior_fp_registers;
ptrace (PT_GETREGS, PIDGET (inferior_ptid),
(PTRACE_ARG3_TYPE) & inferior_registers, 0);
memcpy (&registers[REGISTER_BYTE (0)], &inferior_registers,
sizeof (inferior_registers));
if (regno == -1 || GETREGS_SUPPLIES (regno))
{
ptrace (PT_GETREGS, inferior_pid,
(PTRACE_ARG3_TYPE) & inferior_registers, 0);
supply_regs ((char *) &inferior_registers);
if (regno != -1)
return;
}
ptrace (PT_GETFPREGS, PIDGET (inferior_ptid),
(PTRACE_ARG3_TYPE) & inferior_fp_registers, 0);
memcpy (&registers[REGISTER_BYTE (FP0_REGNUM)], &inferior_fp_registers,
sizeof (inferior_fp_registers));
registers_fetched ();
supply_fpregs ((char *) &inferior_fp_registers);
}
void
@ -77,13 +145,81 @@ fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, int which,
struct md_core *core_reg = (struct md_core *) core_reg_sect;
/* Integer registers */
memcpy (&registers[REGISTER_BYTE (0)],
&core_reg->intreg, sizeof (struct reg));
supply_regs ((char *) &core_reg->intreg);
/* Floating point registers */
memcpy (&registers[REGISTER_BYTE (FP0_REGNUM)],
&core_reg->freg, sizeof (struct fpreg));
supply_fpregs ((char *) &core_reg->freg);
}
static void
fetch_elfcore_registers (core_reg_sect, core_reg_size, which, ignore)
char *core_reg_sect;
unsigned core_reg_size;
int which;
CORE_ADDR ignore;
{
switch (which)
{
case 0: /* Integer registers */
if (core_reg_size != sizeof (struct reg))
warning ("Wrong size register set in core file.");
else
supply_regs (core_reg_sect);
break;
case 2: /* Floating point registers */
if (core_reg_size != sizeof (struct fpreg))
warning ("Wrong size FP register set in core file.");
else
supply_fpregs (core_reg_sect);
break;
default:
/* Don't know what kind of register request this is; just ignore it. */
break;
}
}
#ifdef FETCH_KCORE_REGISTERS
/*
* Get registers from a kernel crash dump or live kernel.
* Called by kcore-nbsd.c:get_kcore_registers().
*/
void
fetch_kcore_registers (pcb)
struct pcb *pcb;
{
int i, *ip, tmp=0;
/* D0,D1 */
ip = &tmp;
supply_register(0, (char *)ip);
supply_register(1, (char *)ip);
/* D2-D7 */
ip = &pcb->pcb_regs[0];
for (i = 2; i < 8; i++, ip++)
supply_register(i, (char *)ip);
/* A0,A1 */
ip = &tmp;
supply_register(8, (char *)ip);
supply_register(9, (char *)ip);
/* A2-A7 */
ip = &pcb->pcb_regs[6];
for (i = 10; i < 16; i++, (char *)ip++)
supply_register(i, (char *)ip);
/* PS (sr) */
tmp = pcb->pcb_ps & 0xFFFF;
supply_register(PS_REGNUM, (char *)&tmp);
/* PC (use return address) */
tmp = pcb->pcb_regs[10] + 4;
if (target_read_memory(tmp, (char *)&tmp, sizeof(tmp)))
tmp = 0;
supply_register(PC_REGNUM, (char *)&tmp);
}
#endif /* FETCH_KCORE_REGISTERS */
/* Register that we are able to handle m68knbsd core file formats.
FIXME: is this really bfd_target_unknown_flavour? */
@ -96,8 +232,18 @@ static struct core_fns m68knbsd_core_fns =
NULL /* next */
};
static struct core_fns m68knbsd_elfcore_fns =
{
bfd_target_elf_flavour, /* core_flavour */
default_check_format, /* check_format */
default_core_sniffer, /* core_sniffer */
fetch_core_registers, /* core_read_registers */
NULL /* next */
};
void
_initialize_m68knbsd_nat (void)
{
add_core_fns (&m68knbsd_core_fns);
add_core_fns (&m68knbsd_elfcore_fns);
}

View File

@ -138,7 +138,7 @@ void
_initialize_ser_pipe (void)
{
struct serial_ops *ops = XMALLOC (struct serial_ops);
memset (ops, sizeof (struct serial_ops), 0);
memset (ops, 0, sizeof (struct serial_ops));
ops->name = "pipe";
ops->next = 0;
ops->open = pipe_open;

View File

@ -1337,7 +1337,7 @@ void
_initialize_ser_hardwire (void)
{
struct serial_ops *ops = XMALLOC (struct serial_ops);
memset (ops, sizeof (struct serial_ops), 0);
memset (ops, 0, sizeof (struct serial_ops));
ops->name = "hardwire";
ops->next = 0;
ops->open = hardwire_open;

View File

@ -331,6 +331,8 @@ sparc_init_extra_frame_info (int fromleaf, struct frame_info *fi)
if (GDB_TARGET_IS_SPARC64 && (fi->frame & 1))
fi->frame += 2047;
else
fi->frame &= 0x0ffffffffL;
}
}
@ -372,6 +374,8 @@ sparc_init_extra_frame_info (int fromleaf, struct frame_info *fi)
if (GDB_TARGET_IS_SPARC64 && (fi->frame & 1))
fi->frame += 2047;
else
fi->frame &= 0x0ffffffffL;
/* Record where the fp got saved. */
fi->extra_info->fp_addr =
@ -1305,6 +1309,8 @@ sparc_pop_frame (void)
if (GDB_TARGET_IS_SPARC64 && (sp & 1))
sp += 2047;
else
sp &= 0x0ffffffffL;
read_memory (sp, reg_temp, SPARC_INTREG_SIZE * 16);
@ -2189,13 +2195,22 @@ sparc_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun,
struct type *value_type, int using_gcc)
{
int i;
#ifdef GDB_TARGET_IS_SPARC64
/*
* XXXXXXXXX
*
* We'll use jmpl %g1, %o7, so we just overwrite %g1 with the
* pointer to the function we want to call.
*/
write_register (G0_REGNUM + 1, fun);
#else
/* Store the relative adddress of the target function into the
'call' instruction. */
store_unsigned_integer (dummy + CALL_DUMMY_CALL_OFFSET, 4,
(0x40000000
| (((fun - (pc + CALL_DUMMY_CALL_OFFSET)) >> 2)
& 0x3fffffff)));
#endif
/* If the called function returns an aggregate value, fill in the UNIMP
instruction containing the size of the returned aggregate return value,
@ -2297,6 +2312,8 @@ sparc64_read_sp (void)
if (sp & 1)
sp += 2047;
else
sp &= 0x0ffffffffL;
return sp;
}
@ -2307,6 +2324,8 @@ sparc64_read_fp (void)
if (fp & 1)
fp += 2047;
else
fp &= 0x0ffffffffL;
return fp;
}
@ -2320,6 +2339,12 @@ sparc64_write_sp (CORE_ADDR val)
write_register (SP_REGNUM, val);
}
CORE_ADDR
sparc64_frame_address (struct frame_info *fi)
{
return (fi->frame - 2047);
}
/* The SPARC 64 ABI passes floating-point arguments in FP0 to FP31,
and all other arguments in O0 to O5. They are also copied onto
the stack in the correct places. Apparently (empirically),