/* Target-dependent code for the IA-64 for GDB, the GNU debugger.
- Copyright 1999, 2000, 2001
- Free Software Foundation, Inc.
+
+ Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
This file is part of GDB.
#include "floatformat.h"
#include "regcache.h"
#include "doublest.h"
+#include "value.h"
#include "objfiles.h"
#include "elf/common.h" /* for DT_PLTGOT value */
static gdbarch_skip_prologue_ftype ia64_skip_prologue;
static gdbarch_frame_init_saved_regs_ftype ia64_frame_init_saved_regs;
static gdbarch_get_saved_register_ftype ia64_get_saved_register;
-static gdbarch_extract_return_value_ftype ia64_extract_return_value;
-static gdbarch_extract_struct_value_address_ftype ia64_extract_struct_value_address;
+static gdbarch_deprecated_extract_return_value_ftype ia64_extract_return_value;
+static gdbarch_deprecated_extract_struct_value_address_ftype ia64_extract_struct_value_address;
static gdbarch_use_struct_convention_ftype ia64_use_struct_convention;
static gdbarch_frameless_function_invocation_ftype ia64_frameless_function_invocation;
static gdbarch_init_extra_frame_info_ftype ia64_init_extra_frame_info;
-static gdbarch_store_return_value_ftype ia64_store_return_value;
static gdbarch_store_struct_return_ftype ia64_store_struct_return;
static gdbarch_push_arguments_ftype ia64_push_arguments;
static gdbarch_push_return_address_ftype ia64_push_return_address;
#define FIND_GLOBAL_POINTER \
(gdbarch_tdep (current_gdbarch)->find_global_pointer)
-static char *
+static const char *
ia64_register_name (int reg)
{
return ia64_register_names[reg];
if (frame == NULL)
internal_error (__FILE__, __LINE__,
"read_sigcontext_register: NULL frame");
- if (!frame->signal_handler_caller)
+ if (!(get_frame_type (frame) == SIGTRAMP_FRAME))
internal_error (__FILE__, __LINE__,
- "read_sigcontext_register: frame not a signal_handler_caller");
+ "read_sigcontext_register: frame not a signal trampoline");
if (SIGCONTEXT_REGISTER_ADDRESS == 0)
internal_error (__FILE__, __LINE__,
"read_sigcontext_register: SIGCONTEXT_REGISTER_ADDRESS is 0");
int slotnum = (int) (addr & 0x0f) / SLOT_MULTIPLIER;
long long instr;
int val;
+ int template;
if (slotnum > 2)
error("Can't insert breakpoint for slot numbers greater than 2.");
addr &= ~0x0f;
val = target_read_memory (addr, bundle, BUNDLE_LEN);
+
+ /* Check for L type instruction in 2nd slot, if present then
+ bump up the slot number to the 3rd slot */
+ template = extract_bit_field (bundle, 0, 5);
+ if (slotnum == 1 && template_encoding_table[template][1] == L)
+ {
+ slotnum = 2;
+ }
+
instr = slotN_contents (bundle, slotnum);
memcpy(contents_cache, &instr, sizeof(instr));
replace_slotN_contents (bundle, BREAKPOINT, slotnum);
int slotnum = (addr & 0x0f) / SLOT_MULTIPLIER;
long long instr;
int val;
+ int template;
addr &= ~0x0f;
val = target_read_memory (addr, bundle, BUNDLE_LEN);
+
+ /* Check for L type instruction in 2nd slot, if present then
+ bump up the slot number to the 3rd slot */
+ template = extract_bit_field (bundle, 0, 5);
+ if (slotnum == 1 && template_encoding_table[template][1] == L)
+ {
+ slotnum = 2;
+ }
+
memcpy (&instr, contents_cache, sizeof instr);
replace_slotN_contents (bundle, instr, slotnum);
if (val == 0)
/* We don't really want to use this, but remote.c needs to call it in order
to figure out if Z-packets are supported or not. Oh, well. */
-unsigned char *
+const unsigned char *
ia64_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr)
{
static unsigned char breakpoint[] =
even really hard to compute the frame chain, but it can be
computationally expensive. So, instead of making life difficult
(and slow), we pick a more convenient representation of the frame
- chain, knowing that we'll have to make some small adjustments
- in other places. (E.g, note that read_fp() and write_fp() are
- actually read_sp() and write_sp() below in ia64_gdbarch_init()
- below.)
+ chain, knowing that we'll have to make some small adjustments in
+ other places. (E.g, note that read_fp() is actually read_sp() in
+ ia64_gdbarch_init() below.)
Okay, so what is the frame chain exactly? It'll be the SP value
at the time that the function in question was entered.
CORE_ADDR
ia64_frame_chain (struct frame_info *frame)
{
- if (frame->signal_handler_caller)
+ if ((get_frame_type (frame) == SIGTRAMP_FRAME))
return read_sigcontext_register (frame, sp_regnum);
- else if (PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame))
+ else if (DEPRECATED_PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame))
return frame->frame;
else
{
CORE_ADDR
ia64_frame_saved_pc (struct frame_info *frame)
{
- if (frame->signal_handler_caller)
+ if ((get_frame_type (frame) == SIGTRAMP_FRAME))
return read_sigcontext_register (frame, pc_regnum);
- else if (PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame))
- return generic_read_register_dummy (frame->pc, frame->frame, pc_regnum);
+ else if (DEPRECATED_PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame))
+ return deprecated_read_register_dummy (frame->pc, frame->frame, pc_regnum);
else
{
FRAME_INIT_SAVED_REGS (frame);
if (frame->saved_regs[IA64_VRAP_REGNUM])
return read_memory_integer (frame->saved_regs[IA64_VRAP_REGNUM], 8);
- else if (frame->next && frame->next->signal_handler_caller)
+ else if (frame->next && (get_frame_type (frame->next) == SIGTRAMP_FRAME))
return read_sigcontext_register (frame->next, IA64_BR0_REGNUM);
else /* either frameless, or not far enough along in the prologue... */
return ia64_saved_pc_after_call (frame);
if (frame->saved_regs)
return;
- if (frame->signal_handler_caller && SIGCONTEXT_REGISTER_ADDRESS)
+ if ((get_frame_type (frame) == SIGTRAMP_FRAME) && SIGCONTEXT_REGISTER_ADDRESS)
{
int regno;
if (lval != NULL)
*lval = not_lval;
- is_dummy_frame = PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame);
+ is_dummy_frame = DEPRECATED_PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame);
if (regnum == SP_REGNUM && frame->next)
{
+ ((regnum - IA64_FR32_REGNUM) + rrb_fr) % 96;
}
- generic_get_saved_register (raw_buffer, optimized, addrp, frame,
- regnum, lval);
+ deprecated_generic_get_saved_register (raw_buffer, optimized, addrp,
+ frame, regnum, lval);
}
}
{
CORE_ADDR bsp, cfm;
int next_frame_is_call_dummy = ((frame->next != NULL)
- && PC_IN_CALL_DUMMY (frame->next->pc, frame->next->frame,
+ && DEPRECATED_PC_IN_CALL_DUMMY (frame->next->pc, frame->next->frame,
frame->next->frame));
frame->extra_info = (struct frame_extra_info *)
cfm = read_register (IA64_CFM_REGNUM);
}
- else if (frame->next->signal_handler_caller)
+ else if ((get_frame_type (frame->next) == SIGTRAMP_FRAME))
{
bsp = read_sigcontext_register (frame->next, IA64_BSP_REGNUM);
cfm = read_sigcontext_register (frame->next, IA64_CFM_REGNUM);
}
else if (next_frame_is_call_dummy)
{
- bsp = generic_read_register_dummy (frame->next->pc, frame->next->frame,
- IA64_BSP_REGNUM);
- cfm = generic_read_register_dummy (frame->next->pc, frame->next->frame,
- IA64_CFM_REGNUM);
+ bsp = deprecated_read_register_dummy (frame->next->pc,
+ frame->next->frame,
+ IA64_BSP_REGNUM);
+ cfm = deprecated_read_register_dummy (frame->next->pc,
+ frame->next->frame,
+ IA64_CFM_REGNUM);
}
else
{
if (frn->saved_regs[IA64_CFM_REGNUM] != 0)
cfm = read_memory_integer (frn->saved_regs[IA64_CFM_REGNUM], 8);
- else if (frn->next && frn->next->signal_handler_caller)
+ else if (frn->next && (get_frame_type (frn->next) == SIGTRAMP_FRAME))
cfm = read_sigcontext_register (frn->next, IA64_PFS_REGNUM);
else if (frn->next
- && PC_IN_CALL_DUMMY (frn->next->pc, frn->next->frame,
+ && DEPRECATED_PC_IN_CALL_DUMMY (frn->next->pc, frn->next->frame,
frn->next->frame))
- cfm = generic_read_register_dummy (frn->next->pc, frn->next->frame,
- IA64_PFS_REGNUM);
+ cfm = deprecated_read_register_dummy (frn->next->pc, frn->next->frame,
+ IA64_PFS_REGNUM);
else
cfm = read_register (IA64_PFS_REGNUM);
frame->extra_info->sof = cfm & 0x7f;
frame->extra_info->sol = (cfm >> 7) & 0x7f;
if (frame->next == 0
- || frame->next->signal_handler_caller
+ || (get_frame_type (frame->next) == SIGTRAMP_FRAME)
|| next_frame_is_call_dummy)
frame->extra_info->bsp = rse_address_add (bsp, -frame->extra_info->sof);
else
float_elt_type,
floatreg,
VALUE_CONTENTS (arg) + argoffset,
- ®isters[REGISTER_BYTE (floatreg)]);
+ &deprecated_registers[REGISTER_BYTE (floatreg)]);
floatreg++;
argoffset += TYPE_LENGTH (float_elt_type);
len -= TYPE_LENGTH (float_elt_type);
/* Store the struct return value in r8 if necessary. */
if (struct_return)
{
- store_address (®isters[REGISTER_BYTE (IA64_GR8_REGNUM)],
+ store_address (&deprecated_registers[REGISTER_BYTE (IA64_GR8_REGNUM)],
REGISTER_RAW_SIZE (IA64_GR8_REGNUM),
struct_addr);
}
if (TYPE_CODE (type) == TYPE_CODE_FLT)
{
ia64_register_convert_to_raw (type, IA64_FR8_REGNUM, valbuf,
- ®isters[REGISTER_BYTE (IA64_FR8_REGNUM)]);
+ &deprecated_registers[REGISTER_BYTE (IA64_FR8_REGNUM)]);
target_store_registers (IA64_FR8_REGNUM);
}
else
- write_register_bytes (REGISTER_BYTE (IA64_GR8_REGNUM),
- valbuf, TYPE_LENGTH (type));
+ deprecated_write_register_bytes (REGISTER_BYTE (IA64_GR8_REGNUM),
+ valbuf, TYPE_LENGTH (type));
}
void
size of the frame and the size of the locals (both wrt the
frame that we're going back to). This seems kind of strange,
especially since it seems like we ought to be subtracting the
- size of the locals... and we should; but the linux kernel
+ size of the locals... and we should; but the Linux kernel
wants bsp to be set at the end of all used registers. It's
likely that this code will need to be revised to accomodate
other operating systems. */
{
os_ident = elf_elfheader (info.abfd)->e_ident[EI_OSABI];
- /* If os_ident is 0, it is not necessarily the case that we're on a
- SYSV system. (ELFOSABI_NONE is defined to be 0.) GNU/Linux uses
- a note section to record OS/ABI info, but leaves e_ident[EI_OSABI]
- zero. So we have to check for note sections too. */
+ /* If os_ident is 0, it is not necessarily the case that we're
+ on a SYSV system. (ELFOSABI_NONE is defined to be 0.)
+ GNU/Linux uses a note section to record OS/ABI info, but
+ leaves e_ident[EI_OSABI] zero. So we have to check for note
+ sections too. */
if (os_ident == 0)
{
bfd_map_over_sections (info.abfd,
arches != NULL;
arches = gdbarch_list_lookup_by_info (arches->next, &info))
{
- if (gdbarch_tdep (current_gdbarch)->os_ident != os_ident)
- continue;
- return arches->gdbarch;
+ tdep = gdbarch_tdep (arches->gdbarch);
+ if (tdep &&tdep->os_ident == os_ident)
+ return arches->gdbarch;
}
tdep = xmalloc (sizeof (struct gdbarch_tdep));
gdbarch = gdbarch_alloc (&info, tdep);
tdep->os_ident = os_ident;
+ /* NOTE: cagney/2002-12-06: This can be deleted when this arch is
+ ready to unwind the PC first (see frame.c:get_prev_frame()). */
+ set_gdbarch_deprecated_init_frame_pc (gdbarch, init_frame_pc_default);
/* Set the method of obtaining the sigcontext addresses at which
registers are saved. The method of checking to see if
else
tdep->sigcontext_register_address = 0;
- /* We know that Linux won't have to resort to the native_find_global_pointer
- hackery. But that's the only one we know about so far, so if
- native_find_global_pointer is set to something non-zero, then use
- it. Otherwise fall back to using generic_elf_find_global_pointer.
- This arrangement should (in theory) allow us to cross debug Linux
- binaries from an AIX machine. */
+ /* We know that GNU/Linux won't have to resort to the
+ native_find_global_pointer hackery. But that's the only one we
+ know about so far, so if native_find_global_pointer is set to
+ something non-zero, then use it. Otherwise fall back to using
+ generic_elf_find_global_pointer. This arrangement should (in
+ theory) allow us to cross debug GNU/Linux binaries from an AIX
+ machine. */
if (os_ident == ELFOSABI_LINUX)
tdep->find_global_pointer = generic_elf_find_global_pointer;
else if (native_find_global_pointer != 0)
set_gdbarch_register_convert_to_raw (gdbarch, ia64_register_convert_to_raw);
set_gdbarch_use_struct_convention (gdbarch, ia64_use_struct_convention);
- set_gdbarch_extract_return_value (gdbarch, ia64_extract_return_value);
+ set_gdbarch_deprecated_extract_return_value (gdbarch, ia64_extract_return_value);
set_gdbarch_store_struct_return (gdbarch, ia64_store_struct_return);
- set_gdbarch_store_return_value (gdbarch, ia64_store_return_value);
- set_gdbarch_extract_struct_value_address (gdbarch, ia64_extract_struct_value_address);
+ set_gdbarch_deprecated_store_return_value (gdbarch, ia64_store_return_value);
+ set_gdbarch_deprecated_extract_struct_value_address (gdbarch, ia64_extract_struct_value_address);
set_gdbarch_memory_insert_breakpoint (gdbarch, ia64_memory_insert_breakpoint);
set_gdbarch_memory_remove_breakpoint (gdbarch, ia64_memory_remove_breakpoint);
set_gdbarch_write_pc (gdbarch, ia64_write_pc);
/* Settings for calling functions in the inferior. */
- set_gdbarch_use_generic_dummy_frames (gdbarch, 1);
set_gdbarch_call_dummy_length (gdbarch, 0);
set_gdbarch_push_arguments (gdbarch, ia64_push_arguments);
set_gdbarch_push_return_address (gdbarch, ia64_push_return_address);
is all read_fp() is used for), simply use the stack pointer value
instead. */
set_gdbarch_read_fp (gdbarch, generic_target_read_sp);
- set_gdbarch_write_fp (gdbarch, generic_target_write_sp);
/* Settings that should be unnecessary. */
set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
set_gdbarch_read_sp (gdbarch, generic_target_read_sp);
set_gdbarch_write_sp (gdbarch, generic_target_write_sp);
- set_gdbarch_call_dummy_location (gdbarch, AT_ENTRY_POINT);
set_gdbarch_call_dummy_address (gdbarch, entry_point_address);
set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0);
set_gdbarch_call_dummy_start_offset (gdbarch, 0);
- set_gdbarch_pc_in_call_dummy (gdbarch, generic_pc_in_call_dummy);
set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0);
set_gdbarch_push_dummy_frame (gdbarch, generic_push_dummy_frame);
set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy);
set_gdbarch_decr_pc_after_break (gdbarch, 0);
set_gdbarch_function_start_offset (gdbarch, 0);
+ set_gdbarch_frame_args_skip (gdbarch, 0);
set_gdbarch_remote_translate_xfer_address (
gdbarch, ia64_remote_translate_xfer_address);