public inbox for archer-commits@sourceware.org
help / color / mirror / Atom feed
* [SCM] archer-jankratochvil-misc: New test for valgrind --db-attach=yes; https://bugzilla.redhat.com/show_bug.cgi?id=483262
@ 2009-02-04 1:28 jkratoch
0 siblings, 0 replies; only message in thread
From: jkratoch @ 2009-02-04 1:28 UTC (permalink / raw)
To: archer-commits
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.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2009-02-04 1:28 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-04 1:28 [SCM] archer-jankratochvil-misc: New test for valgrind --db-attach=yes; https://bugzilla.redhat.com/show_bug.cgi?id=483262 jkratoch
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).