]> git.ipfire.org Git - people/amarx/ipfire-3.x.git/blob - gdb/patches/gdb-6.5-ia64-libunwind-leak-test.patch
gdb: Update to 7.3.50.20110722.
[people/amarx/ipfire-3.x.git] / gdb / patches / gdb-6.5-ia64-libunwind-leak-test.patch
1 diff -u -rup gdb-6.3-orig/gdb/testsuite/gdb.base/unwind-leak.c gdb-6.3/gdb/testsuite/gdb.base/unwind-leak.c
2 --- gdb-6.3-orig/gdb/testsuite/gdb.base/unwind-leak.c 2007-12-19 15:12:55.000000000 -0500
3 +++ gdb-6.3/gdb/testsuite/gdb.base/unwind-leak.c 2007-12-19 13:55:22.000000000 -0500
4 @@ -0,0 +1,29 @@
5 +/* This testcase is part of GDB, the GNU debugger.
6 +
7 + Copyright 2007 Free Software Foundation, Inc.
8 +
9 + This program is free software; you can redistribute it and/or modify
10 + it under the terms of the GNU General Public License as published by
11 + the Free Software Foundation; either version 2 of the License, or
12 + (at your option) any later version.
13 +
14 + This program is distributed in the hope that it will be useful,
15 + but WITHOUT ANY WARRANTY; without even the implied warranty of
16 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 + GNU General Public License for more details.
18 +
19 + You should have received a copy of the GNU General Public License
20 + along with this program; if not, write to the Free Software
21 + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 +
23 + Please email any bugs, comments, and/or additions to this file to:
24 + bug-gdb@prep.ai.mit.edu */
25 +
26 +#include <unistd.h>
27 +
28 +int main()
29 +{
30 + for (;;)
31 + alarm (0);
32 + return 0;
33 +}
34 diff -u -rup gdb-6.3-orig/gdb/testsuite/gdb.base/unwind-leak.exp gdb-6.3/gdb/testsuite/gdb.base/unwind-leak.exp
35 --- gdb-6.3-orig/gdb/testsuite/gdb.base/unwind-leak.exp 2007-12-19 15:12:53.000000000 -0500
36 +++ gdb-6.3/gdb/testsuite/gdb.base/unwind-leak.exp 2007-12-19 15:11:35.000000000 -0500
37 @@ -0,0 +1,83 @@
38 +# Copyright 2007 Free Software Foundation, Inc.
39 +
40 +# This program is free software; you can redistribute it and/or modify
41 +# it under the terms of the GNU General Public License as published by
42 +# the Free Software Foundation; either version 2 of the License, or
43 +# (at your option) any later version.
44 +#
45 +# This program is distributed in the hope that it will be useful,
46 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
47 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
48 +# GNU General Public License for more details.
49 +#
50 +# You should have received a copy of the GNU General Public License
51 +# along with this program; if not, write to the Free Software
52 +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
53 +
54 +set testfile unwind-leak
55 +set srcfile ${testfile}.c
56 +set shfile ${objdir}/${subdir}/${testfile}-gdb.sh
57 +set binfile ${objdir}/${subdir}/${testfile}
58 +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
59 + untested "Couldn't compile test program"
60 + return -1
61 +}
62 +
63 +# Get things started.
64 +
65 +gdb_exit
66 +gdb_start
67 +gdb_reinitialize_dir $srcdir/$subdir
68 +gdb_load ${binfile}
69 +
70 +set pid [exp_pid -i [board_info host fileid]]
71 +
72 +# For C programs, "start" should stop in main().
73 +
74 +gdb_test "start" \
75 + "main \\(\\) at .*$srcfile.*" \
76 + "start"
77 +
78 +set loc [gdb_get_line_number "alarm"]
79 +gdb_breakpoint $loc
80 +
81 +proc memory_get {} {
82 + global pid
83 + set fd [open "/proc/$pid/statm"]
84 + gets $fd line
85 + close $fd
86 + # number of pages of data/stack
87 + scan $line "%*d%*d%*d%*d%*d%d" drs
88 + return $drs
89 +}
90 +
91 +set cycles 100
92 +# For 100 cycles it was 1308: from = 363 KB, to = 1671 KB
93 +set permit_kb 100
94 +verbose -log "cycles = $cycles, permit_kb = $permit_kb"
95 +
96 +set fail 0
97 +set test "breakpoint stop/continue cycles"
98 +for {set i $cycles} {$i > 0} {set i [expr {$i - 1}]} {
99 + gdb_test_multiple "continue" $test {
100 + -re "Breakpoint 2, main .*alarm .*.*${gdb_prompt} $" {
101 + }
102 + -re "Segmentation fault" {
103 + fail $test
104 + set i 0
105 + set fail 1
106 + }
107 + }
108 + if ![info exists from] {
109 + set from [memory_get]
110 + }
111 +}
112 +set to [memory_get]
113 +if {!$fail} {
114 + verbose -log "from = $from KB, to = $to KB"
115 + if {$from > 0 && $to > 10 && $to < $from + $permit_kb} {
116 + pass $test
117 + } else {
118 + fail $test
119 + }
120 +}