From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22931 invoked by alias); 5 Jul 2013 18:41:12 -0000 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 Received: (qmail 22880 invoked by uid 89); 5 Jul 2013 18:41:06 -0000 X-Spam-SWARE-Status: No, score=-0.2 required=5.0 tests=AWL,BAYES_50,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_HOSTKARMA_YE,SPF_PASS autolearn=ham version=3.3.1 Received: from bay0-omc1-s26.bay0.hotmail.com (HELO bay0-omc1-s26.bay0.hotmail.com) (65.54.190.37) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Fri, 05 Jul 2013 18:41:03 +0000 Received: from BAY171-W122 ([65.54.190.61]) by bay0-omc1-s26.bay0.hotmail.com with Microsoft SMTPSVC(6.0.3790.4675); Fri, 5 Jul 2013 11:41:02 -0700 X-TMN: [5inf4KWulranzzXfiL2CUAJVDTvH40mq] Message-ID: From: Rouslan Korneychuk To: "gdb@sourceware.org" Subject: DW_AT_count is the same as DW_AT_upper_bound? Date: Fri, 05 Jul 2013 18:41:00 -0000 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-SW-Source: 2013-07/txt/msg00028.txt.bz2 I'm working on a program which produces DWARF 4 debug information and uses GDB's JIT interface. I have an array with a dynamic size with the following description (taken from objdump): ... =A0<2><4e>: Abbrev Number: 7 (DW_TAG_variable) =A0=A0=A0 <4f>=A0=A0 DW_AT_type=A0=A0=A0=A0=A0=A0=A0 : <0x1d>=A0=A0=20 =A0=A0=A0 <50>=A0=A0 DW_AT_name=A0=A0=A0=A0=A0=A0=A0 : (indirect string, of= fset: 0x2c): stack_len=A0=A0=20 =A0=A0=A0 <54>=A0=A0 DW_AT_location=A0=A0=A0 : 0x0=A0=A0=A0 (location list) =A0<2><58>: Abbrev Number: 8 (DW_TAG_array_type) =A0=A0=A0 <59>=A0=A0 DW_AT_type=A0=A0=A0=A0=A0=A0=A0 : <0x29>=A0=A0=20 =A0<3><5a>: Abbrev Number: 9 (DW_TAG_subrange_type) =A0=A0=A0 <5b>=A0=A0 DW_AT_type=A0=A0=A0=A0=A0=A0=A0 : <0x1d>=A0=A0=20 =A0=A0=A0 <5c>=A0=A0 DW_AT_lower_bound : 0=A0=A0=20 =A0=A0=A0 <5d>=A0=A0 DW_AT_count=A0=A0=A0=A0=A0=A0 : <0x4e>=A0=A0=20 =A0<3><5e>: Abbrev Number: 0 =A0<2><5f>: Abbrev Number: 10 (DW_TAG_variable) =A0=A0=A0 <60>=A0=A0 DW_AT_type=A0=A0=A0=A0=A0=A0=A0 : <0x58>=A0=A0=20 =A0=A0=A0 <61>=A0=A0 DW_AT_name=A0=A0=A0=A0=A0=A0=A0 : (indirect string, of= fset: 0x36): stack=A0=A0=20 =A0=A0=A0 <65>=A0=A0 DW_AT_location=A0=A0=A0 : 2 byte block: 91 18=A0=A0=A0= =A0 (DW_OP_fbreg: 24) =A0=A0=A0 <68>=A0=A0 DW_AT_start_scope : 152=A0=A0=20 ... The array "stack" uses DW_AT_count which is a reference to the variable "stack_len". I expected the length of the array to be equal to the value of "stack_len", but when I use GDB to display these two variables (using the command "display"), "stack" is always shown with 1 more element than I expected. e.g.: ... 0x00007ffff7ff31f6 in $module$ (f=3D0x87f0a0 , =A0=A0=A0 throwflag=3D-240094128) 3: stack =3D {0xc33aa0, 0xc33aa0} 2: stack_len =3D 1 1: x/i $pc =3D> 0x7ffff7ff31f6 <$module$+422>:=A0=A0=A0 mov=A0=A0=A0 %rax,0x48(%rsp) (gdb)=A0 nexti 0x00007ffff7ff31fb in $module$ (f=3D0x87f0a0 , =A0=A0=A0 throwflag=3D-240094128) 3: stack =3D {0xc33aa0, 0xc33aa0, 0x7fffffffce00} 2: stack_len =3D 2 1: x/i $pc =3D> 0x7ffff7ff31fb <$module$+427>:=A0=A0=A0 movabs $0x1,%rsi (gdb) I'm using DW_AT_count instead of DW_AT_upper_bound so that "stack" can be empty (have 0 elements), but these two attributes appear to be treated the same. Is this a bug or am I misunderstanding something? I'm using GDB version 7.5.1.=20=09=09=20=09=20=20=20=09=09=20=20 >From gdb-return-42329-listarch-gdb=sources.redhat.com@sourceware.org Fri Jul 05 18:42:57 2013 Return-Path: Delivered-To: listarch-gdb@sources.redhat.com Received: (qmail 25009 invoked by alias); 5 Jul 2013 18:42:57 -0000 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 Delivered-To: mailing list gdb@sourceware.org Received: (qmail 24984 invoked by uid 89); 5 Jul 2013 18:42:54 -0000 X-Spam-SWARE-Status: No, score=-6.4 required=5.0 tests=AWL,BAYES_00,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.1 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Fri, 05 Jul 2013 18:42:45 +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 r65Igg3P022095 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 5 Jul 2013 14:42:42 -0400 Received: from host2.jankratochvil.net (ovpn-116-27.ams2.redhat.com [10.36.116.27]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r65Igd9b022696 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Fri, 5 Jul 2013 14:42:41 -0400 Date: Fri, 05 Jul 2013 18:42:00 -0000 From: Jan Kratochvil To: vijay nag Cc: gdb@sourceware.org Subject: Re: Fwd: vdso Message-ID: <20130705184238.GA661@host2.jankratochvil.net> References: <20130703084207.GA598@host2.jankratochvil.net> <20130703090259.GA1854@host2.jankratochvil.net> <20130703144857.GA27367@host2.jankratochvil.net> <20130704061052.GA19661@host2.jankratochvil.net> 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 X-SW-Source: 2013-07/txt/msg00029.txt.bz2 Content-length: 472 On Fri, 05 Jul 2013 08:12:29 +0200, vijay nag wrote: > The function linux_proc_xfer_partial() is returning result zero when > trying to pread64 /proc//mem and errno is set to -EIO. And what is 'offset' (and 'len') that time and what is in /proc/PID/maps that time? Isn't there also some incorrect signed extension of 32-bit address to 64-bit address, for example? > Does that mean kernel doesn't support pread64 on /proc/xxx/mem files ? I do not think so. Jan