binutils-gdb/gdb/testsuite/gdb.base/break-interp.exp

694 lines
21 KiB
Plaintext
Raw Normal View History

# Copyright 2010-2018 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 test only works on GNU/Linux.
if { ![isnative] || [is_remote host] || [use_gdb_stub]
|| ![istarget *-linux*] || [skip_shlib_tests]} {
continue
}
load_lib prelink-support.exp
set test "break-interp"
set binprefix [standard_output_file ${test}]
# Only to get the $interp_system name.
set srcfile_test "start.c"
set binfile_test ${test}-test
set binfile_lib ${binprefix}.so
set srcfile "${test}-main.c"
set srcfile_lib "${test}-lib.c"
* lib/gdb.exp (skip_altivec_tests, skip_vsx_tests) (build_executable): Update. (get_compiler_info): Remove 'binfile' argument. * gdb.ada/arrayidx.exp: Update. * gdb.ada/null_array.exp: Update. * gdb.arch/altivec-abi.exp: Update. * gdb.arch/altivec-regs.exp: Update. * gdb.arch/amd64-byte.exp: Update. * gdb.arch/amd64-dword.exp: Update. * gdb.arch/amd64-word.exp: Update. * gdb.arch/i386-avx.exp: Update. * gdb.arch/i386-byte.exp: Update. * gdb.arch/i386-sse.exp: Update. * gdb.arch/i386-word.exp: Update. * gdb.arch/ppc-dfp.exp: Update. * gdb.arch/ppc-fp.exp: Update. * gdb.arch/vsx-regs.exp: Update. * gdb.base/all-bin.exp: Update. * gdb.base/annota1.exp: Update. * gdb.base/async.exp: Update. * gdb.base/attach.exp: Update. * gdb.base/break-interp.exp: Update. * gdb.base/call-ar-st.exp: Update. * gdb.base/call-rt-st.exp: Update. * gdb.base/call-sc.exp: Update. * gdb.base/callfuncs.exp: Update. * gdb.base/catch-load.exp: Update. * gdb.base/completion.exp: Update. * gdb.base/complex.exp: Update. * gdb.base/condbreak.exp: Update. * gdb.base/consecutive.exp: Update. * gdb.base/constvars.exp: Update. * gdb.base/corefile.exp: Update. * gdb.base/eval-skip.exp: Update. * gdb.base/expand-psymtabs.exp: Update. * gdb.base/exprs.exp: Update. * gdb.base/fileio.exp: Update. * gdb.base/fixsection.exp: Update. * gdb.base/funcargs.exp: Update. * gdb.base/gdb11530.exp: Update. * gdb.base/gdb1555.exp: Update. * gdb.base/gnu-ifunc.exp: Update. * gdb.base/gnu_vector.exp: Update. * gdb.base/info-macros.exp: Update. * gdb.base/jit-simple.exp: Update. * gdb.base/jit-so.exp: Update. * gdb.base/jit.exp: Update. * gdb.base/langs.exp: Update. * gdb.base/list.exp: Update. * gdb.base/logical.exp: Update. * gdb.base/long_long.exp: Update. * gdb.base/longjmp.exp: Update. * gdb.base/macscp.exp: Update. * gdb.base/mips_pro.exp: Update. * gdb.base/miscexprs.exp: Update. * gdb.base/morestack.exp: Update. * gdb.base/nodebug.exp: Update. * gdb.base/opaque.exp: Update. * gdb.base/pc-fp.exp: Update. * gdb.base/pending.exp: Update. * gdb.base/permissions.exp: Update. * gdb.base/pointers.exp: Update. * gdb.base/prelink.exp: Update. * gdb.base/printcmds.exp: Update. * gdb.base/psymtab.exp: Update. * gdb.base/ptype.exp: Update. * gdb.base/relational.exp: Update. * gdb.base/scope.exp: Update. * gdb.base/setvar.exp: Update. * gdb.base/shlib-call.exp: Update. * gdb.base/shreloc.exp: Update. * gdb.base/signals.exp: Update. * gdb.base/sizeof.exp: Update. * gdb.base/so-impl-ld.exp: Update. * gdb.base/so-indr-cl.exp: Update. * gdb.base/solib-disc.exp: Update. * gdb.base/solib-display.exp: Update. * gdb.base/solib-nodir.exp: Update. * gdb.base/solib-overlap.exp: Update. * gdb.base/solib-symbol.exp: Update. * gdb.base/solib-weak.exp: Update. * gdb.base/solib.exp: Update. * gdb.base/store.exp: Update. * gdb.base/structs.exp: Update. * gdb.base/structs2.exp: Update. * gdb.base/type-opaque.exp: Update. * gdb.base/unload.exp: Update. * gdb.base/varargs.exp: Update. * gdb.base/volatile.exp: Update. * gdb.base/watch_thread_num.exp: Update. * gdb.base/watchpoint-solib.exp: Update. * gdb.base/watchpoint.exp: Update. * gdb.base/watchpoints.exp: Update. * gdb.base/whatis.exp: Update. * gdb.cell/arch.exp: Update. * gdb.cell/break.exp: Update. * gdb.cell/bt.exp: Update. * gdb.cell/core.exp: Update. * gdb.cell/data.exp: Update. * gdb.cell/ea-cache.exp: Update. * gdb.cell/f-regs.exp: Update. * gdb.cell/fork.exp: Update. * gdb.cell/gcore.exp: Update. * gdb.cell/mem-access.exp: Update. * gdb.cell/ptype.exp: Update. * gdb.cell/registers.exp: Update. * gdb.cell/sizeof.exp: Update. * gdb.cell/solib-symbol.exp: Update. * gdb.cell/solib.exp: Update. * gdb.cp/ambiguous.exp: Update. * gdb.cp/breakpoint.exp: Update. * gdb.cp/bs15503.exp: Update. * gdb.cp/casts.exp: Update. * gdb.cp/class2.exp: Update. * gdb.cp/cpexprs.exp: Update. * gdb.cp/cplusfuncs.exp: Update. * gdb.cp/ctti.exp: Update. * gdb.cp/dispcxx.exp: Update. * gdb.cp/gdb1355.exp: Update. * gdb.cp/gdb2384.exp: Update. * gdb.cp/gdb2495.exp: Update. * gdb.cp/infcall-dlopen.exp: Update. * gdb.cp/local.exp: Update. * gdb.cp/m-data.exp: Update. * gdb.cp/m-static.exp: Update. * gdb.cp/mb-ctor.exp: Update. * gdb.cp/mb-inline.exp: Update. * gdb.cp/mb-templates.exp: Update. * gdb.cp/member-ptr.exp: Update. * gdb.cp/method.exp: Update. * gdb.cp/namespace.exp: Update. * gdb.cp/nextoverthrow.exp: Update. * gdb.cp/nsdecl.exp: Update. * gdb.cp/nsrecurs.exp: Update. * gdb.cp/nsstress.exp: Update. * gdb.cp/nsusing.exp: Update. * gdb.cp/pr-1023.exp: Update. * gdb.cp/pr-1210.exp: Update. * gdb.cp/pr-574.exp: Update. * gdb.cp/pr9631.exp: Update. * gdb.cp/printmethod.exp: Update. * gdb.cp/psmang.exp: Update. * gdb.cp/re-set-overloaded.exp: Update. * gdb.cp/rtti.exp: Update. * gdb.cp/shadow.exp: Update. * gdb.cp/templates.exp: Update. * gdb.cp/try_catch.exp: Update. * gdb.dwarf2/dw2-ranges.exp: Update. * gdb.dwarf2/pr10770.exp: Update. * gdb.fortran/library-module.exp: Update. * gdb.hp/gdb.aCC/optimize.exp: Update. * gdb.hp/gdb.aCC/watch-cmd.exp: Update. * gdb.hp/gdb.base-hp/callfwmall.exp: Update. * gdb.hp/gdb.base-hp/hwwatchbus.exp: Update. * gdb.hp/gdb.base-hp/pxdb.exp: Update. * gdb.hp/gdb.base-hp/sized-enum.exp: Update. * gdb.hp/gdb.base-hp/so-thresh.exp: Update. * gdb.hp/gdb.compat/xdb1.exp: Update. * gdb.hp/gdb.compat/xdb2.exp: Update. * gdb.hp/gdb.compat/xdb3.exp: Update. * gdb.hp/gdb.defects/bs14602.exp: Update. * gdb.hp/gdb.defects/solib-d.exp: Update. * gdb.hp/gdb.objdbg/objdbg01.exp: Update. * gdb.hp/gdb.objdbg/objdbg02.exp: Update. * gdb.hp/gdb.objdbg/objdbg03.exp: Update. * gdb.hp/gdb.objdbg/objdbg04.exp: Update. * gdb.mi/gdb792.exp: Update. * gdb.mi/mi-pending.exp: Update. * gdb.mi/mi-solib.exp: Update. * gdb.mi/mi-var-cp.exp: Update. * gdb.opt/clobbered-registers-O2.exp: Update. * gdb.opt/inline-bt.exp: Update. * gdb.opt/inline-cmds.exp: Update. * gdb.opt/inline-locals.exp: Update. * gdb.python/py-events.exp: Update. * gdb.python/py-finish-breakpoint.exp: Update. * gdb.python/py-type.exp: Update. * gdb.reverse/solib-precsave.exp: Update. * gdb.reverse/solib-reverse.exp: Update. * gdb.server/solib-list.exp: Update. * gdb.stabs/weird.exp: Update. * gdb.threads/attach-into-signal.exp: Update. * gdb.threads/attach-stopped.exp: Update. * gdb.threads/tls-shared.exp: Update. * gdb.trace/change-loc.exp: Update. * gdb.trace/strace.exp: Update.
2012-06-21 22:46:25 +02:00
if [get_compiler_info] {
return -1
}
# Use -soname so that the new library gets copied by build_executable_own_libs.
if {[gdb_compile_shlib ${srcdir}/${subdir}/${srcfile_lib} ${binfile_lib} [list debug ldflags=-Wl,-soname,${test}.so]] != ""} {
return -1
}
if {[build_executable ${test}.exp $binfile_test ${srcfile_test} {}] == -1} {
return -1
}
# Note: The separate debug info file content build-id/crc32 are not verified
# contrary to the GDB search algorithm skipping non-matching ones.
proc system_debug_get {exec} {
global debug_root
set exec_build_id_debug [build_id_debug_filename_get $exec]
set debug_base "[file tail $exec].debug"
set exec_dir [file dirname $exec]
# isfile returns 1 even for symlinks to files.
set retval $debug_root/$exec_build_id_debug
if [file isfile $retval] {
return $retval
}
set retval $exec_dir/$debug_base
if [file isfile $retval] {
return $retval
}
set retval $exec_dir/.debug/$debug_base
if [file isfile $retval] {
return $retval
}
set retval $debug_root/$exec_dir/$debug_base
if [file isfile $retval] {
return $retval
}
return ""
}
gdb_exit
gdb_start
set debug_root ""
set test "show debug-file-directory"
gdb_test_multiple $test $test {
-re "The directory where separate debug symbols are searched for is \"(.*)\".\r\n$gdb_prompt $" {
set debug_root $expect_out(1,string)
}
}
set interp_system [section_get [standard_output_file $binfile_test] .interp]
set interp_system_debug [system_debug_get $interp_system]
verbose -log "$interp_system has debug $interp_system_debug"
proc prelinkNO {arg {name ""}} {
return [prelink_no $arg $name]
}
proc prelinkYES {arg {name ""}} {
return [prelink_yes $arg $name]
}
proc strip_debug {dest} {
set test "strip [file tail $dest]"
set strip_program [transform strip]
set command "exec $strip_program --strip-debug $dest"
verbose -log "command is $command"
if [catch $command] {
fail $test
return 0
} else {
pass $test
return 1
}
}
# The marker function for the standard runtime linker interface is
# _dl_debug_state. The probes-based interface has no specific marker
# function; the probe we will stop on (init_start) is in dl_main so we
# check for that.
set solib_bp {(_dl_debug_state|dl_main)}
# Implementation of reach.
proc reach_1 {func command displacement} {
global gdb_prompt expect_out solib_bp
if {$func == $solib_bp} {
# Breakpoint on _dl_debug_state can have problems due to its overlap
# with the existing internal breakpoint from GDB.
gdb_test_no_output "set stop-on-solib-events 1"
} elseif {! [gdb_breakpoint $func allow-pending]} {
return
}
set test "reach"
set test_displacement "seen displacement message as $displacement"
set debug_state_count 0
gdb_test_multiple $command $test {
-re "Using PIE \\(Position Independent Executable\\) displacement (0x\[0-9a-f\]+) " {
# Missing "$gdb_prompt $" is intentional.
if {$expect_out(1,string) == "0x0"} {
set case "ZERO"
} else {
set case "NONZERO"
}
if {$displacement == $case || $displacement == "PRESENT"} {
pass $test_displacement
set displacement "FOUND-$displacement"
} else {
fail $test_displacement
}
exp_continue
}
-re "Breakpoint \[0-9\]+, \\.?(__GI_)?$func \\(.*\\) at .*:\[0-9\]+\r\n.*$gdb_prompt $" {
if {$func == $solib_bp} {
fail $test
} else {
pass $test
}
}
-re "Breakpoint \[0-9\]+, \[0-9xa-f\]+ in \\.?(__GI_)?$func \\(\\).*\r\n$gdb_prompt $" {
if {$func == $solib_bp} {
fail $test
} else {
pass $test
}
}
PR symtab/12406: * solib.c (update_solib_list): Update the program space's added_solibs and deleted_solibs fields. * progspace.h (struct program_space) <added_solibs, deleted_solibs>: New fields. (clear_program_space_solib_cache): Declare. * progspace.c (release_program_space): Call clear_program_space_solib_cache. (clear_program_space_solib_cache): New function. * infrun.c (handle_inferior_event) <TARGET_WAITKIND_LOADED>: Call bpstat_stop_status. Use handle_solib_event. * breakpoint.c: Include gdb_regex.h. (print_solib_event): New function. (bpstat_print): Use print_solib_event. (bpstat_stop_status): Add special case for bp_shlib_event. (handle_solib_event): New function. (bpstat_what): Use handle_solib_event. (struct solib_catchpoint): New. (dtor_catch_solib, insert_catch_solib, remove_catch_solib) (breakpoint_hit_catch_solib, check_status_catch_solib) (print_it_catch_solib, print_one_catch_solib) (print_mention_catch_solib, print_recreate_catch_solib): New functions. (catch_solib_breakpoint_ops): New global. (catch_load_or_unload, catch_load_command_1) (catch_unload_command_1): New functions. (internal_bkpt_check_status): Add special case for bp_shlib_event. (internal_bkpt_print_it): Use print_solib_event. (initialize_breakpoint_ops): Initialize catch_solib_breakpoint_ops. (_initialize_breakpoint): Register "catch load" and "catch unload". * breakpoint.h (handle_solib_event): Declare. * NEWS: Add entry for "catch load" and "catch unload". gdb/doc * gdb.texinfo (Set Catchpoints): Document "catch load" and "catch unload". (Files): Mention new catch commands. (GDB/MI Async Records): Likewise. gdb/testsuite * lib/mi-support.exp (mi_expect_stop): Add special case for solib-event. * gdb.base/catch-load-so.c: New file. * gdb.base/catch-load.exp: New file. * gdb.base/catch-load.c: New file. * gdb.base/break-interp.exp (reach_1): Update regexp.
2012-01-24 22:39:18 +01:00
-re "Stopped due to (spurious )?shared library event.*\r\n$gdb_prompt $" {
if {$func == $solib_bp} {
if {$debug_state_count == 0} {
# First stop does not yet relocate the _start function
# descriptor on ppc64.
set debug_state_count 1
send_gdb "continue\n"
exp_continue
} else {
pass $test
}
} else {
fail $test
}
}
}
if ![regexp {^(NONE|FOUND-.*)$} $displacement] {
fail $test_displacement
}
if {$func == $solib_bp} {
gdb_test_no_output "set stop-on-solib-events 0"
}
}
# `runto' does not check we stopped really at the function we specified.
# DISPLACEMENT can be "NONE" for no message to be present, "ZERO" for
# displacement of 0 bytes to be present, "NONZERO" for displacement of non-0
# bytes to be present and "PRESENT" if both "ZERO" and "NONZERO" are valid.
proc reach {func command displacement} {
with_test_prefix "reach-$func" {
2012-02-21 Pedro Alves <palves@redhat.com> Tom Tromey <tromey@redhat.com> * lib/gdb.exp: Add description of test prefixes. (with_test_prefix): New procedure. * gdb.arch/altivec-abi.exp: Use with_test_prefix. * gdb.base/attach-pie-misread.exp: Use with_test_prefix. * gdb.base/break-interp.exp: Use with_test_prefix. Use append instead of lappend to append to pf_prefix. * gdb.base/catch-load.exp: Use with_test_prefix. * gdb.base/disp-step-syscall.exp: Use with_test_prefix. * gdb.base/jit-so.exp: Use with_test_prefix. * gdb.base/jit.exp: Use with_test_prefix. * gdb.base/return-nodebug.exp (do_test): Use append instead of lappend to append to pf_prefix. * gdb.base/sepdebug.exp: Use with_test_prefix. * gdb.base/solib-display.exp: Use with_test_prefix. * gdb.base/solib-overlap.exp: Use with_test_prefix. * gdb.base/watch-cond-infcall.exp: Use with_test_prefix. * gdb.base/watchpoint.exp: Use with_test_prefix. * gdb.dwarf2/dw2-noloc.exp: Use with_test_prefix. * gdb.mi/mi-watch.exp: Use with_test_prefix. * gdb.mi/mi2-watch.exp: Use with_test_prefix. * gdb.threads/non-ldr-exc-1.exp: Use with_test_prefix. * gdb.threads/non-ldr-exc-2.exp: Use with_test_prefix. * gdb.threads/non-ldr-exc-3.exp: Use with_test_prefix. * gdb.threads/non-ldr-exc-4.exp: Use with_test_prefix. * gdb.threads/watchpoint-fork.exp: Use with_test_prefix. Use append instead of lappend to append to pf_prefix. * gdb.threads/watchthreads-reorder.exp: Use with_test_prefix. * gdb.trace/change-loc.exp: Use with_test_prefix. * gdb.trace/pending.exp: Use with_test_prefix. * gdb.trace/status-stop.exp: Use with_test_prefix. * gdb.trace/strace.exp: Use with_test_prefix. * gdb.trace/trace-break.exp: Use with_test_prefix. * gdb.trace/unavailable.exp: Use with_test_prefix. Use append instead of lappend to append to pf_prefix.
2012-02-21 22:55:39 +01:00
reach_1 $func $command $displacement
}
}
gdb/testsuite/ * gdb.threads/non-ldr-exc-1.exp (do_test): Fix the indent of using with_test_prefix. * gdb.threads/non-ldr-exc-2.exp (do_test): Likewise. * gdb.threads/non-ldr-exc-3.exp (do_test): Likewise. * gdb.threads/non-ldr-exc-4.exp (do_test): Likewise. * gdb.threads/watchpoint-fork.exp (test): Likewise. * gdb.base/break-interp.exp (test_core): Likewise. (test_attach_gdb): Likewise. * gdb.base/catch-load.exp (one_catch_load_test): Likewise. * gdb.base/disp-step-syscall.exp (disp_step_cross_syscall): Likewise. * gdb.base/jit-so.exp (one_jit_test): Likewise. * gdb.base/jit.exp (one_jit_test): Likewise. * gdb.base/sepdebug.exp (test_different_dir): Likewise. * gdb.dwarf2/dw2-dir-file-name.exp (test): Likewise. * gdb.dwarf2/dw2-noloc.exp (file_symbols): Likewise. * gdb.mi/mi-breakpoint-changed.exp (test_pending_resolved): Likewise. * gdb.mi/mi-cmd-param-changed.exp (test_command_param_changed): Likewise. * gdb.mi/mi-watch.exp test_watchpoint_all): Likewise. * gdb.mi/pr11022.exp (test_memory_changed_observer): Likewise. * gdb.trace/change-loc.exp (tracepoint_change_loc_1): Likewise. (tracepoint_change_loc_2): Likewise. * gdb.trace/disconnected-tracing.exp (disconnected_tracing): Likewise. (disconnected_tfind): Likewise. * gdb.trace/mi-traceframe-changed.exp (test_tfind_tfile): Likewise. (test_tfind_remote): Likewise. * gdb.trace/mi-tracepoint-changed.exp (test_reconnect): Likewise. (test_pending_resolved): Likewise. * gdb.trace/mi-tsv-changed.exp (test_create_delete_modify_tsv): Likewise. (test_upload_tsv): Likewise. * gdb.trace/pending.exp (pending_tracepoint_resolved): Likewise. (pending_tracepoint_works): Likewise. * gdb.trace/report.exp (use_collected_data): Likewise. * gdb.trace/status-stop.exp (test_tstart_tstop_tstart): Likewise. (test_tstart_tstart, test_buffer_full_tstart): Likewise. * gdb.trace/strace.exp (strace_info_marker): Likewise. (strace_trace_on_same_addr): Likewise. (strace_trace_on_diff_addr): Likewise. * gdb.trace/unavailable.exp (gdb_collect_args_test): Likewise. (gdb_collect_locals_test): Likewise. (gdb_unavailable_registers_test): Likewise. (gdb_collect_globals_test): Likewise.
2013-03-15 02:41:29 +01:00
proc test_core {file displacement} {
with_test_prefix "core" {
global srcdir subdir gdb_prompt expect_out
gdb/testsuite/ * gdb.threads/non-ldr-exc-1.exp (do_test): Fix the indent of using with_test_prefix. * gdb.threads/non-ldr-exc-2.exp (do_test): Likewise. * gdb.threads/non-ldr-exc-3.exp (do_test): Likewise. * gdb.threads/non-ldr-exc-4.exp (do_test): Likewise. * gdb.threads/watchpoint-fork.exp (test): Likewise. * gdb.base/break-interp.exp (test_core): Likewise. (test_attach_gdb): Likewise. * gdb.base/catch-load.exp (one_catch_load_test): Likewise. * gdb.base/disp-step-syscall.exp (disp_step_cross_syscall): Likewise. * gdb.base/jit-so.exp (one_jit_test): Likewise. * gdb.base/jit.exp (one_jit_test): Likewise. * gdb.base/sepdebug.exp (test_different_dir): Likewise. * gdb.dwarf2/dw2-dir-file-name.exp (test): Likewise. * gdb.dwarf2/dw2-noloc.exp (file_symbols): Likewise. * gdb.mi/mi-breakpoint-changed.exp (test_pending_resolved): Likewise. * gdb.mi/mi-cmd-param-changed.exp (test_command_param_changed): Likewise. * gdb.mi/mi-watch.exp test_watchpoint_all): Likewise. * gdb.mi/pr11022.exp (test_memory_changed_observer): Likewise. * gdb.trace/change-loc.exp (tracepoint_change_loc_1): Likewise. (tracepoint_change_loc_2): Likewise. * gdb.trace/disconnected-tracing.exp (disconnected_tracing): Likewise. (disconnected_tfind): Likewise. * gdb.trace/mi-traceframe-changed.exp (test_tfind_tfile): Likewise. (test_tfind_remote): Likewise. * gdb.trace/mi-tracepoint-changed.exp (test_reconnect): Likewise. (test_pending_resolved): Likewise. * gdb.trace/mi-tsv-changed.exp (test_create_delete_modify_tsv): Likewise. (test_upload_tsv): Likewise. * gdb.trace/pending.exp (pending_tracepoint_resolved): Likewise. (pending_tracepoint_works): Likewise. * gdb.trace/report.exp (use_collected_data): Likewise. * gdb.trace/status-stop.exp (test_tstart_tstop_tstart): Likewise. (test_tstart_tstart, test_buffer_full_tstart): Likewise. * gdb.trace/strace.exp (strace_info_marker): Likewise. (strace_trace_on_same_addr): Likewise. (strace_trace_on_diff_addr): Likewise. * gdb.trace/unavailable.exp (gdb_collect_args_test): Likewise. (gdb_collect_locals_test): Likewise. (gdb_unavailable_registers_test): Likewise. (gdb_collect_globals_test): Likewise.
2013-03-15 02:41:29 +01:00
set corefile [core_find $file {} "segv"]
if {$corefile == ""} {
return
}
gdb/testsuite/ * gdb.threads/non-ldr-exc-1.exp (do_test): Fix the indent of using with_test_prefix. * gdb.threads/non-ldr-exc-2.exp (do_test): Likewise. * gdb.threads/non-ldr-exc-3.exp (do_test): Likewise. * gdb.threads/non-ldr-exc-4.exp (do_test): Likewise. * gdb.threads/watchpoint-fork.exp (test): Likewise. * gdb.base/break-interp.exp (test_core): Likewise. (test_attach_gdb): Likewise. * gdb.base/catch-load.exp (one_catch_load_test): Likewise. * gdb.base/disp-step-syscall.exp (disp_step_cross_syscall): Likewise. * gdb.base/jit-so.exp (one_jit_test): Likewise. * gdb.base/jit.exp (one_jit_test): Likewise. * gdb.base/sepdebug.exp (test_different_dir): Likewise. * gdb.dwarf2/dw2-dir-file-name.exp (test): Likewise. * gdb.dwarf2/dw2-noloc.exp (file_symbols): Likewise. * gdb.mi/mi-breakpoint-changed.exp (test_pending_resolved): Likewise. * gdb.mi/mi-cmd-param-changed.exp (test_command_param_changed): Likewise. * gdb.mi/mi-watch.exp test_watchpoint_all): Likewise. * gdb.mi/pr11022.exp (test_memory_changed_observer): Likewise. * gdb.trace/change-loc.exp (tracepoint_change_loc_1): Likewise. (tracepoint_change_loc_2): Likewise. * gdb.trace/disconnected-tracing.exp (disconnected_tracing): Likewise. (disconnected_tfind): Likewise. * gdb.trace/mi-traceframe-changed.exp (test_tfind_tfile): Likewise. (test_tfind_remote): Likewise. * gdb.trace/mi-tracepoint-changed.exp (test_reconnect): Likewise. (test_pending_resolved): Likewise. * gdb.trace/mi-tsv-changed.exp (test_create_delete_modify_tsv): Likewise. (test_upload_tsv): Likewise. * gdb.trace/pending.exp (pending_tracepoint_resolved): Likewise. (pending_tracepoint_works): Likewise. * gdb.trace/report.exp (use_collected_data): Likewise. * gdb.trace/status-stop.exp (test_tstart_tstop_tstart): Likewise. (test_tstart_tstart, test_buffer_full_tstart): Likewise. * gdb.trace/strace.exp (strace_info_marker): Likewise. (strace_trace_on_same_addr): Likewise. (strace_trace_on_diff_addr): Likewise. * gdb.trace/unavailable.exp (gdb_collect_args_test): Likewise. (gdb_collect_locals_test): Likewise. (gdb_unavailable_registers_test): Likewise. (gdb_collect_globals_test): Likewise.
2013-03-15 02:41:29 +01:00
gdb_exit
gdb_start
# Clear it to never find any separate debug infos in $debug_root.
gdb_test_no_output "set debug-file-directory" \
"set debug-file-directory for core"
gdb_reinitialize_dir $srcdir/$subdir
gdb_load $file
# Print the "PIE (Position Independent Executable) displacement" message.
gdb_test_no_output "set verbose on"
set test "core loaded"
set test_displacement "seen displacement message as $displacement"
gdb_test_multiple "core-file $corefile" $test {
-re "Using PIE \\(Position Independent Executable\\) displacement (0x\[0-9a-f\]+) " {
# Missing "$gdb_prompt $" is intentional.
if {$expect_out(1,string) == "0x0"} {
set case "ZERO"
} else {
set case "NONZERO"
}
if {$displacement == $case || $displacement == "PRESENT"} {
pass $test_displacement
set displacement "FOUND-$displacement"
} else {
fail $test_displacement
}
exp_continue
}
gdb/testsuite/ * gdb.threads/non-ldr-exc-1.exp (do_test): Fix the indent of using with_test_prefix. * gdb.threads/non-ldr-exc-2.exp (do_test): Likewise. * gdb.threads/non-ldr-exc-3.exp (do_test): Likewise. * gdb.threads/non-ldr-exc-4.exp (do_test): Likewise. * gdb.threads/watchpoint-fork.exp (test): Likewise. * gdb.base/break-interp.exp (test_core): Likewise. (test_attach_gdb): Likewise. * gdb.base/catch-load.exp (one_catch_load_test): Likewise. * gdb.base/disp-step-syscall.exp (disp_step_cross_syscall): Likewise. * gdb.base/jit-so.exp (one_jit_test): Likewise. * gdb.base/jit.exp (one_jit_test): Likewise. * gdb.base/sepdebug.exp (test_different_dir): Likewise. * gdb.dwarf2/dw2-dir-file-name.exp (test): Likewise. * gdb.dwarf2/dw2-noloc.exp (file_symbols): Likewise. * gdb.mi/mi-breakpoint-changed.exp (test_pending_resolved): Likewise. * gdb.mi/mi-cmd-param-changed.exp (test_command_param_changed): Likewise. * gdb.mi/mi-watch.exp test_watchpoint_all): Likewise. * gdb.mi/pr11022.exp (test_memory_changed_observer): Likewise. * gdb.trace/change-loc.exp (tracepoint_change_loc_1): Likewise. (tracepoint_change_loc_2): Likewise. * gdb.trace/disconnected-tracing.exp (disconnected_tracing): Likewise. (disconnected_tfind): Likewise. * gdb.trace/mi-traceframe-changed.exp (test_tfind_tfile): Likewise. (test_tfind_remote): Likewise. * gdb.trace/mi-tracepoint-changed.exp (test_reconnect): Likewise. (test_pending_resolved): Likewise. * gdb.trace/mi-tsv-changed.exp (test_create_delete_modify_tsv): Likewise. (test_upload_tsv): Likewise. * gdb.trace/pending.exp (pending_tracepoint_resolved): Likewise. (pending_tracepoint_works): Likewise. * gdb.trace/report.exp (use_collected_data): Likewise. * gdb.trace/status-stop.exp (test_tstart_tstop_tstart): Likewise. (test_tstart_tstart, test_buffer_full_tstart): Likewise. * gdb.trace/strace.exp (strace_info_marker): Likewise. (strace_trace_on_same_addr): Likewise. (strace_trace_on_diff_addr): Likewise. * gdb.trace/unavailable.exp (gdb_collect_args_test): Likewise. (gdb_collect_locals_test): Likewise. (gdb_unavailable_registers_test): Likewise. (gdb_collect_globals_test): Likewise.
2013-03-15 02:41:29 +01:00
-re "Core was generated by .*\r\n#0 .*$gdb_prompt $" {
# Do not check the binary filename as it may be truncated.
pass $test
}
}
gdb/testsuite/ * gdb.threads/non-ldr-exc-1.exp (do_test): Fix the indent of using with_test_prefix. * gdb.threads/non-ldr-exc-2.exp (do_test): Likewise. * gdb.threads/non-ldr-exc-3.exp (do_test): Likewise. * gdb.threads/non-ldr-exc-4.exp (do_test): Likewise. * gdb.threads/watchpoint-fork.exp (test): Likewise. * gdb.base/break-interp.exp (test_core): Likewise. (test_attach_gdb): Likewise. * gdb.base/catch-load.exp (one_catch_load_test): Likewise. * gdb.base/disp-step-syscall.exp (disp_step_cross_syscall): Likewise. * gdb.base/jit-so.exp (one_jit_test): Likewise. * gdb.base/jit.exp (one_jit_test): Likewise. * gdb.base/sepdebug.exp (test_different_dir): Likewise. * gdb.dwarf2/dw2-dir-file-name.exp (test): Likewise. * gdb.dwarf2/dw2-noloc.exp (file_symbols): Likewise. * gdb.mi/mi-breakpoint-changed.exp (test_pending_resolved): Likewise. * gdb.mi/mi-cmd-param-changed.exp (test_command_param_changed): Likewise. * gdb.mi/mi-watch.exp test_watchpoint_all): Likewise. * gdb.mi/pr11022.exp (test_memory_changed_observer): Likewise. * gdb.trace/change-loc.exp (tracepoint_change_loc_1): Likewise. (tracepoint_change_loc_2): Likewise. * gdb.trace/disconnected-tracing.exp (disconnected_tracing): Likewise. (disconnected_tfind): Likewise. * gdb.trace/mi-traceframe-changed.exp (test_tfind_tfile): Likewise. (test_tfind_remote): Likewise. * gdb.trace/mi-tracepoint-changed.exp (test_reconnect): Likewise. (test_pending_resolved): Likewise. * gdb.trace/mi-tsv-changed.exp (test_create_delete_modify_tsv): Likewise. (test_upload_tsv): Likewise. * gdb.trace/pending.exp (pending_tracepoint_resolved): Likewise. (pending_tracepoint_works): Likewise. * gdb.trace/report.exp (use_collected_data): Likewise. * gdb.trace/status-stop.exp (test_tstart_tstop_tstart): Likewise. (test_tstart_tstart, test_buffer_full_tstart): Likewise. * gdb.trace/strace.exp (strace_info_marker): Likewise. (strace_trace_on_same_addr): Likewise. (strace_trace_on_diff_addr): Likewise. * gdb.trace/unavailable.exp (gdb_collect_args_test): Likewise. (gdb_collect_locals_test): Likewise. (gdb_unavailable_registers_test): Likewise. (gdb_collect_globals_test): Likewise.
2013-03-15 02:41:29 +01:00
if ![regexp {^(NONE|FOUND-.*)$} $displacement] {
fail $test_displacement
}
gdb/testsuite/ * gdb.threads/non-ldr-exc-1.exp (do_test): Fix the indent of using with_test_prefix. * gdb.threads/non-ldr-exc-2.exp (do_test): Likewise. * gdb.threads/non-ldr-exc-3.exp (do_test): Likewise. * gdb.threads/non-ldr-exc-4.exp (do_test): Likewise. * gdb.threads/watchpoint-fork.exp (test): Likewise. * gdb.base/break-interp.exp (test_core): Likewise. (test_attach_gdb): Likewise. * gdb.base/catch-load.exp (one_catch_load_test): Likewise. * gdb.base/disp-step-syscall.exp (disp_step_cross_syscall): Likewise. * gdb.base/jit-so.exp (one_jit_test): Likewise. * gdb.base/jit.exp (one_jit_test): Likewise. * gdb.base/sepdebug.exp (test_different_dir): Likewise. * gdb.dwarf2/dw2-dir-file-name.exp (test): Likewise. * gdb.dwarf2/dw2-noloc.exp (file_symbols): Likewise. * gdb.mi/mi-breakpoint-changed.exp (test_pending_resolved): Likewise. * gdb.mi/mi-cmd-param-changed.exp (test_command_param_changed): Likewise. * gdb.mi/mi-watch.exp test_watchpoint_all): Likewise. * gdb.mi/pr11022.exp (test_memory_changed_observer): Likewise. * gdb.trace/change-loc.exp (tracepoint_change_loc_1): Likewise. (tracepoint_change_loc_2): Likewise. * gdb.trace/disconnected-tracing.exp (disconnected_tracing): Likewise. (disconnected_tfind): Likewise. * gdb.trace/mi-traceframe-changed.exp (test_tfind_tfile): Likewise. (test_tfind_remote): Likewise. * gdb.trace/mi-tracepoint-changed.exp (test_reconnect): Likewise. (test_pending_resolved): Likewise. * gdb.trace/mi-tsv-changed.exp (test_create_delete_modify_tsv): Likewise. (test_upload_tsv): Likewise. * gdb.trace/pending.exp (pending_tracepoint_resolved): Likewise. (pending_tracepoint_works): Likewise. * gdb.trace/report.exp (use_collected_data): Likewise. * gdb.trace/status-stop.exp (test_tstart_tstop_tstart): Likewise. (test_tstart_tstart, test_buffer_full_tstart): Likewise. * gdb.trace/strace.exp (strace_info_marker): Likewise. (strace_trace_on_same_addr): Likewise. (strace_trace_on_diff_addr): Likewise. * gdb.trace/unavailable.exp (gdb_collect_args_test): Likewise. (gdb_collect_locals_test): Likewise. (gdb_unavailable_registers_test): Likewise. (gdb_collect_globals_test): Likewise.
2013-03-15 02:41:29 +01:00
gdb_test "bt" "#\[0-9\]+ +\[^\r\n\]*\\mlibfunc\\M\[^\r\n\]*\r\n#\[0-9\]+ +\[^\r\n\]*\\mmain\\M.*" "core main bt"
}
gdb/testsuite/ * gdb.threads/non-ldr-exc-1.exp (do_test): Fix the indent of using with_test_prefix. * gdb.threads/non-ldr-exc-2.exp (do_test): Likewise. * gdb.threads/non-ldr-exc-3.exp (do_test): Likewise. * gdb.threads/non-ldr-exc-4.exp (do_test): Likewise. * gdb.threads/watchpoint-fork.exp (test): Likewise. * gdb.base/break-interp.exp (test_core): Likewise. (test_attach_gdb): Likewise. * gdb.base/catch-load.exp (one_catch_load_test): Likewise. * gdb.base/disp-step-syscall.exp (disp_step_cross_syscall): Likewise. * gdb.base/jit-so.exp (one_jit_test): Likewise. * gdb.base/jit.exp (one_jit_test): Likewise. * gdb.base/sepdebug.exp (test_different_dir): Likewise. * gdb.dwarf2/dw2-dir-file-name.exp (test): Likewise. * gdb.dwarf2/dw2-noloc.exp (file_symbols): Likewise. * gdb.mi/mi-breakpoint-changed.exp (test_pending_resolved): Likewise. * gdb.mi/mi-cmd-param-changed.exp (test_command_param_changed): Likewise. * gdb.mi/mi-watch.exp test_watchpoint_all): Likewise. * gdb.mi/pr11022.exp (test_memory_changed_observer): Likewise. * gdb.trace/change-loc.exp (tracepoint_change_loc_1): Likewise. (tracepoint_change_loc_2): Likewise. * gdb.trace/disconnected-tracing.exp (disconnected_tracing): Likewise. (disconnected_tfind): Likewise. * gdb.trace/mi-traceframe-changed.exp (test_tfind_tfile): Likewise. (test_tfind_remote): Likewise. * gdb.trace/mi-tracepoint-changed.exp (test_reconnect): Likewise. (test_pending_resolved): Likewise. * gdb.trace/mi-tsv-changed.exp (test_create_delete_modify_tsv): Likewise. (test_upload_tsv): Likewise. * gdb.trace/pending.exp (pending_tracepoint_resolved): Likewise. (pending_tracepoint_works): Likewise. * gdb.trace/report.exp (use_collected_data): Likewise. * gdb.trace/status-stop.exp (test_tstart_tstop_tstart): Likewise. (test_tstart_tstart, test_buffer_full_tstart): Likewise. * gdb.trace/strace.exp (strace_info_marker): Likewise. (strace_trace_on_same_addr): Likewise. (strace_trace_on_diff_addr): Likewise. * gdb.trace/unavailable.exp (gdb_collect_args_test): Likewise. (gdb_collect_locals_test): Likewise. (gdb_unavailable_registers_test): Likewise. (gdb_collect_globals_test): Likewise.
2013-03-15 02:41:29 +01:00
}
gdb/testsuite/ * gdb.threads/non-ldr-exc-1.exp (do_test): Fix the indent of using with_test_prefix. * gdb.threads/non-ldr-exc-2.exp (do_test): Likewise. * gdb.threads/non-ldr-exc-3.exp (do_test): Likewise. * gdb.threads/non-ldr-exc-4.exp (do_test): Likewise. * gdb.threads/watchpoint-fork.exp (test): Likewise. * gdb.base/break-interp.exp (test_core): Likewise. (test_attach_gdb): Likewise. * gdb.base/catch-load.exp (one_catch_load_test): Likewise. * gdb.base/disp-step-syscall.exp (disp_step_cross_syscall): Likewise. * gdb.base/jit-so.exp (one_jit_test): Likewise. * gdb.base/jit.exp (one_jit_test): Likewise. * gdb.base/sepdebug.exp (test_different_dir): Likewise. * gdb.dwarf2/dw2-dir-file-name.exp (test): Likewise. * gdb.dwarf2/dw2-noloc.exp (file_symbols): Likewise. * gdb.mi/mi-breakpoint-changed.exp (test_pending_resolved): Likewise. * gdb.mi/mi-cmd-param-changed.exp (test_command_param_changed): Likewise. * gdb.mi/mi-watch.exp test_watchpoint_all): Likewise. * gdb.mi/pr11022.exp (test_memory_changed_observer): Likewise. * gdb.trace/change-loc.exp (tracepoint_change_loc_1): Likewise. (tracepoint_change_loc_2): Likewise. * gdb.trace/disconnected-tracing.exp (disconnected_tracing): Likewise. (disconnected_tfind): Likewise. * gdb.trace/mi-traceframe-changed.exp (test_tfind_tfile): Likewise. (test_tfind_remote): Likewise. * gdb.trace/mi-tracepoint-changed.exp (test_reconnect): Likewise. (test_pending_resolved): Likewise. * gdb.trace/mi-tsv-changed.exp (test_create_delete_modify_tsv): Likewise. (test_upload_tsv): Likewise. * gdb.trace/pending.exp (pending_tracepoint_resolved): Likewise. (pending_tracepoint_works): Likewise. * gdb.trace/report.exp (use_collected_data): Likewise. * gdb.trace/status-stop.exp (test_tstart_tstop_tstart): Likewise. (test_tstart_tstart, test_buffer_full_tstart): Likewise. * gdb.trace/strace.exp (strace_info_marker): Likewise. (strace_trace_on_same_addr): Likewise. (strace_trace_on_diff_addr): Likewise. * gdb.trace/unavailable.exp (gdb_collect_args_test): Likewise. (gdb_collect_locals_test): Likewise. (gdb_unavailable_registers_test): Likewise. (gdb_collect_globals_test): Likewise.
2013-03-15 02:41:29 +01:00
proc test_attach_gdb {file pid displacement prefix} {
with_test_prefix "$prefix" {
global gdb_prompt expect_out
gdb/testsuite/ * gdb.threads/non-ldr-exc-1.exp (do_test): Fix the indent of using with_test_prefix. * gdb.threads/non-ldr-exc-2.exp (do_test): Likewise. * gdb.threads/non-ldr-exc-3.exp (do_test): Likewise. * gdb.threads/non-ldr-exc-4.exp (do_test): Likewise. * gdb.threads/watchpoint-fork.exp (test): Likewise. * gdb.base/break-interp.exp (test_core): Likewise. (test_attach_gdb): Likewise. * gdb.base/catch-load.exp (one_catch_load_test): Likewise. * gdb.base/disp-step-syscall.exp (disp_step_cross_syscall): Likewise. * gdb.base/jit-so.exp (one_jit_test): Likewise. * gdb.base/jit.exp (one_jit_test): Likewise. * gdb.base/sepdebug.exp (test_different_dir): Likewise. * gdb.dwarf2/dw2-dir-file-name.exp (test): Likewise. * gdb.dwarf2/dw2-noloc.exp (file_symbols): Likewise. * gdb.mi/mi-breakpoint-changed.exp (test_pending_resolved): Likewise. * gdb.mi/mi-cmd-param-changed.exp (test_command_param_changed): Likewise. * gdb.mi/mi-watch.exp test_watchpoint_all): Likewise. * gdb.mi/pr11022.exp (test_memory_changed_observer): Likewise. * gdb.trace/change-loc.exp (tracepoint_change_loc_1): Likewise. (tracepoint_change_loc_2): Likewise. * gdb.trace/disconnected-tracing.exp (disconnected_tracing): Likewise. (disconnected_tfind): Likewise. * gdb.trace/mi-traceframe-changed.exp (test_tfind_tfile): Likewise. (test_tfind_remote): Likewise. * gdb.trace/mi-tracepoint-changed.exp (test_reconnect): Likewise. (test_pending_resolved): Likewise. * gdb.trace/mi-tsv-changed.exp (test_create_delete_modify_tsv): Likewise. (test_upload_tsv): Likewise. * gdb.trace/pending.exp (pending_tracepoint_resolved): Likewise. (pending_tracepoint_works): Likewise. * gdb.trace/report.exp (use_collected_data): Likewise. * gdb.trace/status-stop.exp (test_tstart_tstop_tstart): Likewise. (test_tstart_tstart, test_buffer_full_tstart): Likewise. * gdb.trace/strace.exp (strace_info_marker): Likewise. (strace_trace_on_same_addr): Likewise. (strace_trace_on_diff_addr): Likewise. * gdb.trace/unavailable.exp (gdb_collect_args_test): Likewise. (gdb_collect_locals_test): Likewise. (gdb_unavailable_registers_test): Likewise. (gdb_collect_globals_test): Likewise.
2013-03-15 02:41:29 +01:00
gdb_exit
gdb_start
gdb/testsuite/ * gdb.threads/non-ldr-exc-1.exp (do_test): Fix the indent of using with_test_prefix. * gdb.threads/non-ldr-exc-2.exp (do_test): Likewise. * gdb.threads/non-ldr-exc-3.exp (do_test): Likewise. * gdb.threads/non-ldr-exc-4.exp (do_test): Likewise. * gdb.threads/watchpoint-fork.exp (test): Likewise. * gdb.base/break-interp.exp (test_core): Likewise. (test_attach_gdb): Likewise. * gdb.base/catch-load.exp (one_catch_load_test): Likewise. * gdb.base/disp-step-syscall.exp (disp_step_cross_syscall): Likewise. * gdb.base/jit-so.exp (one_jit_test): Likewise. * gdb.base/jit.exp (one_jit_test): Likewise. * gdb.base/sepdebug.exp (test_different_dir): Likewise. * gdb.dwarf2/dw2-dir-file-name.exp (test): Likewise. * gdb.dwarf2/dw2-noloc.exp (file_symbols): Likewise. * gdb.mi/mi-breakpoint-changed.exp (test_pending_resolved): Likewise. * gdb.mi/mi-cmd-param-changed.exp (test_command_param_changed): Likewise. * gdb.mi/mi-watch.exp test_watchpoint_all): Likewise. * gdb.mi/pr11022.exp (test_memory_changed_observer): Likewise. * gdb.trace/change-loc.exp (tracepoint_change_loc_1): Likewise. (tracepoint_change_loc_2): Likewise. * gdb.trace/disconnected-tracing.exp (disconnected_tracing): Likewise. (disconnected_tfind): Likewise. * gdb.trace/mi-traceframe-changed.exp (test_tfind_tfile): Likewise. (test_tfind_remote): Likewise. * gdb.trace/mi-tracepoint-changed.exp (test_reconnect): Likewise. (test_pending_resolved): Likewise. * gdb.trace/mi-tsv-changed.exp (test_create_delete_modify_tsv): Likewise. (test_upload_tsv): Likewise. * gdb.trace/pending.exp (pending_tracepoint_resolved): Likewise. (pending_tracepoint_works): Likewise. * gdb.trace/report.exp (use_collected_data): Likewise. * gdb.trace/status-stop.exp (test_tstart_tstop_tstart): Likewise. (test_tstart_tstart, test_buffer_full_tstart): Likewise. * gdb.trace/strace.exp (strace_info_marker): Likewise. (strace_trace_on_same_addr): Likewise. (strace_trace_on_diff_addr): Likewise. * gdb.trace/unavailable.exp (gdb_collect_args_test): Likewise. (gdb_collect_locals_test): Likewise. (gdb_unavailable_registers_test): Likewise. (gdb_collect_globals_test): Likewise.
2013-03-15 02:41:29 +01:00
# Print the "PIE (Position Independent Executable) displacement" message.
gdb_test_no_output "set verbose on"
Clean up "Reading symbols" output This patch is another attempt to fix PR cli/19551. Unlike my previous attempt, it doesn't print progress. Instead, it just changes some messages and adds newlines to make the output a bit nicer. It also removes the "done." text that was previously emitted. The idea here is that it is obvious when gdb is done reading debug info, as it starts then doing something else; and that while this message did not provide much benefit to users, it did make it harder to make the output clean. After this change the output from "./gdb -iex 'set complaint 1' -nx ./gdb" reads: Reading symbols from ./gdb... .debug_ranges entry has start address of zero [in module /home/tromey/gdb/build/gdb/gdb] DW_AT_low_pc 0x0 is zero for DIE at 0x17116c1 [in module /home/tromey/gdb/build/gdb/gdb] .debug_line address at offset 0xa22f5 is 0 [in module /home/tromey/gdb/build/gdb/gdb] During symbol reading, unsupported tag: 'DW_TAG_unspecified_type'. During symbol reading, const value length mismatch for 'std::ratio<1, 1000000000>::num', got 8, expected 0. gdb/ChangeLog 2018-10-04 Tom Tromey <tom@tromey.com> PR cli/19551: * symfile.c (symbol_file_add_with_addrs): Update output. * psymtab.c (require_partial_symbols): Update output. gdb/testsuite/ChangeLog 2018-10-04 Tom Tromey <tom@tromey.com> PR cli/19551: * lib/mi-support.exp (mi_gdb_file_cmd): Update. * lib/gdb.exp (gdb_file_cmd): Update. * gdb.stabs/weird.exp (print_weird_var): Update. * gdb.server/solib-list.exp: Update. * gdb.multi/remove-inferiors.exp (test_remove_inferiors): Update. * gdb.mi/mi-cli.exp: Update. * gdb.linespec/linespec.exp: Update. * gdb.dwarf2/dw2-stack-boundary.exp: Update. * gdb.dwarf2/dw2-objfile-overlap.exp: Update. * gdb.cp/cp-relocate.exp: Update. * gdb.base/sym-file.exp: Update. * gdb.base/relocate.exp: Update. * gdb.base/readnever.exp: Update. * gdb.base/print-symbol-loading.exp (test_load_core): Update. * gdb.base/kill-detach-inferiors-cmd.exp: Update. * gdb.base/dbx.exp (gdb_file_cmd): Update. * gdb.base/code_elim.exp: Update. * gdb.base/break-unload-file.exp (test_break): Update. * gdb.base/break-interp.exp (test_attach_gdb): Update. * gdb.base/break-idempotent.exp (force_breakpoint_re_set): Update. * gdb.base/attach.exp (do_attach_tests): Update. * gdb.base/sepdebug.exp: Update. * gdb.python/py-section-script.exp: Update.
2018-05-19 19:25:20 +02:00
gdb_test "file $file" "Reading symbols from .*" "file"
gdb/testsuite/ * gdb.threads/non-ldr-exc-1.exp (do_test): Fix the indent of using with_test_prefix. * gdb.threads/non-ldr-exc-2.exp (do_test): Likewise. * gdb.threads/non-ldr-exc-3.exp (do_test): Likewise. * gdb.threads/non-ldr-exc-4.exp (do_test): Likewise. * gdb.threads/watchpoint-fork.exp (test): Likewise. * gdb.base/break-interp.exp (test_core): Likewise. (test_attach_gdb): Likewise. * gdb.base/catch-load.exp (one_catch_load_test): Likewise. * gdb.base/disp-step-syscall.exp (disp_step_cross_syscall): Likewise. * gdb.base/jit-so.exp (one_jit_test): Likewise. * gdb.base/jit.exp (one_jit_test): Likewise. * gdb.base/sepdebug.exp (test_different_dir): Likewise. * gdb.dwarf2/dw2-dir-file-name.exp (test): Likewise. * gdb.dwarf2/dw2-noloc.exp (file_symbols): Likewise. * gdb.mi/mi-breakpoint-changed.exp (test_pending_resolved): Likewise. * gdb.mi/mi-cmd-param-changed.exp (test_command_param_changed): Likewise. * gdb.mi/mi-watch.exp test_watchpoint_all): Likewise. * gdb.mi/pr11022.exp (test_memory_changed_observer): Likewise. * gdb.trace/change-loc.exp (tracepoint_change_loc_1): Likewise. (tracepoint_change_loc_2): Likewise. * gdb.trace/disconnected-tracing.exp (disconnected_tracing): Likewise. (disconnected_tfind): Likewise. * gdb.trace/mi-traceframe-changed.exp (test_tfind_tfile): Likewise. (test_tfind_remote): Likewise. * gdb.trace/mi-tracepoint-changed.exp (test_reconnect): Likewise. (test_pending_resolved): Likewise. * gdb.trace/mi-tsv-changed.exp (test_create_delete_modify_tsv): Likewise. (test_upload_tsv): Likewise. * gdb.trace/pending.exp (pending_tracepoint_resolved): Likewise. (pending_tracepoint_works): Likewise. * gdb.trace/report.exp (use_collected_data): Likewise. * gdb.trace/status-stop.exp (test_tstart_tstop_tstart): Likewise. (test_tstart_tstart, test_buffer_full_tstart): Likewise. * gdb.trace/strace.exp (strace_info_marker): Likewise. (strace_trace_on_same_addr): Likewise. (strace_trace_on_diff_addr): Likewise. * gdb.trace/unavailable.exp (gdb_collect_args_test): Likewise. (gdb_collect_locals_test): Likewise. (gdb_unavailable_registers_test): Likewise. (gdb_collect_globals_test): Likewise.
2013-03-15 02:41:29 +01:00
set test "attach"
gdb_test_multiple "attach $pid" $test {
-re "Attaching to (program: .*, )?process $pid\r\n" {
# Missing "$gdb_prompt $" is intentional.
pass $test
}
}
gdb/testsuite/ * gdb.threads/non-ldr-exc-1.exp (do_test): Fix the indent of using with_test_prefix. * gdb.threads/non-ldr-exc-2.exp (do_test): Likewise. * gdb.threads/non-ldr-exc-3.exp (do_test): Likewise. * gdb.threads/non-ldr-exc-4.exp (do_test): Likewise. * gdb.threads/watchpoint-fork.exp (test): Likewise. * gdb.base/break-interp.exp (test_core): Likewise. (test_attach_gdb): Likewise. * gdb.base/catch-load.exp (one_catch_load_test): Likewise. * gdb.base/disp-step-syscall.exp (disp_step_cross_syscall): Likewise. * gdb.base/jit-so.exp (one_jit_test): Likewise. * gdb.base/jit.exp (one_jit_test): Likewise. * gdb.base/sepdebug.exp (test_different_dir): Likewise. * gdb.dwarf2/dw2-dir-file-name.exp (test): Likewise. * gdb.dwarf2/dw2-noloc.exp (file_symbols): Likewise. * gdb.mi/mi-breakpoint-changed.exp (test_pending_resolved): Likewise. * gdb.mi/mi-cmd-param-changed.exp (test_command_param_changed): Likewise. * gdb.mi/mi-watch.exp test_watchpoint_all): Likewise. * gdb.mi/pr11022.exp (test_memory_changed_observer): Likewise. * gdb.trace/change-loc.exp (tracepoint_change_loc_1): Likewise. (tracepoint_change_loc_2): Likewise. * gdb.trace/disconnected-tracing.exp (disconnected_tracing): Likewise. (disconnected_tfind): Likewise. * gdb.trace/mi-traceframe-changed.exp (test_tfind_tfile): Likewise. (test_tfind_remote): Likewise. * gdb.trace/mi-tracepoint-changed.exp (test_reconnect): Likewise. (test_pending_resolved): Likewise. * gdb.trace/mi-tsv-changed.exp (test_create_delete_modify_tsv): Likewise. (test_upload_tsv): Likewise. * gdb.trace/pending.exp (pending_tracepoint_resolved): Likewise. (pending_tracepoint_works): Likewise. * gdb.trace/report.exp (use_collected_data): Likewise. * gdb.trace/status-stop.exp (test_tstart_tstop_tstart): Likewise. (test_tstart_tstart, test_buffer_full_tstart): Likewise. * gdb.trace/strace.exp (strace_info_marker): Likewise. (strace_trace_on_same_addr): Likewise. (strace_trace_on_diff_addr): Likewise. * gdb.trace/unavailable.exp (gdb_collect_args_test): Likewise. (gdb_collect_locals_test): Likewise. (gdb_unavailable_registers_test): Likewise. (gdb_collect_globals_test): Likewise.
2013-03-15 02:41:29 +01:00
set test "attach final prompt"
set test_displacement "seen displacement message as $displacement"
gdb_test_multiple "" $test {
-re "Using PIE \\(Position Independent Executable\\) displacement (0x\[0-9a-f\]+) " {
# Missing "$gdb_prompt $" is intentional.
if {$expect_out(1,string) == "0x0"} {
set case "ZERO"
} else {
set case "NONZERO"
}
if {$displacement == $case || $displacement == "PRESENT"} {
pass $test_displacement
set displacement "FOUND-$displacement"
} else {
fail $test_displacement
}
exp_continue
}
gdb/testsuite/ * gdb.threads/non-ldr-exc-1.exp (do_test): Fix the indent of using with_test_prefix. * gdb.threads/non-ldr-exc-2.exp (do_test): Likewise. * gdb.threads/non-ldr-exc-3.exp (do_test): Likewise. * gdb.threads/non-ldr-exc-4.exp (do_test): Likewise. * gdb.threads/watchpoint-fork.exp (test): Likewise. * gdb.base/break-interp.exp (test_core): Likewise. (test_attach_gdb): Likewise. * gdb.base/catch-load.exp (one_catch_load_test): Likewise. * gdb.base/disp-step-syscall.exp (disp_step_cross_syscall): Likewise. * gdb.base/jit-so.exp (one_jit_test): Likewise. * gdb.base/jit.exp (one_jit_test): Likewise. * gdb.base/sepdebug.exp (test_different_dir): Likewise. * gdb.dwarf2/dw2-dir-file-name.exp (test): Likewise. * gdb.dwarf2/dw2-noloc.exp (file_symbols): Likewise. * gdb.mi/mi-breakpoint-changed.exp (test_pending_resolved): Likewise. * gdb.mi/mi-cmd-param-changed.exp (test_command_param_changed): Likewise. * gdb.mi/mi-watch.exp test_watchpoint_all): Likewise. * gdb.mi/pr11022.exp (test_memory_changed_observer): Likewise. * gdb.trace/change-loc.exp (tracepoint_change_loc_1): Likewise. (tracepoint_change_loc_2): Likewise. * gdb.trace/disconnected-tracing.exp (disconnected_tracing): Likewise. (disconnected_tfind): Likewise. * gdb.trace/mi-traceframe-changed.exp (test_tfind_tfile): Likewise. (test_tfind_remote): Likewise. * gdb.trace/mi-tracepoint-changed.exp (test_reconnect): Likewise. (test_pending_resolved): Likewise. * gdb.trace/mi-tsv-changed.exp (test_create_delete_modify_tsv): Likewise. (test_upload_tsv): Likewise. * gdb.trace/pending.exp (pending_tracepoint_resolved): Likewise. (pending_tracepoint_works): Likewise. * gdb.trace/report.exp (use_collected_data): Likewise. * gdb.trace/status-stop.exp (test_tstart_tstop_tstart): Likewise. (test_tstart_tstart, test_buffer_full_tstart): Likewise. * gdb.trace/strace.exp (strace_info_marker): Likewise. (strace_trace_on_same_addr): Likewise. (strace_trace_on_diff_addr): Likewise. * gdb.trace/unavailable.exp (gdb_collect_args_test): Likewise. (gdb_collect_locals_test): Likewise. (gdb_unavailable_registers_test): Likewise. (gdb_collect_globals_test): Likewise.
2013-03-15 02:41:29 +01:00
-re "$gdb_prompt $" {
pass $test
}
}
gdb/testsuite/ * gdb.threads/non-ldr-exc-1.exp (do_test): Fix the indent of using with_test_prefix. * gdb.threads/non-ldr-exc-2.exp (do_test): Likewise. * gdb.threads/non-ldr-exc-3.exp (do_test): Likewise. * gdb.threads/non-ldr-exc-4.exp (do_test): Likewise. * gdb.threads/watchpoint-fork.exp (test): Likewise. * gdb.base/break-interp.exp (test_core): Likewise. (test_attach_gdb): Likewise. * gdb.base/catch-load.exp (one_catch_load_test): Likewise. * gdb.base/disp-step-syscall.exp (disp_step_cross_syscall): Likewise. * gdb.base/jit-so.exp (one_jit_test): Likewise. * gdb.base/jit.exp (one_jit_test): Likewise. * gdb.base/sepdebug.exp (test_different_dir): Likewise. * gdb.dwarf2/dw2-dir-file-name.exp (test): Likewise. * gdb.dwarf2/dw2-noloc.exp (file_symbols): Likewise. * gdb.mi/mi-breakpoint-changed.exp (test_pending_resolved): Likewise. * gdb.mi/mi-cmd-param-changed.exp (test_command_param_changed): Likewise. * gdb.mi/mi-watch.exp test_watchpoint_all): Likewise. * gdb.mi/pr11022.exp (test_memory_changed_observer): Likewise. * gdb.trace/change-loc.exp (tracepoint_change_loc_1): Likewise. (tracepoint_change_loc_2): Likewise. * gdb.trace/disconnected-tracing.exp (disconnected_tracing): Likewise. (disconnected_tfind): Likewise. * gdb.trace/mi-traceframe-changed.exp (test_tfind_tfile): Likewise. (test_tfind_remote): Likewise. * gdb.trace/mi-tracepoint-changed.exp (test_reconnect): Likewise. (test_pending_resolved): Likewise. * gdb.trace/mi-tsv-changed.exp (test_create_delete_modify_tsv): Likewise. (test_upload_tsv): Likewise. * gdb.trace/pending.exp (pending_tracepoint_resolved): Likewise. (pending_tracepoint_works): Likewise. * gdb.trace/report.exp (use_collected_data): Likewise. * gdb.trace/status-stop.exp (test_tstart_tstop_tstart): Likewise. (test_tstart_tstart, test_buffer_full_tstart): Likewise. * gdb.trace/strace.exp (strace_info_marker): Likewise. (strace_trace_on_same_addr): Likewise. (strace_trace_on_diff_addr): Likewise. * gdb.trace/unavailable.exp (gdb_collect_args_test): Likewise. (gdb_collect_locals_test): Likewise. (gdb_unavailable_registers_test): Likewise. (gdb_collect_globals_test): Likewise.
2013-03-15 02:41:29 +01:00
if ![regexp {^(NONE|FOUND-.*)$} $displacement] {
fail $test_displacement
}
gdb/testsuite/ * gdb.threads/non-ldr-exc-1.exp (do_test): Fix the indent of using with_test_prefix. * gdb.threads/non-ldr-exc-2.exp (do_test): Likewise. * gdb.threads/non-ldr-exc-3.exp (do_test): Likewise. * gdb.threads/non-ldr-exc-4.exp (do_test): Likewise. * gdb.threads/watchpoint-fork.exp (test): Likewise. * gdb.base/break-interp.exp (test_core): Likewise. (test_attach_gdb): Likewise. * gdb.base/catch-load.exp (one_catch_load_test): Likewise. * gdb.base/disp-step-syscall.exp (disp_step_cross_syscall): Likewise. * gdb.base/jit-so.exp (one_jit_test): Likewise. * gdb.base/jit.exp (one_jit_test): Likewise. * gdb.base/sepdebug.exp (test_different_dir): Likewise. * gdb.dwarf2/dw2-dir-file-name.exp (test): Likewise. * gdb.dwarf2/dw2-noloc.exp (file_symbols): Likewise. * gdb.mi/mi-breakpoint-changed.exp (test_pending_resolved): Likewise. * gdb.mi/mi-cmd-param-changed.exp (test_command_param_changed): Likewise. * gdb.mi/mi-watch.exp test_watchpoint_all): Likewise. * gdb.mi/pr11022.exp (test_memory_changed_observer): Likewise. * gdb.trace/change-loc.exp (tracepoint_change_loc_1): Likewise. (tracepoint_change_loc_2): Likewise. * gdb.trace/disconnected-tracing.exp (disconnected_tracing): Likewise. (disconnected_tfind): Likewise. * gdb.trace/mi-traceframe-changed.exp (test_tfind_tfile): Likewise. (test_tfind_remote): Likewise. * gdb.trace/mi-tracepoint-changed.exp (test_reconnect): Likewise. (test_pending_resolved): Likewise. * gdb.trace/mi-tsv-changed.exp (test_create_delete_modify_tsv): Likewise. (test_upload_tsv): Likewise. * gdb.trace/pending.exp (pending_tracepoint_resolved): Likewise. (pending_tracepoint_works): Likewise. * gdb.trace/report.exp (use_collected_data): Likewise. * gdb.trace/status-stop.exp (test_tstart_tstop_tstart): Likewise. (test_tstart_tstart, test_buffer_full_tstart): Likewise. * gdb.trace/strace.exp (strace_info_marker): Likewise. (strace_trace_on_same_addr): Likewise. (strace_trace_on_diff_addr): Likewise. * gdb.trace/unavailable.exp (gdb_collect_args_test): Likewise. (gdb_collect_locals_test): Likewise. (gdb_unavailable_registers_test): Likewise. (gdb_collect_globals_test): Likewise.
2013-03-15 02:41:29 +01:00
gdb_test "bt" "#\[0-9\]+ +\[^\r\n\]*\\mlibfunc\\M\[^\r\n\]*\r\n#\[0-9\]+ +\[^\r\n\]*\\mmain\\M.*" "attach main bt"
gdb_exit
}
}
proc test_attach {file displacement {relink_args ""}} {
global board_info
global exec
gdb_exit
set test "sleep function started"
set command "${file} sleep"
testsuite: tcl exec& -> 'kill -9 $pid' is racy (attach-many-short-lived-thread.exp races and others) The buildbots show that attach-many-short-lived-thread.exp is racy. But after staring at debug logs and playing with SystemTap scripts for a (long) while, I figured out that neither GDB, nor the kernel nor the test's program itself are at fault. The problem is simply that the testsuite machinery is currently subject to PID-reuse races. The attach-many-short-lived-threads.c test program just happens to be much more susceptible to trigger this race because threads and processes share the same number space on Linux, and the test spawns many many short lived threads in succession, thus enlarging the race window a lot. Part of the problem is that several tests spawn processes with "exec&" (in order to test the "attach" command) , and then at the end of the test, to make sure things are cleaned up, issue a 'remote_spawn "kill -p $testpid"'. Since with tcl's "exec&", tcl itself is responsible for reaping the process's exit status, when we go kill the process, testpid may have already exited _and_ its status may have (and often has) been reaped already. Thus it can happen that another process meanwhile reuses $testpid, and that "kill" command kills the wrong process... Frequently, that happens to be attach-many-short-lived-thread, but this explains other test's races as well. In the attach-many-short-lived-threads test, it sometimes manifests like this: (gdb) file /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.threads/attach-many-short-lived-threads Reading symbols from /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.threads/attach-many-short-lived-threads...done. (gdb) Loaded /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.threads/attach-many-short-lived-threads into /home/pedro/gdb/mygit/build/gdb/testsuite/../../gdb/gdb attach 5940 Attaching to program: /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.threads/attach-many-short-lived-threads, process 5940 warning: process 5940 is a zombie - the process has already terminated ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ptrace: Operation not permitted. (gdb) PASS: gdb.threads/attach-many-short-lived-threads.exp: iter 1: attach info threads No threads. (gdb) PASS: gdb.threads/attach-many-short-lived-threads.exp: iter 1: no new threads set breakpoint always-inserted on (gdb) PASS: gdb.threads/attach-many-short-lived-threads.exp: iter 1: set breakpoint always-inserted on Other times the process dies while the test is ongoing (the process is ptrace-stopped): (gdb) print again = 1 Cannot access memory at address 0x6020cc (gdb) FAIL: gdb.threads/attach-many-short-lived-threads.exp: iter 2: reset timer in the inferior (Recall that on Linux, SIGKILL is not interceptable) And other times it dies just while we're detaching: $4 = 319 (gdb) PASS: gdb.threads/attach-many-short-lived-threads.exp: iter 2: print seconds_left detach Can't detach Thread 0x7fb13b7de700 (LWP 1842): No such process (gdb) FAIL: gdb.threads/attach-many-short-lived-threads.exp: iter 2: detach GDB mishandles the latter (it should ignore ESRCH while detaching just like when continuing), but that's another story. The fix here is to change spawn_wait_for_attach to use Expect's 'spawn' command instead of Tcl's 'exec&' to spawn programs, because with spawn we control when to wait for/reap the process. That allows killing the process by PID without being subject to pid-reuse races, because even if the process is already dead, the kernel won't reuse the process's PID until the zombie is reaped. The other part of the problem lies in DejaGnu itself, unfortunately. I have occasionally seen tests (attach-many-short-lived-threads included, but not only that one) die with a random inexplicable SIGTERM too, and that too is caused by the same reason, except that in that case, the rogue SIGTERM is sent from this bit in DejaGnu's remote.exp: exec sh -c "exec > /dev/null 2>&1 && (kill -2 $pgid || kill -2 $pid) && sleep 5 && (kill $pgid || kill $pid) && sleep 5 && (kill -9 $pgid || kill -9 $pid) &" ... catch "wait -i $shell_id" Even if the program exits promptly, that whole cascade of kills carries on in the background, thus potentially killing the poor process that manages to reuse $pid... I sent a fix for that to the DejaGnu list: http://lists.gnu.org/archive/html/dejagnu/2015-07/msg00000.html With both patches in place, I haven't seen attach-many-short-lived-threads.exp fail again. Tested on x86_64 Fedora 20, native, gdbserver and extended-gdbserver. gdb/testsuite/ChangeLog: 2015-07-31 Pedro Alves <palves@redhat.com> * gdb.base/attach-pie-misread.exp: Rename $res to $test_spawn_id. Use spawn_id_get_pid. Wait for spawn id after eof. Use kill_wait_spawned_process instead of explicit "kill -9". * gdb.base/attach-pie-noexec.exp: Adjust to spawn_wait_for_attach returning a spawn id instead of a pid. Use spawn_id_get_pid and kill_wait_spawned_process. * gdb.base/attach-twice.exp: Likewise. * gdb.base/attach.exp: Likewise. (do_command_attach_tests): Use gdb_spawn_with_cmdline_opts and gdb_test_multiple. * gdb.base/solib-overlap.exp: Adjust to spawn_wait_for_attach returning a spawn id instead of a pid. Use spawn_id_get_pid and kill_wait_spawned_process. * gdb.base/valgrind-infcall.exp: Likewise. * gdb.multi/multi-attach.exp: Likewise. * gdb.python/py-prompt.exp: Likewise. * gdb.python/py-sync-interp.exp: Likewise. * gdb.server/ext-attach.exp: Likewise. * gdb.threads/attach-into-signal.exp (corefunc): Use spawn_wait_for_attach, spawn_id_get_pid and kill_wait_spawned_process. * gdb.threads/attach-many-short-lived-threads.exp: Adjust to spawn_wait_for_attach returning a spawn id instead of a pid. Use spawn_id_get_pid and kill_wait_spawned_process. * gdb.threads/attach-stopped.exp (corefunc): Use spawn_wait_for_attach, spawn_id_get_pid and kill_wait_spawned_process. * gdb.base/break-interp.exp: Rename $res to $test_spawn_id. Use spawn_id_get_pid. Wait for spawn id after eof. Use kill_wait_spawned_process instead of explicit "kill -9". * lib/gdb.exp (can_spawn_for_attach): Adjust comment. (kill_wait_spawned_process, spawn_id_get_pid): New procedures. (spawn_wait_for_attach): Use spawn instead of exec to spawn processes. Don't map cygwin/windows pids here. Now returns a spawn id list.
2015-07-31 21:06:24 +02:00
set test_spawn_id [remote_spawn host $command]
if { $test_spawn_id < 0 || $test_spawn_id == "" } {
perror "Spawning $command failed."
fail $test
return
}
testsuite: tcl exec& -> 'kill -9 $pid' is racy (attach-many-short-lived-thread.exp races and others) The buildbots show that attach-many-short-lived-thread.exp is racy. But after staring at debug logs and playing with SystemTap scripts for a (long) while, I figured out that neither GDB, nor the kernel nor the test's program itself are at fault. The problem is simply that the testsuite machinery is currently subject to PID-reuse races. The attach-many-short-lived-threads.c test program just happens to be much more susceptible to trigger this race because threads and processes share the same number space on Linux, and the test spawns many many short lived threads in succession, thus enlarging the race window a lot. Part of the problem is that several tests spawn processes with "exec&" (in order to test the "attach" command) , and then at the end of the test, to make sure things are cleaned up, issue a 'remote_spawn "kill -p $testpid"'. Since with tcl's "exec&", tcl itself is responsible for reaping the process's exit status, when we go kill the process, testpid may have already exited _and_ its status may have (and often has) been reaped already. Thus it can happen that another process meanwhile reuses $testpid, and that "kill" command kills the wrong process... Frequently, that happens to be attach-many-short-lived-thread, but this explains other test's races as well. In the attach-many-short-lived-threads test, it sometimes manifests like this: (gdb) file /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.threads/attach-many-short-lived-threads Reading symbols from /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.threads/attach-many-short-lived-threads...done. (gdb) Loaded /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.threads/attach-many-short-lived-threads into /home/pedro/gdb/mygit/build/gdb/testsuite/../../gdb/gdb attach 5940 Attaching to program: /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.threads/attach-many-short-lived-threads, process 5940 warning: process 5940 is a zombie - the process has already terminated ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ptrace: Operation not permitted. (gdb) PASS: gdb.threads/attach-many-short-lived-threads.exp: iter 1: attach info threads No threads. (gdb) PASS: gdb.threads/attach-many-short-lived-threads.exp: iter 1: no new threads set breakpoint always-inserted on (gdb) PASS: gdb.threads/attach-many-short-lived-threads.exp: iter 1: set breakpoint always-inserted on Other times the process dies while the test is ongoing (the process is ptrace-stopped): (gdb) print again = 1 Cannot access memory at address 0x6020cc (gdb) FAIL: gdb.threads/attach-many-short-lived-threads.exp: iter 2: reset timer in the inferior (Recall that on Linux, SIGKILL is not interceptable) And other times it dies just while we're detaching: $4 = 319 (gdb) PASS: gdb.threads/attach-many-short-lived-threads.exp: iter 2: print seconds_left detach Can't detach Thread 0x7fb13b7de700 (LWP 1842): No such process (gdb) FAIL: gdb.threads/attach-many-short-lived-threads.exp: iter 2: detach GDB mishandles the latter (it should ignore ESRCH while detaching just like when continuing), but that's another story. The fix here is to change spawn_wait_for_attach to use Expect's 'spawn' command instead of Tcl's 'exec&' to spawn programs, because with spawn we control when to wait for/reap the process. That allows killing the process by PID without being subject to pid-reuse races, because even if the process is already dead, the kernel won't reuse the process's PID until the zombie is reaped. The other part of the problem lies in DejaGnu itself, unfortunately. I have occasionally seen tests (attach-many-short-lived-threads included, but not only that one) die with a random inexplicable SIGTERM too, and that too is caused by the same reason, except that in that case, the rogue SIGTERM is sent from this bit in DejaGnu's remote.exp: exec sh -c "exec > /dev/null 2>&1 && (kill -2 $pgid || kill -2 $pid) && sleep 5 && (kill $pgid || kill $pid) && sleep 5 && (kill -9 $pgid || kill -9 $pid) &" ... catch "wait -i $shell_id" Even if the program exits promptly, that whole cascade of kills carries on in the background, thus potentially killing the poor process that manages to reuse $pid... I sent a fix for that to the DejaGnu list: http://lists.gnu.org/archive/html/dejagnu/2015-07/msg00000.html With both patches in place, I haven't seen attach-many-short-lived-threads.exp fail again. Tested on x86_64 Fedora 20, native, gdbserver and extended-gdbserver. gdb/testsuite/ChangeLog: 2015-07-31 Pedro Alves <palves@redhat.com> * gdb.base/attach-pie-misread.exp: Rename $res to $test_spawn_id. Use spawn_id_get_pid. Wait for spawn id after eof. Use kill_wait_spawned_process instead of explicit "kill -9". * gdb.base/attach-pie-noexec.exp: Adjust to spawn_wait_for_attach returning a spawn id instead of a pid. Use spawn_id_get_pid and kill_wait_spawned_process. * gdb.base/attach-twice.exp: Likewise. * gdb.base/attach.exp: Likewise. (do_command_attach_tests): Use gdb_spawn_with_cmdline_opts and gdb_test_multiple. * gdb.base/solib-overlap.exp: Adjust to spawn_wait_for_attach returning a spawn id instead of a pid. Use spawn_id_get_pid and kill_wait_spawned_process. * gdb.base/valgrind-infcall.exp: Likewise. * gdb.multi/multi-attach.exp: Likewise. * gdb.python/py-prompt.exp: Likewise. * gdb.python/py-sync-interp.exp: Likewise. * gdb.server/ext-attach.exp: Likewise. * gdb.threads/attach-into-signal.exp (corefunc): Use spawn_wait_for_attach, spawn_id_get_pid and kill_wait_spawned_process. * gdb.threads/attach-many-short-lived-threads.exp: Adjust to spawn_wait_for_attach returning a spawn id instead of a pid. Use spawn_id_get_pid and kill_wait_spawned_process. * gdb.threads/attach-stopped.exp (corefunc): Use spawn_wait_for_attach, spawn_id_get_pid and kill_wait_spawned_process. * gdb.base/break-interp.exp: Rename $res to $test_spawn_id. Use spawn_id_get_pid. Wait for spawn id after eof. Use kill_wait_spawned_process instead of explicit "kill -9". * lib/gdb.exp (can_spawn_for_attach): Adjust comment. (kill_wait_spawned_process, spawn_id_get_pid): New procedures. (spawn_wait_for_attach): Use spawn instead of exec to spawn processes. Don't map cygwin/windows pids here. Now returns a spawn id list.
2015-07-31 21:06:24 +02:00
set pid [spawn_id_get_pid $test_spawn_id]
gdb_expect {
-re "sleeping\r\n" {
pass $test
}
eof {
fail "$test (eof)"
testsuite: tcl exec& -> 'kill -9 $pid' is racy (attach-many-short-lived-thread.exp races and others) The buildbots show that attach-many-short-lived-thread.exp is racy. But after staring at debug logs and playing with SystemTap scripts for a (long) while, I figured out that neither GDB, nor the kernel nor the test's program itself are at fault. The problem is simply that the testsuite machinery is currently subject to PID-reuse races. The attach-many-short-lived-threads.c test program just happens to be much more susceptible to trigger this race because threads and processes share the same number space on Linux, and the test spawns many many short lived threads in succession, thus enlarging the race window a lot. Part of the problem is that several tests spawn processes with "exec&" (in order to test the "attach" command) , and then at the end of the test, to make sure things are cleaned up, issue a 'remote_spawn "kill -p $testpid"'. Since with tcl's "exec&", tcl itself is responsible for reaping the process's exit status, when we go kill the process, testpid may have already exited _and_ its status may have (and often has) been reaped already. Thus it can happen that another process meanwhile reuses $testpid, and that "kill" command kills the wrong process... Frequently, that happens to be attach-many-short-lived-thread, but this explains other test's races as well. In the attach-many-short-lived-threads test, it sometimes manifests like this: (gdb) file /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.threads/attach-many-short-lived-threads Reading symbols from /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.threads/attach-many-short-lived-threads...done. (gdb) Loaded /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.threads/attach-many-short-lived-threads into /home/pedro/gdb/mygit/build/gdb/testsuite/../../gdb/gdb attach 5940 Attaching to program: /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.threads/attach-many-short-lived-threads, process 5940 warning: process 5940 is a zombie - the process has already terminated ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ptrace: Operation not permitted. (gdb) PASS: gdb.threads/attach-many-short-lived-threads.exp: iter 1: attach info threads No threads. (gdb) PASS: gdb.threads/attach-many-short-lived-threads.exp: iter 1: no new threads set breakpoint always-inserted on (gdb) PASS: gdb.threads/attach-many-short-lived-threads.exp: iter 1: set breakpoint always-inserted on Other times the process dies while the test is ongoing (the process is ptrace-stopped): (gdb) print again = 1 Cannot access memory at address 0x6020cc (gdb) FAIL: gdb.threads/attach-many-short-lived-threads.exp: iter 2: reset timer in the inferior (Recall that on Linux, SIGKILL is not interceptable) And other times it dies just while we're detaching: $4 = 319 (gdb) PASS: gdb.threads/attach-many-short-lived-threads.exp: iter 2: print seconds_left detach Can't detach Thread 0x7fb13b7de700 (LWP 1842): No such process (gdb) FAIL: gdb.threads/attach-many-short-lived-threads.exp: iter 2: detach GDB mishandles the latter (it should ignore ESRCH while detaching just like when continuing), but that's another story. The fix here is to change spawn_wait_for_attach to use Expect's 'spawn' command instead of Tcl's 'exec&' to spawn programs, because with spawn we control when to wait for/reap the process. That allows killing the process by PID without being subject to pid-reuse races, because even if the process is already dead, the kernel won't reuse the process's PID until the zombie is reaped. The other part of the problem lies in DejaGnu itself, unfortunately. I have occasionally seen tests (attach-many-short-lived-threads included, but not only that one) die with a random inexplicable SIGTERM too, and that too is caused by the same reason, except that in that case, the rogue SIGTERM is sent from this bit in DejaGnu's remote.exp: exec sh -c "exec > /dev/null 2>&1 && (kill -2 $pgid || kill -2 $pid) && sleep 5 && (kill $pgid || kill $pid) && sleep 5 && (kill -9 $pgid || kill -9 $pid) &" ... catch "wait -i $shell_id" Even if the program exits promptly, that whole cascade of kills carries on in the background, thus potentially killing the poor process that manages to reuse $pid... I sent a fix for that to the DejaGnu list: http://lists.gnu.org/archive/html/dejagnu/2015-07/msg00000.html With both patches in place, I haven't seen attach-many-short-lived-threads.exp fail again. Tested on x86_64 Fedora 20, native, gdbserver and extended-gdbserver. gdb/testsuite/ChangeLog: 2015-07-31 Pedro Alves <palves@redhat.com> * gdb.base/attach-pie-misread.exp: Rename $res to $test_spawn_id. Use spawn_id_get_pid. Wait for spawn id after eof. Use kill_wait_spawned_process instead of explicit "kill -9". * gdb.base/attach-pie-noexec.exp: Adjust to spawn_wait_for_attach returning a spawn id instead of a pid. Use spawn_id_get_pid and kill_wait_spawned_process. * gdb.base/attach-twice.exp: Likewise. * gdb.base/attach.exp: Likewise. (do_command_attach_tests): Use gdb_spawn_with_cmdline_opts and gdb_test_multiple. * gdb.base/solib-overlap.exp: Adjust to spawn_wait_for_attach returning a spawn id instead of a pid. Use spawn_id_get_pid and kill_wait_spawned_process. * gdb.base/valgrind-infcall.exp: Likewise. * gdb.multi/multi-attach.exp: Likewise. * gdb.python/py-prompt.exp: Likewise. * gdb.python/py-sync-interp.exp: Likewise. * gdb.server/ext-attach.exp: Likewise. * gdb.threads/attach-into-signal.exp (corefunc): Use spawn_wait_for_attach, spawn_id_get_pid and kill_wait_spawned_process. * gdb.threads/attach-many-short-lived-threads.exp: Adjust to spawn_wait_for_attach returning a spawn id instead of a pid. Use spawn_id_get_pid and kill_wait_spawned_process. * gdb.threads/attach-stopped.exp (corefunc): Use spawn_wait_for_attach, spawn_id_get_pid and kill_wait_spawned_process. * gdb.base/break-interp.exp: Rename $res to $test_spawn_id. Use spawn_id_get_pid. Wait for spawn id after eof. Use kill_wait_spawned_process instead of explicit "kill -9". * lib/gdb.exp (can_spawn_for_attach): Adjust comment. (kill_wait_spawned_process, spawn_id_get_pid): New procedures. (spawn_wait_for_attach): Use spawn instead of exec to spawn processes. Don't map cygwin/windows pids here. Now returns a spawn id list.
2015-07-31 21:06:24 +02:00
wait -i $test_spawn_id
return
}
timeout {
fail "$test (timeout)"
testsuite: tcl exec& -> 'kill -9 $pid' is racy (attach-many-short-lived-thread.exp races and others) The buildbots show that attach-many-short-lived-thread.exp is racy. But after staring at debug logs and playing with SystemTap scripts for a (long) while, I figured out that neither GDB, nor the kernel nor the test's program itself are at fault. The problem is simply that the testsuite machinery is currently subject to PID-reuse races. The attach-many-short-lived-threads.c test program just happens to be much more susceptible to trigger this race because threads and processes share the same number space on Linux, and the test spawns many many short lived threads in succession, thus enlarging the race window a lot. Part of the problem is that several tests spawn processes with "exec&" (in order to test the "attach" command) , and then at the end of the test, to make sure things are cleaned up, issue a 'remote_spawn "kill -p $testpid"'. Since with tcl's "exec&", tcl itself is responsible for reaping the process's exit status, when we go kill the process, testpid may have already exited _and_ its status may have (and often has) been reaped already. Thus it can happen that another process meanwhile reuses $testpid, and that "kill" command kills the wrong process... Frequently, that happens to be attach-many-short-lived-thread, but this explains other test's races as well. In the attach-many-short-lived-threads test, it sometimes manifests like this: (gdb) file /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.threads/attach-many-short-lived-threads Reading symbols from /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.threads/attach-many-short-lived-threads...done. (gdb) Loaded /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.threads/attach-many-short-lived-threads into /home/pedro/gdb/mygit/build/gdb/testsuite/../../gdb/gdb attach 5940 Attaching to program: /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.threads/attach-many-short-lived-threads, process 5940 warning: process 5940 is a zombie - the process has already terminated ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ptrace: Operation not permitted. (gdb) PASS: gdb.threads/attach-many-short-lived-threads.exp: iter 1: attach info threads No threads. (gdb) PASS: gdb.threads/attach-many-short-lived-threads.exp: iter 1: no new threads set breakpoint always-inserted on (gdb) PASS: gdb.threads/attach-many-short-lived-threads.exp: iter 1: set breakpoint always-inserted on Other times the process dies while the test is ongoing (the process is ptrace-stopped): (gdb) print again = 1 Cannot access memory at address 0x6020cc (gdb) FAIL: gdb.threads/attach-many-short-lived-threads.exp: iter 2: reset timer in the inferior (Recall that on Linux, SIGKILL is not interceptable) And other times it dies just while we're detaching: $4 = 319 (gdb) PASS: gdb.threads/attach-many-short-lived-threads.exp: iter 2: print seconds_left detach Can't detach Thread 0x7fb13b7de700 (LWP 1842): No such process (gdb) FAIL: gdb.threads/attach-many-short-lived-threads.exp: iter 2: detach GDB mishandles the latter (it should ignore ESRCH while detaching just like when continuing), but that's another story. The fix here is to change spawn_wait_for_attach to use Expect's 'spawn' command instead of Tcl's 'exec&' to spawn programs, because with spawn we control when to wait for/reap the process. That allows killing the process by PID without being subject to pid-reuse races, because even if the process is already dead, the kernel won't reuse the process's PID until the zombie is reaped. The other part of the problem lies in DejaGnu itself, unfortunately. I have occasionally seen tests (attach-many-short-lived-threads included, but not only that one) die with a random inexplicable SIGTERM too, and that too is caused by the same reason, except that in that case, the rogue SIGTERM is sent from this bit in DejaGnu's remote.exp: exec sh -c "exec > /dev/null 2>&1 && (kill -2 $pgid || kill -2 $pid) && sleep 5 && (kill $pgid || kill $pid) && sleep 5 && (kill -9 $pgid || kill -9 $pid) &" ... catch "wait -i $shell_id" Even if the program exits promptly, that whole cascade of kills carries on in the background, thus potentially killing the poor process that manages to reuse $pid... I sent a fix for that to the DejaGnu list: http://lists.gnu.org/archive/html/dejagnu/2015-07/msg00000.html With both patches in place, I haven't seen attach-many-short-lived-threads.exp fail again. Tested on x86_64 Fedora 20, native, gdbserver and extended-gdbserver. gdb/testsuite/ChangeLog: 2015-07-31 Pedro Alves <palves@redhat.com> * gdb.base/attach-pie-misread.exp: Rename $res to $test_spawn_id. Use spawn_id_get_pid. Wait for spawn id after eof. Use kill_wait_spawned_process instead of explicit "kill -9". * gdb.base/attach-pie-noexec.exp: Adjust to spawn_wait_for_attach returning a spawn id instead of a pid. Use spawn_id_get_pid and kill_wait_spawned_process. * gdb.base/attach-twice.exp: Likewise. * gdb.base/attach.exp: Likewise. (do_command_attach_tests): Use gdb_spawn_with_cmdline_opts and gdb_test_multiple. * gdb.base/solib-overlap.exp: Adjust to spawn_wait_for_attach returning a spawn id instead of a pid. Use spawn_id_get_pid and kill_wait_spawned_process. * gdb.base/valgrind-infcall.exp: Likewise. * gdb.multi/multi-attach.exp: Likewise. * gdb.python/py-prompt.exp: Likewise. * gdb.python/py-sync-interp.exp: Likewise. * gdb.server/ext-attach.exp: Likewise. * gdb.threads/attach-into-signal.exp (corefunc): Use spawn_wait_for_attach, spawn_id_get_pid and kill_wait_spawned_process. * gdb.threads/attach-many-short-lived-threads.exp: Adjust to spawn_wait_for_attach returning a spawn id instead of a pid. Use spawn_id_get_pid and kill_wait_spawned_process. * gdb.threads/attach-stopped.exp (corefunc): Use spawn_wait_for_attach, spawn_id_get_pid and kill_wait_spawned_process. * gdb.base/break-interp.exp: Rename $res to $test_spawn_id. Use spawn_id_get_pid. Wait for spawn id after eof. Use kill_wait_spawned_process instead of explicit "kill -9". * lib/gdb.exp (can_spawn_for_attach): Adjust comment. (kill_wait_spawned_process, spawn_id_get_pid): New procedures. (spawn_wait_for_attach): Use spawn instead of exec to spawn processes. Don't map cygwin/windows pids here. Now returns a spawn id list.
2015-07-31 21:06:24 +02:00
kill_wait_spawned_process $test_spawn_id
return
}
}
if {$relink_args == ""} {
test_attach_gdb $exec $pid $displacement "attach"
} else {
# These could be rather passed as arguments.
global interp_saved interp
foreach relink {YES NO} {
# Formerly this test was testing only prelinking of $EXEC. As the
# prelink command automatically prelinks all of $EXEC's libraries,
# even $INTERP got prelinked. Therefore, we formerly had to
# `[file_copy $interp_saved $interp]' to make $INTERP not affected
# by this prelinking of $EXEC.
#
# But now we need to test even prelinking of $INTERP. We could
# create a separate test to test just the $INTERP prelinking. For
# test simplicity, we merged this test and the test above by not
# restoring $INTERP after $EXEC prelink. $INTERP gets restored
# later below.
#
# `(wrong library or version mismatch?)' messages are printed for
# $binfile_lib on platforms converting REL->RELA relocations by
# prelink (such as on i386). There is no reliable way to verify
# the library file matches the running library in such case but
# GDB at least attempts to set the right displacement. We test
# `libfunc' is present in the backtrace and therefore the
# displacement has been guessed right.
if [prelink$relink $relink_args [file tail $exec]] {
# /proc/PID/exe cannot be loaded as it is "EXECNAME (deleted)".
test_attach_gdb $exec $pid $displacement "attach-relink$relink"
}
}
file_copy $interp_saved $interp
}
testsuite: tcl exec& -> 'kill -9 $pid' is racy (attach-many-short-lived-thread.exp races and others) The buildbots show that attach-many-short-lived-thread.exp is racy. But after staring at debug logs and playing with SystemTap scripts for a (long) while, I figured out that neither GDB, nor the kernel nor the test's program itself are at fault. The problem is simply that the testsuite machinery is currently subject to PID-reuse races. The attach-many-short-lived-threads.c test program just happens to be much more susceptible to trigger this race because threads and processes share the same number space on Linux, and the test spawns many many short lived threads in succession, thus enlarging the race window a lot. Part of the problem is that several tests spawn processes with "exec&" (in order to test the "attach" command) , and then at the end of the test, to make sure things are cleaned up, issue a 'remote_spawn "kill -p $testpid"'. Since with tcl's "exec&", tcl itself is responsible for reaping the process's exit status, when we go kill the process, testpid may have already exited _and_ its status may have (and often has) been reaped already. Thus it can happen that another process meanwhile reuses $testpid, and that "kill" command kills the wrong process... Frequently, that happens to be attach-many-short-lived-thread, but this explains other test's races as well. In the attach-many-short-lived-threads test, it sometimes manifests like this: (gdb) file /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.threads/attach-many-short-lived-threads Reading symbols from /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.threads/attach-many-short-lived-threads...done. (gdb) Loaded /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.threads/attach-many-short-lived-threads into /home/pedro/gdb/mygit/build/gdb/testsuite/../../gdb/gdb attach 5940 Attaching to program: /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.threads/attach-many-short-lived-threads, process 5940 warning: process 5940 is a zombie - the process has already terminated ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ptrace: Operation not permitted. (gdb) PASS: gdb.threads/attach-many-short-lived-threads.exp: iter 1: attach info threads No threads. (gdb) PASS: gdb.threads/attach-many-short-lived-threads.exp: iter 1: no new threads set breakpoint always-inserted on (gdb) PASS: gdb.threads/attach-many-short-lived-threads.exp: iter 1: set breakpoint always-inserted on Other times the process dies while the test is ongoing (the process is ptrace-stopped): (gdb) print again = 1 Cannot access memory at address 0x6020cc (gdb) FAIL: gdb.threads/attach-many-short-lived-threads.exp: iter 2: reset timer in the inferior (Recall that on Linux, SIGKILL is not interceptable) And other times it dies just while we're detaching: $4 = 319 (gdb) PASS: gdb.threads/attach-many-short-lived-threads.exp: iter 2: print seconds_left detach Can't detach Thread 0x7fb13b7de700 (LWP 1842): No such process (gdb) FAIL: gdb.threads/attach-many-short-lived-threads.exp: iter 2: detach GDB mishandles the latter (it should ignore ESRCH while detaching just like when continuing), but that's another story. The fix here is to change spawn_wait_for_attach to use Expect's 'spawn' command instead of Tcl's 'exec&' to spawn programs, because with spawn we control when to wait for/reap the process. That allows killing the process by PID without being subject to pid-reuse races, because even if the process is already dead, the kernel won't reuse the process's PID until the zombie is reaped. The other part of the problem lies in DejaGnu itself, unfortunately. I have occasionally seen tests (attach-many-short-lived-threads included, but not only that one) die with a random inexplicable SIGTERM too, and that too is caused by the same reason, except that in that case, the rogue SIGTERM is sent from this bit in DejaGnu's remote.exp: exec sh -c "exec > /dev/null 2>&1 && (kill -2 $pgid || kill -2 $pid) && sleep 5 && (kill $pgid || kill $pid) && sleep 5 && (kill -9 $pgid || kill -9 $pid) &" ... catch "wait -i $shell_id" Even if the program exits promptly, that whole cascade of kills carries on in the background, thus potentially killing the poor process that manages to reuse $pid... I sent a fix for that to the DejaGnu list: http://lists.gnu.org/archive/html/dejagnu/2015-07/msg00000.html With both patches in place, I haven't seen attach-many-short-lived-threads.exp fail again. Tested on x86_64 Fedora 20, native, gdbserver and extended-gdbserver. gdb/testsuite/ChangeLog: 2015-07-31 Pedro Alves <palves@redhat.com> * gdb.base/attach-pie-misread.exp: Rename $res to $test_spawn_id. Use spawn_id_get_pid. Wait for spawn id after eof. Use kill_wait_spawned_process instead of explicit "kill -9". * gdb.base/attach-pie-noexec.exp: Adjust to spawn_wait_for_attach returning a spawn id instead of a pid. Use spawn_id_get_pid and kill_wait_spawned_process. * gdb.base/attach-twice.exp: Likewise. * gdb.base/attach.exp: Likewise. (do_command_attach_tests): Use gdb_spawn_with_cmdline_opts and gdb_test_multiple. * gdb.base/solib-overlap.exp: Adjust to spawn_wait_for_attach returning a spawn id instead of a pid. Use spawn_id_get_pid and kill_wait_spawned_process. * gdb.base/valgrind-infcall.exp: Likewise. * gdb.multi/multi-attach.exp: Likewise. * gdb.python/py-prompt.exp: Likewise. * gdb.python/py-sync-interp.exp: Likewise. * gdb.server/ext-attach.exp: Likewise. * gdb.threads/attach-into-signal.exp (corefunc): Use spawn_wait_for_attach, spawn_id_get_pid and kill_wait_spawned_process. * gdb.threads/attach-many-short-lived-threads.exp: Adjust to spawn_wait_for_attach returning a spawn id instead of a pid. Use spawn_id_get_pid and kill_wait_spawned_process. * gdb.threads/attach-stopped.exp (corefunc): Use spawn_wait_for_attach, spawn_id_get_pid and kill_wait_spawned_process. * gdb.base/break-interp.exp: Rename $res to $test_spawn_id. Use spawn_id_get_pid. Wait for spawn id after eof. Use kill_wait_spawned_process instead of explicit "kill -9". * lib/gdb.exp (can_spawn_for_attach): Adjust comment. (kill_wait_spawned_process, spawn_id_get_pid): New procedures. (spawn_wait_for_attach): Use spawn instead of exec to spawn processes. Don't map cygwin/windows pids here. Now returns a spawn id list.
2015-07-31 21:06:24 +02:00
kill_wait_spawned_process $test_spawn_id
}
proc test_ld {file ifmain trynosym displacement} {
global srcdir subdir gdb_prompt expect_out inferior_exited_re solib_bp
# First test normal `file'-command loaded $FILE with symbols.
gdb_exit
gdb_start
# Clear it to never find any separate debug infos in $debug_root.
2010-06-01 Michael Snyder <msnyder@vmware.com> * gdb.base/arithmet.exp: Use gdb_test_no_output. * gdb.base/arrayidx.exp: Ditto. * gdb.base/attach.exp: Ditto. * gdb.base/auxv.exp: Ditto. * gdb.base/bigcre.exp: Ditto. * gdb.base/break-always.exp: Ditto. * gdb.base/break-interp.exp: Ditto. * gdb.base/break.exp: Ditto. * gdb.base/breakpoint-shadow.exp: Ditto. * gdb.base/call-ar-st.exp: Ditto. * gdb.base/call-sc.exp: Ditto. * gdb.base/call-signal-resume.exp: Ditto. * gdb.base/callfuncs.exp: Ditto. * gdb.base/catch-syscall.exp: Ditto. * gdb.base/charset.exp: Ditto. * gdb.base/code-expr.exp: Ditto. * gdb.base/commands.exp: Ditto. * gdb.base/cond-expr.exp: Ditto. * gdb.base/condbreak.exp: Ditto. * gdb.base/cursal.exp: Ditto. * gdb.base/cvexpr.exp: Ditto. * gdb.base/default.exp: Ditto. * gdb.base/del.exp: Ditto. * gdb.base/detach.exp: Ditto. * gdb.base/display.exp: Ditto. * gdb.base/ena-dis-br.exp: Ditto. * gdb.base/eval-skip.exp: Ditto. * gdb.base/foll-fork.exp: Ditto. * gdb.base/foll-vfork.exp: Ditto. * gdb.base/frame-args.exp: Ditto. * gdb.base/funcargs.exp: Ditto. * gdb.base/gcore-buffer-overflow.exp: Ditto. * gdb.base/gdbvars.exp: Ditto. * gdb.base/help.exp: Ditto. * gdb.base/ifelse.exp: Ditto. * gdb.base/included.exp: Ditto. * gdb.base/list.exp: Ditto. * gdb.base/macscp.exp: Ditto. * gdb.base/maint.exp: Ditto. * gdb.base/multi-fork.exp: Ditto. * gdb.base/overlays.exp: Ditto. * gdb.base/page.exp: Ditto. * gdb.base/pending.exp: Ditto. * gdb.base/pointers.exp: Ditto. * gdb.base/pr11022.exp: Ditto. * gdb.base/prelink.exp: Ditto. * gdb.base/printcmds.exp: Ditto. * gdb.base/psymtab.exp: Ditto. * gdb.base/randomize.exp: Ditto. * gdb.base/relational.exp: Ditto. * gdb.base/relocate.exp: Ditto. * gdb.base/remote.exp: Ditto. * gdb.base/sepdebug.exp: Ditto. * gdb.base/set-lang-auto.exp: Ditto. * gdb.base/setshow.exp: Ditto. * gdb.base/setvar.exp: Ditto. * gdb.base/signals.exp: Ditto. * gdb.base/signull.exp: Ditto. * gdb.base/sigstep.exp: Ditto. * gdb.base/sizeof.exp: Ditto. * gdb.base/solib-disc.exp: Ditto. * gdb.base/store.exp: Ditto. * gdb.base/structs.exp: Ditto. * gdb.base/structs2.exp: Ditto. * gdb.base/subst.exp: Ditto. * gdb.base/term.exp: Ditto. * gdb.base/trace-commands.exp: Ditto. * gdb.base/unwindonsignal.exp: Ditto. * gdb.base/valgrind-db-attach.exp: Ditto. * gdb.base/varargs.exp: Ditto. * gdb.base/watch-cond.exp: Ditto. * gdb.base/watch_thread_num.exp: Ditto. * gdb.base/watchpoint-cond-gone.exp: Ditto. * gdb.base/watchpoint.exp: Ditto. * gdb.base/whatis-exp.exp: Ditto.
2010-06-01 23:29:21 +02:00
gdb_test_no_output "set debug-file-directory"
gdb_reinitialize_dir $srcdir/$subdir
gdb_load $file
# Print the "PIE (Position Independent Executable) displacement" message.
2010-06-01 Michael Snyder <msnyder@vmware.com> * gdb.base/arithmet.exp: Use gdb_test_no_output. * gdb.base/arrayidx.exp: Ditto. * gdb.base/attach.exp: Ditto. * gdb.base/auxv.exp: Ditto. * gdb.base/bigcre.exp: Ditto. * gdb.base/break-always.exp: Ditto. * gdb.base/break-interp.exp: Ditto. * gdb.base/break.exp: Ditto. * gdb.base/breakpoint-shadow.exp: Ditto. * gdb.base/call-ar-st.exp: Ditto. * gdb.base/call-sc.exp: Ditto. * gdb.base/call-signal-resume.exp: Ditto. * gdb.base/callfuncs.exp: Ditto. * gdb.base/catch-syscall.exp: Ditto. * gdb.base/charset.exp: Ditto. * gdb.base/code-expr.exp: Ditto. * gdb.base/commands.exp: Ditto. * gdb.base/cond-expr.exp: Ditto. * gdb.base/condbreak.exp: Ditto. * gdb.base/cursal.exp: Ditto. * gdb.base/cvexpr.exp: Ditto. * gdb.base/default.exp: Ditto. * gdb.base/del.exp: Ditto. * gdb.base/detach.exp: Ditto. * gdb.base/display.exp: Ditto. * gdb.base/ena-dis-br.exp: Ditto. * gdb.base/eval-skip.exp: Ditto. * gdb.base/foll-fork.exp: Ditto. * gdb.base/foll-vfork.exp: Ditto. * gdb.base/frame-args.exp: Ditto. * gdb.base/funcargs.exp: Ditto. * gdb.base/gcore-buffer-overflow.exp: Ditto. * gdb.base/gdbvars.exp: Ditto. * gdb.base/help.exp: Ditto. * gdb.base/ifelse.exp: Ditto. * gdb.base/included.exp: Ditto. * gdb.base/list.exp: Ditto. * gdb.base/macscp.exp: Ditto. * gdb.base/maint.exp: Ditto. * gdb.base/multi-fork.exp: Ditto. * gdb.base/overlays.exp: Ditto. * gdb.base/page.exp: Ditto. * gdb.base/pending.exp: Ditto. * gdb.base/pointers.exp: Ditto. * gdb.base/pr11022.exp: Ditto. * gdb.base/prelink.exp: Ditto. * gdb.base/printcmds.exp: Ditto. * gdb.base/psymtab.exp: Ditto. * gdb.base/randomize.exp: Ditto. * gdb.base/relational.exp: Ditto. * gdb.base/relocate.exp: Ditto. * gdb.base/remote.exp: Ditto. * gdb.base/sepdebug.exp: Ditto. * gdb.base/set-lang-auto.exp: Ditto. * gdb.base/setshow.exp: Ditto. * gdb.base/setvar.exp: Ditto. * gdb.base/signals.exp: Ditto. * gdb.base/signull.exp: Ditto. * gdb.base/sigstep.exp: Ditto. * gdb.base/sizeof.exp: Ditto. * gdb.base/solib-disc.exp: Ditto. * gdb.base/store.exp: Ditto. * gdb.base/structs.exp: Ditto. * gdb.base/structs2.exp: Ditto. * gdb.base/subst.exp: Ditto. * gdb.base/term.exp: Ditto. * gdb.base/trace-commands.exp: Ditto. * gdb.base/unwindonsignal.exp: Ditto. * gdb.base/valgrind-db-attach.exp: Ditto. * gdb.base/varargs.exp: Ditto. * gdb.base/watch-cond.exp: Ditto. * gdb.base/watch_thread_num.exp: Ditto. * gdb.base/watchpoint-cond-gone.exp: Ditto. * gdb.base/watchpoint.exp: Ditto. * gdb.base/whatis-exp.exp: Ditto.
2010-06-01 23:29:21 +02:00
gdb_test_no_output "set verbose on"
# We want to test the re-run of a PIE in the case where the executable
# is loaded with a different displacement, but disable-randomization
# prevents that from happening. So turn it off.
gdb_test "set disable-randomization off"
if $ifmain {
gdb_test_no_output "set args segv"
} else {
global binfile_test
# ld.so needs some executable to run to reach _dl_debug_state.
gdb_test_no_output "set args [standard_output_file $binfile_test]" \
"set args OBJDIR/${subdir}/$binfile_test"
}
reach $solib_bp "run" $displacement
gdb_test "bt" "#0 +\[^\r\n\]*\\m(__GI_)?$solib_bp\\M.*" "dl bt"
if $ifmain {
reach "main" continue "NONE"
reach "libfunc" continue "NONE"
gdb_test "bt" "#0 +\[^\r\n\]*\\mlibfunc\\M\[^\r\n\]*\r\n#1 +\[^\r\n\]*\\mmain\\M.*" "main bt"
}
# Try re-run if the new PIE displacement takes effect.
gdb_test "kill" "" "kill" {Kill the program being debugged\? \(y or n\) } "y"
reach $solib_bp "run" $displacement
if $ifmain {
test_core $file $displacement
test_attach $file $displacement
}
if !$trynosym {
return
}
with_test_prefix "symbol-less" {
# Test also `exec-file'-command loaded $FILE - therefore
# without symbols. SYMBOL_OBJFILE is not available and only
# EXEC_BFD must be used.
gdb_exit
gdb_start
# Clear it to never find any separate debug infos in $debug_root.
gdb_test_no_output "set debug-file-directory"
gdb_reinitialize_dir $srcdir/$subdir
# Print the "PIE (Position Independent Executable)
# displacement" message.
gdb_test_no_output "set verbose on"
# Test no (error) message has been printed by `exec-file'.
set escapedfile [string_to_regexp $file]
gdb_test "exec-file $file" "exec-file $escapedfile" "load"
if $ifmain {
reach $solib_bp run $displacement
# Use two separate gdb_test_multiple statements to avoid timeouts due
# to slow processing of wildcard capturing long output
set test "info files"
set entrynohex ""
gdb_test_multiple $test $test {
-re "\r\n\[\t \]*Entry point:\[\t \]*0x(\[0-9a-f\]+)\r\n" {
set entrynohex $expect_out(1,string)
gdb_test_multiple "" $test {
-re "\r\n$gdb_prompt $" {
pass $test
}
}
}
}
# `info sym' cannot be tested for .opd as the binary may not have
# symbols.
if {[istarget powerpc64-*] && [is_lp64_target]} {
set test "convert entry point"
gdb_test_multiple "p *(void(*)(void) *) 0x$entrynohex" $test {
-re " =( \\(\[^0-9\]*\\))? 0x(\[0-9a-f\]+)( < \[^\r\n\]*)?\r\n$gdb_prompt $" {
set entrynohex $expect_out(2,string)
pass $test
}
}
}
if {$entrynohex != ""} {
gdb_test "break *0x$entrynohex" "" "break at entry point"
gdb_test "continue" "\r\nBreakpoint \[0-9\]+, 0x0*$entrynohex in .*" "entry point reached"
}
} else {
# There is no symbol to break at ld.so. Moreover it can
# exit with an error code.
set test "ld.so exit"
set test_displacement "seen displacement message as $displacement"
gdb_test_multiple "run" $test {
-re "Using PIE \\(Position Independent Executable\\) displacement (0x\[0-9a-f\]+) " {
# Missing "$gdb_prompt $" is intentional.
if {$expect_out(1,string) == "0x0"} {
set case "ZERO"
} else {
set case "NONZERO"
}
if {$displacement == $case || $displacement == "PRESENT"} {
pass $test_displacement
set displacement "FOUND-$displacement"
} else {
fail $test_displacement
}
exp_continue
}
-re "$inferior_exited_re (normally|with code \[0-9\]+).\r\n$gdb_prompt $" {
# Do not check the binary filename as it may be truncated.
pass $test
}
}
if ![regexp {^(NONE|FOUND-.*)$} $displacement] {
fail $test_displacement
}
}
}
}
# Create separate binaries for each testcase - to make the possible reported
# problem reproducible after the whole test run finishes.
foreach ldprelink {NO YES} {
foreach ldsepdebug {NO IN SEP} {
# Skip running the ldsepdebug test if we do not have system separate
# debug info available.
if {$interp_system_debug == "" && $ldsepdebug == "SEP"} {
continue
}
set ldname "LDprelink${ldprelink}debug${ldsepdebug}"
set interp $binprefix-$ldname
# prelink needs to always prelink all the dependencies to do any file
# modifications of its files. ld.so also needs all the dependencies to
# be prelinked to omit the relocation process. In-memory file offsets
# are not dependent whether ld.so went the prelink way or through the
# relocation process.
#
# For GDB we are not interested whether prelink succeeds as it is
# transparent to GDB. GDB is being tested for differences of file
# offsets vs. in-memory offsets. So we have to prelink even ld.so for
# the BIN modification to happen but we need to restore the original
# possibly unprelinked ld.so to test all the combinations for GDB.
set interp_saved ${interp}-saved
with_test_prefix "$ldname" {
if {$ldsepdebug == "NO"} {
file_copy $interp_system $interp
# Never call strip-debug before unprelink:
# prelink: ...: Section .note.gnu.build-id created after prelinking
if ![prelinkNO $interp] {
continue
}
strip_debug $interp
} elseif {$ldsepdebug == "IN" && $interp_system_debug == ""} {
file_copy $interp_system $interp
} elseif {$ldsepdebug == "IN" && $interp_system_debug != ""} {
file_copy $interp_system $interp
file_copy $interp_system_debug "${interp}.debug"
# eu-unstrip: DWARF data in '...' not adjusted for prelinking bias; consider prelink -u
if {![prelinkNO $interp] || ![prelinkNO "${interp}.debug"]} {
continue
}
set test "eu-unstrip unprelinked:[file tail $interp_system] + [file tail $interp_system_debug] to [file tail $interp]"
set command "exec eu-unstrip -o $interp $interp ${interp}.debug"
verbose -log "command is $command"
if [catch $command] {
setup_xfail *-*-*
fail $test
continue
} else {
pass $test
}
} elseif {$ldsepdebug == "SEP" && $interp_system_debug == ""} {
file_copy $interp_system $interp
# eu-unstrip: DWARF data in '...' not adjusted for prelinking bias; consider prelink -u
if ![prelinkNO $interp] {
continue
}
gdb_gnu_strip_debug $interp
} elseif {$ldsepdebug == "SEP" && $interp_system_debug != ""} {
file_copy $interp_system $interp
file_copy $interp_system_debug "${interp}.debug"
}
if {$ldsepdebug == "SEP"} {
if ![prelinkNO "${interp}.debug"] {
continue
}
} else {
file delete "${interp}.debug"
}
if ![prelink$ldprelink $interp] {
continue
}
if {$ldprelink == "NO"} {
set displacement "NONZERO"
} else {
# x86* kernel loads prelinked PIE binary at its
# prelinked address but ppc* kernel loads it at a
# random address. prelink normally skips PIE binaries
# during the system scan.
set displacement "PRESENT"
}
test_ld $interp 0 [expr {$ldsepdebug == "NO"}] $displacement
if ![file_copy $interp $interp_saved] {
continue
}
foreach binprelink {NO YES} {
foreach binsepdebug {NO IN SEP} {
# "ATTACH" is like "YES" but it is modified during
# run. It cannot be used for problem
# reproducibility after the testcase ends.
foreach binpie {NO YES ATTACH} {
# This combination is not possible, non-PIE (fixed address)
# binary cannot be prelinked to any (other) address.
if {$binprelink == "YES" && $binpie == "NO"} {
continue
}
set binname "BINprelink${binprelink}debug${binsepdebug}pie${binpie}"
set exec $binprefix-$binname
with_test_prefix "$binname" {
set opts "ldflags=-Wl,$binfile_lib,-rpath,[file dirname $binfile_lib]"
if {$binsepdebug != "NO"} {
lappend opts {debug}
}
if {$binpie != "NO"} {
lappend opts {additional_flags=-fPIE}
lappend opts {ldflags=-pie}
}
set dir ${exec}.d
set relink_args [build_executable_own_libs ${test}.exp [file tail $exec] $srcfile $opts $interp $dir]
if {$relink_args == ""} {
Remove superfluous semicolons from testsuite throughout. A few months ago semicolons after "return" were removed throughout the testsuite. However, as I pointed out in review, they're unnecessary not just after "return", but pretty much after any tcl command. ';' is the command separator, and you only need it if there's another command on the same line afterwards. This patch was written by running: $ find . -name "*.exp" | xargs grep -l ";\s*$" | xargs sed -i 's/\([^#][^\s*;]*\)\s*;\s*$/\1/' and then undoing changes to comments, and lib/future.exp. Tested on x86_64 Fedora 17. gdb/testsuite/ 2013-06-07 Pedro Alves <palves@redhat.com> * boards/native-extended-gdbserver.exp: Remove semicolon. * config/arm-ice.exp: Likewise. * config/bfin.exp: Likewise. * config/cygmon.exp: Likewise. * config/h8300.exp: Likewise. * config/monitor.exp: Likewise. * config/sid.exp: Likewise. * config/sim.exp: Likewise. * config/slite.exp: Likewise. * config/vx.exp: Likewise. * gdb.arch/i386-bp_permanent.exp: Likewise. * gdb.asm/asm-source.exp: Likewise. * gdb.base/args.exp: Likewise. * gdb.base/attach-pie-misread.exp: Likewise. * gdb.base/auxv.exp: Likewise. * gdb.base/bigcore.exp: Likewise. * gdb.base/bitfields2.exp: Likewise. * gdb.base/bitfields.exp: Likewise. * gdb.base/break.exp: Likewise. * gdb.base/break-interp.exp: Likewise. * gdb.base/callfuncs.exp: Likewise. * gdb.base/call-sc.exp: Likewise. * gdb.base/commands.exp: Likewise. * gdb.base/corefile.exp: Likewise. * gdb.base/dbx.exp: Likewise. * gdb.base/ending-run.exp: Likewise. * gdb.base/exprs.exp: Likewise. * gdb.base/funcargs.exp: Likewise. * gdb.base/hbreak2.exp: Likewise. * gdb.base/huge.exp: Likewise. * gdb.base/list.exp: Likewise. * gdb.base/memattr.exp: Likewise. * gdb.base/overlays.exp: Likewise. * gdb.base/printcmds.exp: Likewise. * gdb.base/recurse.exp: Likewise. * gdb.base/remotetimeout.exp: Likewise. * gdb.base/reread.exp: Likewise. * gdb.base/savedregs.exp: Likewise. * gdb.base/scope.exp: Likewise. * gdb.base/sepdebug.exp: Likewise. * gdb.base/setshow.exp: Likewise. * gdb.base/setvar.exp: Likewise. * gdb.base/sigaltstack.exp: Likewise. * gdb.base/siginfo-addr.exp: Likewise. * gdb.base/siginfo.exp: Likewise. * gdb.base/siginfo-obj.exp: Likewise. * gdb.base/sigrepeat.exp: Likewise. * gdb.base/sigstep.exp: Likewise. * gdb.base/structs.exp: Likewise. * gdb.base/testenv.exp: Likewise. * gdb.base/twice.exp: Likewise. * gdb.base/valgrind-db-attach.exp: Likewise. * gdb.base/valgrind-infcall.exp: Likewise. * gdb.base/varargs.exp: Likewise. * gdb.base/watchpoint.exp: Likewise. * gdb.cp/gdb1355.exp: Likewise. * gdb.cp/misc.exp: Likewise. * gdb.disasm/hppa.exp: Likewise. * gdb.disasm/t01_mov.exp: Likewise. * gdb.disasm/t02_mova.exp: Likewise. * gdb.disasm/t03_add.exp: Likewise. * gdb.disasm/t04_sub.exp: Likewise. * gdb.disasm/t05_cmp.exp: Likewise. * gdb.disasm/t06_ari2.exp: Likewise. * gdb.disasm/t07_ari3.exp: Likewise. * gdb.disasm/t08_or.exp: Likewise. * gdb.disasm/t09_xor.exp: Likewise. * gdb.disasm/t10_and.exp: Likewise. * gdb.disasm/t11_logs.exp: Likewise. * gdb.disasm/t12_bit.exp: Likewise. * gdb.disasm/t13_otr.exp: Likewise. * gdb.gdb/selftest.exp: Likewise. * gdb.hp/gdb.base-hp/callfwmall.exp: Likewise. * gdb.mi/mi-reverse.exp: Likewise. * gdb.pascal/floats.exp: Likewise. * gdb.python/py-inferior.exp: Likewise. * gdb.threads/attach-into-signal.exp: Likewise. * gdb.threads/pthreads.exp: Likewise. * gdb.threads/thread_events.exp: Likewise. * gdb.threads/watchthreads.exp: Likewise. * gdb.trace/actions-changed.exp: Likewise. * gdb.trace/actions.exp: Likewise. * gdb.trace/ax.exp: Likewise. * gdb.trace/backtrace.exp: Likewise. * gdb.trace/change-loc.exp: Likewise. * gdb.trace/deltrace.exp: Likewise. * gdb.trace/disconnected-tracing.exp: Likewise. * gdb.trace/ftrace.exp: Likewise. * gdb.trace/infotrace.exp: Likewise. * gdb.trace/passc-dyn.exp: Likewise. * gdb.trace/passcount.exp: Likewise. * gdb.trace/pending.exp: Likewise. * gdb.trace/qtro.exp: Likewise. * gdb.trace/range-stepping.exp: Likewise. * gdb.trace/report.exp: Likewise. * gdb.trace/save-trace.exp: Likewise. * gdb.trace/status-stop.exp: Likewise. * gdb.trace/strace.exp: Likewise. * gdb.trace/tfile.exp: Likewise. * gdb.trace/tfind.exp: Likewise. * gdb.trace/trace-break.exp: Likewise. * gdb.trace/tracecmd.exp: Likewise. * gdb.trace/trace-mt.exp: Likewise. * gdb.trace/tspeed.exp: Likewise. * gdb.trace/tsv.exp: Likewise. * gdb.trace/while-stepping.exp: Likewise. * lib/gdb.exp: Likewise. * lib/gdbserver-support.exp: Likewise. * lib/java.exp: Likewise. * lib/mi-support.exp: Likewise. * lib/pascal.exp: Likewise. * lib/prompt.exp: Likewise. * lib/trace-support.exp: Likewise.
2013-06-07 19:31:09 +02:00
continue
}
if {$binsepdebug == "SEP"} {
gdb_gnu_strip_debug $exec
}
if {$binpie == "NO"} {
set displacement "NONE"
} elseif {$binprelink == "NO"} {
set displacement "NONZERO"
} else {
# x86* kernel loads prelinked PIE binary at its prelinked
# address but ppc* kernel loads it at a random address.
# prelink normally skips PIE binaries during the system scan.
set displacement "PRESENT"
}
if {[prelink$binprelink $relink_args [file tail $exec]]
&& [file_copy $interp_saved $interp]} {
if {$binpie != "ATTACH"} {
test_ld $exec 1 [expr {$binsepdebug == "NO"}] $displacement
} else {
# If the file has been randomly prelinked it must be
# "NONZERO". We could see "ZERO" only if it was unprelinked
# and it is now running at the same address - which is 0 but
# executable can never run at address 0.
set displacement "NONZERO"
test_attach $exec $displacement $relink_args
# ATTACH means that executables and libraries have been
# modified after they have been run. They cannot be reused
# for problem reproducibility after the testcase ends in
# the ATTACH case. Therefore they are rather deleted not
# to confuse after the run finishes.
set exec_debug [system_debug_get $exec]
if {$exec_debug != ""} {
# `file delete [glob "${exec_debug}*"]' does not work.
foreach f [glob "${exec_debug}*"] {
file delete $f
}
}
file delete -force $dir
# `file delete [glob "${exec}*"]' does not work.
foreach f [glob "${exec}*"] {
file delete $f
}
}
}
}
}
}
}
file delete $interp_saved
}
}
}