* 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.
This commit is contained in:
Jan Kratochvil 2010-06-28 16:59:47 +00:00
parent de6a04210c
commit 6036c74221
5 changed files with 124 additions and 24 deletions

View 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'.
@ -12,27 +17,27 @@
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>
@ -6103,7 +6108,7 @@
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>

View 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, "{");

View 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.

View File

@ -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;

View File

@ -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"