diff --git a/SOURCES/gdb-rhbz1228556-bpt-inlined-func-name-1of2.patch b/SOURCES/gdb-rhbz1228556-bpt-inlined-func-name-1of2.patch new file mode 100644 index 0000000..062fe40 --- /dev/null +++ b/SOURCES/gdb-rhbz1228556-bpt-inlined-func-name-1of2.patch @@ -0,0 +1,144 @@ +commit 06871ae84096ed1672eb76f44cea4d5dbe79ae24 +Author: Pedro Alves +Date: Wed Sep 20 16:12:54 2017 +0100 + + Make "list ambiguous" show symbol names too + + Currently, with an ambiguous "list first,last", we get: + + (gdb) list bar,main + Specified first line 'bar' is ambiguous: + file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 97 + file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 98 + + This commit makes gdb's output above a bit clearer by printing the + symbol name as well: + + (gdb) list bar,main + Specified first line 'bar' is ambiguous: + file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 97, symbol: "bar(A)" + file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 98, symbol: "bar(B)" + + And while at it, makes gdb print the symbol name when actually listing + multiple locations too. I.e., before (with "set listsize 2"): + + (gdb) list bar + file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 97 + 96 + 97 int bar (A) { return 11; } + file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 98 + 97 int bar (A) { return 11; } + 98 int bar (B) { return 22; } + + After: + + (gdb) list bar + file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 97, symbol: "bar(A)" + 96 + 97 int bar (A) { return 11; } + file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 98, symbol: "bar(B)" + 97 int bar (A) { return 11; } + 98 int bar (B) { return 22; } + + Currently, the result of decoding a linespec loses information about + the original symbol that was found. All we end up with is an address. + This makes it difficult to find the original symbol again to get at + its print name. Fix that by storing a pointer to the symbol in the + sal. We already store the symtab and obj_section, so it feels like a + natural progression to me. This avoids having to do any extra symbol + lookup too. + + gdb/ChangeLog: + 2017-09-20 Pedro Alves + + * cli/cli-cmds.c (list_command): Use print_sal_location. + (print_sal_location): New function. + (ambiguous_line_spec): Use print_sal_location. + * linespec.c (symbol_to_sal): Record the symbol in the sal. + * symtab.c (find_function_start_sal): Likewise. + * symtab.h (symtab_and_line::symbol): New field. + + gdb/testsuite/ChangeLog: + 2017-09-20 Pedro Alves + + * gdb.base/list-ambiguous.exp (test_list_ambiguous_symbol): Expect + symbol names in gdb's output. + * gdb.cp/overload.exp ("list all overloads"): Likewise. + +### a/gdb/ChangeLog +### b/gdb/ChangeLog +## -1,5 +1,14 @@ + 2017-09-20 Pedro Alves + ++ * cli/cli-cmds.c (list_command): Use print_sal_location. ++ (print_sal_location): New function. ++ (ambiguous_line_spec): Use print_sal_location. ++ * linespec.c (symbol_to_sal): Record the symbol in the sal. ++ * symtab.c (find_function_start_sal): Likewise. ++ * symtab.h (symtab_and_line::symbol): New field. ++ ++2017-09-20 Pedro Alves ++ + * linespec.c (minsym_found): Handle non-text minsyms. + (symbol_to_sal): Record a sal.pc for non-block, non-label symbols. + +Index: gdb-7.6.1/gdb/linespec.c +=================================================================== +--- gdb-7.6.1.orig/gdb/linespec.c 2017-10-27 20:44:32.493790183 +0200 ++++ gdb-7.6.1/gdb/linespec.c 2017-10-27 20:49:52.460307350 +0200 +@@ -3648,6 +3648,7 @@ + { + init_sal (result); + result->symtab = SYMBOL_SYMTAB (sym); ++ result->symbol = sym; + result->line = SYMBOL_LINE (sym); + result->pc = SYMBOL_VALUE_ADDRESS (sym); + result->pspace = SYMTAB_PSPACE (SYMBOL_SYMTAB (sym)); +@@ -3663,6 +3664,7 @@ + /* We know its line number. */ + init_sal (result); + result->symtab = SYMBOL_SYMTAB (sym); ++ result->symbol = sym; + result->line = SYMBOL_LINE (sym); + result->pspace = SYMTAB_PSPACE (SYMBOL_SYMTAB (sym)); + return 1; +Index: gdb-7.6.1/gdb/symtab.c +=================================================================== +--- gdb-7.6.1.orig/gdb/symtab.c 2017-10-27 20:44:32.493790183 +0200 ++++ gdb-7.6.1/gdb/symtab.c 2017-10-27 21:02:02.162058159 +0200 +@@ -872,6 +872,7 @@ + { + sal->pspace = NULL; + sal->symtab = 0; ++ sal->symbol = NULL; + sal->section = 0; + sal->line = 0; + sal->pc = 0; +@@ -2774,6 +2775,7 @@ + fixup_symbol_section (sym, NULL); + sal = find_pc_sect_line (BLOCK_START (SYMBOL_BLOCK_VALUE (sym)), + SYMBOL_OBJ_SECTION (sym), 0); ++ sal.symbol = sym; + + if (funfirstline && sal.symtab != NULL + && (sal.symtab->locations_valid +@@ -2797,6 +2799,7 @@ + sal.pspace = current_program_space; + sal.pc = BLOCK_START (SYMBOL_BLOCK_VALUE (sym)); + sal.section = SYMBOL_OBJ_SECTION (sym); ++ sal.symbol = sym; + } + + if (funfirstline) +Index: gdb-7.6.1/gdb/symtab.h +=================================================================== +--- gdb-7.6.1.orig/gdb/symtab.h 2017-10-27 20:44:32.493790183 +0200 ++++ gdb-7.6.1/gdb/symtab.h 2017-10-27 21:01:41.522895501 +0200 +@@ -1105,6 +1105,7 @@ + struct program_space *pspace; + + struct symtab *symtab; ++ struct symbol *symbol; + struct obj_section *section; + /* Line number. Line numbers start at 1 and proceed through symtab->nlines. + 0 is never a valid line number; it is used to indicate that line number diff --git a/SOURCES/gdb-rhbz1228556-bpt-inlined-func-name-2of2.patch b/SOURCES/gdb-rhbz1228556-bpt-inlined-func-name-2of2.patch new file mode 100644 index 0000000..4c8aa0b --- /dev/null +++ b/SOURCES/gdb-rhbz1228556-bpt-inlined-func-name-2of2.patch @@ -0,0 +1,245 @@ +commit 4a27f119f59a44395e0a34b1526cee709e1d3fce +Author: Keith Seitz +Date: Fri Oct 27 10:57:23 2017 -0700 + + Use SaL symbol name when reporting breakpoint locations + + Currently, "info break" can show some (perhaps) unexpected results when + setting a breakpoint on an inlined function: + + (gdb) list + 1 #include + 2 + 3 static inline void foo() + 4 { + 5 printf("Hello world\n"); + 6 } + 7 + 8 int main() + 9 { + 10 foo(); + 11 return 0; + 12 } + 13 + (gdb) b foo + Breakpoint 1 at 0x400434: file foo.c, line 5. + (gdb) i b + Num Type Disp Enb Address What + 1 breakpoint keep y 0x0000000000400434 in main at foo.c:5 + + GDB reported that we understood what "foo" was, but we then report that the + breakpoint is actually set in main. While that is literally true, we can + do a little better. + + This is accomplished by copying the symbol for which the breakpoint was set + into the bp_location. From there, print_breakpoint_location can use this + information to print out symbol information (if available) instead of calling + find_pc_sect_function. + + With the patch installed, + + (gdb) i b + Num Type Disp Enb Address What + 1 breakpoint keep y 0x0000000000400434 in foo at foo.c:5 + + gdb/ChangeLog: + + * breakpoint.c (print_breakpoint_location): Use the symbol saved + in the bp_location, falling back to find_pc_sect_function when + needed. + (add_location_to_breakpoint): Save sal->symbol. + * breakpoint.h (struct bp_location) : New field. + * symtab.c (find_function_start_sal): Save the symbol into the SaL. + * symtab.h (struct symtab_and_line) : New field. + + gdb/testsuite/ChangeLog: + + * gdb.opt/inline-break.exp (break_info_1): New procedure. + Test "info break" for every inlined function breakpoint. + +### a/gdb/ChangeLog +### b/gdb/ChangeLog +## -1,3 +1,13 @@ ++2017-10-27 Keith Seitz ++ ++ * breakpoint.c (print_breakpoint_location): Use the symbol saved ++ in the bp_location, falling back to find_pc_sect_function when ++ needed. ++ (add_location_to_breakpoint): Save sal->symbol. ++ * breakpoint.h (struct bp_location) : New field. ++ * symtab.c (find_function_start_sal): Save the symbol into the SaL. ++ * symtab.h (struct symtab_and_line) : New field. ++ + 2017-10-26 Patrick Frants + + PR gdb/13669 +Index: gdb-7.6.1/gdb/breakpoint.c +=================================================================== +--- gdb-7.6.1.orig/gdb/breakpoint.c 2017-10-27 21:38:34.569392186 +0200 ++++ gdb-7.6.1/gdb/breakpoint.c 2017-10-27 21:38:37.699416969 +0200 +@@ -5703,8 +5703,11 @@ + ui_out_field_string (uiout, "what", b->addr_string); + else if (loc && loc->symtab) + { +- struct symbol *sym +- = find_pc_sect_function (loc->address, loc->section); ++ const struct symbol *sym = loc->symbol; ++ ++ if (sym == NULL) ++ sym = find_pc_sect_function (loc->address, loc->section); ++ + if (sym) + { + ui_out_text (uiout, "in "); +@@ -8851,6 +8854,7 @@ + loc->gdbarch = loc_gdbarch; + loc->line_number = sal->line; + loc->symtab = sal->symtab; ++ loc->symbol = sal->symbol; + + set_breakpoint_location_function (loc, + sal->explicit_pc || sal->explicit_line); +Index: gdb-7.6.1/gdb/breakpoint.h +=================================================================== +--- gdb-7.6.1.orig/gdb/breakpoint.h 2017-10-27 21:38:33.271381909 +0200 ++++ gdb-7.6.1/gdb/breakpoint.h 2017-10-27 21:38:37.700416977 +0200 +@@ -476,6 +476,11 @@ + to find the corresponding source file name. */ + + struct symtab *symtab; ++ ++ /* The symbol found by the location parser, if any. This may be used to ++ ascertain when an event location was set at a different location than ++ the one originally selected by parsing, e.g., inlined symbols. */ ++ const struct symbol *symbol; + }; + + /* Return values for bpstat_explains_signal. Note that the order of +Index: gdb-7.6.1/gdb/testsuite/gdb.opt/inline-break.exp +=================================================================== +--- gdb-7.6.1.orig/gdb/testsuite/gdb.opt/inline-break.exp 2013-01-01 07:41:25.000000000 +0100 ++++ gdb-7.6.1/gdb/testsuite/gdb.opt/inline-break.exp 2017-10-27 21:41:42.869884103 +0200 +@@ -24,6 +24,100 @@ + return -1 + } + ++# RHEL-7: ++proc parse_args { argset } { ++ upvar args args ++ ++ foreach argument $argset { ++ if {[llength $argument] == 1} { ++ # No default specified, so we assume that we should set ++ # the value to 1 if the arg is present and 0 if it's not. ++ # It is assumed that no value is given with the argument. ++ set result [lsearch -exact $args "-$argument"] ++ if {$result != -1} then { ++ uplevel 1 [list set $argument 1] ++ set args [lreplace $args $result $result] ++ } else { ++ uplevel 1 [list set $argument 0] ++ } ++ } elseif {[llength $argument] == 2} { ++ # There are two items in the argument. The second is a ++ # default value to use if the item is not present. ++ # Otherwise, the variable is set to whatever is provided ++ # after the item in the args. ++ set arg [lindex $argument 0] ++ set result [lsearch -exact $args "-[lindex $arg 0]"] ++ if {$result != -1} then { ++ uplevel 1 [list set $arg [lindex $args [expr $result+1]]] ++ set args [lreplace $args $result [expr $result+1]] ++ } else { ++ uplevel 1 [list set $arg [lindex $argument 1]] ++ } ++ } else { ++ error "Badly formatted argument \"$argument\" in argument set" ++ } ++ } ++ ++ # The remaining args should be checked to see that they match the ++ # number of items expected to be passed into the procedure... ++} ++ ++# Return a string that may be used to match the output of "info break NUM". ++# ++# Optional arguments: ++# ++# source - the name of the source file ++# func - the name of the function ++# disp - the event disposition ++# enabled - enable state ++# locs - number of locations ++# line - source line number (ignored without -source) ++ ++proc break_info_1 {num args} { ++ global decimal ++ ++ # Column delimiter ++ set c {[\t ]+} ++ ++ # Row delimiter ++ set end {[\r\n \t]+} ++ ++ # Table header ++ set header "[join [list Num Type Disp Enb Address What] ${c}]" ++ ++ # Get/configure any optional parameters. ++ parse_args [list {source ""} {func ".*"} {disp "keep"} \ ++ {enabled "y"} {locs 1} [list line $decimal] \ ++ {type "breakpoint"}] ++ ++ if {$source != ""} { ++ set source "$source:$line" ++ } ++ ++ # Result starts with the standard header. ++ set result "$header${end}" ++ ++ # Set up for multi-location breakpoint marker. ++ if {$locs == 1} { ++ set multi ".*" ++ } else { ++ set multi "${end}" ++ } ++ append result "[join [list $num $type $disp $enabled $multi] $c]" ++ ++ # Add location info. ++ for {set i 1} {$i <= $locs} {incr i} { ++ if {$locs > 1} { ++ append result "[join [list $num.$i $enabled] $c].*" ++ } ++ ++ # Add function/source file info. ++ append result "in $func at .*$source${end}" ++ } ++ ++ return $result ++} ++ + # + # func1 is a static inlined function that is called once. + # The result should be a single-location breakpoint. +@@ -111,3 +205,22 @@ + # + gdb_test "print func2" \ + "\\\$.* = {int \\(int\\)} .* " ++ ++# Test that "info break" reports the location of the breakpoints "inside" ++# the inlined functions ++ ++set results(1) [break_info_1 1 -source $srcfile -func "func1"] ++set results(2) [break_info_1 2 -locs 2 -source $srcfile -func "func2"] ++set results(3) [break_info_1 3 -source $srcfile -func "func3b"] ++set results(4) [break_info_1 4 -locs 2 -source $srcfile -func "func4b"] ++set results(5) [break_info_1 5 -locs 2 -source $srcfile -func "func5b"] ++set results(6) [break_info_1 6 -locs 3 -source $srcfile -func "func6b"] ++set results(7) [break_info_1 7 -locs 2 -source $srcfile -func "func7b"] ++set results(8) [break_info_1 8 -locs 3 -source $srcfile -func "func8b"] ++ ++for {set i 1} {$i <= [array size results]} {incr i} { ++ send_log "Expecting: $results($i)\n" ++ gdb_test "info break $i" $results($i) ++} ++ ++unset -nocomplain results diff --git a/SOURCES/gdb-rhbz1473411-spawn-default-signal-handlers.patch b/SOURCES/gdb-rhbz1473411-spawn-default-signal-handlers.patch new file mode 100644 index 0000000..70a64e7 --- /dev/null +++ b/SOURCES/gdb-rhbz1473411-spawn-default-signal-handlers.patch @@ -0,0 +1,670 @@ +commit 35fcb4fc81e51295d14125785765e0ea3e132cd9 +Author: Pedro Alves +Date: Tue Aug 9 20:21:08 2016 +0100 + + Fix PR gdb/18653: gdb disturbs inferior's inherited signal dispositions + + gdb's (or gdbserver's) own signal handling should not interfere with + the signal dispositions their spawned children inherit. However, it + currently does. For example, some paths in gdb cause SIGPIPE to be + set to SIG_IGN, and as consequence, the child starts with SIGPIPE to + set to SIG_IGN too, even though gdb was started with SIGPIPE set to + SIG_DFL. + + This is because the exec family of functions does not reset the signal + disposition of signals that are set to SIG_IGN: + + http://pubs.opengroup.org/onlinepubs/7908799/xsh/execve.html + + Signals set to the default action (SIG_DFL) in the calling process + image are set to the default action in the new process + image. Signals set to be ignored (SIG_IGN) by the calling process + image are set to be ignored by the new process image. Signals set to + be caught by the calling process image are set to the default action + in the new process image (see ). + + And neither does it reset signal masks or flags. + + In order to be transparent, when spawning new child processes to debug + (with "run", etc.), reset signal actions and mask back to what was + originally inherited from gdb/gdbserver's parent, just before execing + the target program to debug. + + gdb/ChangeLog: + 2016-08-09 Pedro Alves + + PR gdb/18653 + * Makefile.in (SFILES): Add + common/signals-state-save-restore.c. + (HFILES_NO_SRCDIR): Add common/signals-state-save-restore.h. + (COMMON_OBS): Add signals-state-save-restore.o. + (signals-state-save-restore.o): New rule. + * configure: Regenerate. + * fork-child.c: Include "signals-state-save-restore.h". + (fork_inferior): Call restore_original_signals_state. + * main.c: Include "signals-state-save-restore.h". + (captured_main): Call save_original_signals_state. + * common/common.m4: Add sigaction to AC_CHECK_FUNCS checks. + * common/signals-state-save-restore.c: New file. + * common/signals-state-save-restore.h: New file. + + gdb/gdbserver/ChangeLog: + 2016-08-09 Pedro Alves + + PR gdb/18653 + * Makefile.in (OBS): Add signals-state-save-restore.o. + (signals-state-save-restore.o): New rule. + * config.in: Regenerate. + * configure: Regenerate. + * linux-low.c: Include "signals-state-save-restore.h". + (linux_create_inferior): Call + restore_original_signals_state. + * server.c: Include "dispositions-save-restore.h". + (captured_main): Call save_original_signals_state. + + gdb/testsuite/ChangeLog: + 2016-08-09 Pedro Alves + + PR gdb/18653 + * gdb.base/signals-state-child.c: New file. + * gdb.base/signals-state-child.exp: New file. + * gdb.gdb/selftest.exp (do_steps_and_nexts): Add new pattern. + +### a/gdb/ChangeLog +### b/gdb/ChangeLog +## -1,5 +1,22 @@ + 2016-08-09 Pedro Alves + ++ PR gdb/18653 ++ * Makefile.in (SFILES): Add ++ common/signals-state-save-restore.c. ++ (HFILES_NO_SRCDIR): Add common/signals-state-save-restore.h. ++ (COMMON_OBS): Add signals-state-save-restore.o. ++ (signals-state-save-restore.o): New rule. ++ * configure: Regenerate. ++ * fork-child.c: Include "signals-state-save-restore.h". ++ (fork_inferior): Call restore_original_signals_state. ++ * main.c: Include "signals-state-save-restore.h". ++ (captured_main): Call save_original_signals_state. ++ * common/common.m4: Add sigaction to AC_CHECK_FUNCS checks. ++ * common/signals-state-save-restore.c: New file. ++ * common/signals-state-save-restore.h: New file. ++ ++2016-08-09 Pedro Alves ++ + * value.c (unpack_value_bitfield): Skip unpacking if the parent + has no contents buffer to begin with. + +Index: gdb-7.6.1/gdb/Makefile.in +=================================================================== +--- gdb-7.6.1.orig/gdb/Makefile.in 2017-11-03 19:22:10.364013263 +0100 ++++ gdb-7.6.1/gdb/Makefile.in 2017-11-03 19:22:11.452021206 +0100 +@@ -763,7 +763,8 @@ + regset.c sol-thread.c windows-termcap.c \ + common/gdb_vecs.c common/common-utils.c common/xml-utils.c \ + common/ptid.c common/buffer.c gdb-dlfcn.c common/agent.c \ +- common/format.c btrace.c record-btrace.c ++ common/format.c btrace.c record-btrace.c \ ++ common/signals-state-save-restore.c \ + + LINTFILES = $(SFILES) $(YYFILES) $(CONFIG_SRCS) init.c + +@@ -841,7 +842,8 @@ + common/format.h common/host-defs.h utils.h common/queue.h common/gdb_string.h \ + common/linux-osdata.h gdb-dlfcn.h auto-load.h probe.h stap-probe.h \ + gdb_bfd.h sparc-ravenscar-thread.h ppc-ravenscar-thread.h common/linux-btrace.h \ +-nat/linux-namespaces.h ++nat/linux-namespaces.h \ ++common/signals-state-save-restore.h + + # Header files that already have srcdir in them, or which are in objdir. + +@@ -898,6 +900,7 @@ + memattr.o mem-break.o target.o parse.o language.o buildsym.o \ + findcmd.o \ + std-regs.o \ ++ signals-state-save-restore.o \ + signals.o \ + exec.o reverse.o \ + bcache.o objfiles.o observer.o minsyms.o maint.o demangle.o \ +@@ -2116,6 +2119,10 @@ + $(COMPILE) $(srcdir)/tui/tui-winsource.c + $(POSTCOMPILE) + ++signals-state-save-restore.o: $(srcdir)/common/signals-state-save-restore.c ++ $(COMPILE) $(srcdir)/common/signals-state-save-restore.c ++ $(POSTCOMPILE) ++ + # + # gdb/python/ dependencies + # +Index: gdb-7.6.1/gdb/common/signals-state-save-restore.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.6.1/gdb/common/signals-state-save-restore.c 2017-11-03 19:33:46.346074718 +0100 +@@ -0,0 +1,99 @@ ++/* Copyright (C) 2016 Free Software Foundation, Inc. ++ ++ This file is part of GDB. ++ ++ 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 . */ ++ ++#ifdef GDBSERVER ++#include "server.h" ++#else ++#include "defs.h" ++#endif ++ ++#include "signals-state-save-restore.h" ++ ++#include ++ ++/* The original signal actions and mask. */ ++ ++#ifdef HAVE_SIGACTION ++static struct sigaction original_signal_actions[NSIG]; ++ ++/* Note that we use sigprocmask without worrying about threads because ++ the save/restore functions are called either from main, or after a ++ fork. In both cases, we know the calling process is single ++ threaded. */ ++static sigset_t original_signal_mask; ++#endif ++ ++/* See signals-state-save-restore.h. */ ++ ++void ++save_original_signals_state (void) ++{ ++#ifdef HAVE_SIGACTION ++ int i; ++ int res; ++ ++ res = sigprocmask (0, NULL, &original_signal_mask); ++ if (res == -1) ++ perror_with_name ("sigprocmask"); ++ ++ for (i = 1; i < NSIG; i++) ++ { ++ struct sigaction *oldact = &original_signal_actions[i]; ++ ++ res = sigaction (i, NULL, oldact); ++ if (res == -1 && errno == EINVAL) ++ { ++ /* Some signal numbers in the range are invalid. */ ++ continue; ++ } ++ else if (res == -1) ++ perror_with_name ("sigaction"); ++ ++ /* If we find a custom signal handler already installed, then ++ this function was called too late. */ ++ if (oldact->sa_handler != SIG_DFL && oldact->sa_handler != SIG_IGN) ++ internal_error (__FILE__, __LINE__, _("unexpected signal handler")); ++ } ++#endif ++} ++ ++/* See signals-state-save-restore.h. */ ++ ++void ++restore_original_signals_state (void) ++{ ++#ifdef HAVE_SIGACTION ++ int i; ++ int res; ++ ++ for (i = 1; i < NSIG; i++) ++ { ++ res = sigaction (i, &original_signal_actions[i], NULL); ++ if (res == -1 && errno == EINVAL) ++ { ++ /* Some signal numbers in the range are invalid. */ ++ continue; ++ } ++ else if (res == -1) ++ perror_with_name ("sigaction"); ++ } ++ ++ res = sigprocmask (SIG_SETMASK, &original_signal_mask, NULL); ++ if (res == -1) ++ perror_with_name ("sigprocmask"); ++#endif ++} +Index: gdb-7.6.1/gdb/common/signals-state-save-restore.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.6.1/gdb/common/signals-state-save-restore.h 2017-11-03 19:22:11.453021213 +0100 +@@ -0,0 +1,39 @@ ++/* Copyright (C) 2016 Free Software Foundation, Inc. ++ ++ This file is part of GDB. ++ ++ 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 . */ ++ ++#ifndef COMMON_SIGNALS_STATE_SAVE_RESTORE_H ++#define COMMON_SIGNALS_STATE_SAVE_RESTORE_H ++ ++/* Save/restore the signal actions of all signals, and the signal ++ mask. ++ ++ Since the exec family of functions does not reset the signal ++ disposition of signals set to SIG_IGN, nor does it reset the signal ++ mask, in order to be transparent, when spawning new child processes ++ to debug (with "run", etc.), we must reset signal actions and mask ++ back to what was originally inherited from gdb/gdbserver's parent, ++ just before execing the target program to debug. */ ++ ++/* Save the signal state of all signals. */ ++ ++extern void save_original_signals_state (void); ++ ++/* Restore the signal state of all signals. */ ++ ++extern void restore_original_signals_state (void); ++ ++#endif /* COMMON_SIGNALS_STATE_SAVE_RESTORE_H */ +Index: gdb-7.6.1/gdb/configure +=================================================================== +--- gdb-7.6.1.orig/gdb/configure 2017-11-03 19:22:08.181997334 +0100 ++++ gdb-7.6.1/gdb/configure 2017-11-03 19:22:11.455021228 +0100 +@@ -10667,7 +10667,7 @@ + sbrk setpgid setpgrp setsid \ + sigaction sigprocmask sigsetmask socketpair syscall \ + ttrace wborder wresize setlocale iconvlist libiconvlist btowc \ +- setrlimit getrlimit posix_madvise waitpid lstat ++ setrlimit getrlimit posix_madvise waitpid lstat sigaction + do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` + ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +Index: gdb-7.6.1/gdb/fork-child.c +=================================================================== +--- gdb-7.6.1.orig/gdb/fork-child.c 2013-01-01 07:32:42.000000000 +0100 ++++ gdb-7.6.1/gdb/fork-child.c 2017-11-03 19:22:11.455021228 +0100 +@@ -32,7 +32,7 @@ + #include "command.h" /* for dont_repeat () */ + #include "gdbcmd.h" + #include "solib.h" +- ++#include "signals-state-save-restore.h" + #include + + /* This just gets used as a default if we can't find SHELL. */ +@@ -350,6 +350,8 @@ + saying "not parent". Sorry; you'll have to use print + statements! */ + ++ restore_original_signals_state (); ++ + /* There is no execlpe call, so we have to set the environment + for our child in the global variable. If we've vforked, this + clobbers the parent, but environ is restored a few lines down +Index: gdb-7.6.1/gdb/gdbserver/Makefile.in +=================================================================== +--- gdb-7.6.1.orig/gdb/gdbserver/Makefile.in 2017-11-03 19:22:10.364013263 +0100 ++++ gdb-7.6.1/gdb/gdbserver/Makefile.in 2017-11-03 19:22:11.455021228 +0100 +@@ -170,6 +170,7 @@ + mem-break.o hostio.o event-loop.o tracepoint.o \ + xml-utils.o common-utils.o ptid.o buffer.o format.o \ + dll.o notif.o \ ++ signals-state-save-restore.o \ + $(XML_BUILTIN) \ + $(DEPFILES) $(LIBOBJS) + GDBREPLAY_OBS = gdbreplay.o version.o +@@ -572,6 +573,9 @@ + linux-namespaces.o: ../nat/linux-namespaces.c + $(COMPILE) $< + $(POSTCOMPILE) ++signals-state-save-restore.o: ../common/signals-state-save-restore.c ++ $(COMPILE) $< ++ $(POSTCOMPILE) + + win32_low_h = $(srcdir)/win32-low.h + +Index: gdb-7.6.1/gdb/gdbserver/config.in +=================================================================== +--- gdb-7.6.1.orig/gdb/gdbserver/config.in 2017-11-03 19:22:10.364013263 +0100 ++++ gdb-7.6.1/gdb/gdbserver/config.in 2017-11-03 19:22:11.455021228 +0100 +@@ -152,6 +152,9 @@ + /* Define to 1 if you have the header file. */ + #undef HAVE_SGTTY_H + ++/* Define to 1 if you have the `sigaction' function. */ ++#undef HAVE_SIGACTION ++ + /* Define to 1 if you have the header file. */ + #undef HAVE_SIGNAL_H + +Index: gdb-7.6.1/gdb/gdbserver/configure +=================================================================== +--- gdb-7.6.1.orig/gdb/gdbserver/configure 2017-11-03 19:22:10.366013278 +0100 ++++ gdb-7.6.1/gdb/gdbserver/configure 2017-11-03 19:22:11.456021235 +0100 +@@ -4796,7 +4796,7 @@ + + done + +-for ac_func in pread pwrite pread64 readlink setns ++for ac_func in pread pwrite pread64 readlink setns sigaction + do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` + ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +Index: gdb-7.6.1/gdb/gdbserver/linux-low.c +=================================================================== +--- gdb-7.6.1.orig/gdb/gdbserver/linux-low.c 2017-11-03 19:22:10.380013380 +0100 ++++ gdb-7.6.1/gdb/gdbserver/linux-low.c 2017-11-03 19:22:11.457021243 +0100 +@@ -20,7 +20,7 @@ + #include "linux-low.h" + #include "linux-osdata.h" + #include "agent.h" +- ++#include "signals-state-save-restore.h" + #include "gdb_wait.h" + #include + #include +@@ -699,6 +699,8 @@ + close (remote_desc); + } + ++ restore_original_signals_state (); ++ + execv (program, allargs); + if (errno == ENOENT) + execvp (program, allargs); +Index: gdb-7.6.1/gdb/gdbserver/server.c +=================================================================== +--- gdb-7.6.1.orig/gdb/gdbserver/server.c 2017-11-03 19:22:10.380013380 +0100 ++++ gdb-7.6.1/gdb/gdbserver/server.c 2017-11-03 19:22:11.457021243 +0100 +@@ -20,7 +20,7 @@ + #include "gdbthread.h" + #include "agent.h" + #include "notif.h" +- ++#include "signals-state-save-restore.h" + #if HAVE_UNISTD_H + #include + #endif +@@ -2896,6 +2896,8 @@ + exit (1); + } + ++ save_original_signals_state (); ++ + /* We need to know whether the remote connection is stdio before + starting the inferior. Inferiors created in this scenario have + stdin,stdout redirected. So do this here before we call +Index: gdb-7.6.1/gdb/main.c +=================================================================== +--- gdb-7.6.1.orig/gdb/main.c 2017-11-03 19:22:10.319012935 +0100 ++++ gdb-7.6.1/gdb/main.c 2017-11-03 19:22:11.458021250 +0100 +@@ -45,6 +45,7 @@ + #include "auto-load.h" + + #include "filenames.h" ++#include "signals-state-save-restore.h" + + /* The selected interpreter. This will be used as a set command + variable, so it should always be malloc'ed - since +@@ -393,6 +394,7 @@ + textdomain (PACKAGE); + + bfd_init (); ++ save_original_signals_state (); + + make_cleanup (VEC_cleanup (cmdarg_s), &cmdarg_vec); + dirsize = 1; +Index: gdb-7.6.1/gdb/testsuite/gdb.base/signals-state-child.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.6.1/gdb/testsuite/gdb.base/signals-state-child.c 2017-11-03 19:22:11.458021250 +0100 +@@ -0,0 +1,101 @@ ++/* Copyright 2016 Free Software Foundation, Inc. ++ ++ This file is part of GDB. ++ ++ 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 . */ ++ ++#include ++#include ++#include ++#include ++#include ++ ++#ifndef OUTPUT_TXT ++# define OUTPUT_TXT "output.txt" ++#endif ++ ++static void ++perror_and_exit (const char *s) ++{ ++ perror (s); ++ exit (1); ++} ++ ++int ++main (int argc, char **argv) ++{ ++ int i; ++ FILE *out; ++ sigset_t sigset; ++ int res; ++ ++ res = sigprocmask (0, NULL, &sigset); ++ if (res != 0) ++ perror_and_exit ("sigprocmask"); ++ ++ if (argc > 1) ++ out = stdout; ++ else ++ { ++ out = fopen (OUTPUT_TXT, "w"); ++ if (out == NULL) ++ perror_and_exit ("fopen"); ++ } ++ ++ for (i = 1; i < NSIG; i++) ++ { ++ struct sigaction oldact; ++ ++ fprintf (out, "signal %d: ", i); ++ ++ res = sigaction (i, NULL, &oldact); ++ if (res == -1 && errno == EINVAL) ++ { ++ /* Some signal numbers in the range are invalid. E.g., ++ signals 32 and 33 on GNU/Linux. */ ++ fprintf (out, "invalid"); ++ } ++ else if (res == -1) ++ { ++ perror_and_exit ("sigaction"); ++ } ++ else ++ { ++ int m; ++ ++ fprintf (out, "sigaction={sa_handler=", i); ++ ++ if (oldact.sa_handler == SIG_DFL) ++ fprintf (out, "SIG_DFL"); ++ else if (oldact.sa_handler == SIG_IGN) ++ fprintf (out, "SIG_IGN"); ++ else ++ abort (); ++ ++ fprintf (out, ", sa_mask="); ++ for (m = 1; m < NSIG; m++) ++ fprintf (out, "%c", sigismember (&oldact.sa_mask, m) ? '1' : '0'); ++ ++ fprintf (out, ", sa_flags=%d", oldact.sa_flags); ++ ++ fprintf (out, "}, masked=%d", sigismember (&sigset, i)); ++ } ++ fprintf (out, "\n"); ++ } ++ ++ if (out != stdout) ++ fclose (out); ++ ++ return 0; ++} +Index: gdb-7.6.1/gdb/testsuite/gdb.base/signals-state-child.exp +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.6.1/gdb/testsuite/gdb.base/signals-state-child.exp 2017-11-03 19:22:11.458021250 +0100 +@@ -0,0 +1,82 @@ ++# Copyright 2016 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 . ++ ++# Test that gdb's (or gdbserver's) own signal handling does not ++# interfere with the signal actions (dispositions, etc.) and mask ++# their spawned children inherit. ++# ++# - If gdb inherits some signal set to SIG_IGN, so should the ++# inferior, even if gdb itself chooses not to ignore the signal. ++# ++# - If gdb inherits some signal set to SIG_DFL, so should the inferior ++# even if gdb itself ignores that signal. ++# ++# This requires special support in gdb/gdbserver because the exec ++# family of functions does not reset the signal disposition of signals ++# that are set to SIG_IGN, nor signal masks and flags. ++ ++standard_testfile ++ ++set gdb_txt [standard_output_file gdb.txt] ++set standalone_txt [standard_output_file standalone.txt] ++remote_exec host "rm -f $gdb_txt" ++remote_exec host "rm -f $standalone_txt" ++ ++set options [list debug "additional_flags=-DOUTPUT_TXT=\"$gdb_txt\""] ++if {[build_executable $testfile.exp $testfile $srcfile $options]} { ++ untested $testfile.exp ++ return -1 ++} ++ ++set options [list debug "additional_flags=-DOUTPUT_TXT=\"$standalone_txt\""] ++if {[build_executable $testfile.exp $testfile-standalone $srcfile $options]} { ++ untested $testfile.exp ++ return -1 ++} ++ ++# Run the program directly, and dump its initial signal actions and ++# mask in "standalone.txt". ++ ++# Use remote_spawn instead of remote_exec, like how we spawn gdb. ++# This is in order to take the same code code paths in dejagnu ++# compared to when running the program through gdb. E.g., because ++# local_exec uses -ignore SIGHUP, while remote_spawn does not, if we ++# used remote_exec, the test program would start with SIGHUP ignored ++# when run standalone, but not when run through gdb. ++set res [remote_spawn host "$binfile-standalone"] ++if { $res < 0 || $res == "" } { ++ untested "spawning $binfile-standalone failed" ++ return 1 ++} else { ++ pass "collect standalone signals state" ++} ++remote_close host ++ ++# Now run the program through gdb, and dump its initial signal actions ++# and mask in "gdb.txt". ++ ++clean_restart $binfile ++ ++if { ! [ runto_main ] } then { ++ untested $testfile.exp ++ return -1 ++} ++ ++gdb_continue_to_end "collect signals state under gdb" ++ ++# Diff the .txt files. They should be identical. ++gdb_test "shell diff -s $standalone_txt $gdb_txt" \ ++ "Files .* are identical.*" \ ++ "signals states are identical" +Index: gdb-7.6.1/gdb/testsuite/gdb.gdb/selftest.exp +=================================================================== +--- gdb-7.6.1.orig/gdb/testsuite/gdb.gdb/selftest.exp 2017-11-03 19:22:06.904988012 +0100 ++++ gdb-7.6.1/gdb/testsuite/gdb.gdb/selftest.exp 2017-11-03 19:22:11.458021250 +0100 +@@ -158,6 +158,10 @@ + set description "next over bfd_init" + set command "next" + } ++ -re ".*save_original_signals_state ..;.*$gdb_prompt $" { ++ set description "next over save_original_signals_state" ++ set command "next" ++ } + -re ".*VEC_cleanup .cmdarg_s.*$gdb_prompt $" { + set description "next over cmdarg_s VEC_cleanup" + set command "next" +Index: gdb-7.6.1/gdb/configure.ac +=================================================================== +--- gdb-7.6.1.orig/gdb/configure.ac 2017-11-03 19:22:08.164997210 +0100 ++++ gdb-7.6.1/gdb/configure.ac 2017-11-03 19:22:11.459021257 +0100 +@@ -1365,7 +1365,7 @@ + sbrk setpgid setpgrp setsid \ + sigaction sigprocmask sigsetmask socketpair syscall \ + ttrace wborder wresize setlocale iconvlist libiconvlist btowc \ +- setrlimit getrlimit posix_madvise waitpid lstat]) ++ setrlimit getrlimit posix_madvise waitpid lstat sigaction]) + AM_LANGINFO_CODESET + + # Check the return and argument types of ptrace. No canned test for +Index: gdb-7.6.1/gdb/gdbserver/configure.ac +=================================================================== +--- gdb-7.6.1.orig/gdb/gdbserver/configure.ac 2017-11-03 19:22:10.366013278 +0100 ++++ gdb-7.6.1/gdb/gdbserver/configure.ac 2017-11-03 19:22:11.459021257 +0100 +@@ -70,7 +70,7 @@ + sys/ioctl.h netinet/in.h sys/socket.h netdb.h dnl + netinet/tcp.h arpa/inet.h sys/wait.h wait.h sys/un.h dnl + linux/perf_event.h) +-AC_CHECK_FUNCS(pread pwrite pread64 readlink setns) ++AC_CHECK_FUNCS(pread pwrite pread64 readlink setns sigaction) + AC_REPLACE_FUNCS(vasprintf vsnprintf) + + # Check for UST diff --git a/SOURCES/gdb-rhbz1480496-power-atomic-step-1of5.patch b/SOURCES/gdb-rhbz1480496-power-atomic-step-1of5.patch new file mode 100644 index 0000000..243979f --- /dev/null +++ b/SOURCES/gdb-rhbz1480496-power-atomic-step-1of5.patch @@ -0,0 +1,173 @@ +commit 62f7182c14492421b8d59ba5c6640d6c27ad6ea2 +Author: Anton Blanchard +Date: Fri Mar 28 12:37:37 2014 +1100 + + Fix ppc64 single step over atomic sequence testcase. + + The current ppc64 single step over atomic sequence testcase is written + in C and breaks with some versions of gcc. Convert the test to + assembly and use stepi to step through it. + + gdb/testsuite/ + 2014-04-01 Anton Blanchard + + * gdb.arch/ppc64-atomic-inst.c: Remove. + * gdb.arch/ppc64-atomic-inst.S: New file. + * gdb.arch/ppc64-atomic-inst.exp: Adapt for asm based testcase. + +### a/gdb/testsuite/ChangeLog +### b/gdb/testsuite/ChangeLog +## -1,3 +1,9 @@ ++2014-04-01 Anton Blanchard ++ ++ * gdb.arch/ppc64-atomic-inst.c: Remove. ++ * gdb.arch/ppc64-atomic-inst.S: New file. ++ * gdb.arch/ppc64-atomic-inst.exp: Adapt for asm based testcase. ++ + 2014-03-31 Doug Evans + + * gdb.base/print-symbol-loading-lib.c: New file. +--- /dev/null ++++ b/gdb/testsuite/gdb.arch/ppc64-atomic-inst.S +@@ -0,0 +1,61 @@ ++/* This file is part of GDB, the GNU debugger. ++ ++ Copyright 2008-2014 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 . */ ++ ++ .align 2 ++ .globl main ++#if _CALL_ELF == 2 ++ .type main,@function ++main: ++#else ++ .section ".opd","aw" ++ .align 3 ++main: ++ .quad .main,.TOC.@tocbase,0 ++ .size main,.-main ++ .previous ++ .globl .main ++ .type .main,@function ++.main: ++#endif ++ ++ li 0,0 ++ addi 4,1,-8 ++ ++ stw 0,0(4) ++1: lwarx 5,0,4 ++ cmpwi 5,0 ++ bne 2f ++ addi 5,5,1 ++ stwcx. 5,0,4 ++ bne 1b ++ ++ std 0,0(4) ++2: ldarx 5,0,4 ++ cmpdi 5,0 ++ bne 3f ++ addi 5,5,1 ++ stdcx. 5,0,4 ++ bne 1b ++ ++3: li 3,0 ++ blr ++ ++#if _CALL_ELF == 2 ++ .size main,.-main ++#else ++ .size .main,.-.main ++#endif +--- a/gdb/testsuite/gdb.arch/ppc64-atomic-inst.c ++++ /dev/null +@@ -1,44 +0,0 @@ +-/* This file is part of GDB, the GNU debugger. +- +- Copyright 2008-2013 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 . */ +- +-#include +- +-int main() +-{ +- unsigned int word = 0; +- unsigned int *word_addr = &word; +- unsigned long dword = 0; +- unsigned long *dword_addr = &dword; +- +- __asm __volatile ("1: lwarx %0,0,%2\n" \ +- " addi %0,%0,1\n" \ +- " stwcx. %0,0,%2\n" \ +- " bne- 1b" \ +- : "=&b" (word), "=m" (*word_addr) \ +- : "b" (word_addr), "m" (*word_addr) \ +- : "cr0", "memory"); \ +- +- __asm __volatile ("1: ldarx %0,0,%2\n" \ +- " addi %0,%0,1\n" \ +- " stdcx. %0,0,%2\n" \ +- " bne- 1b" \ +- : "=&b" (dword), "=m" (*dword_addr) \ +- : "b" (dword_addr), "m" (*dword_addr) \ +- : "cr0", "memory"); \ +- +- return 0; +-} +--- a/gdb/testsuite/gdb.arch/ppc64-atomic-inst.exp ++++ b/gdb/testsuite/gdb.arch/ppc64-atomic-inst.exp +@@ -27,7 +27,7 @@ if {![istarget "powerpc*"] || ![is_lp64_target]} { + } + + set testfile "ppc64-atomic-inst" +-set srcfile ${testfile}.c ++set srcfile ${testfile}.S + set binfile ${objdir}/${subdir}/${testfile} + set compile_flags {debug quiet} + +@@ -50,11 +50,18 @@ set bp1 [gdb_get_line_number "lwarx"] + gdb_breakpoint "$bp1" "Breakpoint $decimal at $hex" \ + "Set the breakpoint at the start of the sequence" + ++set bp2 [gdb_get_line_number "ldarx"] ++gdb_breakpoint "$bp2" "Breakpoint $decimal at $hex" \ ++ "Set the breakpoint at the start of the sequence" ++ + gdb_test continue "Continuing.*Breakpoint $decimal.*" \ + "Continue until breakpoint" + +-gdb_test next ".*__asm __volatile.*" \ ++gdb_test nexti "bne.*1b" \ + "Step through the lwarx/stwcx sequence" + +-gdb_test next ".*return 0.*" \ +- "Step through the ldarx/stdcx sequence" ++gdb_test continue "Continuing.*Breakpoint $decimal.*" \ ++ "Continue until breakpoint" ++ ++gdb_test nexti "bne.*1b" \ ++ "Step through the lwarx/stwcx sequence" diff --git a/SOURCES/gdb-rhbz1480496-power-atomic-step-2of5.patch b/SOURCES/gdb-rhbz1480496-power-atomic-step-2of5.patch new file mode 100644 index 0000000..b158a2c --- /dev/null +++ b/SOURCES/gdb-rhbz1480496-power-atomic-step-2of5.patch @@ -0,0 +1,51 @@ +commit 3114cea14b326c1d429388559f020103108b3019 +Author: Anton Blanchard +Date: Mon Mar 31 12:03:01 2014 +1100 + + gdb.arch/ppc64-atomic-inst.exp: Use standard_testfile, prepare_for_testing. + + gdb/testsuite/ + 2014-04-01 Anton Blanchard + + * gdb.arch/ppc64-atomic-inst.exp: Use standard_testfile, + prepare_for_testing. + +### a/gdb/testsuite/ChangeLog +### b/gdb/testsuite/ChangeLog +## -1,5 +1,10 @@ + 2014-04-01 Anton Blanchard + ++ * gdb.arch/ppc64-atomic-inst.exp: Use standard_testfile, ++ prepare_for_testing. ++ ++2014-04-01 Anton Blanchard ++ + * gdb.arch/ppc64-atomic-inst.c: Remove. + * gdb.arch/ppc64-atomic-inst.S: New file. + * gdb.arch/ppc64-atomic-inst.exp: Adapt for asm based testcase. +--- a/gdb/testsuite/gdb.arch/ppc64-atomic-inst.exp ++++ b/gdb/testsuite/gdb.arch/ppc64-atomic-inst.exp +@@ -26,21 +26,12 @@ if {![istarget "powerpc*"] || ![is_lp64_target]} { + return + } + +-set testfile "ppc64-atomic-inst" +-set srcfile ${testfile}.S +-set binfile ${objdir}/${subdir}/${testfile} +-set compile_flags {debug quiet} ++standard_testfile .S + +-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable $compile_flags] != "" } { +- unsupported "Testcase compile failed." ++if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} {debug quiet}] } { + return -1 + } + +-gdb_exit +-gdb_start +-gdb_reinitialize_dir $srcdir/$subdir +-gdb_load ${binfile} +- + if ![runto_main] then { + perror "Couldn't run to breakpoint" + continue diff --git a/SOURCES/gdb-rhbz1480496-power-atomic-step-3of5.patch b/SOURCES/gdb-rhbz1480496-power-atomic-step-3of5.patch new file mode 100644 index 0000000..edc75aa --- /dev/null +++ b/SOURCES/gdb-rhbz1480496-power-atomic-step-3of5.patch @@ -0,0 +1,61 @@ +commit 98d1b8dcd84bb39ba5d0731162f241890d4ce5f5 +Author: Anton Blanchard +Date: Mon Mar 31 13:32:07 2014 +1100 + + gdb.arch/ppc64-atomic-inst.exp: Improve error handling. + + gdb/testsuite/ + 2014-04-01 Anton Blanchard + + * gdb.arch/ppc64-atomic-inst.exp: Use untested. Make test + messages unique. + +### a/gdb/testsuite/ChangeLog +### b/gdb/testsuite/ChangeLog +## -1,5 +1,10 @@ + 2014-04-01 Anton Blanchard + ++ * gdb.arch/ppc64-atomic-inst.exp: Use untested. Make test ++ messages unique. ++ ++2014-04-01 Anton Blanchard ++ + * gdb.arch/ppc64-atomic-inst.exp: Use standard_testfile, + prepare_for_testing. + +--- a/gdb/testsuite/gdb.arch/ppc64-atomic-inst.exp ++++ b/gdb/testsuite/gdb.arch/ppc64-atomic-inst.exp +@@ -33,26 +33,26 @@ if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} {debug quiet}] + } + + if ![runto_main] then { +- perror "Couldn't run to breakpoint" +- continue ++ untested "could not run to main" ++ return -1 + } + + set bp1 [gdb_get_line_number "lwarx"] + gdb_breakpoint "$bp1" "Breakpoint $decimal at $hex" \ +- "Set the breakpoint at the start of the sequence" ++ "Set the breakpoint at the start of the lwarx/stwcx sequence" + + set bp2 [gdb_get_line_number "ldarx"] + gdb_breakpoint "$bp2" "Breakpoint $decimal at $hex" \ +- "Set the breakpoint at the start of the sequence" ++ "Set the breakpoint at the start of the ldarx/stdcx sequence" + + gdb_test continue "Continuing.*Breakpoint $decimal.*" \ +- "Continue until breakpoint" ++ "Continue until lwarx/stwcx start breakpoint" + + gdb_test nexti "bne.*1b" \ + "Step through the lwarx/stwcx sequence" + + gdb_test continue "Continuing.*Breakpoint $decimal.*" \ +- "Continue until breakpoint" ++ "Continue until ldarx/stdcx start breakpoint" + + gdb_test nexti "bne.*1b" \ +- "Step through the lwarx/stwcx sequence" ++ "Step through the ldarx/stdcx sequence" diff --git a/SOURCES/gdb-rhbz1480496-power-atomic-step-4of5.patch b/SOURCES/gdb-rhbz1480496-power-atomic-step-4of5.patch new file mode 100644 index 0000000..6fd352f --- /dev/null +++ b/SOURCES/gdb-rhbz1480496-power-atomic-step-4of5.patch @@ -0,0 +1,286 @@ +commit 7f03bd92e389a32da490bb55037881cf374d0f69 +Author: Pedro Alves +Date: Thu Aug 6 18:23:00 2015 +0100 + + PPC64: Fix gdb.arch/ppc64-atomic-inst.exp with displaced stepping + + The ppc64 displaced step code can't handle atomic sequences. Fallback + to stepping over the breakpoint in-line if we detect one. + + gdb/ChangeLog: + 2015-08-07 Pedro Alves + + * infrun.c (displaced_step_prepare_throw): Return -1 if + gdbarch_displaced_step_copy_insn returns NULL. Update intro + comment. + * rs6000-tdep.c (LWARX_MASK, LWARX_INSTRUCTION, LDARX_INSTRUCTION) + (STWCX_MASK, STWCX_INSTRUCTION, STDCX_INSTRUCTION): Move higher up + in file. + (ppc_displaced_step_copy_insn): New function. + (ppc_displaced_step_fixup): Update comment. + (rs6000_gdbarch_init): Install ppc_displaced_step_copy_insn as + gdbarch_displaced_step_copy_insn hook. + * gdbarch.sh (displaced_step_copy_insn): Document what happens on + NULL return. + * gdbarch.h: Regenerate. + + gdb/testsuite/ChangeLog: + 2015-08-07 Pedro Alves + + * gdb.arch/ppc64-atomic-inst.exp (do_test): New procedure, move + tests here. + (top level): Run do_test with and without displaced stepping. + +### a/gdb/ChangeLog +### b/gdb/ChangeLog +## -1,5 +1,21 @@ + 2015-08-07 Pedro Alves + ++ * infrun.c (displaced_step_prepare_throw): Return -1 if ++ gdbarch_displaced_step_copy_insn returns NULL. Update intro ++ comment. ++ * rs6000-tdep.c (LWARX_MASK, LWARX_INSTRUCTION, LDARX_INSTRUCTION) ++ (STWCX_MASK, STWCX_INSTRUCTION, STDCX_INSTRUCTION): Move higher up ++ in file. ++ (ppc_displaced_step_copy_insn): New function. ++ (ppc_displaced_step_fixup): Update comment. ++ (rs6000_gdbarch_init): Install ppc_displaced_step_copy_insn as ++ gdbarch_displaced_step_copy_insn hook. ++ * gdbarch.sh (displaced_step_copy_insn): Document what happens on ++ NULL return. ++ * gdbarch.h: Regenerate. ++ ++2015-08-07 Pedro Alves ++ + * inferior.h (struct inferior) : New + field. + * infrun.c (use_displaced_stepping_now_p): New parameter 'inf'. +Index: gdb-7.6.1/gdb/gdbarch.h +=================================================================== +--- gdb-7.6.1.orig/gdb/gdbarch.h 2017-08-29 21:41:21.400218851 +0200 ++++ gdb-7.6.1/gdb/gdbarch.h 2017-08-29 21:41:29.832299833 +0200 +@@ -870,7 +870,11 @@ + + If your architecture doesn't need to adjust instructions before + single-stepping them, consider using simple_displaced_step_copy_insn +- here. */ ++ here. ++ ++ If the instruction cannot execute out of line, return NULL. The ++ core falls back to stepping past the instruction in-line instead in ++ that case. */ + + extern int gdbarch_displaced_step_copy_insn_p (struct gdbarch *gdbarch); + +Index: gdb-7.6.1/gdb/gdbarch.sh +=================================================================== +--- gdb-7.6.1.orig/gdb/gdbarch.sh 2017-08-29 21:41:21.401218861 +0200 ++++ gdb-7.6.1/gdb/gdbarch.sh 2017-08-29 21:41:29.833299843 +0200 +@@ -724,6 +724,10 @@ + # If your architecture doesn't need to adjust instructions before + # single-stepping them, consider using simple_displaced_step_copy_insn + # here. ++# ++# If the instruction cannot execute out of line, return NULL. The ++# core falls back to stepping past the instruction in-line instead in ++# that case. + M:struct displaced_step_closure *:displaced_step_copy_insn:CORE_ADDR from, CORE_ADDR to, struct regcache *regs:from, to, regs + + # Return true if GDB should use hardware single-stepping to execute +Index: gdb-7.6.1/gdb/infrun.c +=================================================================== +--- gdb-7.6.1.orig/gdb/infrun.c 2017-08-29 21:41:21.404218890 +0200 ++++ gdb-7.6.1/gdb/infrun.c 2017-08-29 21:41:29.835299862 +0200 +@@ -1323,7 +1323,9 @@ + explain how we handle this case instead. + + Returns 1 if preparing was successful -- this thread is going to be +- stepped now; or 0 if displaced stepping this thread got queued. */ ++ stepped now; 0 if displaced stepping this thread got queued; or -1 ++ if this instruction can't be displaced stepped. */ ++ + static int + displaced_step_prepare (ptid_t ptid) + { +@@ -1412,9 +1414,14 @@ + + closure = gdbarch_displaced_step_copy_insn (gdbarch, + original, copy, regcache); +- +- /* We don't support the fully-simulated case at present. */ +- gdb_assert (closure); ++ if (closure == NULL) ++ { ++ /* The architecture doesn't know how or want to displaced step ++ this instruction or instruction sequence. Fallback to ++ stepping over the breakpoint in-line. */ ++ do_cleanups (old_cleanups); ++ return -1; ++ } + + /* Save the information we need to fix things up if the step + succeeds. */ +Index: gdb-7.6.1/gdb/rs6000-tdep.c +=================================================================== +--- gdb-7.6.1.orig/gdb/rs6000-tdep.c 2017-08-29 21:41:21.407218918 +0200 ++++ gdb-7.6.1/gdb/rs6000-tdep.c 2017-08-29 21:41:29.837299881 +0200 +@@ -975,6 +975,61 @@ + #define BXL_INSN 0x4c000000 + #define BP_INSN 0x7C000008 + ++/* Instruction masks used during single-stepping of atomic ++ sequences. */ ++#define LWARX_MASK 0xfc0007fe ++#define LWARX_INSTRUCTION 0x7c000028 ++#define LDARX_INSTRUCTION 0x7c0000A8 ++#define STWCX_MASK 0xfc0007ff ++#define STWCX_INSTRUCTION 0x7c00012d ++#define STDCX_INSTRUCTION 0x7c0001ad ++ ++/* We can't displaced step atomic sequences. Otherwise this is just ++ like simple_displaced_step_copy_insn. */ ++ ++static struct displaced_step_closure * ++ppc_displaced_step_copy_insn (struct gdbarch *gdbarch, ++ CORE_ADDR from, CORE_ADDR to, ++ struct regcache *regs) ++{ ++ size_t len = gdbarch_max_insn_length (gdbarch); ++ gdb_byte *buf = xmalloc (len); ++ struct cleanup *old_chain = make_cleanup (xfree, buf); ++ enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); ++ int insn; ++ ++ read_memory (from, buf, len); ++ ++ insn = extract_signed_integer (buf, PPC_INSN_SIZE, byte_order); ++ ++ /* Assume all atomic sequences start with a lwarx/ldarx instruction. */ ++ if ((insn & LWARX_MASK) == LWARX_INSTRUCTION ++ || (insn & LWARX_MASK) == LDARX_INSTRUCTION) ++ { ++ if (debug_displaced) ++ { ++ fprintf_unfiltered (gdb_stdlog, ++ "displaced: can't displaced step " ++ "atomic sequence at %s\n", ++ paddress (gdbarch, from)); ++ } ++ do_cleanups (old_chain); ++ return NULL; ++ } ++ ++ write_memory (to, buf, len); ++ ++ if (debug_displaced) ++ { ++ fprintf_unfiltered (gdb_stdlog, "displaced: copy %s->%s: ", ++ paddress (gdbarch, from), paddress (gdbarch, to)); ++ displaced_step_dump_bytes (gdb_stdlog, buf, len); ++ } ++ ++ discard_cleanups (old_chain); ++ return (struct displaced_step_closure *) buf; ++} ++ + /* Fix up the state of registers and memory after having single-stepped + a displaced instruction. */ + static void +@@ -984,8 +1039,7 @@ + struct regcache *regs) + { + enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); +- /* Since we use simple_displaced_step_copy_insn, our closure is a +- copy of the instruction. */ ++ /* Our closure is a copy of the instruction. */ + ULONGEST insn = extract_unsigned_integer ((gdb_byte *) closure, + PPC_INSN_SIZE, byte_order); + ULONGEST opcode = 0; +@@ -1078,14 +1132,6 @@ + return 1; + } + +-/* Instruction masks used during single-stepping of atomic sequences. */ +-#define LWARX_MASK 0xfc0007fe +-#define LWARX_INSTRUCTION 0x7c000028 +-#define LDARX_INSTRUCTION 0x7c0000A8 +-#define STWCX_MASK 0xfc0007ff +-#define STWCX_INSTRUCTION 0x7c00012d +-#define STDCX_INSTRUCTION 0x7c0001ad +- + /* Checks for an atomic sequence of instructions beginning with a LWARX/LDARX + instruction and ending with a STWCX/STDCX instruction. If such a sequence + is found, attempt to step through it. A breakpoint is placed at the end of +@@ -6427,7 +6473,7 @@ + + /* Setup displaced stepping. */ + set_gdbarch_displaced_step_copy_insn (gdbarch, +- simple_displaced_step_copy_insn); ++ ppc_displaced_step_copy_insn); + set_gdbarch_displaced_step_hw_singlestep (gdbarch, + ppc_displaced_step_hw_singlestep); + set_gdbarch_displaced_step_fixup (gdbarch, ppc_displaced_step_fixup); +Index: gdb-7.6.1/gdb/testsuite/gdb.arch/ppc64-atomic-inst.exp +=================================================================== +--- gdb-7.6.1.orig/gdb/testsuite/gdb.arch/ppc64-atomic-inst.exp 2017-08-29 21:41:21.408218928 +0200 ++++ gdb-7.6.1/gdb/testsuite/gdb.arch/ppc64-atomic-inst.exp 2017-08-29 21:41:29.837299881 +0200 +@@ -32,27 +32,41 @@ + return -1 + } + +-if ![runto_main] then { +- untested "could not run to main" +- return -1 +-} ++# The test proper. DISPLACED is true if we should try with displaced ++# stepping. ++proc do_test { displaced } { ++ global decimal hex ++ ++ if ![runto_main] then { ++ untested "could not run to main" ++ return -1 ++ } ++ ++ gdb_test_no_output "set displaced-stepping $displaced" + +-set bp1 [gdb_get_line_number "lwarx"] +-gdb_breakpoint "$bp1" "Breakpoint $decimal at $hex" \ +- "Set the breakpoint at the start of the lwarx/stwcx sequence" ++ set bp1 [gdb_get_line_number "lwarx"] ++ gdb_breakpoint "$bp1" "Breakpoint $decimal at $hex" \ ++ "Set the breakpoint at the start of the lwarx/stwcx sequence" + +-set bp2 [gdb_get_line_number "ldarx"] +-gdb_breakpoint "$bp2" "Breakpoint $decimal at $hex" \ +- "Set the breakpoint at the start of the ldarx/stdcx sequence" ++ set bp2 [gdb_get_line_number "ldarx"] ++ gdb_breakpoint "$bp2" "Breakpoint $decimal at $hex" \ ++ "Set the breakpoint at the start of the ldarx/stdcx sequence" + +-gdb_test continue "Continuing.*Breakpoint $decimal.*" \ +- "Continue until lwarx/stwcx start breakpoint" ++ gdb_test continue "Continuing.*Breakpoint $decimal.*" \ ++ "Continue until lwarx/stwcx start breakpoint" + +-gdb_test nexti "bne.*1b" \ +- "Step through the lwarx/stwcx sequence" ++ gdb_test nexti "bne.*1b" \ ++ "Step through the lwarx/stwcx sequence" + +-gdb_test continue "Continuing.*Breakpoint $decimal.*" \ +- "Continue until ldarx/stdcx start breakpoint" ++ gdb_test continue "Continuing.*Breakpoint $decimal.*" \ ++ "Continue until ldarx/stdcx start breakpoint" + +-gdb_test nexti "bne.*1b" \ +- "Step through the ldarx/stdcx sequence" ++ gdb_test nexti "bne.*1b" \ ++ "Step through the ldarx/stdcx sequence" ++} ++ ++foreach displaced { "off" "on" } { ++ with_test_prefix "displaced=$displaced" { ++ do_test $displaced ++ } ++} diff --git a/SOURCES/gdb-rhbz1480496-power-atomic-step-5of5.patch b/SOURCES/gdb-rhbz1480496-power-atomic-step-5of5.patch new file mode 100644 index 0000000..4933426 --- /dev/null +++ b/SOURCES/gdb-rhbz1480496-power-atomic-step-5of5.patch @@ -0,0 +1,399 @@ +commit 2039d74e780db6659c87cd3c426d526615cfe703 +Author: Edjunior Barbosa Machado +Date: Tue Feb 21 11:14:56 2017 -0300 + + [ppc64] Add POWER8/ISA 2.07 atomic sequences single-stepping support + + gdb/ + 2017-02-21 Edjunior Barbosa Machado + + * rs6000-tdep.c (LOAD_AND_RESERVE_MASK): Rename from LWARX_MASK. + (STORE_CONDITIONAL_MASK): Rename from STWCX_MASK. + (LBARX_INSTRUCTION, LHARX_INSTRUCTION, LQARX_INSTRUCTION, + STBCX_INSTRUCTION, STHCX_INSTRUCTION, STQCX_INSTRUCTION): New defines. + (IS_LOAD_AND_RESERVE_INSN, IS_STORE_CONDITIONAL_INSN): New macros. + (ppc_displaced_step_copy_insn): Use IS_LOAD_AND_RESERVE_INSN. + (ppc_deal_with_atomic_sequence): Use IS_LOAD_AND_RESERVE_INSN and + IS_STORE_CONDITIONAL_INSN. + + gdb/testsuite/ + 2017-02-21 Edjunior Barbosa Machado + + * gdb.arch/ppc64-isa207-atomic-inst.exp: New testcase based on + gdb.arch/ppc64-atomic-inst.exp. Add tests for lbarx/stbcx, lharx/sthcx + and lqarx/stqcx. + * gdb.arch/ppc64-isa207-atomic-inst.S: New file. + * gdb.arch/ppc64-isa207-atomic-inst.c: Likewise. + +### a/gdb/ChangeLog +### b/gdb/ChangeLog +## -1,3 +1,14 @@ ++2017-02-21 Edjunior Barbosa Machado ++ ++ * rs6000-tdep.c (LOAD_AND_RESERVE_MASK): Rename from LWARX_MASK. ++ (STORE_CONDITIONAL_MASK): Rename from STWCX_MASK. ++ (LBARX_INSTRUCTION, LHARX_INSTRUCTION, LQARX_INSTRUCTION, ++ STBCX_INSTRUCTION, STHCX_INSTRUCTION, STQCX_INSTRUCTION): New defines. ++ (IS_LOAD_AND_RESERVE_INSN, IS_STORE_CONDITIONAL_INSN): New macros. ++ (ppc_displaced_step_copy_insn): Use IS_LOAD_AND_RESERVE_INSN. ++ (ppc_deal_with_atomic_sequence): Use IS_LOAD_AND_RESERVE_INSN and ++ IS_STORE_CONDITIONAL_INSN. ++ + 2017-02-21 Jan Kratochvil + + * dwarf2_rnglists_process: Initialize range_beginning and range_end. +Index: gdb-7.6.1/gdb/rs6000-tdep.c +=================================================================== +--- gdb-7.6.1.orig/gdb/rs6000-tdep.c 2017-08-29 21:41:48.797481976 +0200 ++++ gdb-7.6.1/gdb/rs6000-tdep.c 2017-08-29 21:44:12.643863483 +0200 +@@ -977,12 +977,33 @@ + + /* Instruction masks used during single-stepping of atomic + sequences. */ +-#define LWARX_MASK 0xfc0007fe ++#define LOAD_AND_RESERVE_MASK 0xfc0007fe + #define LWARX_INSTRUCTION 0x7c000028 + #define LDARX_INSTRUCTION 0x7c0000A8 +-#define STWCX_MASK 0xfc0007ff ++#define LBARX_INSTRUCTION 0x7c000068 ++#define LHARX_INSTRUCTION 0x7c0000e8 ++#define LQARX_INSTRUCTION 0x7c000228 ++#define STORE_CONDITIONAL_MASK 0xfc0007ff + #define STWCX_INSTRUCTION 0x7c00012d + #define STDCX_INSTRUCTION 0x7c0001ad ++#define STBCX_INSTRUCTION 0x7c00056d ++#define STHCX_INSTRUCTION 0x7c0005ad ++#define STQCX_INSTRUCTION 0x7c00016d ++ ++/* Check if insn is one of the Load And Reserve instructions used for atomic ++ sequences. */ ++#define IS_LOAD_AND_RESERVE_INSN(insn) ((insn & LOAD_AND_RESERVE_MASK) == LWARX_INSTRUCTION \ ++ || (insn & LOAD_AND_RESERVE_MASK) == LDARX_INSTRUCTION \ ++ || (insn & LOAD_AND_RESERVE_MASK) == LBARX_INSTRUCTION \ ++ || (insn & LOAD_AND_RESERVE_MASK) == LHARX_INSTRUCTION \ ++ || (insn & LOAD_AND_RESERVE_MASK) == LQARX_INSTRUCTION) ++/* Check if insn is one of the Store Conditional instructions used for atomic ++ sequences. */ ++#define IS_STORE_CONDITIONAL_INSN(insn) ((insn & STORE_CONDITIONAL_MASK) == STWCX_INSTRUCTION \ ++ || (insn & STORE_CONDITIONAL_MASK) == STDCX_INSTRUCTION \ ++ || (insn & STORE_CONDITIONAL_MASK) == STBCX_INSTRUCTION \ ++ || (insn & STORE_CONDITIONAL_MASK) == STHCX_INSTRUCTION \ ++ || (insn & STORE_CONDITIONAL_MASK) == STQCX_INSTRUCTION) + + /* We can't displaced step atomic sequences. Otherwise this is just + like simple_displaced_step_copy_insn. */ +@@ -1002,9 +1023,8 @@ + + insn = extract_signed_integer (buf, PPC_INSN_SIZE, byte_order); + +- /* Assume all atomic sequences start with a lwarx/ldarx instruction. */ +- if ((insn & LWARX_MASK) == LWARX_INSTRUCTION +- || (insn & LWARX_MASK) == LDARX_INSTRUCTION) ++ /* Assume all atomic sequences start with a Load and Reserve instruction. */ ++ if (IS_LOAD_AND_RESERVE_INSN (insn)) + { + if (debug_displaced) + { +@@ -1132,11 +1152,10 @@ + return 1; + } + +-/* Checks for an atomic sequence of instructions beginning with a LWARX/LDARX +- instruction and ending with a STWCX/STDCX instruction. If such a sequence +- is found, attempt to step through it. A breakpoint is placed at the end of +- the sequence. */ +- ++/* Checks for an atomic sequence of instructions beginning with a ++ Load And Reserve instruction and ending with a Store Conditional ++ instruction. If such a sequence is found, attempt to step through it. ++ A breakpoint is placed at the end of the sequence. */ + int + ppc_deal_with_atomic_sequence (struct frame_info *frame) + { +@@ -1155,9 +1174,8 @@ + int opcode; /* Branch instruction's OPcode. */ + int bc_insn_count = 0; /* Conditional branch instruction count. */ + +- /* Assume all atomic sequences start with a lwarx/ldarx instruction. */ +- if ((insn & LWARX_MASK) != LWARX_INSTRUCTION +- && (insn & LWARX_MASK) != LDARX_INSTRUCTION) ++ /* Assume all atomic sequences start with a Load And Reserve instruction. */ ++ if (!IS_LOAD_AND_RESERVE_INSN (insn)) + return 0; + + /* Assume that no atomic sequence is longer than "atomic_sequence_length" +@@ -1188,14 +1206,13 @@ + last_breakpoint++; + } + +- if ((insn & STWCX_MASK) == STWCX_INSTRUCTION +- || (insn & STWCX_MASK) == STDCX_INSTRUCTION) ++ if (IS_STORE_CONDITIONAL_INSN (insn)) + break; + } + +- /* Assume that the atomic sequence ends with a stwcx/stdcx instruction. */ +- if ((insn & STWCX_MASK) != STWCX_INSTRUCTION +- && (insn & STWCX_MASK) != STDCX_INSTRUCTION) ++ /* Assume that the atomic sequence ends with a Store Conditional ++ instruction. */ ++ if (!IS_STORE_CONDITIONAL_INSN (insn)) + return 0; + + closing_insn = loc; +Index: gdb-7.6.1/gdb/testsuite/gdb.arch/ppc64-isa207-atomic-inst.S +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.6.1/gdb/testsuite/gdb.arch/ppc64-isa207-atomic-inst.S 2017-08-29 21:41:50.528498600 +0200 +@@ -0,0 +1,100 @@ ++/* This file is part of GDB, the GNU debugger. ++ ++ Copyright 2017 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 . */ ++ ++ .align 2 ++ .globl test_atomic_sequences ++#if _CALL_ELF == 2 ++ .type test_atomic_sequences,@function ++test_atomic_sequences: ++#else ++ .section ".opd","aw" ++ .align 3 ++test_atomic_sequences: ++ .quad .test_atomic_sequences,.TOC.@tocbase,0 ++ .size test_atomic_sequences,.-test_atomic_sequences ++ .previous ++ .globl .test_atomic_sequences ++ .type .test_atomic_sequences,@function ++.test_atomic_sequences: ++#endif ++ ++ li 0,0 ++ addi 4,1,-8 ++ ++ stb 0,0(4) ++1: lbarx 5,0,4 ++ cmpdi 5,0 ++ bne 2f ++ addi 5,5,1 ++ stbcx. 5,0,4 ++ bne 1b ++ ++ sth 0,0(4) ++2: lharx 5,0,4 ++ cmpdi 5,0 ++ bne 3f ++ addi 5,5,1 ++ sthcx. 5,0,4 ++ bne 2b ++ ++#ifdef __BIG_ENDIAN__ ++ li 10,0 ++ li 6,0 ++ li 7,1 ++ std 10,-16(1) ++ li 10,1 ++ std 10,-8(1) ++ addi 4,1,-16 ++#else ++ std 9,40(1) ++ li 9,1 ++ addi 4,1,32 ++ std 9,32(1) ++ mr 8,9 ++ ld 3,8(4) ++#endif ++3: lqarx 10,0,4 ++#ifdef __BIG_ENDIAN__ ++ li 8,0 ++ li 9,2 ++ mr 5,10 ++ xor 10,11,7 ++ xor 5,5,6 ++ or. 4,5,10 ++ bne 4f ++ addi 10,1,-16 ++ stqcx. 8,0,10 ++#else ++ xor 9,11,8 ++ mr 6,11 ++ xor 11,10,3 ++ or. 0,9,11 ++ bne 4f ++ li 14,0 ++ li 15,2 ++ stqcx. 14,0,4 ++#endif ++ bne 3b ++ ++4: li 3,0 ++ blr ++ ++#if _CALL_ELF == 2 ++ .size test_atomic_sequences,.-test_atomic_sequences ++#else ++ .size .test_atomic_sequences,.-.test_atomic_sequences ++#endif +Index: gdb-7.6.1/gdb/testsuite/gdb.arch/ppc64-isa207-atomic-inst.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.6.1/gdb/testsuite/gdb.arch/ppc64-isa207-atomic-inst.c 2017-08-29 21:41:50.528498600 +0200 +@@ -0,0 +1,42 @@ ++/* Copyright 2017 Free Software Foundation, Inc. ++ ++ This file is part of GDB. ++ ++ 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 . */ ++ ++#include ++ ++typedef Elf64_auxv_t auxv_t; ++ ++#ifndef PPC_FEATURE2_ARCH_2_07 ++#define PPC_FEATURE2_ARCH_2_07 0x80000000 ++#endif ++ ++extern void test_atomic_sequences (void); ++ ++int ++main (int argc, char *argv[], char *envp[], auxv_t auxv[]) ++{ ++ int i; ++ ++ for (i = 0; auxv[i].a_type != AT_NULL; i++) ++ if (auxv[i].a_type == AT_HWCAP2) { ++ if (!(auxv[i].a_un.a_val & PPC_FEATURE2_ARCH_2_07)) ++ return 1; ++ break; ++ } ++ ++ test_atomic_sequences (); ++ return 0; ++} +Index: gdb-7.6.1/gdb/testsuite/gdb.arch/ppc64-isa207-atomic-inst.exp +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.6.1/gdb/testsuite/gdb.arch/ppc64-isa207-atomic-inst.exp 2017-08-29 21:41:50.528498600 +0200 +@@ -0,0 +1,99 @@ ++# Copyright 2017 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, write to the Free Software ++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++# ++# This file is part of the gdb testsuite. ++ ++# Test single stepping through POWER8/ISA 2.07 atomic sequences beginning with ++# a lbarx/lharx/lqarx instruction and ending with a stbcx/sthcx/stqxc ++# instruction. Note that although lbarx, lharx, stbcx and sthcx instructions ++# were introduced in ISA 2.06, they were implemented only in POWER8 (ISA 2.07). ++ ++ ++if {![istarget "powerpc*"] || ![is_lp64_target]} { ++ untested "skipping powerpc isa 207 atomic sequences test" ++ return ++} ++ ++standard_testfile .c .S ++ ++if { [prepare_for_testing "failed to prepare" $testfile "$srcfile $srcfile2" \ ++ {debug quiet}] } { ++ return -1 ++} ++ ++# The test proper. DISPLACED is true if we should try with displaced ++# stepping. ++ ++proc do_test { displaced } { ++ global decimal hex ++ global gdb_prompt inferior_exited_re srcfile srcfile2 ++ ++ if ![runto_main] then { ++ untested "could not run to main" ++ return -1 ++ } ++ ++ gdb_test_no_output "set displaced-stepping $displaced" ++ ++ gdb_breakpoint "test_atomic_sequences" "Breakpoint $decimal at $hex" \ ++ "set the breakpoint at the start of the test function" ++ ++ gdb_test_multiple "continue" "Continue until lbarx/stbcx start breakpoint" { ++ -re "$inferior_exited_re with code 01.\[\r\n\]+$gdb_prompt $" { ++ unsupported "POWER8/ISA 2.07 atomic instructions not supported." ++ return -1 ++ } ++ -re "Continuing.*Breakpoint $decimal.*$gdb_prompt $" { ++ pass "continue until test_atomic_sequences function" ++ } ++ } ++ ++ set bp1 [gdb_get_line_number "lbarx" "$srcfile2"] ++ gdb_breakpoint "$bp1" "Breakpoint $decimal at $hex" \ ++ "set the breakpoint at the start of the lbarx/stbcx sequence" ++ ++ set bp2 [gdb_get_line_number "lharx" "$srcfile2"] ++ gdb_breakpoint "$bp2" "Breakpoint $decimal at $hex" \ ++ "set the breakpoint at the start of the lharx/sthcx sequence" ++ ++ set bp3 [gdb_get_line_number "lqarx" "$srcfile2"] ++ gdb_breakpoint "$bp3" "Breakpoint $decimal at $hex" \ ++ "set the breakpoint at the start of the lqarx/stqcx sequence" ++ ++ gdb_test continue "Continuing.*Breakpoint $decimal.*" \ ++ "continue until lbarx/stbcx start breakpoint" ++ ++ gdb_test nexti "bne.*1b" \ ++ "step through the lbarx/stbcx sequence" ++ ++ gdb_test continue "Continuing.*Breakpoint $decimal.*" \ ++ "continue until lharx/sthcx start breakpoint" ++ ++ gdb_test nexti "bne.*2b" \ ++ "step through the lharx/sthcx sequence" ++ ++ gdb_test continue "Continuing.*Breakpoint $decimal.*" \ ++ "continue until ldqrx/stqcx start breakpoint" ++ ++ gdb_test nexti "bne.*3b" \ ++ "step through the lqarx/stqcx sequence" ++} ++ ++foreach displaced { "off" "on" } { ++ with_test_prefix "displaced=$displaced" { ++ do_test $displaced ++ } ++} diff --git a/SOURCES/gdb-rhbz1480497-ppc64le-shortvec-retval.patch b/SOURCES/gdb-rhbz1480497-ppc64le-shortvec-retval.patch new file mode 100644 index 0000000..7e7d7ce --- /dev/null +++ b/SOURCES/gdb-rhbz1480497-ppc64le-shortvec-retval.patch @@ -0,0 +1,90 @@ +commit a1da2672bdc5adc551ad30d73eccea902063f583 +Author: Ulrich Weigand +Date: Fri Jun 12 17:43:48 2015 +0200 + + ppc64: Handle short vectors as function return types + + Short synthetic vector types (i.e. those defined using GCC's + attribute ((vector_size)) instead of AltiVec vector types) + are returned in r3. Fix ppc64_sysv_abi_return_value to + correctly handle this. + + gdb/ChangeLog: + + * ppc-sysv-tdep.c (ppc64_sysv_abi_return_value_base): Handle short + synthetic (non-AltiVec) vector types. + (ppc64_sysv_abi_return_value): Likewise. + +### a/gdb/ChangeLog +### b/gdb/ChangeLog +## -1,3 +1,9 @@ ++2015-05-12 Ulrich Weigand ++ ++ * ppc-sysv-tdep.c (ppc64_sysv_abi_return_value_base): Handle short ++ synthetic (non-AltiVec) vector types. ++ (ppc64_sysv_abi_return_value): Likewise. ++ + 2015-06-12 Antoine Tremblay + + PR breakpoints/16465 +--- a/gdb/ppc-sysv-tdep.c ++++ b/gdb/ppc-sysv-tdep.c +@@ -1892,7 +1892,8 @@ ppc64_sysv_abi_return_value_base (struct gdbarch *gdbarch, struct type *valtype, + } + + /* AltiVec vectors are returned in VRs starting at v2. */ +- if (TYPE_CODE (valtype) == TYPE_CODE_ARRAY && TYPE_VECTOR (valtype) ++ if (TYPE_LENGTH (valtype) == 16 ++ && TYPE_CODE (valtype) == TYPE_CODE_ARRAY && TYPE_VECTOR (valtype) + && tdep->vector_abi == POWERPC_VEC_ALTIVEC) + { + int regnum = tdep->ppc_vr0_regnum + 2 + index; +@@ -1904,6 +1905,25 @@ ppc64_sysv_abi_return_value_base (struct gdbarch *gdbarch, struct type *valtype, + return 1; + } + ++ /* Short vectors are returned in GPRs starting at r3. */ ++ if (TYPE_LENGTH (valtype) <= 8 ++ && TYPE_CODE (valtype) == TYPE_CODE_ARRAY && TYPE_VECTOR (valtype)) ++ { ++ int regnum = tdep->ppc_gp0_regnum + 3 + index; ++ int offset = 0; ++ ++ if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG) ++ offset = 8 - TYPE_LENGTH (valtype); ++ ++ if (writebuf != NULL) ++ regcache_cooked_write_part (regcache, regnum, ++ offset, TYPE_LENGTH (valtype), writebuf); ++ if (readbuf != NULL) ++ regcache_cooked_read_part (regcache, regnum, ++ offset, TYPE_LENGTH (valtype), readbuf); ++ return 1; ++ } ++ + return 0; + } + +@@ -1993,6 +2013,7 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct value *function, + + /* Small character arrays are returned, right justified, in r3. */ + if (TYPE_CODE (valtype) == TYPE_CODE_ARRAY ++ && !TYPE_VECTOR (valtype) + && TYPE_LENGTH (valtype) <= 8 + && TYPE_CODE (TYPE_TARGET_TYPE (valtype)) == TYPE_CODE_INT + && TYPE_LENGTH (TYPE_TARGET_TYPE (valtype)) == 1) +@@ -2012,7 +2033,13 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct value *function, + /* In the ELFv2 ABI, homogeneous floating-point or vector + aggregates are returned in registers. */ + if (tdep->elf_abi == POWERPC_ELF_V2 +- && ppc64_elfv2_abi_homogeneous_aggregate (valtype, &eltype, &nelt)) ++ && ppc64_elfv2_abi_homogeneous_aggregate (valtype, &eltype, &nelt) ++ && (TYPE_CODE (eltype) == TYPE_CODE_FLT ++ || TYPE_CODE (eltype) == TYPE_CODE_DECFLOAT ++ || (TYPE_CODE (eltype) == TYPE_CODE_ARRAY ++ && TYPE_VECTOR (eltype) ++ && tdep->vector_abi == POWERPC_VEC_ALTIVEC ++ && TYPE_LENGTH (eltype) == 16))) + { + for (i = 0; i < nelt; i++) + { diff --git a/SOURCES/gdb-rhbz1480498-power-record-1of3.patch b/SOURCES/gdb-rhbz1480498-power-record-1of3.patch new file mode 100644 index 0000000..652c7b5 --- /dev/null +++ b/SOURCES/gdb-rhbz1480498-power-record-1of3.patch @@ -0,0 +1,51 @@ +commit d44c67f38178c5ad0c083ebff6429d6e477ea42e +Author: Edjunior Barbosa Machado +Date: Thu Aug 18 10:45:12 2016 -0300 + + ppc: Fix record of HTM instructions + + The patch fixes the record support of Hardware Transactional Memory + instructions on Power. It also solves a large number of unexpected failures + from gdb.reverse testcases sigall-precsave.exp and sigall-reverse.exp that + occur on distros which glibc uses HTM instructions. + + gdb/ChangeLog + 2016-08-18 Edjunior Barbosa Machado + + * rs6000-tdep.c (ppc_process_record_op31): Handle HTM instructions. + +### a/gdb/ChangeLog +### b/gdb/ChangeLog +## -1,3 +1,7 @@ ++2016-08-18 Edjunior Barbosa Machado ++ ++ * rs6000-tdep.c (ppc_process_record_op31): Handle HTM instructions. ++ + 2016-08-17 Simon Marchi + + * inferior.c (remove_inferior_command): Fix error message. +--- a/gdb/rs6000-tdep.c ++++ b/gdb/rs6000-tdep.c +@@ -4613,17 +4613,17 @@ ppc_process_record_op31 (struct gdbarch *gdbarch, struct regcache *regcache, + + case 654: /* Transaction Begin */ + case 686: /* Transaction End */ +- case 718: /* Transaction Check */ + case 750: /* Transaction Suspend or Resume */ + case 782: /* Transaction Abort Word Conditional */ + case 814: /* Transaction Abort Doubleword Conditional */ + case 846: /* Transaction Abort Word Conditional Immediate */ + case 878: /* Transaction Abort Doubleword Conditional Immediate */ + case 910: /* Transaction Abort */ +- fprintf_unfiltered (gdb_stdlog, "Cannot record Transaction instructions. " +- "%08x at %s, 31-%d.\n", +- insn, paddress (gdbarch, addr), ext); +- return -1; ++ record_full_arch_list_add_reg (regcache, tdep->ppc_ps_regnum); ++ /* FALL-THROUGH */ ++ case 718: /* Transaction Check */ ++ record_full_arch_list_add_reg (regcache, tdep->ppc_cr_regnum); ++ return 0; + + case 1014: /* Data Cache Block set to Zero */ + if (target_auxv_search (¤t_target, AT_DCACHEBSIZE, &at_dcsz) <= 0 diff --git a/SOURCES/gdb-rhbz1480498-power-record-2of3.patch b/SOURCES/gdb-rhbz1480498-power-record-2of3.patch new file mode 100644 index 0000000..10508c7 --- /dev/null +++ b/SOURCES/gdb-rhbz1480498-power-record-2of3.patch @@ -0,0 +1,58 @@ +commit 9f7efd5bf76aa5065298d13aefb109ecfd7a825a +Author: Edjunior Barbosa Machado +Date: Tue Sep 20 12:24:30 2016 -0300 + + ppc: Fix record support of Store String Word instructions + + gdb/ChangeLog + 2016-09-20 Edjunior Barbosa Machado + + * rs6000-tdep.c (ppc_process_record_op31): Fix record of Store String + Word instructions. + +### a/gdb/ChangeLog +### b/gdb/ChangeLog +## -1,3 +1,8 @@ ++2016-09-20 Edjunior Barbosa Machado ++ ++ * rs6000-tdep.c (ppc_process_record_op31): Fix record of Store String ++ Word instructions. ++ + 2016-09-20 Sergio Durigan Junior + + * fork-inferior.c (startup_inferior): Pass 'event_ptid' instead of +Index: gdb-7.6.1/gdb/rs6000-tdep.c +=================================================================== +--- gdb-7.6.1.orig/gdb/rs6000-tdep.c 2017-08-29 20:31:52.226270560 +0200 ++++ gdb-7.6.1/gdb/rs6000-tdep.c 2017-08-29 20:32:00.121345605 +0200 +@@ -4642,7 +4642,8 @@ + case 725: /* Store String Word Immediate */ + ra = 0; + if (PPC_RA (insn) != 0) +- regcache_raw_read_unsigned (regcache, tdep->ppc_xer_regnum, &ra); ++ regcache_raw_read_unsigned (regcache, ++ tdep->ppc_gp0_regnum + PPC_RA (insn), &ra); + ea += ra; + + nb = PPC_NB (insn); +@@ -4657,7 +4658,8 @@ + case 661: /* Store String Word Indexed */ + ra = 0; + if (PPC_RA (insn) != 0) +- regcache_raw_read_unsigned (regcache, tdep->ppc_xer_regnum, &ra); ++ regcache_raw_read_unsigned (regcache, ++ tdep->ppc_gp0_regnum + PPC_RA (insn), &ra); + ea += ra; + + regcache_raw_read_unsigned (regcache, tdep->ppc_xer_regnum, &xer); +@@ -4665,7 +4667,9 @@ + + if (nb != 0) + { +- regcache_raw_read_unsigned (regcache, tdep->ppc_xer_regnum, &rb); ++ regcache_raw_read_unsigned (regcache, ++ tdep->ppc_gp0_regnum + PPC_RB (insn), ++ &rb); + ea += rb; + if (record_full_arch_list_add_mem (ea, nb) != 0) + return -1; diff --git a/SOURCES/gdb-rhbz1480498-power-record-3of3.patch b/SOURCES/gdb-rhbz1480498-power-record-3of3.patch new file mode 100644 index 0000000..2e6905c --- /dev/null +++ b/SOURCES/gdb-rhbz1480498-power-record-3of3.patch @@ -0,0 +1,54 @@ +commit 8aabe2e254e6a0419db9c6397c4068c69bfd95b0 +Author: Edjunior Barbosa Machado +Date: Wed Sep 21 14:47:43 2016 -0300 + + ppc: Fix return of instruction handlers in ppc_process_record_op63 + + some instruction handlers in ppc_process_record_op63() seem to be missing + return or incorrectly using break. This patch aims to fix that. + + gdb/ChangeLog: + 2016-09-21 Edjunior Barbosa Machado + + * rs6000-tdep.c (ppc_process_record_op63): Fix return of instruction + handlers. + +### a/gdb/ChangeLog +### b/gdb/ChangeLog +## -1,3 +1,8 @@ ++2016-09-21 Edjunior Barbosa Machado ++ ++ * rs6000-tdep.c (ppc_process_record_op63): Fix return of instruction ++ handlers. ++ + 2016-09-21 Tom Tromey + + PR gdb/20604: +--- a/gdb/rs6000-tdep.c ++++ b/gdb/rs6000-tdep.c +@@ -5399,6 +5399,7 @@ ppc_process_record_op63 (struct gdbarch *gdbarch, struct regcache *regcache, + tdep->ppc_fp0_regnum + PPC_FRT (insn)); + if (PPC_RC (insn)) + record_full_arch_list_add_reg (regcache, tdep->ppc_cr_regnum); ++ return 0; + } + + switch (ext & 0xff) +@@ -5462,7 +5463,7 @@ ppc_process_record_op63 (struct gdbarch *gdbarch, struct regcache *regcache, + if (PPC_RC (insn)) + record_full_arch_list_add_reg (regcache, tdep->ppc_cr_regnum); + record_full_arch_list_add_reg (regcache, tdep->ppc_fpscr_regnum); +- break; ++ return 0; + + case 354: /* DFP Extract Biased Exponent Quad */ + record_full_arch_list_add_reg (regcache, +@@ -5541,7 +5542,7 @@ ppc_process_record_op63 (struct gdbarch *gdbarch, struct regcache *regcache, + if (PPC_RC (insn)) + record_full_arch_list_add_reg (regcache, tdep->ppc_cr_regnum); + record_full_arch_list_add_reg (regcache, tdep->ppc_fpscr_regnum); +- break; ++ return 0; + + case 0: /* Floating Compare Unordered */ + case 32: /* Floating Compare Ordered */ diff --git a/SOURCES/gdb-rhbz1493675-gcore-sigkilled-process.patch b/SOURCES/gdb-rhbz1493675-gcore-sigkilled-process.patch new file mode 100644 index 0000000..6ce289d --- /dev/null +++ b/SOURCES/gdb-rhbz1493675-gcore-sigkilled-process.patch @@ -0,0 +1,47 @@ +https://bugzilla.redhat.com/show_bug.cgi?id=1493675 + +diff -dup -rup gdb-7.6.1-orig/gdb/gcore.c gdb-7.6.1/gdb/gcore.c +--- gdb-7.6.1-orig/gdb/gcore.c 2017-10-20 22:28:50.990391003 +0200 ++++ gdb-7.6.1/gdb/gcore.c 2017-10-20 22:29:26.797710799 +0200 +@@ -111,8 +111,8 @@ do_bfd_delete_cleanup (void *arg) + bfd *obfd = arg; + const char *filename = obfd->filename; + +- gdb_bfd_unref (arg); + unlink (filename); ++ gdb_bfd_unref (arg); + } + + /* gcore_command -- implements the 'gcore' command. +--- ./gdb/inf-ptrace.c 2017-09-28 20:14:05.802344770 +0200 ++++ ./gdb/inf-ptrace.c 2017-09-28 22:04:30.417779859 +0200 +@@ -280,6 +280,7 @@ inf_ptrace_detach (struct target_ops *op + { + pid_t pid = ptid_get_pid (inferior_ptid); + int sig = 0; ++ int saved_errno; + + if (from_tty) + { +@@ -300,8 +301,7 @@ inf_ptrace_detach (struct target_ops *op + started the process ourselves. */ + errno = 0; + ptrace (PT_DETACH, pid, (PTRACE_TYPE_ARG3)1, sig); +- if (errno != 0) +- perror_with_name (("ptrace")); ++saved_errno = errno; + #else + error (_("This system does not support detaching from a process")); + #endif +@@ -311,6 +311,11 @@ inf_ptrace_detach (struct target_ops *op + + if (!have_inferiors ()) + unpush_target (ops); ++ ++if (saved_errno != 0) { ++ errno = saved_errno; ++ perror_with_name (("ptrace")); ++} + } + + /* Kill the inferior. */ diff --git a/SOURCES/gdb-rhbz1522798-ppc64-plt-reverse.patch b/SOURCES/gdb-rhbz1522798-ppc64-plt-reverse.patch new file mode 100644 index 0000000..bea1919 --- /dev/null +++ b/SOURCES/gdb-rhbz1522798-ppc64-plt-reverse.patch @@ -0,0 +1,230 @@ +commit db9077b7275e86637218a7a7d165cb85a4de116f +Author: Alan Modra +Date: Mon Dec 11 17:31:11 2017 +1030 + + PR22576, ppc64_skip_trampoline_code uses wrong r2 for EXEC_REVERSE + + The TOC pointer register, r2, on powerpc64 is generally not mentioned + in debug info. It is saved and restored by call linkage code, and + set to the callee value either by call stub code (ELFv1) or in the + callee global entry point code (ELFv2). A call stub uses the caller + TOC pointer to access the PLT. So for gdb to read the correct PLT + entry in order to determine the destination of the trampoline, gdb + needs to know the caller r2. When skipping over trampolines in the + normal forward direction, the caller r2 is simply the current value of + r2 (at the start of the trampoline). However, when reversing over + trampolines the current value of r2 is that for the callee. Using + that value results in wild reads of memory rather than the correct PLT + entry. + + This patch corrects the value of r2 by using the value saved on the + stack for reverse execution. Note that in reverse execution mode it + isn't really necessary for skip_trampoline_code to return the actual + destination, so we're doing a little more work than needed here. Any + non-zero return value would do (and it would be nicer if the interface + was changed to return the start of the stub). + + PR tdep/22576 + * ppc64-tdep.c (ppc64_plt_entry_point): Rewrite to take TOC-relative + PLT offset, and retrieve r2 from stack when executing in reverse. + (ppc64_standard_linkage1_target): Drop pc param. Calculate offset + rather than PLT address. + (ppc64_standard_linkage2_target): Likewise. + (ppc64_standard_linkage3_target): Likewise. + (ppc64_standard_linkage4_target): Likewise. + (ppc64_skip_trampoline_code_1): Adjust to suit. + +### a/gdb/ChangeLog +### b/gdb/ChangeLog +## -1,3 +1,15 @@ ++2017-12-12 Alan Modra ++ ++ PR tdep/22576 ++ * ppc64-tdep.c (ppc64_plt_entry_point): Rewrite to take TOC-relative ++ PLT offset, and retrieve r2 from stack when executing in reverse. ++ (ppc64_standard_linkage1_target): Drop pc param. Calculate offset ++ rather than PLT address. ++ (ppc64_standard_linkage2_target): Likewise. ++ (ppc64_standard_linkage3_target): Likewise. ++ (ppc64_standard_linkage4_target): Likewise. ++ (ppc64_skip_trampoline_code_1): Adjust to suit. ++ + 2017-12-11 Simon Marchi + + PR gdb/22556 +--- a/gdb/ppc64-tdep.c ++++ b/gdb/ppc64-tdep.c +@@ -49,15 +49,30 @@ + | (((spr) & 0x3e0) << 6) \ + | (((xo) & 0x3ff) << 1)) + +-/* If PLT is the address of a 64-bit PowerPC PLT entry, +- return the function's entry point. */ ++/* PLT_OFF is the TOC-relative offset of a 64-bit PowerPC PLT entry. ++ Return the function's entry point. */ + + static CORE_ADDR +-ppc64_plt_entry_point (struct gdbarch *gdbarch, CORE_ADDR plt) ++ppc64_plt_entry_point (struct frame_info *frame, CORE_ADDR plt_off) + { ++ struct gdbarch *gdbarch = get_frame_arch (frame); + enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); ++ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); ++ CORE_ADDR tocp; ++ ++ if (execution_direction == EXEC_REVERSE) ++ { ++ /* If executing in reverse, r2 will have been stored to the stack. */ ++ CORE_ADDR sp = get_frame_register_unsigned (frame, ++ tdep->ppc_gp0_regnum + 1); ++ unsigned int sp_off = tdep->elf_abi == POWERPC_ELF_V1 ? 40 : 24; ++ tocp = read_memory_unsigned_integer (sp + sp_off, 8, byte_order); ++ } ++ else ++ tocp = get_frame_register_unsigned (frame, tdep->ppc_gp0_regnum + 2); ++ + /* The first word of the PLT entry is the function entry point. */ +- return (CORE_ADDR) read_memory_unsigned_integer (plt, 8, byte_order); ++ return read_memory_unsigned_integer (tocp + plt_off, 8, byte_order); + } + + /* Patterns for the standard linkage functions. These are built by +@@ -377,74 +392,44 @@ static struct ppc_insn_pattern ppc64_standard_linkage8[] = + the linkage function. */ + + /* If the current thread is about to execute a series of instructions +- at PC matching the ppc64_standard_linkage pattern, and INSN is the result ++ matching the ppc64_standard_linkage pattern, and INSN is the result + from that pattern match, return the code address to which the + standard linkage function will send them. (This doesn't deal with + dynamic linker lazy symbol resolution stubs.) */ + + static CORE_ADDR +-ppc64_standard_linkage1_target (struct frame_info *frame, +- CORE_ADDR pc, unsigned int *insn) ++ppc64_standard_linkage1_target (struct frame_info *frame, unsigned int *insn) + { +- struct gdbarch *gdbarch = get_frame_arch (frame); +- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); +- +- /* The address of the PLT entry this linkage function references. */ +- CORE_ADDR plt +- = ((CORE_ADDR) get_frame_register_unsigned (frame, +- tdep->ppc_gp0_regnum + 2) +- + (ppc_insn_d_field (insn[0]) << 16) +- + ppc_insn_ds_field (insn[2])); ++ CORE_ADDR plt_off = ((ppc_insn_d_field (insn[0]) << 16) ++ + ppc_insn_ds_field (insn[2])); + +- return ppc64_plt_entry_point (gdbarch, plt); ++ return ppc64_plt_entry_point (frame, plt_off); + } + + static CORE_ADDR +-ppc64_standard_linkage2_target (struct frame_info *frame, +- CORE_ADDR pc, unsigned int *insn) ++ppc64_standard_linkage2_target (struct frame_info *frame, unsigned int *insn) + { +- struct gdbarch *gdbarch = get_frame_arch (frame); +- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); +- +- /* The address of the PLT entry this linkage function references. */ +- CORE_ADDR plt +- = ((CORE_ADDR) get_frame_register_unsigned (frame, +- tdep->ppc_gp0_regnum + 2) +- + (ppc_insn_d_field (insn[1]) << 16) +- + ppc_insn_ds_field (insn[3])); ++ CORE_ADDR plt_off = ((ppc_insn_d_field (insn[1]) << 16) ++ + ppc_insn_ds_field (insn[3])); + +- return ppc64_plt_entry_point (gdbarch, plt); ++ return ppc64_plt_entry_point (frame, plt_off); + } + + static CORE_ADDR +-ppc64_standard_linkage3_target (struct frame_info *frame, +- CORE_ADDR pc, unsigned int *insn) ++ppc64_standard_linkage3_target (struct frame_info *frame, unsigned int *insn) + { +- struct gdbarch *gdbarch = get_frame_arch (frame); +- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); ++ CORE_ADDR plt_off = ppc_insn_ds_field (insn[1]); + +- /* The address of the PLT entry this linkage function references. */ +- CORE_ADDR plt +- = ((CORE_ADDR) get_frame_register_unsigned (frame, +- tdep->ppc_gp0_regnum + 2) +- + ppc_insn_ds_field (insn[1])); +- +- return ppc64_plt_entry_point (gdbarch, plt); ++ return ppc64_plt_entry_point (frame, plt_off); + } + + static CORE_ADDR +-ppc64_standard_linkage4_target (struct frame_info *frame, +- CORE_ADDR pc, unsigned int *insn) ++ppc64_standard_linkage4_target (struct frame_info *frame, unsigned int *insn) + { +- struct gdbarch *gdbarch = get_frame_arch (frame); +- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); +- +- CORE_ADDR plt +- = ((CORE_ADDR) get_frame_register_unsigned (frame, tdep->ppc_gp0_regnum + 2) +- + (ppc_insn_d_field (insn[1]) << 16) +- + ppc_insn_ds_field (insn[2])); ++ CORE_ADDR plt_off = ((ppc_insn_d_field (insn[1]) << 16) ++ + ppc_insn_ds_field (insn[2])); + +- return ppc64_plt_entry_point (gdbarch, plt); ++ return ppc64_plt_entry_point (frame, plt_off); + } + + +@@ -480,39 +465,39 @@ ppc64_skip_trampoline_code_1 (struct frame_info *frame, CORE_ADDR pc) + { + if (i < ARRAY_SIZE (ppc64_standard_linkage8) - 1 + && ppc_insns_match_pattern (frame, pc, ppc64_standard_linkage8, insns)) +- pc = ppc64_standard_linkage4_target (frame, pc, insns); ++ pc = ppc64_standard_linkage4_target (frame, insns); + else if (i < ARRAY_SIZE (ppc64_standard_linkage7) - 1 + && ppc_insns_match_pattern (frame, pc, ppc64_standard_linkage7, + insns)) +- pc = ppc64_standard_linkage3_target (frame, pc, insns); ++ pc = ppc64_standard_linkage3_target (frame, insns); + else if (i < ARRAY_SIZE (ppc64_standard_linkage6) - 1 + && ppc_insns_match_pattern (frame, pc, ppc64_standard_linkage6, + insns)) +- pc = ppc64_standard_linkage4_target (frame, pc, insns); ++ pc = ppc64_standard_linkage4_target (frame, insns); + else if (i < ARRAY_SIZE (ppc64_standard_linkage5) - 1 + && ppc_insns_match_pattern (frame, pc, ppc64_standard_linkage5, + insns) + && (insns[8] != 0 || insns[9] != 0)) +- pc = ppc64_standard_linkage3_target (frame, pc, insns); ++ pc = ppc64_standard_linkage3_target (frame, insns); + else if (i < ARRAY_SIZE (ppc64_standard_linkage4) - 1 + && ppc_insns_match_pattern (frame, pc, ppc64_standard_linkage4, + insns) + && (insns[9] != 0 || insns[10] != 0)) +- pc = ppc64_standard_linkage4_target (frame, pc, insns); ++ pc = ppc64_standard_linkage4_target (frame, insns); + else if (i < ARRAY_SIZE (ppc64_standard_linkage3) - 1 + && ppc_insns_match_pattern (frame, pc, ppc64_standard_linkage3, + insns) + && (insns[8] != 0 || insns[9] != 0)) +- pc = ppc64_standard_linkage3_target (frame, pc, insns); ++ pc = ppc64_standard_linkage3_target (frame, insns); + else if (i < ARRAY_SIZE (ppc64_standard_linkage2) - 1 + && ppc_insns_match_pattern (frame, pc, ppc64_standard_linkage2, + insns) + && (insns[10] != 0 || insns[11] != 0)) +- pc = ppc64_standard_linkage2_target (frame, pc, insns); ++ pc = ppc64_standard_linkage2_target (frame, insns); + else if (i < ARRAY_SIZE (ppc64_standard_linkage1) - 1 + && ppc_insns_match_pattern (frame, pc, ppc64_standard_linkage1, + insns)) +- pc = ppc64_standard_linkage1_target (frame, pc, insns); ++ pc = ppc64_standard_linkage1_target (frame, insns); + else + { + /* Scan backward one more instructions if doesn't match. */ diff --git a/SOURCES/gdb-rhbz1531838-rhbz1473411-spawn-default-signal-handlers-regression.patch b/SOURCES/gdb-rhbz1531838-rhbz1473411-spawn-default-signal-handlers-regression.patch new file mode 100644 index 0000000..39d2c25 --- /dev/null +++ b/SOURCES/gdb-rhbz1531838-rhbz1473411-spawn-default-signal-handlers-regression.patch @@ -0,0 +1,311 @@ +commit 1ec6a1148ad3ca06f48be269e1b61cb9c61a0938 +Author: Pedro Alves +Date: Fri Jan 5 18:30:49 2018 +0000 + + Fix regression: cannot start with LD_PRELOAD=libSegFault.so (PR gdb/18653#c7) + + At https://sourceware.org/bugzilla/show_bug.cgi?id=18653#c7, Andrew + reports that the fix for PR gdb/18653 made GDB useless if you preload + libSegFault.so, because GDB internal-errors on startup: + + $ LD_PRELOAD=libSegFault.so gdb + src/gdb/common/signals-state-save-restore.c:64: internal-error: unexpected signal handler + A problem internal to GDB has been detected, + further debugging may prove unreliable. + Aborted (core dumped) + $ + + The internal error comes from the code saving the signal dispositions + inherited from gdb's parent: + + (top-gdb) bt + #0 0x000000000056b001 in internal_error(char const*, int, char const*, ...) (file=0xaf5f38 "src/gdb/common/signals-state-save-restore.c", line=64, fmt=0xaf5f18 "unexpected signal handler") at src/gdb/common/errors.c:54 + #1 0x00000000005752c9 in save_original_signals_state() () at src/gdb/common/signals-state-save-restore.c:64 + #2 0x00000000007425de in captured_main_1(captured_main_args*) (context=0x7fffffffd860) + at src/gdb/main.c:509 + #3 0x0000000000743622 in captured_main(void*) (data=0x7fffffffd860) at src/gdb/main.c:1145 + During symbol reading, cannot get low and high bounds for subprogram DIE at 24065. + #4 0x00000000007436f9 in gdb_main(captured_main_args*) (args=0x7fffffffd860) at src/gdb/main.c:1171 + #5 0x0000000000413acd in main(int, char**) (argc=1, argv=0x7fffffffd968) at src/gdb/gdb.c:32 + + This commit downgrades the internal error to a warning. You'll get + instead: + + ~~~ + $ LD_PRELOAD=libSegFault.so gdb + warning: Found custom handler for signal 11 (Segmentation fault) preinstalled. + Some signal dispositions inherited from the environment (SIG_DFL/SIG_IGN) + won't be propagated to spawned programs. + GNU gdb (GDB) 8.0.50.20171213-git + Copyright (C) 2017 Free Software Foundation, Inc. + License GPLv3+: GNU GPL version 3 or later + This is free software: you are free to change and redistribute it. + There is NO WARRANTY, to the extent permitted by law. Type "show copying" + and "show warranty" for details. + This GDB was configured as "x86_64-pc-linux-gnu". + Type "show configuration" for configuration details. + For bug reporting instructions, please see: + . + Find the GDB manual and other documentation resources online at: + . + For help, type "help". + Type "apropos word" to search for commands related to "word"... + (gdb) + ~~~ + + This also moves the location where save_original_signals_state is + called a bit further below (to after option processing), so that "-q" + disables the warning: + + ~~~ + $ LD_PRELOAD=libSegFault.so gdb -q + (gdb) + ~~~ + + New testcase included. + + gdb/ChangeLog: + 2018-01-05 Pedro Alves + + PR gdb/18653 + * common/signals-state-save-restore.c + (save_original_signals_state): New parameter 'quiet'. Warn if we + find a custom handler preinstalled, instead of internal erroring. + But only warn if !quiet. + * common/signals-state-save-restore.h + (save_original_signals_state): New parameter 'quiet'. + * main.c (captured_main_1): Move save_original_signals_state call + after option handling, and pass QUIET. + + gdb/gdbserver/ChangeLog: + 2018-01-05 Pedro Alves + + PR gdb/18653 + * server.c (captured_main): Pass quiet=false to + save_original_signals_state. + + gdb/testsuite/ChangeLog: + 2018-01-05 Pedro Alves + + PR gdb/18653 + * gdb.base/libsegfault.exp: New. + +### a/gdb/ChangeLog +### b/gdb/ChangeLog +## -1,3 +1,15 @@ ++2018-01-05 Pedro Alves ++ ++ PR gdb/18653 ++ * common/signals-state-save-restore.c ++ (save_original_signals_state): New parameter 'quiet'. Warn if we ++ find a custom handler preinstalled, instead of internal erroring. ++ But only warn if !quiet. ++ * common/signals-state-save-restore.h ++ (save_original_signals_state): New parameter 'quiet'. ++ * main.c (captured_main_1): Move save_original_signals_state call ++ after option handling, and pass QUIET. ++ + 2018-01-05 Pedro Alves + + * spu-tdep.c (spu_catch_start): Pass +Index: gdb-7.6.1/gdb/common/signals-state-save-restore.c +=================================================================== +--- gdb-7.6.1.orig/gdb/common/signals-state-save-restore.c 2018-01-08 15:30:48.182057111 +0100 ++++ gdb-7.6.1/gdb/common/signals-state-save-restore.c 2018-01-08 15:37:50.450183830 +0100 +@@ -24,6 +24,7 @@ + #include "signals-state-save-restore.h" + + #include ++#include + + /* The original signal actions and mask. */ + +@@ -40,11 +41,12 @@ + /* See signals-state-save-restore.h. */ + + void +-save_original_signals_state (void) ++save_original_signals_state (int quiet) + { + #ifdef HAVE_SIGACTION + int i; + int res; ++ int found_preinstalled = 0; + + res = sigprocmask (0, NULL, &original_signal_mask); + if (res == -1) +@@ -64,9 +66,31 @@ + perror_with_name ("sigaction"); + + /* If we find a custom signal handler already installed, then +- this function was called too late. */ +- if (oldact->sa_handler != SIG_DFL && oldact->sa_handler != SIG_IGN) +- internal_error (__FILE__, __LINE__, _("unexpected signal handler")); ++ this function was called too late. This is a warning instead ++ of an internal error because this can also happen if you ++ LD_PRELOAD a library that installs a signal handler early via ++ __attribute__((constructor)), like libSegFault.so. */ ++ if (!quiet ++ && oldact->sa_handler != SIG_DFL ++ && oldact->sa_handler != SIG_IGN) ++ { ++ found_preinstalled = 1; ++ ++ /* Use raw fprintf here because we're being called in early ++ startup, because GDB's filtered streams are are ++ created. */ ++ fprintf (stderr, ++ _("warning: Found custom handler for signal " ++ "%d (%s) preinstalled.\n"), i, ++ strsignal (i)); ++ } ++ } ++ ++ if (found_preinstalled) ++ { ++ fprintf (stderr, _("\ ++Some signal dispositions inherited from the environment (SIG_DFL/SIG_IGN)\n\ ++won't be propagated to spawned programs.\n")); + } + #endif + } +Index: gdb-7.6.1/gdb/common/signals-state-save-restore.h +=================================================================== +--- gdb-7.6.1.orig/gdb/common/signals-state-save-restore.h 2018-01-08 15:30:48.613060301 +0100 ++++ gdb-7.6.1/gdb/common/signals-state-save-restore.h 2018-01-08 15:35:15.538036768 +0100 +@@ -28,9 +28,10 @@ + back to what was originally inherited from gdb/gdbserver's parent, + just before execing the target program to debug. */ + +-/* Save the signal state of all signals. */ ++/* Save the signal state of all signals. If !QUIET, warn if we detect ++ a custom signal handler preinstalled. */ + +-extern void save_original_signals_state (void); ++extern void save_original_signals_state (int quiet); + + /* Restore the signal state of all signals. */ + +Index: gdb-7.6.1/gdb/gdbserver/server.c +=================================================================== +--- gdb-7.6.1.orig/gdb/gdbserver/server.c 2018-01-08 15:30:48.613060301 +0100 ++++ gdb-7.6.1/gdb/gdbserver/server.c 2018-01-08 15:38:02.115270202 +0100 +@@ -2896,7 +2896,7 @@ + exit (1); + } + +- save_original_signals_state (); ++ save_original_signals_state (0); + + /* We need to know whether the remote connection is stdio before + starting the inferior. Inferiors created in this scenario have +Index: gdb-7.6.1/gdb/main.c +=================================================================== +--- gdb-7.6.1.orig/gdb/main.c 2018-01-08 15:30:51.951085018 +0100 ++++ gdb-7.6.1/gdb/main.c 2018-01-08 15:31:46.874491703 +0100 +@@ -394,7 +394,6 @@ + textdomain (PACKAGE); + + bfd_init (); +- save_original_signals_state (); + + make_cleanup (VEC_cleanup (cmdarg_s), &cmdarg_vec); + dirsize = 1; +@@ -778,6 +777,8 @@ + quiet = 1; + } + ++ save_original_signals_state (quiet); ++ + /* Initialize all files. Give the interpreter a chance to take + control of the console via the deprecated_init_ui_hook (). */ + gdb_init (gdb_program_name); +Index: gdb-7.6.1/gdb/testsuite/gdb.base/libsegfault.exp +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.6.1/gdb/testsuite/gdb.base/libsegfault.exp 2018-01-08 15:30:51.951085018 +0100 +@@ -0,0 +1,84 @@ ++# Copyright 2017-2018 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 . ++ ++# This file is part of the gdb testsuite. ++ ++# Test that GDB tolerates being started with libSegFault.so preloaded ++# with LD_PRELOAD, and that GDB warns about a custom SIGSEGV custom ++# handler. See PR gdb/18653 ++# . ++ ++# We cannot expect remote hosts to see environment variables set on ++# the local machine. ++if { [is_remote host] } { ++ unsupported "can't set environment variables on remote host" ++ return -1 ++} ++ ++# Spawn GDB with LIB preloaded with LD_PRELOAD. CMDLINE_OPTS are ++# command line options passed to GDB. ++ ++proc gdb_spawn_with_ld_preload {lib cmdline_opts} { ++ global env ++ ++ save_vars { env(LD_PRELOAD) } { ++ if { ![info exists env(LD_PRELOAD) ] ++ || $env(LD_PRELOAD) == "" } { ++ set env(LD_PRELOAD) "$lib" ++ } else { ++ append env(LD_PRELOAD) ":$lib" ++ } ++ ++ gdb_spawn_with_cmdline_opts $cmdline_opts ++ } ++} ++ ++proc test_libsegfault {} { ++ global gdb_prompt ++ ++ set libsegfault "libSegFault.so" ++ ++ # When started normally, if libSegFault.so is preloaded, GDB ++ # should warn about not being able to propagate the signal ++ # disposition of SIGSEGV. ++ gdb_exit ++ gdb_spawn_with_ld_preload $libsegfault "" ++ ++ set test "gdb emits custom handler warning" ++ gdb_test_multiple "" $test { ++ -re "cannot be preloaded.*\r\n$gdb_prompt $" { ++ # Glibc 2.22 outputs: ++ # ERROR: ld.so: object 'libSegFault.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored. ++ untested "cannot preload libSegFault.so" ++ return ++ } ++ -re "Found custom handler.*won't be propagated.*\r\n$gdb_prompt $" { ++ pass $test ++ } ++ } ++ ++ # "-q" should disable the warning, though. ++ gdb_exit ++ gdb_spawn_with_ld_preload $libsegfault "-q" ++ ++ set test "quiet suppresses custom handler warning" ++ gdb_test_multiple "" $test { ++ -re "^$gdb_prompt $" { ++ pass $test ++ } ++ } ++} ++ ++test_libsegfault diff --git a/SPECS/gdb.spec b/SPECS/gdb.spec index d4b3830..650c1bf 100644 --- a/SPECS/gdb.spec +++ b/SPECS/gdb.spec @@ -42,7 +42,7 @@ Version: 7.6.1 # 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: 100%{?dist}.1 +Release: 110%{?dist} License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and BSD and Public Domain Group: Development/Debuggers @@ -888,13 +888,44 @@ Patch1207: gdb-rhbz1320945-power9-36of38.patch Patch1208: gdb-rhbz1320945-power9-37of38.patch Patch1209: gdb-rhbz1320945-power9-38of38.patch -# Fix gcore for memory regions with VM_DONTDUMP (RH BZ 1524312, Sergio Lopez). +# [ppc64le] Fix short vector return values (RH BZ 1480497). +Patch1245: gdb-rhbz1480497-ppc64le-shortvec-retval.patch + +# [ppc*] Fix ppc* record/replay (RH BZ 1480498). +Patch1246: gdb-rhbz1480498-power-record-1of3.patch +Patch1247: gdb-rhbz1480498-power-record-2of3.patch +Patch1248: gdb-rhbz1480498-power-record-3of3.patch + +# [ppc64le] Fix ppc64le atomic sequences single-stepping (RH BZ 1480496). +patch1249: gdb-rhbz1480496-power-atomic-step-1of5.patch +patch1250: gdb-rhbz1480496-power-atomic-step-2of5.patch +patch1251: gdb-rhbz1480496-power-atomic-step-3of5.patch +patch1252: gdb-rhbz1480496-power-atomic-step-4of5.patch +patch1253: gdb-rhbz1480496-power-atomic-step-5of5.patch + +# Fix default signal handlers for spawned processes (RH BZ 1473411). +Patch1260: gdb-rhbz1473411-spawn-default-signal-handlers.patch + +# Use inlined func name for printing breakpoints (RH BZ 1228556, Keith Seitz). +Patch1261: gdb-rhbz1228556-bpt-inlined-func-name-1of2.patch +Patch1262: gdb-rhbz1228556-bpt-inlined-func-name-2of2.patch + +# Fix gcore of process being SIGKILLed (RH BZ 1493675). +Patch1263: gdb-rhbz1493675-gcore-sigkilled-process.patch + +# Fix gcore for memory regions with VM_DONTDUMP (RH BZ 1518243, Sergio Lopez). Patch1264: gdb-rhbz1518243-gcore-VM_DONTDUMP-1of5.patch Patch1265: gdb-rhbz1518243-gcore-VM_DONTDUMP-2of5.patch Patch1266: gdb-rhbz1518243-gcore-VM_DONTDUMP-3of5.patch Patch1267: gdb-rhbz1518243-gcore-VM_DONTDUMP-4of5.patch Patch1268: gdb-rhbz1518243-gcore-VM_DONTDUMP-5of5.patch +# [ppc64] Fix exec-reverse regression with relro ld (RH BZ 1522798, Alan Modra). +Patch1269: gdb-rhbz1522798-ppc64-plt-reverse.patch + +# Fix signal handlers (RH BZ 1473411) regression (RH BZ 1531838, Pedro Alves). +Patch1270: gdb-rhbz1531838-rhbz1473411-spawn-default-signal-handlers-regression.patch + %if 0%{!?rhel:1} || 0%{?rhel} > 6 # RL_STATE_FEDORA_GDB would not be found for: # Patch642: gdb-readline62-ask-more-rh.patch @@ -1421,11 +1452,26 @@ find -name "*.info*"|xargs rm -f %patch1207 -p1 %patch1208 -p1 %patch1209 -p1 +%patch1245 -p1 +%patch1246 -p1 +%patch1247 -p1 +%patch1248 -p1 +%patch1249 -p1 +%patch1250 -p1 +%patch1251 -p1 +%patch1252 -p1 +%patch1253 -p1 +%patch1260 -p1 +%patch1261 -p1 +%patch1262 -p1 +%patch1263 -p1 %patch1264 -p1 %patch1265 -p1 %patch1266 -p1 %patch1267 -p1 %patch1268 -p1 +%patch1269 -p1 +%patch1270 -p1 %if 0%{?scl:1} %patch836 -p1 -R @@ -1951,8 +1997,36 @@ fi %endif # 0%{!?el5:1} || "%{_target_cpu}" == "noarch" %changelog -* Mon Dec 11 2017 Jan Kratochvil - 7.6.1-100.el7_4.1 -- Fix gcore for memory regions with VM_DONTDUMP (RH BZ 1524312, Sergio Lopez). +* Mon Jan 8 2018 Jan Kratochvil - 7.6.1-110.el7 +- Fix signal handlers (RH BZ 1473411) regression (RH BZ 1531838, Pedro Alves). + +* Tue Dec 12 2017 Jan Kratochvil - 7.6.1-109.el7 +- [ppc64] Fix exec-reverse regression with relro ld (RH BZ 1522798, Alan Modra). + +* Wed Dec 6 2017 Jan Kratochvil - 7.6.1-108.el7 +- Fix gcore for memory regions with VM_DONTDUMP (RH BZ 1518243, Sergio Lopez). + +* Fri Nov 3 2017 Jan Kratochvil - 7.6.1-107.el7 +- Fix backport of default signal handlers for spawned processes + (RH BZ 1473411, found by Michal Kolar). + +* Fri Oct 27 2017 Jan Kratochvil - 7.6.1-106.el7 +- Use inlined func name for printing breakpoints (RH BZ 1228556, Keith Seitz). + +* Fri Oct 20 2017 Jan Kratochvil - 7.6.1-105.el7 +- Fix gcore of process being SIGKILLed (RH BZ 1493675). + +* Wed Oct 18 2017 Jan Kratochvil - 7.6.1-104.el7 +- Fix default signal handlers for spawned processes (RH BZ 1473411). + +* Tue Aug 29 2017 Jan Kratochvil - 7.6.1-103.el7 +- [ppc64le] Fix ppc64le atomic sequences single-stepping (RH BZ 1480496). + +* Tue Aug 29 2017 Jan Kratochvil - 7.6.1-102.el7 +- [ppc*] Fix ppc* record/replay (RH BZ 1480498). + +* Mon Aug 21 2017 Jan Kratochvil - 7.6.1-101.el7 +- [ppc64le] Fix short vector return values (RH BZ 1480497). * Tue Jun 13 2017 Jan Kratochvil - 7.6.1-100.el7 - [ppc*] IBM Power9 backport extension (RH BZ 1320945).