From 6f69bd32d74537e863260db95f3639c5218e9882 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Mar 31 2020 09:32:32 +0000 Subject: import gdb-7.6.1-119.el7 --- diff --git a/SOURCES/gdb-6.6-bz235197-fork-detach-info.patch b/SOURCES/gdb-6.6-bz235197-fork-detach-info.patch deleted file mode 100644 index d7263ff..0000000 --- a/SOURCES/gdb-6.6-bz235197-fork-detach-info.patch +++ /dev/null @@ -1,121 +0,0 @@ -2008-03-01 Jan Kratochvil - - Port to GDB-6.8pre. - Remove the `[' character from the GDB-6.8 default message. - -Index: gdb-7.2.50.20110320/gdb/linux-nat.c -=================================================================== ---- gdb-7.2.50.20110320.orig/gdb/linux-nat.c 2011-03-20 16:59:51.000000000 +0100 -+++ gdb-7.2.50.20110320/gdb/linux-nat.c 2011-03-20 16:59:51.000000000 +0100 -@@ -716,7 +716,7 @@ holding the child stopped. Try \"set de - remove_breakpoints_pid (GET_PID (inferior_ptid)); - } - -- if (info_verbose || debug_linux_nat) -+ if (1 /* Fedora Bug 235197 */ || info_verbose || debug_linux_nat) - { - target_terminal_ours (); - fprintf_filtered (gdb_stdlog, -Index: gdb-7.2.50.20110320/gdb/testsuite/gdb.base/fork-detach.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.2.50.20110320/gdb/testsuite/gdb.base/fork-detach.c 2011-03-20 16:59:51.000000000 +0100 -@@ -0,0 +1,57 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 2007 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 2 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. -+ -+ Please email any bugs, comments, and/or additions to this file to: -+ bug-gdb@prep.ai.mit.edu */ -+ -+#include -+#include -+#include -+#include -+#include -+ -+static void func (void) -+{ -+} -+ -+int main (void) -+{ -+ pid_t child; -+ -+ child = fork (); -+ switch (child) -+ { -+ case -1: -+ abort (); -+ case 0: -+ func (); -+ break; -+ default: -+ { -+/* We do not test the switching to the other fork by GDB `fork 1'. */ -+#if 0 -+ pid_t got; -+ -+ got = waitpid (child, NULL, 0); -+ assert (got == child); -+#endif -+ break; -+ } -+ } -+ return 0; -+} -Index: gdb-7.2.50.20110320/gdb/testsuite/gdb.base/fork-detach.exp -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.2.50.20110320/gdb/testsuite/gdb.base/fork-detach.exp 2011-03-20 17:12:22.000000000 +0100 -@@ -0,0 +1,36 @@ -+# Copyright 2007 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 2 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. -+ -+set testfile fork-detach -+set srcfile ${testfile}.c -+set binfile ${objdir}/${subdir}/${testfile} -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { -+ untested "Couldn't compile test program" -+ return -1 -+} -+ -+# Get things started. -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfile} -+ -+gdb_run_cmd -+# `Starting program: .*' prefix is available since gdb-6.7. -+gdb_test "" \ -+ "Detaching after fork from child process.*\\\[Inferior .* exited normally\\\]" \ -+ "Info message caught" diff --git a/SOURCES/gdb-rhbz1639077-symlink-default-symtab.patch b/SOURCES/gdb-rhbz1639077-symlink-default-symtab.patch index 3e01722..6ed264f 100644 --- a/SOURCES/gdb-rhbz1639077-symlink-default-symtab.patch +++ b/SOURCES/gdb-rhbz1639077-symlink-default-symtab.patch @@ -53,30 +53,6 @@ Date: Fri Feb 22 09:39:35 2019 -0800 * gdb.base/symlink-sourcefile.c: New file. * gdb.base/symlink-sourcefile.exp: New file. -Index: gdb-7.6.1/gdb/linespec.c -=================================================================== ---- gdb-7.6.1.orig/gdb/linespec.c -+++ gdb-7.6.1/gdb/linespec.c -@@ -1844,17 +1844,15 @@ create_sals_line_offset (struct linespec - if (VEC_length (symtab_p, ls->file_symtabs) == 1 - && VEC_index (symtab_p, ls->file_symtabs, 0) == NULL) - { -- const char *fullname; -- - set_current_program_space (self->program_space); - - /* Make sure we have at least a default source line. */ - set_default_source_symtab_and_line (); - initialize_defaults (&self->default_symtab, &self->default_line); -- fullname = symtab_to_fullname (self->default_symtab); - VEC_pop (symtab_p, ls->file_symtabs); - VEC_free (symtab_p, ls->file_symtabs); -- ls->file_symtabs = collect_symtabs_from_filename (fullname); -+ ls->file_symtabs -+ = collect_symtabs_from_filename (self->default_symtab->filename); - use_default = 1; - } - Index: gdb-7.6.1/gdb/testsuite/gdb.base/symlink-sourcefile.c =================================================================== --- /dev/null @@ -112,7 +88,7 @@ Index: gdb-7.6.1/gdb/testsuite/gdb.base/symlink-sourcefile.exp =================================================================== --- /dev/null +++ gdb-7.6.1/gdb/testsuite/gdb.base/symlink-sourcefile.exp -@@ -0,0 +1,46 @@ +@@ -0,0 +1,65 @@ +# Copyright 2019 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify @@ -157,8 +133,27 @@ Index: gdb-7.6.1/gdb/testsuite/gdb.base/symlink-sourcefile.exp +} + +# Using a line number ensures that the default symtab is used. -+gdb_breakpoint [gdb_get_line_number "break here" $srcfile] message -+gdb_continue_to_breakpoint "run to breakpoint marker" ++gdb_test_no_output "set basenames-may-differ on" ++set line [gdb_get_line_number "break here" $srcfile] ++gdb_breakpoint $line message ++gdb_continue_to_breakpoint "run to file-less breakpoint marker" ++ ++if {![runto_main]} { ++ untested "could not run to main" ++ return -1 ++} ++ ++gdb_breakpoint "$linksrc:$line" message ++gdb_continue_to_breakpoint "run to symlink itself breakpoint marker" ++ ++if {![runto_main]} { ++ untested "could not run to main" ++ return -1 ++} ++ ++gdb_test_no_output "set basenames-may-differ on" ++gdb_breakpoint "$srcfile:$line" message ++gdb_continue_to_breakpoint "run to symlink target breakpoint marker" Index: gdb-7.6.1/gdb/testsuite/lib/gdb.exp =================================================================== --- gdb-7.6.1.orig/gdb/testsuite/lib/gdb.exp diff --git a/SOURCES/gdb-rhbz1677918-print-inferior-events.patch b/SOURCES/gdb-rhbz1677918-print-inferior-events.patch new file mode 100644 index 0000000..dea5f2d --- /dev/null +++ b/SOURCES/gdb-rhbz1677918-print-inferior-events.patch @@ -0,0 +1,717 @@ +Index: rhel-7.8/gdb-7.6.1/gdb/inf-ttrace.c +=================================================================== +--- rhel-7.8.orig/gdb-7.6.1/gdb/inf-ttrace.c ++++ rhel-7.8/gdb-7.6.1/gdb/inf-ttrace.c +@@ -459,10 +459,14 @@ inf_ttrace_follow_fork (struct target_op + copy_terminal_info (inf, parent_inf); + detach_breakpoints (ptid_build (pid, lwpid, 0)); + +- target_terminal_ours (); +- fprintf_unfiltered (gdb_stdlog, +- _("Attaching after fork to child process %ld.\n"), +- (long)fpid); ++ if (print_inferior_events) ++ { ++ target_terminal_ours (); ++ fprintf_unfiltered (gdb_stdlog, ++ _("[Attaching after %s fork to child %s]\n"), ++ target_pid_to_str (pid_to_ptid (pid)), ++ target_pid_to_str (pid_to_ptid (fid))); ++ } + } + else + { +@@ -473,10 +477,13 @@ inf_ttrace_follow_fork (struct target_op + if (tts.tts_event == TTEVT_VFORK) + detach_breakpoints (ptid_build (fpid, flwpid, 0)); + +- target_terminal_ours (); +- fprintf_unfiltered (gdb_stdlog, +- _("Detaching after fork from child process %ld.\n"), +- (long)fpid); ++ if (print_inferior_events) ++ { ++ target_terminal_ours (); ++ fprintf_unfiltered (gdb_stdlog, ++ _("[Detaching after fork from child %s]\n"), ++ target_pid_to_str (pid_to_ptid (fpid))); ++ } + } + + if (tts.tts_event == TTEVT_VFORK) +Index: rhel-7.8/gdb-7.6.1/gdb/infcmd.c +=================================================================== +--- rhel-7.8.orig/gdb-7.6.1/gdb/infcmd.c ++++ rhel-7.8/gdb-7.6.1/gdb/infcmd.c +@@ -2326,6 +2326,9 @@ vector_info (char *args, int from_tty) + static void + kill_command (char *arg, int from_tty) + { ++ const char *pid_str; ++ int infnum, pid; ++ + /* FIXME: This should not really be inferior_ptid (or target_has_execution). + It should be a distinct flag that indicates that a target is active, cuz + some targets don't have processes! */ +@@ -2334,8 +2337,19 @@ kill_command (char *arg, int from_tty) + error (_("The program is not being run.")); + if (!query (_("Kill the program being debugged? "))) + error (_("Not confirmed.")); ++ ++ pid = current_inferior ()->pid; ++ /* Save the pid as a string before killing the inferior, since that ++ may unpush the current target, and we need the string after. */ ++ pid_str = target_pid_to_str (pid_to_ptid (pid)); ++ infnum = current_inferior ()->num; ++ + target_kill (); + ++ if (print_inferior_events) ++ printf_unfiltered (_("[Inferior %d (%s) killed]\n"), ++ infnum, pid_str); ++ + /* If we still have other inferiors to debug, then don't mess with + with their threads. */ + if (!have_inferiors ()) +Index: rhel-7.8/gdb-7.6.1/gdb/inferior.c +=================================================================== +--- rhel-7.8.orig/gdb-7.6.1/gdb/inferior.c ++++ rhel-7.8/gdb-7.6.1/gdb/inferior.c +@@ -46,9 +46,8 @@ DEFINE_REGISTRY (inferior, REGISTRY_ACCE + struct inferior *inferior_list = NULL; + static int highest_inferior_num; + +-/* Print notices on inferior events (attach, detach, etc.), set with +- `set print inferior-events'. */ +-static int print_inferior_events = 0; ++/* See inferior.h. */ ++int print_inferior_events = 1; + + /* The Current Inferior. */ + static struct inferior *current_inferior_ = NULL; +@@ -157,7 +156,9 @@ add_inferior (int pid) + struct inferior *inf = add_inferior_silent (pid); + + if (print_inferior_events) +- printf_unfiltered (_("[New inferior %d]\n"), pid); ++ printf_unfiltered (_("[New inferior %d (%s)]\n"), ++ inf->num, ++ target_pid_to_str (pid_to_ptid (pid))); + + return inf; + } +@@ -286,9 +287,6 @@ exit_inferior (int pid) + struct inferior *inf = find_inferior_pid (pid); + + exit_inferior_1 (inf, 0); +- +- if (print_inferior_events) +- printf_unfiltered (_("[Inferior %d exited]\n"), pid); + } + + void +@@ -315,7 +313,9 @@ detach_inferior (int pid) + exit_inferior_1 (inf, 1); + + if (print_inferior_events) +- printf_unfiltered (_("[Inferior %d detached]\n"), pid); ++ printf_unfiltered (_("[Inferior %d (%s) detached]\n"), ++ inf->num, ++ target_pid_to_str (pid_to_ptid (pid))); + } + + void +@@ -991,7 +991,7 @@ initialize_inferiors (void) + can only allocate an inferior when all those modules have done + that. Do this after initialize_progspace, due to the + current_program_space reference. */ +- current_inferior_ = add_inferior (0); ++ current_inferior_ = add_inferior_silent (0); + current_inferior_->pspace = current_program_space; + current_inferior_->aspace = current_program_space->aspace; + /* The architecture will be initialized shortly, by +Index: rhel-7.8/gdb-7.6.1/gdb/inferior.h +=================================================================== +--- rhel-7.8.orig/gdb-7.6.1/gdb/inferior.h ++++ rhel-7.8/gdb-7.6.1/gdb/inferior.h +@@ -277,6 +277,10 @@ extern enum stop_stack_kind stop_stack_d + + extern int stopped_by_random_signal; + ++/* Print notices on inferior events (attach, detach, etc.), set with ++ `set print inferior-events'. */ ++extern int print_inferior_events; ++ + /* STEP_OVER_ALL means step over all subroutine calls. + STEP_OVER_UNDEBUGGABLE means step over calls to undebuggable functions. + STEP_OVER_NONE means don't step over any subroutine calls. */ +Index: rhel-7.8/gdb-7.6.1/gdb/infrun.c +=================================================================== +--- rhel-7.8.orig/gdb-7.6.1/gdb/infrun.c ++++ rhel-7.8/gdb-7.6.1/gdb/infrun.c +@@ -718,20 +718,21 @@ handle_vfork_child_exec_or_exit (int exe + inf->aspace = NULL; + inf->pspace = NULL; + +- if (debug_infrun || info_verbose) ++ if (print_inferior_events) + { ++ const char *pidstr ++ = target_pid_to_str (pid_to_ptid (inf->vfork_parent->pid)); ++ + target_terminal_ours (); + + if (exec) + fprintf_filtered (gdb_stdlog, +- "Detaching vfork parent process " +- "%d after child exec.\n", +- inf->vfork_parent->pid); ++ "[Detaching vfork parent %s " ++ "after child exec]\n", pidstr); + else + fprintf_filtered (gdb_stdlog, +- "Detaching vfork parent process " +- "%d after child exit.\n", +- inf->vfork_parent->pid); ++ "[Detaching vfork parent %s " ++ "after child exit]\n", pidstr); + } + + target_detach (NULL, 0); +@@ -3260,7 +3261,7 @@ handle_inferior_event (struct execution_ + ecs->event_thread = find_thread_ptid (ecs->ptid); + /* If it's a new thread, add it to the thread database. */ + if (ecs->event_thread == NULL) +- ecs->event_thread = add_thread (ecs->ptid); ++ ecs->event_thread = add_thread (ecs->ptid); /* !!keiths: _silent? */ + } + + /* Dependent on valid ECS->EVENT_THREAD. */ +Index: rhel-7.8/gdb-7.6.1/gdb/linux-nat.c +=================================================================== +--- rhel-7.8.orig/gdb-7.6.1/gdb/linux-nat.c ++++ rhel-7.8/gdb-7.6.1/gdb/linux-nat.c +@@ -688,13 +688,13 @@ holding the child stopped. Try \"set de + remove_breakpoints_pid (GET_PID (inferior_ptid)); + } + +- if (info_verbose || debug_linux_nat) ++ if (print_inferior_events) + { + target_terminal_ours (); + fprintf_filtered (gdb_stdlog, +- "Detaching after fork from " +- "child process %d.\n", +- child_pid); ++ "[Detaching after %s from child %s]\n", ++ has_vforked ? "vfork" : "fork", ++ target_pid_to_str (pid_to_ptid (child_pid))); + } + + old_chain = save_inferior_ptid (); +@@ -729,7 +729,7 @@ holding the child stopped. Try \"set de + save_current_program_space (); + + inferior_ptid = ptid_build (child_pid, child_pid, 0); +- add_thread (inferior_ptid); ++ add_thread_silent (inferior_ptid); + child_lp = add_lwp (inferior_ptid); + child_lp->stopped = 1; + child_lp->last_resume_kind = resume_stop; +@@ -865,19 +865,19 @@ holding the child stopped. Try \"set de + struct lwp_info *child_lp; + struct program_space *parent_pspace; + +- if (info_verbose || debug_linux_nat) ++ if (print_inferior_events) + { ++ const char *parent_pidstr ++ = target_pid_to_str (pid_to_ptid (parent_pid)); ++ const char *child_pidstr ++ = target_pid_to_str (pid_to_ptid (child_pid)); ++ + target_terminal_ours (); +- if (has_vforked) +- fprintf_filtered (gdb_stdlog, +- _("Attaching after process %d " +- "vfork to child process %d.\n"), +- parent_pid, child_pid); +- else +- fprintf_filtered (gdb_stdlog, +- _("Attaching after process %d " +- "fork to child process %d.\n"), +- parent_pid, child_pid); ++ fprintf_filtered (gdb_stdlog, ++ _("[Attaching after %s %s to child %s]\n"), ++ parent_pidstr, ++ has_vforked ? "vfork" : "fork", ++ child_pidstr); + } + + /* Add the new inferior first, so that the target_detach below +@@ -914,7 +914,21 @@ holding the child stopped. Try \"set de + parent_inf->waiting_for_vfork_done = 0; + } + else if (detach_fork) +- target_detach (NULL, 0); ++ { ++ if (print_inferior_events) ++ { ++ /* Ensure that we have a process ptid. */ ++ ptid_t process_ptid = pid_to_ptid (parent_pid); ++ ++ target_terminal_ours (); ++ fprintf_filtered (gdb_stdlog, ++ _("[Detaching after fork from " ++ "parent %s]\n"), ++ target_pid_to_str (process_ptid)); ++ } ++ ++ target_detach (NULL, 0); ++ } + + /* Note that the detach above makes PARENT_INF dangling. */ + +@@ -923,7 +937,7 @@ holding the child stopped. Try \"set de + informing the solib layer about this new process. */ + + inferior_ptid = ptid_build (child_pid, child_pid, 0); +- add_thread (inferior_ptid); ++ add_thread_silent (inferior_ptid); + child_lp = add_lwp (inferior_ptid); + child_lp->stopped = 1; + child_lp->last_resume_kind = resume_stop; +Index: rhel-7.8/gdb-7.6.1/gdb/remote.c +=================================================================== +--- rhel-7.8.orig/gdb-7.6.1/gdb/remote.c ++++ rhel-7.8/gdb-7.6.1/gdb/remote.c +@@ -4437,7 +4437,17 @@ remote_detach_1 (char *args, int from_tt + if (from_tty && !extended) + puts_filtered (_("Ending remote debugging.\n")); + +- target_mourn_inferior (); ++ { ++ /* Save the pid as a string before mourning, since that will ++ unpush the remote target, and we need the string after. */ ++ const char *infpid = target_pid_to_str (pid_to_ptid (pid)); ++ struct inferior *inf = find_inferior_pid (pid); ++ ++ target_mourn_inferior (); ++ if (print_inferior_events) ++ printf_unfiltered (_("[Inferior %d (%s) detached]\n"), ++ inf->num, infpid); ++ } + } + + static void +Index: rhel-7.8/gdb-7.6.1/gdb/testsuite/gdb.base/attach.exp +=================================================================== +--- rhel-7.8.orig/gdb-7.6.1/gdb/testsuite/gdb.base/attach.exp ++++ rhel-7.8/gdb-7.6.1/gdb/testsuite/gdb.base/attach.exp +@@ -70,6 +70,7 @@ proc do_attach_tests {} { + global objdir + global subdir + global timeout ++ global decimal + + # Start the program running and then wait for a bit, to be sure + # that it can be attached to. +@@ -203,7 +204,7 @@ proc do_attach_tests {} { + # Detach the process. + + gdb_test "detach" \ +- "Detaching from program: .*$escapedbinfile, process $testpid" \ ++ "Detaching from program: .*$escapedbinfile, process $testpid\r\n\\\[Inferior $decimal \\(.*\\) detached\\\]" \ + "attach1 detach" + + # Wait a bit for gdb to finish detaching +Index: rhel-7.8/gdb-7.6.1/gdb/testsuite/gdb.base/catch-syscall.exp +=================================================================== +--- rhel-7.8.orig/gdb-7.6.1/gdb/testsuite/gdb.base/catch-syscall.exp ++++ rhel-7.8/gdb-7.6.1/gdb/testsuite/gdb.base/catch-syscall.exp +@@ -164,7 +164,7 @@ proc check_for_program_end {} { + # Deleting the catchpoints + delete_breakpoints + +- gdb_continue_to_end ++ gdb_continue_to_end "" continue 1 + + } + +@@ -228,7 +228,7 @@ proc test_catch_syscall_with_wrong_args + # If it doesn't, everything is right (since we don't have + # a syscall named "mlock" in it). Otherwise, this is a failure. + set thistest "catch syscall with unused syscall ($syscall_name)" +- gdb_continue_to_end $thistest ++ gdb_continue_to_end $thistest continue 1 + } + + proc test_catch_syscall_restarting_inferior {} { +Index: rhel-7.8/gdb-7.6.1/gdb/testsuite/gdb.base/foll-fork.exp +=================================================================== +--- rhel-7.8.orig/gdb-7.6.1/gdb/testsuite/gdb.base/foll-fork.exp ++++ rhel-7.8/gdb-7.6.1/gdb/testsuite/gdb.base/foll-fork.exp +@@ -64,7 +64,7 @@ proc default_fork_parent_follow {} { + "default show parent follow, no catchpoints" + + gdb_test "next 2" \ +- "Detaching after fork from.*" \ ++ "\\\[Detaching after fork from.*" \ + "default parent follow, no catchpoints" + + # The child has been detached; allow time for any output it might +@@ -83,7 +83,7 @@ proc explicit_fork_parent_follow {} { + "Debugger response to a program call of fork or vfork is \"parent\"." \ + "explicit show parent follow, no catchpoints" + +- gdb_test "next 2" "Detaching after fork from.*" \ ++ gdb_test "next 2" "\\\[Detaching after fork from.*" \ + "explicit parent follow, no catchpoints" + + # The child has been detached; allow time for any output it might +@@ -102,7 +102,7 @@ proc explicit_fork_child_follow {} { + "Debugger response to a program call of fork or vfork is \"child\"." \ + "explicit show child follow, no catchpoints" + +- gdb_test "next 2" "Attaching after.* fork to.*" \ ++ gdb_test "next 2" "\\\[Attaching after.* fork to.*" \ + "explicit child follow, no catchpoints" + + # The child has been detached; allow time for any output it might +@@ -152,7 +152,7 @@ proc catch_fork_child_follow {} { + "set follow-fork child, tbreak" + + gdb_test "continue" \ +- "Attaching after.* fork to.* at .*$bp_after_fork.*" \ ++ "\\\[Attaching after.* fork to.* at .*$bp_after_fork.*" \ + "set follow-fork child, hit tbreak" + + # The parent has been detached; allow time for any output it might +@@ -239,7 +239,7 @@ proc tcatch_fork_parent_follow {} { + "set follow-fork parent, tbreak" + + gdb_test "continue" \ +- "Detaching after fork from.* at .*$bp_after_fork.*" \ ++ "\\\[Detaching after fork from.* at .*$bp_after_fork.*" \ + "set follow-fork parent, hit tbreak" + + # The child has been detached; allow time for any output it might +@@ -338,10 +338,6 @@ gdb_start + gdb_reinitialize_dir $srcdir/$subdir + gdb_load ${binfile} + +-# The "Detaching..." and "Attaching..." messages may be hidden by +-# default. +-gdb_test_no_output "set verbose" +- + # This is a test of gdb's ability to follow the parent, child or both + # parent and child of a Unix fork() system call. + # +Index: rhel-7.8/gdb-7.6.1/gdb/testsuite/gdb.base/foll-vfork.exp +=================================================================== +--- rhel-7.8.orig/gdb-7.6.1/gdb/testsuite/gdb.base/foll-vfork.exp ++++ rhel-7.8/gdb-7.6.1/gdb/testsuite/gdb.base/foll-vfork.exp +@@ -73,10 +73,6 @@ proc setup_gdb {} { + + clean_restart $testfile + +- # The "Detaching..." and "Attaching..." messages may be hidden by +- # default. +- gdb_test_no_output "set verbose" +- + if ![runto_main] { + return -code return + } +@@ -117,7 +113,7 @@ proc vfork_parent_follow_through_step {} + + set test "step" + gdb_test_multiple "next" $test { +- -re "Detaching after fork from.*if \\(pid == 0\\).*$gdb_prompt " { ++ -re "\\\[Detaching after vfork from.*if \\(pid == 0\\).*$gdb_prompt " { + pass $test + } + } +@@ -142,7 +138,7 @@ proc vfork_parent_follow_to_bp {} { + + set test "continue to bp" + gdb_test_multiple "continue" $test { +- -re ".*Detaching after fork from child process.*Breakpoint.*${bp_location}.*$gdb_prompt " { ++ -re ".*\\\[Detaching after vfork from child process.*Breakpoint.*${bp_location}.*$gdb_prompt " { + pass $test + } + } +@@ -167,7 +163,7 @@ proc vfork_child_follow_to_exit {} { + # PR gdb/14766 + fail "$test" + } +- -re "Attaching after.* vfork to.*Detaching vfork parent .* after child exit.*$gdb_prompt " { ++ -re "\\\[Attaching after.* vfork to.*\\\[Detaching vfork parent .* after child exit.*$gdb_prompt " { + pass $test + } + } +@@ -191,7 +187,8 @@ proc vfork_and_exec_child_follow_to_main + + set test "continue to bp" + gdb_test_multiple "continue" $test { +- -re "Attaching after.* vfork to.*xecuting new program.*Breakpoint.*vforked-prog.c:${linenum}.*$gdb_prompt " { ++ -re "\\\[Attaching after.* vfork to.*\\\[Detaching vfork parent.*xecuting new program.*Breakpoint.*vforked-prog.c:${linenum}.*$gdb_prompt " { ++ + pass $test + } + } +@@ -235,7 +232,7 @@ proc vfork_and_exec_child_follow_through + # + set linenum [gdb_get_line_number "printf(\"Hello from vforked-prog" ${srcfile2}] + gdb_test_multiple "next" $test { +- -re "Attaching after fork to.*Executing new program.*Breakpoint.*vforked-prog.c:${linenum}.*$gdb_prompt " { ++ -re "\\\[Attaching after fork to.*Executing new program.*Breakpoint.*vforked-prog.c:${linenum}.*$gdb_prompt " { + pass "$test" + } + } +@@ -244,7 +241,7 @@ proc vfork_and_exec_child_follow_through + # before it execs. Thus, "next" lands on the next line after + # the vfork. + gdb_test_multiple "next" $test { +- -re "Attaching after .* vfork to child.*if \\(pid == 0\\).*$gdb_prompt " { ++ -re "\\\[Attaching after .* vfork to child.*if \\(pid == 0\\).*$gdb_prompt " { + pass "$test" + } + } +@@ -398,7 +395,7 @@ proc vfork_relations_in_info_inferiors { + + set test "step over vfork" + gdb_test_multiple "next" $test { +- -re "Attaching after .* vfork to child.*if \\(pid == 0\\).*$gdb_prompt " { ++ -re "\\\[Attaching after .* vfork to child.*if \\(pid == 0\\).*$gdb_prompt " { + pass "$test" + } + } +Index: rhel-7.8/gdb-7.6.1/gdb/testsuite/gdb.base/fork-print-inferior-events.c +=================================================================== +--- /dev/null ++++ rhel-7.8/gdb-7.6.1/gdb/testsuite/gdb.base/fork-print-inferior-events.c +@@ -0,0 +1,37 @@ ++/* This testcase is part of GDB, the GNU debugger. ++ ++ Copyright 2007-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 . */ ++ ++#include ++#include ++ ++int ++main (int argc, char *argv[]) ++{ ++ pid_t child; ++ ++ child = fork (); ++ switch (child) ++ { ++ case -1: ++ abort (); ++ case 0: ++ default: ++ break; ++ } ++ ++ return 0; ++} +Index: rhel-7.8/gdb-7.6.1/gdb/testsuite/gdb.base/fork-print-inferior-events.exp +=================================================================== +--- /dev/null ++++ rhel-7.8/gdb-7.6.1/gdb/testsuite/gdb.base/fork-print-inferior-events.exp +@@ -0,0 +1,96 @@ ++# This testcase is part of GDB, the GNU debugger. ++ ++# Copyright 2007-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 . ++ ++# Test that the event messages printed when using 'set print ++# inferior-events [on,off]', 'set follow-fork-mode [child,parent]' and ++# 'set detach-on-fork [on,off]' are the correct ones. ++ ++# This test relies on "run", so it cannot run on target remote stubs. ++if { [use_gdb_stub] } { ++ untested "not supported on target remote stubs" ++ return ++} ++ ++standard_testfile ++ ++if { [prepare_for_testing "failed to prepare" $testfile $srcfile debug] } { ++ return -1 ++} ++ ++# RHEL7 GDB lacks the unified remote/native fork handling code, ++# so we don't get event notifications for remote targets. ++# Skip the "on" case of print inferior-events. ++set using_remote 0 ++if {[target_info gdb_protocol] == "extended-remote"} { ++ set using_remote 1 ++} ++ ++# This is the expected output for each of the test combinations ++# below. The order here is important: ++# ++# inferior-events: on; follow-fork: child; detach-on-fork: on ++# inferior-events: on; follow-fork: child; detach-on-fork: off ++# inferior-events: on; follow-fork: parent; detach-on-fork: on ++# inferior-events: on; follow-fork: parent; detach-on-fork: off ++# inferior-events: off; follow-fork: child; detach-on-fork: on ++# inferior-events: off; follow-fork: child; detach-on-fork: off ++# inferior-events: off; follow-fork: parent; detach-on-fork: on ++# inferior-events: off; follow-fork: parent; detach-on-fork: off ++ ++set reading_re "(Reading.*from remote target\\.\\.\\.\r\n)*" ++set exited_normally_re "${reading_re}\\\[Inferior $decimal \\(.*\\) exited normally\\\]" ++# gdbserver produces a slightly different message when attaching after ++# a fork, so we have to tweak the regexp to accomodate that. ++set attach_child_re "${reading_re}\\\[Attaching after .* fork to child .*\\\]\r\n" ++set detach_child_re "${reading_re}\\\[Detaching after fork from child .*\\\]\r\n" ++set detach_parent_re "${reading_re}\\\[Detaching after fork from parent .*\\\]\r\n" ++set new_inf_re "${reading_re}\\\[New inferior $decimal \\(.*\\)\\\]\r\n" ++set inf_detached_re "${reading_re}\\\[Inferior $decimal \\(.*\\) detached\\\]\r\n" ++ ++set expected_output [list \ ++ "${attach_child_re}${new_inf_re}${detach_parent_re}${inf_detached_re}" \ ++ "${attach_child_re}${new_inf_re}" \ ++ "${detach_child_re}" \ ++ "${new_inf_re}" \ ++ "" \ ++ "" \ ++ "" \ ++ "" \ ++ ] ++ ++set i 0 ++ ++foreach_with_prefix print_inferior_events { "on" "off" } { ++ foreach_with_prefix follow_fork_mode { "child" "parent" } { ++ foreach_with_prefix detach_on_fork { "on" "off" } { ++ clean_restart $binfile ++ gdb_test_no_output "set print inferior-events $print_inferior_events" ++ gdb_test_no_output "set follow-fork-mode $follow_fork_mode" ++ gdb_test_no_output "set detach-on-fork $detach_on_fork" ++ ++ set output [lindex $expected_output $i] ++ # Always add the "Starting program..." string so that we ++ # match exactly the lines we want. ++ set output "Starting program: $binfile\\s*\r\n${output}${exited_normally_re}" ++ set i [expr $i + 1] ++ if {$using_remote && $print_inferior_events == "on"} { ++ continue ++ } ++ gdb_test "run" $output ++ } ++ } ++} +Index: rhel-7.8/gdb-7.6.1/gdb/testsuite/gdb.base/kill-after-signal.exp +=================================================================== +--- rhel-7.8.orig/gdb-7.6.1/gdb/testsuite/gdb.base/kill-after-signal.exp ++++ rhel-7.8/gdb-7.6.1/gdb/testsuite/gdb.base/kill-after-signal.exp +@@ -37,4 +37,8 @@ if ![runto_main] { + + gdb_test "continue" "Program received signal SIGUSR1, .*" + gdb_test "stepi" "\r\nhandler .*" +-gdb_test "kill" "^y" "kill" "Kill the program being debugged\\? \\(y or n\\) $" "y" ++gdb_test_multiple "kill" "kill" { ++ -re "Kill the program being debugged\\? \\(y or n\\) $" { ++ gdb_test "y" "\\\[Inferior $decimal \\(.*\\) killed\\\]" "kill" ++ } ++} +Index: rhel-7.8/gdb-7.6.1/gdb/testsuite/gdb.base/solib-overlap.exp +=================================================================== +--- rhel-7.8.orig/gdb-7.6.1/gdb/testsuite/gdb.base/solib-overlap.exp ++++ rhel-7.8/gdb-7.6.1/gdb/testsuite/gdb.base/solib-overlap.exp +@@ -127,7 +127,7 @@ foreach prelink_lib1 {0x40000000 0x50000 + + # Detach the process. + +- gdb_test "detach" "Detaching from program: .*$escapedbinfile, process $testpid" ++ gdb_test "detach" "Detaching from program: .*$escapedbinfile, process $testpid\r\n\\\[Inferior $decimal \\(.*\\) detached\\\]" + + # Wait a bit for gdb to finish detaching + +Index: rhel-7.8/gdb-7.6.1/gdb/testsuite/lib/gdb.exp +=================================================================== +--- rhel-7.8.orig/gdb-7.6.1/gdb/testsuite/lib/gdb.exp ++++ rhel-7.8/gdb-7.6.1/gdb/testsuite/lib/gdb.exp +@@ -1738,6 +1738,27 @@ proc with_test_prefix { prefix body } { + } + } + ++# Wrapper for foreach that calls with_test_prefix on each iteration, ++# including the iterator's name and current value in the prefix. ++ ++proc foreach_with_prefix {var list body} { ++ upvar 1 $var myvar ++ foreach myvar $list { ++ with_test_prefix "$var=$myvar" { ++ set code [catch {uplevel 1 $body} result] ++ } ++ ++ if {$code == 1} { ++ global errorInfo errorCode ++ return -code $code -errorinfo $errorInfo -errorcode $errorCode $result ++ } elseif {$code == 3} { ++ break ++ } elseif {$code == 2} { ++ return -code $code $result ++ } ++ } ++} ++ + # Return 1 if _Complex types are supported, otherwise, return 0. + + proc support_complex_tests {} { +@@ -2354,6 +2375,26 @@ proc skip_unwinder_tests {} { + return $ok + } + ++# Return the effective value of use_gdb_stub. ++# ++# If the use_gdb_stub global has been set (it is set when the gdb process is ++# spawned), return that. Otherwise, return the value of the use_gdb_stub ++# property from the board file. ++# ++# This is the preferred way of checking use_gdb_stub, since it allows to check ++# the value before the gdb has been spawned and it will return the correct value ++# even when it was overriden by the test. ++ ++proc use_gdb_stub {} { ++ global use_gdb_stub ++ ++ if [info exists use_gdb_stub] { ++ return $use_gdb_stub ++ } ++ ++ return [target_info exists use_gdb_stub] ++} ++ + set compiler_info "unknown" + set gcc_compiled 0 + set hp_cc_compiler 0 diff --git a/SPECS/gdb.spec b/SPECS/gdb.spec index 9819976..75b0ef9 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: 115%{?dist} +Release: 119%{?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 @@ -302,10 +302,6 @@ Patch235: gdb-6.3-bz231832-obstack-2gb.patch #=fedoratest Patch245: gdb-6.6-bz229517-gcore-without-terminal.patch -# Notify user of a child forked process being detached (BZ 235197). -#=push: This is more about discussion if/what should be printed. -Patch247: gdb-6.6-bz235197-fork-detach-info.patch - # Avoid too long timeouts on failing cases of "annota1.exp annota3.exp". #=fedoratest Patch254: gdb-6.6-testsuite-timeouts.patch @@ -941,6 +937,9 @@ Patch1278: gdb-rhbz1347993-aarch64-hw-watchpoint.patch # Backport symtab/23853 symlinked default symtab (RH BZ 1639077) Patch1280: gdb-rhbz1639077-symlink-default-symtab.patch +# Backport print inferior-events (RH BZ 1677918) +Patch1281: gdb-rhbz1677918-print-inferior-events.patch + %if 0%{!?rhel:1} || 0%{?rhel} > 6 # RL_STATE_FEDORA_GDB would not be found for: # Patch642: gdb-readline62-ask-more-rh.patch @@ -1195,7 +1194,6 @@ find -name "*.info*"|xargs rm -f %patch234 -p1 %patch235 -p1 %patch245 -p1 -%patch247 -p1 %patch254 -p1 %patch258 -p1 %patch260 -p1 @@ -1496,6 +1494,7 @@ find -name "*.info*"|xargs rm -f %patch1276 -p1 %patch1277 -p1 %patch1280 -p1 +%patch1281 -p2 %if 0%{?scl:1} %patch836 -p1 -R @@ -2023,6 +2022,21 @@ fi %endif # 0%{!?el5:1} || "%{_target_cpu}" == "noarch" %changelog +* Sun Dec 1 2019 Jan Kratochvil - 7.6.1-119.el7 +- Fix the source files symlinks (Jan Kratochvil, RH BZ 1639077 and RH BZ 1750470). + +* Mon Nov 18 2019 Keith Seitz - 7.6.1-118.el7 +- Really fix breakpoint reset error when symtab is symlinked + (Keith Seitz, RH BZ 1750470) + +* Mon Nov 11 2019 Keith Seitz - 7.6.1-117.el7 +- Fix breakpoint reset error when symtab is symlinked + (Keith Seitz, RH BZ 1750470) + +* Wed Jul 24 2019 Keith Seitz - 7.6.1-116.el7 +- Backport print inferior-events patch + (Sergio Durigan et al, RH BZ 1677918) + * Fri Mar 1 2019 Keith Seitz - 7.6.1-115.el7 - Fix symlinked default symtab bug (RH BZ 1639077).