aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorJoel Brobecker <brobecker@gnat.com>2007-12-22 05:28:19 +0000
committerJoel Brobecker <brobecker@gnat.com>2007-12-22 05:28:19 +0000
commit919809b9731914a489162a428b55d17f0badee14 (patch)
tree2bd7cd4aa996c8b24b190f496349e0d38772a338 /gdb
parentcf88803ada9d053a8d6f48437bb117a6ca45e0db (diff)
downloadgdb-919809b9731914a489162a428b55d17f0badee14.zip
gdb-919809b9731914a489162a428b55d17f0badee14.tar.gz
gdb-919809b9731914a489162a428b55d17f0badee14.tar.bz2
* gdb.base/ptype.c (highest): New struct type.
(the_highest): New variable of that type. (main): Add dummy assignment to a field of variable the_highest. * gdb.base/ptype.exp: Test type printing of our new variable.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/testsuite/ChangeLog7
-rw-r--r--gdb/testsuite/gdb.base/ptype.c12
-rw-r--r--gdb/testsuite/gdb.base/ptype.exp16
3 files changed, 35 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 32d59f6..a340fff 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,10 @@
+2007-12-22 Joel Brobecker <brobecker@adacore.com>
+
+ * gdb.base/ptype.c (highest): New struct type.
+ (the_highest): New variable of that type.
+ (main): Add dummy assignment to a field of variable the_highest.
+ * gdb.base/ptype.exp: Test type printing of our new variable.
+
2007-12-19 Pierre Muller <muller@ics-u-strasbg.fr>
* (gdb.base/watch_thread_num.exp): Add breakpoint at thread_function
diff --git a/gdb/testsuite/gdb.base/ptype.c b/gdb/testsuite/gdb.base/ptype.c
index b847139..46769ad 100644
--- a/gdb/testsuite/gdb.base/ptype.c
+++ b/gdb/testsuite/gdb.base/ptype.c
@@ -198,6 +198,16 @@ struct outer_struct {
long outer_long;
} nested_su;
+struct highest
+{
+ int a;
+ struct
+ {
+ int b;
+ struct { int c; } anonymous_level_2;
+ } anonymous_level_1;
+} the_highest;
+
/**** Enumerations *******/
enum
@@ -352,6 +362,8 @@ int main ()
nested_su.outer_int = 0;
v_t_struct_p = 0;
+ the_highest.a = 0;
+
v_boolean = FALSE;
v_boolean2 = my_false;
return 0;
diff --git a/gdb/testsuite/gdb.base/ptype.exp b/gdb/testsuite/gdb.base/ptype.exp
index e65fdc7..3273c37 100644
--- a/gdb/testsuite/gdb.base/ptype.exp
+++ b/gdb/testsuite/gdb.base/ptype.exp
@@ -532,6 +532,22 @@ gdb_test "ptype nested_su.inner_struct_instance.inner_int" "type = int.*" "ptype
gdb_test "ptype nested_su.inner_union_instance" "type = union ${outer}inner_union \{.*\[\r\n\] int inner_union_int;.*\[\r\n\] (long|long int|int) inner_union_long;.*\[\r\n\]\}.*" "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"
+
+# Print the type descrption for one of the fields of variable the_highest.
+# The purpose is to verify that the type of a field that was printed above
+# as "struct {...}" is now printed in a more descriptive way (because the
+# 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"
get_debug_format