Blame SOURCES/gdb-6.3-attach-see-vdso-test.patch

f9426a
--- /dev/null	1 Jan 1970 00:00:00 -0000
f9426a
+++ ./gdb/testsuite/gdb.base/attach-see-vdso.c	6 Jul 2007 14:14:44 -0000
f9426a
@@ -0,0 +1,25 @@
f9426a
+/* This testcase is part of GDB, the GNU debugger.
f9426a
+
f9426a
+   Copyright 2007 Free Software Foundation, Inc.
f9426a
+
f9426a
+   This program is free software; you can redistribute it and/or modify
f9426a
+   it under the terms of the GNU General Public License as published by
f9426a
+   the Free Software Foundation; either version 2 of the License, or
f9426a
+   (at your option) any later version.
f9426a
+
f9426a
+   This program is distributed in the hope that it will be useful,
f9426a
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
f9426a
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
f9426a
+   GNU General Public License for more details.
f9426a
+ 
f9426a
+   You should have received a copy of the GNU General Public License
f9426a
+   along with this program; if not, write to the Free Software
f9426a
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
f9426a
+
f9426a
+#include <unistd.h>
f9426a
+
f9426a
+int main ()
f9426a
+{
f9426a
+  pause ();
f9426a
+  return 1;
f9426a
+}
f9426a
--- /dev/null	1 Jan 1970 00:00:00 -0000
f9426a
+++ ./gdb/testsuite/gdb.base/attach-see-vdso.exp	6 Jul 2007 14:14:44 -0000
f9426a
@@ -0,0 +1,72 @@
f9426a
+# Copyright 2007
f9426a
+
f9426a
+# This program is free software; you can redistribute it and/or modify
f9426a
+# it under the terms of the GNU General Public License as published by
f9426a
+# the Free Software Foundation; either version 2 of the License, or
f9426a
+# (at your option) any later version.
f9426a
+# 
f9426a
+# This program is distributed in the hope that it will be useful,
f9426a
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
f9426a
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
f9426a
+# GNU General Public License for more details.
f9426a
+# 
f9426a
+# You should have received a copy of the GNU General Public License
f9426a
+# along with this program; if not, write to the Free Software
f9426a
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
f9426a
+
f9426a
+# This file was created by Jan Kratochvil <jan.kratochvil@redhat.com>.
f9426a
+
f9426a
+# This test only works on Linux
f9426a
+if { ![istarget "*-*-linux-gnu*"] } {
f9426a
+    return 0
f9426a
+}
f9426a
+
f9426a
+set testfile "attach-see-vdso"
f9426a
+set srcfile  ${testfile}.c
f9426a
+set binfile  ${objdir}/${subdir}/${testfile}
f9426a
+set escapedbinfile  [string_to_regexp ${objdir}/${subdir}/${testfile}]
f9426a
+
f9426a
+# The kernel VDSO is used for the syscalls returns only on i386 (not x86_64).
f9426a
+#
f9426a
+if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-m32}] != "" } {
f9426a
+    gdb_suppress_entire_file "Testcase nonthraded compile failed, so all tests in this file will automatically fail."
f9426a
+}
f9426a
+
f9426a
+if [get_compiler_info ${binfile}] {
f9426a
+    return -1
f9426a
+}
f9426a
+
f9426a
+# Start the program running and then wait for a bit, to be sure
f9426a
+# that it can be attached to.
f9426a
+
f9426a
+set testpid [eval exec $binfile &]
f9426a
+
f9426a
+# Avoid some race:
f9426a
+sleep 2
f9426a
+
f9426a
+# Start with clean gdb
f9426a
+gdb_exit
f9426a
+gdb_start
f9426a
+gdb_reinitialize_dir $srcdir/$subdir
f9426a
+# Never call: gdb_load ${binfile}
f9426a
+# as the former problem would not reproduce otherwise.
f9426a
+
f9426a
+set test "attach"
f9426a
+gdb_test_multiple "attach $testpid" "$test" {
f9426a
+    -re "Attaching to process $testpid\r?\n.*$gdb_prompt $" {
f9426a
+	pass "$test"
f9426a
+    }
f9426a
+}
f9426a
+
f9426a
+gdb_test "bt" "#0 *0x\[0-9a-f\]* in \[^?\].*" "backtrace decodes VDSO"
f9426a
+
f9426a
+# Exit and detach the process.
f9426a
+   
f9426a
+gdb_exit
f9426a
+
f9426a
+# Make sure we don't leave a process around to confuse
f9426a
+# the next test run (and prevent the compile by keeping
f9426a
+# the text file busy), in case the "set should_exit" didn't
f9426a
+# work.
f9426a
+   
f9426a
+remote_exec build "kill -9 ${testpid}"