This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug gdb/18436] Can't print dynamically allocated global array


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

--- Comment #3 from stanton at haas dot berkeley.edu ---
Further follow-up: I tried MacPorts cgdb, - same result.

I then tried LLDB (the Xcode default debugger) on the same executable - it can
print the contents of vec just fine However, I donât want to use LLDB!


> On May 20, 2015, at 10:15 AM, Richard Stanton <stanton@haas.berkeley.edu> wrote:
> 
> 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
> 
> Test 2: Same debugger, but Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn): same result.
> 
> Test 3: I just installed home-brew gdb 7.9 and tried the same test with the Apple LLVM compiled code. Same result again.
> 
> 
> 
>> On May 20, 2015, at 9:34 AM, keiths at redhat dot com <sourceware-bugzilla@sourceware.org> wrote:
>> 
>> https://sourceware.org/bugzilla/show_bug.cgi?id=18436
>> 
>> Keith Seitz <keiths at redhat dot com> changed:
>> 
>>          What    |Removed                     |Added
>> ----------------------------------------------------------------------------
>>                CC|                            |keiths at redhat dot com
>> 
>> --- Comment #1 from Keith Seitz <keiths at redhat dot com> ---
>> I tried your supplied test case on both the 7.9 branch and HEAD, and I was
>> unable to reproduce it on Fedora 21, using the system compiler (4.9.2 20150212
>> (Red Hat 4.9.2-6)).
>> 
>> What is your environment? gdb/gcc -v (or "show version" in gdb).
>> What does "info var ^vec$" give?
>> 
>> For reference:
>> 
>> GNU gdb (GDB) 7.9
>> Copyright (C) 2015 Free Software Foundation, Inc.
>> [snip]
>> Type "apropos word" to search for commands related to "word"...
>> Reading symbols from /home/keiths/tmp/18436...done.
>> (gdb) start
>> Temporary breakpoint 1 at 0x4005d5: file /home/keiths/tmp/18436.c, line 10.
>> Starting program: /home/keiths/tmp/18436 
>> 
>> Temporary breakpoint 1, main (argc=1, argv=0x7fffffffdb18)
>>   at /home/keiths/tmp/18436.c:10
>> 10          vec = (double *) malloc((unsigned) 10*sizeof(double));
>> (gdb) n
>> 12          for (i=0; i<10; i++) {
>> (gdb) 
>> 13              vec[i] = i;
>> (gdb) 
>> 14              printf("Item %d = %15.6g\n", i, vec[i]);
>> (gdb) p vec[0]
>> $1 = 0
>> (gdb) info var ^vec$
>> All variables matching regular expression "^vec$":
>> 
>> File /home/keiths/tmp/18436.c:
>> double *vec;
>> (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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]