aboutsummaryrefslogtreecommitdiff
path: root/gdb/jit.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@redhat.com>2011-10-11 19:08:59 +0000
committerDavid S. Miller <davem@redhat.com>2011-10-11 19:08:59 +0000
commit205c306f8020479681add9d274b2c261acc48318 (patch)
treec2115206a3c038bad74bc1f8a3ea8cb7a558e6f6 /gdb/jit.c
parentfac7ceb31e1d0600828e3d1c5729871fe1f10600 (diff)
downloadgdb-205c306f8020479681add9d274b2c261acc48318.zip
gdb-205c306f8020479681add9d274b2c261acc48318.tar.gz
gdb-205c306f8020479681add9d274b2c261acc48318.tar.bz2
Fix jit.exp on most 32-bit targets.
* 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.
Diffstat (limited to 'gdb/jit.c')
-rw-r--r--gdb/jit.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/gdb/jit.c b/gdb/jit.c
index eb1bcc7..283ccdb 100644
--- a/gdb/jit.c
+++ b/gdb/jit.c
@@ -205,10 +205,11 @@ static void
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);
@@ -230,8 +231,13 @@ jit_read_code_entry (struct gdbarch *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