Ilia K 94b8ebcacf Add -gdb-set/-gdb-show aggregate-field-names option (MI)
Use this option to print/skip field names (default is on):
```
-var-create var1 * complx
^done,name="var1",numchild="3",value="{i = 3, inner = {l = 3}, complex_ptr = 0x[0-9a-f]+}",type="complex_type",thread-id="1",has_more="0"
-var-create var2 * complx_array
^done,name="var2",numchild="2",value="{[0] = {i = 4, inner = {l = 4}, complex_ptr = 0x[0-9a-f]+}, [1] = {i = 5, inner = {l = 5}, complex_ptr = 0x[0-9a-f]+}}",type="complex_type [2]",thread-id="1",has_more="0"
-gdb-set print aggregate-field-names off
^done
-var-create var3 * complx
^done,name="var3",numchild="3",value="{3,{3},0x[0-9a-f]+}",type="complex_type",thread-id="1",has_more="0"
-var-create var4 * complx_array
^done,name="var4",numchild="2",value="{{4,{4},0x[0-9a-f]+},{5,{5},0x[0-9a-f]+}}",type="complex_type [2]",thread-id="1",has_more="0"
```

llvm-svn: 235807
2015-04-25 20:33:02 +00:00

78 lines
1.9 KiB
C++

//===-- main.cpp ------------------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include <cstdint>
struct complex_type
{
int i;
struct { long l; } inner;
complex_type *complex_ptr;
};
void
var_update_test(void)
{
long l = 1;
complex_type complx = { 3, { 3L }, &complx };
complex_type complx_array[2] = { { 4, { 4L }, &complx_array[1] }, { 5, { 5 }, &complx_array[0] } };
// BP_var_update_test_init
l = 0;
// BP_var_update_test_l
complx.inner.l = 2;
// BP_var_update_test_complx
complx_array[1].inner.l = 4;
// BP_var_update_test_complx_array
}
void
gdb_set_show_print_char_array_as_string_test(void)
{
const char *string_ptr = "string - const char *";
const char string_arr[] = "string - char []";
// BP_gdb_set_show_print_char_array_as_string_test
}
void
gdb_set_show_print_expand_aggregates(void)
{
complex_type complx = { 3, { 3L }, &complx };
complex_type complx_array[2] = { { 4, { 4L }, &complx_array[1] }, { 5, { 5 }, &complx_array[0] } };
// BP_gdb_set_show_print_expand_aggregates
}
void
gdb_set_show_print_aggregate_field_names(void)
{
complex_type complx = { 3, { 3L }, &complx };
complex_type complx_array[2] = { { 4, { 4L }, &complx_array[1] }, { 5, { 5 }, &complx_array[0] } };
// BP_gdb_set_show_print_aggregate_field_names
}
int g_MyVar = 3;
static int s_MyVar = 4;
int
main(int argc, char const *argv[])
{
int a = 10, b = 20;
s_MyVar = a + b;
var_update_test();
gdb_set_show_print_char_array_as_string_test();
gdb_set_show_print_expand_aggregates();
gdb_set_show_print_aggregate_field_names();
return 0; // BP_return
}