Blame SOURCES/gdb-6.5-ia64-libunwind-leak-test.patch

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