Blame SOURCES/gdb-6.5-readline-long-line-crash-test.patch

f9426a
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=214196
f9426a
f9426a
f9426a
Index: ./gdb/testsuite/gdb.base/readline-overflow.exp
f9426a
===================================================================
f9426a
RCS file: ./gdb/testsuite/gdb.base/readline-overflow.exp
f9426a
diff -N ./gdb/testsuite/gdb.base/readline-overflow.exp
f9426a
--- /dev/null	1 Jan 1970 00:00:00 -0000
f9426a
+++ ./gdb/testsuite/gdb.base/readline-overflow.exp	13 Nov 2006 23:42:50 -0000
f9426a
@@ -0,0 +1,125 @@
f9426a
+# Copyright 2006 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
+# This file was written by Jan Kratochvil <jan.kratochvil@redhat.com>
f9426a
+
f9426a
+# This file is part of the gdb testsuite.
f9426a
+
f9426a
+#
f9426a
+# Tests for readline buffer overflow.
f9426a
+#
f9426a
+
f9426a
+if $tracelevel {
f9426a
+  strace $tracelevel
f9426a
+}
f9426a
+
f9426a
+# Don't let a .inputrc file or an existing setting of INPUTRC mess up
f9426a
+# the test results.  Even if /dev/null doesn't exist on the particular
f9426a
+# platform, the readline library will use the default setting just by
f9426a
+# failing to open the file.  OTOH, opening /dev/null successfully will
f9426a
+# also result in the default settings being used since nothing will be
f9426a
+# read from this file.
f9426a
+global env
f9426a
+if [info exists env(INPUTRC)] {
f9426a
+    set old_inputrc $env(INPUTRC)
f9426a
+}
f9426a
+set env(INPUTRC) "/dev/null"
f9426a
+
f9426a
+set oldtimeout1 $timeout
f9426a
+set timeout 600
f9426a
+
f9426a
+if [info exists env(GDBHISTFILE)] {
f9426a
+    set old_gdbhistfile $env(GDBHISTFILE)
f9426a
+}
f9426a
+if [info exists env(HISTSIZE)] {
f9426a
+    set old_histsize $env(HISTSIZE)
f9426a
+}
f9426a
+set env(GDBHISTFILE) "${srcdir}/${subdir}/gdb_history"
f9426a
+set env(HISTSIZE) "10"
f9426a
+
f9426a
+gdb_exit
f9426a
+gdb_start
f9426a
+gdb_reinitialize_dir $srcdir/$subdir
f9426a
+
f9426a
+
f9426a
+set width 11
f9426a
+gdb_test "set width $width" \
f9426a
+         "" \
f9426a
+         "Setting width to $width."
f9426a
+#gdb_test "set height 1" \
f9426a
+#         "" \
f9426a
+#         "Setting height to 1."
f9426a
+send_gdb "run X"
f9426a
+set i 0
f9426a
+# It crashes using `set width 7' on `set total 3560'.
f9426a
+# Sometimes it corrupts screen on `set width 7'.
f9426a
+# Bugreport used `set total 130001':
f9426a
+# 	https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=214196
f9426a
+# Check also `timeout' above.
f9426a
+set total 4200
f9426a
+gdb_expect {
f9426a
+	-re X {
f9426a
+		incr i
f9426a
+		if {$i <= $total} {
f9426a
+			send_gdb "X"
f9426a
+			exp_continue
f9426a
+		}
f9426a
+	}
f9426a
+	-re "\[ \b\r\n\]" {
f9426a
+		exp_continue
f9426a
+	}
f9426a
+	eof {
f9426a
+		fail "gdb sending total $total characters"
f9426a
+		note "Failed after sending $i characters, reason: EOF"
f9426a
+		gdb_clear_suppressed
f9426a
+	}
f9426a
+	timeout {
f9426a
+		fail "gdb sending total $total characters"
f9426a
+		note "Failed after sending $i characters (timeout $timeout), reason: TIMEOUT"
f9426a
+		gdb_clear_suppressed
f9426a
+	}
f9426a
+	default {
f9426a
+		fail "gdb sending total $total characters"
f9426a
+		note "Failed after sending $i characters, reason: 0=\[$expect_out(0,string)\] buffer=\[$expect_out(buffer)\]"
f9426a
+		gdb_clear_suppressed
f9426a
+	}
f9426a
+}
f9426a
+gdb_test "\r" \
f9426a
+         "No executable file specified..*" \
f9426a
+         "All the characters transferred"
f9426a
+
f9426a
+
f9426a
+# Restore globals modified in this test...
f9426a
+if [info exists old_inputrc] {
f9426a
+    set env(INPUTRC) $old_inputrc
f9426a
+} else {
f9426a
+    unset env(INPUTRC)
f9426a
+}
f9426a
+if [info exists old_gdbhistfile] {
f9426a
+    set env(GDBHISTFILE) $old_gdbhistfile
f9426a
+} else {
f9426a
+    unset env(GDBHISTFILE)
f9426a
+}
f9426a
+if [info exists old_histsize] {
f9426a
+    set env(HISTSIZE) $old_histsize
f9426a
+} else {
f9426a
+    unset env(HISTSIZE)
f9426a
+}
f9426a
+set timeout $oldtimeout1
f9426a
+
f9426a
+return 0