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

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