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

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