From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32679 invoked by alias); 11 Feb 2013 17:02:40 -0000 Received: (qmail 32660 invoked by uid 22791); 11 Feb 2013 17:02:39 -0000 X-SWARE-Spam-Status: No, hits=-6.2 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_SPAMHAUS_DROP,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,RP_MATCHES_RCVD,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 11 Feb 2013 17:02:29 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r1BH2Rgs003523 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 11 Feb 2013 12:02:27 -0500 Received: from host2.jankratochvil.net (ovpn-116-18.ams2.redhat.com [10.36.116.18]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r1BH2MeQ028795 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Mon, 11 Feb 2013 12:02:24 -0500 Date: Mon, 11 Feb 2013 17:02:00 -0000 From: Jan Kratochvil To: Michael Haupt Cc: "gdb@sourceware.org" Subject: Re: debugging custom array types Message-ID: <20130211170221.GA16645@host2.jankratochvil.net> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2013-02/txt/msg00023.txt.bz2 On Mon, 11 Feb 2013 17:51:36 +0100, Michael Haupt wrote: > The internal layout of an array instance is as follows: > +0 hub reference (reference to meta-information, e.g., class, vtable, ...) > +8 length > +12 beginning of array contents (offset depends on type, 12 is for char, for instance) THis means the type length is stored in inferior memory. I call it 'dynamic type', FSF GDB does not support it, it is supported in archer-jankratochvil-vla from http://sourceware.org/gdb/wiki/ArcherBranchManagement or in any Fedora GDB. But FSF GDB generally displays such arrays as pointers instead: 34 foo (int size) { 36 char temp1[size]; FSF GDB: (gdb) p temp1 $1 = 0x7fffffffd9e0 "XXX" (gdb) ptype temp1 type = char [] archer-jankratochvil-vla: (gdb) p temp1 $1 = "XXX" (gdb) ptype temp1 type = char [26] > The DWARF I'm generating right now looks as pasted at the end of this message. Could you display it with GNU binutils "readelf -wi"? There aren't the DWARF expressions decoded so it is not easy to read what you have there. BTW such dynamic types are in the archer-jankratochvil-vla branch above, for a simple one see gdb.base/vla.exp. <1><12c>: Abbrev Number: 11 (DW_TAG_array_type) <12d> DW_AT_type : <0x49> <2><135>: Abbrev Number: 12 (DW_TAG_subrange_type) <136> DW_AT_type : <0x34> <13a> DW_AT_upper_bound : 3 byte block: 91 48 6 (DW_OP_fbreg: -56; DW_OP_deref) <2><13e>: Abbrev Number: 0 Regards, Jan