d9019901f8
Rename gdb_load_shlibs to gdb_load_shlib to reflect that it can only load a single shlib at the time. gdb/testsuite/ChangeLog: * lib/gdb.exp (gdb_load_shlibs): Rename to... (gdb_load_shlib): ... this. * gdb.arch/ftrace-insn-reloc.exp: Adjust gdb_load_shlibs -> gdb_load_shlib. * gdb.base/catch-load.exp (one_catch_load_test): Likewise. * gdb.base/ctxobj.exp: Likewise. * gdb.base/dprintf-pending.exp: Likewise. * gdb.base/dso2dso.exp: Likewise. * gdb.base/fixsection.exp: Likewise. * gdb.base/gcore-relro.exp: Likewise. * gdb.base/gdb1555.exp: Likewise. * gdb.base/global-var-nested-by-dso.exp: Likewise. * gdb.base/gnu-ifunc.exp: Likewise. * gdb.base/hbreak-in-shr-unsupported.exp: Likewise. * gdb.base/jit-so.exp (one_jit_test): Likewise. * gdb.base/pending.exp: Likewise. * gdb.base/print-file-var.exp: Likewise. * gdb.base/print-symbol-loading.exp: Likewise. * gdb.base/shlib-call.exp: Likewise. * gdb.base/shreloc.exp: Likewise. * gdb.base/so-impl-ld.exp: Likewise. * gdb.base/solib-disc.exp: Likewise. * gdb.base/solib-nodir.exp: Likewise. * gdb.base/solib-overlap.exp: Likewise. * gdb.base/solib-symbol.exp: Likewise. * gdb.base/solib-weak.exp (do_test): Likewise. * gdb.base/sym-file.exp: Likewise. * gdb.base/symtab-search-order.exp: Likewise. * gdb.base/type-opaque.exp: Likewise. * gdb.base/unload.exp: Likewise. * gdb.base/watchpoint-solib.exp: Likewise. * gdb.compile/compile.exp: Likewise. * gdb.cp/gdb2384.exp: Likewise. * gdb.cp/infcall-dlopen.exp: Likewise. * gdb.cp/re-set-overloaded.exp: Likewise. * gdb.fortran/library-module.exp: Likewise. * gdb.opt/solib-intra-step.exp: Likewise. * gdb.python/py-finish-breakpoint.exp: Likewise. * gdb.python/py-shared.exp: Likewise. * gdb.reverse/solib-precsave.exp: Likewise. * gdb.reverse/solib-reverse.exp: Likewise. * gdb.server/solib-list.exp: Likewise. * gdb.threads/dlopen-libpthread.exp: Likewise. * gdb.threads/tls-shared.exp: Likewise. * gdb.threads/tls-so_extern.exp: Likewise. * gdb.trace/change-loc.exp: Likewise. * gdb.trace/ftrace-lock.exp: Likewise. * gdb.trace/ftrace.exp: Likewise. * gdb.trace/mi-tracepoint-changed.exp (test_reconnect): Likewise. * gdb.trace/pending.exp: Likewise. * gdb.trace/range-stepping.exp: Likewise. * gdb.trace/strace.exp (strace_remove_socket): Likewise. (strace_info_marker): Likewise. (strace_probe_marker): Likewise. (strace_trace_on_same_addr): Likewise. (strace_trace_on_diff_addr): Likewise. * gdb.trace/trace-break.exp: Likewise. * gdb.trace/trace-condition.exp: Likewise. * gdb.trace/trace-mt.exp: Likewise.
279 lines
7.7 KiB
Text
279 lines
7.7 KiB
Text
# Copyright 2003-2016 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/>.
|
|
|
|
# This file was created by Jeff Johnston. (jjohnstn@redhat.com)
|
|
|
|
#
|
|
# test running programs
|
|
#
|
|
|
|
if {[skip_shlib_tests]} {
|
|
return 0
|
|
}
|
|
|
|
standard_testfile .c
|
|
set libfile "pendshr"
|
|
set libsrc $srcdir/$subdir/$libfile.c
|
|
set lib_sl [standard_output_file $libfile.sl]
|
|
|
|
set lib_opts debug
|
|
set exec_opts [list debug shlib=$lib_sl]
|
|
|
|
if [get_compiler_info] {
|
|
return -1
|
|
}
|
|
|
|
if { [gdb_compile_shlib $libsrc $lib_sl $lib_opts] != ""
|
|
|| [gdb_compile $srcdir/$subdir/$srcfile $binfile executable $exec_opts] != ""} {
|
|
untested "Could not compile either $libsrc or $srcdir/$subdir/$srcfile."
|
|
return -1
|
|
}
|
|
|
|
# Start with a fresh gdb.
|
|
|
|
gdb_exit
|
|
gdb_start
|
|
gdb_reinitialize_dir $srcdir/$subdir
|
|
|
|
gdb_test_multiple "break pendfunc1" "set pending breakpoint" {
|
|
-re ".*Make breakpoint pending.*y or \\\[n\\\]. $" {
|
|
gdb_test "y" "Breakpoint.*pendfunc1.*pending." "set pending breakpoint (without symbols)"
|
|
}
|
|
}
|
|
|
|
# Complete the condition (PR 15413).
|
|
gdb_test "complete condition " "condition 1"
|
|
|
|
gdb_test "info break" \
|
|
"Num Type\[ \]+Disp Enb Address\[ \]+What.*
|
|
\[0-9\]+\[\t \]+breakpoint keep y.*PENDING.*pendfunc1.*" \
|
|
"single pending breakpoint info (without symbols)"
|
|
|
|
gdb_load ${binfile}
|
|
gdb_load_shlib $lib_sl
|
|
|
|
set pendfunc1_loc [gdb_get_line_number "y = x + 4" ${libfile}.c]
|
|
|
|
gdb_run_cmd
|
|
|
|
gdb_test "" \
|
|
".*Breakpoint.*pendfunc1.*at.*pendshr.c:$pendfunc1_loc.*y = x \\+ 4.*" \
|
|
"run to resolved breakpoint 1 (without symbols)"
|
|
|
|
# Restart with a fresh gdb.
|
|
|
|
gdb_exit
|
|
gdb_start
|
|
gdb_reinitialize_dir $srcdir/$subdir
|
|
|
|
gdb_load ${binfile}
|
|
gdb_load_shlib $lib_sl
|
|
|
|
#
|
|
# Test setting, querying, and modifying pending breakpoints
|
|
#
|
|
|
|
gdb_test_multiple "break pendfunc1" "set pending breakpoint" {
|
|
-re ".*Make breakpoint pending.*y or \\\[n\\\]. $" {
|
|
gdb_test "y" "Breakpoint.*pendfunc1.*pending." "set pending breakpoint"
|
|
}
|
|
}
|
|
|
|
gdb_test "info break" \
|
|
"Num Type\[ \]+Disp Enb Address\[ \]+What.*
|
|
\[0-9\]+\[\t \]+breakpoint keep y.*PENDING.*pendfunc1.*" \
|
|
"single pending breakpoint info"
|
|
|
|
#
|
|
# Test breaking at existing function
|
|
#
|
|
|
|
set mainline [gdb_get_line_number "break main here"]
|
|
|
|
gdb_test "break main" \
|
|
"Breakpoint.*at.* file .*$srcfile, line $mainline.*" \
|
|
"breakpoint function"
|
|
|
|
gdb_test "info break" \
|
|
"Num Type\[ \]+Disp Enb Address\[ \]+What.*
|
|
\[0-9\]+\[\t \]+breakpoint keep y.*PENDING.*pendfunc1.*
|
|
\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$mainline" \
|
|
"pending plus real breakpoint info"
|
|
|
|
|
|
#
|
|
# Test not setting a pending breakpoint
|
|
#
|
|
gdb_test "break pendfunc2" \
|
|
"" \
|
|
"Don't set pending breakpoint" \
|
|
".*Make breakpoint pending.*y or \\\[n\\\]. $" \
|
|
"n"
|
|
|
|
#
|
|
# Add condition to pending breakpoint
|
|
#
|
|
|
|
gdb_test_no_output "condition 1 k == 1"
|
|
|
|
gdb_test "info break" \
|
|
"Num Type\[ \]+Disp Enb Address\[ \]+What.*
|
|
\[0-9\]+\[\t \]+breakpoint keep y.*PENDING.*pendfunc1.*
|
|
\[\t \]+stop only if k == 1.*
|
|
\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$mainline" \
|
|
"pending plus condition"
|
|
|
|
#
|
|
# Disable pending breakpoint
|
|
#
|
|
|
|
gdb_test_no_output "disable 1"
|
|
|
|
gdb_test "info break" \
|
|
"Num Type\[ \]+Disp Enb Address\[ \]+What.*
|
|
\[0-9\]+\[\t \]+breakpoint keep n.*PENDING.*pendfunc1.*
|
|
\[\t \]+stop only if k == 1.*
|
|
\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$mainline" \
|
|
"pending disabled"
|
|
|
|
#
|
|
# Add commands to pending breakpoint
|
|
#
|
|
gdb_test "commands 1\nprint k\nend" "" \
|
|
"Set commands for pending breakpoint"
|
|
|
|
gdb_test "info break" \
|
|
"Num Type\[ \]+Disp Enb Address\[ \]+What.*
|
|
\[0-9\]+\[\t \]+breakpoint keep n.*PENDING.*pendfunc1.*
|
|
\[\t \]+stop only if k == 1.*
|
|
\[\t \]+print k.*
|
|
\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$mainline" \
|
|
"pending disabled plus commands"
|
|
|
|
#
|
|
# Try a pending break for a line in a source file with a condition
|
|
#
|
|
|
|
set bp2_loc [gdb_get_line_number "y = x + 4" ${libfile}.c]
|
|
gdb_test_multiple "break pendshr.c:$bp2_loc if x > 3" "Set pending breakpoint 2" {
|
|
-re ".*Make breakpoint pending.*y or \\\[n\\\]. $" {
|
|
gdb_test "y" "Breakpoint.*pendshr.c:$bp2_loc.*pending." \
|
|
"Set pending breakpoint 2"
|
|
}
|
|
}
|
|
|
|
gdb_test "info break" \
|
|
"Num Type\[ \]+Disp Enb Address\[ \]+What.*
|
|
\[0-9\]+\[\t \]+breakpoint keep n.*PENDING.*pendfunc1.*
|
|
\[\t \]+stop only if k == 1.*
|
|
\[\t \]+print k.*
|
|
\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$mainline.*
|
|
\[0-9\]+\[\t \]+breakpoint keep y.*PENDING.*pendshr.c:$bp2_loc if x > 3.*" \
|
|
"multiple pending breakpoints"
|
|
|
|
|
|
#
|
|
# Try a pending break for a line in a source file with ignore count:
|
|
#
|
|
|
|
set bp3_loc [gdb_get_line_number "printf" ${libfile}.c]
|
|
gdb_test_multiple "break pendshr.c:$bp3_loc" "Set pending breakpoint 3" {
|
|
-re ".*Make breakpoint pending.*y or \\\[n\\\]. $" {
|
|
gdb_test "y" "Breakpoint.*pendshr.c:$bp3_loc.*pending." \
|
|
"Set pending breakpoint 3"
|
|
}
|
|
}
|
|
|
|
gdb_test {ignore $bpnum 2} "Will ignore next 2 crossings of breakpoint .*" \
|
|
"set ignore count on pending breakpoint 3"
|
|
|
|
gdb_test "info break" \
|
|
"Num Type\[ \]+Disp Enb Address\[ \]+What.*
|
|
\[0-9\]+\[\t \]+breakpoint keep n.*PENDING.*pendfunc1.*
|
|
\[\t \]+stop only if k == 1.*
|
|
\[\t \]+print k.*
|
|
\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$mainline.*
|
|
\[0-9\]+\[\t \]+breakpoint keep y.*PENDING.*pendshr.c:$bp2_loc if x > 3.*
|
|
\[0-9\]+\[\t \]+breakpoint keep y.*PENDING.*pendshr.c:$bp3_loc.*ignore next 2 hits.*" \
|
|
"multiple pending breakpoints 2"
|
|
|
|
#
|
|
# Run to main which should resolve a pending breakpoint
|
|
#
|
|
|
|
gdb_run_cmd
|
|
gdb_test "" \
|
|
".*Breakpoint.*, main.*$mainline.*" \
|
|
"running to main"
|
|
|
|
#
|
|
# Re-enable the first pending breakpoint which should resolve
|
|
#
|
|
|
|
gdb_test_no_output "enable 1" \
|
|
"re-enabling pending breakpoint that can resolve instantly"
|
|
|
|
#
|
|
# Continue to verify conditionals and commands for breakpoints are honored
|
|
#
|
|
|
|
gdb_test "continue" \
|
|
".*Breakpoint.*pendfunc1.*at.*pendshr.c:$bp2_loc.*4;" \
|
|
"continue to resolved breakpoint 2"
|
|
|
|
gdb_test "continue" \
|
|
".*Breakpoint.*pendfunc1.*at.*pendshr.c:$bp2_loc.*
|
|
\[$\]1 = 1." \
|
|
"continue to resolved breakpoint 1"
|
|
|
|
#
|
|
# Disable the other two breakpoints, and continue to the one with
|
|
# the ignore count. Make sure you hit it the third time, x should
|
|
# be 3 then.
|
|
#
|
|
|
|
gdb_test "disable 7" "" "Disable other breakpoints"
|
|
gdb_test "disable 5" "" "Disable other breakpoints"
|
|
|
|
gdb_test "continue" \
|
|
".*Breakpoint.*pendfunc1.*\\\(x=3\\\) at.*pendshr.c:$bp3_loc.*printf.*;" \
|
|
"continue to resolved breakpoint 3"
|
|
|
|
delete_breakpoints
|
|
|
|
gdb_breakpoint "main"
|
|
|
|
#
|
|
# Set non-existent pending breakpoint
|
|
#
|
|
gdb_test_multiple "break imaginary" "set imaginary pending breakpoint" {
|
|
-re ".*Make breakpoint pending.*y or \\\[n\\\]. $" {
|
|
gdb_test "y" "Breakpoint.*imaginary.*pending." \
|
|
"set imaginary pending breakpoint"
|
|
}
|
|
}
|
|
|
|
#
|
|
# rerun program and make sure that any pending breakpoint remains and no
|
|
# error messages are issued for the missing function
|
|
#
|
|
|
|
rerun_to_main
|
|
|
|
gdb_test "info break" \
|
|
"Num Type\[ \]+Disp Enb Address\[ \]+What.*
|
|
\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$mainline.*
|
|
\[0-9\]+\[\t \]+breakpoint keep y.*PENDING.*imaginary.*" \
|
|
"verify pending breakpoint after restart"
|