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