From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 93229 invoked by alias); 20 May 2015 17:48:25 -0000 Mailing-List: contact gdb-prs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-prs-owner@sourceware.org Received: (qmail 93152 invoked by uid 48); 20 May 2015 17:48:24 -0000 From: "keiths at redhat dot com" To: gdb-prs@sourceware.org Subject: [Bug gdb/18436] Can't print dynamically allocated global array Date: Wed, 20 May 2015 17:48:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: gdb X-Bugzilla-Version: 7.9 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: keiths at redhat dot com X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-q2/txt/msg00295.txt.bz2 https://sourceware.org/bugzilla/show_bug.cgi?id=3D18436 --- Comment #5 from Keith Seitz --- (In reply to stanton from comment #2) > Thanks for the response, Keith First, I=E2=80=99m running OS X 10.10.3. >=20 > Test 1: MacPorts versions of gdb and gcc > gdb version =3D GNU gdb (GDB) 7.7.1 > gcc version =3D gcc version 4.9.2 (MacPorts gcc49 4.9.2_1)=20 >=20 > (gdb) print vec[0] > cannot subscript something of type `' > (gdb) info var ^vec$ > All variables matching regular expression "^vec$": >=20 > Non-debugging symbols: > 0x0000000100001028 vec >=20 Considering you have source files and can step through your program, this t= ells me that there is a debug info problem concerning the global variable vec or there is some obscure bug in gdb preventing this from working. I have some vague recollection of custom Apple DWARF extensions making their way into GCC for MacOS, but not GDB. That might explain why LLDB can successfully inspect the variable. Does "readelf -w" (does that exist on Mac?) show any output DIEs? For example, for the test case associated with this bug, $ readelf -w main | grep producer DW_AT_producer : (indirect string, offset: 0xb6): GNU C 4.9.2 20150212 (Red Hat 4.9.2-6) -mtune=3Dgeneric -march=3Dx86-64 -g=20=20 DW_AT_producer DW_FORM_strp Other than the fact that we have debug DIEs, we can also see the "-g" was passed to GCC to output debug info. Also, what is the debug info for "vec" (if any)? In my build of the test, I have: <1>: Abbrev Number: 8 (DW_TAG_variable) DW_AT_name : vec=20=20=20=20=20=20 DW_AT_decl_file : 1=20=20=20=20=20=20=20=20
DW_AT_decl_line : 4=20=20=20=20=20=20=20=20 DW_AT_type : <0xec>=20=20=20 DW_AT_external : 1=20=20=20=20=20=20=20=20 DW_AT_location : 9 byte block: 3 50 10 60 0 0 0 0 0=20=20=20= =20=20=20 (DW_OP_addr: 601050) A (not satisfactory IMO) workaround is to tell gdb what "vec" is: (gdb) file ~/tmp/18436.nodebug (gdb) start Temporary breakpoint 1 at 0x4005ca Starting program: /home/keiths/tmp/18436.nodebug=20 Temporary breakpoint 1, 0x00000000004005ca in main () (gdb) ni 50 Item 0 =3D 0 0x000000000040062b in main () (gdb) p vec[0] cannot subscript something of type `' (gdb) p ((double*)vec)[0] $1 =3D 0 (gdb) --=20 You are receiving this mail because: You are on the CC list for the bug. >>From gdb-prs-return-18102-listarch-gdb-prs=sources.redhat.com@sourceware.org Wed May 20 17:49:36 2015 Return-Path: Delivered-To: listarch-gdb-prs@sources.redhat.com Received: (qmail 94441 invoked by alias); 20 May 2015 17:49:36 -0000 Mailing-List: contact gdb-prs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-prs-owner@sourceware.org Delivered-To: mailing list gdb-prs@sourceware.org Received: (qmail 94410 invoked by uid 48); 20 May 2015 17:49:35 -0000 From: "keiths at redhat dot com" To: gdb-prs@sourceware.org Subject: [Bug gdb/18436] Can't print dynamically allocated global array Date: Wed, 20 May 2015 17:49:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: gdb X-Bugzilla-Version: 7.9 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: keiths at redhat dot com X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-q2/txt/msg00296.txt.bz2 Content-length: 910 https://sourceware.org/bugzilla/show_bug.cgi?id=18436 --- Comment #6 from Keith Seitz --- (In reply to stanton from comment #4) > It also works if I use the MacPorts port gdb-apple, which announces itself as > > GNU gdb 6.3.50.20050815-cvs (Wed Nov 26 07:47:26 UTC 2014) > Copyright 2004 Free Software Foundation, Inc. > GDB is free software, covered by the GNU General Public License, and you are > welcome to change it and/or distribute copies of it under certain conditions. > Type "show copying" to see the conditions. > There is absolutely no warranty for GDB. Type "show warranty" for details. > This GDB was configured as "--host=i686-apple-darwin14.0.0 --target=". This would seem to support my suspicion that there are DWARF extensions that were never submitted and/or approved for FSF GDB. -- You are receiving this mail because: You are on the CC list for the bug.