mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-23 03:29:47 +08:00
gdb: Only run scheduler-locking tests if feature is supported
Not all targets support scheduler-locking. Add a check to see if the taraget supports scheduler locking, and if it doesn't, don't run the scheduler-locking tests that will otherwise fail. There are actually a set of tests that try to use scheduler-locking however, in most of these cases the test will not be run on smaller targets (those that might not support threads and scheduler-locking) due to the targets lack of support for threads, or some other larger feature. In the gdb.mi/mi-cmd-param-changed.exp test though, there's no dependence on threads, or any other larger feature, and so, for the small target I was using the test would otherwise try to run, only to fail due to lack of support for scheduler-locking. gdb/testsuite/ChangeLog: * lib/gdb.exp (target_supports_scheduler_locking): New proc. * gdb.mi/mi-cmd-param-changed.exp: Only run scheduler locking tests if the target supports scheduler locking.
This commit is contained in:
@ -1,3 +1,9 @@
|
||||
2018-08-06 Andrew Burgess <andrew.burgess@embecosm.com>
|
||||
|
||||
* lib/gdb.exp (target_supports_scheduler_locking): New proc.
|
||||
* gdb.mi/mi-cmd-param-changed.exp: Only run scheduler locking
|
||||
tests if the target supports scheduler locking.
|
||||
|
||||
2018-08-04 Tom de Vries <tdevries@suse.de>
|
||||
|
||||
* gdb.python/py-rbreak.exp: Fix rbreak regexp.
|
||||
|
@ -13,6 +13,9 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Do this here before we start GDB for the test.
|
||||
set scheduler_locking_supported [target_supports_scheduler_locking]
|
||||
|
||||
load_lib mi-support.exp
|
||||
set MIFLAGS "-i=mi"
|
||||
|
||||
@ -24,37 +27,40 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
|
||||
}
|
||||
|
||||
proc test_command_param_changed { } {
|
||||
global scheduler_locking_supported
|
||||
|
||||
with_test_prefix "cmd param" {
|
||||
if [mi_gdb_start] {
|
||||
return
|
||||
}
|
||||
mi_run_to_main
|
||||
|
||||
foreach opt { "on" "off" "step" } {
|
||||
mi_gdb_test "set scheduler-locking ${opt}" \
|
||||
".*=cmd-param-changed,param=\"scheduler-locking\",value=\"${opt}\".*\\^done" \
|
||||
"\"set scheduler-locking ${opt}\""
|
||||
if { $scheduler_locking_supported } {
|
||||
foreach opt { "on" "off" "step" } {
|
||||
mi_gdb_test "set scheduler-locking ${opt}" \
|
||||
".*=cmd-param-changed,param=\"scheduler-locking\",value=\"${opt}\".*\\^done" \
|
||||
"\"set scheduler-locking ${opt}\""
|
||||
}
|
||||
foreach opt { "on" "off" "step" } {
|
||||
mi_gdb_test "interpreter-exec console \"set scheduler-locking ${opt}\"" \
|
||||
".*=cmd-param-changed,param=\"scheduler-locking\",value=\"${opt}\".*\\^done" \
|
||||
"interpreter-exec \"set scheduler-locking ${opt}\""
|
||||
}
|
||||
# Don't emit MI notification for request from MI.
|
||||
mi_gdb_test "-gdb-set scheduler-locking on" \
|
||||
{\^done} \
|
||||
"\"set scheduler-locking on\" no event (requested by MI)"
|
||||
mi_gdb_test "interpreter-exec mi \"-gdb-set scheduler-locking step\"" \
|
||||
"\\&\"interpreter-exec mi .*\"-gdb-set scheduler-locking step.*\"\\\\n\"\r\n\\^done\r\n\\^done" \
|
||||
"\"set scheduler-locking step\" no event (requested by MI interp)"
|
||||
mi_gdb_test "set scheduler-locking step" \
|
||||
"\\&\"set scheduler-locking step\\\\n\"\r\n\\^done" \
|
||||
"\"set scheduler-locking stepr\" no event"
|
||||
}
|
||||
foreach opt { "on" "off" "step" } {
|
||||
mi_gdb_test "interpreter-exec console \"set scheduler-locking ${opt}\"" \
|
||||
".*=cmd-param-changed,param=\"scheduler-locking\",value=\"${opt}\".*\\^done" \
|
||||
"interpreter-exec \"set scheduler-locking ${opt}\""
|
||||
}
|
||||
# Don't emit MI notification for request from MI.
|
||||
mi_gdb_test "-gdb-set scheduler-locking on" \
|
||||
{\^done} \
|
||||
"\"set scheduler-locking on\" no event (requested by MI)"
|
||||
|
||||
mi_gdb_test "-exec-arguments foo" {\^done} \
|
||||
"\"-exec-arguments foo\" no event"
|
||||
|
||||
mi_gdb_test "interpreter-exec mi \"-gdb-set scheduler-locking step\"" \
|
||||
"\\&\"interpreter-exec mi .*\"-gdb-set scheduler-locking step.*\"\\\\n\"\r\n\\^done\r\n\\^done" \
|
||||
"\"set scheduler-locking step\" no event (requested by MI interp)"
|
||||
mi_gdb_test "set scheduler-locking step" \
|
||||
"\\&\"set scheduler-locking step\\\\n\"\r\n\\^done" \
|
||||
"\"set scheduler-locking stepr\" no event"
|
||||
|
||||
|
||||
foreach command { "remotecache" "check type" } {
|
||||
|
||||
# The default value of each command option may be different, so we first
|
||||
|
@ -6053,6 +6053,76 @@ gdb_caching_proc gdb_target_symbol_prefix {
|
||||
return $prefix
|
||||
}
|
||||
|
||||
# Return 1 if target supports scheduler locking, otherwise return 0.
|
||||
|
||||
gdb_caching_proc target_supports_scheduler_locking {
|
||||
global gdb_prompt
|
||||
|
||||
set me "gdb_target_supports_scheduler_locking"
|
||||
|
||||
set src [standard_temp_file has_schedlock[pid].c]
|
||||
set exe [standard_temp_file has_schedlock[pid].x]
|
||||
|
||||
gdb_produce_source $src {
|
||||
int main () {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
verbose "$me: compiling testfile $src" 2
|
||||
set compile_flags {debug nowarnings}
|
||||
set lines [gdb_compile $src $exe executable $compile_flags]
|
||||
file delete $src
|
||||
|
||||
if ![string match "" $lines] then {
|
||||
verbose "$me: testfile compilation failed, returning 0" 2
|
||||
return 0
|
||||
}
|
||||
|
||||
clean_restart $exe
|
||||
gdb_start_cmd
|
||||
|
||||
set supports_schedule_locking -1
|
||||
set current_schedule_locking_mode ""
|
||||
|
||||
set test "reading current scheduler-locking mode"
|
||||
gdb_test_multiple "show scheduler-locking" $test {
|
||||
-re "Mode for locking scheduler during execution is \"(\[\^\"\]*)\".*$gdb_prompt" {
|
||||
set current_schedule_locking_mode $expect_out(1,string)
|
||||
}
|
||||
-re "$gdb_prompt $" {
|
||||
set supports_schedule_locking 0
|
||||
}
|
||||
timeout {
|
||||
set supports_schedule_locking 0
|
||||
}
|
||||
}
|
||||
|
||||
if { $supports_schedule_locking == -1 } {
|
||||
set test "checking for scheduler-locking support"
|
||||
gdb_test_multiple "set scheduler-locking $current_schedule_locking_mode" $test {
|
||||
-re "Target '\[^'\]+' cannot support this command\..*$gdb_prompt $" {
|
||||
set supports_schedule_locking 0
|
||||
}
|
||||
-re "$gdb_prompt $" {
|
||||
set supports_schedule_locking 1
|
||||
}
|
||||
timeout {
|
||||
set supports_schedule_locking 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if { $supports_schedule_locking == -1 } {
|
||||
set supports_schedule_locking 0
|
||||
}
|
||||
|
||||
gdb_exit
|
||||
remote_file build delete $exe
|
||||
verbose "$me: returning $supports_schedule_locking" 2
|
||||
return $supports_schedule_locking
|
||||
}
|
||||
|
||||
# gdb_target_symbol returns the provided symbol with the correct prefix
|
||||
# prepended. (See gdb_target_symbol_prefix, above.)
|
||||
|
||||
|
Reference in New Issue
Block a user