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