From: kettenis Date: Sat, 10 Jan 2004 17:58:29 +0000 (+0000) Subject: * x86-64-tdep.c (amd64_non_pod_p): New function. X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=5cee2c17c6e84fdcd6b1638bf15f758b902ced26;p=pf3gnuchains%2Fsourceware.git * x86-64-tdep.c (amd64_non_pod_p): New function. (amd64_classify_aggregate): Return class memory for non-POD C++ structure types. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index bdf88b9130..929fe9b4b0 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,9 @@ 2004-01-10 Mark Kettenis + * x86-64-tdep.c (amd64_non_pod_p): New function. + (amd64_classify_aggregate): Return class memory for non-POD + C++ structure types. + * x86-64-tdep.c (amd64_push_arguments): Add struct_return argument. Use it to reserve a register if necessary. (amd64_push_dummy_call): Pass STRUCT_RETURN in call to diff --git a/gdb/x86-64-tdep.c b/gdb/x86-64-tdep.c index 242d597ace..fcb29edc25 100644 --- a/gdb/x86-64-tdep.c +++ b/gdb/x86-64-tdep.c @@ -270,6 +270,19 @@ amd64_merge_classes (enum amd64_reg_class class1, enum amd64_reg_class class2) static void amd64_classify (struct type *type, enum amd64_reg_class class[2]); +/* Return non-zero if TYPE is a non-POD structure or union type. */ + +static int +amd64_non_pod_p (struct type *type) +{ + /* ??? A class with a base class certainly isn't POD, but does this + catch all non-POD structure types? */ + if (TYPE_CODE (type) == TYPE_CODE_STRUCT && TYPE_N_BASECLASSES (type) > 0) + return 1; + + return 0; +} + /* Classify TYPE according to the rules for aggregate (structures and arrays) and union types, and store the result in CLASS. */ @@ -281,7 +294,7 @@ amd64_classify_aggregate (struct type *type, enum amd64_reg_class class[2]) /* 1. If the size of an object is larger than two eightbytes, or in C++, is a non-POD structure or union type, or contains unaligned fields, it has class memory. */ - if (len > 16) + if (len > 16 || amd64_non_pod_p (type)) { class[0] = class[1] = AMD64_MEMORY; return;