Dwarf::assemble $asm_file {
cu {} {
compile_unit {{language @DW_LANG_C99}} {
- declare_labels char_label array_label array_label2 static_array_label
+ declare_labels char_label \
+ array_size_type_label long_unsigned_int_label \
+ array_label array_label2 static_array_label \
+ vla_length_label vla_array_label
char_label: base_type {
{name char}
{byte_size 1 DW_FORM_sdata}
}
+ array_size_type_label: base_type {
+ {byte_size 8 DW_FORM_sdata}
+ {encoding @DW_ATE_unsigned}
+ {name __ARRAY_SIZE_TYPE__}
+ }
+
+ long_unsigned_int_label: base_type {
+ {byte_size 8 DW_FORM_sdata}
+ {encoding @DW_ATE_unsigned}
+ {name "long unsigned int"}
+ }
+
array_label: array_type {
{type :$char_label}
} {
}
}
+ vla_length_label:
+ DW_TAG_variable {
+ {location
+ {
+ lit6
+ stack_value
+ } SPECIAL_expr}
+ {name "__vla_array_length"}
+ {type :$long_unsigned_int_label}
+ {artificial 1 DW_FORM_flag_present}
+ }
+
+ vla_array_label: array_type {
+ {type :$char_label}
+ } {
+ subrange_type {
+ {type :$array_size_type_label}
+ {count :$vla_length_label}
+ }
+ }
+
DW_TAG_variable {
{name array2}
{type :$array_label2}
{type :$static_array_label}
{const_value world DW_FORM_block1}
}
+
+ DW_TAG_variable {
+ {name vla_array}
+ {type :$vla_array_label}
+ {const_value saluton DW_FORM_block1}
+ }
}
}
}
gdb_test "whatis static_array" "type = char \\\[5\\\]"
gdb_test "print static_array" " = \"world\""
gdb_test "print sizeof static_array" " = 5"
+
+setup_kfail "gdb/26905" *-*-*
+gdb_test "ptype vla_array" "type = char \\\[6\\\]"
+setup_kfail "gdb/26905" *-*-*
+gdb_test "whatis vla_array" "type = char \\\[6\\\]"
+setup_kfail "gdb/26905" *-*-*
+gdb_test "print vla_array" " = \"saluto\""
+setup_kfail "gdb/26905" *-*-*
+gdb_test "print sizeof vla_array" " = 6"