Blame SOURCES/gdb-rhbz-818343-set-solib-absolute-prefix-testcase.patch

a8223e
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
a8223e
From: Fedora GDB patches <invalid@email.com>
a8223e
Date: Fri, 27 Oct 2017 21:07:50 +0200
a8223e
Subject: gdb-rhbz-818343-set-solib-absolute-prefix-testcase.patch
a8223e
a8223e
;; Testcase for `Setting solib-absolute-prefix breaks vDSO' (BZ 818343).
a8223e
;;=fedoratest
a8223e
a8223e
diff --git a/gdb/testsuite/gdb.base/set-solib-absolute-prefix.c b/gdb/testsuite/gdb.base/set-solib-absolute-prefix.c
a8223e
new file mode 100644
a8223e
--- /dev/null
a8223e
+++ b/gdb/testsuite/gdb.base/set-solib-absolute-prefix.c
a8223e
@@ -0,0 +1,26 @@
a8223e
+/* Copyright (C) 2012 Free Software Foundation, Inc.
a8223e
+
a8223e
+   This file is part of GDB.
a8223e
+
a8223e
+   This program is free software; you can redistribute it and/or modify
a8223e
+   it under the terms of the GNU General Public License as published by
a8223e
+   the Free Software Foundation; either version 3 of the License, or
a8223e
+   (at your option) any later version.
a8223e
+
a8223e
+   This program is distributed in the hope that it will be useful,
a8223e
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
a8223e
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
a8223e
+   GNU General Public License for more details.
a8223e
+
a8223e
+   You should have received a copy of the GNU General Public License
a8223e
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
a8223e
+
a8223e
+#include <stdio.h>
a8223e
+#include <stdlib.h>
a8223e
+
a8223e
+int
a8223e
+main (int argc, char *argv[])
a8223e
+{
a8223e
+  printf ("Hello, World.\n");
a8223e
+  abort ();
a8223e
+}
a8223e
diff --git a/gdb/testsuite/gdb.base/set-solib-absolute-prefix.exp b/gdb/testsuite/gdb.base/set-solib-absolute-prefix.exp
a8223e
new file mode 100644
a8223e
--- /dev/null
a8223e
+++ b/gdb/testsuite/gdb.base/set-solib-absolute-prefix.exp
a8223e
@@ -0,0 +1,39 @@
a8223e
+# Copyright 2012 Free Software Foundation, Inc.
a8223e
+
a8223e
+# This program is free software; you can redistribute it and/or modify
a8223e
+# it under the terms of the GNU General Public License as published by
a8223e
+# the Free Software Foundation; either version 3 of the License, or
a8223e
+# (at your option) any later version.
a8223e
+#
a8223e
+# This program is distributed in the hope that it will be useful,
a8223e
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
a8223e
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
a8223e
+# GNU General Public License for more details.
a8223e
+#
a8223e
+# You should have received a copy of the GNU General Public License
a8223e
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
a8223e
+
a8223e
+set testfile "set-solib-absolute-prefix"
a8223e
+set srcfile ${testfile}.c
a8223e
+
a8223e
+# It is necessary to verify if the binary is 32-bit, so that the system
a8223e
+# call `__kernel_vsyscall' originates from vDSO.
a8223e
+
a8223e
+if { ![is_ilp32_target] } {
a8223e
+    return -1
a8223e
+}
a8223e
+
a8223e
+if { [prepare_for_testing $testfile.exp $testfile $srcfile] } {
a8223e
+    return -1
a8223e
+}
a8223e
+
a8223e
+if { ![runto_main] } {
a8223e
+    return -1
a8223e
+}
a8223e
+
a8223e
+gdb_test "continue" "Program received signal SIGABRT, Aborted.*" \
a8223e
+    "continue until abort"
a8223e
+gdb_test "set solib-absolute-prefix /BOGUS_DIRECT" \
a8223e
+    ".*warning: Unable to find dynamic linker breakpoint function.*" \
a8223e
+    "set solib-absolute-prefix"
a8223e
+gdb_test "bt" "__kernel_vsyscall.*" "backtrace with __kernel_vsyscall"