Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] Classify non-POD struct types more or less correctly on AMD64
@ 2004-01-10 18:00 Mark Kettenis
  2004-01-10 18:36 ` Daniel Jacobowitz
  0 siblings, 1 reply; 14+ messages in thread
From: Mark Kettenis @ 2004-01-10 18:00 UTC (permalink / raw)
  To: gdb-patches

This (together with the previous patch) fixes the problems I saw with
gdb.cp/bs15503.exp.  The check for non-POD-ness isn't complete though.
I hope to revisit that later, after someone tells me how to properly
determine non-POD-ness.

Mark

P.S. The amd64_non_pod_p function should probably be moved to the
     generic cod, but we can do that later.


Index: ChangeLog
from  Mark Kettenis  <kettenis@gnu.org>
 
	* x86-64-tdep.c (amd64_non_pod_p): New function.
	(amd64_classify_aggregate): Return class memory for non-POD
	C++ structure types.

Index: x86-64-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/x86-64-tdep.c,v
retrieving revision 1.110
diff -u -p -r1.110 x86-64-tdep.c
--- x86-64-tdep.c 10 Jan 2004 17:48:15 -0000 1.110
+++ x86-64-tdep.c 10 Jan 2004 17:51:19 -0000
@@ -270,6 +270,19 @@ amd64_merge_classes (enum amd64_reg_clas
 
 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 *t
   /* 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;


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2004-03-10  4:21 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-10 18:00 [PATCH] Classify non-POD struct types more or less correctly on AMD64 Mark Kettenis
2004-01-10 18:36 ` Daniel Jacobowitz
2004-01-10 18:59   ` Mark Kettenis
2004-01-11  4:10     ` Daniel Jacobowitz
2004-01-11 12:38       ` Mark Kettenis
2004-01-11 13:29         ` Jan Hubicka
2004-01-12  5:37           ` Mark Mitchell
2004-01-11 15:05         ` Gabriel Dos Reis
2004-03-19  0:09         ` Daniel Jacobowitz
2004-03-09 15:39           ` Daniel Jacobowitz
2004-03-19  0:09           ` Mark Mitchell
2004-03-10  3:38             ` Mark Mitchell
2004-03-10  4:21             ` Daniel Jacobowitz
2004-03-19  0:09               ` Daniel Jacobowitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox