Update gdb-6.3-gstack-20050411.patch (Pedro Alves).

Update gdb-archer-next-over-throw-cxx-exec.patch (Pedro Alves).
Update gdb-glibc-strstr-workaround.patch (Pedro Alves).
This commit is contained in:
Sergio Durigan Junior 2018-12-11 16:37:09 -05:00
parent 1ea4563053
commit 83f9b09ebf
5 changed files with 43 additions and 52 deletions

View File

@ -291,7 +291,7 @@ Patch072: gdb-runtest-pie-override.patch
Patch073: gdb-attach-fail-reasons-5of5.patch
# Workaround PR libc/14166 for inferior calls of strstr.
#=fedora: Compatibility with RHELs (unchecked which ones).
#=fedoratest: Compatibility with RHELs (unchecked which ones).
Patch074: gdb-glibc-strstr-workaround.patch
# Include testcase for `Unable to see a variable inside a module (XLF)' (BZ 823789).

View File

@ -171,7 +171,7 @@ diff --git a/gdb/testsuite/gdb.base/gstack.exp b/gdb/testsuite/gdb.base/gstack.e
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/gstack.exp
@@ -0,0 +1,66 @@
@@ -0,0 +1,84 @@
+# Copyright (C) 2012 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
@ -202,6 +202,10 @@ new file mode 100644
+ fail $test
+ return
+}
+
+# The spawn id of the test inferior.
+set test_spawn_id $res
+
+set use_gdb_stub 1
+set pid [exp_pid -i $res]
+gdb_expect {
@ -217,7 +221,6 @@ new file mode 100644
+ return
+ }
+}
+gdb_exit
+
+# Testcase uses the most simple notification not to get caught by attach on
+# exiting the function. Still we could retry the gstack command if we fail.
@ -229,12 +232,27 @@ new file mode 100644
+ perror "Spawning $command failed."
+ fail $test
+}
+set pid [exp_pid -i $res]
+
+set gdb_spawn_id $res
+
+gdb_test_multiple "" $test {
+ -re "^#0 +(0x\[0-9a-f\]+ in )?\\.?func \\(\\) at \[^\r\n\]*\r\n#1 +0x\[0-9a-f\]+ in \\.?main \\(\\) at \[^\r\n\]*\r\nGSTACK-END\r\n\$" {
+ pass $test
+ }
+}
+gdb_exit
+
+remote_exec host "kill -9 $pid"
+gdb_test_multiple "" "gstack exits" {
+ eof {
+ set result [wait -i $gdb_spawn_id]
+ verbose $result
+
+ gdb_assert { [lindex $result 2] == 0 } "gstack exits with no error"
+ gdb_assert { [lindex $result 3] == 0 } "gstack's exit status is 0"
+
+ remote_close host
+ clear_gdb_spawn_id
+ }
+}
+
+# Kill the test inferior.
+kill_wait_spawned_process $test_spawn_id

View File

@ -43,7 +43,7 @@ diff --git a/gdb/testsuite/gdb.cp/cxxexec.exp b/gdb/testsuite/gdb.cp/cxxexec.exp
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.cp/cxxexec.exp
@@ -0,0 +1,51 @@
@@ -0,0 +1,42 @@
+# Copyright 2010 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
@ -83,15 +83,6 @@ new file mode 100644
+ }
+}
+
+set test continue
+gdb_test_multiple $test $test {
+ -re "Cannot access memory at address 0x\[0-9a-f\]+\r\n$gdb_prompt $" {
+ fail $test
+ }
+ -re "\r\n$gdb_prompt $" {
+ pass $test
+ }
+}
+
+# `info inferiors' can show <null> on older GDBs.
+gdb_test "info threads" "info threads" "program finished"
+# Run to end. The buggy GDB failed instead with:
+# Cannot access memory at address ADDR.
+gdb_continue_to_end "" "continue" 1

View File

@ -4,43 +4,13 @@ Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-glibc-strstr-workaround.patch
;; Workaround PR libc/14166 for inferior calls of strstr.
;;=fedora: Compatibility with RHELs (unchecked which ones).
;;=fedoratest: Compatibility with RHELs (unchecked which ones).
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -21490,6 +21490,26 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
/* Cache this symbol's name and the name's demangled form (if any). */
SYMBOL_SET_LANGUAGE (sym, cu->language, &objfile->objfile_obstack);
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
+ && strstr (objfile_name (objfile), "/libc") != NULL)
+ {
+ struct objfile *objfile_msym;
+ struct bound_minimal_symbol bmsym;
+
+ if (objfile->separate_debug_objfile_backlink)
+ objfile_msym = objfile->separate_debug_objfile_backlink;
+ else
+ objfile_msym = objfile;
+ bmsym = lookup_minimal_symbol ("strstr", NULL, objfile_msym);
+ if (bmsym.minsym != NULL
+ && MSYMBOL_TYPE (bmsym.minsym) == mst_text_gnu_ifunc)
+ linkagename = "__strstr";
+ }
+
SYMBOL_SET_NAMES (sym, linkagename, strlen (linkagename), 0, objfile);
/* Fortran does not have mangling standard and the mangling does differ
diff --git a/gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp b/gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp
@@ -0,0 +1,108 @@
@@ -0,0 +1,115 @@
+# Copyright (C) 2012 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
@ -103,6 +73,10 @@ new file mode 100644
+ set addr $expect_out(1,string)
+ pass "$test (fixed glibc)"
+ }
+ -re " = {<text gnu-indirect-function variable, no debug info>} (0x\[0-9a-f\]+) <__libc_strstr_ifunc>\r\n$gdb_prompt $" {
+ set addr $expect_out(1,string)
+ pass "$test (fixed glibc)"
+ }
+ -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
@ -142,6 +116,9 @@ new file mode 100644
+ -re " = {<text gnu-indirect-function variable, no debug info>} $addr <__libc_strstr>\r\n$gdb_prompt $" {
+ pass "$test (fixed glibc)"
+ }
+ -re " = {<text gnu-indirect-function variable, no debug info>} $addr <__libc_strstr_ifunc>\r\n$gdb_prompt $" {
+ pass "$test (fixed glibc)"
+ }
+ -re " = {void \\*\\(void\\)} 0x\[0-9a-f\]+ <strstr>\r\n$gdb_prompt $" {
+ fail $test
+ }

View File

@ -30,7 +30,7 @@ Version: 8.2.50.%{snapsrc}
# The release always contains a leading reserved number, start it at 1.
# `upstream' is not a part of `name' to stay fully rpm dependencies compatible for the testing.
Release: 10%{?dist}
Release: 11%{?dist}
License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and LGPLv3+ and BSD and Public Domain and GFDL
Group: Development/Debuggers
@ -1032,6 +1032,11 @@ fi
%endif
%changelog
* Tue Dec 11 2018 Sergio Durigan Junior <sergiodj@redhat.com> - 8.2.50.20181130-11.fc30
- Update gdb-6.3-gstack-20050411.patch (Pedro Alves).
- Update gdb-archer-next-over-throw-cxx-exec.patch (Pedro Alves).
- Update gdb-glibc-strstr-workaround.patch (Pedro Alves).
* Fri Nov 30 2018 Sergio Durigan Junior <sergiodj@redhat.com> - 8.2.50.20181130-10.fc30
- Rebase to FSF GDB 8.2.50.20181130 (8.3pre).