]> git.pld-linux.org Git - packages/gdb.git/blame - gdb-6.5-readline-long-line-crash-test.patch
- obsolete file
[packages/gdb.git] / gdb-6.5-readline-long-line-crash-test.patch
CommitLineData
3a58abaf
AM
1https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=214196
2
3
4Index: ./gdb/testsuite/gdb.base/readline-overflow.exp
5===================================================================
6RCS file: ./gdb/testsuite/gdb.base/readline-overflow.exp
7diff -N ./gdb/testsuite/gdb.base/readline-overflow.exp
8--- /dev/null 1 Jan 1970 00:00:00 -0000
9+++ ./gdb/testsuite/gdb.base/readline-overflow.exp 13 Nov 2006 23:42:50 -0000
10@@ -0,0 +1,125 @@
11+# Copyright 2006 Free Software Foundation, Inc.
12+
13+# This program is free software; you can redistribute it and/or modify
14+# it under the terms of the GNU General Public License as published by
15+# the Free Software Foundation; either version 2 of the License, or
16+# (at your option) any later version.
17+#
18+# This program is distributed in the hope that it will be useful,
19+# but WITHOUT ANY WARRANTY; without even the implied warranty of
20+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21+# GNU General Public License for more details.
22+#
23+# You should have received a copy of the GNU General Public License
24+# along with this program; if not, write to the Free Software
25+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26+
27+# Please email any bugs, comments, and/or additions to this file to:
28+# bug-gdb@prep.ai.mit.edu
29+
30+# This file was written by Jan Kratochvil <jan.kratochvil@redhat.com>
31+
32+# This file is part of the gdb testsuite.
33+
34+#
35+# Tests for readline buffer overflow.
36+#
37+
38+if $tracelevel {
39+ strace $tracelevel
40+}
41+
42+# Don't let a .inputrc file or an existing setting of INPUTRC mess up
43+# the test results. Even if /dev/null doesn't exist on the particular
44+# platform, the readline library will use the default setting just by
45+# failing to open the file. OTOH, opening /dev/null successfully will
46+# also result in the default settings being used since nothing will be
47+# read from this file.
48+global env
49+if [info exists env(INPUTRC)] {
50+ set old_inputrc $env(INPUTRC)
51+}
52+set env(INPUTRC) "/dev/null"
53+
54+set oldtimeout1 $timeout
55+set timeout 600
56+
57+if [info exists env(GDBHISTFILE)] {
58+ set old_gdbhistfile $env(GDBHISTFILE)
59+}
60+if [info exists env(HISTSIZE)] {
61+ set old_histsize $env(HISTSIZE)
62+}
63+set env(GDBHISTFILE) "${srcdir}/${subdir}/gdb_history"
64+set env(HISTSIZE) "10"
65+
66+gdb_exit
67+gdb_start
68+gdb_reinitialize_dir $srcdir/$subdir
69+
70+
71+set width 11
72+gdb_test "set width $width" \
73+ "" \
74+ "Setting width to $width."
75+#gdb_test "set height 1" \
76+# "" \
77+# "Setting height to 1."
78+send_gdb "run X"
79+set i 0
80+# It crashes using `set width 7' on `set total 3560'.
81+# Sometimes it corrupts screen on `set width 7'.
82+# Bugreport used `set total 130001':
83+# https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=214196
84+# Check also `timeout' above.
85+set total 4200
86+gdb_expect {
87+ -re X {
88+ incr i
89+ if {$i <= $total} {
90+ send_gdb "X"
91+ exp_continue
92+ }
93+ }
94+ -re "\[ \b\r\n\]" {
95+ exp_continue
96+ }
97+ eof {
98+ fail "gdb sending total $total characters"
99+ note "Failed after sending $i characters, reason: EOF"
100+ gdb_clear_suppressed
101+ }
102+ timeout {
103+ fail "gdb sending total $total characters"
104+ note "Failed after sending $i characters (timeout $timeout), reason: TIMEOUT"
105+ gdb_clear_suppressed
106+ }
107+ default {
108+ fail "gdb sending total $total characters"
109+ note "Failed after sending $i characters, reason: 0=\[$expect_out(0,string)\] buffer=\[$expect_out(buffer)\]"
110+ gdb_clear_suppressed
111+ }
112+}
113+gdb_test "\r" \
114+ "No executable file specified..*" \
115+ "All the characters transferred"
116+
117+
118+# Restore globals modified in this test...
119+if [info exists old_inputrc] {
120+ set env(INPUTRC) $old_inputrc
121+} else {
122+ unset env(INPUTRC)
123+}
124+if [info exists old_gdbhistfile] {
125+ set env(GDBHISTFILE) $old_gdbhistfile
126+} else {
127+ unset env(GDBHISTFILE)
128+}
129+if [info exists old_histsize] {
130+ set env(HISTSIZE) $old_histsize
131+} else {
132+ unset env(HISTSIZE)
133+}
134+set timeout $oldtimeout1
135+
136+return 0
This page took 0.474379 seconds and 4 git commands to generate.