gdb/
authorJan Kratochvil <jan.kratochvil@redhat.com>
Mon, 28 Jun 2010 16:59:47 +0000 (16:59 +0000)
committerJan Kratochvil <jan.kratochvil@redhat.com>
Mon, 28 Jun 2010 16:59:47 +0000 (16:59 +0000)
* cp-valprint.c (cp_print_value_fields) <recurse == 0>: Call
obstack_begin after each obstack_free.

gdb/testsuite/
* gdb.cp/static-print-quit.exp, gdb.cp/static-print-quit.cc: New.

gdb/ChangeLog
gdb/cp-valprint.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.cp/static-print-quit.cc [new file with mode: 0644]
gdb/testsuite/gdb.cp/static-print-quit.exp [new file with mode: 0644]

index 6e700a4d84dde011de4679c19e278755d73d554a..2b889fc9bea068ac0f60472584f52ef325f5f9b3 100644 (file)
@@ -1,3 +1,8 @@
+2010-06-28  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+       * cp-valprint.c (cp_print_value_fields) <recurse == 0>: Call
+       obstack_begin after each obstack_free.
+
 2010-06-27  Doug Evans  <dje@google.com>
 
        * value.c (value_static_field): Use `switch' instead of `if'.
 
 2010-06-25  Paul Hilfinger  <hilfinger@adacore.com>
 
-        * defs.h (make_command_stats_cleanup): Declare.
-        (set_display_time): Declare.
-        (set_display_space): Declare.
-        * event-top.c (command_handler): Use make_command_stats_cleanup.
-        * main.c (display_time, display_space): Move definitions to utils.c.
-        (captured_main): Use make_command_stats_cleanup to get start-up
-        statistics.
-        Use set_display_time and set_display_space for processing OPT_STATISTICS
-        case.
-        * maint.c (maintenance_time_display): Use set_display_time.
-        (maintenance_space_display): Use set_display_space.
-        * top.c (execute_command): Remove obsolete 'maint time' code.
-        (command_loop): Use make_command_stats_cleanup.
-        * utils.c (struct cmd_stats): Structure for storing initial time
-        and space usage.
-        (display_time, display_space): Move definitions here from utils.c.
-        (set_display_time): New function.
-        (set_display_space): New function.
-        (make_command_stats_cleanup): New function.
-        (report_command_stats): New auxiliary function for
-        make_command_stats_cleanup.
+       * defs.h (make_command_stats_cleanup): Declare.
+       (set_display_time): Declare.
+       (set_display_space): Declare.
+       * event-top.c (command_handler): Use make_command_stats_cleanup.
+       * main.c (display_time, display_space): Move definitions to utils.c.
+       (captured_main): Use make_command_stats_cleanup to get start-up
+       statistics.
+       Use set_display_time and set_display_space for processing OPT_STATISTICS
+       case.
+       * maint.c (maintenance_time_display): Use set_display_time.
+       (maintenance_space_display): Use set_display_space.
+       * top.c (execute_command): Remove obsolete 'maint time' code.
+       (command_loop): Use make_command_stats_cleanup.
+       * utils.c (struct cmd_stats): Structure for storing initial time
+       and space usage.
+       (display_time, display_space): Move definitions here from utils.c.
+       (set_display_time): New function.
+       (set_display_space): New function.
+       (make_command_stats_cleanup): New function.
+       (report_command_stats): New auxiliary function for
+       make_command_stats_cleanup.
 
 2010-06-25  Ulrich Weigand  <uweigand@de.ibm.com>
 
 
        PR gdb/9067
        * cp-valprint.c (cp_print_value_fields) Fix use of obstacks.
-       cp_print_static_field)  Fix use of obstacks.
+       (cp_print_static_field)  Fix use of obstacks.
 
 2010-02-08  Pedro Alves  <pedro@codesourcery.com>
 
index 57b8dab7027fe2455de8eef1b04502940b4d1131..5f47ec4d9100d26b3e69bd6f843df177a8d192b2 100644 (file)
@@ -164,10 +164,19 @@ cp_print_value_fields (struct type *type, struct type *real_type,
   
   if (recurse == 0)
     {
+      /* Any object can be left on obstacks only during an unexpected error.  */
+
       if (obstack_object_size (&dont_print_statmem_obstack) > 0)
-       obstack_free (&dont_print_statmem_obstack, NULL);
+       {
+         obstack_free (&dont_print_statmem_obstack, NULL);
+         obstack_begin (&dont_print_statmem_obstack, 32 * sizeof (CORE_ADDR));
+       }
       if (obstack_object_size (&dont_print_stat_array_obstack) > 0)
-       obstack_free (&dont_print_stat_array_obstack, NULL);
+       {
+         obstack_free (&dont_print_stat_array_obstack, NULL);
+         obstack_begin (&dont_print_stat_array_obstack,
+                        32 * sizeof (struct type *));
+       }
     }
 
   fprintf_filtered (stream, "{");
index e04653989325c822bfa4b79308febe4dfa0e799b..01c11d5549b4bef036f276e9bab0a92c3c151026 100644 (file)
@@ -1,3 +1,7 @@
+2010-06-28  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+       * gdb.cp/static-print-quit.exp, gdb.cp/static-print-quit.cc: New.
+
 2010-06-28  Doug Evans  <dje@google.com>
 
        * gdb.base/break-interp.exp (reach): Relax expected output a bit.
diff --git a/gdb/testsuite/gdb.cp/static-print-quit.cc b/gdb/testsuite/gdb.cp/static-print-quit.cc
new file mode 100644 (file)
index 0000000..a62e340
--- /dev/null
@@ -0,0 +1,32 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+   Copyright 2010 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+class D
+  {
+  public:
+    int loooooooooooooooooooooooooooooooooooooooooooooong;
+  };
+
+class C
+  {
+  public:
+    int loooooooooooooooooooooooooooooooooooooooooooooong;
+    static D field;
+  };
+
+D C::field;
+C c;
diff --git a/gdb/testsuite/gdb.cp/static-print-quit.exp b/gdb/testsuite/gdb.cp/static-print-quit.exp
new file mode 100644 (file)
index 0000000..8db13ed
--- /dev/null
@@ -0,0 +1,50 @@
+# Copyright 2010 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+if { [skip_cplus_tests] } { continue }
+
+set testfile static-print-quit
+set srcfile ${testfile}.cc
+set executable $testfile.o
+set objfile ${objdir}/${subdir}/${executable}
+
+if { [gdb_compile $srcdir/$subdir/$srcfile $objfile object {debug c++}] != ""} {
+    untested ${testfile}.exp
+    return -1
+}
+
+clean_restart $executable
+
+gdb_test_no_output "set width 80"
+gdb_test_no_output "set height 2"
+
+set test "print c"
+gdb_test_multiple $test $test {
+    -re " = \{loooooooooooooooooooooooooooooooooooooooooooooong = 0, static field = \{\r\n---Type <return> to continue, or q <return> to quit---$" {
+       pass $test
+    }
+    -re " to quit---$" {
+       fail $test
+       return -1
+    }
+}
+
+gdb_test "q" ".*"
+
+# Now the obstack is uninitialized.  Excercise it.
+
+gdb_test_no_output "set pagination off"
+gdb_test "print c" ".*" "first print"
+gdb_test "print c" ".*" "second print"
This page took 0.037805 seconds and 4 git commands to generate.