aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Burgess <aburgess@broadcom.com>2011-06-23 09:51:57 +0000
committerAndrew Burgess <aburgess@broadcom.com>2011-06-23 09:51:57 +0000
commit86c3c1fccc917b1674bde0d41c24c4331c758e6b (patch)
tree990f3c0ec26eb420307c6a382ee774c9e03ce869
parent9497469fbddef7bf2c3bfd6568735e537e9a09b0 (diff)
downloadgdb-86c3c1fccc917b1674bde0d41c24c4331c758e6b.zip
gdb-86c3c1fccc917b1674bde0d41c24c4331c758e6b.tar.gz
gdb-86c3c1fccc917b1674bde0d41c24c4331c758e6b.tar.bz2
http://sourceware.org/ml/gdb-patches/2011-06/msg00136.html
2011-06-23 Andrew Burgess <aburgess@broadcom.com> * gdbtypes.c (append_composite_type_field_aligned): Fix calculation of bit position based on alignment.
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/gdbtypes.c9
2 files changed, 11 insertions, 3 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index fb4c664..b2ff7ff 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2011-06-23 Andrew Burgess <aburgess@broadcom.com>
+
+ * gdbtypes.c (append_composite_type_field_aligned): Fix
+ calculation of bit position based on alignment.
+
2011-06-22 Pedro Alves <pedro@codesourcery.com>
* breakpoint.c (bpstat_stop_status): Call the check_status
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 2bdb4eb..2572046 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -3654,12 +3654,15 @@ append_composite_type_field_aligned (struct type *t, char *name,
if (alignment)
{
- int left = FIELD_BITPOS (f[0]) % (alignment * TARGET_CHAR_BIT);
+ int left;
+
+ alignment *= TARGET_CHAR_BIT;
+ left = FIELD_BITPOS (f[0]) % alignment;
if (left)
{
- FIELD_BITPOS (f[0]) += left;
- TYPE_LENGTH (t) += left / TARGET_CHAR_BIT;
+ FIELD_BITPOS (f[0]) += (alignment - left);
+ TYPE_LENGTH (t) += (alignment - left) / TARGET_CHAR_BIT;
}
}
}