This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] msp430: Fix bug regarding large memory model inferior function call arguments.


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=3b1ad7d5104a63b4c7cae69188a56d1a230f68e0

commit 3b1ad7d5104a63b4c7cae69188a56d1a230f68e0
Author: Kevin Buettner <kevinb@redhat.com>
Date:   Tue Sep 29 16:31:48 2015 -0700

    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<n>; call 1 structs-tc
    FAIL: gdb.base/structs.exp: p/c L<n>; call 2 structs-tc
    FAIL: gdb.base/structs.exp: p/c L<n>; call 3 structs-tc
    FAIL: gdb.base/structs.exp: p/c L<n>; call 4 structs-tc
    FAIL: gdb.base/structs.exp: p/c L<n>; call 5 structs-tc
    FAIL: gdb.base/structs.exp: p/c L<n>; call 6 structs-tc
    FAIL: gdb.base/structs.exp: p/c L<n>; call 7 structs-tc
    FAIL: gdb.base/structs.exp: p/c L<n>; call 8 structs-tc
    FAIL: gdb.base/structs.exp: p/c L<n>; call 9 structs-tc
    FAIL: gdb.base/structs.exp: p/c L<n>; call 10 structs-tc
    FAIL: gdb.base/structs.exp: p/c L<n>; call 11 structs-tc
    FAIL: gdb.base/structs.exp: p/c L<n>; call 12 structs-tc
    FAIL: gdb.base/structs.exp: p/c L<n>; call 13 structs-tc
    FAIL: gdb.base/structs.exp: p/c L<n>; call 14 structs-tc
    FAIL: gdb.base/structs.exp: p/c L<n>; call 15 structs-tc
    FAIL: gdb.base/structs.exp: p/c L<n>; call 16 structs-tc
    FAIL: gdb.base/structs.exp: p/c L<n>; call 17 structs-tc
    FAIL: gdb.base/structs.exp: p/c L<n>; call 1 structs-ts
    FAIL: gdb.base/structs.exp: p/c L<n>; call 2 structs-ts
    FAIL: gdb.base/structs.exp: p/c L<n>; call 3 structs-ts
    FAIL: gdb.base/structs.exp: p/c L<n>; call 4 structs-ts
    FAIL: gdb.base/structs.exp: p/c L<n>; call 5 structs-ts
    FAIL: gdb.base/structs.exp: p/c L<n>; call 1 structs-ti
    FAIL: gdb.base/structs.exp: p/c L<n>; call 2 structs-ti
    FAIL: gdb.base/structs.exp: p/c L<n>; call 3 structs-ti
    FAIL: gdb.base/structs.exp: p/c L<n>; call 1 structs-tl
    FAIL: gdb.base/structs.exp: p/c L<n>; call 2 structs-tl
    FAIL: gdb.base/structs.exp: p/c L<n>; call 3 structs-tl
    FAIL: gdb.base/structs.exp: p/c L<n>; call 1 structs-tll
    FAIL: gdb.base/structs.exp: p/c L<n>; call 2 structs-tll
    FAIL: gdb.base/structs.exp: p/c L<n>; call 1 structs-tf
    FAIL: gdb.base/structs.exp: p/c L<n>; call 2 structs-tf
    FAIL: gdb.base/structs.exp: p/c L<n>; call 3 structs-tf
    FAIL: gdb.base/structs.exp: p/c L<n>; call 1 structs-td
    FAIL: gdb.base/structs.exp: p/c L<n>; call 2 structs-td
    FAIL: gdb.base/structs.exp: p/c L<n>; call 1 structs-tld
    FAIL: gdb.base/structs.exp: p/c L<n>; call 2 structs-tld
    FAIL: gdb.base/structs.exp: p/c L<n>; call 2 structs-ts-tc
    FAIL: gdb.base/structs.exp: p/c L<n>; call 3 structs-ts-tc
    FAIL: gdb.base/structs.exp: p/c L<n>; call 4 structs-ts-tc
    FAIL: gdb.base/structs.exp: p/c L<n>; call 5 structs-ts-tc
    FAIL: gdb.base/structs.exp: p/c L<n>; call 6 structs-ts-tc
    FAIL: gdb.base/structs.exp: p/c L<n>; call 7 structs-ts-tc
    FAIL: gdb.base/structs.exp: p/c L<n>; call 8 structs-ts-tc
    FAIL: gdb.base/structs.exp: p/c L<n>; call 2 structs-ti-tc
    FAIL: gdb.base/structs.exp: p/c L<n>; call 3 structs-ti-tc
    FAIL: gdb.base/structs.exp: p/c L<n>; call 4 structs-ti-tc
    FAIL: gdb.base/structs.exp: p/c L<n>; call 5 structs-ti-tc
    FAIL: gdb.base/structs.exp: p/c L<n>; call 6 structs-ti-tc
    FAIL: gdb.base/structs.exp: p/c L<n>; call 2 structs-tl-tc
    FAIL: gdb.base/structs.exp: p/c L<n>; call 3 structs-tl-tc
    FAIL: gdb.base/structs.exp: p/c L<n>; call 4 structs-tl-tc
    FAIL: gdb.base/structs.exp: p/c L<n>; call 5 structs-tl-tc
    FAIL: gdb.base/structs.exp: p/c L<n>; call 6 structs-tl-tc
    FAIL: gdb.base/structs.exp: p/c L<n>; call 2 structs-tll-tc
    FAIL: gdb.base/structs.exp: p/c L<n>; call 2 structs-tf-tc
    FAIL: gdb.base/structs.exp: p/c L<n>; call 3 structs-tf-tc
    FAIL: gdb.base/structs.exp: p/c L<n>; call 4 structs-tf-tc
    FAIL: gdb.base/structs.exp: p/c L<n>; call 5 structs-tf-tc
    FAIL: gdb.base/structs.exp: p/c L<n>; call 6 structs-tf-tc
    FAIL: gdb.base/structs.exp: p/c L<n>; call 2 structs-td-tc
    FAIL: gdb.base/structs.exp: p/c L<n>; call 2 structs-tld-tc
    FAIL: gdb.base/structs.exp: p/c L<n>; call 2 structs-tc-ts
    FAIL: gdb.base/structs.exp: p/c L<n>; call 3 structs-tc-ts
    FAIL: gdb.base/structs.exp: p/c L<n>; call 4 structs-tc-ts
    FAIL: gdb.base/structs.exp: p/c L<n>; call 5 structs-tc-ts
    FAIL: gdb.base/structs.exp: p/c L<n>; call 6 structs-tc-ts
    FAIL: gdb.base/structs.exp: p/c L<n>; call 2 structs-tc-ti
    FAIL: gdb.base/structs.exp: p/c L<n>; call 3 structs-tc-ti
    FAIL: gdb.base/structs.exp: p/c L<n>; call 4 structs-tc-ti
    FAIL: gdb.base/structs.exp: p/c L<n>; call 2 structs-tc-tl
    FAIL: gdb.base/structs.exp: p/c L<n>; call 3 structs-tc-tl
    FAIL: gdb.base/structs.exp: p/c L<n>; call 4 structs-tc-tl
    FAIL: gdb.base/structs.exp: p/c L<n>; call 2 structs-tc-tll
    FAIL: gdb.base/structs.exp: p/c L<n>; call 2 structs-tc-tf
    FAIL: gdb.base/structs.exp: p/c L<n>; call 3 structs-tc-tf
    FAIL: gdb.base/structs.exp: p/c L<n>; call 4 structs-tc-tf
    FAIL: gdb.base/structs.exp: p/c L<n>; call 2 structs-tc-td
    FAIL: gdb.base/structs.exp: p/c L<n>; call 2 structs-tc-tld
    FAIL: gdb.base/structs.exp: p/c L<n>; call 2 structs-td-tf
    FAIL: gdb.base/structs.exp: p/c L<n>; 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:
---
 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  <kevinb@redhat.com>
+
+	* 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  <james.bowman@ftdichip.com>
 
 	* 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;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]