|
|
861f93 |
diff -u -rup gdb-6.3-orig/gdb/testsuite/gdb.base/unwind-leak.c gdb-6.3/gdb/testsuite/gdb.base/unwind-leak.c
|
|
|
861f93 |
--- gdb-6.3-orig/gdb/testsuite/gdb.base/unwind-leak.c 2007-12-19 15:12:55.000000000 -0500
|
|
|
861f93 |
+++ gdb-6.3/gdb/testsuite/gdb.base/unwind-leak.c 2007-12-19 13:55:22.000000000 -0500
|
|
|
861f93 |
@@ -0,0 +1,29 @@
|
|
|
861f93 |
+/* This testcase is part of GDB, the GNU debugger.
|
|
|
861f93 |
+
|
|
|
861f93 |
+ Copyright 2007 Free Software Foundation, Inc.
|
|
|
861f93 |
+
|
|
|
861f93 |
+ This program is free software; you can redistribute it and/or modify
|
|
|
861f93 |
+ it under the terms of the GNU General Public License as published by
|
|
|
861f93 |
+ the Free Software Foundation; either version 2 of the License, or
|
|
|
861f93 |
+ (at your option) any later version.
|
|
|
861f93 |
+
|
|
|
861f93 |
+ This program is distributed in the hope that it will be useful,
|
|
|
861f93 |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
861f93 |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
861f93 |
+ GNU General Public License for more details.
|
|
|
861f93 |
+
|
|
|
861f93 |
+ You should have received a copy of the GNU General Public License
|
|
|
861f93 |
+ along with this program; if not, write to the Free Software
|
|
|
861f93 |
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
861f93 |
+
|
|
|
861f93 |
+ Please email any bugs, comments, and/or additions to this file to:
|
|
|
861f93 |
+ bug-gdb@prep.ai.mit.edu */
|
|
|
861f93 |
+
|
|
|
861f93 |
+#include <unistd.h>
|
|
|
861f93 |
+
|
|
|
861f93 |
+int main()
|
|
|
861f93 |
+{
|
|
|
861f93 |
+ for (;;)
|
|
|
861f93 |
+ alarm (0);
|
|
|
861f93 |
+ return 0;
|
|
|
861f93 |
+}
|
|
|
861f93 |
diff -u -rup gdb-6.3-orig/gdb/testsuite/gdb.base/unwind-leak.exp gdb-6.3/gdb/testsuite/gdb.base/unwind-leak.exp
|
|
|
861f93 |
--- gdb-6.3-orig/gdb/testsuite/gdb.base/unwind-leak.exp 2007-12-19 15:12:53.000000000 -0500
|
|
|
861f93 |
+++ gdb-6.3/gdb/testsuite/gdb.base/unwind-leak.exp 2007-12-19 15:11:35.000000000 -0500
|
|
|
861f93 |
@@ -0,0 +1,83 @@
|
|
|
861f93 |
+# Copyright 2007 Free Software Foundation, Inc.
|
|
|
861f93 |
+
|
|
|
861f93 |
+# This program is free software; you can redistribute it and/or modify
|
|
|
861f93 |
+# it under the terms of the GNU General Public License as published by
|
|
|
861f93 |
+# the Free Software Foundation; either version 2 of the License, or
|
|
|
861f93 |
+# (at your option) any later version.
|
|
|
861f93 |
+#
|
|
|
861f93 |
+# This program is distributed in the hope that it will be useful,
|
|
|
861f93 |
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
861f93 |
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
861f93 |
+# GNU General Public License for more details.
|
|
|
861f93 |
+#
|
|
|
861f93 |
+# You should have received a copy of the GNU General Public License
|
|
|
861f93 |
+# along with this program; if not, write to the Free Software
|
|
|
861f93 |
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
861f93 |
+
|
|
|
861f93 |
+set testfile unwind-leak
|
|
|
861f93 |
+set srcfile ${testfile}.c
|
|
|
861f93 |
+set shfile ${objdir}/${subdir}/${testfile}-gdb.sh
|
|
|
861f93 |
+set binfile ${objdir}/${subdir}/${testfile}
|
|
|
861f93 |
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
|
|
|
861f93 |
+ untested "Couldn't compile test program"
|
|
|
861f93 |
+ return -1
|
|
|
861f93 |
+}
|
|
|
861f93 |
+
|
|
|
861f93 |
+# Get things started.
|
|
|
861f93 |
+
|
|
|
861f93 |
+gdb_exit
|
|
|
861f93 |
+gdb_start
|
|
|
861f93 |
+gdb_reinitialize_dir $srcdir/$subdir
|
|
|
861f93 |
+gdb_load ${binfile}
|
|
|
861f93 |
+
|
|
|
861f93 |
+set pid [exp_pid -i [board_info host fileid]]
|
|
|
861f93 |
+
|
|
|
861f93 |
+# For C programs, "start" should stop in main().
|
|
|
861f93 |
+
|
|
|
861f93 |
+gdb_test "start" \
|
|
|
861f93 |
+ "main \\(\\) at .*$srcfile.*" \
|
|
|
861f93 |
+ "start"
|
|
|
861f93 |
+
|
|
|
861f93 |
+set loc [gdb_get_line_number "alarm"]
|
|
|
861f93 |
+gdb_breakpoint $loc
|
|
|
861f93 |
+
|
|
|
861f93 |
+proc memory_get {} {
|
|
|
861f93 |
+ global pid
|
|
|
861f93 |
+ set fd [open "/proc/$pid/statm"]
|
|
|
861f93 |
+ gets $fd line
|
|
|
861f93 |
+ close $fd
|
|
|
861f93 |
+ # number of pages of data/stack
|
|
|
861f93 |
+ scan $line "%*d%*d%*d%*d%*d%d" drs
|
|
|
861f93 |
+ return $drs
|
|
|
861f93 |
+}
|
|
|
861f93 |
+
|
|
|
861f93 |
+set cycles 100
|
|
|
861f93 |
+# For 100 cycles it was 1308: from = 363 KB, to = 1671 KB
|
|
|
861f93 |
+set permit_kb 100
|
|
|
861f93 |
+verbose -log "cycles = $cycles, permit_kb = $permit_kb"
|
|
|
861f93 |
+
|
|
|
861f93 |
+set fail 0
|
|
|
861f93 |
+set test "breakpoint stop/continue cycles"
|
|
|
861f93 |
+for {set i $cycles} {$i > 0} {set i [expr {$i - 1}]} {
|
|
|
861f93 |
+ gdb_test_multiple "continue" $test {
|
|
|
861f93 |
+ -re "Breakpoint 2, main .*alarm .*.*${gdb_prompt} $" {
|
|
|
861f93 |
+ }
|
|
|
861f93 |
+ -re "Segmentation fault" {
|
|
|
861f93 |
+ fail $test
|
|
|
861f93 |
+ set i 0
|
|
|
861f93 |
+ set fail 1
|
|
|
861f93 |
+ }
|
|
|
861f93 |
+ }
|
|
|
861f93 |
+ if ![info exists from] {
|
|
|
861f93 |
+ set from [memory_get]
|
|
|
861f93 |
+ }
|
|
|
861f93 |
+}
|
|
|
861f93 |
+set to [memory_get]
|
|
|
861f93 |
+if {!$fail} {
|
|
|
861f93 |
+ verbose -log "from = $from KB, to = $to KB"
|
|
|
861f93 |
+ if {$from > 0 && $to > 10 && $to < $from + $permit_kb} {
|
|
|
861f93 |
+ pass $test
|
|
|
861f93 |
+ } else {
|
|
|
861f93 |
+ fail $test
|
|
|
861f93 |
+ }
|
|
|
861f93 |
+}
|