aboutsummaryrefslogtreecommitdiff
path: root/gdb/cp-valprint.c
diff options
context:
space:
mode:
authorChris Moller <cmoller@cygnus>2010-04-21 17:33:54 +0000
committerChris Moller <cmoller@cygnus>2010-04-21 17:33:54 +0000
commit0b66f3173809e422f3dfbab2a8afff7fb9fc0ef3 (patch)
treed01b4a9ce867591f4a06247baf0d6f481cffeb0e /gdb/cp-valprint.c
parent34a7d6c6d367a964e24ea7f0f8c868cc531736f8 (diff)
downloadgdb-0b66f3173809e422f3dfbab2a8afff7fb9fc0ef3.zip
gdb-0b66f3173809e422f3dfbab2a8afff7fb9fc0ef3.tar.gz
gdb-0b66f3173809e422f3dfbab2a8afff7fb9fc0ef3.tar.bz2
PR 9167
* cp-valprint.c (cp_print_value_fields): Replaced obstack_base() method of popping recursion-detection stack with a method based on obstack_object_size(). * gdb.cp/Makefile.in (EXECUTABLES): Added pr9167. * gdb.cp/pr9167.cc: New file. * gdb.cp/pr9167.exp: New file.
Diffstat (limited to 'gdb/cp-valprint.c')
-rw-r--r--gdb/cp-valprint.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c
index d3d94d9..c865ba4 100644
--- a/gdb/cp-valprint.c
+++ b/gdb/cp-valprint.c
@@ -186,14 +186,13 @@ cp_print_value_fields (struct type *type, struct type *real_type,
fprintf_filtered (stream, "<No data fields>");
else
{
- void *statmem_obstack_top = NULL;
+ int obstack_initial_size = 0;
void *stat_array_obstack_top = NULL;
if (dont_print_statmem == 0)
{
- /* Set the current printed-statics stack top. */
- statmem_obstack_top
- = obstack_next_free (&dont_print_statmem_obstack);
+ obstack_initial_size =
+ obstack_object_size (&dont_print_statmem_obstack);
if (last_set_recurse != recurse)
{
@@ -321,8 +320,19 @@ cp_print_value_fields (struct type *type, struct type *real_type,
if (dont_print_statmem == 0)
{
- if (obstack_object_size (&dont_print_statmem_obstack) > 0)
- obstack_free (&dont_print_statmem_obstack, statmem_obstack_top);
+ int obstack_final_size =
+ obstack_object_size (&dont_print_statmem_obstack);
+
+ if (obstack_final_size > 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_free (&dont_print_statmem_obstack,
+ free_to_ptr);
+ }
if (last_set_recurse != recurse)
{
@@ -555,7 +565,6 @@ cp_print_static_field (struct type *type,
addr = value_address (val);
obstack_grow (&dont_print_statmem_obstack, (char *) &addr,
sizeof (CORE_ADDR));
-
CHECK_TYPEDEF (type);
cp_print_value_fields (type, value_enclosing_type (val),
value_contents_all (val),