From owner-freebsd-hackers@FreeBSD.ORG Sun Jun 6 07:18:11 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0FA9A106567A for ; Sun, 6 Jun 2010 07:18:11 +0000 (UTC) (envelope-from artemb@gmail.com) Received: from mail-pw0-f54.google.com (mail-pw0-f54.google.com [209.85.160.54]) by mx1.freebsd.org (Postfix) with ESMTP id D60478FC0A for ; Sun, 6 Jun 2010 07:18:10 +0000 (UTC) Received: by pwj1 with SMTP id 1so1419294pwj.13 for ; Sun, 06 Jun 2010 00:18:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=SRcqNAltN731eckdAwCuvi6qpz0tXKbxuW8zMc7WS+8=; b=WBO2bWI6EI/RwHViCe9+r+Zjc48LBvTkFkrxStJfhp5BlxLcPZ/ys7SdTo/05W7yb2 zaAjBs6tMw81iFmw//hJAJH7ufwpwwHhCdqIcnIp8JJn2Z0iyy46GO0yeL4M6EUQEIXj X+7rTPBPiMzNvDE/kQ0HSKQi++vme/4jZrwAs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=uJrVqGyKAf7k5NXOXHnuhao+7hYpWgzm6IQphOAJOkWE6qzLfCQ62Kjwvh+cUUBdKq sT5W7TakJZCQzrZ/97VEz8Y4tALvK4XfWyS5UHqVvIVppzPoey2ZnNbk2kMAEHt2zji7 jmIqDryAbfrG9qa/B9wM41tWTkGCB1ZhBaQhQ= MIME-Version: 1.0 Received: by 10.141.214.40 with SMTP id r40mr10633721rvq.11.1275808690005; Sun, 06 Jun 2010 00:18:10 -0700 (PDT) Sender: artemb@gmail.com Received: by 10.141.40.4 with HTTP; Sun, 6 Jun 2010 00:18:09 -0700 (PDT) In-Reply-To: References: Date: Sun, 6 Jun 2010 00:18:09 -0700 X-Google-Sender-Auth: gNo7E6eGF8Wj95SoMKtD2nTecTU Message-ID: From: Artem Belevich To: Shrikanth Kamath Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: freebsd-hackers@freebsd.org Subject: Re: ctfconvert : failed to resolve types X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Jun 2010 07:18:11 -0000 Interesting. Looking at dwarf parsing sources in DTrace, and there are comments that suggest that ctfconvert should've been able to deal with zero-sized arrays. Look at die_sou_resolve() in cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c One observation, if you add a real member to the union that otherwise contains only zero-sized arrays, then ctfconvert is happy. This suggests that it can deal with zero-sized arrays as such, but got surprised that we've managed to define zero-sized data type that is not an array. It sounds like a corner case to me. After all, who could have thought that someone may need zero-sized struct or union one day? One possible way to deal with that would be to move zero-sized arrays out of the union. ctfconvert is happy and the size of your data structure should not change -- you still should be able to use zero-sized array members to append real data, only now they are members of the structure itself, not of the member union. This seems to work: struct abc { int length; int bit; char key[0]; char *key_ptr[0]; }; --Artem On Sat, Jun 5, 2010 at 10:23 PM, Shrikanth Kamath w= rote: > I have a small snippet trying to study ctfconvert... > > struct abc { > =A0 =A0int length; > =A0 =A0int bit; > =A0 =A0union { > =A0 =A0 =A0 =A0char key[0]; > =A0 =A0 =A0 =A0char *key_ptr[0]; > =A0 =A0} keys; > }; > > int main() > { > =A0 =A0int a =3D1; > =A0 =A0struct abc member =3D { 16, 5 }; > =A0 =A0printf("Sizeof abc structure [%d] \n", sizeof(struct abc)); > } > > % gcc -g ctfconvert_prob.c > % ctfconvert a.out > > I get the following error on running "ctfconvert"... > ctfconvert_prob.c: failed to resolve the following types: > struct 362 <16a>: failed to size member "keys" of type __anon__ (297 <129= >) > ERROR: ctfconvert_prob.c: failed to resolve types > > How can ctfconvert be equipped to resolve this data type? > > -- > Shrikanth R K > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org= " >