public inbox for archer-commits@sourceware.org help / color / mirror / Atom feed
From: jkratoch@sourceware.org To: archer-commits@sourceware.org Subject: [SCM] archer-jankratochvil-misc: New test for valgrind --db-attach=yes; https://bugzilla.redhat.com/show_bug.cgi?id=483262 Date: Wed, 04 Feb 2009 01:28:00 -0000 [thread overview] Message-ID: <20090204012854.675.qmail@sourceware.org> (raw) The branch, archer-jankratochvil-misc has been updated via 8887aadb61d7186ef7721770a34af7976dd2a3f3 (commit) from 6b30aec83c031c7a5ecfe3c8182c894048e74b7d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit 8887aadb61d7186ef7721770a34af7976dd2a3f3 Author: Jan Kratochvil <jan.kratochvil@redhat.com> Date: Wed Feb 4 02:11:46 2009 +0100 New test for valgrind --db-attach=yes; https://bugzilla.redhat.com/show_bug.cgi?id=483262 ----------------------------------------------------------------------- Summary of changes: gdb/testsuite/gdb.base/valgrind-attach.c | 28 ++++++++ gdb/testsuite/gdb.base/valgrind-attach.exp | 94 ++++++++++++++++++++++++++++ gdb/testsuite/gdb.base/valgrind-attach.sh | 20 ++++++ 3 files changed, 142 insertions(+), 0 deletions(-) create mode 100644 gdb/testsuite/gdb.base/valgrind-attach.c create mode 100644 gdb/testsuite/gdb.base/valgrind-attach.exp create mode 100755 gdb/testsuite/gdb.base/valgrind-attach.sh First 500 lines of diff: diff --git a/gdb/testsuite/gdb.base/valgrind-attach.c b/gdb/testsuite/gdb.base/valgrind-attach.c new file mode 100644 index 0000000..84b57db --- /dev/null +++ b/gdb/testsuite/gdb.base/valgrind-attach.c @@ -0,0 +1,28 @@ +/* This testcase is part of GDB, the GNU debugger. + + 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/>. */ + +#include <stdlib.h> + +int +main (void) +{ + int *a = malloc (1); + + a[10] = 0; /* crash-here */ + + return 0; +} diff --git a/gdb/testsuite/gdb.base/valgrind-attach.exp b/gdb/testsuite/gdb.base/valgrind-attach.exp new file mode 100644 index 0000000..1f9b26e --- /dev/null +++ b/gdb/testsuite/gdb.base/valgrind-attach.exp @@ -0,0 +1,94 @@ +# 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 testfile valgrind-attach +set shfile ${testfile}.sh +set srcfile ${testfile}.c +set binfile ${objdir}/${subdir}/${testfile} +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { + untested "Couldn't compile test program" + return -1 +} + +gdb_exit +gdb_stop_suppressing_tests; + +set VALGRIND "valgrind" + +# Syntax for ${shfile} is: <binfile> <valgrind> <db-command-arguments> +set VALGRIND_SPAWN "sh ${srcdir}/${subdir}/${shfile} $binfile $VALGRIND $GDB $INTERNAL_GDBFLAGS $GDBFLAGS [host_info gdb_opts]" + +set test "spawn valgrind" +verbose "Spawning $VALGRIND_SPAWN" + +if [info exists gdb_spawn_id] { + fail $test + return -1 +} + +if ![is_remote host] { + if { [which $VALGRIND] == 0 } then { + untested "Couldn't find $VALGRIND" + return -1 + } +} +set res [remote_spawn host "$VALGRIND_SPAWN"] +if { $res < 0 || $res == "" } { + perror "Spawning $VALGRIND_SPAWN failed." + return -1 +} +set gdb_spawn_id -1; + +gdb_expect { + -re "---- Attach to debugger \\? --- \\\[Return/N/n/Y/y/C/c\\\] ---- $" { + pass $test + } + eof { + perror "(eof) $VALGRIND never initialized" + remote_close host + return -1 + } + timeout { + perror "(timeout) $VALGRIND never initialized" + remote_close host + return -1 + } +} +send_gdb "y\n" + +set test "spawn gdb" +set test2 "crash line caught" +gdb_expect { + -re "starting debugger with cmd:.* in main .* crash-here .*\[\r\n\]$gdb_prompt $" { + pass $test + pass $test2 + } + -re "starting debugger with cmd:.*\[\r\n\]$gdb_prompt $" { + pass $test + fail $test2 + } + eof { + perror "(eof) $GDB never initialized" + remote_close host + return -1 + } + timeout { + perror "(timeout) $GDB never initialized" + remote_close host + return -1 + } +} + +remote_close host diff --git a/gdb/testsuite/gdb.base/valgrind-attach.sh b/gdb/testsuite/gdb.base/valgrind-attach.sh new file mode 100755 index 0000000..f02c6f7 --- /dev/null +++ b/gdb/testsuite/gdb.base/valgrind-attach.sh @@ -0,0 +1,20 @@ +#! /bin/sh + +# 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/>. + +BINFILE="$1"; shift +VALGRIND="$1"; shift +"$VALGRIND" --db-attach=yes --db-command="$* %f %p" "$BINFILE" hooks/post-receive -- Repository for Project Archer.
reply other threads:[~2009-02-04 1:28 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20090204012854.675.qmail@sourceware.org \ --to=jkratoch@sourceware.org \ --cc=archer-commits@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).