You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
121 lines
3.9 KiB
121 lines
3.9 KiB
2 years ago
|
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||
|
From: Fedora GDB patches <invalid@email.com>
|
||
|
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||
|
Subject: gdb-6.3-attach-see-vdso-test.patch
|
||
|
|
||
|
;; Test kernel VDSO decoding while attaching to an i386 process.
|
||
|
;;=fedoratest
|
||
|
|
||
|
diff --git a/gdb/testsuite/gdb.base/attach-see-vdso.c b/gdb/testsuite/gdb.base/attach-see-vdso.c
|
||
|
new file mode 100644
|
||
|
--- /dev/null
|
||
|
+++ b/gdb/testsuite/gdb.base/attach-see-vdso.c
|
||
|
@@ -0,0 +1,25 @@
|
||
|
+/* This testcase is part of GDB, the GNU debugger.
|
||
|
+
|
||
|
+ Copyright 2007 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 2 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, write to the Free Software
|
||
|
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||
|
+
|
||
|
+#include <unistd.h>
|
||
|
+
|
||
|
+int main ()
|
||
|
+{
|
||
|
+ pause ();
|
||
|
+ return 1;
|
||
|
+}
|
||
|
diff --git a/gdb/testsuite/gdb.base/attach-see-vdso.exp b/gdb/testsuite/gdb.base/attach-see-vdso.exp
|
||
|
new file mode 100644
|
||
|
--- /dev/null
|
||
|
+++ b/gdb/testsuite/gdb.base/attach-see-vdso.exp
|
||
|
@@ -0,0 +1,77 @@
|
||
|
+# Copyright 2007
|
||
|
+
|
||
|
+# 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 2 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, write to the Free Software
|
||
|
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||
|
+
|
||
|
+# This file was created by Jan Kratochvil <jan.kratochvil@redhat.com>.
|
||
|
+
|
||
|
+# This test only works on Linux
|
||
|
+if { ![istarget "*-*-linux-gnu*"] } {
|
||
|
+ return 0
|
||
|
+}
|
||
|
+
|
||
|
+if {[use_gdb_stub]} {
|
||
|
+ untested "skipping test because of use_gdb_stub"
|
||
|
+ return -1
|
||
|
+}
|
||
|
+
|
||
|
+set testfile "attach-see-vdso"
|
||
|
+set srcfile ${testfile}.c
|
||
|
+set binfile [standard_output_file ${testfile}]
|
||
|
+set escapedbinfile [string_to_regexp [standard_output_file ${testfile}]]
|
||
|
+
|
||
|
+# The kernel VDSO is used for the syscalls returns only on i386 (not x86_64).
|
||
|
+#
|
||
|
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-m32}] != "" } {
|
||
|
+ gdb_suppress_entire_file "Testcase nonthraded compile failed, so all tests in this file will automatically fail."
|
||
|
+}
|
||
|
+
|
||
|
+if [get_compiler_info ${binfile}] {
|
||
|
+ return -1
|
||
|
+}
|
||
|
+
|
||
|
+# Start the program running and then wait for a bit, to be sure
|
||
|
+# that it can be attached to.
|
||
|
+
|
||
|
+set testpid [eval exec $binfile &]
|
||
|
+
|
||
|
+# Avoid some race:
|
||
|
+sleep 2
|
||
|
+
|
||
|
+# Start with clean gdb
|
||
|
+gdb_exit
|
||
|
+gdb_start
|
||
|
+gdb_reinitialize_dir $srcdir/$subdir
|
||
|
+# Never call: gdb_load ${binfile}
|
||
|
+# as the former problem would not reproduce otherwise.
|
||
|
+
|
||
|
+set test "attach"
|
||
|
+gdb_test_multiple "attach $testpid" "$test" {
|
||
|
+ -re "Attaching to process $testpid\r?\n.*$gdb_prompt $" {
|
||
|
+ pass "$test"
|
||
|
+ }
|
||
|
+}
|
||
|
+
|
||
|
+gdb_test "bt" "#0 *0x\[0-9a-f\]* in \[^?\].*" "backtrace decodes VDSO"
|
||
|
+
|
||
|
+# Exit and detach the process.
|
||
|
+
|
||
|
+gdb_exit
|
||
|
+
|
||
|
+# Make sure we don't leave a process around to confuse
|
||
|
+# the next test run (and prevent the compile by keeping
|
||
|
+# the text file busy), in case the "set should_exit" didn't
|
||
|
+# work.
|
||
|
+
|
||
|
+remote_exec build "kill -9 ${testpid}"
|