/* Target-dependent code for the x86-64 for GDB, the GNU debugger.
- Copyright 2001
- Free Software Foundation, Inc.
+
+ Copyright 2001, 2002 Free Software Foundation, Inc.
+
Contributed by Jiri Smid, SuSE Labs.
This file is part of GDB.
#include "symfile.h"
#include "x86-64-tdep.h"
#include "dwarf2cfi.h"
-
+#include "gdb_assert.h"
/* Register numbers of various important registers. */
#define RAX_REGNUM 0
-#define RDX_REGNUM 1
+#define RDX_REGNUM 3
#define RDI_REGNUM 5
#define EFLAGS_REGNUM 17
-#define XMM1_REGNUM 35
+#define ST0_REGNUM 22
+#define XMM1_REGNUM 39
+
+struct register_info
+{
+ int size;
+ char *name;
+ struct type **type;
+};
/* x86_64_register_raw_size_table[i] is the number of bytes of storage in
GDB's register array occupied by register i. */
-int x86_64_register_raw_size_table[X86_64_NUM_REGS] = {
- 8, 8, 8, 8,
- 8, 8, 8, 8,
- 8, 8, 8, 8,
- 8, 8, 8, 8,
- 8, 4,
- 10, 10, 10, 10,
- 10, 10, 10, 10,
- 4, 4, 4, 4,
- 4, 4, 4, 4,
- 16, 16, 16, 16,
- 16, 16, 16, 16,
- 16, 16, 16, 16,
- 16, 16, 16, 16,
- 4
+static struct register_info x86_64_register_info_table[] = {
+ /* 0 */ {8, "rax", &builtin_type_int64},
+ /* 1 */ {8, "rbx", &builtin_type_int64},
+ /* 2 */ {8, "rcx", &builtin_type_int64},
+ /* 3 */ {8, "rdx", &builtin_type_int64},
+ /* 4 */ {8, "rsi", &builtin_type_int64},
+ /* 5 */ {8, "rdi", &builtin_type_int64},
+ /* 6 */ {8, "rbp", &builtin_type_void_func_ptr},
+ /* 7 */ {8, "rsp", &builtin_type_void_func_ptr},
+ /* 8 */ {8, "r8", &builtin_type_int64},
+ /* 9 */ {8, "r9", &builtin_type_int64},
+ /* 10 */ {8, "r10", &builtin_type_int64},
+ /* 11 */ {8, "r11", &builtin_type_int64},
+ /* 12 */ {8, "r12", &builtin_type_int64},
+ /* 13 */ {8, "r13", &builtin_type_int64},
+ /* 14 */ {8, "r14", &builtin_type_int64},
+ /* 15 */ {8, "r15", &builtin_type_int64},
+ /* 16 */ {8, "rip", &builtin_type_void_func_ptr},
+ /* 17 */ {4, "eflags", &builtin_type_int32},
+ /* 18 */ {4, "ds", &builtin_type_int32},
+ /* 19 */ {4, "es", &builtin_type_int32},
+ /* 20 */ {4, "fs", &builtin_type_int32},
+ /* 21 */ {4, "gs", &builtin_type_int32},
+ /* 22 */ {10, "st0", &builtin_type_i387_ext},
+ /* 23 */ {10, "st1", &builtin_type_i387_ext},
+ /* 24 */ {10, "st2", &builtin_type_i387_ext},
+ /* 25 */ {10, "st3", &builtin_type_i387_ext},
+ /* 26 */ {10, "st4", &builtin_type_i387_ext},
+ /* 27 */ {10, "st5", &builtin_type_i387_ext},
+ /* 28 */ {10, "st6", &builtin_type_i387_ext},
+ /* 29 */ {10, "st7", &builtin_type_i387_ext},
+ /* 30 */ {4, "fctrl", &builtin_type_int32},
+ /* 31 */ {4, "fstat", &builtin_type_int32},
+ /* 32 */ {4, "ftag", &builtin_type_int32},
+ /* 33 */ {4, "fiseg", &builtin_type_int32},
+ /* 34 */ {4, "fioff", &builtin_type_int32},
+ /* 35 */ {4, "foseg", &builtin_type_int32},
+ /* 36 */ {4, "fooff", &builtin_type_int32},
+ /* 37 */ {4, "fop", &builtin_type_int32},
+ /* 38 */ {16, "xmm0", &builtin_type_v4sf},
+ /* 39 */ {16, "xmm1", &builtin_type_v4sf},
+ /* 40 */ {16, "xmm2", &builtin_type_v4sf},
+ /* 41 */ {16, "xmm3", &builtin_type_v4sf},
+ /* 42 */ {16, "xmm4", &builtin_type_v4sf},
+ /* 43 */ {16, "xmm5", &builtin_type_v4sf},
+ /* 44 */ {16, "xmm6", &builtin_type_v4sf},
+ /* 45 */ {16, "xmm7", &builtin_type_v4sf},
+ /* 46 */ {16, "xmm8", &builtin_type_v4sf},
+ /* 47 */ {16, "xmm9", &builtin_type_v4sf},
+ /* 48 */ {16, "xmm10", &builtin_type_v4sf},
+ /* 49 */ {16, "xmm11", &builtin_type_v4sf},
+ /* 50 */ {16, "xmm12", &builtin_type_v4sf},
+ /* 51 */ {16, "xmm13", &builtin_type_v4sf},
+ /* 52 */ {16, "xmm14", &builtin_type_v4sf},
+ /* 53 */ {16, "xmm15", &builtin_type_v4sf},
+ /* 54 */ {4, "mxcsr", &builtin_type_int32}
+};
+
+/* This array is a mapping from Dwarf-2 register
+ numbering to GDB's one. Dwarf-2 numbering is
+ defined in x86-64 ABI, section 3.6. */
+static int x86_64_dwarf2gdb_regno_map[] = {
+ 0, 1, 2, 3, /* RAX - RDX */
+ 4, 5, 6, 7, /* RSI, RDI, RBP, RSP */
+ 8, 9, 10, 11, /* R8 - R11 */
+ 12, 13, 14, 15, /* R12 - R15 */
+ -1, /* RA - not mapped */
+ XMM1_REGNUM - 1, XMM1_REGNUM, /* XMM0 ... */
+ XMM1_REGNUM + 1, XMM1_REGNUM + 2,
+ XMM1_REGNUM + 3, XMM1_REGNUM + 4,
+ XMM1_REGNUM + 5, XMM1_REGNUM + 6,
+ XMM1_REGNUM + 7, XMM1_REGNUM + 8,
+ XMM1_REGNUM + 9, XMM1_REGNUM + 10,
+ XMM1_REGNUM + 11, XMM1_REGNUM + 12,
+ XMM1_REGNUM + 13, XMM1_REGNUM + 14, /* ... XMM15 */
+ ST0_REGNUM + 0, ST0_REGNUM + 1, /* ST0 ... */
+ ST0_REGNUM + 2, ST0_REGNUM + 3,
+ ST0_REGNUM + 4, ST0_REGNUM + 5,
+ ST0_REGNUM + 6, ST0_REGNUM + 7 /* ... ST7 */
};
+static int x86_64_dwarf2gdb_regno_map_length =
+ sizeof (x86_64_dwarf2gdb_regno_map) /
+ sizeof (x86_64_dwarf2gdb_regno_map[0]);
+
+/* Number of all registers */
+#define X86_64_NUM_REGS (sizeof (x86_64_register_info_table) / \
+ sizeof (x86_64_register_info_table[0]))
+
+/* Number of general registers. */
+#define X86_64_NUM_GREGS (22)
+
+int x86_64_num_regs = X86_64_NUM_REGS;
+int x86_64_num_gregs = X86_64_NUM_GREGS;
+
+/* Did we already print a note about frame pointer? */
+int omit_fp_note_printed = 0;
+
/* Number of bytes of storage in the actual machine representation for
register REGNO. */
int
x86_64_register_raw_size (int regno)
{
- return x86_64_register_raw_size_table[regno];
+ return x86_64_register_info_table[regno].size;
}
/* x86_64_register_byte_table[i] is the offset into the register file of the
start of register number i. We initialize this from
- x86_64_register_raw_size_table. */
+ x86_64_register_info_table. */
int x86_64_register_byte_table[X86_64_NUM_REGS];
/* Index within `registers' of the first byte of the space for register REGNO. */
static struct type *
x86_64_register_virtual_type (int regno)
{
- if (regno == PC_REGNUM || regno == SP_REGNUM)
- return lookup_pointer_type (builtin_type_void);
- if (IS_FP_REGNUM (regno))
- return builtin_type_long_double;
- if (IS_SSE_REGNUM (regno))
- return builtin_type_v4sf;
- if (IS_FPU_CTRL_REGNUM (regno) || regno == MXCSR_REGNUM
- || regno == EFLAGS_REGNUM)
- return builtin_type_int;
- return builtin_type_long;
-}
-
-/* Number of bytes of storage in the program's representation
- for register REGNO. */
-int
-x86_64_register_virtual_size (int regno)
-{
- return (TYPE_LENGTH (x86_64_register_virtual_type (regno)));
+ return *x86_64_register_info_table[regno].type;
}
/* x86_64_register_convertible is true if register N's virtual format is
x86_64_register_convert_to_virtual (int regnum, struct type *type,
char *from, char *to)
{
-/* Copy straight over, but take care of the padding. */
- memcpy (to, from, FPU_REG_RAW_SIZE);
- memset (to + FPU_REG_RAW_SIZE, 0, TYPE_LENGTH (type) - FPU_REG_RAW_SIZE);
+ char buf[12];
+
+ /* We only support floating-point values. */
+ if (TYPE_CODE (type) != TYPE_CODE_FLT)
+ {
+ warning ("Cannot convert floating-point register value "
+ "to non-floating-point type.");
+ memset (to, 0, TYPE_LENGTH (type));
+ return;
+ }
+ /* First add the necessary padding. */
+ memcpy (buf, from, FPU_REG_RAW_SIZE);
+ memset (buf + FPU_REG_RAW_SIZE, 0, sizeof buf - FPU_REG_RAW_SIZE);
+ /* Convert to TYPE. This should be a no-op, if TYPE is equivalent
+ to the extended floating-point format used by the FPU. */
+ convert_typed_floating (to, type, buf,
+ x86_64_register_virtual_type (regnum));
}
/* Convert data from virtual format with type TYPE in buffer FROM to
x86_64_register_convert_to_raw (struct type *type, int regnum,
char *from, char *to)
{
+ gdb_assert (TYPE_CODE (type) == TYPE_CODE_FLT && TYPE_LENGTH (type) == 12);
+ /* Simply omit the two unused bytes. */
memcpy (to, from, FPU_REG_RAW_SIZE);
}
-\f
+
+/* Dwarf-2 <-> GDB register numbers mapping. */
+int
+x86_64_dwarf2_reg_to_regnum (int dw_reg)
+{
+ if (dw_reg < 0 || dw_reg > x86_64_dwarf2gdb_regno_map_length)
+ {
+ warning ("Dwarf-2 uses unmapped register #%d\n", dw_reg);
+ return dw_reg;
+ }
+
+ return x86_64_dwarf2gdb_regno_map[dw_reg];
+}
/* This is the variable that is set with "set disassembly-flavour", and
its legitimate values. */
case TYPE_CODE_STRUCT:
{
int j;
- for (j = 0; j < type->nfields; ++j)
+ for (j = 0; j < TYPE_NFIELDS (type); ++j)
{
- int num = classify_argument (type->fields[j].type,
+ int num = classify_argument (TYPE_FIELDS (type)[j].type,
subclasses,
- (type->fields[j].loc.bitpos
+ (TYPE_FIELDS (type)[j].loc.bitpos
+ bit_offset) % 256);
if (!num)
return 0;
for (i = 0; i < num; i++)
{
int pos =
- (type->fields[j].loc.bitpos + bit_offset) / 8 / 8;
+ (TYPE_FIELDS (type)[j].loc.bitpos + bit_offset) / 8 / 8;
classes[i + pos] =
merge_classes (subclasses[i], classes[i + pos]);
}
{
int num;
- num = classify_argument (type->target_type,
+ num = classify_argument (TYPE_TARGET_TYPE (type),
subclasses, bit_offset);
if (!num)
return 0;
{
int j;
{
- for (j = 0; j < type->nfields; ++j)
+ for (j = 0; j < TYPE_NFIELDS (type); ++j)
{
int num;
- num = classify_argument (type->fields[j].type,
+ num = classify_argument (TYPE_FIELDS (type)[j].type,
subclasses, bit_offset);
if (!num)
return 0;
}
}
break;
+ default:
+ break;
}
/* Final merger cleanup. */
for (i = 0; i < words; i++)
}
case TYPE_CODE_VOID:
return 0;
+ default: /* Avoid warning. */
+ break;
}
- internal_error (__FILE__, __LINE__, "classify_argument: unknown argument type");
+ internal_error (__FILE__, __LINE__,
+ "classify_argument: unknown argument type");
}
/* Examine the argument and return set number of register required in each
case X86_64_X87UP_CLASS:
break;
case X86_64_MEMORY_CLASS:
- internal_error (__FILE__, __LINE__, "examine_argument: unexpected memory class");
+ internal_error (__FILE__, __LINE__,
+ "examine_argument: unexpected memory class");
}
return 1;
}
#define INT_REGS 6
#define SSE_REGS 16
-/* Push onto the stack the specified value VALUE. Pad it correctly for
- it to be an argument to a function. */
-
-static CORE_ADDR
-value_push (register CORE_ADDR sp, value_ptr arg)
-{
- register int len = TYPE_LENGTH (VALUE_ENCLOSING_TYPE (arg));
- register int container_len = len;
-
- /* How big is the container we're going to put this value in? */
- if (PARM_BOUNDARY)
- container_len = ((len + PARM_BOUNDARY / TARGET_CHAR_BIT - 1)
- & ~(PARM_BOUNDARY / TARGET_CHAR_BIT - 1));
-
- sp -= container_len;
- write_memory (sp, VALUE_CONTENTS_ALL (arg), len);
-
- return sp;
-}
-
CORE_ADDR
-x86_64_push_arguments (int nargs, value_ptr *args, CORE_ADDR sp,
+x86_64_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
int struct_return, CORE_ADDR struct_addr)
{
int intreg = 0;
int ssereg = 0;
int i;
- static int int_parameter_registers[INT_REGS] = {5 /*RDI*/, 4 /*RSI*/,
- 1 /*RDX*/, 2 /*RCX*/,
- 8 /*R8 */, 9 /*R9 */};
+ static int int_parameter_registers[INT_REGS] = {
+ 5 /* RDI */ , 4 /* RSI */ ,
+ 3 /* RDX */ , 2 /* RCX */ ,
+ 8 /* R8 */ , 9 /* R9 */
+ };
/* XMM0 - XMM15 */
- static int sse_parameter_registers[SSE_REGS] = {34, 35, 36, 37,
- 38, 39, 40, 41,
- 42, 43, 44, 45,
- 46, 47, 48, 49};
+ static int sse_parameter_registers[SSE_REGS] = {
+ XMM1_REGNUM - 1, XMM1_REGNUM, XMM1_REGNUM + 1, XMM1_REGNUM + 2,
+ XMM1_REGNUM + 3, XMM1_REGNUM + 4, XMM1_REGNUM + 5, XMM1_REGNUM + 6,
+ XMM1_REGNUM + 7, XMM1_REGNUM + 8, XMM1_REGNUM + 9, XMM1_REGNUM + 10,
+ XMM1_REGNUM + 11, XMM1_REGNUM + 12, XMM1_REGNUM + 13, XMM1_REGNUM + 14
+ };
+ int stack_values_count = 0;
+ int *stack_values;
+ stack_values = alloca (nargs * sizeof (int));
for (i = 0; i < nargs; i++)
{
enum x86_64_reg_class class[MAX_CLASSES];
if (!n ||
!examine_argument (class, n, &needed_intregs, &needed_sseregs)
- || intreg + needed_intregs > INT_REGS
- || ssereg + needed_sseregs > SSE_REGS)
- { /* memory class */
- sp = value_push (sp, args[i]);
+ || intreg / 2 + needed_intregs > INT_REGS
+ || ssereg / 2 + needed_sseregs > SSE_REGS)
+ { /* memory class */
+ stack_values[stack_values_count++] = i;
}
else
{
case X86_64_NO_CLASS:
break;
case X86_64_INTEGER_CLASS:
- write_register_gen (int_parameter_registers[(intreg + 1) / 2],
+ write_register_gen (int_parameter_registers
+ [(intreg + 1) / 2],
VALUE_CONTENTS_ALL (args[i]) + offset);
offset += 8;
intreg += 2;
case X86_64_SSEDF_CLASS:
case X86_64_SSESF_CLASS:
case X86_64_SSE_CLASS:
- write_register_gen (sse_parameter_registers[(ssereg + 1) / 2],
+ write_register_gen (sse_parameter_registers
+ [(ssereg + 1) / 2],
VALUE_CONTENTS_ALL (args[i]) + offset);
offset += 8;
ssereg += 2;
ssereg++;
break;
case X86_64_X87_CLASS:
- case X86_64_X87UP_CLASS:
case X86_64_MEMORY_CLASS:
- sp = value_push (sp, args[i]);
+ stack_values[stack_values_count++] = i;
+ break;
+ case X86_64_X87UP_CLASS:
break;
default:
internal_error (__FILE__, __LINE__,
}
}
}
+ while (--stack_values_count >= 0)
+ {
+ struct value *arg = args[stack_values[stack_values_count]];
+ int len = TYPE_LENGTH (VALUE_ENCLOSING_TYPE (arg));
+ len += 7;
+ len -= len % 8;
+ sp -= len;
+ write_memory (sp, VALUE_CONTENTS_ALL (arg), len);
+ }
return sp;
}
static char *
x86_64_register_name (int reg_nr)
{
- static char *register_names[] = {
- "rax", "rdx", "rcx", "rbx",
- "rsi", "rdi", "rbp", "rsp",
- "r8", "r9", "r10", "r11",
- "r12", "r13", "r14", "r15",
- "rip", "eflags",
- "st0", "st1", "st2", "st3",
- "st4", "st5", "st6", "st7",
- "fctrl", "fstat", "ftag", "fiseg",
- "fioff", "foseg", "fooff", "fop",
- "xmm0", "xmm1", "xmm2", "xmm3",
- "xmm4", "xmm5", "xmm6", "xmm7",
- "xmm8", "xmm9", "xmm10", "xmm11",
- "xmm12", "xmm13", "xmm14", "xmm15",
- "mxcsr"
- };
- if (reg_nr < 0)
+ if (reg_nr < 0 || reg_nr >= X86_64_NUM_REGS)
return NULL;
- if (reg_nr >= (sizeof (register_names) / sizeof (*register_names)))
- return NULL;
- return register_names[reg_nr];
+ return x86_64_register_info_table[reg_nr].name;
}
\f
return 0;
}
-/* On x86_64 there are no reasonable prologs. */
+/* If a function with debugging information and known beginning
+ is detected, we will return pc of the next line in the source
+ code. With this approach we effectively skip the prolog. */
+
+#define PROLOG_BUFSIZE 4
CORE_ADDR
x86_64_skip_prologue (CORE_ADDR pc)
{
+ int i, firstline, currline;
+ struct symtab_and_line v_sal;
+ struct symbol *v_function;
+ CORE_ADDR salendaddr = 0, endaddr = 0;
+
+ /* We will handle only functions beginning with:
+ 55 pushq %rbp
+ 48 89 e5 movq %rsp,%rbp
+ */
+ unsigned char prolog_expect[PROLOG_BUFSIZE] = { 0x55, 0x48, 0x89, 0xe5 },
+ prolog_buf[PROLOG_BUFSIZE];
+
+ read_memory (pc, (char *) prolog_buf, PROLOG_BUFSIZE);
+
+ /* First check, whether pc points to pushq %rbp. If not,
+ * print a recommendation to enable frame pointer. */
+ if (prolog_expect[0] != prolog_buf[0])
+ {
+ if (!omit_fp_note_printed)
+ {
+ printf_filtered
+ ("NOTE: This function doesn't seem to have a valid prologue.\n"
+ " Consider adding -fno-omit-frame-pointer to your gcc's CFLAGS.\n");
+ omit_fp_note_printed++;
+ }
+ return pc;
+ }
+ /* Valid prolog continues with movq %rsp,%rbp. */
+ for (i = 1; i < PROLOG_BUFSIZE; i++)
+ if (prolog_expect[i] != prolog_buf[i])
+ return pc + 1; /* First instruction after pushq %rbp. */
+
+ v_function = find_pc_function (pc);
+ v_sal = find_pc_line (pc, 0);
+
+ /* If pc doesn't point to a function with debuginfo,
+ some of the following may be NULL. */
+ if (!v_function || !v_function->ginfo.value.block || !v_sal.symtab)
+ return pc;
+
+ firstline = v_sal.line;
+ currline = firstline;
+ salendaddr = v_sal.end;
+ endaddr = v_function->ginfo.value.block->endaddr;
+
+ for (i = 0; i < v_sal.symtab->linetable->nitems; i++)
+ if (v_sal.symtab->linetable->item[i].line > firstline
+ && v_sal.symtab->linetable->item[i].pc >= salendaddr
+ && v_sal.symtab->linetable->item[i].pc < endaddr)
+ {
+ pc = v_sal.symtab->linetable->item[i].pc;
+ currline = v_sal.symtab->linetable->item[i].line;
+ break;
+ }
+
return pc;
}
/* Sequence of bytes for breakpoint instruction. */
static unsigned char *
-x86_64_breakpoint_from_pc (CORE_ADDR *pc, int *lenptr)
+x86_64_breakpoint_from_pc (CORE_ADDR * pc, int *lenptr)
{
static unsigned char breakpoint[] = { 0xcc };
*lenptr = 1;
}
static struct gdbarch *
-i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
+x86_64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
{
struct gdbarch *gdbarch;
struct gdbarch_tdep *tdep;
+ int i, sum;
/* Find a candidate among the list of pre-declared architectures. */
for (arches = gdbarch_list_lookup_by_info (arches, &info);
break;
default:
internal_error (__FILE__, __LINE__,
- "i386_gdbarch_init: unknown machine type");
+ "x86_64_gdbarch_init: unknown machine type");
}
break;
case bfd_mach_i386_i386:
return arches->gdbarch;
default:
internal_error (__FILE__, __LINE__,
- "i386_gdbarch_init: unknown machine type");
+ "x86_64_gdbarch_init: unknown machine type");
}
break;
default:
internal_error (__FILE__, __LINE__,
- "i386_gdbarch_init: unknown machine type");
+ "x86_64_gdbarch_init: unknown machine type");
}
}
{
case bfd_mach_x86_64:
case bfd_mach_x86_64_intel_syntax:
- tdep->last_fpu_regnum = 25;
- tdep->first_xmm_regnum = 34;
- tdep->last_xmm_regnum = 49;
- tdep->mxcsr_regnum = 50;
- tdep->first_fpu_ctrl_regnum = 26;
+ tdep->num_xmm_regs = 16;
break;
case bfd_mach_i386_i386:
case bfd_mach_i386_i8086:
break;
default:
internal_error (__FILE__, __LINE__,
- "i386_gdbarch_init: unknown machine type");
+ "x86_64_gdbarch_init: unknown machine type");
}
set_gdbarch_long_bit (gdbarch, 64);
set_gdbarch_ptr_bit (gdbarch, 64);
set_gdbarch_long_double_format (gdbarch, &floatformat_i387_ext);
- set_gdbarch_ieee_float (gdbarch, 1);
-
set_gdbarch_num_regs (gdbarch, X86_64_NUM_REGS);
set_gdbarch_register_name (gdbarch, x86_64_register_name);
set_gdbarch_register_raw_size (gdbarch, x86_64_register_raw_size);
set_gdbarch_max_register_raw_size (gdbarch, 16);
set_gdbarch_register_byte (gdbarch, x86_64_register_byte);
+
/* Total amount of space needed to store our copies of the machine's register
(SIZEOF_GREGS + SIZEOF_FPU_REGS + SIZEOF_FPU_CTRL_REGS + SIZEOF_SSE_REGS) */
- set_gdbarch_register_bytes (gdbarch,
- (18 * 8) + (8 * 10) + (8 * 4) + (8 * 16 + 4));
- set_gdbarch_register_virtual_size (gdbarch, x86_64_register_virtual_size);
+ for (i = 0, sum = 0; i < X86_64_NUM_REGS; i++)
+ sum += x86_64_register_info_table[i].size;
+ set_gdbarch_register_bytes (gdbarch, sum);
+ set_gdbarch_register_virtual_size (gdbarch, generic_register_size);
set_gdbarch_max_register_virtual_size (gdbarch, 16);
set_gdbarch_register_virtual_type (gdbarch, x86_64_register_virtual_type);
set_gdbarch_fp_regnum (gdbarch, 6); /* (rbp) */
set_gdbarch_pc_regnum (gdbarch, 16); /* (rip) Contains program counter. */
- set_gdbarch_fp0_regnum (gdbarch, 18); /* First FPU floating-point register. */
+ set_gdbarch_fp0_regnum (gdbarch, X86_64_NUM_GREGS); /* First FPU floating-point register. */
set_gdbarch_read_fp (gdbarch, cfi_read_fp);
- set_gdbarch_write_fp (gdbarch, cfi_write_fp);
/* Discard from the stack the innermost frame, restoring all registers. */
set_gdbarch_pop_frame (gdbarch, x86_64_pop_frame);
set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
- set_gdbarch_breakpoint_from_pc (gdbarch, x86_64_breakpoint_from_pc);
+ set_gdbarch_breakpoint_from_pc (gdbarch,
+ (gdbarch_breakpoint_from_pc_ftype *)
+ x86_64_breakpoint_from_pc);
/* Amount PC must be decremented by after a breakpoint. This is often the
number of bytes in BREAKPOINT but not always. */
set_gdbarch_decr_pc_after_break (gdbarch, 1);
+/* Use dwarf2 debug frame informations. */
+ set_gdbarch_dwarf2_build_frame_info (gdbarch, dwarf2_build_frame_info);
+ set_gdbarch_dwarf2_reg_to_regnum (gdbarch, x86_64_dwarf2_reg_to_regnum);
+
return gdbarch;
}
void
_initialize_x86_64_tdep (void)
{
- register_gdbarch_init (bfd_arch_i386, i386_gdbarch_init);
+ register_gdbarch_init (bfd_arch_i386, x86_64_gdbarch_init);
/* Initialize the table saying where each register starts in the
register file. */
for (i = 0; i < X86_64_NUM_REGS; i++)
{
x86_64_register_byte_table[i] = offset;
- offset += x86_64_register_raw_size_table[i];
+ offset += x86_64_register_info_table[i].size;
}
}