* alpha-tdep.h (gdbarch_tdep): Add jb_pc and jb_elt_size members.

* alpha-linux-tdep.c (alpha_linux_init_abi): Initialize
tdep->jb_pc and tdep->jb_elt_size.
* alpha-osf1-tdep.c (alpha_osf1_init_abi): Likewise.
* alphafbsd-tdep.c (alphafbsd_init_abi): Likewise.
* alphanbsd-tdep.c (alphanbsd_init_abi): Likewise.
* alpha-nat.c (get_longjmp_target): Remove.
(JB_ELEMENT_SIZE): Ditto.
(JB_PC): Ditto.
* alpha-tdep.c (alpha_get_longjmp_target): New function.
(alpha_gdbarch_init): Default tdep->jb_pc to -1.  If the
OS ABI sets jb_pc to a valid value, set gdbarch_get_longjmp_target
to alpha_get_longjmp_target.
(alpha_dump_tdep): Report tdep->jb_pc and tdep->jb_elt_size.
* config/alpha/nm-linux.h (GET_LONGJMP_TARGET): Remove.
* config/alpha/nm-osf.h (GET_LONGJMP_TARGET): Remove.
This commit is contained in:
Jason Thorpe 2002-04-26 01:08:19 +00:00
parent d5ba2a0169
commit accc6d1ff3
10 changed files with 75 additions and 52 deletions

View File

@ -1,3 +1,22 @@
2002-04-25 Jason Thorpe <thorpej@wasabisystems.com>
* alpha-tdep.h (gdbarch_tdep): Add jb_pc and jb_elt_size members.
* alpha-linux-tdep.c (alpha_linux_init_abi): Initialize
tdep->jb_pc and tdep->jb_elt_size.
* alpha-osf1-tdep.c (alpha_osf1_init_abi): Likewise.
* alphafbsd-tdep.c (alphafbsd_init_abi): Likewise.
* alphanbsd-tdep.c (alphanbsd_init_abi): Likewise.
* alpha-nat.c (get_longjmp_target): Remove.
(JB_ELEMENT_SIZE): Ditto.
(JB_PC): Ditto.
* alpha-tdep.c (alpha_get_longjmp_target): New function.
(alpha_gdbarch_init): Default tdep->jb_pc to -1. If the
OS ABI sets jb_pc to a valid value, set gdbarch_get_longjmp_target
to alpha_get_longjmp_target.
(alpha_dump_tdep): Report tdep->jb_pc and tdep->jb_elt_size.
* config/alpha/nm-linux.h (GET_LONGJMP_TARGET): Remove.
* config/alpha/nm-osf.h (GET_LONGJMP_TARGET): Remove.
2002-04-25 Andrew Cagney <ac131313@redhat.com>
* README: Update to GDB 5.2.

View File

@ -100,6 +100,9 @@ alpha_linux_init_abi (struct gdbarch_info info,
set_gdbarch_pc_in_sigtramp (gdbarch, alpha_linux_pc_in_sigtramp);
tdep->dynamic_sigtramp_offset = alpha_linux_sigtramp_offset;
tdep->jb_pc = 2;
tdep->jb_elt_size = 8;
}
void

View File

@ -41,40 +41,6 @@
static void fetch_osf_core_registers (char *, unsigned, int, CORE_ADDR);
static void fetch_elf_core_registers (char *, unsigned, int, CORE_ADDR);
/* 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 (CORE_ADDR *pc)
{
CORE_ADDR jb_addr;
char raw_buffer[ALPHA_MAX_REGISTER_RAW_SIZE];
jb_addr = read_register (ALPHA_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.

View File

@ -52,6 +52,9 @@ alpha_osf1_init_abi (struct gdbarch_info info,
set_gdbarch_pc_in_sigtramp (gdbarch, alpha_osf1_pc_in_sigtramp);
tdep->skip_sigtramp_frame = alpha_osf1_skip_sigtramp_frame;
tdep->jb_pc = 2;
tdep->jb_elt_size = 8;
}
void

View File

@ -78,6 +78,8 @@ static gdbarch_fix_call_dummy_ftype alpha_fix_call_dummy;
static gdbarch_init_frame_pc_first_ftype alpha_init_frame_pc_first;
static gdbarch_init_extra_frame_info_ftype alpha_init_extra_frame_info;
static gdbarch_get_longjmp_target_ftype alpha_get_longjmp_target;
struct frame_extra_info
{
alpha_extra_func_info_t proc_desc;
@ -1617,6 +1619,28 @@ alpha_extract_struct_value_address (char *regbuf)
REGISTER_RAW_SIZE (ALPHA_V0_REGNUM)));
}
/* 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 the "pc". This routine returns true on success. */
static int
alpha_get_longjmp_target (CORE_ADDR *pc)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
CORE_ADDR jb_addr;
char raw_buffer[ALPHA_MAX_REGISTER_RAW_SIZE];
jb_addr = read_register (ALPHA_A0_REGNUM);
if (target_read_memory (jb_addr + (tdep->jb_pc * tdep->jb_elt_size),
raw_buffer, tdep->jb_elt_size))
return 0;
*pc = extract_address (raw_buffer, tdep->jb_elt_size);
return 1;
}
/* alpha_software_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 (NetBSD on Alpha, for example). We find
@ -1975,6 +1999,8 @@ alpha_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
tdep->dynamic_sigtramp_offset = NULL;
tdep->skip_sigtramp_frame = NULL;
tdep->jb_pc = -1; /* longjmp support not enabled by default */
/* Type sizes */
set_gdbarch_short_bit (gdbarch, 16);
set_gdbarch_int_bit (gdbarch, 32);
@ -2113,6 +2139,12 @@ alpha_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
}
}
/* Now that we have tuned the configuration, set a few final things
based on what the OS ABI has told us. */
if (tdep->jb_pc >= 0)
set_gdbarch_get_longjmp_target (gdbarch, alpha_get_longjmp_target);
return gdbarch;
}
@ -2134,6 +2166,13 @@ alpha_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file)
fprintf_unfiltered (file,
"alpha_dump_tdep: vm_min_address = 0x%lx\n",
(long) tdep->vm_min_address);
fprintf_unfiltered (file,
"alpha_dump_tdep: jb_pc = %d\n",
tdep->jb_pc);
fprintf_unfiltered (file,
"alpha_dump_tdep: jb_elt_size = %ld\n",
(long) tdep->jb_elt_size);
}
void

View File

@ -105,6 +105,11 @@ struct gdbarch_tdep
/* If FRAME refers to a sigtramp frame, return the address of the next
frame. */
CORE_ADDR (*skip_sigtramp_frame) (struct frame_info *, CORE_ADDR);
int jb_pc; /* Offset to PC value in jump buffer.
If htis is negative, longjmp support
will be disabled. */
size_t jb_elt_size; /* And the size of each entry in the buf. */
};
void alpha_software_single_step (enum target_signal, int);

View File

@ -70,6 +70,9 @@ alphafbsd_init_abi (struct gdbarch_info info,
set_gdbarch_pc_in_sigtramp (gdbarch, alphafbsd_pc_in_sigtramp);
set_gdbarch_use_struct_convention (gdbarch, alphafbsd_use_struct_convention);
tdep->jb_pc = 2;
tdep->jb_elt_size = 8;
}
void

View File

@ -145,6 +145,9 @@ alphanbsd_init_abi (struct gdbarch_info info,
alphanbsd_solib_svr4_fetch_link_map_offsets);
tdep->dynamic_sigtramp_offset = alphanbsd_sigtramp_offset;
tdep->jb_pc = 2;
tdep->jb_elt_size = 8;
}
void

View File

@ -25,15 +25,6 @@
#include "nm-linux.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 (CORE_ADDR *);
/* ptrace register ``addresses'' are absolute. */
#define U_REGS_OFFSET 0

View File

@ -18,15 +18,6 @@
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* 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 (CORE_ADDR *);
/* ptrace register ``addresses'' are absolute. */
#define U_REGS_OFFSET 0