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