public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "stanton at haas dot berkeley.edu" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug gdb/18436] Can't print dynamically allocated global array
Date: Wed, 20 May 2015 18:13:00 -0000	[thread overview]
Message-ID: <bug-18436-4717-wTDHatVwV5@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-18436-4717@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=18436

--- Comment #7 from stanton at haas dot berkeley.edu ---
Thanks, Keith. I found a port of readelf, but it doesn’t like my executable:

Richards-Mac-Pro:C stanton$ greadelf -w main | grep producer
readelf: Error: Not an ELF file - it has the wrong magic bytes at the start

> On May 20, 2015, at 10:48 AM, keiths at redhat dot com <sourceware-bugzilla@sourceware.org> wrote:
> 
> https://sourceware.org/bugzilla/show_bug.cgi?id=18436
> 
> --- Comment #5 from Keith Seitz <keiths at redhat dot com> ---
> (In reply to stanton from comment #2)
>> Thanks for the response, Keith First, I’m running OS X 10.10.3.
>> 
>> Test 1: MacPorts versions of gdb and gcc
>> gdb version = GNU gdb (GDB) 7.7.1
>> gcc version = gcc version 4.9.2 (MacPorts gcc49 4.9.2_1) 
>> 
>> (gdb) print vec[0]
>> cannot subscript something of type `<data variable, no debug info>'
>> (gdb) info var ^vec$
>> All variables matching regular expression "^vec$":
>> 
>> Non-debugging symbols:
>> 0x0000000100001028  vec
>> 
> 
> Considering you have source files and can step through your program, this tells
> 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
>     <c>   DW_AT_producer    : (indirect string, offset: 0xb6): GNU C 4.9.2
> 20150212 (Red Hat 4.9.2-6) -mtune=generic -march=x86-64 -g  
>    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><d7>: Abbrev Number: 8 (DW_TAG_variable)
>    <d8>   DW_AT_name        : vec      
>    <dc>   DW_AT_decl_file   : 1        
>    <dd>   DW_AT_decl_line   : 4        
>    <de>   DW_AT_type        : <0xec>   
>    <e2>   DW_AT_external    : 1        
>    <e2>   DW_AT_location    : 9 byte block: 3 50 10 60 0 0 0 0 0      
> (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 
> 
> Temporary breakpoint 1, 0x00000000004005ca in main ()
> (gdb) ni 50
> Item 0 =               0
> 0x000000000040062b in main ()
> (gdb) p vec[0]
> cannot subscript something of type `<data variable, no debug info>'
> (gdb) p ((double*)vec)[0]
> $1 = 0
> (gdb)
> 
> -- 
> You are receiving this mail because:
> You reported the bug.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
>From gdb-prs-return-18104-listarch-gdb-prs=sources.redhat.com@sourceware.org Wed May 20 18:18:23 2015
Return-Path: <gdb-prs-return-18104-listarch-gdb-prs=sources.redhat.com@sourceware.org>
Delivered-To: listarch-gdb-prs@sources.redhat.com
Received: (qmail 63490 invoked by alias); 20 May 2015 18:18:22 -0000
Mailing-List: contact gdb-prs-help@sourceware.org; run by ezmlm
Precedence: bulk
List-Id: <gdb-prs.sourceware.org>
List-Subscribe: <mailto:gdb-prs-subscribe@sourceware.org>
List-Archive: <http://sourceware.org/ml/gdb-prs/>
List-Post: <mailto:gdb-prs@sourceware.org>
List-Help: <mailto:gdb-prs-help@sourceware.org>, <http://sourceware.org/lists.html#faqs>
Sender: gdb-prs-owner@sourceware.org
Delivered-To: mailing list gdb-prs@sourceware.org
Received: (qmail 63465 invoked by uid 55); 20 May 2015 18:18:22 -0000
From: "stanton at haas dot berkeley.edu" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug gdb/18436] Can't print dynamically allocated global array
Date: Wed, 20 May 2015 18:18: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: stanton at haas dot berkeley.edu
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: <bug-18436-4717-MHVjUmQIPe@http.sourceware.org/bugzilla/>
In-Reply-To: <bug-18436-4717@http.sourceware.org/bugzilla/>
References: <bug-18436-4717@http.sourceware.org/bugzilla/>
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/msg00298.txt.bz2
Content-length: 520

https://sourceware.org/bugzilla/show_bug.cgi?id=18436

--- Comment #8 from stanton at haas dot berkeley.edu ---
Unfortunately, the workaround below doesn’t work on my system:

(gdb) print vec[0]
cannot subscript something of type `<data variable, no debug info>'
(gdb) print ((double*)vec)[0]
Cannot access memory at address 0x200000

I just installed MacPorts gcc 5.1.0, and also hand-compiled gdb 7.9.1. It
didn’t help.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
>From gdb-prs-return-18105-listarch-gdb-prs=sources.redhat.com@sourceware.org Wed May 20 20:16:22 2015
Return-Path: <gdb-prs-return-18105-listarch-gdb-prs=sources.redhat.com@sourceware.org>
Delivered-To: listarch-gdb-prs@sources.redhat.com
Received: (qmail 4257 invoked by alias); 20 May 2015 20:16:21 -0000
Mailing-List: contact gdb-prs-help@sourceware.org; run by ezmlm
Precedence: bulk
List-Id: <gdb-prs.sourceware.org>
List-Subscribe: <mailto:gdb-prs-subscribe@sourceware.org>
List-Archive: <http://sourceware.org/ml/gdb-prs/>
List-Post: <mailto:gdb-prs@sourceware.org>
List-Help: <mailto:gdb-prs-help@sourceware.org>, <http://sourceware.org/lists.html#faqs>
Sender: gdb-prs-owner@sourceware.org
Delivered-To: mailing list gdb-prs@sourceware.org
Received: (qmail 4230 invoked by uid 55); 20 May 2015 20:16:20 -0000
From: "stanton at haas dot berkeley.edu" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug gdb/18436] Can't print dynamically allocated global array
Date: Wed, 20 May 2015 20:16: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: stanton at haas dot berkeley.edu
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: <bug-18436-4717-LZ1nTv7kpw@http.sourceware.org/bugzilla/>
In-Reply-To: <bug-18436-4717@http.sourceware.org/bugzilla/>
References: <bug-18436-4717@http.sourceware.org/bugzilla/>
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/msg00299.txt.bz2
Content-length: 952

https://sourceware.org/bugzilla/show_bug.cgi?id=18436

--- Comment #9 from stanton at haas dot berkeley.edu ---
I just noticed something odd. Using gcc 5.1 and gdb 7.7.1 (both MacPorts), I
can inspect v[0] fine if I compile like this:

gcc -g main.c -o main

It fails if I compile the same program (same gcc, some gdb) like this:

gcc -g -c -o main.o main.c
gcc -o main main.o 

Any idea why this should be different? 


> On May 20, 2015, at 11:17 AM, Richard Stanton <stanton@haas.berkeley.edu> wrote:
> 
> Unfortunately, the workaround below doesn’t work on my system:
> 
> (gdb) print vec[0]
> cannot subscript something of type `<data variable, no debug info>'
> (gdb) print ((double*)vec)[0]
> Cannot access memory at address 0x200000
> 
> I just installed MacPorts gcc 5.1.0, and also hand-compiled gdb 7.9.1. It didn’t help.
> 
>

-- 
You are receiving this mail because:
You are on the CC list for the bug.
>From gdb-prs-return-18106-listarch-gdb-prs=sources.redhat.com@sourceware.org Wed May 20 21:18:16 2015
Return-Path: <gdb-prs-return-18106-listarch-gdb-prs=sources.redhat.com@sourceware.org>
Delivered-To: listarch-gdb-prs@sources.redhat.com
Received: (qmail 123518 invoked by alias); 20 May 2015 21:18:16 -0000
Mailing-List: contact gdb-prs-help@sourceware.org; run by ezmlm
Precedence: bulk
List-Id: <gdb-prs.sourceware.org>
List-Subscribe: <mailto:gdb-prs-subscribe@sourceware.org>
List-Archive: <http://sourceware.org/ml/gdb-prs/>
List-Post: <mailto:gdb-prs@sourceware.org>
List-Help: <mailto:gdb-prs-help@sourceware.org>, <http://sourceware.org/lists.html#faqs>
Sender: gdb-prs-owner@sourceware.org
Delivered-To: mailing list gdb-prs@sourceware.org
Received: (qmail 123487 invoked by uid 48); 20 May 2015 21:18:16 -0000
From: "dje at google dot com" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug python/11324] python pretty-printers uglify backtraces
Date: Wed, 20 May 2015 21:18:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gdb
X-Bugzilla-Component: python
X-Bugzilla-Version: archer
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: dje at google dot com
X-Bugzilla-Status: RESOLVED
X-Bugzilla-Resolution: FIXED
X-Bugzilla-Priority: P2
X-Bugzilla-Assigned-To: unassigned at sourceware dot org
X-Bugzilla-Target-Milestone: 7.1
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_status cc resolution
Message-ID: <bug-11324-4717-hes9tZOPmn@http.sourceware.org/bugzilla/>
In-Reply-To: <bug-11324-4717@http.sourceware.org/bugzilla/>
References: <bug-11324-4717@http.sourceware.org/bugzilla/>
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/msg00300.txt.bz2
Content-length: 671

https://sourceware.org/bugzilla/show_bug.cgi?id\x11324

dje at google dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |dje at google dot com
         Resolution|---                         |FIXED

--- Comment #2 from dje at google dot com ---
IIUC the intended solution is now implemented: gdbpy_gdb_memory_error and
print_stack_unless_memory_error.

Please reopen and clarify if not.

--
You are receiving this mail because:
You are on the CC list for the bug.


  parent reply	other threads:[~2015-05-20 18:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-20  4:54 [Bug gdb/18436] New: " stanton at haas dot berkeley.edu
2015-05-20 16:34 ` [Bug gdb/18436] " keiths at redhat dot com
2015-05-20 17:15 ` stanton at haas dot berkeley.edu
2015-05-20 17:48 ` keiths at redhat dot com
2015-05-20 18:13 ` stanton at haas dot berkeley.edu [this message]
2015-05-21 17:26 ` stanton at haas dot berkeley.edu
2023-08-03 15:53 ` tromey at sourceware dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-18436-4717-wTDHatVwV5@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).