aboutsummaryrefslogtreecommitdiff
path: root/gdb/amd64-tdep.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2019-04-16 11:11:10 -0600
committerTom Tromey <tromey@adacore.com>2019-04-24 12:01:03 -0600
commita59240a41ac34d91e4ef5dd8b484763639388364 (patch)
tree8543a94201f810ff63de79fcf095c68bb84f2eb1 /gdb/amd64-tdep.c
parent1b8dd6432644c256ab294d205a8e00f6c6dc5073 (diff)
downloadgdb-a59240a41ac34d91e4ef5dd8b484763639388364.zip
gdb-a59240a41ac34d91e4ef5dd8b484763639388364.tar.gz
gdb-a59240a41ac34d91e4ef5dd8b484763639388364.tar.bz2
Fix passing of struct with bitfields on x86-64
Commit 4aa866af ("Fix AMD64 return value ABI in expression evaluation") introduced a regression when calling a function with a structure that contains bitfields. Because the caller of amd64_has_unaligned_fields handles bitfields already, it seemed to me that the simplest fix was to ignore bitfields here. gdb/ChangeLog 2019-04-24 Tom Tromey <tromey@adacore.com> * amd64-tdep.c (amd64_has_unaligned_fields): Ignore bitfields. gdb/testsuite/ChangeLog 2019-04-24 Tom Tromey <tromey@adacore.com> * gdb.arch/amd64-eval.exp: Test bitfield return. * gdb.arch/amd64-eval.cc (struct Bitfields): New. (class Foo) <return_bitfields>: New method. (main): Call it.
Diffstat (limited to 'gdb/amd64-tdep.c')
-rw-r--r--gdb/amd64-tdep.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c
index d4c96de..31791f9 100644
--- a/gdb/amd64-tdep.c
+++ b/gdb/amd64-tdep.c
@@ -555,11 +555,13 @@ amd64_has_unaligned_fields (struct type *type)
int bitpos = TYPE_FIELD_BITPOS (type, i);
int align = type_align(subtype);
- /* Ignore static fields, or empty fields, for example nested
- empty structures. */
+ /* Ignore static fields, empty fields (for example nested
+ empty structures), and bitfields (these are handled by
+ the caller). */
if (field_is_static (&TYPE_FIELD (type, i))
|| (TYPE_FIELD_BITSIZE (type, i) == 0
- && TYPE_LENGTH (subtype) == 0))
+ && TYPE_LENGTH (subtype) == 0)
+ || TYPE_FIELD_PACKED (type, i))
continue;
if (bitpos % 8 != 0)
@@ -569,7 +571,7 @@ amd64_has_unaligned_fields (struct type *type)
if (bytepos % align != 0)
return true;
- if (amd64_has_unaligned_fields(subtype))
+ if (amd64_has_unaligned_fields (subtype))
return true;
}
}