From: Kevin Buettner Date: Tue, 29 Sep 2015 23:31:48 +0000 (-0700) Subject: msp430: Fix bug regarding large memory model inferior function call arguments. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3b1ad7d5104a63b4c7cae69188a56d1a230f68e0;p=binutils-gdb.git msp430: Fix bug regarding large memory model inferior function call arguments. 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. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index de4606d5132..667bf27fe12 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 896ee57fce4..4c22ee429c5 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;