2014-06-19 20:14:32 +00:00
|
|
|
Index: gdb-7.7.90.20140613/gdb/dwarf2read.c
|
2013-01-19 22:41:55 +00:00
|
|
|
===================================================================
|
2014-06-19 20:14:32 +00:00
|
|
|
--- gdb-7.7.90.20140613.orig/gdb/dwarf2read.c 2014-06-13 21:56:54.744653443 +0200
|
|
|
|
+++ gdb-7.7.90.20140613/gdb/dwarf2read.c 2014-06-13 22:01:51.529990684 +0200
|
|
|
|
@@ -17695,6 +17695,26 @@ new_symbol_full (struct die_info *die, s
|
2012-05-28 15:16:39 +00:00
|
|
|
/* Cache this symbol's name and the name's demangled form (if any). */
|
2013-08-02 20:26:03 +00:00
|
|
|
SYMBOL_SET_LANGUAGE (sym, cu->language, &objfile->objfile_obstack);
|
2012-05-28 15:16:39 +00:00
|
|
|
linkagename = dwarf2_physname (name, die, cu);
|
|
|
|
+
|
|
|
|
+ /* Workaround for:
|
|
|
|
+ * invalid IFUNC DW_AT_linkage_name: memmove strstr time
|
|
|
|
+ * http://sourceware.org/bugzilla/show_bug.cgi?id=14166 */
|
|
|
|
+ if (strcmp (linkagename, "strstr") == 0
|
2014-02-07 18:38:14 +00:00
|
|
|
+ && strstr (objfile_name (objfile), "/libc") != NULL)
|
2012-05-28 15:16:39 +00:00
|
|
|
+ {
|
|
|
|
+ struct objfile *objfile_msym;
|
2014-06-19 20:14:32 +00:00
|
|
|
+ struct bound_minimal_symbol bmsym;
|
2012-05-28 15:16:39 +00:00
|
|
|
+
|
|
|
|
+ if (objfile->separate_debug_objfile_backlink)
|
|
|
|
+ objfile_msym = objfile->separate_debug_objfile_backlink;
|
|
|
|
+ else
|
|
|
|
+ objfile_msym = objfile;
|
2014-06-19 20:14:32 +00:00
|
|
|
+ bmsym = lookup_minimal_symbol ("strstr", NULL, objfile_msym);
|
|
|
|
+ if (bmsym.minsym != NULL
|
|
|
|
+ && MSYMBOL_TYPE (bmsym.minsym) == mst_text_gnu_ifunc)
|
2012-05-28 15:16:39 +00:00
|
|
|
+ linkagename = "__strstr";
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
SYMBOL_SET_NAMES (sym, linkagename, strlen (linkagename), 0, objfile);
|
|
|
|
|
|
|
|
/* Fortran does not have mangling standard and the mangling does differ
|
2014-06-19 20:14:32 +00:00
|
|
|
Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp
|
2013-01-19 22:41:55 +00:00
|
|
|
===================================================================
|
|
|
|
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
2014-06-19 20:14:32 +00:00
|
|
|
+++ gdb-7.7.90.20140613/gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp 2014-06-13 21:59:41.174840871 +0200
|
2013-01-19 22:41:55 +00:00
|
|
|
@@ -0,0 +1,108 @@
|
2012-05-28 15:16:39 +00:00
|
|
|
+# Copyright (C) 2012 Free Software Foundation, Inc.
|
|
|
|
+
|
|
|
|
+# This program is free software; you can redistribute it and/or modify
|
|
|
|
+# it under the terms of the GNU General Public License as published by
|
|
|
|
+# the Free Software Foundation; either version 3 of the License, or
|
|
|
|
+# (at your option) any later version.
|
|
|
|
+#
|
|
|
|
+# This program is distributed in the hope that it will be useful,
|
|
|
|
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
+# GNU General Public License for more details.
|
|
|
|
+#
|
|
|
|
+# You should have received a copy of the GNU General Public License
|
|
|
|
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
+
|
|
|
|
+# Workaround for:
|
|
|
|
+# invalid IFUNC DW_AT_linkage_name: memmove strstr time
|
|
|
|
+# http://sourceware.org/bugzilla/show_bug.cgi?id=14166
|
|
|
|
+
|
|
|
|
+if {[skip_shlib_tests]} {
|
|
|
|
+ return 0
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+set testfile "gnu-ifunc-strstr-workaround"
|
|
|
|
+set executable ${testfile}
|
|
|
|
+set srcfile start.c
|
2017-02-25 05:45:31 +00:00
|
|
|
+set binfile [standard_output_file ${executable}]
|
2012-05-28 15:16:39 +00:00
|
|
|
+
|
|
|
|
+if [prepare_for_testing ${testfile}.exp $executable $srcfile] {
|
|
|
|
+ return -1
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+if ![runto_main] {
|
|
|
|
+ return 0
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+set test "ptype atoi"
|
|
|
|
+gdb_test_multiple $test $test {
|
|
|
|
+ -re "type = int \\(const char \\*\\)\r\n$gdb_prompt $" {
|
|
|
|
+ pass $test
|
|
|
|
+ }
|
|
|
|
+ -re "type = int \\(\\)\r\n$gdb_prompt $" {
|
|
|
|
+ untested "$test (no DWARF)"
|
|
|
|
+ return 0
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+set addr ""
|
|
|
|
+set test "print strstr"
|
|
|
|
+gdb_test_multiple $test $test {
|
|
|
|
+ -re " = {<text gnu-indirect-function variable, no debug info>} (0x\[0-9a-f\]+) <strstr>\r\n$gdb_prompt $" {
|
|
|
|
+ set addr $expect_out(1,string)
|
|
|
|
+ pass $test
|
|
|
|
+ }
|
|
|
|
+ -re " = {<text gnu-indirect-function variable, no debug info>} (0x\[0-9a-f\]+) <__strstr>\r\n$gdb_prompt $" {
|
|
|
|
+ set addr $expect_out(1,string)
|
2013-01-19 22:41:55 +00:00
|
|
|
+ pass "$test (GDB workaround)"
|
|
|
|
+ }
|
|
|
|
+ -re " = {<text gnu-indirect-function variable, no debug info>} (0x\[0-9a-f\]+) <__libc_strstr>\r\n$gdb_prompt $" {
|
|
|
|
+ set addr $expect_out(1,string)
|
|
|
|
+ pass "$test (fixed glibc)"
|
2012-05-28 15:16:39 +00:00
|
|
|
+ }
|
|
|
|
+ -re " = {char \\*\\(const char \\*, const char \\*\\)} 0x\[0-9a-f\]+ <strstr>\r\n$gdb_prompt $" {
|
|
|
|
+ untested "$test (gnu-ifunc not in use by glibc)"
|
|
|
|
+ return 0
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+set test "info sym"
|
|
|
|
+gdb_test_multiple "info sym $addr" $test {
|
|
|
|
+ -re "strstr in section \\.text of /lib\[^/\]*/libc.so.6\r\n$gdb_prompt $" {
|
|
|
|
+ pass $test
|
|
|
|
+ }
|
|
|
|
+ -re " = {char \\*\\(const char \\*, const char \\*\\)} 0x\[0-9a-f\]+ <strstr>\r\n$gdb_prompt $" {
|
|
|
|
+ # unexpected
|
|
|
|
+ xfail "$test (not in libc.so.6)"
|
|
|
|
+ return 0
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+set test "info addr strstr"
|
|
|
|
+gdb_test_multiple $test $test {
|
|
|
|
+ -re "Symbol \"strstr\" is a function at address $addr\\.\r\n$gdb_prompt $" {
|
|
|
|
+ fail "$test (DWARF for strstr)"
|
|
|
|
+ }
|
|
|
|
+ -re "Symbol \"strstr\" is at $addr in a file compiled without debugging\\.\r\n$gdb_prompt $" {
|
|
|
|
+ pass "$test"
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+set test "print strstr second time"
|
|
|
|
+gdb_test_multiple "print strstr" $test {
|
|
|
|
+ -re " = {<text gnu-indirect-function variable, no debug info>} $addr <strstr>\r\n$gdb_prompt $" {
|
|
|
|
+ pass $test
|
|
|
|
+ }
|
|
|
|
+ -re " = {<text gnu-indirect-function variable, no debug info>} $addr <__strstr>\r\n$gdb_prompt $" {
|
2013-01-19 22:41:55 +00:00
|
|
|
+ pass "$test (GDB workaround)"
|
|
|
|
+ }
|
|
|
|
+ -re " = {<text gnu-indirect-function variable, no debug info>} $addr <__libc_strstr>\r\n$gdb_prompt $" {
|
|
|
|
+ pass "$test (fixed glibc)"
|
2012-05-28 15:16:39 +00:00
|
|
|
+ }
|
|
|
|
+ -re " = {void \\*\\(void\\)} 0x\[0-9a-f\]+ <strstr>\r\n$gdb_prompt $" {
|
|
|
|
+ fail $test
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+gdb_test {print strstr("abc","b")} { = 0x[0-9a-f]+ "bc"}
|
|
|
|
+gdb_test {print strstr("def","e")} { = 0x[0-9a-f]+ "ef"}
|