diff options
author | Chris Moller <cmoller@cygnus> | 2010-04-22 20:12:07 +0000 |
---|---|---|
committer | Chris Moller <cmoller@cygnus> | 2010-04-22 20:12:07 +0000 |
commit | f56dcb8879cd1ef225707588cbf07599fcf7855d (patch) | |
tree | e587bee2df8debb77a9257845b18fe604674c9c2 /gdb/cp-valprint.c | |
parent | 6cd6a2aec631174856a2f68a8323427f78f7edc3 (diff) | |
download | gdb-f56dcb8879cd1ef225707588cbf07599fcf7855d.zip gdb-f56dcb8879cd1ef225707588cbf07599fcf7855d.tar.gz gdb-f56dcb8879cd1ef225707588cbf07599fcf7855d.tar.bz2 |
* 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.)
Diffstat (limited to 'gdb/cp-valprint.c')
-rw-r--r-- | gdb/cp-valprint.c | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c index c865ba4..64aa3e0 100644 --- a/gdb/cp-valprint.c +++ b/gdb/cp-valprint.c @@ -186,18 +186,18 @@ cp_print_value_fields (struct type *type, struct type *real_type, fprintf_filtered (stream, "<No data fields>"); 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 +323,12 @@ cp_print_value_fields (struct type *type, struct type *real_type, 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 +336,18 @@ cp_print_value_fields (struct type *type, struct type *real_type, if (last_set_recurse != recurse) { - if (obstack_object_size (&dont_print_stat_array_obstack) > 0) - obstack_free (&dont_print_stat_array_obstack, - stat_array_obstack_top); + 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, + free_to_ptr); + } last_set_recurse = -1; } } |