From patchwork Wed Sep 30 05:01:31 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Buettner X-Patchwork-Id: 8885 Received: (qmail 2229 invoked by alias); 30 Sep 2015 05:01:39 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 2216 invoked by uid 89); 30 Sep 2015 05:01:38 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.7 required=5.0 tests=AWL, BAYES_00, SPF_HELO_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Wed, 30 Sep 2015 05:01:37 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id 026038F2E4 for ; Wed, 30 Sep 2015 05:01:35 +0000 (UTC) Received: from pinnacle.lan ([10.3.113.5]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t8U51YF0023684 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA256 bits=256 verify=NO) for ; Wed, 30 Sep 2015 01:01:35 -0400 Date: Tue, 29 Sep 2015 22:01:31 -0700 From: Kevin Buettner To: gdb-patches@sourceware.org Subject: [COMMITTED PATCH] msp430: Fix bug regarding large memory model inferior function call arguments Message-ID: <20150929220131.0afd4813@pinnacle.lan> MIME-Version: 1.0 X-IsSubscribed: yes This change causes reference, struct, and union arguments to be treated the same as pointer arguments when determining the size of the value to place into a register. The case for doing this for reference arguments is obvious. The msp430 ABI specifies that struct and union arguments are passed by reference. This is why they're treated in the same manner as pointer and reference arguments when computing the size of the value to place into a register. In my testing using this multilib... msp430-sim/-msim/-mcpu=msp430x/-mlarge/-mdata-region=either/-mcode-region=either ... I find that the the following failures, 125 in all, are fixed by this patch. FAIL: gdb.base/callfuncs.exp: call inferior func with struct - returns char FAIL: gdb.base/callfuncs.exp: call inferior func with struct - returns short FAIL: gdb.base/callfuncs.exp: call inferior func with struct - returns int FAIL: gdb.base/callfuncs.exp: call inferior func with struct - returns long FAIL: gdb.base/callfuncs.exp: call inferior func with struct - returns float FAIL: gdb.base/callfuncs.exp: call inferior func with struct - returns double FAIL: gdb.base/callfuncs.exp: call inferior func with struct - returns float _Complex FAIL: gdb.base/callfuncs.exp: call inferior func with struct - returns double _Complex FAIL: gdb.base/callfuncs.exp: call inferior func with struct - returns long double _Complex FAIL: gdb.base/callfuncs.exp: call inferior func with struct - returns char * FAIL: gdb.base/callfuncs.exp: noproto: call inferior func with struct - returns char FAIL: gdb.base/callfuncs.exp: noproto: call inferior func with struct - returns short FAIL: gdb.base/callfuncs.exp: noproto: call inferior func with struct - returns int FAIL: gdb.base/callfuncs.exp: noproto: call inferior func with struct - returns long FAIL: gdb.base/callfuncs.exp: noproto: call inferior func with struct - returns float FAIL: gdb.base/callfuncs.exp: noproto: call inferior func with struct - returns double FAIL: gdb.base/callfuncs.exp: noproto: call inferior func with struct - returns float _Complex FAIL: gdb.base/callfuncs.exp: noproto: call inferior func with struct - returns double _Complex FAIL: gdb.base/callfuncs.exp: noproto: call inferior func with struct - returns long double _Complex FAIL: gdb.base/callfuncs.exp: noproto: call inferior func with struct - returns char * FAIL: gdb.base/structs.exp: p/c L; call 1 structs-tc FAIL: gdb.base/structs.exp: p/c L; call 2 structs-tc FAIL: gdb.base/structs.exp: p/c L; call 3 structs-tc FAIL: gdb.base/structs.exp: p/c L; call 4 structs-tc FAIL: gdb.base/structs.exp: p/c L; call 5 structs-tc FAIL: gdb.base/structs.exp: p/c L; call 6 structs-tc FAIL: gdb.base/structs.exp: p/c L; call 7 structs-tc FAIL: gdb.base/structs.exp: p/c L; call 8 structs-tc FAIL: gdb.base/structs.exp: p/c L; call 9 structs-tc FAIL: gdb.base/structs.exp: p/c L; call 10 structs-tc FAIL: gdb.base/structs.exp: p/c L; call 11 structs-tc FAIL: gdb.base/structs.exp: p/c L; call 12 structs-tc FAIL: gdb.base/structs.exp: p/c L; call 13 structs-tc FAIL: gdb.base/structs.exp: p/c L; call 14 structs-tc FAIL: gdb.base/structs.exp: p/c L; call 15 structs-tc FAIL: gdb.base/structs.exp: p/c L; call 16 structs-tc FAIL: gdb.base/structs.exp: p/c L; call 17 structs-tc FAIL: gdb.base/structs.exp: p/c L; call 1 structs-ts FAIL: gdb.base/structs.exp: p/c L; call 2 structs-ts FAIL: gdb.base/structs.exp: p/c L; call 3 structs-ts FAIL: gdb.base/structs.exp: p/c L; call 4 structs-ts FAIL: gdb.base/structs.exp: p/c L; call 5 structs-ts FAIL: gdb.base/structs.exp: p/c L; call 1 structs-ti FAIL: gdb.base/structs.exp: p/c L; call 2 structs-ti FAIL: gdb.base/structs.exp: p/c L; call 3 structs-ti FAIL: gdb.base/structs.exp: p/c L; call 1 structs-tl FAIL: gdb.base/structs.exp: p/c L; call 2 structs-tl FAIL: gdb.base/structs.exp: p/c L; call 3 structs-tl FAIL: gdb.base/structs.exp: p/c L; call 1 structs-tll FAIL: gdb.base/structs.exp: p/c L; call 2 structs-tll FAIL: gdb.base/structs.exp: p/c L; call 1 structs-tf FAIL: gdb.base/structs.exp: p/c L; call 2 structs-tf FAIL: gdb.base/structs.exp: p/c L; call 3 structs-tf FAIL: gdb.base/structs.exp: p/c L; call 1 structs-td FAIL: gdb.base/structs.exp: p/c L; call 2 structs-td FAIL: gdb.base/structs.exp: p/c L; call 1 structs-tld FAIL: gdb.base/structs.exp: p/c L; call 2 structs-tld FAIL: gdb.base/structs.exp: p/c L; call 2 structs-ts-tc FAIL: gdb.base/structs.exp: p/c L; call 3 structs-ts-tc FAIL: gdb.base/structs.exp: p/c L; call 4 structs-ts-tc FAIL: gdb.base/structs.exp: p/c L; call 5 structs-ts-tc FAIL: gdb.base/structs.exp: p/c L; call 6 structs-ts-tc FAIL: gdb.base/structs.exp: p/c L; call 7 structs-ts-tc FAIL: gdb.base/structs.exp: p/c L; call 8 structs-ts-tc FAIL: gdb.base/structs.exp: p/c L; call 2 structs-ti-tc FAIL: gdb.base/structs.exp: p/c L; call 3 structs-ti-tc FAIL: gdb.base/structs.exp: p/c L; call 4 structs-ti-tc FAIL: gdb.base/structs.exp: p/c L; call 5 structs-ti-tc FAIL: gdb.base/structs.exp: p/c L; call 6 structs-ti-tc FAIL: gdb.base/structs.exp: p/c L; call 2 structs-tl-tc FAIL: gdb.base/structs.exp: p/c L; call 3 structs-tl-tc FAIL: gdb.base/structs.exp: p/c L; call 4 structs-tl-tc FAIL: gdb.base/structs.exp: p/c L; call 5 structs-tl-tc FAIL: gdb.base/structs.exp: p/c L; call 6 structs-tl-tc FAIL: gdb.base/structs.exp: p/c L; call 2 structs-tll-tc FAIL: gdb.base/structs.exp: p/c L; call 2 structs-tf-tc FAIL: gdb.base/structs.exp: p/c L; call 3 structs-tf-tc FAIL: gdb.base/structs.exp: p/c L; call 4 structs-tf-tc FAIL: gdb.base/structs.exp: p/c L; call 5 structs-tf-tc FAIL: gdb.base/structs.exp: p/c L; call 6 structs-tf-tc FAIL: gdb.base/structs.exp: p/c L; call 2 structs-td-tc FAIL: gdb.base/structs.exp: p/c L; call 2 structs-tld-tc FAIL: gdb.base/structs.exp: p/c L; call 2 structs-tc-ts FAIL: gdb.base/structs.exp: p/c L; call 3 structs-tc-ts FAIL: gdb.base/structs.exp: p/c L; call 4 structs-tc-ts FAIL: gdb.base/structs.exp: p/c L; call 5 structs-tc-ts FAIL: gdb.base/structs.exp: p/c L; call 6 structs-tc-ts FAIL: gdb.base/structs.exp: p/c L; call 2 structs-tc-ti FAIL: gdb.base/structs.exp: p/c L; call 3 structs-tc-ti FAIL: gdb.base/structs.exp: p/c L; call 4 structs-tc-ti FAIL: gdb.base/structs.exp: p/c L; call 2 structs-tc-tl FAIL: gdb.base/structs.exp: p/c L; call 3 structs-tc-tl FAIL: gdb.base/structs.exp: p/c L; call 4 structs-tc-tl FAIL: gdb.base/structs.exp: p/c L; call 2 structs-tc-tll FAIL: gdb.base/structs.exp: p/c L; call 2 structs-tc-tf FAIL: gdb.base/structs.exp: p/c L; call 3 structs-tc-tf FAIL: gdb.base/structs.exp: p/c L; call 4 structs-tc-tf FAIL: gdb.base/structs.exp: p/c L; call 2 structs-tc-td FAIL: gdb.base/structs.exp: p/c L; call 2 structs-tc-tld FAIL: gdb.base/structs.exp: p/c L; call 2 structs-td-tf FAIL: gdb.base/structs.exp: p/c L; call 2 structs-tf-td FAIL: gdb.cp/classes.exp: call class_param.Aref_a (g_A) FAIL: gdb.cp/classes.exp: call class_param.Aref_x (g_A) FAIL: gdb.cp/classes.exp: call class_param.Aref_a (g_B) FAIL: gdb.cp/classes.exp: call class_param.Aref_x (g_B) FAIL: gdb.cp/classes.exp: call class_param.Aval_a (g_A) FAIL: gdb.cp/classes.exp: call class_param.Aval_x (g_A) FAIL: gdb.cp/classes.exp: call class_param.Aval_a (g_B) FAIL: gdb.cp/classes.exp: call class_param.Aval_x (g_B) FAIL: gdb.cp/ref-params.exp: print value of f1 on Child in main FAIL: gdb.cp/ref-params.exp: print value of f2 on Child in main FAIL: gdb.cp/ref-params.exp: print value of f1 on (Child&) in main FAIL: gdb.cp/ref-params.exp: print value of f2 on (Child&) in main FAIL: gdb.cp/ref-params.exp: print value of f1 on Child& in f2 FAIL: gdb.cp/ref-params.exp: print f1(MQ) FAIL: gdb.cp/ref-params.exp: print mf1(MQ) FAIL: gdb.cp/ref-params.exp: print mf2(MQ) FAIL: gdb.cp/ref-params.exp: print f1(MQR) FAIL: gdb.cp/ref-params.exp: print mf1(MQR) FAIL: gdb.cp/ref-params.exp: print mf2(MQR) FAIL: gdb.python/py-xmethods.exp: Before: a1 + a2 FAIL: gdb.python/py-xmethods.exp: Before: a2 - a1 FAIL: gdb.python/py-xmethods.exp: Before: b1 - a1 FAIL: gdb.python/py-xmethods.exp: After: a2 - a1 FAIL: gdb.python/py-xmethods.exp: After: b1 - a1 gdb/ChangeLog: * msp430-tdep.c (msp430_push_dummy_call): Treat reference, struct, and union arguments the same as pointer arguments when determining size of argument. --- gdb/ChangeLog | 6 ++++++ gdb/msp430-tdep.c | 12 +++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index de4606d..667bf27 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2015-09-29 Kevin Buettner + + * msp430-tdep.c (msp430_push_dummy_call): Treat reference, struct, + and union arguments the same as pointer arguments when determining + size of argument. + 2015-09-29 James Bowman * ft32-tdep.c: #include "opcode/ft32.h". diff --git a/gdb/msp430-tdep.c b/gdb/msp430-tdep.c index 896ee57..4c22ee4 100644 --- a/gdb/msp430-tdep.c +++ b/gdb/msp430-tdep.c @@ -772,10 +772,16 @@ msp430_push_dummy_call (struct gdbarch *gdbarch, struct value *function, int size = 2; if (code_model == MSP_LARGE_CODE_MODEL - && TYPE_CODE (arg_type) == TYPE_CODE_PTR) + && (TYPE_CODE (arg_type) == TYPE_CODE_PTR + || TYPE_CODE (arg_type) == TYPE_CODE_REF + || TYPE_CODE (arg_type) == TYPE_CODE_STRUCT + || TYPE_CODE (arg_type) == TYPE_CODE_UNION)) { - /* Pointer arguments using large memory model are passed - using entire register. */ + /* When using the large memory model, pointer, + reference, struct, and union arguments are + passed using the entire register. (As noted + earlier, aggregates are always passed by + reference.) */ if (offset != 0) continue; size = 4;