diff options
author | Jan Kratochvil <jan.kratochvil@redhat.com> | 2010-01-14 21:15:00 +0000 |
---|---|---|
committer | Jan Kratochvil <jan.kratochvil@redhat.com> | 2010-01-14 21:15:00 +0000 |
commit | 9f2982ff0bf5e33d54b085b98970ab15ba4fac46 (patch) | |
tree | cb004329356d337dade67017cf7bb35db6015e38 /gdb/testsuite/gdb.base/valgrind-db-attach.exp | |
parent | gdb/testsuite/ (diff) | |
download | binutils-gdb-9f2982ff0bf5e33d54b085b98970ab15ba4fac46.tar.gz binutils-gdb-9f2982ff0bf5e33d54b085b98970ab15ba4fac46.tar.bz2 binutils-gdb-9f2982ff0bf5e33d54b085b98970ab15ba4fac46.zip |
gdb/
Support Valgrind attachments broken by the PIE support.
* auxv.c: Include gdbcore.h.
(procfs_xfer_auxv): Make static. Reduce its comment. Drop its
parameters ops, object and annex. Remove their assertions.
(ld_so_xfer_auxv, memory_xfer_auxv): New function.
* auxv.h (procfs_xfer_auxv): Remove comment. Rename to ...
(memory_xfer_auxv): ... here.
* linux-nat.c (linux_xfer_partial): Rename procfs_xfer_auxv to
memory_xfer_auxv.
* procfs.c (procfs_xfer_partial): Likewise.
* solib-svr4.c (svr4_relocate_main_executable): New prototype.
(svr4_special_symbol_handling): Call svr4_relocate_main_executable.
(svr4_solib_create_inferior_hook): Conditionalize the
svr4_relocate_main_executable call.
gdb/testsuite/
* gdb.base/valgrind-db-attach.exp, gdb.base/valgrind-db-attach.c: New.
Diffstat (limited to 'gdb/testsuite/gdb.base/valgrind-db-attach.exp')
-rw-r--r-- | gdb/testsuite/gdb.base/valgrind-db-attach.exp | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.base/valgrind-db-attach.exp b/gdb/testsuite/gdb.base/valgrind-db-attach.exp new file mode 100644 index 00000000000..2aa22c1e5ec --- /dev/null +++ b/gdb/testsuite/gdb.base/valgrind-db-attach.exp @@ -0,0 +1,76 @@ +# Copyright 2009 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/>. + +set test valgrind-db-attach +set srcfile $test.c +set executable $test +set binfile ${objdir}/${subdir}/${executable} +if {[build_executable $test.exp $executable $srcfile {debug}] == -1} { + return -1 +} + +gdb_exit + +# remote_spawn breaks the command on each whitespace despite possible quoting. +# Use backslash-escaped whitespace there instead: + +set db_command "--db-command=$GDB $INTERNAL_GDBFLAGS $GDBFLAGS [host_info gdb_opts] %f %p" +regsub -all " " $db_command "\\ " db_command + +set test "spawn valgrind" +set cmd "valgrind --db-attach=yes $db_command $binfile" +set res [remote_spawn host $cmd]; +if { $res < 0 || $res == "" } { + verbose -log "Spawning $cmd failed." + setup_xfail *-*-* + fail $test + return -1 +} +pass $test +# Declare GDB now as running. +set gdb_spawn_id -1 + +set test "valgrind started" +# The trailing '.' differs for different memcheck versions. +gdb_test_multiple "" $test { + -re "Memcheck, a memory error detector\\.?\r\n" { + pass $test + } + -re "valgrind: failed to start tool 'memcheck' for platform '.*': No such file or directory" { + setup_xfail *-*-* + fail $test + return -1 + } +} + +set double_free [gdb_get_line_number "double-free"] + +gdb_test_multiple "" $test { + -re "Invalid free\\(\\) / delete / delete\\\[\\\]\r\n.*: main \\(${srcfile}:$double_free\\)\r\n.*---- Attach to debugger \\? --- \[^\r\n\]* ---- " { + send_gdb "y\r" + } + -re "---- Attach to debugger \\? --- \[^\r\n\]* ---- " { + send_gdb "n\r" + exp_continue + } +} + +gdb_test "" "" "eat first prompt" + +# Initialization from default_gdb_start. +gdb_test "set height 0" +gdb_test "set width 0" + +gdb_test "bt" "in main \\(.*\\) at .*${srcfile}:$double_free" |