Accepting request 734341 from home:tomdevries:branches:devel:gcc-gdb-8.3.1-upgrade

- Add gdb-testsuite-8.3-kfail-xfail-unsupported.patch
- Drop ChangeLog part of patch:
  * gdb-rhbz1708192-parse_macro_definition-crash.patch
  * gdb-rhbz1704406-disable-style-log-output-1of3.patch
  * gdb-rhbz1704406-disable-style-log-output-2of3.patch
  * gdb-rhbz1704406-disable-style-log-output-3of3.patch
  * gdb-rhbz1723564-gdb-crash-PYTHONMALLOC-debug.patch
  * gdb-rhbz1553086-binutils-warning-loadable-section-outside-elf.patch
- Update to gdb-8.3.1.
  * Drop "Testsuite: Ensure pie is disabled on some tests" part of
    gdb-testsuite-pie-no-pie.patch
  * Drop:
    - gdb-7.10-swo18929.patch
    - gdb-handle-vfork-in-thread-with-follow-fork-mode-child.patch
    - gdb-x86_64-i386-syscall-restart-master.patch
    - gdb-suppress-sigttou-when-handling-errors.patch
    - gdb-fix-breakpoints-on-file-reloads-for-pie-binaries.patch
    - gdb-symtab-fix-symbol-loading-performance-regression.patch
- Fix macro in comment warning

OBS-URL: https://build.opensuse.org/request/show/734341
OBS-URL: https://build.opensuse.org/package/show/devel:gcc/gdb?expand=0&rev=229
This commit is contained in:
Michael Matz 2019-10-01 14:34:39 +00:00 committed by Git OBS Bridge
parent 0ecc5e2c59
commit 814eaf999d
18 changed files with 985 additions and 1348 deletions

View File

@ -1,37 +0,0 @@
https://sourceware.org/bugzilla/show_bug.cgi?id=18929
---
gdb/cp-valprint.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
Index: gdb-7.11/gdb/cp-valprint.c
===================================================================
--- gdb-7.11.orig/gdb/cp-valprint.c 2016-03-21 10:04:07.845131361 +0100
+++ gdb-7.11/gdb/cp-valprint.c 2016-03-21 10:04:49.089597879 +0100
@@ -313,11 +313,13 @@ cp_print_value_fields (struct type *type
}
else if (field_is_static (&TYPE_FIELD (type, i)))
{
- struct value *v = NULL;
-
TRY
{
+ struct value *v = NULL;
v = value_static_field (type, i);
+ cp_print_static_field (TYPE_FIELD_TYPE (type, i),
+ v, stream, recurse + 1,
+ options);
}
CATCH (ex, RETURN_MASK_ERROR)
@@ -327,10 +329,6 @@ cp_print_value_fields (struct type *type
ex.message);
}
END_CATCH
-
- cp_print_static_field (TYPE_FIELD_TYPE (type, i),
- v, stream, recurse + 1,
- options);
}
else if (i == vptr_fieldno && type == vptr_basetype)
{

3
gdb-8.3.1.tar.bz2 Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:05c64ab7298487fde1aac402026ef0569cf7e703054d2a42e272292a0b096fdf
size 29382553

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e722dd64f86742c5be2da15dea9f8906f44f20dd89f7f98bcad93767ffaf7638
size 29368870

View File

@ -1,154 +0,0 @@
Fix breakpoints on file reloads for PIE binaries
When a binary is built using PIE, reloading the file will cause GDB to error
on restart. For example:
gdb ./a.out
(gdb) break main
(gdb) run
(gdb) file ./a.out
(gdb) continue
Will cause GDB to error with:
Continuing.
Warning:
Cannot insert breakpoint 1.
Cannot access memory at address 0x9e0
Command aborted.
This is due to the symbol offsets not being relocated after reloading the file.
Fix is to ensure solib_create_inferior_hook is called, in the same manner as
infrun.c:follow_exec().
Expand the idempotent test to cover PIE scenarios.
gdb/ChangeLog:
* symfile.c (symbol_file_command): Call solib_create_inferior_hook.
gdb/testsuite/ChangeLog:
* gdb.base/break-idempotent.exp: Test both PIE and non PIE.
---
gdb/ChangeLog | 4 ++
gdb/symfile.c | 12 ++++++
gdb/testsuite/ChangeLog | 4 ++
gdb/testsuite/gdb.base/break-idempotent.exp | 66 ++++++++++++++++-------------
4 files changed, 56 insertions(+), 30 deletions(-)
diff --git a/gdb/symfile.c b/gdb/symfile.c
index bd79315687..a03ac29541 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -1672,7 +1672,19 @@ symbol_file_command (const char *args, int from_tty)
validate_readnow_readnever (flags);
+ /* Set SYMFILE_DEFER_BP_RESET because the proper displacement for a PIE
+ (Position Independent Executable) main symbol file will only be
+ computed by the solib_create_inferior_hook below. Without it,
+ breakpoint_re_set would fail to insert the breakpoints with the zero
+ displacement. */
+ add_flags |= SYMFILE_DEFER_BP_RESET;
+
symbol_file_add_main_1 (name, add_flags, flags, offset);
+
+ solib_create_inferior_hook (from_tty);
+
+ /* Now it's safe to re-add the breakpoints. */
+ breakpoint_re_set ();
}
}
diff --git a/gdb/testsuite/gdb.base/break-idempotent.exp b/gdb/testsuite/gdb.base/break-idempotent.exp
index 902a5f818b..96f91c50f9 100644
--- a/gdb/testsuite/gdb.base/break-idempotent.exp
+++ b/gdb/testsuite/gdb.base/break-idempotent.exp
@@ -36,23 +36,6 @@
standard_testfile
-if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} {
- return -1
-}
-
-if ![runto_main] then {
- fail "can't run to main"
- return 0
-}
-
-if [is_remote host] {
- set arg [remote_download host $binfile]
- if { $arg == "" } {
- perror "download failed"
- return -1
- }
-}
-
# Force a breakpoint re-set in GDB. Currently this is done by
# reloading symbols with the "file" command.
@@ -123,7 +106,7 @@ proc set_breakpoint { break_command } {
proc test_break { always_inserted break_command } {
set cmd [lindex [split "$break_command"] 0]
- with_test_prefix "always-inserted $always_inserted: $cmd" {
+ with_test_prefix "$cmd" {
delete_breakpoints
if ![runto_main] then {
@@ -163,20 +146,43 @@ proc test_break { always_inserted break_command } {
}
}
-foreach always_inserted { "off" "on" } {
- test_break $always_inserted "break"
+# The testcase uses the "file" command to force breakpoint re-set in
+# GDB. Test both with and without PIE, as GDB used to mishandle
+# breakpoint re-set when reloading PIEs.
+foreach_with_prefix pie { "nopie" "pie" } {
+
+ set opts {debug}
+ lappend opts $pie
- if {![skip_hw_breakpoint_tests]} {
- test_break $always_inserted "hbreak"
+ set binfile [standard_output_file $testfile-$pie]
+
+ if {[prepare_for_testing "failed to prepare" $binfile $srcfile $opts]} {
+ continue
}
- if {![skip_hw_watchpoint_tests]} {
- test_break $always_inserted "watch"
+ if [is_remote host] {
+ set arg [remote_download host $binfile]
+ if { $arg == "" } {
+ untested "download failed"
+ continue
+ }
}
- if {![skip_hw_watchpoint_access_tests]
- && ![skip_hw_watchpoint_multi_tests]} {
- test_break $always_inserted "rwatch"
- test_break $always_inserted "awatch"
+ foreach_with_prefix always_inserted { "off" "on" } {
+ test_break $always_inserted "break"
+
+ if {![skip_hw_breakpoint_tests]} {
+ test_break $always_inserted "hbreak"
+ }
+
+ if {![skip_hw_watchpoint_tests]} {
+ test_break $always_inserted "watch"
+ }
+
+ if {![skip_hw_watchpoint_access_tests]
+ && ![skip_hw_watchpoint_multi_tests]} {
+ test_break $always_inserted "rwatch"
+ test_break $always_inserted "awatch"
+ }
}
}

View File

@ -1,431 +0,0 @@
commit b73715df01e6e9b3de5a49cd7bf4170deef48461
Author: Tom de Vries <tdevries@suse.de>
Date: Thu Apr 18 17:05:43 2019 +0100
[gdb] Handle vfork in thread with follow-fork-mode child
When debugging any of the testcases added by this commit, which do a
vfork in a thread with "set follow-fork-mode child" + "set
detach-on-fork on", we run into this assertion:
...
src/gdb/nat/x86-linux-dregs.c:146: internal-error: \
void x86_linux_update_debug_registers(lwp_info*): \
Assertion `lwp_is_stopped (lwp)' failed.
...
The assert is caused by the following: the vfork-child exit or exec
event is handled by handle_vfork_child_exec_or_exit, which calls
target_detach to detach from the vfork parent. During target_detach
we call linux_nat_target::detach, which:
#1 - stops all the threads
#2 - waits for all the threads to be stopped
#3 - detaches all the threads
However, during the second step we run into this code in
stop_wait_callback:
...
/* If this is a vfork parent, bail out, it is not going to report
any SIGSTOP until the vfork is done with. */
if (inf->vfork_child != NULL)
return 0;
...
and we don't wait for the threads to be stopped, which results in this
assert in x86_linux_update_debug_registers triggering during the third
step:
...
gdb_assert (lwp_is_stopped (lwp));
...
The fix is to reset the vfork parent's vfork_child field before
calling target_detach in handle_vfork_child_exec_or_exit. There's
already similar code for the other paths handled by
handle_vfork_child_exec_or_exit, so this commit refactors the code a
bit so that all paths share the same code.
The new tests cover both a vfork child exiting, and a vfork child
execing, since both cases would trigger the assertion.
The new testcases also exercise following the vfork children with "set
detach-on-fork off", since it doesn't seem to be tested anywhere.
Tested on x86_64-linux, using native and native-gdbserver.
gdb/ChangeLog:
2019-04-18 Tom de Vries <tdevries@suse.de>
Pedro Alves <palves@redhat.com>
PR gdb/24454
* infrun.c (handle_vfork_child_exec_or_exit): Reset vfork parent's
vfork_child field before calling target_detach.
gdb/testsuite/ChangeLog:
2019-04-18 Tom de Vries <tdevries@suse.de>
Pedro Alves <palves@redhat.com>
PR gdb/24454
* gdb.threads/vfork-follow-child-exec.c: New file.
* gdb.threads/vfork-follow-child-exec.exp: New file.
* gdb.threads/vfork-follow-child-exit.c: New file.
* gdb.threads/vfork-follow-child-exit.exp: New file.
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 37713b24fe..37df561de0 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -915,10 +915,14 @@ handle_vfork_child_exec_or_exit (int exec)
int resume_parent = -1;
/* This exec or exit marks the end of the shared memory region
- between the parent and the child. If the user wanted to
- detach from the parent, now is the time. */
+ between the parent and the child. Break the bonds. */
+ inferior *vfork_parent = inf->vfork_parent;
+ inf->vfork_parent->vfork_child = NULL;
+ inf->vfork_parent = NULL;
- if (inf->vfork_parent->pending_detach)
+ /* If the user wanted to detach from the parent, now is the
+ time. */
+ if (vfork_parent->pending_detach)
{
struct thread_info *tp;
struct program_space *pspace;
@@ -926,7 +930,7 @@ handle_vfork_child_exec_or_exit (int exec)
/* follow-fork child, detach-on-fork on. */
- inf->vfork_parent->pending_detach = 0;
+ vfork_parent->pending_detach = 0;
gdb::optional<scoped_restore_exited_inferior>
maybe_restore_inferior;
@@ -941,7 +945,7 @@ handle_vfork_child_exec_or_exit (int exec)
maybe_restore_thread.emplace ();
/* We're letting loose of the parent. */
- tp = any_live_thread_of_inferior (inf->vfork_parent);
+ tp = any_live_thread_of_inferior (vfork_parent);
switch_to_thread (tp);
/* We're about to detach from the parent, which implicitly
@@ -964,7 +968,7 @@ handle_vfork_child_exec_or_exit (int exec)
if (print_inferior_events)
{
const char *pidstr
- = target_pid_to_str (ptid_t (inf->vfork_parent->pid));
+ = target_pid_to_str (ptid_t (vfork_parent->pid));
target_terminal::ours_for_output ();
@@ -982,7 +986,7 @@ handle_vfork_child_exec_or_exit (int exec)
}
}
- target_detach (inf->vfork_parent, 0);
+ target_detach (vfork_parent, 0);
/* Put it back. */
inf->pspace = pspace;
@@ -997,10 +1001,7 @@ handle_vfork_child_exec_or_exit (int exec)
inf->removable = 1;
set_current_program_space (inf->pspace);
- resume_parent = inf->vfork_parent->pid;
-
- /* Break the bonds. */
- inf->vfork_parent->vfork_child = NULL;
+ resume_parent = vfork_parent->pid;
}
else
{
@@ -1030,17 +1031,13 @@ handle_vfork_child_exec_or_exit (int exec)
set_current_program_space (pspace);
inf->removable = 1;
inf->symfile_flags = SYMFILE_NO_READ;
- clone_program_space (pspace, inf->vfork_parent->pspace);
+ clone_program_space (pspace, vfork_parent->pspace);
inf->pspace = pspace;
inf->aspace = pspace->aspace;
- resume_parent = inf->vfork_parent->pid;
- /* Break the bonds. */
- inf->vfork_parent->vfork_child = NULL;
+ resume_parent = vfork_parent->pid;
}
- inf->vfork_parent = NULL;
-
gdb_assert (current_program_space == inf->pspace);
if (non_stop && resume_parent != -1)
diff --git a/gdb/testsuite/gdb.threads/vfork-follow-child-exec.c b/gdb/testsuite/gdb.threads/vfork-follow-child-exec.c
new file mode 100644
index 0000000000..80632d1772
--- /dev/null
+++ b/gdb/testsuite/gdb.threads/vfork-follow-child-exec.c
@@ -0,0 +1,66 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2019 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include <stdio.h>
+#include <unistd.h>
+#include <pthread.h>
+#include <string.h>
+#include <stdlib.h>
+
+static char *program_name;
+
+static void *
+f (void *arg)
+{
+ int res = vfork ();
+
+ if (res == -1)
+ {
+ perror ("vfork");
+ return NULL;
+ }
+ else if (res == 0)
+ {
+ /* Child. */
+ execl (program_name, program_name, "1", NULL);
+ perror ("exec");
+ abort ();
+ }
+ else
+ {
+ /* Parent. */
+ return NULL;
+ }
+}
+
+int
+main (int argc, char **argv)
+{
+ pthread_t tid;
+
+ if (argc > 1)
+ {
+ /* Getting here via execl. */
+ return 0;
+ }
+
+ program_name = argv[0];
+
+ pthread_create (&tid, NULL, f, NULL);
+ pthread_join (tid, NULL);
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.threads/vfork-follow-child-exec.exp b/gdb/testsuite/gdb.threads/vfork-follow-child-exec.exp
new file mode 100644
index 0000000000..5a28715fa0
--- /dev/null
+++ b/gdb/testsuite/gdb.threads/vfork-follow-child-exec.exp
@@ -0,0 +1,64 @@
+# Copyright (C) 2019 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+# Test following a vfork child that execs, when the vfork parent is a
+# threaded program, and it's a non-main thread that vforks.
+
+standard_testfile
+
+if {[build_executable "failed to prepare" $testfile $srcfile {debug pthreads}]} {
+ return -1
+}
+
+# DETACH indicates whether "set detach-on-fork" is enabled. It is
+# either "on" or "off".
+
+proc test_vfork {detach} {
+ global binfile
+
+ clean_restart $binfile
+
+ if ![runto_main] then {
+ fail "can't run to main"
+ return 0
+ }
+
+ delete_breakpoints
+
+ gdb_test_no_output "set follow-fork-mode child"
+ gdb_test_no_output "set detach-on-fork $detach"
+
+ if {$detach == "off"} {
+ gdb_test "continue" \
+ [multi_line \
+ "Attaching after .* vfork to child .*" \
+ ".*New inferior 2 .*" \
+ ".* is executing new program: .*" \
+ ".*Inferior 2 .* exited normally.*"]
+ } else {
+ gdb_test "continue" \
+ [multi_line \
+ "Attaching after .* vfork to child .*" \
+ ".*New inferior 2 .*" \
+ ".*Detaching vfork parent process .* after child exec.*" \
+ ".*Inferior 1 .* detached.*" \
+ ".*is executing new program: .*" \
+ ".*Inferior 2 .*exited normally.*"]
+ }
+}
+
+foreach_with_prefix detach-on-fork {"off" "on"} {
+ test_vfork ${detach-on-fork}
+}
diff --git a/gdb/testsuite/gdb.threads/vfork-follow-child-exit.c b/gdb/testsuite/gdb.threads/vfork-follow-child-exit.c
new file mode 100644
index 0000000000..6ae254cce9
--- /dev/null
+++ b/gdb/testsuite/gdb.threads/vfork-follow-child-exit.c
@@ -0,0 +1,52 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2019 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include <stdio.h>
+#include <unistd.h>
+#include <pthread.h>
+
+static void *
+f (void *arg)
+{
+ int res = vfork ();
+
+ if (res == -1)
+ {
+ perror ("vfork");
+ return NULL;
+ }
+ else if (res == 0)
+ {
+ /* Child. */
+ _exit (0);
+ }
+ else
+ {
+ /* Parent. */
+ return NULL;
+ }
+}
+
+int
+main (void)
+{
+ pthread_t tid;
+
+ pthread_create (&tid, NULL, f, NULL);
+ pthread_join (tid, NULL);
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.threads/vfork-follow-child-exit.exp b/gdb/testsuite/gdb.threads/vfork-follow-child-exit.exp
new file mode 100644
index 0000000000..f07215d41c
--- /dev/null
+++ b/gdb/testsuite/gdb.threads/vfork-follow-child-exit.exp
@@ -0,0 +1,60 @@
+# Copyright (C) 2019 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+# Test following a vfork child that exits, when the vfork parent is a
+# threaded program, and it's a non-main thread that vforks.
+
+standard_testfile
+
+if {[build_executable "failed to prepare" $testfile $srcfile {debug pthreads}]} {
+ return -1
+}
+
+# DETACH indicates whether "set detach-on-fork" is enabled. It is
+# either "on" or "off".
+
+proc test_vfork {detach} {
+ global binfile
+
+ clean_restart $binfile
+
+ if ![runto_main] then {
+ fail "can't run to main"
+ return 0
+ }
+
+ gdb_test_no_output "set follow-fork-mode child"
+ gdb_test_no_output "set detach-on-fork $detach"
+
+ if {$detach == "off"} {
+ gdb_test "continue" \
+ [multi_line \
+ "Attaching after .* vfork to child .*" \
+ ".*New inferior 2 .*" \
+ ".*Inferior 2 .*exited normally.*"]
+ } else {
+ gdb_test "continue" \
+ [multi_line \
+ "Attaching after .* vfork to child .*" \
+ ".*New inferior 2 .*" \
+ ".*Detaching vfork parent process .* after child exit.*" \
+ ".*Inferior 1 .* detached.*" \
+ ".*Inferior 2 .*exited normally.*"]
+ }
+}
+
+foreach_with_prefix detach-on-fork {"off" "on"} {
+ test_vfork ${detach-on-fork}
+}

View File

@ -16,22 +16,6 @@ Stop the BFD library from issuing a warning message when processing allocated se
in a debuginfo file.
* elf-bfd.h (is_debuginfo_file): Prototype.
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,12 @@
+2019-07-02 Nick Clifton <nickc@redhat.com>
+
+ PR 24717
+ * elf.c (is_debuginfo_file): New function.
+ (assign_file_positions_for_non_load_sections): Do not warn about
+ allocated sections outside of loadable segments if they are found
+ in a debuginfo file.
+ * elf-bfd.h (is_debuginfo_file): Prototype.
+
2019-05-02 Nick Clifton <nickc@redhat.com>
PR 24493
diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
--- a/bfd/elf-bfd.h
+++ b/bfd/elf-bfd.h

View File

@ -20,19 +20,6 @@ gdb/testsuite/ChangeLog
* gdb.base/style.exp: Use "style".
* lib/gdb-utils.exp (style): New proc.
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2019-05-22 Tom Tromey <tromey@adacore.com>
+
+ * gdb.base/info-shared.exp (check_info_shared): Use "style".
+ * gdb.base/style.exp: Use "style".
+ * lib/gdb-utils.exp (style): New proc.
+
2019-04-30 Tom Tromey <tromey@adacore.com>
PR c++/24470:
diff --git a/gdb/testsuite/gdb.base/style.exp b/gdb/testsuite/gdb.base/style.exp
--- a/gdb/testsuite/gdb.base/style.exp
+++ b/gdb/testsuite/gdb.base/style.exp

View File

@ -36,23 +36,6 @@ gdb/testsuite/ChangeLog
PR gdb/24502:
* gdb.base/style-logging.exp: New file.
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,13 @@
+2019-06-14 Tom Tromey <tromey@adacore.com>
+
+ PR gdb/24502:
+ * ui-style.h (skip_ansi_escape): Update comment.
+ * ui-file.h (class no_terminal_escape_file): New class.
+ * ui-file.c (no_terminal_escape_file::write)
+ (no_terminal_escape_file::puts): New methods.
+ * cli/cli-logging.c (handle_redirections): Use
+ no_terminal_escape_file.
+
2019-05-15 Sergio Durigan Junior <sergiodj@redhat.com>
Ref.: https://bugzilla.redhat.com/show_bug.cgi?id=1708192
diff --git a/gdb/cli/cli-logging.c b/gdb/cli/cli-logging.c
--- a/gdb/cli/cli-logging.c
+++ b/gdb/cli/cli-logging.c
@ -65,18 +48,6 @@ diff --git a/gdb/cli/cli-logging.c b/gdb/cli/cli-logging.c
if (!log->open (logging_filename, logging_overwrite ? "w" : "a"))
perror_with_name (_("set logging"));
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2019-06-14 Tom Tromey <tromey@adacore.com>
+
+ PR gdb/24502:
+ * gdb.base/style-logging.exp: New file.
+
2019-05-22 Tom Tromey <tromey@adacore.com>
* gdb.base/info-shared.exp (check_info_shared): Use "style".
diff --git a/gdb/testsuite/gdb.base/style-logging.exp b/gdb/testsuite/gdb.base/style-logging.exp
new file mode 100644
--- /dev/null

View File

@ -15,17 +15,6 @@ gdb/testsuite/ChangeLog:
* gdb.base/style-logging.exp: Remove path from test name.
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2019-06-15 Andrew Burgess <andrew.burgess@embecosm.com>
+
+ * gdb.base/style-logging.exp: Remove path from test name.
+
2019-06-14 Tom Tromey <tromey@adacore.com>
PR gdb/24502:
diff --git a/gdb/testsuite/gdb.base/style-logging.exp b/gdb/testsuite/gdb.base/style-logging.exp
--- a/gdb/testsuite/gdb.base/style-logging.exp
+++ b/gdb/testsuite/gdb.base/style-logging.exp

View File

@ -41,19 +41,6 @@ gdb/ChangeLog:
* dwarf2read.c (dwarf_decode_macro_bytes): Check whether 'body' is
NULL, and complain if that's the case.
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2019-05-15 Sergio Durigan Junior <sergiodj@redhat.com>
+
+ Ref.: https://bugzilla.redhat.com/show_bug.cgi?id=1708192
+ * dwarf2read.c (parse_macro_definition): Check whether 'body' is
+ NULL, and complain/return if that's the case.
+
2019-05-11 Joel Brobecker <brobecker@adacore.com>
* version.in: Set GDB version number to 8.3.
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c

View File

@ -96,20 +96,6 @@ gdb/ChangeLog:
* python/python.c (do_start_initialization): Use 'xmalloc'
instead of 'PyMem_Malloc'.
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,10 @@
+2019-06-28 Sergio Durigan Junior <sergiodj@redhat.com>
+
+ PR python/24742
+ https://bugzilla.redhat.com/show_bug.cgi?id=1723564
+ * python/python.c (do_start_initialization): Use 'xmalloc'
+ instead of 'PyMem_Malloc'.
+
2019-06-14 Tom Tromey <tromey@adacore.com>
PR gdb/24502:
diff --git a/gdb/python/python.c b/gdb/python/python.c
--- a/gdb/python/python.c
+++ b/gdb/python/python.c

View File

@ -1,173 +0,0 @@
From 766f883622ef008230250aa5aecef9fb9b29f233 Mon Sep 17 00:00:00 2001
From: Alan Hayward <alan.hayward@arm.com>
Date: Tue, 28 May 2019 10:07:54 +0100
Subject: [PATCH] Suppress SIGTTOU when handling errors
Calls to error () can cause SIGTTOU to send gdb to the background.
For example, on an Arm build:
(gdb) b main
Breakpoint 1 at 0x10774: file /build/gdb/testsuite/../../../src/binutils-gdb/gdb/testsuite/gdb.base/watchpoint.c, line 174.
(gdb) r
Starting program: /build/gdb/testsuite/outputs/gdb.base/watchpoint/watchpoint
[1]+ Stopped ../gdb ./outputs/gdb.base/watchpoint/watchpoint
localhost$ fg
../gdb ./outputs/gdb.base/watchpoint/watchpoint
Cannot parse expression `.L1199 4@r4'.
warning: Probes-based dynamic linker interface failed.
Reverting to original interface.
The SIGTTOU is raised whilst inside a syscall during the call to tcdrain.
Fix is to use scoped_ignore_sigttou to ensure SIGTTOU is blocked.
In addition fix include comments - job_control is not included via terminal.h
gdb/ChangeLog:
* event-top.c: Remove include comment.
* inflow.c (class scoped_ignore_sigttou): Move from here...
* inflow.h (class scoped_ignore_sigttou): ...to here.
* ser-unix.c (hardwire_drain_output): Block SIGTTOU during drain.
* top.c: Remove include comment.
---
gdb/ChangeLog | 8 ++++++++
gdb/event-top.c | 2 +-
gdb/inflow.c | 29 -----------------------------
gdb/inflow.h | 31 +++++++++++++++++++++++++++++++
gdb/ser-unix.c | 4 ++++
gdb/top.c | 2 +-
6 files changed, 45 insertions(+), 31 deletions(-)
diff --git a/gdb/event-top.c b/gdb/event-top.c
index 3ccf136ff12..93b7d2d28bc 100644
--- a/gdb/event-top.c
+++ b/gdb/event-top.c
@@ -24,7 +24,7 @@
#include "inferior.h"
#include "infrun.h"
#include "target.h"
-#include "terminal.h" /* for job_control */
+#include "terminal.h"
#include "event-loop.h"
#include "event-top.h"
#include "interps.h"
diff --git a/gdb/inflow.c b/gdb/inflow.c
index 339b55c0bc6..eba7a931f46 100644
--- a/gdb/inflow.c
+++ b/gdb/inflow.c
@@ -106,35 +106,6 @@ static serial_ttystate initial_gdb_ttystate;
static struct terminal_info *get_inflow_inferior_data (struct inferior *);
-/* RAII class used to ignore SIGTTOU in a scope. */
-
-class scoped_ignore_sigttou
-{
-public:
- scoped_ignore_sigttou ()
- {
-#ifdef SIGTTOU
- if (job_control)
- m_osigttou = signal (SIGTTOU, SIG_IGN);
-#endif
- }
-
- ~scoped_ignore_sigttou ()
- {
-#ifdef SIGTTOU
- if (job_control)
- signal (SIGTTOU, m_osigttou);
-#endif
- }
-
- DISABLE_COPY_AND_ASSIGN (scoped_ignore_sigttou);
-
-private:
-#ifdef SIGTTOU
- sighandler_t m_osigttou = NULL;
-#endif
-};
-
/* While the inferior is running, we want SIGINT and SIGQUIT to go to the
inferior only. If we have job control, that takes care of it. If not,
we save our handlers in these two variables and set SIGINT and SIGQUIT
diff --git a/gdb/inflow.h b/gdb/inflow.h
index c32aa144331..5dd5c37bd2b 100644
--- a/gdb/inflow.h
+++ b/gdb/inflow.h
@@ -21,5 +21,36 @@
#define INFLOW_H
#include <unistd.h>
+#include <signal.h>
+#include "common/job-control.h"
+
+/* RAII class used to ignore SIGTTOU in a scope. */
+
+class scoped_ignore_sigttou
+{
+public:
+ scoped_ignore_sigttou ()
+ {
+#ifdef SIGTTOU
+ if (job_control)
+ m_osigttou = signal (SIGTTOU, SIG_IGN);
+#endif
+ }
+
+ ~scoped_ignore_sigttou ()
+ {
+#ifdef SIGTTOU
+ if (job_control)
+ signal (SIGTTOU, m_osigttou);
+#endif
+ }
+
+ DISABLE_COPY_AND_ASSIGN (scoped_ignore_sigttou);
+
+private:
+#ifdef SIGTTOU
+ sighandler_t m_osigttou = NULL;
+#endif
+};
#endif /* inflow.h */
diff --git a/gdb/ser-unix.c b/gdb/ser-unix.c
index 5a9965bf744..3492619f2d6 100644
--- a/gdb/ser-unix.c
+++ b/gdb/ser-unix.c
@@ -32,6 +32,7 @@
#include "gdbcmd.h"
#include "common/filestuff.h"
#include <termios.h>
+#include "inflow.h"
struct hardwire_ttystate
{
@@ -164,6 +165,9 @@ hardwire_print_tty_state (struct serial *scb,
static int
hardwire_drain_output (struct serial *scb)
{
+ /* Ignore SIGTTOU which may occur during the drain. */
+ scoped_ignore_sigttou ignore_sigttou;
+
return tcdrain (scb->fd);
}
diff --git a/gdb/top.c b/gdb/top.c
index bacd684dbaa..1e17ebee87c 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -34,7 +34,7 @@
#include "expression.h"
#include "value.h"
#include "language.h"
-#include "terminal.h" /* For job_control. */
+#include "terminal.h"
#include "common/job-control.h"
#include "annotate.h"
#include "completer.h"
--
2.21.0

View File

@ -1,97 +0,0 @@
commit ed483764bd189d61714aa6b07104abe35469175a
Author: Tom de Vries <tdevries@suse.de>
Date: Fri May 10 18:46:28 2019 +0200
[gdb/symtab] Fix symbol loading performance regression
The commit "[gdb/symtab] Fix language of duplicate static minimal symbol"
introduces a performance regression, when loading a cc1 executable build with
-O0 -g and gcc 7.4.0. The performance regression, measured in 'real' time is
about 175%.
The slower execution comes from the fact that the fix in symbol_set_names
makes the call to symbol_find_demangled_name unconditional.
Fix this by reverting the commit, and redoing the fix as follows.
Recapturing the original problem, the first time symbol_set_names is called
with gsymbol.language == lang_auto and linkage_name == "_ZL3foov", the name is
not present in the per_bfd->demangled_names_hash hash table, so
symbol_find_demangled_name is called to demangle the name, after which the
mangled/demangled pair is added to the hashtable. The call to
symbol_find_demangled_name also sets gsymbol.language to lang_cplus.
The second time symbol_set_names is called with gsymbol.language == lang_auto
and linkage_name == "_ZL3foov", the name is present in the hash table, so the
demangled name from the hash table is used. However, the language of the
symbol remains lang_auto.
Fix this by adding a field language in struct demangled_name_entry, and using
the field in symbol_set_names to set the language of gsymbol, if necessary.
Tested on x86_64-linux.
gdb/ChangeLog:
2019-05-11 Tom de Vries <tdevries@suse.de>
PR symtab/24545
* symtab.c (struct demangled_name_entry): Add language field.
(symbol_set_names): Revert "[gdb/symtab] Fix language of duplicate
static minimal symbol". Set and use language field.
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 130d5cd48f..44964533ee 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -713,6 +713,7 @@ symbol_set_language (struct general_symbol_info *gsymbol,
struct demangled_name_entry
{
const char *mangled;
+ ENUM_BITFIELD(language) language : LANGUAGE_BITS;
char demangled[1];
};
@@ -853,11 +854,6 @@ symbol_set_names (struct general_symbol_info *gsymbol,
else
linkage_name_copy = linkage_name;
- /* Set the symbol language. */
- char *demangled_name_ptr
- = symbol_find_demangled_name (gsymbol, linkage_name_copy);
- gdb::unique_xmalloc_ptr<char> demangled_name (demangled_name_ptr);
-
entry.mangled = linkage_name_copy;
slot = ((struct demangled_name_entry **)
htab_find_slot (per_bfd->demangled_names_hash,
@@ -870,7 +866,9 @@ symbol_set_names (struct general_symbol_info *gsymbol,
|| (gsymbol->language == language_go
&& (*slot)->demangled[0] == '\0'))
{
- int demangled_len = demangled_name ? strlen (demangled_name.get ()) : 0;
+ char *demangled_name = symbol_find_demangled_name (gsymbol,
+ linkage_name_copy);
+ int demangled_len = demangled_name ? strlen (demangled_name) : 0;
/* Suppose we have demangled_name==NULL, copy_name==0, and
linkage_name_copy==linkage_name. In this case, we already have the
@@ -906,12 +904,19 @@ symbol_set_names (struct general_symbol_info *gsymbol,
strcpy (mangled_ptr, linkage_name_copy);
(*slot)->mangled = mangled_ptr;
}
+ (*slot)->language = gsymbol->language;
if (demangled_name != NULL)
- strcpy ((*slot)->demangled, demangled_name.get());
+ {
+ strcpy ((*slot)->demangled, demangled_name);
+ xfree (demangled_name);
+ }
else
(*slot)->demangled[0] = '\0';
}
+ else if (gsymbol->language == language_unknown
+ || gsymbol->language == language_auto)
+ gsymbol->language = (*slot)->language;
gsymbol->name = (*slot)->mangled;
if ((*slot)->demangled[0] != '\0')

View File

@ -0,0 +1,948 @@
- [gdb/testsuite] Add -early pattern flag for gdb_test_multiple
- [gdb/testsuite] Mark watchthreads-reorder.exp FAIL as KFAIL
- [gdb/testsuite] Allow some tests in gdb.base/restore.exp to be unsupported
- [gdb/testsuite] Allow some tests in gdb.base/store.exp to be unsupported
- [gdb/testsuite] Require gnatmake 8 for gdb.ada/rename_subscript_param.exp
- [gdb/tdep] Handle mxcsr kernel bug on Intel Skylake CPUs
- [gdb/testsuite] Add KFAIL for missing support of reverse-debugging of vmovd
- [gdb/testsuite] Fix incomplete regexps in step-precsave.exp
- [gdb/testsuite] Add KFAIL for missing support of reverse-debugging xsave
------------------------------------------------------------
[gdb/testsuite] Add -early pattern flag for gdb_test_multiple
[ https://sourceware.org/ml/gdb-patches/2019-09/msg00600.html ]
Proc gdb_test_multiple builds up and executes a gdb_expect expression with
pattern/action clauses. The clauses are either implicit (added by
gdb_test_multiple) or explicit (passed via the gdb_test_multiple parameter
user_code).
However, there are a few implicit clauses which are inserted before the
explicit ones, making sure those take precedence.
Add an -early pattern flag for a gdb_test_multiple user_code clause to specify
that the clause needs to be inserted before any implicit clause.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2019-09-12 Tom de Vries <tdevries@suse.de>
* lib/gdb.exp (gdb_test_multiple): Handle -early pattern flag.
------------------------------------------------------------
[gdb/testsuite] Mark watchthreads-reorder.exp FAIL as KFAIL
[ https://sourceware.org/ml/gdb-patches/2019-09/msg00221.html ]
When running gdb.threads/watchthreads-reorder.exp in parallel with:
...
$ n=$(grep -c processor /proc/cpuinfo); n=$((($n + 1) / 2)); stress -c $n
...
there's a reasonable change to trigger an internal gdb error:
...
$ for n in $(seq 1 10); do ./test.sh; done 2>&1 \
| grep "expected passes" \
| sort \
| uniq -c
1 # of expected passes 14
2 # of expected passes 15
1 # of expected passes 16
6 # of expected passes 17
...
which look like this in gdb.sum:
...
FAIL: gdb.threads/watchthreads-reorder.exp: reorder1: continue to breakpoint: \
break-at-exit (GDB internal error)
...
This FAIL is filed as PR gdb/24995 and fixed on master by commit c29705b71a
"Fix internal error and improve 'set debug infrun 1'/target wait kind trace".
Mark this as KFAIL for the 8.3 branch.
It's trivial to do this by adding a setup_kfail:
...
+ setup_kfail gdb/24995 "*-*-*"
gdb_continue_to_breakpoint "break-at-exit" ".*break-at-exit.*"
...
but we'll get a fair amount of KPASSES:
...
KPASS: gdb.threads/watchthreads-reorder.exp: reorder0: \
continue to breakpoint: break-at-exit (PRMS gdb/24995)
KPASS: gdb.threads/watchthreads-reorder.exp: reorder1: \
continue to breakpoint: break-at-exit (PRMS gdb/24995)
...
Instead, do this more precise by only KFAILing in case the internal error is
detected.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2019-09-12 Tom de Vries <tdevries@suse.de>
* gdb.threads/watchthreads-reorder.exp: Add PR gdb/24995 KFAIL.
------------------------------------------------------------
[gdb/testsuite] Allow some tests in gdb.base/restore.exp to be unsupported
[ Backport of master commit 77d036789aa. ]
We currently run into:
...
248 n = callee1 (n + l5);
(gdb) PASS: gdb.base/restore.exp: caller5 calls callee1; return callee now
print l1
$51 = <optimized out>
(gdb) FAIL: gdb.base/restore.exp: caller5 calls callee1; return restored l1 \
to 32492
...
The problem is that we try to access the value of l1 in function caller5, but
variable l1 has no DW_AT_location attribute. Since l1 is declared using the
register keyword, it's valid for gcc to emit no DW_AT_location at -O0.
Change the FAIL into an UNSUPPORTED.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2019-09-22 Tom de Vries <tdevries@suse.de>
* gdb.base/restore.exp: Allow register variables to be optimized out at
-O0.
------------------------------------------------------------
[gdb/testsuite] Allow some tests in gdb.base/store.exp to be unsupported
[ Backport of master commit 25e5c20918a. ]
The test-case gdb.base/store.exp fails with gcc 7.4.0:
...
nr of unexpected failures 27
...
The first FAIL:
...
110 l = add_float (l, r);
(gdb) PASS: gdb.base/store.exp: continue to wack_float
print l
$21 = <optimized out>
FAIL: gdb.base/store.exp: var float l; print old l, expecting -1
...
relates to this bit in the test-case (compiled at -O0):
...
106 float
107 wack_float (register float u, register float v)
108 {
109 register float l = u, r = v;
110 l = add_float (l, r);
111 return l + r;
112 }
...
and it expects to be able to read and modify variable l before executing line
110, but it already fails to read the value, because l has no DW_AT_location
attribute in the debug info.
Variable l is declared with the register keyword, and GCC implements the
register keyword at -O0 like so:
...
the compiler allocates distinct stack memory for all variables that do not
have the register storage-class specifier; if register is specified, the
variable may have a shorter lifespan than the code would indicate and may
never be placed in memory.
...
The fact that l has no DW_AT_location attribute, matches with the documented
"variable may have a shorter lifespan that code would indicate", (though it
is the most extreme case of it) so the gcc behaviour is valid. We can of
course improve gcc to generate better debuginfo (filed gcc PR91611), but
this not a wrong-debug problem.
[ The test-case passes with gcc 4.2.1, but for the failing test discussed
above, it passes simply because it doesn't store l in a register. ]
With the debug info missing for l, reading and setting l is unsupported, so
fix the FAIL by marking the test UNSUPPORTED instead.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2019-09-12 Tom de Vries <tdevries@suse.de>
* gdb.base/store.exp: Allow register variables to be optimized out at
-O0.
------------------------------------------------------------
[gdb/testsuite] Require gnatmake 8 for gdb.ada/rename_subscript_param.exp
[ Backport of master commit d1b70248bde. ]
When running gdb.ada/rename_subscript_param.exp with gnatmake 7.4.1, we get:
...
FAIL: gdb.ada/rename_subscript_param.exp: print rename_subscript_param_b \
before changing its value
FAIL: gdb.ada/rename_subscript_param.exp: print rename_subscript_param_b \
after changing its value
...
The commit last touching the test-case (afcfda091e) states:
...
The test still fails with old compilers that do not properly
generate debug info for this renaming:
...
Fix this by requiring at least gnatmake 8 for the test-case.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2019-09-14 Tom de Vries <tdevries@suse.de>
PR teststuite/24599
* gdb.ada/rename_subscript_param.exp: Require gnatmake 8.
* lib/ada.exp (gnatmake_version_at_least): New proc.
------------------------------------------------------------
[gdb/tdep] Handle mxcsr kernel bug on Intel Skylake CPUs
[ Backport of master commit 3d4352200e3. ]
On my openSUSE Leap 15.1 x86_64 Skylake system with the default (4.12) kernel,
I run into:
...
FAIL: gdb.base/gcore.exp: corefile restored all registers
...
The problem is that there's a difference in the mxcsr register value before
and after the gcore command:
...
- mxcsr 0x0 [ ]
+ mxcsr 0x400440 [ DAZ OM ]
...
This can be traced back to amd64_linux_nat_target::fetch_registers, where
xstateregs is partially initialized by the ptrace call:
...
char xstateregs[X86_XSTATE_MAX_SIZE];
struct iovec iov;
amd64_collect_xsave (regcache, -1, xstateregs, 0);
iov.iov_base = xstateregs;
iov.iov_len = sizeof (xstateregs);
if (ptrace (PTRACE_GETREGSET, tid,
(unsigned int) NT_X86_XSTATE, (long) &iov) < 0)
perror_with_name (_("Couldn't get extended state status"));
amd64_supply_xsave (regcache, -1, xstateregs);
...
after which amd64_supply_xsave is called.
The amd64_supply_xsave call is supposed to only use initialized parts of
xstateregs, but due to a kernel bug on intel skylake (fixed from 4.14 onwards
by commit 0852b374173b "x86/fpu: Add FPU state copying quirk to handle XRSTOR
failure on Intel Skylake CPUs") it can happen that the mxcsr part of
xstateregs is not initialized, while amd64_supply_xsave expects it to be
initialized, which explains the FAIL mentioned above.
Fix the undetermined behaviour by initializing xstateregs before calling
ptrace, which makes sure we get a 0x0 for mxcsr when this kernel bug occurs,
and which also happens to fix the FAIL.
Furthermore, add an xfail for this FAIL which triggers the same kernel bug:
...
FAIL: gdb.arch/amd64-init-x87-values.exp: check_setting_mxcsr_before_enable: \
check new value of MXCSR is still in place
...
Both FAILs pass when using a 5.3 kernel instead on the system mentioned above.
Tested on x86_64-linux.
gdb/ChangeLog:
2019-09-24 Tom de Vries <tdevries@suse.de>
PR gdb/23815
* amd64-linux-nat.c (amd64_linux_nat_target::fetch_registers):
Initialize xstateregs before ptrace PTRACE_GETREGSET call.
gdb/testsuite/ChangeLog:
2019-09-24 Tom de Vries <tdevries@suse.de>
PR gdb/24598
* gdb.arch/amd64-init-x87-values.exp: Add xfail.
------------------------------------------------------------
[gdb/testsuite] Add KFAIL for missing support of reverse-debugging of vmovd
[ Backport of master commit 68f7d34dd50. ]
On my openSUSE Leap 15.1 system I run into:
...
(gdb) PASS: gdb.reverse/step-precsave.exp: turn on process record
break 76^M
Breakpoint 2 at 0x400654: file step-reverse.c, line 76.^M
(gdb) PASS: gdb.reverse/step-precsave.exp: breakpoint at end of main
continue^M
Continuing.^M
Process record does not support instruction 0xc5 at address 0x7ffff783fc70.^M
Process record: failed to record execution log.^M
^M
Program stopped.^M
0x00007ffff783fc70 in __memset_avx2_unaligned_erms () from /lib64/libc.so.6^M
(gdb) FAIL: gdb.reverse/step-precsave.exp: run to end of main
...
The problem is that the vmovd instruction is not supported in
reverse-debugging (PR record/23188).
Add a KFAIL for this PR.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2019-09-27 Tom de Vries <tdevries@suse.de>
PR record/23188
* gdb.reverse/step-precsave.exp: Add kfail for PR record/23188.
------------------------------------------------------------
[gdb/testsuite] Fix incomplete regexps in step-precsave.exp
[ Backport of master commit 060b3ab4eda. ]
The commit 68f7d34dd50 "[gdb/testsuite] Add KFAIL for missing support of
reverse-debugging of vmovd" rewrites a gdb_test into a gdb_test_multiple but
forgets to add the $gdb_prompt part in the regexp.
Add the missing parts of the regexps.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2019-09-27 Tom de Vries <tdevries@suse.de>
* gdb.reverse/step-precsave.exp: Add missing $gdb_prompt in regexps.
------------------------------------------------------------
[gdb/testsuite] Add KFAIL for missing support of reverse-debugging xsave
[ https://sourceware.org/ml/gdb-patches/2019-09/msg00557.html ]
Normally the gdb.reverse/*.exp test-cases pass on my system (apart from the
record/23188 KFAIL for gdb.reverse/step-precsave.exp). But when specifying
GLIBC_TUNABLES=glibc.tune.hwcaps=-XSAVEC_Usable to force glibc to use
_dl_runtime_resolve_xsave instead of _dl_runtime_resolve_xsavec, we run into
1054 FAILs like this:
...
(gdb) PASS: gdb.reverse/sigall-reverse.exp: b gen_HUP
continue^M
Continuing.^M
Process record does not support instruction 0xfae64 at address \
0x7ffff7ded958.^M
Process record: failed to record execution log.^M
^M
Program stopped.^M
0x00007ffff7ded958 in _dl_runtime_resolve_xsave () from \
/lib64/ld-linux-x86-64.so.2^M
(gdb) FAIL: gdb.reverse/sigall-reverse.exp: get signal ABRT
...
The problem is that the xsave instruction is not supported in
reverse-debugging (PR record/25038).
Add KFAILs for this PR.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2019-09-27 Tom de Vries <tdevries@suse.de>
PR record/25038
* gdb.reverse/sigall-precsave.exp: Add PR record/25038 KFAIL.
* gdb.reverse/sigall-reverse.exp: Same.
* gdb.reverse/solib-precsave.exp: Same.
* gdb.reverse/solib-reverse.exp: Same.
* gdb.reverse/step-precsave.exp: Same.
* gdb.reverse/until-precsave.exp: Same.
* gdb.reverse/until-reverse.exp: Same.
* lib/gdb.exp (gdb_continue_to_breakpoint): Same.
------------------------------------------------------------
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 3d5f8726f7f..5f1bc4d84b7 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -798,37 +798,44 @@ proc gdb_test_multiple { command message user_code } {
set subst_code [uplevel list $subst_code]
set processed_code ""
+ set early_processed_code ""
+ set current_list processed_code
set patterns ""
set expecting_action 0
set expecting_arg 0
foreach item $user_code subst_item $subst_code {
if { $item == "-n" || $item == "-notransfer" || $item == "-nocase" } {
- lappend processed_code $item
+ lappend $current_list $item
continue
}
if { $item == "-indices" || $item == "-re" || $item == "-ex" } {
- lappend processed_code $item
+ lappend $current_list $item
+ continue
+ }
+ if { $item == "-early" } {
+ set current_list early_processed_code
continue
}
if { $item == "-timeout" || $item == "-i" } {
set expecting_arg 1
- lappend processed_code $item
+ lappend $current_list $item
continue
}
if { $expecting_arg } {
set expecting_arg 0
- lappend processed_code $subst_item
+ lappend $current_list $subst_item
continue
}
if { $expecting_action } {
- lappend processed_code "uplevel [list $item]"
+ lappend $current_list "uplevel [list $item]"
set expecting_action 0
# Cosmetic, no effect on the list.
- append processed_code "\n"
+ append $current_list "\n"
+ set current_list processed_code
continue
}
set expecting_action 1
- lappend processed_code $subst_item
+ lappend $current_list $subst_item
if {$patterns != ""} {
append patterns "; "
}
@@ -891,7 +898,8 @@ proc gdb_test_multiple { command message user_code } {
}
}
- set code {
+ set code $early_processed_code
+ append code {
-re ".*A problem internal to GDB has been detected" {
fail "$message (GDB internal error)"
gdb_internal_error_resync
diff --git a/gdb/testsuite/gdb.threads/watchthreads-reorder.exp b/gdb/testsuite/gdb.threads/watchthreads-reorder.exp
index 9bbbb6f2b8b..2e90870087d 100644
--- a/gdb/testsuite/gdb.threads/watchthreads-reorder.exp
+++ b/gdb/testsuite/gdb.threads/watchthreads-reorder.exp
@@ -90,5 +90,19 @@ foreach reorder {0 1} { with_test_prefix "reorder$reorder" {
# found in the DEBUG_INFRUN code path.
gdb_test "set debug infrun 1"
- gdb_continue_to_breakpoint "break-at-exit" ".*break-at-exit.*"
+ # Do:
+ # gdb_continue_to_breakpoint "break-at-exit" ".*break-at-exit.*"
+ # with setup_kfail.
+ set msg "continue to breakpoint: break-at-exit"
+ set pass_pattern "(?:Breakpoint|Temporary breakpoint) .* (at|in) .*break-at-exit.*"
+ set kfail_pattern "internal-error: inferior\\* find_inferior_pid\\(int\\): Assertion .pid != 0. failed\\."
+ gdb_test_multiple "continue" $msg {
+ -early -re "$kfail_pattern" {
+ setup_kfail gdb/24995 "*-*-*"
+ exp_continue
+ }
+ -re "\[\r\n\]*(?:$pass_pattern)\[\r\n\]+$gdb_prompt $" {
+ pass $msg
+ }
+ }
}}
diff --git a/gdb/testsuite/gdb.base/restore.exp b/gdb/testsuite/gdb.base/restore.exp
index 947fe58be47..56c2f5e3dce 100644
--- a/gdb/testsuite/gdb.base/restore.exp
+++ b/gdb/testsuite/gdb.base/restore.exp
@@ -73,8 +73,17 @@ proc restore_tests { } {
# they should be.
for {set var 1} {$var <= $c} {incr var} {
set expected [expr 0x7eeb + $var]
- gdb_test "print l$var" " = $expected" \
- "caller$c calls callee$e; return restored l$var to $expected"
+ set test "caller$c calls callee$e; return restored l$var to $expected"
+ set pass_pattern " = $expected"
+ set unsupported_pattern " = <optimized out>"
+ gdb_test_multiple "print l$var" $test {
+ -re "\[\r\n\]*(?:$pass_pattern)\[\r\n\]+$gdb_prompt $" {
+ pass $test
+ }
+ -re "\[\r\n\]*(?:$unsupported_pattern)\[\r\n\]+$gdb_prompt $" {
+ unsupported $test
+ }
+ }
}
}
}
diff --git a/gdb/testsuite/gdb.base/store.exp b/gdb/testsuite/gdb.base/store.exp
index c5a7584101a..9c19ce15a7b 100644
--- a/gdb/testsuite/gdb.base/store.exp
+++ b/gdb/testsuite/gdb.base/store.exp
@@ -55,18 +55,29 @@ proc check_set { t l r new add } {
}
}
- gdb_test "print l" " = ${l}" \
- "${prefix}; print old l, expecting ${l}"
- gdb_test "print r" " = ${r}" \
- "${prefix}; print old r, expecting ${r}"
- gdb_test_no_output "set variable l = 4" \
- "${prefix}; setting l to 4"
- gdb_test "print l" " = ${new}" \
- "${prefix}; print new l, expecting ${new}"
- gdb_test "next" "return l \\+ r;" \
- "${prefix}; next over add call"
- gdb_test "print l" " = ${add}" \
- "${prefix}; print incremented l, expecting ${add}"
+ set supported 1
+ set test "${prefix}; print old l, expecting ${l}"
+ gdb_test_multiple "print l" "$test" {
+ -re " = <optimized out>\r\n$gdb_prompt $" {
+ unsupported $test
+ set supported 0
+ }
+ -re " = ${l}\r\n$gdb_prompt $" {
+ pass $test
+ }
+ }
+ if { $supported } {
+ gdb_test "print r" " = ${r}" \
+ "${prefix}; print old r, expecting ${r}"
+ gdb_test_no_output "set variable l = 4" \
+ "${prefix}; setting l to 4"
+ gdb_test "print l" " = ${new}" \
+ "${prefix}; print new l, expecting ${new}"
+ gdb_test "next" "return l \\+ r;" \
+ "${prefix}; next over add call"
+ gdb_test "print l" " = ${add}" \
+ "${prefix}; print incremented l, expecting ${add}"
+ }
}
check_set "charest" "-1 .*" "-2 .*" "4 ..004." "2 ..002."
@@ -81,20 +92,34 @@ check_set "doublest" "-1" "-2" "4" "2"
#
proc up_set { t l r new } {
+ global gdb_prompt
+
set prefix "upvar ${t} l"
gdb_test "tbreak add_${t}"
gdb_test "continue" "return u . v;" \
"continue to add_${t}"
gdb_test "up" "l = add_${t} .l, r.;" \
"${prefix}; up"
- gdb_test "print l" " = ${l}" \
- "${prefix}; print old l, expecting ${l}"
- gdb_test "print r" " = ${r}" \
- "${prefix}; print old r, expecting ${r}"
- gdb_test_no_output "set variable l = 4" \
- "${prefix}; set l to 4"
- gdb_test "print l" " = ${new}" \
- "${prefix}; print new l, expecting ${new}"
+
+ set supported 1
+ set test "${prefix}; print old l, expecting ${l}"
+ gdb_test_multiple "print l" "$test" {
+ -re " = <optimized out>\r\n$gdb_prompt $" {
+ unsupported $test
+ set supported 0
+ }
+ -re " = ${l}\r\n$gdb_prompt $" {
+ pass $test
+ }
+ }
+ if { $supported } {
+ gdb_test "print r" " = ${r}" \
+ "${prefix}; print old r, expecting ${r}"
+ gdb_test_no_output "set variable l = 4" \
+ "${prefix}; set l to 4"
+ gdb_test "print l" " = ${new}" \
+ "${prefix}; print new l, expecting ${new}"
+ }
}
up_set "charest" "-1 .*" "-2 .*" "4 ..004."
diff --git a/gdb/testsuite/gdb.ada/rename_subscript_param.exp b/gdb/testsuite/gdb.ada/rename_subscript_param.exp
index ffcfa50df33..fd8208825a0 100644
--- a/gdb/testsuite/gdb.ada/rename_subscript_param.exp
+++ b/gdb/testsuite/gdb.ada/rename_subscript_param.exp
@@ -15,6 +15,10 @@
load_lib "ada.exp"
+if { ![gnatmake_version_at_least 8] } {
+ return -1
+}
+
standard_ada_testfile pb30_012
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug]] != "" } {
diff --git a/gdb/testsuite/lib/ada.exp b/gdb/testsuite/lib/ada.exp
index ee9ade16ae5..b10558811fb 100644
--- a/gdb/testsuite/lib/ada.exp
+++ b/gdb/testsuite/lib/ada.exp
@@ -78,3 +78,23 @@ proc standard_ada_testfile {base_file {dir ""}} {
set srcfile $srcdir/$subdir/$testdir/$testfile.adb
set binfile [standard_output_file $testfile]
}
+
+# Return 1 if gnatmake is at least version $MAJOR.x.x
+
+proc gnatmake_version_at_least { major } {
+ set gnatmake [gdb_find_gnatmake]
+ set gnatmake [lindex [split $gnatmake] 0]
+ set output [exec $gnatmake --version]
+ if { [regexp {GNATMAKE ([^ .]+).([^ .]+).([^ .]+)} $output \
+ match gnatmake_major gnatmake_minor gnatmake_micro] } {
+ if { $gnatmake_major >= $major } {
+ return 1
+ } else {
+ return 0
+ }
+ }
+
+ # Unknown, return 1
+ return 1
+}
+
diff --git a/gdb/amd64-linux-nat.c b/gdb/amd64-linux-nat.c
index 8d0e8eb35cd..b56917c2bc6 100644
--- a/gdb/amd64-linux-nat.c
+++ b/gdb/amd64-linux-nat.c
@@ -238,6 +238,12 @@ amd64_linux_nat_target::fetch_registers (struct regcache *regcache, int regnum)
char xstateregs[X86_XSTATE_MAX_SIZE];
struct iovec iov;
+ /* Pre-4.14 kernels have a bug (fixed by commit 0852b374173b
+ "x86/fpu: Add FPU state copying quirk to handle XRSTOR failure on
+ Intel Skylake CPUs") that sometimes causes the mxcsr location in
+ xstateregs not to be copied by PTRACE_GETREGSET. Make sure that
+ the location is at least initialized with a defined value. */
+ memset (xstateregs, 0, sizeof (xstateregs));
iov.iov_base = xstateregs;
iov.iov_len = sizeof (xstateregs);
if (ptrace (PTRACE_GETREGSET, tid,
diff --git a/gdb/testsuite/gdb.arch/amd64-init-x87-values.exp b/gdb/testsuite/gdb.arch/amd64-init-x87-values.exp
index cdf92dcd377..5fd18dbb794 100644
--- a/gdb/testsuite/gdb.arch/amd64-init-x87-values.exp
+++ b/gdb/testsuite/gdb.arch/amd64-init-x87-values.exp
@@ -116,7 +116,7 @@ proc_with_prefix check_x87_regs_around_init {} {
# nop that does not enable any FP features). Finally check that the
# mxcsr register still has the value we set.
proc_with_prefix check_setting_mxcsr_before_enable {} {
- global binfile
+ global binfile gdb_prompt
clean_restart ${binfile}
@@ -127,7 +127,22 @@ proc_with_prefix check_setting_mxcsr_before_enable {} {
gdb_test_no_output "set \$mxcsr=0x9f80" "set a new value for MXCSR"
gdb_test "stepi" "fwait" "step forward one instruction for mxcsr test"
- gdb_test "p/x \$mxcsr" " = 0x9f80" "check new value of MXCSR is still in place"
+
+ set test "check new value of MXCSR is still in place"
+ set pass_pattern " = 0x9f80"
+ # Pre-4.14 kernels have a bug (fixed by commit 0852b374173b "x86/fpu:
+ # Add FPU state copying quirk to handle XRSTOR failure on Intel Skylake
+ # CPUs") that causes mxcsr not to be copied, in which case we get 0 instead of
+ # the just saved value.
+ set xfail_pattern " = 0x0"
+ gdb_test_multiple "p/x \$mxcsr" $test {
+ -re "\[\r\n\]*(?:$pass_pattern)\[\r\n\]+$gdb_prompt $" {
+ pass $test
+ }
+ -re "\[\r\n\]*(?:$xfail_pattern)\[\r\n\]+$gdb_prompt $" {
+ xfail $test
+ }
+ }
}
# Start the test file, all FP features will be disabled. Set new
diff --git a/gdb/testsuite/gdb.reverse/step-precsave.exp b/gdb/testsuite/gdb.reverse/step-precsave.exp
index 7443995c007..f5e15510e1f 100644
--- a/gdb/testsuite/gdb.reverse/step-precsave.exp
+++ b/gdb/testsuite/gdb.reverse/step-precsave.exp
@@ -46,7 +46,15 @@ gdb_test "break $end_of_main" \
# This can take awhile.
with_timeout_factor 20 {
- gdb_test "continue" "Breakpoint .* end of main .*" "run to end of main"
+ set test "run to end of main"
+ gdb_test_multiple "continue" $test {
+ -re "Breakpoint .* end of main .*" {
+ pass $test
+ }
+ -re "Process record does not support instruction 0xc5 at.*$gdb_prompt $" {
+ kfail "record/23188" $test
+ }
+ }
}
# So can this, against gdbserver, for example.
diff --git a/gdb/testsuite/gdb.reverse/step-precsave.exp b/gdb/testsuite/gdb.reverse/step-precsave.exp
index f5e15510e1f..2073b8a1542 100644
--- a/gdb/testsuite/gdb.reverse/step-precsave.exp
+++ b/gdb/testsuite/gdb.reverse/step-precsave.exp
@@ -47,11 +47,13 @@ gdb_test "break $end_of_main" \
# This can take awhile.
with_timeout_factor 20 {
set test "run to end of main"
+ set pass_pattern "Breakpoint .* end of main .*"
+ set kfail_pattern "Process record does not support instruction 0xc5 at.*"
gdb_test_multiple "continue" $test {
- -re "Breakpoint .* end of main .*" {
+ -re "\[\r\n\]*(?:$pass_pattern)\[\r\n\]+$gdb_prompt $" {
pass $test
}
- -re "Process record does not support instruction 0xc5 at.*$gdb_prompt $" {
+ -re "\[\r\n\]*(?:$kfail_pattern)\[\r\n\]+$gdb_prompt $" {
kfail "record/23188" $test
}
}
diff --git a/gdb/testsuite/gdb.reverse/sigall-precsave.exp b/gdb/testsuite/gdb.reverse/sigall-precsave.exp
index 79a1e7282b6..ccdfde407fc 100644
--- a/gdb/testsuite/gdb.reverse/sigall-precsave.exp
+++ b/gdb/testsuite/gdb.reverse/sigall-precsave.exp
@@ -258,14 +258,20 @@ foreach sig $signals {
}
}
-gdb_test_multiple "continue" "continue" {
+set kfail_pattern "Process record does not support instruction 0xfae64 at.*"
+set test "run to end of main"
+gdb_test_multiple "continue" $test {
-re "Breakpoint .* end of main .*$gdb_prompt $" {
- pass "run to end of main"
+ pass $test
}
-re "Breakpoint .* handle_.*$gdb_prompt $" {
send_gdb "continue\n"
exp_continue
}
+ -re "\[\r\n\]*(?:$kfail_pattern)\[\r\n\]+$gdb_prompt $" {
+ kfail "gdb/25038" $test
+ return -1
+ }
}
delete_breakpoints
@@ -289,8 +295,12 @@ set sig_supported 1
set thissig "ABRT"
# test signal handling
+set record_instruction_kfail 0
foreach sig [lrange $signals 1 end] {
test_one_sig $sig
+ if { $record_instruction_kfail } {
+ return -1
+ }
}
# The last signal (SIGTERM) gets handled slightly differently because
diff --git a/gdb/testsuite/gdb.reverse/sigall-reverse.exp b/gdb/testsuite/gdb.reverse/sigall-reverse.exp
index c734fe8e17a..884a00c5dcf 100644
--- a/gdb/testsuite/gdb.reverse/sigall-reverse.exp
+++ b/gdb/testsuite/gdb.reverse/sigall-reverse.exp
@@ -37,6 +37,7 @@ proc test_one_sig {nextsig} {
global sig_supported
global gdb_prompt
global thissig
+ global record_instruction_kfail
set this_sig_supported $sig_supported
gdb_test "handle SIG$thissig stop print" \
@@ -51,6 +52,7 @@ proc test_one_sig {nextsig} {
setup_xfail "i*86-pc-linuxoldld-gnu" "i*86-pc-linuxaout-gnu"
}
set testmsg "get signal $thissig"
+ set kfail_pattern "Process record does not support instruction 0xfae64 at.*"
gdb_test_multiple "continue" $testmsg {
-re "Program received signal SIG$thissig.*handle_$thissig.*$gdb_prompt $" {
fail "$testmsg (wrong location)"
@@ -62,6 +64,11 @@ proc test_one_sig {nextsig} {
xfail $testmsg
set need_another_continue 0
}
+ -re "\[\r\n\]*(?:$kfail_pattern)\[\r\n\]+$gdb_prompt $" {
+ kfail "gdb/25038" "$testmsg"
+ set record_instruction_kfail 1
+ return
+ }
}
}
@@ -237,8 +244,12 @@ set sig_supported 1
set thissig "ABRT"
# test signal handling
+set record_instruction_kfail 0
foreach sig [lrange $signals 1 end] {
test_one_sig $sig
+ if { $record_instruction_kfail } {
+ return -1
+ }
}
# The last signal (SIGTERM) gets handled slightly differently because
diff --git a/gdb/testsuite/gdb.reverse/solib-precsave.exp b/gdb/testsuite/gdb.reverse/solib-precsave.exp
index 574d79816db..a3f874c09b7 100644
--- a/gdb/testsuite/gdb.reverse/solib-precsave.exp
+++ b/gdb/testsuite/gdb.reverse/solib-precsave.exp
@@ -91,7 +91,18 @@ gdb_test "break $end_of_main" \
"Breakpoint $decimal at .*$srcfile, line $end_of_main\." \
"breakpoint at end of main"
-gdb_test "continue" "Breakpoint .* end of main .*" "run to end of main"
+set test "run to end of main"
+set pass_pattern "Breakpoint .* end of main .*"
+set kfail_pattern "Process record does not support instruction 0xfae64 at.*"
+gdb_test_multiple "continue" $test {
+ -re "\[\r\n\]*(?:$pass_pattern)\[\r\n\]+$gdb_prompt $" {
+ pass $test
+ }
+ -re "\[\r\n\]*(?:$kfail_pattern)\[\r\n\]+$gdb_prompt $" {
+ kfail "gdb/25038" $test
+ return -1
+ }
+}
gdb_test "record save $precsave" \
"Saved core file $precsave with execution log\." \
diff --git a/gdb/testsuite/gdb.reverse/solib-reverse.exp b/gdb/testsuite/gdb.reverse/solib-reverse.exp
index 77c321388b4..53b35239f81 100644
--- a/gdb/testsuite/gdb.reverse/solib-reverse.exp
+++ b/gdb/testsuite/gdb.reverse/solib-reverse.exp
@@ -86,7 +86,18 @@ if [supports_process_record] {
set end_part_one [gdb_get_line_number " end part one" "$srcfile"]
set end_part_two [gdb_get_line_number " end part two" "$srcfile"]
-gdb_test "until $end_part_one" " end part one.*" "run until end part one"
+set test "run until end part one"
+set pass_pattern " end part one.*"
+set kfail_pattern "Process record does not support instruction 0xfae64 at.*"
+gdb_test_multiple "until $end_part_one" $test {
+ -re "\[\r\n\]*(?:$pass_pattern)\[\r\n\]+$gdb_prompt $" {
+ pass $test
+ }
+ -re "\[\r\n\]*(?:$kfail_pattern)\[\r\n\]+$gdb_prompt $" {
+ kfail "gdb/25038" $test
+ return -1
+ }
+}
gdb_test "reverse-step" " shr1 three .*" "reverse-step third shr1"
gdb_test "reverse-step" " shr1 two .*" "reverse-step second shr1"
diff --git a/gdb/testsuite/gdb.reverse/step-precsave.exp b/gdb/testsuite/gdb.reverse/step-precsave.exp
index 2073b8a1542..72ee279f806 100644
--- a/gdb/testsuite/gdb.reverse/step-precsave.exp
+++ b/gdb/testsuite/gdb.reverse/step-precsave.exp
@@ -49,6 +49,7 @@ with_timeout_factor 20 {
set test "run to end of main"
set pass_pattern "Breakpoint .* end of main .*"
set kfail_pattern "Process record does not support instruction 0xc5 at.*"
+ set kfail2_pattern "Process record does not support instruction 0xfae64 at.*"
gdb_test_multiple "continue" $test {
-re "\[\r\n\]*(?:$pass_pattern)\[\r\n\]+$gdb_prompt $" {
pass $test
@@ -56,6 +57,9 @@ with_timeout_factor 20 {
-re "\[\r\n\]*(?:$kfail_pattern)\[\r\n\]+$gdb_prompt $" {
kfail "record/23188" $test
}
+ -re "\[\r\n\]*(?:$kfail2_pattern)\[\r\n\]+$gdb_prompt $" {
+ kfail "record/25038" $test
+ }
}
}
diff --git a/gdb/testsuite/gdb.reverse/until-precsave.exp b/gdb/testsuite/gdb.reverse/until-precsave.exp
index baf21ab7ad2..1f09df193fd 100644
--- a/gdb/testsuite/gdb.reverse/until-precsave.exp
+++ b/gdb/testsuite/gdb.reverse/until-precsave.exp
@@ -50,7 +50,18 @@ gdb_test "break $end_of_main" \
# This can take awhile.
with_timeout_factor 20 {
- gdb_test "continue" "Breakpoint .* set breakpoint 10a here .*" "run to end of main"
+ set test "run to end of main"
+ set pass_pattern "Breakpoint .* set breakpoint 10a here .*"
+ set kfail_pattern "Process record does not support instruction 0xfae64 at.*"
+ gdb_test_multiple "continue" $test {
+ -re "\[\r\n\]*(?:$pass_pattern)\[\r\n\]+$gdb_prompt $" {
+ pass $test
+ }
+ -re "\[\r\n\]*(?:$kfail_pattern)\[\r\n\]+$gdb_prompt $" {
+ kfail "gdb/25038" $test
+ return -1
+ }
+ }
}
# So can this, against gdbserver, for example.
diff --git a/gdb/testsuite/gdb.reverse/until-reverse.exp b/gdb/testsuite/gdb.reverse/until-reverse.exp
index 2e26de3ce7b..804e07f46ca 100644
--- a/gdb/testsuite/gdb.reverse/until-reverse.exp
+++ b/gdb/testsuite/gdb.reverse/until-reverse.exp
@@ -49,9 +49,18 @@ gdb_test "until $bp_location1" \
# Advance up to factorial, outer invocation
#
-gdb_test "advance factorial" \
- "factorial .value=6..*$srcfile:$bp_location7.*" \
- "advance to factorial"
+set test "advance to factorial"
+set pass_pattern "factorial .value=6..*$srcfile:$bp_location7.*"
+set kfail_pattern "Process record does not support instruction 0xfae64 at.*"
+gdb_test_multiple "advance factorial" $test {
+ -re "\[\r\n\]*(?:$pass_pattern)\[\r\n\]+$gdb_prompt $" {
+ pass "$test"
+ }
+ -re "\[\r\n\]*(?:$kfail_pattern)\[\r\n\]+$gdb_prompt $" {
+ kfail "gdb/25038" $test
+ return -1
+ }
+}
# At this point, 'until' should continue the inferior up to when all the
# inner invocations of factorial() are completed and we are back at this
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 5f1bc4d84b7..0d5447dd10c 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -633,10 +633,14 @@ proc gdb_continue_to_breakpoint {name {location_pattern .*}} {
global gdb_prompt
set full_name "continue to breakpoint: $name"
+ set kfail_pattern "Process record does not support instruction 0xfae64 at.*"
gdb_test_multiple "continue" $full_name {
-re "(?:Breakpoint|Temporary breakpoint) .* (at|in) $location_pattern\r\n$gdb_prompt $" {
pass $full_name
}
+ -re "\[\r\n\]*(?:$kfail_pattern)\[\r\n\]+$gdb_prompt $" {
+ kfail "gdb/25038" $full_name
+ }
}
}

View File

@ -1,4 +1,3 @@
- Testsuite: Ensure pie is disabled on some tests
- Testsuite: Remove pie from trace tests
- [gdb/testsuite] Fail in gdb_compile if nopie results in PIE executable
- [gdb/testsuite] Fail in gdb_compile if pie results in non-PIE executable
@ -107,130 +106,6 @@ gdb/testsuite/ChangeLog:
---------------------------------------------------------
Testsuite: Ensure pie is disabled on some tests
Recent versions of Ubuntu and Debian default GCC to enable pie.
In dump.exp, pie will causes addresses to be out of range for IHEX.
In break-interp.exp, pie is explicitly set for some tests and assumed
to be disabled for the remainder.
Ensure pie is disabled for these tests when required.
In addition, add a pie option to gdb_compile to match the nopie option
and simplify use.
gdb/testsuite/ChangeLog:
* README: Add pie options.
* gdb.base/break-interp.exp: Ensure pie is disabled.
* gdb.base/dump.exp: Likewise.
* lib/gdb.exp (gdb_compile): Add pie option.
---------------------------------------------------------
diff --git a/gdb/testsuite/README b/gdb/testsuite/README
index b5e75b9a79..db90ea4698 100644
--- a/gdb/testsuite/README
+++ b/gdb/testsuite/README
@@ -482,6 +482,16 @@ gdb,no_thread_names
The target doesn't support thread names.
+gdb,pie_flag
+
+ The flag required to force the compiler to produce position-independent
+ executables.
+
+gdb,pie_ldflag
+
+ The flag required to force the linker to produce position-independent
+ executables.
+
gdb,nopie_flag
The flag required to force the compiler to produce non-position-independent
diff --git a/gdb/testsuite/gdb.base/break-interp.exp b/gdb/testsuite/gdb.base/break-interp.exp
index f85e8a650a..51e31f6503 100644
--- a/gdb/testsuite/gdb.base/break-interp.exp
+++ b/gdb/testsuite/gdb.base/break-interp.exp
@@ -625,8 +625,10 @@ foreach ldprelink {NO YES} {
lappend opts {debug}
}
if {$binpie != "NO"} {
- lappend opts {additional_flags=-fPIE}
- lappend opts {ldflags=-pie}
+ lappend opts {pie}
+ } else {
+ # Debian9/Ubuntu16.10 onwards default to PIE enabled. Ensure it is disabled.
+ lappend opts {nopie}
}
set dir ${exec}.d
diff --git a/gdb/testsuite/gdb.base/dump.exp b/gdb/testsuite/gdb.base/dump.exp
index 44b0988b80..52ba5f8ebe 100644
--- a/gdb/testsuite/gdb.base/dump.exp
+++ b/gdb/testsuite/gdb.base/dump.exp
@@ -36,6 +36,10 @@ if {[istarget "spu*-*-*"]} then {
set is64bitonly "yes"
}
+# Debian9/Ubuntu16.10 onwards default to PIE enabled. Ensure it is disabled as
+# this causes addresses to be out of range for IHEX.
+lappend options {nopie}
+
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable ${options}] != "" } {
untested "failed to compile"
return -1
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 36f167336c..3d5f8726f7 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -3492,6 +3492,7 @@ set gdb_saved_set_unbuffered_mode_obj ""
# dynamically load libraries at runtime. For example, on Linux, this adds
# -ldl so that the test can use dlopen.
# - nowarnings: Inhibit all compiler warnings.
+# - pie: Force creation of PIE executables.
# - nopie: Prevent creation of PIE executables.
#
# And here are some of the not too obscure options understood by DejaGnu that
@@ -3630,8 +3631,33 @@ proc gdb_compile {source dest type options} {
set options [lreplace $options $nowarnings $nowarnings $flag]
}
- # Replace the "nopie" option with the appropriate additional_flags
- # to disable PIE executables.
+ # Replace the "pie" option with the appropriate compiler and linker flags
+ # to enable PIE executables.
+ set pie [lsearch -exact $options pie]
+ if {$pie != -1} {
+ if [target_info exists gdb,pie_flag] {
+ set flag "additional_flags=[target_info gdb,pie_flag]"
+ } else {
+ # For safety, use fPIE rather than fpie. On AArch64, m68k, PowerPC
+ # and SPARC, fpie can cause compile errors due to the GOT exceeding
+ # a maximum size. On other architectures the two flags are
+ # identical (see the GCC manual). Note Debian9 and Ubuntu16.10
+ # onwards default GCC to using fPIE. If you do require fpie, then
+ # it can be set using the pie_flag.
+ set flag "additional_flags=-fPIE"
+ }
+ set options [lreplace $options $pie $pie $flag]
+
+ if [target_info exists gdb,pie_ldflag] {
+ set flag "ldflags=[target_info gdb,pie_ldflag]"
+ } else {
+ set flag "ldflags=-pie"
+ }
+ lappend options "$flag"
+ }
+
+ # Replace the "nopie" option with the appropriate linker flag to disable
+ # PIE executables. There are no compiler flags for this option.
set nopie [lsearch -exact $options nopie]
if {$nopie != -1} {
if [target_info exists gdb,nopie_flag] {
diff --git a/gdb/testsuite/gdb.trace/backtrace.exp b/gdb/testsuite/gdb.trace/backtrace.exp
index 0f60153cb5..24e097135f 100644
--- a/gdb/testsuite/gdb.trace/backtrace.exp

View File

@ -1,212 +0,0 @@
commit 3f52fdbcb599f76b4838020721ca6c9f1cc28f84
Author: Kevin Buettner <kevinb@redhat.com>
Date: Sat Mar 16 12:40:01 2019 -0700
Fix amd64->i386 linux syscall restart problem
This commit fixes some failures in gdb.base/interrupt.exp
when debugging a 32-bit i386 linux inferior from an amd64 host.
When running the following test...
make check RUNTESTFLAGS="--target_board unix/-m32 interrupt.exp"
... without this commit, I see the following output:
FAIL: gdb.base/interrupt.exp: continue (the program exited)
FAIL: gdb.base/interrupt.exp: echo data
FAIL: gdb.base/interrupt.exp: Send Control-C, second time
FAIL: gdb.base/interrupt.exp: signal SIGINT (the program is no longer running)
ERROR: Undefined command "".
ERROR: GDB process no longer exists
=== gdb Summary ===
When the test is run with this commit in place, we see 12 passes
instead. This is the desired behavior.
Analysis:
On Linux, when a syscall is interrupted by a signal, the syscall
may return -ERESTARTSYS when a signal occurs. Doing so indicates that
the syscall is restartable. Then, depending on settings associated
with the signal handler, and after the signal handler is called, the
kernel can then either return -EINTR or can cause the syscall to be
restarted. In this discussion, we are concerned with the latter
case.
On i386, the kernel returns this status via the EAX register.
When debugging a 32-bit (i386) process from a 64-bit (amd64)
GDB, the debugger fetches 64-bit registers even though the
process being debugged is 32-bit. Since we're debugging a 32-bit
target, only 32 bits are being saved in the register cache.
Now, ideally, GDB would save all 64-bits in the regcache and
then would be able to restore those same values when it comes
time to continue the target. I've looked into doing this, but
it's not easy and I don't see many benefits to doing so. One
benefit, however, would be that EAX would appear as a negative
value for doing syscall restarts.
At the moment, GDB is setting the high 32 bits of RAX (and other
registers too) to 0. So, when GDB restores EAX just prior to
a syscall restart, the high 32 bits of RAX are zeroed, thus making
it look like a positive value. For this particular purpose, we
need to sign extend EAX so that RAX will appear as a negative
value when EAX is set to -ERESTARTSYS. This in turn will cause
the signal handling code in the kernel to recognize -ERESTARTSYS
which will in turn cause the syscall to be restarted.
This commit is based on work by Jan Kratochvil from 2009:
https://sourceware.org/ml/gdb-patches/2009-11/msg00592.html
Jan's patch had the sign extension code in amd64-nat.c. Several
other native targets make use of this code, so it seemed better
to move the sign extension code to a linux specific file. I
also added similar code to gdbserver.
Another approach is to fix the problem in the kernel. Hui Zhu
tried to get a fix into the kernel back in 2014, but it was not
accepted. Discussion regarding this approach may be found here:
https://lore.kernel.org/patchwork/patch/457841/
Even if a fix were to be put into the kernel, we'd still need
some kind of fix in GDB in order to support older kernels.
Finally, I'll note that Fedora has been carrying a similar patch for
at least nine years. Other distributions, including RHEL and CentOS
have picked up this change and have been using it too.
gdb/ChangeLog:
* amd64-linux-nat.c (amd64_linux_collect_native_gregset): New
function.
(fill_gregset): Call amd64_linux_collect_native_gregset instead
of amd64_collect_native_gregset.
(amd64_linux_nat_target::store_registers): Likewise.
gdb/gdbserver/ChangeLog:
* linux-x86-low.c (x86_fill_gregset): Sign extend EAX value
when using a 64-bit gdbserver.
diff --git a/gdb/amd64-linux-nat.c b/gdb/amd64-linux-nat.c
index a0bb105f5a..8d0e8eb35c 100644
--- a/gdb/amd64-linux-nat.c
+++ b/gdb/amd64-linux-nat.c
@@ -92,6 +92,71 @@ static int amd64_linux_gregset32_reg_offset[] =
/* Transfering the general-purpose registers between GDB, inferiors
and core files. */
+/* See amd64_collect_native_gregset. This linux specific version handles
+ issues with negative EAX values not being restored correctly upon syscall
+ return when debugging 32-bit targets. It has no effect on 64-bit
+ targets. */
+
+static void
+amd64_linux_collect_native_gregset (const struct regcache *regcache,
+ void *gregs, int regnum)
+{
+ amd64_collect_native_gregset (regcache, gregs, regnum);
+
+ struct gdbarch *gdbarch = regcache->arch ();
+ if (gdbarch_bfd_arch_info (gdbarch)->bits_per_word == 32)
+ {
+ /* Sign extend EAX value to avoid potential syscall restart
+ problems.
+
+ On Linux, when a syscall is interrupted by a signal, the
+ (kernel function implementing the) syscall may return
+ -ERESTARTSYS when a signal occurs. Doing so indicates that
+ the syscall is restartable. Then, depending on settings
+ associated with the signal handler, and after the signal
+ handler is called, the kernel can then either return -EINTR
+ or it can cause the syscall to be restarted. We are
+ concerned with the latter case here.
+
+ On (32-bit) i386, the status (-ERESTARTSYS) is placed in the
+ EAX register. When debugging a 32-bit process from a 64-bit
+ (amd64) GDB, the debugger fetches 64-bit registers even
+ though the process being debugged is only 32-bit. The
+ register cache is only 32 bits wide though; GDB discards the
+ high 32 bits when placing 64-bit values in the 32-bit
+ regcache. Normally, this is not a problem since the 32-bit
+ process should only care about the lower 32-bit portions of
+ these registers. That said, it can happen that the 64-bit
+ value being restored will be different from the 64-bit value
+ that was originally retrieved from the kernel. The one place
+ (that we know of) where it does matter is in the kernel's
+ syscall restart code. The kernel's code for restarting a
+ syscall after a signal expects to see a negative value
+ (specifically -ERESTARTSYS) in the 64-bit RAX register in
+ order to correctly cause a syscall to be restarted.
+
+ The call to amd64_collect_native_gregset, above, is setting
+ the high 32 bits of RAX (and other registers too) to 0. For
+ syscall restart, we need to sign extend EAX so that RAX will
+ appear as a negative value when EAX is set to -ERESTARTSYS.
+ This in turn will cause the signal handling code in the
+ kernel to recognize -ERESTARTSYS which will in turn cause the
+ syscall to be restarted.
+
+ The test case gdb.base/interrupt.exp tests for this problem.
+ Without this sign extension code in place, it'll show
+ a number of failures when testing against unix/-m32. */
+
+ if (regnum == -1 || regnum == I386_EAX_REGNUM)
+ {
+ void *ptr = ((gdb_byte *) gregs
+ + amd64_linux_gregset32_reg_offset[I386_EAX_REGNUM]);
+
+ *(int64_t *) ptr = *(int32_t *) ptr;
+ }
+ }
+}
+
/* Fill GDB's register cache with the general-purpose register values
in *GREGSETP. */
@@ -109,7 +174,7 @@ void
fill_gregset (const struct regcache *regcache,
elf_gregset_t *gregsetp, int regnum)
{
- amd64_collect_native_gregset (regcache, gregsetp, regnum);
+ amd64_linux_collect_native_gregset (regcache, gregsetp, regnum);
}
/* Transfering floating-point registers between GDB, inferiors and cores. */
@@ -237,7 +302,7 @@ amd64_linux_nat_target::store_registers (struct regcache *regcache, int regnum)
if (ptrace (PTRACE_GETREGS, tid, 0, (long) &regs) < 0)
perror_with_name (_("Couldn't get registers"));
- amd64_collect_native_gregset (regcache, &regs, regnum);
+ amd64_linux_collect_native_gregset (regcache, &regs, regnum);
if (ptrace (PTRACE_SETREGS, tid, 0, (long) &regs) < 0)
perror_with_name (_("Couldn't write registers"));
diff --git a/gdb/gdbserver/linux-x86-low.c b/gdb/gdbserver/linux-x86-low.c
index 029796e361..dd7673126e 100644
--- a/gdb/gdbserver/linux-x86-low.c
+++ b/gdb/gdbserver/linux-x86-low.c
@@ -338,6 +338,19 @@ x86_fill_gregset (struct regcache *regcache, void *buf)
collect_register_by_name (regcache, "orig_eax",
((char *) buf) + ORIG_EAX * REGSIZE);
+
+ /* Sign extend EAX value to avoid potential syscall restart
+ problems.
+
+ See amd64_linux_collect_native_gregset() in gdb/amd64-linux-nat.c
+ for a detailed explanation. */
+ if (register_size (regcache->tdesc, 0) == 4)
+ {
+ void *ptr = ((gdb_byte *) buf
+ + i386_regmap[find_regno (regcache->tdesc, "eax")]);
+
+ *(int64_t *) ptr = *(int32_t *) ptr;
+ }
}
static void

View File

@ -1,3 +1,30 @@
-------------------------------------------------------------------
Mon Sep 30 10:34:54 UTC 2019 - Tom de Vries <tdevries@suse.com>
- Add gdb-testsuite-8.3-kfail-xfail-unsupported.patch
-------------------------------------------------------------------
Thu Sep 26 16:51:17 UTC 2019 - Tom de Vries <tdevries@suse.com>
- Drop ChangeLog part of patch:
* gdb-rhbz1708192-parse_macro_definition-crash.patch
* gdb-rhbz1704406-disable-style-log-output-1of3.patch
* gdb-rhbz1704406-disable-style-log-output-2of3.patch
* gdb-rhbz1704406-disable-style-log-output-3of3.patch
* gdb-rhbz1723564-gdb-crash-PYTHONMALLOC-debug.patch
* gdb-rhbz1553086-binutils-warning-loadable-section-outside-elf.patch
- Update to gdb-8.3.1.
* Drop "Testsuite: Ensure pie is disabled on some tests" part of
gdb-testsuite-pie-no-pie.patch
* Drop:
- gdb-7.10-swo18929.patch
- gdb-handle-vfork-in-thread-with-follow-fork-mode-child.patch
- gdb-x86_64-i386-syscall-restart-master.patch
- gdb-suppress-sigttou-when-handling-errors.patch
- gdb-fix-breakpoints-on-file-reloads-for-pie-binaries.patch
- gdb-symtab-fix-symbol-loading-performance-regression.patch
- Fix macro in comment warning
-------------------------------------------------------------------
Wed Sep 25 14:41:32 UTC 2019 - Tom de Vries <tdevries@suse.com>

View File

@ -28,7 +28,7 @@ License: GPL-3.0-or-later AND GPL-3.0-with-GCC-exception AND LGPL-2.1-or-
Group: Development/Tools/Debuggers
Name: gdb
Version: 8.3
Version: 8.3.1
Release: 0
# The release always contains a leading reserved number, start it at 1.
@ -232,30 +232,21 @@ Patch1003: gdb-testsuite-ada-pie.patch
# Patches to upstream
# Fixed upstream Wed, 29 May 2019, 4330d61dfb "Fix crash in
# cp_print_value_fields". We should be able to drop this in 8.4.
Patch1005: gdb-7.10-swo18929.patch
# Fixed upstream Sat, Jun 22 2019, 47e3f47487 "[gdb] Fix s390x -m31 build".
# We should be able to drop this in 8.4.
Patch1007: gdb-fix-s390-build.diff
# Backports from master
Patch2000: gdb-handle-vfork-in-thread-with-follow-fork-mode-child.patch
Patch2001: gdb-fix-riscv-tdep.patch
Patch2002: gdb-x86_64-i386-syscall-restart-master.patch
Patch2003: gdb-suppress-sigttou-when-handling-errors.patch
Patch2004: gdb-testsuite-add-missing-initial-prompt-read-in-multidictionary.exp.patch
Patch2005: gdb-testsuite-pie-no-pie.patch
Patch2006: gdb-fix-breakpoints-on-file-reloads-for-pie-binaries.patch
Patch2007: gdb-testsuite-read1-fixes.patch
Patch2008: gdb-testsuite-i386-pkru-exp.patch
# Submitted for master
Patch2500: gdb-fix-heap-use-after-free-in-typename-concat.patch
Patch2501: gdb-symtab-fix-symbol-loading-performance-regression.patch
# Testsuite patches
Patch2600: gdb-testsuite-8.3-kfail-xfail-unsupported.patch
# libipt support
Patch3000: v1.5-libipt-static.patch
@ -587,21 +578,17 @@ find -name "*.info*"|xargs rm -f
%patch1002 -p1
%patch1003 -p1
%patch1005 -p1
%patch1007 -p1
%patch2000 -p1
%patch2001 -p1
%patch2002 -p1
%patch2003 -p1
%patch2004 -p1
%patch2005 -p1
%patch2006 -p1
%patch2007 -p1
%patch2008 -p1
%patch2500 -p1
%patch2501 -p1
%patch2600 -p1
#unpack libipt
%if 0%{have_libipt}
@ -832,7 +819,7 @@ then
fi
# This is a build-time test, but still a test. So, skip if we don't do tests.
# This is relevant for %qemu_user_space_build == 1 builds, which atm is
# This is relevant for %%qemu_user_space_build == 1 builds, which atm is
# the case for riscv64.
%if %{with testsuite}
if [ "$LIBRPM" != "no" ]; then