+2017-10-26 Patrick Frants <osscontribute@gmail.com>
+
+ * cp-valprint.c (cp_print_value_fields): Use obstack_blank_fast
+ to rewind obstack.
+
2017-10-26 Pedro Alves <palves@redhat.com>
* remote.c (remote_async_terminal_ours_p): Delete.
if (obstack_final_size > statmem_obstack_initial_size)
{
/* In effect, a pop of the printed-statics stack. */
-
- void *free_to_ptr =
- (char *) obstack_next_free (&dont_print_statmem_obstack) -
- (obstack_final_size - statmem_obstack_initial_size);
-
- obstack_free (&dont_print_statmem_obstack,
- free_to_ptr);
+ size_t shrink_bytes
+ = statmem_obstack_initial_size - obstack_final_size;
+ obstack_blank_fast (&dont_print_statmem_obstack, shrink_bytes);
}
if (last_set_recurse != recurse)
+2017-10-26 Patrick Frants <osscontribute@gmail.com>
+
+ * gdb.cp/classes.exp (test_static_members): Test printing
+ Outer::instance.
+ * gdb.cp/classes.c (struct Inner, struct Outer): New.
+ (Inner::instance, Outer::instance): New.
+
2017-10-24 Pedro Alves <palves@redhat.com>
* gdb.base/new-ui.exp (do_test): Split "delete all breakpoints on
base1 b (3);
}
+struct Inner
+{
+ static Inner instance;
+};
+
+struct Outer
+{
+ Inner inner;
+ static Outer instance;
+};
+
+Inner Inner::instance;
+Outer Outer::instance;
int
main()
gdb_test "print cnsi" \
"{x = 30, y = 40, static null = {x = 0, y = 0, static null = <same as static member of an already seen type>, static yy = {z = 5, static xx = {x = 1, y = 2, static null = <same as static member of an already seen type>, static yy = <same as static member of an already seen type>}}}, static yy = <same as static member of an already seen type>}" \
"print cnsi with static members"
+
+ # Another case of infinite recursion.
+ gdb_test "print Outer::instance" \
+ "{inner = {static instance = {static instance = <same as static member of an already seen type>}}, static instance = {inner = {static instance = {static instance = <same as static member of an already seen type>}}, static instance = <same as static member of an already seen type>}}" \
+ "print recursive static member"
}
proc do_tests {} {