[llvm-bugs] [Bug 26010] New: LLDB fails to display content of a variable size array

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jan 4 03:17:17 PST 2016


https://llvm.org/bugs/show_bug.cgi?id=26010

            Bug ID: 26010
           Summary: LLDB fails to display content of a variable size array
           Product: lldb
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: lldb-dev at lists.llvm.org
          Reporter: tberghammer at google.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Compile the following code snippet with g++ (tested with 4.8.2 on Linux
x86_64):

int main() {
    for (int i = 0; i < 10; ++i) {
        int x[i + 1];
        x[0] = sizeof(x);
        x[0] *= 2; // Break here
    }
}

Break at the marked line and display the variable x with executing the "frame
variable x" command.

Expected behavior is to display x as an array with the number of displayed
elements matching with the actual element count of the array in the current
implementation.

Actual behavior is that the array is always displayed with 4 element regardless
of the current iteration.

In the same scenario gdb displays the array with the correct number of element.

If the inferior is compiled with clang then gdb fails as well because incorrect
debug info is generated (http://llvm.org/pr25934)

The problem is that for variable sized arrays g++ correctly generates a
DW_TAG_subrange_type children with a DW_AT_upper_bound attribute containing a
dwarf expression pointing to the location where the current size of the array
is stored but LLDB don't handle the case where DW_AT_upper_bound is a dwarf
expression.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160104/919fa8cf/attachment.html>


More information about the llvm-bugs mailing list