* gdbarch.sh: New field 'long_long_align_bit'.
* gdbarch.c, gdbarch.h: Regenerate.
* i386-tdep.c (i386_gdbarch_init): Set long_long_align_bit to 32.
* jit.c (jit_read_code_entry): Use it to determine correct size offset.
static.
* regcache.h (regcache_restore): Remove declaration.
+ * gdbarch.sh: New field 'long_long_align_bit'.
+ * gdbarch.c, gdbarch.h: Regenerate.
+ * i386-tdep.c (i386_gdbarch_init): Set long_long_align_bit to 32.
+ * jit.c (jit_read_code_entry): Use it to determine correct size offset.
+
2011-10-11 Jan Kratochvil <jan.kratochvil@redhat.com>
Revert this part of:
int int_bit;
int long_bit;
int long_long_bit;
+ int long_long_align_bit;
int half_bit;
const struct floatformat ** half_format;
int float_bit;
8 * sizeof (int), /* int_bit */
8 * sizeof (long), /* long_bit */
8 * sizeof (LONGEST), /* long_long_bit */
+ 8 * sizeof (LONGEST), /* long_long_align_bit */
16, /* half_bit */
0, /* half_format */
8 * sizeof (float), /* float_bit */
gdbarch->int_bit = 4*TARGET_CHAR_BIT;
gdbarch->long_bit = 4*TARGET_CHAR_BIT;
gdbarch->long_long_bit = 2*gdbarch->long_bit;
+ gdbarch->long_long_align_bit = 2*gdbarch->long_bit;
gdbarch->half_bit = 2*TARGET_CHAR_BIT;
gdbarch->float_bit = 4*TARGET_CHAR_BIT;
gdbarch->double_bit = 8*TARGET_CHAR_BIT;
/* Skip verify of int_bit, invalid_p == 0 */
/* Skip verify of long_bit, invalid_p == 0 */
/* Skip verify of long_long_bit, invalid_p == 0 */
+ /* Skip verify of long_long_align_bit, invalid_p == 0 */
/* Skip verify of half_bit, invalid_p == 0 */
if (gdbarch->half_format == 0)
gdbarch->half_format = floatformats_ieee_half;
fprintf_unfiltered (file,
"gdbarch_dump: long_double_format = %s\n",
pformat (gdbarch->long_double_format));
+ fprintf_unfiltered (file,
+ "gdbarch_dump: long_long_align_bit = %s\n",
+ plongest (gdbarch->long_long_align_bit));
fprintf_unfiltered (file,
"gdbarch_dump: long_long_bit = %s\n",
plongest (gdbarch->long_long_bit));
gdbarch->long_long_bit = long_long_bit;
}
+int
+gdbarch_long_long_align_bit (struct gdbarch *gdbarch)
+{
+ gdb_assert (gdbarch != NULL);
+ /* Skip verify of long_long_align_bit, invalid_p == 0 */
+ if (gdbarch_debug >= 2)
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_long_long_align_bit called\n");
+ return gdbarch->long_long_align_bit;
+}
+
+void
+set_gdbarch_long_long_align_bit (struct gdbarch *gdbarch,
+ int long_long_align_bit)
+{
+ gdbarch->long_long_align_bit = long_long_align_bit;
+}
+
int
gdbarch_half_bit (struct gdbarch *gdbarch)
{
extern int gdbarch_long_long_bit (struct gdbarch *gdbarch);
extern void set_gdbarch_long_long_bit (struct gdbarch *gdbarch, int long_long_bit);
+/* Alignment of a long long or unsigned long long for the target
+ machine. */
+
+extern int gdbarch_long_long_align_bit (struct gdbarch *gdbarch);
+extern void set_gdbarch_long_long_align_bit (struct gdbarch *gdbarch, int long_long_align_bit);
+
/* The ABI default bit-size and format for "half", "float", "double", and
"long double". These bit/format pairs should eventually be combined
into a single object. For the moment, just initialize them as a pair.
FIXME/cagney/2001-01-18: The logic is backwards. It should be asking if the
target can single step. If not, then implement single step using breakpoints.
- A return value of 1 means that the software_single_step breakpoints
+ A return value of 1 means that the software_single_step breakpoints
were inserted; 0 means they were not. */
extern int gdbarch_software_single_step_p (struct gdbarch *gdbarch);
# Number of bits in a long long or unsigned long long for the target
# machine.
v:int:long_long_bit:::8 * sizeof (LONGEST):2*gdbarch->long_bit::0
+# Alignment of a long long or unsigned long long for the target
+# machine.
+v:int:long_long_align_bit:::8 * sizeof (LONGEST):2*gdbarch->long_bit::0
# The ABI default bit-size and format for "half", "float", "double", and
# "long double". These bit/format pairs should eventually be combined
tdep->record_regmap = i386_record_regmap;
+ set_gdbarch_long_long_align_bit (gdbarch, 32);
+
/* The format used for `long double' on almost all i386 targets is
the i387 extended floating-point format. In fact, of all targets
in the GCC 2.95 tree, only OSF/1 does it different, and insists
jit_read_code_entry (struct gdbarch *gdbarch,
CORE_ADDR code_addr, struct jit_code_entry *code_entry)
{
- int err;
+ int err, off;
struct type *ptr_type;
int ptr_size;
int entry_size;
+ int align_bytes;
gdb_byte *entry_buf;
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
extract_typed_address (&entry_buf[ptr_size], ptr_type);
code_entry->symfile_addr =
extract_typed_address (&entry_buf[2 * ptr_size], ptr_type);
+
+ align_bytes = gdbarch_long_long_align_bit (gdbarch) / 8;
+ off = 3 * ptr_size;
+ off = (off + (align_bytes - 1)) & ~(align_bytes - 1);
+
code_entry->symfile_size =
- extract_unsigned_integer (&entry_buf[3 * ptr_size], 8, byte_order);
+ extract_unsigned_integer (&entry_buf[off], 8, byte_order);
}
/* This function registers code associated with a JIT code entry. It uses the