# Here and elsewhere, we accept
# "long", "long int", or "int" for long variables (whatis.exp already
# has an XFAIL for "int" (Sun cc bug), so no need to fail it here).
-gdb_test "ptype struct t_struct" "type = struct t_struct \{.*\[\r\n\] (unsigned |)char v_char_member;.*\[\r\n\] (short|short int) v_short_member;.*\[\r\n\] int v_int_member;.*\[\r\n\] (long|long int|int) v_long_member;.*\[\r\n\] float v_float_member;.*\[\r\n\] double v_double_member;.*\[\r\n\]\}.*" "ptype structure"
+gdb_test "ptype struct t_struct" \
+ [multi_line \
+ "type = struct t_struct {" \
+ " (unsigned |)char v_char_member;" \
+ " (short|short int) v_short_member;" \
+ " int v_int_member;" \
+ " (long|long int|int) v_long_member;" \
+ " float v_float_member;" \
+ " double v_double_member;" \
+ "}"] "ptype structure"
# Test the equivalence between '.' and '->' for struct member references.
return -1
}
-gdb_test "ptype struct link" "type = struct link \{\[\r\n\]+\[ \t\]+struct link \\*next;\[\r\n\]+\[ \t\]+struct link \\*\\(\\*linkfunc\\)\\((struct link \\*, int|void|)\\);\[\r\n\]+\[ \t\]+struct t_struct stuff.3.;\[\r\n\]+\}.*" "ptype linked list structure"
+gdb_test "ptype struct link" \
+ [multi_line \
+ "type = struct link {" \
+ " struct link \\*next;" \
+ " struct link \\*\\(\\*linkfunc\\)\\((struct link \\*, int|void|)\\);" \
+ " struct t_struct stuff.3.;" \
+ "}"] "ptype linked list structure"
#
# test ptype command with unions
#
-gdb_test "ptype union t_union" "type = union t_union \{.*\[\r\n\] (unsigned |)char v_char_member;.*\[\r\n\] (short|short int) v_short_member;.*\[\r\n\] int v_int_member;.*\[\r\n\] (long|long int|int) v_long_member;.*\[\r\n\] float v_float_member;.*\[\r\n\] double v_double_member;.*\[\r\n\]\}.*" "ptype union"
+gdb_test "ptype union t_union" \
+ [multi_line \
+ "type = union t_union {" \
+ " (unsigned |)char v_char_member;" \
+ " (short|short int) v_short_member;" \
+ " int v_int_member;" \
+ " (long|long int|int) v_long_member;" \
+ " float v_float_member;" \
+ " double v_double_member;" \
+ "}"] "ptype union"
#
# test ptype command with enums
#
# test ptype command with nested structure and union
#
-gdb_test "ptype struct outer_struct" "type = struct outer_struct \{.*\[\r\n\]+\
-.*int outer_int;.*\[\r\n\]+\
-.*(struct|) inner_struct inner_struct_instance;.*\[\r\n\]+\
-.*(union|) inner_union inner_union_instance;.*\[\r\n\]+\
-.*(long|long int|int) outer_long;.*\[\r\n\]\}.*" "ptype outer structure"
-
-gdb_test "ptype struct inner_struct" "type = struct inner_struct \{.*\[\r\n\] int inner_int;.*\[\r\n\] (long|long int|int) inner_long;.*\[\r\n\]\}.*" "ptype inner structure"
-
-gdb_test "ptype union inner_union" "type = union inner_union \{.*\[\r\n\] int inner_union_int;.*\[\r\n\] (long|long int|int) inner_union_long;.*\[\r\n\]\}.*" "ptype inner union"
-
-gdb_test "ptype nested_su" "type = struct outer_struct \{.*\[\r\n\] int outer_int;.*\[\r\n\] (struct |)inner_struct inner_struct_instance;.*\[\r\n\] (union |)inner_union inner_union_instance;.*\[\r\n\] (long|long int|int) outer_long;.*\[\r\n\]\}.*" "ptype nested structure"
+gdb_test "ptype struct outer_struct" \
+ [multi_line \
+ "type = struct outer_struct {" \
+ " int outer_int;" \
+ " (struct|) inner_struct inner_struct_instance;" \
+ " (union|) inner_union inner_union_instance;" \
+ " (long|long int|int) outer_long;" \
+ "}"] "ptype outer structure"
+
+gdb_test "ptype struct inner_struct" \
+ [multi_line \
+ "type = struct inner_struct {" \
+ " int inner_int;" \
+ " (long|long int|int) inner_long;" \
+ "}"] "ptype inner structure"
+
+gdb_test "ptype union inner_union" \
+ [multi_line \
+ "type = union inner_union {" \
+ " int inner_union_int;" \
+ " (long|long int|int) inner_union_long;" \
+ "}"] "ptype inner union"
+
+gdb_test "ptype nested_su" \
+ [multi_line \
+ "type = struct outer_struct {" \
+ " int outer_int;" \
+ " (struct |)inner_struct inner_struct_instance;" \
+ " (union |)inner_union inner_union_instance;" \
+ " (long|long int|int) outer_long;" \
+ "}"] "ptype nested structure"
gdb_test "ptype nested_su.outer_int" "type = int.*" "ptype outer int"
-gdb_test "ptype nested_su.inner_struct_instance" "type = struct inner_struct \{.*\[\r\n\] int inner_int;.*\[\r\n\] (long|long int|int) inner_long;.*\[\r\n\]\}.*" "ptype nested structure #2"
+gdb_test "ptype nested_su.inner_struct_instance" \
+ [multi_line \
+ "type = struct inner_struct {" \
+ " int inner_int;" \
+ " (long|long int|int) inner_long;" \
+ "}"] "ptype nested structure #2"
gdb_test "ptype nested_su.inner_struct_instance.inner_int" "type = int.*" "ptype inner int"
-gdb_test "ptype nested_su.inner_union_instance" "type = union inner_union \{.*\[\r\n\] int inner_union_int;.*\[\r\n\] (long|long int|int) inner_union_long;.*\[\r\n\]\}.*" "ptype nested union"
+gdb_test "ptype nested_su.inner_union_instance" \
+ [multi_line \
+ "type = union inner_union {" \
+ " int inner_union_int;" \
+ " (long|long int|int) inner_union_long;" \
+ "}"] "ptype nested union"
# Print the type description of variable the_highest, and verify that
# the type description for the fields whose type is anonymous are
# correctly printed (at nesting level 1 and 2).
gdb_test "ptype the_highest" \
- "type = struct highest \{.*\[\r\n\] *int a;.*\[\r\n\] *struct \{.*\[\r\n\] *int b;.*\[\r\n\] *struct \{\.\.\.\} anonymous_level_2;.*\[\r\n\] *\} anonymous_level_1;.*\[\r\n\]}.*" \
- "ptype the_highest"
+ [multi_line \
+ "type = struct highest {" \
+ " int a;" \
+ " struct {" \
+ " int b;" \
+ " struct {...} anonymous_level_2;" \
+ " } anonymous_level_1;" \
+ "}"] "ptype the_highest"
# Print the type description for one of the fields of variable the_highest.
# The purpose is to verify that the type of a field that was printed above
# nesting level is now one level less).
gdb_test "ptype the_highest.anonymous_level_1" \
- "type = struct \{.*\[\r\n\] *int b;.*\[\r\n\] *struct \{.*\[\r\n\] *int c;.*\[\r\n\] *\} anonymous_level_2;.*\[\r\n\]}.*" \
- "ptype the_highest.anonymous_level_1"
+ [multi_line \
+ "type = struct {" \
+ " int b;" \
+ " struct {" \
+ " int c;" \
+ " \} anonymous_level_2;" \
+ "}"] "ptype the_highest.anonymous_level_1"
# Print the type of the identifier ID, and check the response:
# - Expect to see PROTOTYPED as the type. PROTOTYPED is not a regular
# Here and elsewhere, we accept
# "long", "long int", or "int" for long variables (whatis.exp already
# has an XFAIL for "int" (Sun cc bug), so no need to fail it here).
-gdb_test "ptype struct t_struct" "type = struct t_struct \{.*\[\r\n\] (unsigned |)char v_char_member;.*\[\r\n\] (short|short int) v_short_member;.*\[\r\n\] int v_int_member;.*\[\r\n\] (long|long int|int) v_long_member;.*\[\r\n\] float v_float_member;.*\[\r\n\] double v_double_member;.*\[\r\n\]\}.*" "ptype structure"
+gdb_test "ptype struct t_struct" \
+ [multi_line \
+ "type = struct t_struct {" \
+ " (unsigned |)char v_char_member;" \
+ " (short|short int) v_short_member;" \
+ " int v_int_member;" \
+ " (long|long int|int) v_long_member;" \
+ " float v_float_member;" \
+ " double v_double_member;" \
+ "}"] "ptype structure"
# Test the equivalence between '.' and '->' for struct member references.
# IBM's xlc puts out bogus stabs--the stuff field is type 42,
# which isn't defined.
-gdb_test "ptype struct link" "type = struct link \{\[\r\n\]+\[ \t\]+struct link \\*next;\[\r\n\]+\[ \t\]+struct link \\*\\(\\*linkfunc\\)\\((struct link \\*, int|void|)\\);\[\r\n\]+\[ \t\]+struct t_struct stuff.1..2..3.;\[\r\n\]+\}.*" "ptype linked list structure"
+gdb_test "ptype struct link" \
+ [multi_line \
+ "type = struct link {" \
+ " struct link \\*next;" \
+ " struct link \\*\\(\\*linkfunc\\)\\((struct link \\*, int|void|)\\);" \
+ " struct t_struct stuff.1..2..3.;" \
+ "}"] "ptype linked list structure"
#
# test ptype command with unions
#
-gdb_test "ptype union t_union" "type = union t_union \{.*\[\r\n\] (unsigned |)char v_char_member;.*\[\r\n\] (short|short int) v_short_member;.*\[\r\n\] int v_int_member;.*\[\r\n\] (long|long int|int) v_long_member;.*\[\r\n\] float v_float_member;.*\[\r\n\] double v_double_member;.*\[\r\n\]\}.*" "ptype union"
+gdb_test "ptype union t_union" \
+ [multi_line \
+ "type = union t_union {" \
+ " (unsigned |)char v_char_member;" \
+ " (short|short int) v_short_member;" \
+ " int v_int_member;" \
+ " (long|long int|int) v_long_member;" \
+ " float v_float_member;" \
+ " double v_double_member;" \
+ "}"] "ptype union"
# IBM's xlc puts out bogus stabs--the stuff field is type 42,
# which isn't defined.
-gdb_test "ptype union tu_link" "type = union tu_link \{\[\r\n\]+\[ \t\]+struct link \\*next;\[\r\n\]+\[ \t\]+struct link \\*\\(\\*linkfunc\\)\\((struct link \\*, int|void|)\\);\[\r\n\]+\[ \t\]+struct t_struct stuff.1..2..3.;\[\r\n\]+\}.*" "ptype linked list union"
+gdb_test "ptype union tu_link" \
+ [multi_line \
+ "type = union tu_link {" \
+ " struct link \\*next;" \
+ " struct link \\*\\(\\*linkfunc\\)\\((struct link \\*, int|void|)\\);" \
+ " struct t_struct stuff.1..2..3.;" \
+ "}"] "ptype linked list union"
#
# test ptype command with enums
#
# test ptype command with nested structure and union
#
-gdb_test "ptype struct outer_struct" "type = struct outer_struct \{.*\[\r\n\]+\
-.*int outer_int;.*\[\r\n\]+\
-.*(struct|) inner_struct inner_struct_instance;.*\[\r\n\]+\
-.*(union|) inner_union inner_union_instance;.*\[\r\n\]+\
-.*(long|long int|int) outer_long;.*\[\r\n\]\}.*" "ptype outer structure"
-
-gdb_test "ptype struct inner_struct" "type = struct inner_struct \{.*\[\r\n\] int inner_int;.*\[\r\n\] (long|long int|int) inner_long;.*\[\r\n\]\}.*" "ptype inner structure"
-
-gdb_test "ptype union inner_union" "type = union inner_union \{.*\[\r\n\] int inner_union_int;.*\[\r\n\] (long|long int|int) inner_union_long;.*\[\r\n\]\}.*" "ptype inner union"
-
-gdb_test "ptype nested_su" "type = struct outer_struct \{.*\[\r\n\] int outer_int;.*\[\r\n\] (struct |)inner_struct inner_struct_instance;.*\[\r\n\] (union |)inner_union inner_union_instance;.*\[\r\n\] (long|long int|int) outer_long;.*\[\r\n\]\}.*" "ptype nested structure"
+gdb_test "ptype struct outer_struct" \
+ [multi_line \
+ "type = struct outer_struct {" \
+ " int outer_int;" \
+ " (struct|) inner_struct inner_struct_instance;" \
+ " (union|) inner_union inner_union_instance;" \
+ " (long|long int|int) outer_long;" \
+ "}"] "ptype outer structure"
+
+gdb_test "ptype struct inner_struct" \
+ [multi_line \
+ "type = struct inner_struct {" \
+ " int inner_int;" \
+ " (long|long int|int) inner_long;" \
+ "}"] "ptype inner structure"
+
+gdb_test "ptype union inner_union" \
+ [multi_line \
+ "type = union inner_union {" \
+ " int inner_union_int;" \
+ " (long|long int|int) inner_union_long;" \
+ "}"] "ptype inner union"
+
+gdb_test "ptype nested_su" \
+ [multi_line \
+ "type = struct outer_struct {" \
+ " int outer_int;" \
+ " (struct |)inner_struct inner_struct_instance;" \
+ " (union |)inner_union inner_union_instance;" \
+ " (long|long int|int) outer_long;" \
+ "}"] "ptype nested structure"
gdb_test "ptype nested_su.outer_int" "type = int.*" "ptype outer int"
-gdb_test "ptype nested_su.inner_struct_instance" "type = struct inner_struct \{.*\[\r\n\] int inner_int;.*\[\r\n\] (long|long int|int) inner_long;.*\[\r\n\]\}.*" "ptype nested structure #2"
+gdb_test "ptype nested_su.inner_struct_instance" \
+ [multi_line \
+ "type = struct inner_struct {" \
+ " int inner_int;" \
+ " (long|long int|int) inner_long;" \
+ "}"] "ptype nested structure #2"
gdb_test "ptype nested_su.inner_struct_instance.inner_int" "type = int.*" "ptype inner int"
-gdb_test "ptype nested_su.inner_union_instance" "type = union inner_union \{.*\[\r\n\] int inner_union_int;.*\[\r\n\] (long|long int|int) inner_union_long;.*\[\r\n\]\}.*" "ptype nested union"
+gdb_test "ptype nested_su.inner_union_instance" \
+ [multi_line \
+ "type = union inner_union {" \
+ " int inner_union_int;" \
+ " (long|long int|int) inner_union_long;" \
+ "}"] "ptype nested union"
# Print the type description of variable the_highest, and verify that
# the type description for the fields whose type is anonymous are
# correctly printed (at nesting level 1 and 2).
gdb_test "ptype the_highest" \
- "type = struct highest \{.*\[\r\n\] *int a;.*\[\r\n\] *struct \{.*\[\r\n\] *int b;.*\[\r\n\] *struct \{\.\.\.\} anonymous_level_2;.*\[\r\n\] *\} anonymous_level_1;.*\[\r\n\]}.*"
+ [multi_line \
+ "type = struct highest {" \
+ " int a;" \
+ " struct {" \
+ " int b;" \
+ " struct \{\.\.\.\} anonymous_level_2;" \
+ " \} anonymous_level_1;" \
+ "}"]
# Print the type description for one of the fields of variable the_highest.
# The purpose is to verify that the type of a field that was printed above
# nesting level is now one level less).
gdb_test "ptype the_highest.anonymous_level_1" \
- "type = struct \{.*\[\r\n\] *int b;.*\[\r\n\] *struct \{.*\[\r\n\] *int c;.*\[\r\n\] *\} anonymous_level_2;.*\[\r\n\]}.*" \
- "ptype the_highest.anonymous_level_1"
+ [multi_line \
+ "type = struct {" \
+ " int b;" \
+ " struct {" \
+ " int c;" \
+ " \} anonymous_level_2;" \
+ "}"] "ptype the_highest.anonymous_level_1"
get_debug_format
gdb_test "ptype \$uintreg" "type = uint32_t"
gdb_test "ptype \$vecreg" "type = int8_t __attribute__ \\(\\(vector_size\\(4\\)\\)\\)"
gdb_test "ptype \$unionreg" \
- "type = union vecint {\r\n *v4int8 v4;\r\n *v2int16 v2;\r\n}"
+ [multi_line \
+ "type = union vecint {" \
+ " v4int8 v4;" \
+ " v2int16 v2;" \
+ "}"]
gdb_test "ptype \$unionreg.v4" "type = int8_t __attribute__ \\(\\(vector_size\\(4\\)\\)\\)"
gdb_test "ptype \$structreg" \
- "type = struct struct1 {\r\n *v4int8 v4;\r\n *v2int16 v2;\r\n}"
+ [multi_line \
+ "type = struct struct1 {" \
+ " v4int8 v4;" \
+ " v2int16 v2;" \
+ "}"]
gdb_test "ptype \$structreg.v4" "type = int8_t __attribute__ \\(\\(vector_size\\(4\\)\\)\\)"
gdb_test "ptype \$bitfields" \
- "type = struct struct2 {\r\n *uint64_t f1 : 35;\r\n *uint64_t f2 : 1;\r\n}"
+ [multi_line \
+ "type = struct struct2 {" \
+ " uint64_t f1 : 35;" \
+ " uint64_t f2 : 1;" \
+ "}"]
gdb_test "ptype \$flags" \
- "type = flag flags {\r\n *bool X @0;\r\n *uint32_t Y @2;\r\n}"
+ [multi_line \
+ "type = flag flags {" \
+ " bool X @0;" \
+ " uint32_t Y @2;" \
+ "}"]
gdb_test "ptype \$mixed_flags" \
- "type = flag mixed_flags {\r\n *bool A @0;\r\n *uint32_t B @1-3;\r\n *bool C @4;\r\n *uint32_t D @5;\r\n *uint32_t @6-7;\r\n *enum Z_values {yes = 1, no = 0, maybe = 2, so} Z @8-9;\r\n}"
+ [multi_line \
+ "type = flag mixed_flags {" \
+ " bool A @0;" \
+ " uint32_t B @1-3;" \
+ " bool C @4;" \
+ " uint32_t D @5;" \
+ " uint32_t @6-7;" \
+ " enum Z_values {yes = 1, no = 0, maybe = 2, so} Z @8-9;" \
+ "}"]
# Reggroups should have at least general and the extra foo group
gdb_test "maintenance print reggroups" \
"Group\[ \t\]+Type\[ \t\]+\r\n.*general\[ \t\]+user\[ \t\]+\r\n.*foo\[ \t\]+user\[ \t\]+"