This is the mail archive of the gdb-patches@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]

[commit, spu] Fix TYPE_CALLING_CONVENTION crashes


Hello,

a while ago, Joel notices a bug in handling TYPE_CALLING_CONVENTION that
caused crashes on PowerPC.  I'm now running into the same bug on SPU.

The patch below fixes this in the same way as this patch for PowerPC:
http://sourceware.org/ml/gdb-patches/2011-10/msg00699.html

Tested on spu-elf, committed to mainline.

Bye,
Ulrich


ChangeLog:

	* spu-tdep.c (spu_return_value): Fix handling of
	TYPE_CALLING_CONVENTION annotation.


Index: gdb/spu-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/spu-tdep.c,v
retrieving revision 1.75
diff -u -p -r1.75 spu-tdep.c
--- gdb/spu-tdep.c	26 Oct 2011 17:26:29 -0000	1.75
+++ gdb/spu-tdep.c	16 Nov 2011 18:25:28 -0000
@@ -1458,11 +1458,19 @@ spu_return_value (struct gdbarch *gdbarc
   enum return_value_convention rvc;
   int opencl_vector = 0;
 
-  if (func_type
-      && TYPE_CALLING_CONVENTION (func_type) == DW_CC_GDB_IBM_OpenCL
-      && TYPE_CODE (type) == TYPE_CODE_ARRAY
-      && TYPE_VECTOR (type))
-    opencl_vector = 1;
+  if (func_type)
+    {
+      func_type = check_typedef (func_type);
+
+      if (TYPE_CODE (func_type) == TYPE_CODE_PTR)
+	func_type = check_typedef (TYPE_TARGET_TYPE (func_type));
+
+      if (TYPE_CODE (func_type) == TYPE_CODE_FUNC
+	  && TYPE_CALLING_CONVENTION (func_type) == DW_CC_GDB_IBM_OpenCL
+	  && TYPE_CODE (type) == TYPE_CODE_ARRAY
+	  && TYPE_VECTOR (type))
+	opencl_vector = 1;
+    }
 
   if (TYPE_LENGTH (type) <= (SPU_ARGN_REGNUM - SPU_ARG1_REGNUM + 1) * 16)
     rvc = RETURN_VALUE_REGISTER_CONVENTION;

-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


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