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/11744] New: Fails to display contents of array dynamically allocated on stack


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.


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