Re: [PATCH] Fix PR 17206

Yao Qi
2014-07-28T13:37:00Z

On 07/28/2014 08:37 PM, Pedro Alves wrote:
> This looks right, but, could we add a test to the test suite?

Sure, how about the test below? Without the fix, I get the fail

FAIL: gdb.base/until-range-step.exp: until 2 (GDB internal error)

on x86-linux and arm-none-eabi. With the fix applied, the fail goes
away. I am not sure the test case name is good or clear enough.
Maybe we can rename it to pr17206.exp or something else.

--
Yao (é½å°§)

gdb/testsuite:

2014-07-28 Yao Qi <yao@codesourcery.com>

PR gdb/17206
* gdb.base/until-range-step.exp: New.
---
gdb/testsuite/gdb.base/until-range-step.exp | 37 +++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
create mode 100644 gdb/testsuite/gdb.base/until-range-step.exp

diff --git a/gdb/testsuite/gdb.base/until-range-step.exp b/gdb/testsuite/gdb.base/until-range-step.exp
new file mode 100644
index 0000000..a7e75e2
--- /dev/null
+++ b/gdb/testsuite/gdb.base/until-range-step.exp
@@ -0,0 +1,37 @@
+# Copyright 2014 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/>. */
+
+# Test that the address range for stepping is correctly set in command
+# until when there is no debug information.
+
+standard_testfile advance.c
+
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile nodebug]} {
+ return -1
+}
+
+if ![runto_main] {
+ fail "Can't run to main"
+ return 0
+}
+
+# Without debug information, the program stops at the next
+# instruction, which is still in main.
+gdb_test "until" "in main .*" "until 1"
+
+# If the stepping range is correctly set, the program stops at the next
+# instruction. Otherwise, an internal error will be triggered. See
+# PR gdb/17206.
+gdb_test "until" "in main .*" "until 2"
--
1.9.0