[patch] testsuite: Test readline-6.2 "ask" regression

Jan Kratochvil jan.kratochvil@redhat.com
Sun May 1 11:17:00 GMT 2011


Hi,

this problem does not affect default FSF GDB build as it is using bundled
readline-5.1.  But with system readline-6.2 and build using:
  --with-system-readline  use installed readline library

GDB will no longer ask about displaying too many symbols and dumps them all
immediately.
PASS:
	$ gdb gdb
	(gdb) p <tab><tab>
	Display all 21482 possibilities? (y or n)_
FAIL:
	$ gdb gdb
	(gdb) p <tab><tab>
	Display all 22129 possibilities? (y or n)
	../../bfd/aout-target.h                                      cs_to_section
	../../bfd/aout32.c                                           ctime
	<screens and screens of dumps without any question>

This regression will soon start affecting distros:
	FSF GDB HEAD  - PASS - using bundled readline-5.1
	fedora-15     - FAIL - using system  readline-6.2
	fedora-14     - PASS - using system  readline-6.1
	debian-6.0    - PASS - using system  readline-6.1
	kubuntu-10.10 - PASS - using system  readline-6.1

I have asked about it on readline ml:
	Re: [Bug-readline] callback mode pager disable status
	https://lists.gnu.org/archive/html/bug-readline/2011-04/msg00012.html
The suggested workaround (in fact the readline-5.1 code state) going to patch
into the proposed FSF GDB bundled readline-6.2.  Distros then can stop using
--with-system-readline to still feature recent and system matching readline
until readline-7.0 gets released.

This regression has been so far caught only with system debug infos installed:
	-PASS: gdb.base/completion.exp: complete (2) 'p no_var_named_this-'
	-PASS: gdb.base/completion.exp: complete 'p values[0].a'
	-PASS: gdb.base/completion.exp: complete 'p values[0] . a'
	-PASS: gdb.base/completion.exp: complete 'p &values[0] -> a'
	-PASS: gdb.base/completion.exp: copmletion of field in anonymous union
	+FAIL: gdb.base/completion.exp: (timeout) complete (2) 'p no_var_named_this-'
	+FAIL: gdb.base/completion.exp: (timeout) complete 'p values[0].a' 2
	+FAIL: gdb.base/completion.exp: (timeout) complete 'p values[0] . a' 2
	+FAIL: gdb.base/completion.exp: (timeout) complete 'p &values[0] -> a' 2
	+FAIL: gdb.base/completion.exp: copmletion of field in anonymous union

I will check it in with no comments.


Thanks,
Jan


gdb/testsuite/
2011-05-01  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* gdb.base/readline-ask.c: New file.
	* gdb.base/readline-ask.exp: New file.
	* gdb.base/readline-ask.inputrc: New file.

--- /dev/null
+++ b/gdb/testsuite/gdb.base/readline-ask.c
@@ -0,0 +1,23 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+   Copyright 2011 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+int
+symbol_01_length_40_____________________,
+symbol_02_length_40_____________________,
+symbol_03_length_40_____________________,
+symbol_04_length_40_____________________,
+symbol_10_length_40_____________________;
--- /dev/null
+++ b/gdb/testsuite/gdb.base/readline-ask.exp
@@ -0,0 +1,118 @@
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+set testfile readline-ask
+set executable ${testfile}.x
+set srcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${executable}
+set inputrc ${srcdir}/${subdir}/${testfile}.inputrc
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" object {debug}] != "" } {
+    untested ${testfile}.exp
+    return -1
+}
+
+# INPUTRC gets reset for the next testfile.
+setenv INPUTRC $inputrc
+clean_restart ${executable}
+
+gdb_test_no_output "set width 50"
+gdb_test_no_output "set height 3"
+
+set cmd "p symbol_0"
+send_gdb "$cmd\t"
+set test "bell for more message"
+gdb_test_multiple "" $test {
+    -re "$cmd\007$" {
+	pass $test
+    }
+}
+
+send_gdb "\t"
+set test "more message for 01 and 02"
+gdb_test_multiple "" $test {
+    -re "^\r\nsymbol_01_length_40_____________________\r\nsymbol_02_length_40_____________________\r\n--More--$" {
+	pass $test
+    }
+    -re "$gdb_prompt " {
+	fail $test
+    }
+}
+
+# There get some VT100 characters printed.
+
+send_gdb "\r"
+set test "more message for 03"
+gdb_test_multiple "" $test {
+    -re "\rsymbol_03_length_40_____________________\r\n--More--$" {
+	pass $test
+    }
+}
+
+# "$gdb_prompt $" will not match as $cmd gets output: $gdb_prompt p symbol_0
+# And "$gdb_prompt p symbol_0" cannot be matched as the default "$gdb_prompt $"
+# string from gdb_test_multiple could match earlier.
+
+send_gdb "\r"
+set test "more finish for 04"
+gdb_test_multiple "" $test {
+    -re "\rsymbol_04_length_40_____________________\r\n$gdb_prompt " {
+	pass $test
+    }
+}
+
+gdb_test "foo" {No symbol "symbol_0foo" in current context\.} "abort more message"
+
+set cmd "p symbol_"
+send_gdb "$cmd\t"
+set test "bell for ask message"
+gdb_test_multiple "" $test {
+    -re "$cmd\007$" {
+	pass $test
+    }
+}
+
+send_gdb "\t"
+set test "ask message"
+gdb_test_multiple "" $test {
+    -re "^\r\nDisplay all 5 possibilities\\? \\(y or n\\)$" {
+	pass $test
+    }
+    -re "$gdb_prompt " {
+	fail $test
+	return 0
+    }
+}
+
+send_gdb "y"
+set test "ask message for 01 and 02"
+gdb_test_multiple "" $test {
+    -re "^\r\nsymbol_01_length_40_____________________\r\nsymbol_02_length_40_____________________\r\n--More--$" {
+	pass $test
+    }
+}
+
+# There get some VT100 characters printed.
+# See the "$gdb_prompt " match like in "more finish for 04".
+
+send_gdb "n"
+set test "ask message no"
+gdb_test_multiple "" $test {
+    -re "\r$gdb_prompt " {
+	pass $test
+    }
+}
+
+gdb_test "foo" {No symbol "symbol_foo" in current context\.} "abort ask message"
--- /dev/null
+++ b/gdb/testsuite/gdb.base/readline-ask.inputrc
@@ -0,0 +1,16 @@
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+set completion-query-items 5



More information about the Gdb-patches mailing list