From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25044 invoked by alias); 13 Feb 2013 10:50:50 -0000 Received: (qmail 25036 invoked by uid 22791); 13 Feb 2013 10:50:49 -0000 X-SWARE-Spam-Status: No, hits=-1.4 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RCVD_IN_HOSTKARMA_NO,RP_MATCHES_RCVD,UNPARSEABLE_RELAY X-Spam-Check-By: sourceware.org Received: from aserp1040.oracle.com (HELO aserp1040.oracle.com) (141.146.126.69) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 13 Feb 2013 10:50:18 +0000 Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238]) by aserp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id r1DAoHnu016023 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 13 Feb 2013 10:50:17 GMT Received: from acsmt358.oracle.com (acsmt358.oracle.com [141.146.40.158]) by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r1DAoGB7022240 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 13 Feb 2013 10:50:17 GMT Received: from abhmt102.oracle.com (abhmt102.oracle.com [141.146.116.54]) by acsmt358.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id r1DAoGcG006523 for ; Wed, 13 Feb 2013 04:50:16 -0600 Received: from dhcp-potsdam-10-165-122-246.de.oracle.com (/10.165.122.246) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 13 Feb 2013 02:50:16 -0800 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 6.2 \(1499\)) Subject: Re: debugging custom array types From: Michael Haupt In-Reply-To: <20130211170221.GA16645@host2.jankratochvil.net> Date: Wed, 13 Feb 2013 10:50:00 -0000 Content-Transfer-Encoding: quoted-printable Message-Id: References: <20130211170221.GA16645@host2.jankratochvil.net> To: "gdb@sourceware.org" 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/msg00042.txt.bz2 Jan, thanks a lot, this is most enlightening ... Am 11.02.2013 um 18:02 schrieb Jan Kratochvil : > 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 cha= r, for instance) >=20 > THis means the type length is stored in inferior memory. I call it 'dyna= mic > 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. Is there documentation somewhere that explicates which pieces of DWARF gdb = supports out of the box? I'm not opposed to patching it but would like to k= now better what to (not) expect. >> The DWARF I'm generating right now looks as pasted at the end of this me= ssage. >=20 > Could you display it with GNU binutils "readelf -wi"? There aren't the D= WARF > expressions decoded so it is not easy to read what you have there. Sure; sorry about having missed that. It's pasted below. Interestingly the = byte_size DWARF expressions are not interpreted. The one in char_array looks as follows: DW_OP_push_object_address DW_OP_plus_uconst: 8 DW_OP_deref_size: 4 DW_OP_const1u: 2 DW_OP_mul DW_OP_plus_uconst: 12 The one in the array type, as follows: DW_OP_push_object_address DW_OP_plus_uconst: 8 DW_OP_deref_size: 4 DW_OP_const1u: 2 DW_OP_mul Best, Michael <1><5320>: Abbrev Number: 16 (DW_TAG_structure_type) <5321> DW_AT_name : (indirect string, offset: 0x177): char_arr= ay=20=20=20 <5325> DW_AT_byte_size : 10 byte block: 97 23 8 94 4 8 2 1e 23 c=20= =20=20=20=20=20=20=20 <5330> DW_AT_sibling : <0x5359>=20=20=20=20=20=20=20 <2><5334>: Abbrev Number: 10 (DW_TAG_member) <5335> DW_AT_name : (indirect string, offset: 0xdc): __hub_ref= erence__=20=20=20=20=20 <5339> DW_AT_type : <0x5c6f>=20=20=20=20=20=20=20 <533d> DW_AT_data_member_location: 2 byte block: 23 0 (DW_OP_plus= _uconst: 0) <2><5340>: Abbrev Number: 10 (DW_TAG_member) <5341> DW_AT_name : (indirect string, offset: 0x185): __length= __=20=20=20 <5345> DW_AT_type : <0x2d>=20 <5349> DW_AT_data_member_location: 2 byte block: 23 8 (DW_OP_plus= _uconst: 8) <2><534c>: Abbrev Number: 10 (DW_TAG_member) <534d> DW_AT_name : (indirect string, offset: 0x195): __array_= _=20=20=20=20 <5351> DW_AT_type : <0x5a6c>=20=20=20=20=20=20=20 <5355> DW_AT_data_member_location: 2 byte block: 23 c (DW_OP_plus= _uconst: 12) ... <1><5a6c>: Abbrev Number: 11 (DW_TAG_array_type) <5a6d> DW_AT_type : <0x4f11>=20=20=20=20=20=20=20 <5a71> DW_AT_byte_size : 8 byte block: 97 23 8 94 4 8 2 1e=20=20=20= =20=20=20 <5a7a> DW_AT_data_location: 3 byte block: 97 23 c (DW_OP_push= _object_address; DW_OP_plus_uconst: 12) <5a7e> DW_AT_sibling : <0x5a91>=20=20=20=20=20=20=20 <2><5a82>: Abbrev Number: 14 (DW_TAG_subrange_type) <5a83> DW_AT_type : <0x2d>=20 <5a87> DW_AT_upper_bound : 8 byte block: 97 23 8 94 4 8 1 1c (DW= _OP_push_object_address; DW_OP_plus_uconst: 8; DW_OP_deref_size: 4; DW_OP_c= onst1u: 1; DW_OP_minus) --=20 Dr. Michael Haupt Principal Member of Technical Staff Phone: +49 331 200 7277, Fax: +49 331 200 7561 Oracle Labs Oracle Deutschland B.V. & Co. KG, Schiffbauergasse 14, 14467 Potsdam, Germa= ny