]> git.pld-linux.org Git - packages/gdb.git/blob - gdb-6.5-ia64-libunwind-leak-test.patch
- NOTE: does not build with -j2
[packages/gdb.git] / 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,90 @@
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 +if $tracelevel then {
55 +    strace $tracelevel
56 +}
57 +
58 +set prms_id 0
59 +set bug_id 0
60 +
61 +set testfile unwind-leak
62 +set srcfile ${testfile}.c
63 +set shfile ${objdir}/${subdir}/${testfile}-gdb.sh
64 +set binfile ${objdir}/${subdir}/${testfile}
65 +if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
66 +    untested "Couldn't compile test program"
67 +    return -1
68 +}
69 +
70 +# Get things started.
71 +
72 +gdb_exit
73 +gdb_start
74 +gdb_reinitialize_dir $srcdir/$subdir
75 +gdb_load ${binfile}
76 +
77 +set pid [exp_pid -i [board_info host fileid]]
78 +
79 +# For C programs, "start" should stop in main().
80 +
81 +gdb_test "start" \
82 +         "main \\(\\) at .*$srcfile.*" \
83 +         "start"
84 +
85 +set loc [gdb_get_line_number "alarm"]
86 +gdb_breakpoint $loc
87 +
88 +proc memory_get {} {
89 +    global pid
90 +    set fd [open "/proc/$pid/statm"]
91 +    gets $fd line
92 +    close $fd
93 +    # number of pages of data/stack
94 +    scan $line "%*d%*d%*d%*d%*d%d" drs
95 +    return $drs
96 +}
97 +
98 +set cycles 100
99 +# For 100 cycles it was 1308: from = 363 KB, to = 1671 KB
100 +set permit_kb 100
101 +verbose -log "cycles = $cycles, permit_kb = $permit_kb"
102 +
103 +set fail 0
104 +set test "breakpoint stop/continue cycles" 
105 +for {set i $cycles} {$i > 0} {set i [expr {$i - 1}]} {
106 +    gdb_test_multiple "continue" $test {
107 +       -re "Breakpoint 2, main .*alarm .*.*${gdb_prompt} $" {
108 +       }
109 +       -re "Segmentation fault" {
110 +           fail $test
111 +           set i 0
112 +           set fail 1
113 +       }
114 +    }
115 +    if ![info exists from] {
116 +       set from [memory_get]
117 +    }
118 +}
119 +set to [memory_get]
120 +if {!$fail} {
121 +    verbose -log "from = $from KB, to = $to KB"
122 +    if {$from > 0 && $to > 10 && $to < $from + $permit_kb} {
123 +       pass $test
124 +    } else {
125 +       fail $test
126 +    }
127 +}
This page took 0.042194 seconds and 3 git commands to generate.