From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12780 invoked by alias); 10 Jan 2004 18:00:37 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 12773 invoked from network); 10 Jan 2004 18:00:36 -0000 Received: from unknown (HELO walton.kettenis.dyndns.org) (213.93.115.144) by sources.redhat.com with SMTP; 10 Jan 2004 18:00:36 -0000 Received: from elgar.kettenis.dyndns.org (elgar.kettenis.dyndns.org [192.168.0.2]) by walton.kettenis.dyndns.org (8.12.6p3/8.12.6) with ESMTP id i0AI0Zjv004655 for ; Sat, 10 Jan 2004 19:00:35 +0100 (CET) (envelope-from kettenis@elgar.kettenis.dyndns.org) Received: from elgar.kettenis.dyndns.org (localhost [127.0.0.1]) by elgar.kettenis.dyndns.org (8.12.6p3/8.12.6) with ESMTP id i0AI0ZLA026626 for ; Sat, 10 Jan 2004 19:00:35 +0100 (CET) (envelope-from kettenis@elgar.kettenis.dyndns.org) Received: (from kettenis@localhost) by elgar.kettenis.dyndns.org (8.12.6p3/8.12.6/Submit) id i0AI0Zm6026623; Sat, 10 Jan 2004 19:00:35 +0100 (CET) Date: Sat, 10 Jan 2004 18:00:00 -0000 Message-Id: <200401101800.i0AI0Zm6026623@elgar.kettenis.dyndns.org> From: Mark Kettenis To: gdb-patches@sources.redhat.com Subject: [PATCH] Classify non-POD struct types more or less correctly on AMD64 X-SW-Source: 2004-01/txt/msg00265.txt.bz2 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 * 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;