From a1c3ad9cd8905677453052bee9792e0ee54d5eba Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Fri, 10 Sep 2021 17:16:48 +0200 Subject: [PATCH] [gdb/testsuite] Fix DUPLICATE in gdb.base/skip-solib.exp Fix DUPLICATE in gdb.base/skip-solib.exp by using with_test_prefix. Also fix indentation style and long lines, remove outdated question/answer bits, and use multi_line. --- gdb/testsuite/gdb.base/skip-solib.exp | 104 ++++++++++++-------------- 1 file changed, 49 insertions(+), 55 deletions(-) diff --git a/gdb/testsuite/gdb.base/skip-solib.exp b/gdb/testsuite/gdb.base/skip-solib.exp index 22c8ee06850..a66272aeffb 100644 --- a/gdb/testsuite/gdb.base/skip-solib.exp +++ b/gdb/testsuite/gdb.base/skip-solib.exp @@ -20,7 +20,8 @@ # # This only works on GNU/Linux. -if { ![isnative] || [is_remote host] || ![istarget *-linux*] || [skip_shlib_tests]} { +if { ![isnative] || [is_remote host] || ![istarget *-linux*] + || [skip_shlib_tests]} { continue } @@ -39,82 +40,75 @@ set binfile_lib [standard_output_file ${libname}.so] # the main program. # -if {[gdb_compile_shlib ${srcdir}/${subdir}/${srcfile_lib} ${binfile_lib} [list debug -Wl,-soname,${libname}.so]] != ""} { +if {[gdb_compile_shlib ${srcdir}/${subdir}/${srcfile_lib} ${binfile_lib} \ + [list debug -Wl,-soname,${libname}.so]] != ""} { return -1 } -if {[gdb_compile "${srcdir}/${subdir}/${srcfile_main}" "${binfile_main}.o" object debug] != ""} { +if {[gdb_compile "${srcdir}/${subdir}/${srcfile_main}" "${binfile_main}.o" \ + object debug] != ""} { return -1 } set testobjdir [standard_output_file {}] if {[gdb_compile "${binfile_main}.o" "${binfile_main}" executable \ - [list debug "additional_flags=-L$testobjdir -l${test} \ - -Wl,-rpath=$testobjdir"]] != ""} { + [list debug "additional_flags=-L$testobjdir" \ + "additional_flags=-l${test}" \ + "additional_flags=-Wl,-rpath=$testobjdir"]] != ""} { return -1 } -clean_restart ${executable_main} - # -# At this point, if we try to skip the file ${srcfile_lib} or the function -# multiply(), we should get a prompt asking us if we want to enable the -# skip entry pending a shared library load. +# Test ignoring of a file inside a solib. # +with_test_prefix "ignoring solib file" { -gdb_test "skip file ${srcfile_lib}" \ - "File ${srcfile_lib} will be skipped when stepping." \ - "ignoring file in solib" \ - "No source file named ${srcfile_lib}.* -Ignore file pending future shared library load.*" \ - "y" + clean_restart ${executable_main} -# -# Checkinfo skip list. -# -gdb_test "info skip" \ - "Num\\s+Enb\\s+Glob\\s+File\\s+RE\\s+Function\\s* -1\\s+y\\s+n\\s+${srcfile_lib}\\s+n\\s+\\s*" \ - "info skip with pending file" + gdb_test "skip file ${srcfile_lib}" \ + "File ${srcfile_lib} will be skipped when stepping." \ + "skip file" -if ![runto_main] { fail "skip tests suppressed" } + gdb_test "info skip" \ + [multi_line \ + "Num\\s+Enb\\s+Glob\\s+File\\s+RE\\s+Function\\s*" \ + "1\\s+y\\s+n\\s+${srcfile_lib}\\s+n\\s+\\s*"] -# -# We shouldn't step into square(), since we skipped skip-solib-lib.c. -# -gdb_test "step" "" -gdb_test "bt" "#0\\s+main.*" "step after ignoring solib file." + if ![runto_main] { fail "skip tests suppressed" } + + # + # We shouldn't step into square(), since we skipped skip-solib-lib.c. + # + gdb_test "step" "" + gdb_test "bt" "#0\\s+main.*" +} # -# Now restart gdb and testing ignoring of a function inside a solib. +# Now test ignoring of a function inside a solib. # -clean_restart ${executable_main} +with_test_prefix "ignoring solib function" { + clean_restart ${executable_main} -gdb_test "skip function multiply" \ - "Function multiply will be skipped when stepping\\." \ - "ignoring function in solib" \ -"No function found named multiply..* -Ignore function pending future shared library load.*" \ - "y" + gdb_test "skip function multiply" \ + "Function multiply will be skipped when stepping\\." \ + "skip function" -if ![runto_main] { fail "skip tests suppressed" } + if ![runto_main] { fail "skip tests suppressed" } -# -# Our first step should take us into square. -# -gdb_test "step" "square.*" + # + # Our first step should take us into square. + # + gdb_test "step" "square.*" "step into other function" -# -# Now our entry should no longer be pending. -# -gdb_test "info skip" \ - "Num\\s+Enb\\s+Glob\\s+File\\s+RE\\s+Function\\s* -1\\s+y\\s+n\\s+\\s+n\\s+multiply\\s*" \ - "info skip for function multiply" + gdb_test "info skip" \ + [multi_line \ + "Num\\s+Enb\\s+Glob\\s+File\\s+RE\\s+Function\\s*" \ + "1\\s+y\\s+n\\s+\\s+n\\s+multiply\\s*"] -# -# This step shouldn't go into multiply -- we should skip it and go on to the -# last line of square. -# -gdb_test "step" "" -gdb_test "bt" "#0\\s+square.*" + # + # This step shouldn't go into multiply -- we should skip it and go on to + # the last line of square. + # + gdb_test "step" "" + gdb_test "bt" "#0\\s+square.*" +} -- 2.30.2