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

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