public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/11744] New: Fails to display contents of array dynamically allocated on stack
@ 2010-06-23 15:08 jamesb at broadcom dot com
  2010-06-29 15:11 ` [Bug gdb/11744] " jan dot kratochvil at redhat dot com
  0 siblings, 1 reply; 4+ messages in thread
From: jamesb at broadcom dot com @ 2010-06-23 15:08 UTC (permalink / raw)
  To: gdb-prs

Using GDB 7.1 + the latest gcc I could find here (4.5.0):

Build -O0 -g3:
int main(void)
{
        typedef struct tag_FooStruct
        {
            int a;
            int b;
        } FooStruct;
        FooStruct fooStruct[1] = {{.a = 4, .b = 4}};
        char byteArray1[fooStruct[0].a * fooStruct[0].b];
        char byteArray2[16];
        byteArray1[0] = 0;
        byteArray2[0] = 0;
}

Set a breakpoint at byteArray1[0]

Using Eclipse DSF I see:
...
492,695 20-var-create --thread 1 --frame 0 - * byteArray1
492,695 21-var-create --thread 1 --frame 0 - * byteArray2
492,699 20^done,name="var2",numchild="0",value="[0]",type="char
[0]",thread-id="1",has_more="0"
492,699 21^done,name="var3",numchild="16",value="[16]",type="char
[16]",thread-id="1",has_more="0"
...

byteArray1 has incorrect [0] length which means it's contents aren't correctly
displayed.

Using the CLI:
ptype byteArray2
type = char [16]
ptype byteArray1
type = char [0]
print byteArray1@16
$1 = 0x7fbfffeed0
print byteArray2@16
$2 = {"@L\221>7\000\000\000C\003@\000\000\000\000", 
  "\004\000\000\000\004\000\000\000\341\004@\000\000\000\000", 
...

-- 
           Summary: Fails to display contents of array dynamically allocated
                    on stack
           Product: gdb
           Version: 7.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: gdb
        AssignedTo: unassigned at sourceware dot org
        ReportedBy: jamesb at broadcom dot com
                CC: gdb-prs at sourceware dot org


http://sourceware.org/bugzilla/show_bug.cgi?id=11744

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 4+ messages in thread
[parent not found: <bug-11744-4717@http.sourceware.org/bugzilla/>]

end of thread, other threads:[~2022-11-07 21:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-23 15:08 [Bug gdb/11744] New: Fails to display contents of array dynamically allocated on stack jamesb at broadcom dot com
2010-06-29 15:11 ` [Bug gdb/11744] " jan dot kratochvil at redhat dot com
     [not found] <bug-11744-4717@http.sourceware.org/bugzilla/>
2022-10-21 17:04 ` tromey at sourceware dot org
2022-11-07 21:02 ` tromey at sourceware dot org

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).