forked from Imagelibrary/binutils-gdb
Clang doesn't use CFA information for variable locations. This makes it so software breakpoints get a false hit when rbp gets popped, causing a FAIL in gdb.python/py-watchpoint.exp. Since this is nothing wrong with GDB itself, add an xfail to reduce noise. Approved-By: Tom Tromey <tom@tromey.com>
62 lines
2.2 KiB
Plaintext
62 lines
2.2 KiB
Plaintext
# Copyright (C) 2022-2023 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/>.
|
|
|
|
# Check that Watchpoints are deleted after use.
|
|
|
|
load_lib gdb-python.exp
|
|
|
|
standard_testfile
|
|
|
|
if {[prepare_for_testing "failed to prepare" $testfile $srcfile]} {
|
|
return -1
|
|
}
|
|
|
|
require allow_python_tests
|
|
|
|
if ![runto_main] then {
|
|
return
|
|
}
|
|
|
|
# For remote host testing
|
|
set pyfile [gdb_remote_download host ${srcdir}/${subdir}/${testfile}.py]
|
|
|
|
gdb_test_no_output "set can-use-hw-watchpoints 0" "don't use hardware watchpoints"
|
|
set for_line_no [gdb_get_line_number "main for"]
|
|
gdb_test "break $for_line_no" ".*" "set breakpoint before loop"
|
|
gdb_test "continue" ".*" "run until reaching loop"
|
|
gdb_test "clear" ".*" "delete the breakpoint before loop"
|
|
gdb_test "python print(len(gdb.breakpoints()))" "1" "check default BP count"
|
|
gdb_test "source $pyfile" ".*Python script imported.*" \
|
|
"import python scripts"
|
|
gdb_test "python print(len(gdb.breakpoints()))" "2" "check modified BP count"
|
|
gdb_test "continue" ".*" "run until program stops"
|
|
# Clang doesn't use CFA location information for variables (despite generating
|
|
# them), meaning when the instruction "pop rbp" happens, we get a false hit
|
|
# on the watchpoint. for more details, see:
|
|
# https://github.com/llvm/llvm-project/issues/64390
|
|
gdb_test_multiple "python print(bpt.n)" "check watchpoint hits" {
|
|
-re -wrap "5" {
|
|
pass $gdb_test_name
|
|
}
|
|
-re -wrap "6" {
|
|
if {[test_compiler_info "clang-*"]} {
|
|
xfail "$gdb_test_name (clang issue 64390)"
|
|
} else {
|
|
fail $gdb_test_name
|
|
}
|
|
}
|
|
}
|
|
gdb_test "python print(len(gdb.breakpoints()))" "1" "check BP count"
|