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

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