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