Index: ChangeLog =================================================================== RCS file: /cvs/src/src/gdb/ChangeLog,v retrieving revision 1.11667 diff -u -r1.11667 ChangeLog --- ChangeLog 22 Apr 2010 12:30:54 -0000 1.11667 +++ ChangeLog 22 Apr 2010 13:56:51 -0000 @@ -1,3 +1,10 @@ +2010-04-22 Chris Moller + + * cp-valprint.c (cp_print_value_fields): Replaced obstack_base() + method of popping recursion-detection stack with a method based on + obstack_object_size(). (Similar to the PR9167 patch below, but for + the static array obstack rather than the static member obstack.) + 2010-04-22 Pierre Muller PR stabs/11479. Index: cp-valprint.c =================================================================== RCS file: /cvs/src/src/gdb/cp-valprint.c,v retrieving revision 1.66 diff -u -r1.66 cp-valprint.c --- cp-valprint.c 21 Apr 2010 17:33:54 -0000 1.66 +++ cp-valprint.c 22 Apr 2010 13:56:51 -0000 @@ -81,7 +81,8 @@ static void cp_print_value (struct type *, struct type *, const gdb_byte *, int, CORE_ADDR, struct ui_file *, int, - const struct value_print_options *, struct type **); + const struct value_print_options *, + struct type **); /* GCC versions after 2.4.5 use this. */ @@ -186,18 +187,18 @@ fprintf_filtered (stream, ""); else { - int obstack_initial_size = 0; - void *stat_array_obstack_top = NULL; + int statmem_obstack_initial_size = 0; + int stat_array_obstack_initial_size = 0; if (dont_print_statmem == 0) { - obstack_initial_size = + statmem_obstack_initial_size = obstack_object_size (&dont_print_statmem_obstack); if (last_set_recurse != recurse) { - stat_array_obstack_top - = obstack_next_free (&dont_print_stat_array_obstack); + stat_array_obstack_initial_size = + obstack_object_size (&dont_print_stat_array_obstack); last_set_recurse = recurse; } } @@ -323,12 +324,12 @@ int obstack_final_size = obstack_object_size (&dont_print_statmem_obstack); - if (obstack_final_size > obstack_initial_size) { + if (obstack_final_size > statmem_obstack_initial_size) { /* In effect, a pop of the printed-statics stack. */ void *free_to_ptr = obstack_next_free (&dont_print_statmem_obstack) - - (obstack_final_size - obstack_initial_size); + (obstack_final_size - statmem_obstack_initial_size); obstack_free (&dont_print_statmem_obstack, free_to_ptr); @@ -336,9 +337,17 @@ if (last_set_recurse != recurse) { - if (obstack_object_size (&dont_print_stat_array_obstack) > 0) + int obstack_final_size = + obstack_object_size (&dont_print_stat_array_obstack); + + if (obstack_final_size > stat_array_obstack_initial_size) { + void *free_to_ptr = + obstack_next_free (&dont_print_stat_array_obstack) - + (obstack_final_size - stat_array_obstack_initial_size); + obstack_free (&dont_print_stat_array_obstack, - stat_array_obstack_top); + free_to_ptr); + } last_set_recurse = -1; } }