llvm-project/lldb
Adrian Prantl eca07c592a Fix (and improve) the support for C99 variable length array types
Clang recently improved its DWARF support for C VLA types. The DWARF
now looks like this:

0x00000051:         DW_TAG_variable [4]
                     DW_AT_location( fbreg -32 )
                     DW_AT_name( "__vla_expr" )
                     DW_AT_type( {0x000000d3} ( long unsigned int ) )
                     DW_AT_artificial( true )
...
0x000000da:     DW_TAG_array_type [10] *
                 DW_AT_type( {0x000000cc} ( int ) )

0x000000df:         DW_TAG_subrange_type [11]
                     DW_AT_type( {0x000000e9} ( __ARRAY_SIZE_TYPE__ ) )
                     DW_AT_count( {0x00000051} )

Without this patch LLDB will naively interpret the DIE offset 0x51 as
the static size of the array, which is clearly wrong.  This patch
extends ValueObject::GetNumChildren to query the dynamic properties of
incomplete array types.

See the testcase for an example:

   4   int foo(int a) {
   5   	     int vla[a];
   6   	       for (int i = 0; i < a; ++i)
   7   	           vla[i] = i;
   8
-> 9            pause(); // break here
   10  		return vla[a-1];
   11   }

(lldb) fr v vla
(int []) vla = ([0] = 0, [1] = 1, [2] = 2, [3] = 3)
(lldb) quit

rdar://problem/21814005

Differential Revision: https://reviews.llvm.org/D53530

llvm-svn: 346165
2018-11-05 20:49:07 +00:00
..
cmake [lldb] Fix race condition in framework installation 2018-10-31 10:41:12 +00:00
docs Test commit 2018-11-03 05:12:15 +00:00
examples Fixes for GDB remote packet disassembler: 2018-09-27 17:55:36 +00:00
include/lldb Fix (and improve) the support for C99 variable length array types 2018-11-05 20:49:07 +00:00
lit Make sure to have lit load the configured site config first. 2018-11-03 00:06:37 +00:00
lldb.xcodeproj Fix the Xcode project for the removal of the Go, Java & OCaml 2018-11-05 20:15:27 +00:00
lldb.xcworkspace Fix a typo in the gtest build target for Debug configuration. 2018-04-10 17:49:56 +00:00
packages/Python/lldbsuite Fix (and improve) the support for C99 variable length array types 2018-11-05 20:49:07 +00:00
resources Fix up Info.plist when building LLDB.framework with CMake 2018-06-19 02:59:30 +00:00
scripts Update framework-header-fix to force system sed 2018-11-04 15:55:28 +00:00
source Fix (and improve) the support for C99 variable length array types 2018-11-05 20:49:07 +00:00
test Allow use of self.filecheck in LLDB tests (c.f self.expect) 2018-09-18 19:31:47 +00:00
third_party/Python/module *** This commit represents a complete reformatting of the LLDB source code 2016-09-06 20:57:50 +00:00
tools Remove OCaml debugger plugin 2018-11-05 19:34:03 +00:00
unittests Remove OCaml debugger plugin 2018-11-05 19:34:03 +00:00
utils Fix typos. 2018-10-04 22:33:39 +00:00
www [lldb] Introduce StackFrameRecognizer [take 3] 2018-10-31 04:00:22 +00:00
.arcconfig
.clang-format
.gitignore [dotest] Remove crashinfo hook 2018-01-10 10:18:47 +00:00
CMakeLists.txt Allow use of self.filecheck in LLDB tests (c.f self.expect) 2018-09-18 19:31:47 +00:00
CODE_OWNERS.txt Fix/unify the spelling of Objective-C. 2018-06-13 16:21:24 +00:00
INSTALL.txt Changed builld-llvm.py to use .json files 2017-02-23 02:21:34 +00:00
LICENSE.TXT
use_lldb_suite_root.py *** This commit represents a complete reformatting of the LLDB source code 2016-09-06 20:57:50 +00:00