|
|
ed07ac |
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
|
|
ed07ac |
From: Fedora GDB patches <invalid@email.com>
|
|
|
ed07ac |
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
|
|
ed07ac |
Subject: gdb-glibc-strstr-workaround.patch
|
|
|
ed07ac |
|
|
|
ed07ac |
;; Workaround PR libc/14166 for inferior calls of strstr.
|
|
|
ed07ac |
;;=fedoratest: Compatibility with RHELs (unchecked which ones).
|
|
|
ed07ac |
|
|
|
ed07ac |
diff --git a/gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp b/gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp
|
|
|
ed07ac |
new file mode 100644
|
|
|
ed07ac |
--- /dev/null
|
|
|
ed07ac |
+++ b/gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp
|
|
|
ed07ac |
@@ -0,0 +1,119 @@
|
|
|
ed07ac |
+# Copyright (C) 2012 Free Software Foundation, Inc.
|
|
|
ed07ac |
+
|
|
|
ed07ac |
+# This program is free software; you can redistribute it and/or modify
|
|
|
ed07ac |
+# it under the terms of the GNU General Public License as published by
|
|
|
ed07ac |
+# the Free Software Foundation; either version 3 of the License, or
|
|
|
ed07ac |
+# (at your option) any later version.
|
|
|
ed07ac |
+#
|
|
|
ed07ac |
+# This program is distributed in the hope that it will be useful,
|
|
|
ed07ac |
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
ed07ac |
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
ed07ac |
+# GNU General Public License for more details.
|
|
|
ed07ac |
+#
|
|
|
ed07ac |
+# You should have received a copy of the GNU General Public License
|
|
|
ed07ac |
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
ed07ac |
+
|
|
|
ed07ac |
+# Workaround for:
|
|
|
ed07ac |
+# invalid IFUNC DW_AT_linkage_name: memmove strstr time
|
|
|
ed07ac |
+# http://sourceware.org/bugzilla/show_bug.cgi?id=14166
|
|
|
ed07ac |
+
|
|
|
ed07ac |
+if {[skip_shlib_tests]} {
|
|
|
ed07ac |
+ return 0
|
|
|
ed07ac |
+}
|
|
|
ed07ac |
+
|
|
|
ed07ac |
+set testfile "gnu-ifunc-strstr-workaround"
|
|
|
ed07ac |
+set executable ${testfile}
|
|
|
ed07ac |
+set srcfile start.c
|
|
|
ed07ac |
+set binfile [standard_output_file ${executable}]
|
|
|
ed07ac |
+
|
|
|
ed07ac |
+if [prepare_for_testing ${testfile}.exp $executable $srcfile] {
|
|
|
ed07ac |
+ return -1
|
|
|
ed07ac |
+}
|
|
|
ed07ac |
+
|
|
|
ed07ac |
+if ![runto_main] {
|
|
|
ed07ac |
+ return 0
|
|
|
ed07ac |
+}
|
|
|
ed07ac |
+
|
|
|
ed07ac |
+set test "ptype atoi"
|
|
|
ed07ac |
+gdb_test_multiple $test $test {
|
|
|
ed07ac |
+ -re "type = int \\(const char \\*\\)\r\n$gdb_prompt $" {
|
|
|
ed07ac |
+ pass $test
|
|
|
ed07ac |
+ }
|
|
|
ed07ac |
+ -re "type = int \\(\\)\r\n$gdb_prompt $" {
|
|
|
ed07ac |
+ untested "$test (no DWARF)"
|
|
|
ed07ac |
+ return 0
|
|
|
ed07ac |
+ }
|
|
|
ed07ac |
+ -re "type = <unknown return type> \\(\\)\r\n$gdb_prompt $" {
|
|
|
ed07ac |
+ untested "$test (no DWARF)"
|
|
|
ed07ac |
+ return 0
|
|
|
ed07ac |
+ }
|
|
|
ed07ac |
+}
|
|
|
ed07ac |
+
|
|
|
ed07ac |
+set addr ""
|
|
|
ed07ac |
+set test "print strstr"
|
|
|
ed07ac |
+gdb_test_multiple $test $test {
|
|
|
ed07ac |
+ -re " = {<text gnu-indirect-function variable, no debug info>} (0x\[0-9a-f\]+) <strstr>\r\n$gdb_prompt $" {
|
|
|
ed07ac |
+ set addr $expect_out(1,string)
|
|
|
ed07ac |
+ pass $test
|
|
|
ed07ac |
+ }
|
|
|
ed07ac |
+ -re " = {<text gnu-indirect-function variable, no debug info>} (0x\[0-9a-f\]+) <__strstr>\r\n$gdb_prompt $" {
|
|
|
ed07ac |
+ set addr $expect_out(1,string)
|
|
|
ed07ac |
+ pass "$test (GDB workaround)"
|
|
|
ed07ac |
+ }
|
|
|
ed07ac |
+ -re " = {<text gnu-indirect-function variable, no debug info>} (0x\[0-9a-f\]+) <__libc_strstr>\r\n$gdb_prompt $" {
|
|
|
ed07ac |
+ set addr $expect_out(1,string)
|
|
|
ed07ac |
+ pass "$test (fixed glibc)"
|
|
|
ed07ac |
+ }
|
|
|
ed07ac |
+ -re " = {<text gnu-indirect-function variable, no debug info>} (0x\[0-9a-f\]+) <__libc_strstr_ifunc>\r\n$gdb_prompt $" {
|
|
|
ed07ac |
+ set addr $expect_out(1,string)
|
|
|
ed07ac |
+ pass "$test (fixed glibc)"
|
|
|
ed07ac |
+ }
|
|
|
ed07ac |
+ -re " = {char \\*\\(const char \\*, const char \\*\\)} 0x\[0-9a-f\]+ <strstr>\r\n$gdb_prompt $" {
|
|
|
ed07ac |
+ untested "$test (gnu-ifunc not in use by glibc)"
|
|
|
ed07ac |
+ return 0
|
|
|
ed07ac |
+ }
|
|
|
ed07ac |
+}
|
|
|
ed07ac |
+
|
|
|
ed07ac |
+set test "info sym"
|
|
|
ed07ac |
+gdb_test_multiple "info sym $addr" $test {
|
|
|
ed07ac |
+ -re "strstr in section \\.text of /lib\[^/\]*/libc.so.6\r\n$gdb_prompt $" {
|
|
|
ed07ac |
+ pass $test
|
|
|
ed07ac |
+ }
|
|
|
ed07ac |
+ -re " = {char \\*\\(const char \\*, const char \\*\\)} 0x\[0-9a-f\]+ <strstr>\r\n$gdb_prompt $" {
|
|
|
ed07ac |
+ # unexpected
|
|
|
ed07ac |
+ xfail "$test (not in libc.so.6)"
|
|
|
ed07ac |
+ return 0
|
|
|
ed07ac |
+ }
|
|
|
ed07ac |
+}
|
|
|
ed07ac |
+
|
|
|
ed07ac |
+set test "info addr strstr"
|
|
|
ed07ac |
+gdb_test_multiple $test $test {
|
|
|
ed07ac |
+ -re "Symbol \"strstr\" is a function at address $addr\\.\r\n$gdb_prompt $" {
|
|
|
ed07ac |
+ fail "$test (DWARF for strstr)"
|
|
|
ed07ac |
+ }
|
|
|
ed07ac |
+ -re "Symbol \"strstr\" is at $addr in a file compiled without debugging\\.\r\n$gdb_prompt $" {
|
|
|
ed07ac |
+ pass "$test"
|
|
|
ed07ac |
+ }
|
|
|
ed07ac |
+}
|
|
|
ed07ac |
+
|
|
|
ed07ac |
+set test "print strstr second time"
|
|
|
ed07ac |
+gdb_test_multiple "print strstr" $test {
|
|
|
ed07ac |
+ -re " = {<text gnu-indirect-function variable, no debug info>} $addr <strstr>\r\n$gdb_prompt $" {
|
|
|
ed07ac |
+ pass $test
|
|
|
ed07ac |
+ }
|
|
|
ed07ac |
+ -re " = {<text gnu-indirect-function variable, no debug info>} $addr <__strstr>\r\n$gdb_prompt $" {
|
|
|
ed07ac |
+ pass "$test (GDB workaround)"
|
|
|
ed07ac |
+ }
|
|
|
ed07ac |
+ -re " = {<text gnu-indirect-function variable, no debug info>} $addr <__libc_strstr>\r\n$gdb_prompt $" {
|
|
|
ed07ac |
+ pass "$test (fixed glibc)"
|
|
|
ed07ac |
+ }
|
|
|
ed07ac |
+ -re " = {<text gnu-indirect-function variable, no debug info>} $addr <__libc_strstr_ifunc>\r\n$gdb_prompt $" {
|
|
|
ed07ac |
+ pass "$test (fixed glibc)"
|
|
|
ed07ac |
+ }
|
|
|
ed07ac |
+ -re " = {void \\*\\(void\\)} 0x\[0-9a-f\]+ <strstr>\r\n$gdb_prompt $" {
|
|
|
ed07ac |
+ fail $test
|
|
|
ed07ac |
+ }
|
|
|
ed07ac |
+}
|
|
|
ed07ac |
+
|
|
|
ed07ac |
+gdb_test {print (char *)strstr("abc","b")} { = 0x[0-9a-f]+ "bc"}
|
|
|
ed07ac |
+gdb_test {print (char *)strstr("def","e")} { = 0x[0-9a-f]+ "ef"}
|