https://llvm.org/bugs/show_bug.cgi?id=30553
Bug ID: 30553 Summary: Debug info generated for arrays is not what GDB expects (not as good as GCC's) Product: new-bugs Version: trunk Hardware: PC OS: Linux Status: NEW Severity: normal Priority: P Component: new bugs Assignee: unassignedb...@nondot.org Reporter: cmt...@google.com CC: llvm-bugs@lists.llvm.org Classification: Unclassified There is a very annoying difference in the way GCC & LLVM generate debug information for arrays. The symptom is that when GDB is asked to print an array-type variable that was compiled with GCC, it shows the array and it's contents, while when asked to print the same variable for the same program, compiled by LLVM, all you get is a pointer: GCC version: (gdb) print vla $1 = {5, 7, 9} (gdb) print vlaref $2 = (int (&)[3]) @0x7fffffffdc30: {5, 7, 9} (gdb) print vlaref2 $3 = (const vlareftypedef) @0x7fffffffdc30: {5, 7, 9} LLVM version: (gdb) print vla $1 = 0x7fffffffdc20 (gdb) print vlaref $2 = (int (&)[]) @0x7fffffffdc20: 0x7fffffffdc20 (gdb) print vlaref2 $3 = (vlareftypedef) @0x7fffffffdc20: 0x7fffffffdc20 LLVM can't even tell gdb the length of the array, much less its contents! In discussing this with Eric Christopher, he said: A simple testcase is: int foo(int a) { int vla[a]; int sum = 0; for (int i = 0; i < a; ++i) vla[i] = i; for (int j = 0; j < a; ++j) sum += vla[j]; return sum; } int main (void) { return foo(4); } What's happening is that we're not adding a DW_AT_upper_bound of type DW_FORM_expr/exprloc with the upper bound of the array. -- You are receiving this mail because: You are on the CC list for the bug.
_______________________________________________ llvm-bugs mailing list llvm-bugs@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs