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

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