Accepting request 822281 from home:tomdevries:branches:gdb-upgrade

- Fix SLE-11 build.  Gdb 9.1 requires make 3.82, but SLE-11 has
  make 3.81:
  * gdbserver-fix-build-with-make-3.81.patch
- Fix patch context:
  * gdb-fix-the-thread-pool.c-compilation.patch
- Fix build error due to missing DIAGNOSTIC_IGNORE_UNUSED_FUNCTION.
  * gdb-fix-the-thread-pool.c-compilation.patch
- Drop ChangeLog part of patch:
  * gdb-fix-unused-function-error.patch
- Fix Werror=unused-function with gcc 4.8 (for Leap 42.3).
  * gdb-fix-unused-function-error.patch
- Require %{suse_version} >= 1500 for --with-system-readline.
- Rebase to 9.1 release (as in fedora 32 @ 1735910).
  * Breakpoints on nested functions and subroutines in Fortran.
  * Multithreaded symbol loading, disabled by default.  Enable
    using 'maint set worker-threads unlimited'.
  * Multi-target debugging support.
  * New command pipe.
  * New command set logging debugredirect [on|off].
  * New fortran commands info modules, info module functions,
    info module variables.
- Fedora-specific patches dropped:
  * gdb-libexec-add-index.patch
  * gdb-6.3-rh-testversion-20041202.patch
  * gdb-6.6-buildid-locate-misleading-warning-missing-debuginfo-rhbz981154.patch
- Obsoleted fedora patches dropped:
  * gdb-6.5-bz216711-clone-is-outermost.patch
  * gdb-6.6-scheduler_locking-step-is-default.patch
  * gdb-6.8-bz436037-reg-no-longer-active.patch
  * gdb-bz541866-rwatch-before-run.patch
  * gdb-bz568248-oom-is-error.patch
  * gdb-follow-child-stale-parent.patch
  * gdb-readline62-ask-more-rh.patch
  * gdb-rhbz1371380-gcore-elf-headers.patch
  * gdb-rhbz1553086-binutils-warning-loadable-section-outside-elf.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-rhbz1708192-parse_macro_definition-crash.patch
  * gdb-rhbz1723564-gdb-crash-PYTHONMALLOC-debug.patch
  * gdb-rhbz795424-bitpos-20of25.patch
  * gdb-rhbz795424-bitpos-21of25.patch
  * gdb-rhbz795424-bitpos-22of25.patch
  * gdb-rhbz795424-bitpos-23of25.patch
  * gdb-rhbz795424-bitpos-25of25-test.patch
  * gdb-rhbz795424-bitpos-25of25.patch
  * gdb-rhbz795424-bitpos-arrayview.patch
  * gdb-rhbz795424-bitpos-lazyvalue.patch
  * gdb-testsuite-readline63-sigint.patch
- Fedora patches added:
  * gdb-rhbz1818011-bfd-gcc10-error.patch
- Obsoleted patched dropped:
  * gdb-fix-s390-build.diff
  * gdb-fix-riscv-tdep.patch
  * gdb-testsuite-add-missing-initial-prompt-read-in-multidictionary.exp.patch
  * gdb-testsuite-pie-no-pie.patch
  * gdb-testsuite-read1-fixes.patch
  * gdb-testsuite-i386-pkru-exp.patch
  * gdb-s390-handle-arch13.diff
  * gdb-fix-heap-use-after-free-in-typename-concat.patch
  * gdb-dwarf-reader-reject-sections-with-invalid-sizes.patch
  * gdb-0001-remove-alloca-0-calls.patch
  * gdb-arch13-1.diff
  * gdb-arch13-2.diff
  * gdb-arch13-3.diff
  * bfd-change-num_group-to-unsigned-int.patch
  * gdb-fix-incorrect-use-of-is-operator-for-comparison-in-python-lib-gdb-command-prompt.py.patch
  * gdb-symtab-prefer-var-def-over-decl.patch
  * gdb-only-force-interp_console-ui_out-for-breakpoint-commands-in-mi-mode.patch
  * gdb-testsuite-8.3-kfail-xfail-unsupported.patch
- Backport from master:
  * gdb-fix-debug-agent-odr-bool-int.patch
  * gdb-fix-python3.9-related-runtime-problems.patch

OBS-URL: https://build.opensuse.org/request/show/822281
OBS-URL: https://build.opensuse.org/package/show/devel:gcc/gdb?expand=0&rev=251
This commit is contained in:
Michael Matz 2020-07-23 12:21:48 +00:00 committed by Git OBS Bridge
parent f9775d16c5
commit 389676c4ef
89 changed files with 1595 additions and 14069 deletions

View File

@ -1,57 +0,0 @@
Remove alloca(0) calls
PR gdb/24653 points out that a gcc snapshot will complain about the
calls to alloca(0) in gdb.
These calls are only needed when using the C alloca. I'm inclined to
think that no current platform needs this, so this patch removes the
calls.
Let me know what you think.
gdb/ChangeLog
2019-06-14 Tom Tromey <tromey@adacore.com>
PR gdb/24653:
* regcache.c (registers_changed): Don't call alloca.
* top.c (execute_command): Don't call alloca.
---
gdb/ChangeLog | 6 ++++++
gdb/regcache.c | 7 -------
gdb/top.c | 4 ----
3 files changed, 6 insertions(+), 11 deletions(-)
diff --git a/gdb/regcache.c b/gdb/regcache.c
index 6e3eee96631..323f0f5ab4e 100644
--- a/gdb/regcache.c
+++ b/gdb/regcache.c
@@ -454,13 +454,6 @@ void
registers_changed (void)
{
registers_changed_ptid (minus_one_ptid);
-
- /* Force cleanup of any alloca areas if using C alloca instead of
- a builtin alloca. This particular call is used to clean up
- areas allocated by low level target code which may build up
- during lengthy interactions between gdb and the target before
- gdb gives control to the user (ie watchpoints). */
- alloca (0);
}
void
diff --git a/gdb/top.c b/gdb/top.c
index b46de90f755..857207c3767 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -560,10 +560,6 @@ execute_command (const char *p, int from_tty)
auto cleanup_if_error = make_scope_exit (bpstat_clear_actions);
scoped_value_mark cleanup = prepare_execute_command ();
- /* Force cleanup of any alloca areas if using C alloca instead of
- a builtin alloca. */
- alloca (0);
-
/* This can happen when command_line_input hits end of file. */
if (p == NULL)
{

View File

@ -16,7 +16,7 @@ Subject: gdb-6.3-gstack-20050411.patch
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -1749,7 +1749,7 @@ info install-info clean-info dvi pdf install-pdf html install-html: force
@@ -1768,7 +1768,7 @@ info install-info clean-info dvi pdf install-pdf html install-html: force
install: all
@$(MAKE) $(FLAGS_TO_PASS) install-only
@ -25,7 +25,7 @@ diff --git a/gdb/Makefile.in b/gdb/Makefile.in
transformed_name=`t='$(program_transform_name)'; \
echo gdb | sed -e "$$t"` ; \
if test "x$$transformed_name" = x; then \
@@ -1798,7 +1798,25 @@ install-guile:
@@ -1817,7 +1817,25 @@ install-guile:
install-python:
$(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(GDB_DATADIR)/python/gdb
@ -52,7 +52,7 @@ diff --git a/gdb/Makefile.in b/gdb/Makefile.in
transformed_name=`t='$(program_transform_name)'; \
echo gdb | sed -e $$t` ; \
if test "x$$transformed_name" = x; then \
@@ -1821,6 +1839,18 @@ uninstall: force $(CONFIG_UNINSTALL)
@@ -1840,6 +1858,18 @@ uninstall: force $(CONFIG_UNINSTALL)
fi
@$(MAKE) DO=uninstall "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do

View File

@ -1,26 +0,0 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Elena Zannoni <ezannoni@redhat.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-6.3-rh-testversion-20041202.patch
;; Match the Fedora's version info.
;;=fedora
2003-02-24 Elena Zannoni <ezannoni@redhat.com>
* gdb.gdb/selftest.exp: Add matching on specific Red Hat only version
string.
diff --git a/gdb/testsuite/gdb.gdb/selftest.exp b/gdb/testsuite/gdb.gdb/selftest.exp
--- a/gdb/testsuite/gdb.gdb/selftest.exp
+++ b/gdb/testsuite/gdb.gdb/selftest.exp
@@ -53,6 +53,9 @@ proc test_with_self { } {
-re ".\[0-9\]+ = +.+ +0x.*\[0-9.\]+.*$gdb_prompt $" {
pass "printed version with cast"
}
+ -re ".\[0-9\]+ = .(Fedora|Red Hat Enterprise Linux) \[\\(\\)0-9.a-z\\-\]+.*$gdb_prompt $" {
+ pass "printed version Fedora or Red Hat Enterprise Linux only"
+ }
}
# start the "xgdb" process

View File

@ -44,9 +44,9 @@ glibc-debuginfo-2.7-2.x86_64: /usr/lib/debug/lib64/libc.so.6.debug:
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -1183,6 +1183,10 @@ print_command_1 (const char *exp, int voidprint)
@@ -1214,6 +1214,10 @@ print_command_1 (const char *args, int voidprint)
if (exp && *exp)
if (exp != nullptr && *exp)
{
+ /* '*((int *(*) (void)) __errno_location) ()' is incompatible with
+ function descriptors. */

View File

@ -1,304 +0,0 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Jan Kratochvil <jan.kratochvil@redhat.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-6.5-bz216711-clone-is-outermost.patch
;; Fix bogus 0x0 unwind of the thread's topmost function clone(3) (BZ 216711).
;;=fedora
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=216711
FIXME: This workaround should be dropped and
glibc/sysdeps/unix/sysv/linux/x86_64/clone.S should get CFI for the child
instead.
2006-12-17 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb/amd64-linux-tdep.c (linux_clone_code): New variable.
(LINUX_CLONE_LEN): New definition.
(amd64_linux_clone_running, amd64_linux_outermost_frame): New function.
(amd64_linux_init_abi): Initialize `outermost_frame_p'.
* gdb/i386-tdep.c (i386_gdbarch_init): Likewise.
* gdb/i386-tdep.h (gdbarch_tdep): Add `outermost_frame_p' member.
* gdb/amd64-tdep.c (amd64_frame_this_id): Call `outermost_frame_p'.
2006-12-17 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.threads/bt-clone-stop.exp, gdb.threads/bt-clone-stop.c:
New file.
2007-10-16 Jan Kratochvil <jan.kratochvil@redhat.com>
Port to GDB-6.7.
diff --git a/gdb/amd64-linux-tdep.c b/gdb/amd64-linux-tdep.c
--- a/gdb/amd64-linux-tdep.c
+++ b/gdb/amd64-linux-tdep.c
@@ -291,6 +291,80 @@ amd64_linux_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
/* Set the program counter for process PTID to PC. */
+/* Detect the outermost frame; during unwind of
+ #5 0x000000305cec68c3 in clone () from /lib64/tls/libc.so.6
+ avoid the additional bogus frame
+ #6 0x0000000000000000 in ??
+ We compare if the `linux_clone_code' block is _before_ unwound PC. */
+
+static const unsigned char linux_clone_code[] =
+{
+/* libc/sysdeps/unix/sysv/linux/x86_64/clone.S */
+/* #ifdef RESET_PID */
+/* ... */
+/* mov $SYS_ify(getpid), %eax */
+/* 0xb8, 0x27, 0x00, 0x00, 0x00 */
+/* OR */
+/* mov $SYS_ify(getpid), %rax */
+/* 0x48, 0xc7, 0xc0, 0x27, 0x00, 0x00, 0x00 */
+/* so just: */
+ 0x27, 0x00, 0x00, 0x00,
+/* syscall */
+ 0x0f, 0x05,
+/* movl %eax, %fs:PID */
+ 0x64, 0x89, 0x04, 0x25, 0x94, 0x00, 0x00, 0x00,
+/* movl %eax, %fs:TID */
+ 0x64, 0x89, 0x04, 0x25, 0x90, 0x00, 0x00, 0x00,
+/* #endif */
+/* |* Set up arguments for the function call. *| */
+/* popq %rax |* Function to call. *| */
+ 0x58,
+/* popq %rdi |* Argument. *| */
+ 0x5f,
+/* call *%rax$ */
+ 0xff, 0xd0
+};
+
+#define LINUX_CLONE_LEN (sizeof linux_clone_code)
+
+static int
+amd64_linux_clone_running (struct frame_info *this_frame)
+{
+ CORE_ADDR pc = get_frame_pc (this_frame);
+ unsigned char buf[LINUX_CLONE_LEN];
+
+ if (!safe_frame_unwind_memory (this_frame, pc - LINUX_CLONE_LEN, buf,
+ LINUX_CLONE_LEN))
+ return 0;
+
+ if (memcmp (buf, linux_clone_code, LINUX_CLONE_LEN) != 0)
+ return 0;
+
+ return 1;
+}
+
+static int
+amd64_linux_outermost_frame (struct frame_info *this_frame)
+{
+ CORE_ADDR pc = get_frame_pc (this_frame);
+ const char *name;
+
+ find_pc_partial_function (pc, &name, NULL, NULL);
+
+ /* If we have NAME, we can optimize the search.
+ `clone' NAME still needs to have the code checked as its name may be
+ present in the user code.
+ `__clone' NAME should not be present in the user code but in the initial
+ parts of the `__clone' implementation the unwind still makes sense.
+ More detailed unwinding decision would be too much sensitive to possible
+ subtle changes in specific glibc revisions. */
+ if (name == NULL || strcmp (name, "clone") == 0
+ || strcmp ("__clone", name) == 0)
+ return (amd64_linux_clone_running (this_frame) != 0);
+
+ return 0;
+}
+
static void
amd64_linux_write_pc (struct regcache *regcache, CORE_ADDR pc)
{
@@ -1808,6 +1882,8 @@ amd64_linux_init_abi_common(struct gdbarch_info info, struct gdbarch *gdbarch)
tdep->xsave_xcr0_offset = I386_LINUX_XSAVE_XCR0_OFFSET;
+ tdep->outermost_frame_p = amd64_linux_outermost_frame;
+
/* Add the %orig_rax register used for syscall restarting. */
set_gdbarch_write_pc (gdbarch, amd64_linux_write_pc);
diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c
--- a/gdb/amd64-tdep.c
+++ b/gdb/amd64-tdep.c
@@ -2601,6 +2601,7 @@ amd64_frame_unwind_stop_reason (struct frame_info *this_frame,
{
struct amd64_frame_cache *cache =
amd64_frame_cache (this_frame, this_cache);
+ struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (this_frame));
if (!cache->base_p)
return UNWIND_UNAVAILABLE;
@@ -2609,6 +2610,10 @@ amd64_frame_unwind_stop_reason (struct frame_info *this_frame,
if (cache->base == 0)
return UNWIND_OUTERMOST;
+ /* Detect OS dependent outermost frames; such as `clone'. */
+ if (tdep->outermost_frame_p && tdep->outermost_frame_p (this_frame))
+ return UNWIND_OUTERMOST;
+
return UNWIND_NO_REASON;
}
@@ -2743,6 +2748,7 @@ amd64_sigtramp_frame_this_id (struct frame_info *this_frame,
{
struct amd64_frame_cache *cache =
amd64_sigtramp_frame_cache (this_frame, this_cache);
+ struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (this_frame));
if (!cache->base_p)
(*this_id) = frame_id_build_unavailable_stack (get_frame_pc (this_frame));
@@ -2751,6 +2757,11 @@ amd64_sigtramp_frame_this_id (struct frame_info *this_frame,
/* This marks the outermost frame. */
return;
}
+ else if (tdep->outermost_frame_p && tdep->outermost_frame_p (this_frame))
+ {
+ /* Detect OS dependent outermost frames; such as `clone'. */
+ return;
+ }
else
(*this_id) = frame_id_build (cache->base + 16, get_frame_pc (this_frame));
}
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -8407,6 +8407,9 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
tdep->xsave_xcr0_offset = -1;
+ /* Unwinding stops on i386 automatically. */
+ tdep->outermost_frame_p = NULL;
+
tdep->record_regmap = i386_record_regmap;
set_gdbarch_type_align (gdbarch, i386_type_align);
diff --git a/gdb/i386-tdep.h b/gdb/i386-tdep.h
--- a/gdb/i386-tdep.h
+++ b/gdb/i386-tdep.h
@@ -251,6 +251,9 @@ struct gdbarch_tdep
/* Regsets. */
const struct regset *fpregset;
+
+ /* Detect OS dependent outermost frames; such as `clone'. */
+ int (*outermost_frame_p) (struct frame_info *this_frame);
};
/* Floating-point registers. */
diff --git a/gdb/testsuite/gdb.threads/bt-clone-stop.c b/gdb/testsuite/gdb.threads/bt-clone-stop.c
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.threads/bt-clone-stop.c
@@ -0,0 +1,39 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2006 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., 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA. */
+
+
+#include <pthread.h>
+#include <unistd.h>
+#include <assert.h>
+
+
+void *threader (void *arg)
+{
+ assert (0);
+ return NULL;
+}
+
+int main (void)
+{
+ pthread_t t1;
+
+ pthread_create (&t1, NULL, threader, (void *) NULL);
+ for (;;)
+ pause();
+}
diff --git a/gdb/testsuite/gdb.threads/bt-clone-stop.exp b/gdb/testsuite/gdb.threads/bt-clone-stop.exp
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.threads/bt-clone-stop.exp
@@ -0,0 +1,61 @@
+# Copyright 2006 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.
+
+# Backtraced `clone' must not have `PC == 0' as its previous frame.
+
+if $tracelevel then {
+ strace $tracelevel
+}
+
+set testfile bt-clone-stop
+set srcfile ${testfile}.c
+set binfile [standard_output_file ${testfile}]
+if { [gdb_compile_pthreads "${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}
+
+# threader: threader.c:8: threader: Assertion `0' failed.
+# Program received signal SIGABRT, Aborted.
+
+gdb_test "run" \
+ {Thread 2 "bt-clone-stop" received signal SIGABRT.*} \
+ "run"
+
+# Former gdb unwind (the first function is `clone'):
+# #5 0x0000003421ecd62d in ?? () from /lib64/libc.so.6
+# #6 0x0000000000000000 in ?? ()
+# (gdb)
+# Tested `amd64_linux_outermost_frame' functionality should omit the line `#6'.
+#
+# Two `-re' cases below must be in this order (1st is a subset of the 2nd one).
+# Unhandled case below should not happen and it is fortunately handled by
+# `amd64_linux_outermost_frame' as FAIL (and result `0x0 entry output invalid').
+gdb_test_multiple "bt" "0x0 entry output invalid" {
+ -re "in threader \\(.*\n#\[0-9\]* *0x0* in .*$gdb_prompt $" {
+ fail "0x0 entry found"
+ }
+ -re "in threader \\(.*$gdb_prompt $" {
+ pass "0x0 entry not found"
+ }
+}

View File

@ -11,8 +11,8 @@ https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=218379
diff --git a/gdb/symtab.c b/gdb/symtab.c
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -3177,6 +3177,13 @@ find_pc_sect_line (CORE_ADDR pc, struct obj_section *section, int notcurrent)
SYMBOL_LINKAGE_NAME (msymbol)); */
@@ -3166,6 +3166,13 @@ find_pc_sect_line (CORE_ADDR pc, struct obj_section *section, int notcurrent)
msymbol->linkage_name ()); */
;
/* fall through */
+ /* `msymbol' trampoline may be located before its .text symbol
@ -20,7 +20,7 @@ diff --git a/gdb/symtab.c b/gdb/symtab.c
+ Avoid `find_pc_sect_line'<->`find_pc_line' infinite loop.
+ Red Hat Bug 218379. */
+ else if (BMSYMBOL_VALUE_ADDRESS (mfunsym) == pc)
+ warning ("In stub for %s (0x%s); interlocked, please submit the binary to http://bugzilla.redhat.com", MSYMBOL_LINKAGE_NAME (msymbol.minsym), paddress (target_gdbarch (), pc));
+ warning ("In stub for %s (0x%s); interlocked, please submit the binary to http://bugzilla.redhat.com", msymbol.minsym->linkage_name (), paddress (target_gdbarch (), pc));
+ /* fall through */
else
return find_pc_line (BMSYMBOL_VALUE_ADDRESS (mfunsym), 0);

View File

@ -61,31 +61,19 @@ Http://sourceware.org/ml/gdb-patches/2010-01/msg00517.html
* exec.c (exec_file_attach): Print a more useful error message if the
user did "gdb core".
diff --git a/gdb/common/common-exceptions.h b/gdb/common/common-exceptions.h
--- a/gdb/common/common-exceptions.h
+++ b/gdb/common/common-exceptions.h
@@ -104,6 +104,9 @@ enum errors {
"_ERROR" is appended to the name. */
MAX_COMPLETIONS_REACHED_ERROR,
+ /* Attempt to load a core file as executable. */
+ IS_CORE_ERROR,
+
/* Add more errors here. */
NR_ERRORS
};
diff --git a/gdb/exec.c b/gdb/exec.c
--- a/gdb/exec.c
+++ b/gdb/exec.c
@@ -36,6 +36,7 @@
#include "gdb_bfd.h"
#include "gcore.h"
#include "source.h"
+#include "exceptions.h"
@@ -18,6 +18,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <fcntl.h>
#include "readline/readline.h"
@@ -355,12 +356,27 @@ exec_file_attach (const char *filename, int from_tty)
#include "defs.h"
+#include "arch-utils.h"
+#include "exceptions.h"
#include "frame.h"
#include "inferior.h"
#include "target.h"
@@ -345,12 +347,27 @@ exec_file_attach (const char *filename, int from_tty)
if (!bfd_check_format_matches (exec_bfd, bfd_object, &matching))
{
@ -110,16 +98,29 @@ diff --git a/gdb/exec.c b/gdb/exec.c
+ "Please specify an executable to debug."),
+ scratch_pathname);
+ else
+ error (_("\"%s\": not in executable format: %s"),
+ error (_("\"%ss\": not in executable format: %s"),
+ scratch_pathname,
+ gdb_bfd_errmsg (bfd_get_error (), matching).c_str ());
}
if (build_section_table (exec_bfd, &sections, &sections_end))
diff --git a/gdb/gdbsupport/common-exceptions.h b/gdb/gdbsupport/common-exceptions.h
--- a/gdb/gdbsupport/common-exceptions.h
+++ b/gdb/gdbsupport/common-exceptions.h
@@ -106,6 +106,9 @@ enum errors {
"_ERROR" is appended to the name. */
MAX_COMPLETIONS_REACHED_ERROR,
+ /* Attempt to load a core file as executable. */
+ IS_CORE_ERROR,
+
/* Add more errors here. */
NR_ERRORS
};
diff --git a/gdb/main.c b/gdb/main.c
--- a/gdb/main.c
+++ b/gdb/main.c
@@ -448,6 +448,35 @@ struct cmdarg
@@ -467,6 +467,34 @@ struct cmdarg
char *string;
};
@ -132,11 +133,11 @@ diff --git a/gdb/main.c b/gdb/main.c
+{
+ gdb_assert (exec_bfd == NULL);
+
+ TRY
+ try
+ {
+ exec_file_attach (filename, from_tty);
+ }
+ CATCH (e, RETURN_MASK_ALL)
+ catch (gdb_exception_error &e)
+ {
+ if (e.error == IS_CORE_ERROR)
+ {
@ -147,15 +148,14 @@ diff --git a/gdb/main.c b/gdb/main.c
+ if (exec_bfd != NULL)
+ return;
+ }
+ throw_exception (e);
+ throw_exception (std::move (e));
+ }
+ END_CATCH
+}
+
static void
captured_main_1 (struct captured_main_args *context)
{
@@ -893,6 +922,8 @@ captured_main_1 (struct captured_main_args *context)
@@ -907,6 +935,8 @@ captured_main_1 (struct captured_main_args *context)
{
symarg = argv[optind];
execarg = argv[optind];
@ -164,7 +164,7 @@ diff --git a/gdb/main.c b/gdb/main.c
optind++;
}
@@ -1043,12 +1074,25 @@ captured_main_1 (struct captured_main_args *context)
@@ -1063,12 +1093,25 @@ captured_main_1 (struct captured_main_args *context)
&& symarg != NULL
&& strcmp (execarg, symarg) == 0)
{

View File

@ -1,129 +0,0 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject:
gdb-6.6-buildid-locate-misleading-warning-missing-debuginfo-rhbz981154.patch
;; Fix 'gdb gives highly misleading error when debuginfo pkg is present,
;; but not corresponding binary pkg' (RH BZ 981154).
;;=push+jan
Comments by Sergio Durigan Junior <sergiodj@redhat.com>:
This is the fix for RH BZ #981154
It is mainly a testcase addition, but a minor fix in the gdb/build-id.c
file was also needed.
gdb/build-id.c was added by:
commit dc294be54c96414035eed7d53dafdea0a6f31a72
Author: Tom Tromey <tromey@redhat.com>
Date: Tue Oct 8 19:56:15 2013 +0000
and had a little thinko there. The variable 'filename' needs to be set to
NULL after it is free'd, otherwise the code below thinks that it is still
valid and doesn't print the necessary warning ("Try: yum install ...").
diff --git a/gdb/testsuite/gdb.base/rhbz981154-misleading-yum-install-warning.exp b/gdb/testsuite/gdb.base/rhbz981154-misleading-yum-install-warning.exp
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/rhbz981154-misleading-yum-install-warning.exp
@@ -0,0 +1,97 @@
+# Copyright (C) 2014 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+standard_testfile "normal.c"
+
+if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile}] } {
+ return -1
+}
+
+# Get the build-id of the file
+set build_id_debug_file [build_id_debug_filename_get $binfile]
+regsub -all ".debug$" $build_id_debug_file "" build_id_without_debug
+
+# Run to main
+if { ![runto_main] } {
+ return -1
+}
+
+# We first need to generate a corefile
+set escapedfilename [string_to_regexp [standard_output_file gcore.test]]
+set core_supported 0
+gdb_test_multiple "gcore [standard_output_file gcore.test]" \
+ "save a corefile" \
+{
+ -re "Saved corefile ${escapedfilename}\[\r\n\]+$gdb_prompt $" {
+ pass "save a corefile"
+ global core_supported
+ set core_supported 1
+ }
+ -re "Can't create a corefile\[\r\n\]+$gdb_prompt $" {
+ unsupported "save a corefile"
+ global core_supported
+ set core_supported 0
+ }
+}
+
+if {!$core_supported} {
+ return -1
+}
+
+# Move the binfile to a temporary name
+remote_exec build "mv $binfile ${binfile}.old"
+
+# Reinitialize GDB and see if we get a yum/dnf warning
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+
+with_test_prefix "first run:" {
+ gdb_test "set build-id-verbose 1" "" \
+ "set build-id-verbose"
+
+ gdb_test "set debug-file-directory [file dirname [standard_output_file gcore.test]]" "" \
+ "set debug-file-directory"
+
+ gdb_test "core-file [standard_output_file gcore.test]" \
+ "Missing separate debuginfo for the main executable file\r\nTry: (yum|dnf) --enablerepo='\\*debug\\*' install [standard_output_file $build_id_without_debug]\r\n.*" \
+ "test first yum/dnf warning"
+}
+
+# Now we define and create our .build-id
+file mkdir [file dirname [standard_output_file ${build_id_without_debug}]]
+# Cannot use "file link" (from TCL) because it requires the target file to
+# exist.
+remote_exec build "ln -s $binfile [standard_output_file ${build_id_without_debug}]"
+
+# Reinitialize GDB to get the second yum/dnf warning
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+
+with_test_prefix "second run:" {
+ gdb_test "set build-id-verbose 1" "" \
+ "set build-id-verbose"
+
+ gdb_test "set debug-file-directory [file dirname [standard_output_file gcore.test]]" "" \
+ "set debug-file-directory"
+
+ gdb_test "core-file [standard_output_file gcore.test]" \
+ "Missing separate debuginfo for the main executable file\r\nTry: (yum|dnf) --enablerepo='\\*debug\\*' install $binfile\r\n.*" \
+ "test second yum/dnf warning"
+}
+
+# Leaving the link there will cause breakage in the next run.
+remote_exec build "rm -f [standard_output_file ${build_id_without_debug}]"

View File

@ -9,7 +9,7 @@ Subject: gdb-6.6-buildid-locate-rpm-librpm-workaround.patch
diff --git a/gdb/build-id.c b/gdb/build-id.c
--- a/gdb/build-id.c
+++ b/gdb/build-id.c
@@ -712,6 +712,19 @@ build_id_to_filename (const struct bfd_build_id *build_id, char **link_return)
@@ -709,6 +709,19 @@ build_id_to_filename (const struct bfd_build_id *build_id, char **link_return)
#include <dlfcn.h>
#endif

View File

@ -12,7 +12,7 @@ https://bugzilla.redhat.com/show_bug.cgi?id=953585
diff --git a/gdb/build-id.c b/gdb/build-id.c
--- a/gdb/build-id.c
+++ b/gdb/build-id.c
@@ -746,7 +746,11 @@ static int missing_rpm_list_entries;
@@ -743,7 +743,11 @@ static int missing_rpm_list_entries;
/* Returns the count of newly added rpms. */
static int
@ -24,7 +24,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
{
static int rpm_init_done = 0;
rpmts ts;
@@ -853,7 +857,11 @@ missing_rpm_enlist (const char *filename)
@@ -850,7 +854,11 @@ missing_rpm_enlist (const char *filename)
mi = rpmtsInitIterator_p (ts, RPMTAG_BASENAMES, filename, 0);
if (mi != NULL)
{
@ -36,7 +36,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
{
Header h;
char *debuginfo, **slot, *s, *s2;
@@ -971,6 +979,37 @@ missing_rpm_enlist (const char *filename)
@@ -968,6 +976,37 @@ missing_rpm_enlist (const char *filename)
xfree (debuginfo);
count++;
}
@ -74,10 +74,10 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
rpmdbFreeIterator_p (mi);
}
@@ -981,6 +1020,21 @@ missing_rpm_enlist (const char *filename)
@@ -977,6 +1016,20 @@ missing_rpm_enlist (const char *filename)
return count;
}
static int
+#ifdef GDB_INDEX_VERIFY_VENDOR
+missing_rpm_enlist (const char *filename)
+{
@ -90,16 +90,15 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
+{
+ return missing_rpm_enlist_1 (filename, 1);
+}
+
+static int
+#endif
missing_rpm_list_compar (const char *const *ap, const char *const *bp)
+
static bool
missing_rpm_list_compar (const char *ap, const char *bp)
{
return strcoll (*ap, *bp);
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -3501,6 +3501,16 @@ read_gdb_index_from_buffer (struct objfile *objfile,
@@ -3497,6 +3497,16 @@ read_gdb_index_from_buffer (struct objfile *objfile,
"set use-deprecated-index-sections on". */
if (version < 6 && !deprecated_ok)
{
@ -116,7 +115,7 @@ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
static int warning_printed = 0;
if (!warning_printed)
{
@@ -3512,6 +3522,10 @@ to use the section anyway."),
@@ -3508,6 +3518,10 @@ to use the section anyway."),
warning_printed = 1;
}
return 0;

View File

@ -1,8 +1,19 @@
Index: gdb-7.12.1/gdb/build-id.c
Index: gdb-9.1/gdb/build-id.c
===================================================================
--- gdb-7.12.1.orig/gdb/build-id.c 2017-02-14 15:56:04.000000000 +0100
+++ gdb-7.12.1/gdb/build-id.c 2017-02-14 15:58:29.000000000 +0100
@@ -841,9 +841,9 @@ missing_rpm_enlist_1 (const char *filena
--- gdb-9.1.orig/gdb/build-id.c
+++ gdb-9.1/gdb/build-id.c
@@ -861,19 +861,17 @@ missing_rpm_enlist_1 (const char *filena
#endif
{
Header h;
- char *debuginfo, **slot, *s, *s2;
+ char *debuginfo, **slot;
errmsg_t err;
- size_t srcrpmlen = sizeof (".src.rpm") - 1;
- size_t debuginfolen = sizeof ("-debuginfo") - 1;
rpmdbMatchIterator mi_debuginfo;
h = rpmdbNextIterator_p (mi);
if (h == NULL)
break;
@ -15,7 +26,7 @@ Index: gdb-7.12.1/gdb/build-id.c
&err);
if (!debuginfo)
{
@@ -851,60 +851,19 @@ missing_rpm_enlist_1 (const char *filena
@@ -881,60 +879,19 @@ missing_rpm_enlist_1 (const char *filena
err);
continue;
}
@ -78,8 +89,8 @@ Index: gdb-7.12.1/gdb/build-id.c
/* Base package name for `debuginfo-install'. We do not use the
`yum' command directly as the line
yum --enablerepo='*debug*' install NAME-debuginfo.ARCH
@@ -1035,10 +994,7 @@ missing_rpm_list_print (void)
(int (*) (const void *, const void *)) missing_rpm_list_compar);
@@ -1076,10 +1033,7 @@ missing_rpm_list_print (void)
missing_rpm_list_entries = 0;
printf_unfiltered (_("Missing separate debuginfos, use: %s"),
-#ifdef DNF_DEBUGINFO_INSTALL
@ -87,10 +98,10 @@ Index: gdb-7.12.1/gdb/build-id.c
-#endif
- "debuginfo-install");
+ "zypper install");
for (array_iter = array; array_iter < array + missing_rpm_list_entries;
array_iter++)
for (const char *el : array)
{
@@ -1251,13 +1207,12 @@ debug_print_missing (const char *binary,
puts_unfiltered (" ");
@@ -1287,13 +1241,12 @@ debug_print_missing (const char *binary,
fprintf_unfiltered (gdb_stdlog,
_("Missing separate debuginfo for %s\n"), binary);
if (debug != NULL)
@ -110,19 +121,3 @@ Index: gdb-7.12.1/gdb/build-id.c
}
}
diff --git a/gdb/build-id.c b/gdb/build-id.c
index b9ff15a..75d501a 100644
--- a/gdb/build-id.c
+++ b/gdb/build-id.c
@@ -864,10 +864,8 @@ missing_rpm_enlist_1 (const char *filename, int verify_vendor)
#endif
{
Header h;
- char *debuginfo, **slot, *s, *s2;
+ char *debuginfo, **slot;
errmsg_t err;
- size_t srcrpmlen = sizeof (".src.rpm") - 1;
- size_t debuginfolen = sizeof ("-debuginfo") - 1;
rpmdbMatchIterator mi_debuginfo;
h = rpmdbNextIterator_p (mi);

View File

@ -235,16 +235,15 @@ diff --git a/gdb/aclocal.m4 b/gdb/aclocal.m4
diff --git a/gdb/build-id.c b/gdb/build-id.c
--- a/gdb/build-id.c
+++ b/gdb/build-id.c
@@ -35,6 +35,8 @@
#include "elf/common.h"
#include "elf-bfd.h"
#include <sys/stat.h>
+#include "elf/external.h"
@@ -33,6 +33,7 @@
#include "gdb_bfd.h"
#include "gdbcmd.h"
#include "gdbcore.h"
+#include "inferior.h"
#define BUILD_ID_VERBOSE_NONE 0
#define BUILD_ID_VERBOSE_FILENAMES 1
@@ -700,8 +702,366 @@ build_id_to_filename (const struct bfd_build_id *build_id, char **link_return)
#include "libbfd.h"
#include "objfiles.h"
#include "observable.h"
@@ -698,8 +699,374 @@ build_id_to_filename (const struct bfd_build_id *build_id, char **link_return)
return result;
}
@ -513,10 +512,10 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
+ return count;
+}
+
+static int
+missing_rpm_list_compar (const char *const *ap, const char *const *bp)
+static bool
+missing_rpm_list_compar (const char *ap, const char *bp)
+{
+ return strcoll (*ap, *bp);
+ return strcoll (ap, bp) < 0;
+}
+
+/* It returns a NULL-terminated array of strings needing to be FREEd. It may
@ -525,39 +524,50 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
+static void
+missing_rpm_list_print (void)
+{
+ char **array, **array_iter;
+ struct missing_rpm *list_iter;
+ struct cleanup *cleanups;
+
+ if (missing_rpm_list_entries == 0)
+ return;
+
+ array = (char **) xmalloc (sizeof (*array) * missing_rpm_list_entries);
+ cleanups = make_cleanup (xfree, array);
+ std::vector<const char *> array (missing_rpm_list_entries);
+ size_t idx = 0;
+
+ array_iter = array;
+ for (list_iter = missing_rpm_list; list_iter != NULL;
+ list_iter = list_iter->next)
+ {
+ *array_iter++ = list_iter->rpm;
+ array[idx++] = list_iter->rpm;
+ }
+ gdb_assert (array_iter == array + missing_rpm_list_entries);
+ gdb_assert (idx == missing_rpm_list_entries);
+
+ qsort (array, missing_rpm_list_entries, sizeof (*array),
+ (int (*) (const void *, const void *)) missing_rpm_list_compar);
+ std::sort (array.begin (), array.end (), missing_rpm_list_compar);
+
+ /* We zero out the number of missing RPMs here because of a nasty
+ bug (see RHBZ 1801974).
+
+ When we call 'puts_unfiltered' below, if pagination is on and if
+ the number of missing RPMs is big enough to trigger pagination,
+ we will end up in an infinite recursion. The call chain looks
+ like this:
+
+ missing_rpm_list_print -> puts_unfiltered -> fputs_maybe_filtered
+ -> prompt_for_continue -> display_gdb_prompt ->
+ debug_flush_missing -> missing_rpm_list_print ...
+
+ For this reason, we make sure MISSING_RPM_LIST_ENTRIES is zero
+ *before* calling any print function. */
+ missing_rpm_list_entries = 0;
+
+ printf_unfiltered (_("Missing separate debuginfos, use: %s"),
+#ifdef DNF_DEBUGINFO_INSTALL
+ "dnf "
+#endif
+ "debuginfo-install");
+ for (array_iter = array; array_iter < array + missing_rpm_list_entries;
+ array_iter++)
+ for (const char *el : array)
+ {
+ putchar_unfiltered (' ');
+ puts_unfiltered (*array_iter);
+ puts_unfiltered (" ");
+ puts_unfiltered (el);
+ }
+ putchar_unfiltered ('\n');
+ puts_unfiltered ("\n");
+
+ while (missing_rpm_list != NULL)
+ {
@ -565,9 +575,6 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
+ missing_rpm_list = list_iter->next;
+ xfree (list_iter);
+ }
+ missing_rpm_list_entries = 0;
+
+ do_cleanups (cleanups);
+}
+
+static void
@ -612,7 +619,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
avoidance. */
struct missing_filepair
@@ -755,11 +1115,17 @@ missing_filepair_change (void)
@@ -753,11 +1120,17 @@ missing_filepair_change (void)
/* All their memory came just from missing_filepair_OBSTACK. */
missing_filepair_hash = NULL;
}
@ -630,7 +637,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
missing_filepair_change ();
}
@@ -826,14 +1192,39 @@ debug_print_missing (const char *binary, const char *debug)
@@ -824,14 +1197,38 @@ debug_print_missing (const char *binary, const char *debug)
*slot = missing_filepair;
@ -639,14 +646,13 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
+#ifdef HAVE_LIBRPM
+ if (missing_exec == MISSING_EXEC_NOT_TRIED)
+ {
+ char *execfilename;
+ const char *execfilename = get_exec_file (0);
- fprintf_unfiltered (gdb_stdlog,
- _("Missing separate debuginfo for %s\n"), binary);
- if (debug != NULL)
- fprintf_unfiltered (gdb_stdlog, _("Try to install the hash file %s\n"),
- debug);
+ execfilename = get_exec_file (0);
+ if (execfilename != NULL)
+ {
+ if (missing_rpm_enlist (execfilename) == 0)
@ -680,7 +686,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
diff --git a/gdb/config.in b/gdb/config.in
--- a/gdb/config.in
+++ b/gdb/config.in
@@ -33,6 +33,9 @@
@@ -36,6 +36,9 @@
/* Define to BFD's default target vector. */
#undef DEFAULT_BFD_VEC
@ -690,9 +696,9 @@ diff --git a/gdb/config.in b/gdb/config.in
/* Define to 1 if translation of program messages to the user's native
language is requested. */
#undef ENABLE_NLS
@@ -261,6 +264,9 @@
/* Define if Python 2.7 is being used. */
#undef HAVE_LIBPYTHON2_7
@@ -245,6 +248,9 @@
/* Define if you have the mpfr library. */
#undef HAVE_LIBMPFR
+/* Define if librpm library is being used. */
+#undef HAVE_LIBRPM
@ -703,7 +709,7 @@ diff --git a/gdb/config.in b/gdb/config.in
diff --git a/gdb/configure b/gdb/configure
--- a/gdb/configure
+++ b/gdb/configure
@@ -751,6 +751,11 @@ CODESIGN_CERT
@@ -761,6 +761,11 @@ CODESIGN_CERT
HAVE_NATIVE_GCORE_TARGET
TARGET_OBS
subdirs
@ -715,7 +721,7 @@ diff --git a/gdb/configure b/gdb/configure
GDB_DATADIR
DEBUGDIR
MAKEINFO_EXTRA_FLAGS
@@ -855,6 +860,7 @@ with_gdb_datadir
@@ -864,6 +869,7 @@ with_gdb_datadir
with_relocated_sources
with_auto_load_dir
with_auto_load_safe_path
@ -723,7 +729,7 @@ diff --git a/gdb/configure b/gdb/configure
enable_targets
enable_64_bit_bfd
enable_gdbmi
@@ -915,6 +921,11 @@ CCC
@@ -926,6 +932,11 @@ CCC
CPP
MAKEINFO
MAKEINFOFLAGS
@ -735,7 +741,7 @@ diff --git a/gdb/configure b/gdb/configure
YACC
YFLAGS
XMKMF'
@@ -1588,6 +1599,8 @@ Optional Packages:
@@ -1598,6 +1609,8 @@ Optional Packages:
[--with-auto-load-dir]
--without-auto-load-safe-path
do not restrict auto-loaded files locations
@ -744,7 +750,7 @@ diff --git a/gdb/configure b/gdb/configure
--with-libunwind-ia64 use libunwind frame unwinding for ia64 targets
--with-curses use the curses library instead of the termcap
library
@@ -1645,6 +1658,13 @@ Some influential environment variables:
@@ -1661,6 +1674,13 @@ Some influential environment variables:
MAKEINFO Parent configure detects if it is of sufficient version.
MAKEINFOFLAGS
Parameters for MAKEINFO.
@ -758,7 +764,7 @@ diff --git a/gdb/configure b/gdb/configure
YACC The `Yet Another Compiler Compiler' implementation to use.
Defaults to the first program found out of: `bison -y', `byacc',
`yacc'.
@@ -6626,6 +6646,494 @@ _ACEOF
@@ -6587,6 +6607,494 @@ _ACEOF
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_auto_load_safe_path" >&5
$as_echo "$with_auto_load_safe_path" >&6; }
@ -1256,7 +1262,7 @@ diff --git a/gdb/configure b/gdb/configure
diff --git a/gdb/configure.ac b/gdb/configure.ac
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -166,6 +166,199 @@ AC_DEFINE_DIR(AUTO_LOAD_SAFE_PATH, escape_dir,
@@ -144,6 +144,199 @@ AC_DEFINE_DIR(AUTO_LOAD_SAFE_PATH, escape_dir,
[Directories safe to hold auto-loaded files.])
AC_MSG_RESULT([$with_auto_load_safe_path])
@ -1456,30 +1462,18 @@ diff --git a/gdb/configure.ac b/gdb/configure.ac
AC_CONFIG_SUBDIRS(testsuite)
# Check whether to support alternative target configurations
diff --git a/gdb/corelow.c b/gdb/corelow.c
--- a/gdb/corelow.c
+++ b/gdb/corelow.c
@@ -365,7 +365,7 @@ build_id_locate_exec (int from_tty)
symfile_objfile->flags |= OBJF_BUILD_ID_CORE_LOADED;
}
else
- debug_print_missing (_("the main executable file"), build_id_filename);
+ debug_print_missing (BUILD_ID_MAIN_EXECUTABLE_FILENAME, build_id_filename);
do_cleanups (back_to);
diff --git a/gdb/event-top.c b/gdb/event-top.c
--- a/gdb/event-top.c
+++ b/gdb/event-top.c
@@ -40,6 +40,7 @@
#include "common/buffer.h"
@@ -41,6 +41,7 @@
#include "ser-event.h"
#include "gdb_select.h"
#include "gdbsupport/gdb-sigmask.h"
+#include "symfile.h"
/* readline include files. */
#include "readline/readline.h"
@@ -359,6 +360,8 @@ display_gdb_prompt (const char *new_prompt)
@@ -363,6 +364,8 @@ display_gdb_prompt (const char *new_prompt)
/* Reset the nesting depth used when trace-commands is set. */
reset_command_nest_depth ();
@ -1488,7 +1482,7 @@ diff --git a/gdb/event-top.c b/gdb/event-top.c
/* Do not call the python hook on an explicit prompt change as
passed to this function, as this forms a secondary/local prompt,
IE, displayed but not set. */
@@ -770,7 +773,10 @@ command_line_handler (gdb::unique_xmalloc_ptr<char> &&rl)
@@ -772,7 +775,10 @@ command_line_handler (gdb::unique_xmalloc_ptr<char> &&rl)
command_handler (cmd);
if (ui->prompt_state != PROMPTED)
@ -1503,7 +1497,7 @@ diff --git a/gdb/event-top.c b/gdb/event-top.c
diff --git a/gdb/symfile.h b/gdb/symfile.h
--- a/gdb/symfile.h
+++ b/gdb/symfile.h
@@ -534,6 +534,8 @@ void map_symbol_filenames (symbol_filename_ftype *fun, void *data,
@@ -542,6 +542,8 @@ extern void generic_load (const char *args, int from_tty);
/* build-id support. */
extern struct bfd_build_id *build_id_addr_get (CORE_ADDR addr);
extern void debug_print_missing (const char *binary, const char *debug);

View File

@ -14,7 +14,7 @@ https://bugzilla.redhat.com/show_bug.cgi?id=1339862
diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -1347,14 +1347,27 @@ svr4_read_so_list (CORE_ADDR lm, CORE_ADDR prev_lm,
@@ -1346,14 +1346,27 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm,
}
{
@ -44,7 +44,7 @@ diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
if (build_id != NULL)
{
char *name, *build_id_filename;
@@ -1369,23 +1382,7 @@ svr4_read_so_list (CORE_ADDR lm, CORE_ADDR prev_lm,
@@ -1368,23 +1381,7 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm,
xfree (name);
}
else

View File

@ -6,22 +6,50 @@ Subject: gdb-6.6-buildid-locate.patch
;; New locating of the matching binaries from the pure core file (build-id).
;;=push+jan
diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h
--- a/bfd/libbfd-in.h
+++ b/bfd/libbfd-in.h
@@ -127,7 +127,7 @@ static inline char *
bfd_strdup (const char *str)
{
size_t len = strlen (str) + 1;
- char *buf = bfd_malloc (len);
+ char *buf = (char *) bfd_malloc (len);
if (buf != NULL)
memcpy (buf, str, len);
return buf;
diff --git a/bfd/libbfd.h b/bfd/libbfd.h
--- a/bfd/libbfd.h
+++ b/bfd/libbfd.h
@@ -132,7 +132,7 @@ static inline char *
bfd_strdup (const char *str)
{
size_t len = strlen (str) + 1;
- char *buf = bfd_malloc (len);
+ char *buf = (char *) bfd_malloc (len);
if (buf != NULL)
memcpy (buf, str, len);
return buf;
diff --git a/gdb/build-id.c b/gdb/build-id.c
--- a/gdb/build-id.c
+++ b/gdb/build-id.c
@@ -26,11 +26,67 @@
@@ -24,13 +24,71 @@
#include "gdbsupport/gdb_vecs.h"
#include "symfile.h"
#include "objfiles.h"
#include "filenames.h"
#include "gdbcore.h"
+#include "libbfd.h"
+#include "gdbcore.h"
+#include "gdbcmd.h"
+#include "observable.h"
+#include <sys/stat.h>
+#include "elf-bfd.h"
+#include "elf/common.h"
+#include "elf/external.h"
+#include "elf/internal.h"
+#include "elf/common.h"
+#include "elf-bfd.h"
+#include <sys/stat.h>
#include "filenames.h"
+#include "gdb_bfd.h"
+#include "gdbcmd.h"
#include "gdbcore.h"
+#include "libbfd.h"
+#include "objfiles.h"
+#include "observable.h"
+#include "symfile.h"
+
+#define BUILD_ID_VERBOSE_NONE 0
+#define BUILD_ID_VERBOSE_FILENAMES 1
@ -76,9 +104,9 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
-build_id_bfd_get (bfd *abfd)
+build_id_bfd_shdr_get (bfd *abfd)
{
if (!bfd_check_format (abfd, bfd_object))
return NULL;
@@ -42,6 +98,348 @@ build_id_bfd_get (bfd *abfd)
if (!bfd_check_format (abfd, bfd_object)
&& !bfd_check_format (abfd, bfd_core))
@@ -43,6 +101,348 @@ build_id_bfd_get (bfd *abfd)
return NULL;
}
@ -367,7 +395,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
+
+static void build_id_addr_candidate (bfd *abfd, asection *sect, void *obj)
+{
+ if (build_id_addr >= bfd_section_vma (abfd, sect))
+ if (build_id_addr >= bfd_section_vma (sect))
+ {
+ struct build_id_addr_sect *candidate;
+
@ -402,7 +430,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
+ candidate = candidate->next)
+ {
+ i_phdr = elf_get_phdr (core_bfd,
+ bfd_section_vma (core_bfd, candidate->sect),
+ bfd_section_vma (candidate->sect),
+ &e_phnum, &loadbase);
+ if (i_phdr != NULL)
+ break;
@ -427,7 +455,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
/* See build-id.h. */
int
@@ -50,7 +448,7 @@ build_id_verify (bfd *abfd, size_t check_len, const bfd_byte *check)
@@ -51,7 +451,7 @@ build_id_verify (bfd *abfd, size_t check_len, const bfd_byte *check)
const struct bfd_build_id *found;
int retval = 0;
@ -436,7 +464,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
if (found == NULL)
warning (_("File \"%s\" has no build-id, file skipped"),
@@ -65,62 +463,173 @@ build_id_verify (bfd *abfd, size_t check_len, const bfd_byte *check)
@@ -66,56 +466,159 @@ build_id_verify (bfd *abfd, size_t check_len, const bfd_byte *check)
return retval;
}
@ -482,8 +510,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
-build_id_to_debug_bfd_1 (const std::string &link, size_t build_id_len,
- const bfd_byte *build_id)
+build_id_to_debug_bfd_1 (const std::string &orig_link, size_t build_id_len,
+ const bfd_byte *build_id, char **link_return,
+ int add_debug_suffix)
+ const bfd_byte *build_id, char **link_return)
{
+ gdb_bfd_ref_ptr ret_bfd = {};
+ std::string ret_link;
@ -524,9 +551,6 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
- {
- if (separate_debug_file_debug)
- printf_unfiltered (_(" no, unable to open.\n"));
+ if (add_debug_suffix)
+ link += ".debug";
+
+ ret_link = link;
+
+ struct stat statbuf_trash;
@ -551,7 +575,8 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
+
+ continue;
+ }
+
- return {};
+ /* We expect to be silent on the non-existing files. */
+ gdb_bfd_ref_ptr debug_bfd = gdb_bfd_open (filename.get (), gnutarget, -1);
+
@ -570,8 +595,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
+
+ continue;
+ }
- return {};
+
+ ret_bfd = debug_bfd;
+ break;
}
@ -583,6 +607,8 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
{
if (separate_debug_file_debug)
- printf_unfiltered (_(" no, build-id does not match.\n"));
-
- return {};
+ printf_unfiltered (_(" yes!\n"));
+ }
+ else
@ -591,15 +617,11 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
+ always the non-.%u-suffixed file. */
+ std::string link0 = orig_link;
+
+ if (add_debug_suffix)
+ link0 += ".debug";
+
+ /* If the symlink has target request to install the target.
+ BASE-debuginfo.rpm contains the symlink but BASE.rpm may be missing.
+ https://bugzilla.redhat.com/show_bug.cgi?id=981154 */
+ std::string link0_resolved (link_resolve (link0.c_str (), 0));
- return {};
+
+ if (link_all.empty ())
+ link_all = link0_resolved;
+ else
@ -628,16 +650,17 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
+ return ret_bfd;
}
/* See build-id.h. */
/* Common code for finding BFDs of a given build-id. This function
@@ -124,7 +627,7 @@ build_id_to_debug_bfd_1 (const std::string &link, size_t build_id_len,
gdb_bfd_ref_ptr
-build_id_to_debug_bfd (size_t build_id_len, const bfd_byte *build_id)
+build_id_to_debug_bfd (size_t build_id_len, const bfd_byte *build_id,
+ char **link_return, int add_debug_suffix)
static gdb_bfd_ref_ptr
build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id,
- const char *suffix)
+ const char *suffix, char **link_return)
{
/* Keep backward compatibility so that DEBUG_FILE_DIRECTORY being "" will
cause "/.build-id/..." lookups. */
@@ -143,16 +652,16 @@ build_id_to_debug_bfd (size_t build_id_len, const bfd_byte *build_id)
@@ -147,16 +650,17 @@ build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id,
if (size > 0)
{
size--;
@ -650,26 +673,25 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
while (size-- > 0)
string_appendf (link, "%02x", (unsigned) *data++);
- link += ".debug";
-
link += suffix;
gdb_bfd_ref_ptr debug_bfd
- = build_id_to_debug_bfd_1 (link, build_id_len, build_id);
+ = build_id_to_debug_bfd_1 (link, build_id_len, build_id,
+ link_return, add_debug_suffix);
+ = build_id_to_debug_bfd_1 (link, build_id_len, build_id, link_return);
if (debug_bfd != NULL)
return debug_bfd;
@@ -166,7 +675,8 @@ build_id_to_debug_bfd (size_t build_id_len, const bfd_byte *build_id)
@@ -170,7 +674,8 @@ build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id,
if (strcmp (gdb_sysroot, TARGET_SYSROOT_PREFIX) != 0)
{
link = gdb_sysroot + link;
- debug_bfd = build_id_to_debug_bfd_1 (link, build_id_len, build_id);
+ debug_bfd = build_id_to_debug_bfd_1 (link, build_id_len, build_id,
+ link_return, add_debug_suffix);
+ link_return);
if (debug_bfd != NULL)
return debug_bfd;
}
@@ -175,22 +685,190 @@ build_id_to_debug_bfd (size_t build_id_len, const bfd_byte *build_id)
@@ -179,38 +684,208 @@ build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id,
return {};
}
@ -679,12 +701,11 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
+ gdb_bfd_ref_ptr abfd;
+ char *result;
+
+ abfd = build_id_to_debug_bfd (build_id->size, build_id->data, link_return, 0);
+ abfd = build_id_to_exec_bfd (build_id->size, build_id->data, link_return);
+ if (abfd == NULL)
+ return NULL;
+
+ result = xstrdup (bfd_get_filename (abfd));
+ abfd.release ();
+ result = xstrdup (bfd_get_filename (abfd.get ()));
+ return result;
+}
+
@ -826,6 +847,29 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
+
/* See build-id.h. */
gdb_bfd_ref_ptr
-build_id_to_debug_bfd (size_t build_id_len, const bfd_byte *build_id)
+build_id_to_debug_bfd (size_t build_id_len, const bfd_byte *build_id,
+ char **link_return)
{
- return build_id_to_bfd_suffix (build_id_len, build_id, ".debug");
+ return build_id_to_bfd_suffix (build_id_len, build_id, ".debug",
+ link_return);
}
/* See build-id.h. */
gdb_bfd_ref_ptr
-build_id_to_exec_bfd (size_t build_id_len, const bfd_byte *build_id)
+build_id_to_exec_bfd (size_t build_id_len, const bfd_byte *build_id,
+ char **link_return)
{
- return build_id_to_bfd_suffix (build_id_len, build_id, "");
+ return build_id_to_bfd_suffix (build_id_len, build_id, "", link_return);
}
/* See build-id.h. */
std::string
-find_separate_debug_file_by_buildid (struct objfile *objfile)
+find_separate_debug_file_by_buildid (struct objfile *objfile,
@ -848,7 +892,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
gdb_bfd_ref_ptr abfd (build_id_to_debug_bfd (build_id->size,
- build_id->data));
+ build_id->data,
+ (!build_id_filename_return ? NULL : &build_id_filename_cstr), 1));
+ (!build_id_filename_return ? NULL : &build_id_filename_cstr)));
+ if (build_id_filename_return)
+ {
+ if (!build_id_filename_cstr)
@ -863,7 +907,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
/* Prevent looping on a stripped .debug file. */
if (abfd != NULL
&& filename_cmp (bfd_get_filename (abfd.get ()),
@@ -203,3 +881,21 @@ find_separate_debug_file_by_buildid (struct objfile *objfile)
@@ -223,3 +898,21 @@ find_separate_debug_file_by_buildid (struct objfile *objfile)
return std::string ();
}
@ -890,7 +934,7 @@ diff --git a/gdb/build-id.h b/gdb/build-id.h
+++ b/gdb/build-id.h
@@ -23,9 +23,10 @@
#include "gdb_bfd.h"
#include "common/rsp-low.h"
#include "gdbsupport/rsp-low.h"
-/* Locate NT_GNU_BUILD_ID from ABFD and return its content. */
+/* Separate debuginfo files have corrupted PHDR but SHDR is correct there.
@ -901,16 +945,24 @@ diff --git a/gdb/build-id.h b/gdb/build-id.h
/* Return true if ABFD has NT_GNU_BUILD_ID matching the CHECK value.
Otherwise, issue a warning and return false. */
@@ -39,14 +40,19 @@ extern int build_id_verify (bfd *abfd,
the caller. */
@@ -38,21 +39,26 @@ extern int build_id_verify (bfd *abfd,
can be found, return NULL. */
extern gdb_bfd_ref_ptr build_id_to_debug_bfd (size_t build_id_len,
- const bfd_byte *build_id);
+ const bfd_byte *build_id,
+ char **link_return,
+ int add_debug_suffix);
+ char **link_return);
+
+extern char *build_id_to_filename (const struct bfd_build_id *build_id,
+ char **link_return);
/* Find and open a BFD for an executable file given a build-id. If no BFD
can be found, return NULL. The returned reference to the BFD must be
released by the caller. */
extern gdb_bfd_ref_ptr build_id_to_exec_bfd (size_t build_id_len,
- const bfd_byte *build_id);
+ const bfd_byte *build_id,
+ char **link_return);
/* Find the separate debug file for OBJFILE, by using the build-id
@ -927,7 +979,7 @@ diff --git a/gdb/build-id.h b/gdb/build-id.h
diff --git a/gdb/coffread.c b/gdb/coffread.c
--- a/gdb/coffread.c
+++ b/gdb/coffread.c
@@ -732,7 +732,8 @@ coff_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
@@ -709,7 +709,8 @@ coff_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
/* Try to add separate debug file if no symbols table found. */
if (!objfile_has_partial_symbols (objfile))
{
@ -940,88 +992,55 @@ diff --git a/gdb/coffread.c b/gdb/coffread.c
diff --git a/gdb/corelow.c b/gdb/corelow.c
--- a/gdb/corelow.c
+++ b/gdb/corelow.c
@@ -43,6 +43,10 @@
#include "gdb_bfd.h"
#include "completer.h"
#include "common/filestuff.h"
@@ -22,6 +22,10 @@
#include <signal.h>
#include <fcntl.h>
#include "frame.h" /* required by inferior.h */
+#include "auxv.h"
+#include "build-id.h"
+#include "elf/common.h"
+#include "gdbcmd.h"
+#include "build-id.h"
#ifndef O_LARGEFILE
#define O_LARGEFILE 0
@@ -320,6 +324,54 @@ add_to_thread_list (bfd *abfd, asection *asect, void *reg_sect_arg)
#include "inferior.h"
#include "infrun.h"
#include "symtab.h"
@@ -322,6 +326,8 @@ add_to_thread_list (bfd *abfd, asection *asect, void *reg_sect_arg)
inferior_ptid = ptid; /* Yes, make it current. */
}
+static int build_id_core_loads = 1;
+
+static void
+build_id_locate_exec (int from_tty)
+{
+ CORE_ADDR at_entry;
+ struct bfd_build_id *build_id;
+ char *execfilename;
+ char *build_id_filename;
+ struct cleanup *back_to;
+
+ if (exec_bfd != NULL || symfile_objfile != NULL)
+ return;
+
+ if (target_auxv_search (current_top_target (), AT_ENTRY, &at_entry) <= 0)
+ return;
+
+ build_id = build_id_addr_get (at_entry);
+ if (build_id == NULL)
+ return;
+ back_to = make_cleanup (xfree, build_id);
+
+ /* SYMFILE_OBJFILE should refer to the main executable (not only to its
+ separate debug info file). gcc44+ keeps .eh_frame only in the main
+ executable without its duplicate .debug_frame in the separate debug info
+ file - such .eh_frame would not be found if SYMFILE_OBJFILE would refer
+ directly to the separate debug info file. */
+
+ execfilename = build_id_to_filename (build_id, &build_id_filename);
+ make_cleanup (xfree, build_id_filename);
+
+ if (execfilename != NULL)
+ {
+ make_cleanup (xfree, execfilename);
+ exec_file_attach (execfilename, from_tty);
+ symbol_file_add_main (execfilename,
+ symfile_add_flag (!from_tty ? 0 : SYMFILE_VERBOSE));
+ if (symfile_objfile != NULL)
+ symfile_objfile->flags |= OBJF_BUILD_ID_CORE_LOADED;
+ }
+ else
+ debug_print_missing (_("the main executable file"), build_id_filename);
+
+ do_cleanups (back_to);
+
+ /* No automatic SOLIB_ADD as the libraries would get read twice. */
+}
+static bool build_id_core_loads = true;
+
/* Issue a message saying we have no core to debug, if FROM_TTY. */
static void
@@ -455,6 +507,14 @@ core_target_open (const char *arg, int from_tty)
switch_to_thread (thread);
@@ -358,19 +364,25 @@ core_file_command (const char *filename, int from_tty)
static void
locate_exec_from_corefile_build_id (bfd *abfd, int from_tty)
{
- const bfd_build_id *build_id = build_id_bfd_get (abfd);
+ const bfd_build_id *build_id = build_id_bfd_shdr_get (abfd);
if (build_id == nullptr)
return;
+ char *build_id_filename;
gdb_bfd_ref_ptr execbfd
- = build_id_to_exec_bfd (build_id->size, build_id->data);
+ = build_id_to_exec_bfd (build_id->size, build_id->data,
+ &build_id_filename);
if (execbfd != nullptr)
{
exec_file_attach (bfd_get_filename (execbfd.get ()), from_tty);
symbol_file_add_main (bfd_get_filename (execbfd.get ()),
symfile_add_flag (from_tty ? SYMFILE_VERBOSE : 0));
+ if (symfile_objfile != NULL)
+ symfile_objfile->flags |= OBJF_BUILD_ID_CORE_LOADED;
}
+ else
+ debug_print_missing (BUILD_ID_MAIN_EXECUTABLE_FILENAME, build_id_filename);
}
+ /* Find the build_id identifiers. If it gets executed after
+ POST_CREATE_INFERIOR we would clash with asking to discard the already
+ loaded VDSO symbols. If it gets executed before bfd_map_over_sections
+ INFERIOR_PTID is still not set and libthread_db initialization crashes on
+ PID == 0 in ps_pglobal_lookup. */
+ if (build_id_core_loads != 0)
+ build_id_locate_exec (from_tty);
+
post_create_inferior (target, from_tty);
/* Now go through the target stack looking for threads since there
@@ -1063,4 +1123,11 @@ void
/* See gdbcore.h. */
@@ -998,4 +1010,11 @@ void
_initialize_corelow (void)
{
add_target (core_target_info, core_target_open, filename_completer);
@ -1036,7 +1055,7 @@ diff --git a/gdb/corelow.c b/gdb/corelow.c
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -19949,6 +19949,27 @@ information files.
@@ -20862,6 +20862,27 @@ information files.
@end table
@ -1067,28 +1086,38 @@ diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
diff --git a/gdb/dwarf-index-cache.c b/gdb/dwarf-index-cache.c
--- a/gdb/dwarf-index-cache.c
+++ b/gdb/dwarf-index-cache.c
@@ -93,7 +93,7 @@ index_cache::store (struct dwarf2_per_objfile *dwarf2_per_objfile)
if (!enabled ())
@@ -94,7 +94,7 @@ index_cache::store (struct dwarf2_per_objfile *dwarf2_per_objfile)
return;
/* Get build id of objfile. */
- const bfd_build_id *build_id = build_id_bfd_get (obj->obfd);
+ const bfd_build_id *build_id = build_id_bfd_shdr_get (obj->obfd);
if (build_id == nullptr)
{
if (debug_index_cache)
@@ -112,7 +112,8 @@ index_cache::store (struct dwarf2_per_objfile *dwarf2_per_objfile)
if (dwz != nullptr)
{
- const bfd_build_id *dwz_build_id = build_id_bfd_get (dwz->dwz_bfd.get ());
+ const bfd_build_id *dwz_build_id
+ = build_id_bfd_shdr_get (dwz->dwz_bfd.get ());
if (dwz_build_id == nullptr)
{
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -2727,7 +2727,7 @@ dwarf2_get_dwz_file (struct dwarf2_per_objfile *dwarf2_per_objfile)
@@ -2718,7 +2718,7 @@ dwarf2_get_dwz_file (struct dwarf2_per_objfile *dwarf2_per_objfile)
}
if (dwz_bfd == NULL)
- dwz_bfd = build_id_to_debug_bfd (buildid_len, buildid);
+ dwz_bfd = build_id_to_debug_bfd (buildid_len, buildid, NULL, 1);
+ dwz_bfd = build_id_to_debug_bfd (buildid_len, buildid, NULL);
if (dwz_bfd == NULL)
error (_("could not find '.gnu_debugaltlink' file for %s"),
@@ -6237,7 +6237,7 @@ get_gdb_index_contents_from_section (objfile *obj, T *section_owner)
@@ -6276,7 +6276,7 @@ get_gdb_index_contents_from_section (objfile *obj, T *section_owner)
static gdb::array_view<const gdb_byte>
get_gdb_index_contents_from_cache (objfile *obj, dwarf2_per_objfile *dwarf2_obj)
{
@ -1097,7 +1126,7 @@ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
if (build_id == nullptr)
return {};
@@ -6250,7 +6250,7 @@ get_gdb_index_contents_from_cache (objfile *obj, dwarf2_per_objfile *dwarf2_obj)
@@ -6289,7 +6289,7 @@ get_gdb_index_contents_from_cache (objfile *obj, dwarf2_per_objfile *dwarf2_obj)
static gdb::array_view<const gdb_byte>
get_gdb_index_contents_from_cache_dwz (objfile *obj, dwz_file *dwz)
{
@ -1109,7 +1138,7 @@ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
diff --git a/gdb/elfread.c b/gdb/elfread.c
--- a/gdb/elfread.c
+++ b/gdb/elfread.c
@@ -1287,7 +1287,9 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
@@ -1299,7 +1299,9 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
&& objfile->separate_debug_objfile == NULL
&& objfile->separate_debug_objfile_backlink == NULL)
{
@ -1120,22 +1149,26 @@ diff --git a/gdb/elfread.c b/gdb/elfread.c
if (debugfile.empty ())
debugfile = find_separate_debug_file_by_debuglink (objfile);
@@ -1299,6 +1301,10 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
@@ -1311,8 +1313,12 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
symbol_file_add_separate (debug_bfd.get (), debugfile.c_str (),
symfile_flags, objfile);
}
- else
- has_dwarf2 = false;
+ /* Check if any separate debug info has been extracted out. */
+ else if (bfd_get_section_by_name (objfile->obfd, ".gnu_debuglink")
+ != NULL)
+ debug_print_missing (objfile_name (objfile), build_id_filename.get ());
}
+ else
+ has_dwarf2 = false;
}
/* Read the CTF section only if there is no DWARF info. */
diff --git a/gdb/objfiles.h b/gdb/objfiles.h
--- a/gdb/objfiles.h
+++ b/gdb/objfiles.h
@@ -554,6 +554,10 @@ struct objfile
htab_t static_links {};
@@ -627,6 +627,10 @@ struct objfile
htab_up static_links;
};
+/* This file was loaded according to the BUILD_ID_CORE_LOADS rules. */
@ -1150,14 +1183,14 @@ diff --git a/gdb/python/py-objfile.c b/gdb/python/py-objfile.c
+++ b/gdb/python/py-objfile.c
@@ -132,7 +132,7 @@ objfpy_get_build_id (PyObject *self, void *closure)
TRY
try
{
- build_id = build_id_bfd_get (objfile->obfd);
+ build_id = build_id_bfd_shdr_get (objfile->obfd);
}
CATCH (except, RETURN_MASK_ALL)
catch (const gdb_exception &except)
{
@@ -535,7 +535,7 @@ objfpy_lookup_objfile_by_build_id (const char *build_id)
@@ -600,7 +600,7 @@ objfpy_lookup_objfile_by_build_id (const char *build_id)
/* Don't return separate debug files. */
if (objfile->separate_debug_objfile_backlink != NULL)
continue;
@ -1177,7 +1210,7 @@ diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
static struct link_map_offsets *svr4_fetch_link_map_offsets (void);
static int svr4_have_link_map_offsets (void);
@@ -1345,9 +1346,51 @@ svr4_read_so_list (CORE_ADDR lm, CORE_ADDR prev_lm,
@@ -1344,9 +1345,51 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm,
continue;
}
@ -1235,10 +1268,17 @@ diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
diff --git a/gdb/symfile.h b/gdb/symfile.h
--- a/gdb/symfile.h
+++ b/gdb/symfile.h
@@ -531,6 +531,10 @@ void expand_symtabs_matching
@@ -532,12 +532,17 @@ void expand_symtabs_matching
void map_symbol_filenames (symbol_filename_ftype *fun, void *data,
int need_fullname);
+
/* Target-agnostic function to load the sections of an executable into memory.
ARGS should be in the form "EXECUTABLE [OFFSET]", where OFFSET is an
optional offset to apply to each section. */
extern void generic_load (const char *args, int from_tty);
+/* build-id support. */
+extern struct bfd_build_id *build_id_addr_get (CORE_ADDR addr);
+extern void debug_print_missing (const char *binary, const char *debug);
@ -1297,10 +1337,10 @@ diff --git a/gdb/testsuite/gdb.base/new-ui-pending-input.exp b/gdb/testsuite/gdb
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -1716,6 +1716,16 @@ proc default_gdb_start { } {
warning "Couldn't set the width to 0."
@@ -1891,6 +1891,17 @@ proc default_gdb_start { } {
}
}
+ # Turn off the missing warnings as the testsuite does not expect it.
+ send_gdb "set build-id-verbose 0\n"
+ gdb_expect 10 {
@ -1311,9 +1351,10 @@ diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
+ warning "Could not disable the missing debug infos warnings.."
+ }
+ }
+
gdb_debug_init
return 0
}
diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp
--- a/gdb/testsuite/lib/mi-support.exp
+++ b/gdb/testsuite/lib/mi-support.exp

View File

@ -1,78 +0,0 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-6.6-scheduler_locking-step-is-default.patch
;; Make upstream `set scheduler-locking step' as default.
;;=push+jan: How much is scheduler-locking relevant after non-stop?
diff --git a/gdb/infrun.c b/gdb/infrun.c
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -2075,7 +2075,7 @@ static const char *const scheduler_enums[] = {
schedlock_replay,
NULL
};
-static const char *scheduler_mode = schedlock_replay;
+static const char *scheduler_mode = schedlock_step;
static void
show_scheduler_mode (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
diff --git a/gdb/testsuite/gdb.mi/mi-cli.exp b/gdb/testsuite/gdb.mi/mi-cli.exp
--- a/gdb/testsuite/gdb.mi/mi-cli.exp
+++ b/gdb/testsuite/gdb.mi/mi-cli.exp
@@ -199,7 +199,7 @@ mi_expect_stop "breakpoint-hit" "main" "" ".*basics.c" \
# Test that the token is output even for CLI commands
# Also test that *stopped includes frame information.
mi_gdb_test "34 next" \
- ".*34\\\^running.*\\*running,thread-id=\"all\"" \
+ ".*34\\\^running.*\\*running,thread-id=\"1\"" \
"34 next: run"
# Test that the new current source line is output to the console
diff --git a/gdb/testsuite/gdb.mi/mi-console.exp b/gdb/testsuite/gdb.mi/mi-console.exp
--- a/gdb/testsuite/gdb.mi/mi-console.exp
+++ b/gdb/testsuite/gdb.mi/mi-console.exp
@@ -60,6 +60,9 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
mi_run_to_main
+# thread-id=\"all\" vs. thread-id=\"1\" below:
+mi_gdb_test "210-gdb-set scheduler-locking off" "210\\^done" "set scheduler-locking off"
+
# The output we get from the target depends on how it is hosted. If
# we are semihosted (e.g., the sim or a remote target that supports
# the File I/O remote protocol extension), we see the target I/O
diff --git a/gdb/testsuite/gdb.mi/mi-logging.exp b/gdb/testsuite/gdb.mi/mi-logging.exp
--- a/gdb/testsuite/gdb.mi/mi-logging.exp
+++ b/gdb/testsuite/gdb.mi/mi-logging.exp
@@ -53,7 +53,7 @@ close $chan
set mi_log_prompt "\[(\]gdb\[)\] \[\r\n\]+"
-if [regexp "\\^done\[\r\n\]+$mi_log_prompt\\^running\[\r\n\]+\\*running,thread-id=\"all\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt\\^running\[\r\n\]+\\*running,thread-id=\"all\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt" $logcontent] {
+if [regexp "\\^done\[\r\n\]+$mi_log_prompt\\^running\[\r\n\]+\\*running,thread-id=\"1\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt\\^running\[\r\n\]+\\*running,thread-id=\"1\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt" $logcontent] {
pass "log file contents"
} else {
fail "log file contents"
@@ -76,7 +76,7 @@ set chan [open $milogfile]
set logcontent [read $chan]
close $chan
-if [regexp "1001\\^done\[\r\n\]+$mi_log_prompt.*1002\\^running\[\r\n\]+\\*running,thread-id=\"all\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt.*1003\\^running\[\r\n\]+\\*running,thread-id=\"all\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt" $logcontent] {
+if [regexp "1001\\^done\[\r\n\]+$mi_log_prompt.*1002\\^running\[\r\n\]+\\*running,thread-id=\"1\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt.*1003\\^running\[\r\n\]+\\*running,thread-id=\"1\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt" $logcontent] {
pass "redirect log file contents"
} else {
fail "redirect log file contents"
diff --git a/gdb/testsuite/gdb.opt/inline-cmds.exp b/gdb/testsuite/gdb.opt/inline-cmds.exp
--- a/gdb/testsuite/gdb.opt/inline-cmds.exp
+++ b/gdb/testsuite/gdb.opt/inline-cmds.exp
@@ -331,7 +331,7 @@ proc mi_cli_step {cli_output_re message} {
send_gdb "interpreter-exec console \"step\"\n"
gdb_expect {
- -re "\\^running\r\n\\*running,thread-id=\"all\"\r\n${mi_gdb_prompt}${cli_output_re}" {
+ -re "\\^running\r\n\\*running,thread-id=\"1\"\r\n${mi_gdb_prompt}${cli_output_re}" {
pass $message
}
timeout {

View File

@ -1,37 +0,0 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-6.8-bz436037-reg-no-longer-active.patch
;; Fix register assignments with no GDB stack frames (BZ 436037).
;;=push+jan: This fix is incorrect.
diff --git a/gdb/valops.c b/gdb/valops.c
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -1092,6 +1092,8 @@ value_assign (struct value *toval, struct value *fromval)
struct gdbarch *gdbarch;
int value_reg;
+ value_reg = VALUE_REGNUM (toval);
+
/* Figure out which frame this is in currently.
We use VALUE_FRAME_ID for obtaining the value's frame id instead of
@@ -1101,8 +1103,14 @@ value_assign (struct value *toval, struct value *fromval)
frame. */
frame = frame_find_by_id (VALUE_FRAME_ID (toval));
- value_reg = VALUE_REGNUM (toval);
-
+ /* "set $reg+=1" should work on programs with no debug info,
+ but frame_find_by_id returns NULL here (RH bug 436037).
+ Use current frame, it represents CPU state in this case.
+ If frame_find_by_id is changed to do it internally
+ (it is contemplated there), remove this. */
+ if (!frame)
+ frame = get_current_frame ();
+ /* Probably never happens. */
if (!frame)
error (_("Value being assigned to is no longer active."));

View File

@ -30,7 +30,7 @@ diff --git a/gdb/defs.h b/gdb/defs.h
diff --git a/gdb/extension.c b/gdb/extension.c
--- a/gdb/extension.c
+++ b/gdb/extension.c
@@ -820,6 +820,11 @@ check_quit_flag (void)
@@ -823,6 +823,11 @@ check_quit_flag (void)
int i, result = 0;
const struct extension_language_defn *extlang;
@ -45,7 +45,7 @@ diff --git a/gdb/extension.c b/gdb/extension.c
diff --git a/gdb/top.c b/gdb/top.c
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -1626,7 +1626,13 @@ quit_force (int *exit_arg, int from_tty)
@@ -1703,7 +1703,13 @@ quit_force (int *exit_arg, int from_tty)
qt.from_tty = from_tty;
@ -58,13 +58,13 @@ diff --git a/gdb/top.c b/gdb/top.c
+#endif
/* Get out of tfind mode, and kill or detach all inferiors. */
TRY
try
diff --git a/gdb/utils.c b/gdb/utils.c
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -100,6 +100,13 @@ static std::chrono::steady_clock::duration prompt_for_continue_wait_time;
@@ -102,6 +102,13 @@ static std::chrono::steady_clock::duration prompt_for_continue_wait_time;
static int debug_timestamp = 0;
static bool debug_timestamp = false;
+#ifdef NEED_DETACH_SIGSTOP
+/* Nonzero means we are already processing the quitting cleanups and we should
@ -73,6 +73,6 @@ diff --git a/gdb/utils.c b/gdb/utils.c
+int quit_flag_cleanup;
+#endif
+
/* Nonzero means that strings with character values >0x7F should be printed
as octal escapes. Zero means just print the value (e.g. it's an
/* True means that strings with character values >0x7F should be printed
as octal escapes. False means just print the value (e.g. it's an
international character, and the terminal or window can cope.) */

View File

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

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

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

View File

@ -1,238 +0,0 @@
commit ba354106f02e25c9adc3dc1364d6a974216ec94e
Author: Andreas Krebbel <krebbel@linux.ibm.com>
Date: Tue Mar 12 14:09:55 2019 +0100
S/390: arch13: Add instruction descriptions
opcodes/ChangeLog:
2019-03-12 Andreas Krebbel <krebbel@linux.ibm.com>
* s390-opc.txt: Add instruction descriptions.
diff --git a/opcodes/s390-opc.txt b/opcodes/s390-opc.txt
index be4c97d..58a2490 100644
--- a/opcodes/s390-opc.txt
+++ b/opcodes/s390-opc.txt
@@ -1888,106 +1888,120 @@ e70000000036 vlm VRS_VVRDU "vector load multiple" arch12 zarch optparm
e7000000000e vst VRX_VRRDU "vector store" arch12 zarch optparm
e7000000003e vstm VRS_VVRDU "vector store multiple" arch12 zarch optparm
+
# arch13 instructions
-b9f5 ncrk RRF_R0RR2 " " arch13 zarch
-b9e5 ncgrk RRF_R0RR2 " " arch13 zarch
-e50a mvcrl SSE_RDRD " " arch13 zarch
-b974 nnrk RRF_R0RR2 " " arch13 zarch
-b964 nngrk RRF_R0RR2 " " arch13 zarch
-b976 nork RRF_R0RR2 " " arch13 zarch
-b966 nogrk RRF_R0RR2 " " arch13 zarch
-b977 nxrk RRF_R0RR2 " " arch13 zarch
-b967 nxgrk RRF_R0RR2 " " arch13 zarch
-b975 ocrk RRF_R0RR2 " " arch13 zarch
-b965 ocgrk RRF_R0RR2 " " arch13 zarch
-b9e1 popcnt RRF_U0RR " " arch13 zarch optparm
-b9f0 selr RRF_RURR " " arch13 zarch
-b9f00000 selr*20 RRF_R0RR3 " " arch13 zarch
-b9e3 selgr RRF_RURR " " arch13 zarch
-b9e30000 selgr*20 RRF_R0RR3 " " arch13 zarch
-b9c0 selhhhr RRF_RURR " " arch13 zarch
-b9c00000 selhhhr*20 RRF_R0RR3 " " arch13 zarch
-
-e60000000006 vlbr VRX_VRRDU " " arch13 zarch
-e60000001006 vlbrh VRX_VRRD " " arch13 zarch
-e60000002006 vlbrf VRX_VRRD " " arch13 zarch
-e60000003006 vlbrg VRX_VRRD " " arch13 zarch
-e60000004006 vlbrq VRX_VRRD " " arch13 zarch
-
-e60000000007 vler VRX_VRRDU " " arch13 zarch
-e60000001007 vlerh VRX_VRRD " " arch13 zarch
-e60000002007 vlerf VRX_VRRD " " arch13 zarch
-e60000003007 vlerg VRX_VRRD " " arch13 zarch
-
-e60000000004 vllebrz VRX_VRRDU " " arch13 zarch
-e60000001004 vllebrzh VRX_VRRD " " arch13 zarch
-e60000002004 vllebrzf VRX_VRRD " " arch13 zarch
-e60000003004 ldrv VRX_VRRD " " arch13 zarch
-e60000003004 vllebrzg VRX_VRRD " " arch13 zarch
-e60000006004 lerv VRX_VRRD " " arch13 zarch
-e60000006004 vllebrze VRX_VRRD " " arch13 zarch
-
-e60000000001 vlebrh VRX_VRRDU " " arch13 zarch
-e60000000003 vlebrf VRX_VRRDU " " arch13 zarch
-e60000000002 vlebrg VRX_VRRDU " " arch13 zarch
-
-e60000000005 vlbrrep VRX_VRRDU " " arch13 zarch
-e60000001005 vlbrreph VRX_VRRD " " arch13 zarch
-e60000002005 vlbrrepf VRX_VRRD " " arch13 zarch
-e60000003005 vlbrrepg VRX_VRRD " " arch13 zarch
-
-e6000000000e vstbr VRX_VRRDU " " arch13 zarch
-e6000000100e vstbrh VRX_VRRD " " arch13 zarch
-e6000000200e vstbrf VRX_VRRD " " arch13 zarch
-e6000000300e vstbrg VRX_VRRD " " arch13 zarch
-e6000000400e vstbrq VRX_VRRD " " arch13 zarch
-
-e6000000000f vster VRX_VRRDU " " arch13 zarch
-e6000000100f vsterh VRX_VRRD " " arch13 zarch
-e6000000200f vsterf VRX_VRRD " " arch13 zarch
-e6000000300f vsterg VRX_VRRD " " arch13 zarch
-
-e60000000009 vstebrh VRX_VRRDU " " arch13 zarch
-e6000000000b vstebrf VRX_VRRDU " " arch13 zarch
-e6000000000b sterv VRX_VRRD " " arch13 zarch
-e6000000000a vstebrg VRX_VRRDU " " arch13 zarch
-e6000000000a stdrv VRX_VRRD " " arch13 zarch
-
-e70000000086 vsld VRI_VVV0U " " arch13 zarch
-e70000000087 vsrd VRI_VVV0U " " arch13 zarch
-
-e7000000008b vstrs VRR_VVVUU0V " " arch13 zarch optparm
-
-e7000000008b vstrsb VRR_VVVU0VB " " arch13 zarch optparm
-e7000100008b vstrsh VRR_VVVU0VB " " arch13 zarch optparm
-e7000200008b vstrsf VRR_VVVU0VB " " arch13 zarch optparm
-
-e7000020008b vstrszb VRR_VVVU0VB2 " " arch13 zarch optparm
-e7000120008b vstrszh VRR_VVVU0VB2 " " arch13 zarch optparm
-e7000220008b vstrszf VRR_VVVU0VB2 " " arch13 zarch optparm
-
-e700000000c3 vcfps VRR_VV0UUU " " arch13 zarch
-e700000020c3 vcefb VRR_VV0UU " " arch13 zarch
-e700000820c3 wcefb VRR_VV0UU8 " " arch13 zarch
-
-e700000000c1 vcfpl VRR_VV0UUU " " arch13 zarch
-e700000020c1 vcelfb VRR_VV0UU " " arch13 zarch
-e700000820c1 wcelfb VRR_VV0UU8 " " arch13 zarch
-
-e700000000c2 vcsfp VRR_VV0UUU " " arch13 zarch
-e700000020c2 vcfeb VRR_VV0UU " " arch13 zarch
-e700000820c2 wcfeb VRR_VV0UU8 " " arch13 zarch
-
-e700000000c0 vclfp VRR_VV0UUU " " arch13 zarch
-e700000020c0 vclfeb VRR_VV0UU " " arch13 zarch
-e700000820c0 wclfeb VRR_VV0UU8 " " arch13 zarch
-
-b939 dfltcc RRF_R0RR2 " " arch13 zarch
-
-b938 sortl RRE_RR " " arch13 zarch
-
-e60000000050 vcvb VRR_RV0UU " " arch13 zarch optparm
-e60000000052 vcvbg VRR_RV0UU " " arch13 zarch optparm
-
-b93a kdsa RRE_RR " " arch13 zarch
+
+# Miscellaneous Instruction Extensions Facility 2
+
+b9f5 ncrk RRF_R0RR2 "and with complement 32 bit" arch13 zarch
+b9e5 ncgrk RRF_R0RR2 "and with complement 64 bit" arch13 zarch
+e50a mvcrl SSE_RDRD "move right to left" arch13 zarch
+b974 nnrk RRF_R0RR2 "nand 32 bit" arch13 zarch
+b964 nngrk RRF_R0RR2 "nand 64 bit" arch13 zarch
+b976 nork RRF_R0RR2 "nor 32 bit" arch13 zarch
+b966 nogrk RRF_R0RR2 "nor 64 bit" arch13 zarch
+b977 nxrk RRF_R0RR2 "not exclusive or 32 bit" arch13 zarch
+b967 nxgrk RRF_R0RR2 "not exclusive or 64 bit" arch13 zarch
+b975 ocrk RRF_R0RR2 "or with complement 32 bit" arch13 zarch
+b965 ocgrk RRF_R0RR2 "or with complement 64 bit" arch13 zarch
+b9e1 popcnt RRF_U0RR "population count arch13" arch13 zarch optparm
+b9f0 selr RRF_RURR "select 32 bit" arch13 zarch
+b9f00000 selr*20 RRF_R0RR3 "select 32 bit" arch13 zarch
+b9e3 selgr RRF_RURR "select 64 bit" arch13 zarch
+b9e30000 selgr*20 RRF_R0RR3 "select 64 bit" arch13 zarch
+b9c0 selhhhr RRF_RURR "select high" arch13 zarch
+b9c00000 selhhhr*20 RRF_R0RR3 "select high" arch13 zarch
+
+# Vector Enhancements Facility 2
+
+e60000000006 vlbr VRX_VRRDU "vector load byte reversed elements" arch13 zarch
+e60000001006 vlbrh VRX_VRRD "vector load byte reversed halfword elements" arch13 zarch
+e60000002006 vlbrf VRX_VRRD "vector load byte reversed word elements" arch13 zarch
+e60000003006 vlbrg VRX_VRRD "vector load byte reversed doubleword elements" arch13 zarch
+e60000004006 vlbrq VRX_VRRD "vector load byte reversed quadword elements" arch13 zarch
+
+e60000000007 vler VRX_VRRDU "vector load elements reversed" arch13 zarch
+e60000001007 vlerh VRX_VRRD "vector load halfword elements reversed" arch13 zarch
+e60000002007 vlerf VRX_VRRD "vector load word elements reversed" arch13 zarch
+e60000003007 vlerg VRX_VRRD "vector load doubleword elements reversed" arch13 zarch
+
+e60000000004 vllebrz VRX_VRRDU "vector load byte reversed element and zero" arch13 zarch
+e60000001004 vllebrzh VRX_VRRD "vector load byte reversed halfword element and zero" arch13 zarch
+e60000002004 vllebrzf VRX_VRRD "vector load byte reversed word element and zero" arch13 zarch
+e60000003004 ldrv VRX_VRRD "load byte reversed doubleword" arch13 zarch
+e60000003004 vllebrzg VRX_VRRD "vector load byte reversed doubleword element and zero" arch13 zarch
+e60000006004 lerv VRX_VRRD "load byte reversed word" arch13 zarch
+e60000006004 vllebrze VRX_VRRD "vector load byte reversed word element left-aligned and zero" arch13 zarch
+
+e60000000001 vlebrh VRX_VRRDU "vector load byte reversed halfword element" arch13 zarch
+e60000000003 vlebrf VRX_VRRDU "vector load byte reversed word element" arch13 zarch
+e60000000002 vlebrg VRX_VRRDU "vector load byte reversed doubleword element" arch13 zarch
+
+e60000000005 vlbrrep VRX_VRRDU "vector load byte reversed element and replicate" arch13 zarch
+e60000001005 vlbrreph VRX_VRRD "vector load byte reversed halfword element and replicate" arch13 zarch
+e60000002005 vlbrrepf VRX_VRRD "vector load byte reversed word element and replicate" arch13 zarch
+e60000003005 vlbrrepg VRX_VRRD "vector load byte reversed doubleword element and replicate" arch13 zarch
+
+e6000000000e vstbr VRX_VRRDU "vector store byte reversed elements" arch13 zarch
+e6000000100e vstbrh VRX_VRRD "vector store byte reversed halfword elements" arch13 zarch
+e6000000200e vstbrf VRX_VRRD "vector store byte reversed word elements" arch13 zarch
+e6000000300e vstbrg VRX_VRRD "vector store byte reversed doubleword elements" arch13 zarch
+e6000000400e vstbrq VRX_VRRD "vector store byte reversed quadword elements" arch13 zarch
+
+e6000000000f vster VRX_VRRDU "vector store elements reversed" arch13 zarch
+e6000000100f vsterh VRX_VRRD "vector store halfword elements reversed" arch13 zarch
+e6000000200f vsterf VRX_VRRD "vector store word elements reversed" arch13 zarch
+e6000000300f vsterg VRX_VRRD "vector store doubleword elements reversed" arch13 zarch
+
+e60000000009 vstebrh VRX_VRRDU "vector store byte reversed halfword element" arch13 zarch
+e6000000000b vstebrf VRX_VRRDU "vector store byte reversed word element" arch13 zarch
+e6000000000b sterv VRX_VRRD "store byte reversed word" arch13 zarch
+e6000000000a vstebrg VRX_VRRDU "vector store byte reversed doubleword element" arch13 zarch
+e6000000000a stdrv VRX_VRRD "store byte reversed doubleword" arch13 zarch
+
+e70000000086 vsld VRI_VVV0U "vector shift left double by bit" arch13 zarch
+e70000000087 vsrd VRI_VVV0U "vector shift right double by bit" arch13 zarch
+
+e7000000008b vstrs VRR_VVVUU0V "vector string search" arch13 zarch optparm
+
+e7000000008b vstrsb VRR_VVVU0VB "vector string search byte" arch13 zarch optparm
+e7000100008b vstrsh VRR_VVVU0VB "vector string search halfword" arch13 zarch optparm
+e7000200008b vstrsf VRR_VVVU0VB "vector string search word" arch13 zarch optparm
+
+e7000020008b vstrszb VRR_VVVU0VB2 "vector string search byte zero" arch13 zarch optparm
+e7000120008b vstrszh VRR_VVVU0VB2 "vector string search halfword zero" arch13 zarch optparm
+e7000220008b vstrszf VRR_VVVU0VB2 "vector string search word zero" arch13 zarch optparm
+
+e700000000c3 vcfps VRR_VV0UUU "vector fp convert from fixed" arch13 zarch
+e700000020c3 vcefb VRR_VV0UU "vector fp convert from fixed 32 bit" arch13 zarch
+e700000820c3 wcefb VRR_VV0UU8 "vector fp convert from fixed 32 bit" arch13 zarch
+
+e700000000c1 vcfpl VRR_VV0UUU "vector fp convert from logical" arch13 zarch
+e700000020c1 vcelfb VRR_VV0UU "vector fp convert from logical 32 bit" arch13 zarch
+e700000820c1 wcelfb VRR_VV0UU8 "vector fp convert from logical 32 bit" arch13 zarch
+
+e700000000c2 vcsfp VRR_VV0UUU "vector fp convert to fixed" arch13 zarch
+e700000020c2 vcfeb VRR_VV0UU "vector fp convert to fixed 32 bit" arch13 zarch
+e700000820c2 wcfeb VRR_VV0UU8 "vector fp convert to fixed 32 bit" arch13 zarch
+
+e700000000c0 vclfp VRR_VV0UUU "vector fp convert to logical" arch13 zarch
+e700000020c0 vclfeb VRR_VV0UU "vector fp convert to logical 32 bit" arch13 zarch
+e700000820c0 wclfeb VRR_VV0UU8 "vector fp convert to logical 32 bit" arch13 zarch
+
+# Deflate conversion facility
+
+b939 dfltcc RRF_R0RR2 "deflate conversion call" arch13 zarch
+
+# Enhanced-Sort Facility
+
+b938 sortl RRE_RR "sort lists" arch13 zarch
+
+# Vector packed decimal enhancement facility
+
+e60000000050 vcvb VRR_RV0UU "vector convert to binary 32 bit" arch13 zarch optparm
+e60000000052 vcvbg VRR_RV0UU "vector convert to binary 64 bit" arch13 zarch optparm
+
+# Message Security Assist Extension 9
+
+b93a kdsa RRE_RR "compute digital signature authentication" arch13 zarch

View File

@ -1,50 +0,0 @@
[matz: removed hunk that are exclusive to binutils]
commit 40f382e88d0391ffaa4098c92cbf339a7924a629
Author: Andreas Krebbel <krebbel@linux.ibm.com>
Date: Tue Mar 12 14:09:55 2019 +0100
S/390: arch13: Adjust to recent changes
opcodes/ChangeLog:
2019-03-12 Andreas Krebbel <krebbel@linux.ibm.com>
* s390-opc.txt: Rename selhhhr to selfhr. Remove optional operand
from vstrszb, vstrszh, and vstrszf.
gas/ChangeLog:
2019-03-12 Andreas Krebbel <krebbel@linux.ibm.com>
* testsuite/gas/s390/zarch-arch13.s: Adjust testcase to optable changes.
* testsuite/gas/s390/zarch-arch13.d: Likewise.
diff --git a/opcodes/s390-opc.txt b/opcodes/s390-opc.txt
index 58a2490..7569a56 100644
--- a/opcodes/s390-opc.txt
+++ b/opcodes/s390-opc.txt
@@ -1910,8 +1910,8 @@ b9f0 selr RRF_RURR "select 32 bit" arch13 zarch
b9f00000 selr*20 RRF_R0RR3 "select 32 bit" arch13 zarch
b9e3 selgr RRF_RURR "select 64 bit" arch13 zarch
b9e30000 selgr*20 RRF_R0RR3 "select 64 bit" arch13 zarch
-b9c0 selhhhr RRF_RURR "select high" arch13 zarch
-b9c00000 selhhhr*20 RRF_R0RR3 "select high" arch13 zarch
+b9c0 selfhr RRF_RURR "select high" arch13 zarch
+b9c00000 selfhr*20 RRF_R0RR3 "select high" arch13 zarch
# Vector Enhancements Facility 2
@@ -1969,9 +1969,9 @@ e7000000008b vstrsb VRR_VVVU0VB "vector string search byte" arch13 zarch optparm
e7000100008b vstrsh VRR_VVVU0VB "vector string search halfword" arch13 zarch optparm
e7000200008b vstrsf VRR_VVVU0VB "vector string search word" arch13 zarch optparm
-e7000020008b vstrszb VRR_VVVU0VB2 "vector string search byte zero" arch13 zarch optparm
-e7000120008b vstrszh VRR_VVVU0VB2 "vector string search halfword zero" arch13 zarch optparm
-e7000220008b vstrszf VRR_VVVU0VB2 "vector string search word zero" arch13 zarch optparm
+e7000020008b vstrszb VRR_VVV0V "vector string search byte zero" arch13 zarch
+e7000120008b vstrszh VRR_VVV0V "vector string search halfword zero" arch13 zarch
+e7000220008b vstrszf VRR_VVV0V "vector string search word zero" arch13 zarch
e700000000c3 vcfps VRR_VV0UUU "vector fp convert from fixed" arch13 zarch
e700000020c3 vcefb VRR_VV0UU "vector fp convert from fixed 32 bit" arch13 zarch

View File

@ -1,40 +0,0 @@
[matz: removed hunks that are exclusive to binutils]
commit 46e292ab0af65d13675b54f808fa24e12999e405
Author: Andreas Krebbel <krebbel@linux.ibm.com>
Date: Tue Oct 8 11:23:57 2019 +0200
S/390: Add support for z15 as CPU name.
So far z15 was identified as arch13. After the machine has been
announced we can now add the real name.
gas/ChangeLog:
2019-10-08 Andreas Krebbel <krebbel@linux.ibm.com>
* config/tc-s390.c (s390_parse_cpu): Add z15 as alternate CPU
name.
* doc/as.texi: Add z15 to CPU string list.
* doc/c-s390.texi: Likewise.
opcodes/ChangeLog:
2019-10-08 Andreas Krebbel <krebbel@linux.ibm.com>
* s390-mkopc.c (main): Enable z15 as CPU string in the opcode
table.
diff --git a/opcodes/s390-mkopc.c b/opcodes/s390-mkopc.c
index 0d07678..fe21ea1 100644
--- a/opcodes/s390-mkopc.c
+++ b/opcodes/s390-mkopc.c
@@ -377,7 +377,8 @@ main (void)
else if (strcmp (cpu_string, "z14") == 0
|| strcmp (cpu_string, "arch12") == 0)
min_cpu = S390_OPCODE_ARCH12;
- else if (strcmp (cpu_string, "arch13") == 0)
+ else if (strcmp (cpu_string, "z15") == 0
+ || strcmp (cpu_string, "arch13") == 0)
min_cpu = S390_OPCODE_ARCH13;
else {
fprintf (stderr, "Couldn't parse cpu string %s\n", cpu_string);

View File

@ -8,7 +8,7 @@ Subject: gdb-archer-pie-addons-keep-disabled.patch
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -15441,6 +15441,50 @@ static struct cmd_list_element *enablebreaklist = NULL;
@@ -15396,6 +15396,51 @@ static struct cmd_list_element *enablebreaklist = NULL;
cmd_list_element *commands_cmd_element = nullptr;
@ -52,17 +52,18 @@ diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
+ }
+
+ if (changed)
+ qsort (bp_locations, bp_locations_count, sizeof (*bp_locations),
+ bp_locations_compare);
+ std::sort (bp_locations, bp_locations + bp_locations_count,
+ bp_location_is_less_than);
+}
+
+void _initialize_breakpoint (void);
void
_initialize_breakpoint (void)
{
diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h
--- a/gdb/breakpoint.h
+++ b/gdb/breakpoint.h
@@ -1664,6 +1664,9 @@ extern const char *ep_parse_optional_if_clause (const char **arg);
@@ -1696,6 +1696,9 @@ extern const char *ep_parse_optional_if_clause (const char **arg);
UIOUT iff debugging multiple threads. */
extern void maybe_print_thread_hit_breakpoint (struct ui_out *uiout);
@ -75,7 +76,7 @@ diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -875,6 +875,11 @@ objfile_relocate1 (struct objfile *objfile,
@@ -816,6 +816,11 @@ objfile_relocate1 (struct objfile *objfile,
obj_section_addr (s));
}
@ -87,3 +88,15 @@ diff --git a/gdb/objfiles.c b/gdb/objfiles.c
/* Data changed. */
return 1;
}
diff --git a/gdb/value.c b/gdb/value.c
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -2840,7 +2840,7 @@ value_static_field (struct type *type, int fieldno)
case FIELD_LOC_KIND_PHYSADDR:
retval = value_at_lazy (TYPE_FIELD_TYPE (type, fieldno),
TYPE_FIELD_STATIC_PHYSADDR (type, fieldno)
- + (TYPE_OBJFILE (type) == NULL ? 0 : TYPE_OBJFILE (type)->section_offsets[SECT_OFF_TEXT (TYPE_OBJFILE (type))]));
+ + (TYPE_OBJFILE (type) == NULL ? 0 : ANOFFSET (TYPE_OBJFILE (type)->section_offsets, SECT_OFF_TEXT (TYPE_OBJFILE (type)))));
break;
case FIELD_LOC_KIND_PHYSNAME:
{

View File

@ -8,7 +8,7 @@ Subject: gdb-archer-pie-addons.patch
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -507,6 +507,7 @@ enum field_loc_kind
@@ -516,6 +516,7 @@ enum field_loc_kind
{
FIELD_LOC_KIND_BITPOS, /**< bitpos */
FIELD_LOC_KIND_ENUMVAL, /**< enumval */
@ -16,7 +16,7 @@ diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
FIELD_LOC_KIND_PHYSADDR, /**< physaddr */
FIELD_LOC_KIND_PHYSNAME, /**< physname */
FIELD_LOC_KIND_DWARF_BLOCK /**< dwarf_block */
@@ -558,6 +559,7 @@ union field_location
@@ -566,6 +567,7 @@ union field_location
field. Otherwise, physname is the mangled label of the
static field. */
@ -24,7 +24,7 @@ diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
CORE_ADDR physaddr;
const char *physname;
@@ -1436,6 +1438,7 @@ extern void set_type_vptr_basetype (struct type *, struct type *);
@@ -1474,6 +1476,7 @@ extern void set_type_vptr_basetype (struct type *, struct type *);
#define FIELD_ENUMVAL_LVAL(thisfld) ((thisfld).loc.enumval)
#define FIELD_ENUMVAL(thisfld) (FIELD_ENUMVAL_LVAL (thisfld) + 0)
#define FIELD_STATIC_PHYSNAME(thisfld) ((thisfld).loc.physname)
@ -32,7 +32,7 @@ diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
#define FIELD_STATIC_PHYSADDR(thisfld) ((thisfld).loc.physaddr)
#define FIELD_DWARF_BLOCK(thisfld) ((thisfld).loc.dwarf_block)
#define SET_FIELD_BITPOS(thisfld, bitpos) \
@@ -1447,6 +1450,7 @@ extern void set_type_vptr_basetype (struct type *, struct type *);
@@ -1485,6 +1488,7 @@ extern void set_type_vptr_basetype (struct type *, struct type *);
#define SET_FIELD_PHYSNAME(thisfld, name) \
(FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_PHYSNAME, \
FIELD_STATIC_PHYSNAME (thisfld) = (name))
@ -40,7 +40,7 @@ diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
#define SET_FIELD_PHYSADDR(thisfld, addr) \
(FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_PHYSADDR, \
FIELD_STATIC_PHYSADDR (thisfld) = (addr))
@@ -1463,6 +1467,7 @@ extern void set_type_vptr_basetype (struct type *, struct type *);
@@ -1501,6 +1505,7 @@ extern void set_type_vptr_basetype (struct type *, struct type *);
#define TYPE_FIELD_BITPOS(thistype, n) FIELD_BITPOS (TYPE_FIELD (thistype, n))
#define TYPE_FIELD_ENUMVAL(thistype, n) FIELD_ENUMVAL (TYPE_FIELD (thistype, n))
#define TYPE_FIELD_STATIC_PHYSNAME(thistype, n) FIELD_STATIC_PHYSNAME (TYPE_FIELD (thistype, n))
@ -51,13 +51,13 @@ diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
diff --git a/gdb/value.c b/gdb/value.c
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -2827,7 +2827,8 @@ value_static_field (struct type *type, int fieldno)
@@ -2839,7 +2839,8 @@ value_static_field (struct type *type, int fieldno)
{
case FIELD_LOC_KIND_PHYSADDR:
retval = value_at_lazy (TYPE_FIELD_TYPE (type, fieldno),
- TYPE_FIELD_STATIC_PHYSADDR (type, fieldno));
+ TYPE_FIELD_STATIC_PHYSADDR (type, fieldno)
+ + (TYPE_OBJFILE (type) == NULL ? 0 : ANOFFSET (TYPE_OBJFILE (type)->section_offsets, SECT_OFF_TEXT (TYPE_OBJFILE (type)))));
+ + (TYPE_OBJFILE (type) == NULL ? 0 : TYPE_OBJFILE (type)->section_offsets[SECT_OFF_TEXT (TYPE_OBJFILE (type))]));
break;
case FIELD_LOC_KIND_PHYSNAME:
{

View File

@ -8,7 +8,7 @@ Subject: gdb-archer-vla-tests.patch
diff --git a/gdb/testsuite/gdb.ada/packed_array.exp b/gdb/testsuite/gdb.ada/packed_array.exp
--- a/gdb/testsuite/gdb.ada/packed_array.exp
+++ b/gdb/testsuite/gdb.ada/packed_array.exp
@@ -56,5 +56,11 @@ gdb_test_multiple "$test" "$test" {
@@ -53,5 +53,11 @@ gdb_test_multiple "$test" "$test" {
# are. Observed with (FSF GNU Ada 4.5.3 20110124).
xfail $test
}
@ -2804,7 +2804,7 @@ new file mode 100644
+gdb_breakpoint [gdb_get_line_number "varx-allocated"]
+gdb_continue_to_breakpoint "varx-allocated"
+# $1 = (( ( 0, 0, 0, 0, 0, 0) ( 0, 0, 0, 0, 0, 0) --- , 0) ) ( ( 0, 0, ...) ...) ...)
+gdb_test "ptype varx" "type = real(\\(kind=4\\)|\\*4) \\(6,5:15,17:28\\)" "ptype varx allocated"
+gdb_test "ptype varx" "type = real(\\(kind=4\\)|\\*4), allocatable \\(6,5:15,17:28\\)" "ptype varx allocated"
+# Intel Fortran Compiler 10.1.008 uses -1 there, GCC uses 1.
+gdb_test "p l" "\\$\[0-9\]* = (\\.TRUE\\.|4294967295)" "p l if varx allocated"
+
@ -2831,7 +2831,7 @@ new file mode 100644
+gdb_test "p varv(3, 7, 19)" "\\$\[0-9\]* = 6" "p varv(3, 7, 19) associated"
+# Intel Fortran Compiler 10.1.008 uses -1 there, GCC uses 1.
+gdb_test "p l" "\\$\[0-9\]* = (\\.TRUE\\.|4294967295)" "p l if varv associated"
+gdb_test "ptype varx" "type = real(\\(kind=4\\)|\\*4) \\(6,5:15,17:28\\)" "ptype varx with varv associated"
+gdb_test "ptype varx" "type = real(\\(kind=4\\)|\\*4), allocatable \\(6,5:15,17:28\\)" "ptype varx with varv associated"
+# Intel Fortran Compiler 10.1.008 uses the pointer type.
+gdb_test "ptype varv" "type = (PTR TO -> \\( )?real(\\(kind=4\\)|\\*4) \\(6,5:15,17:28\\)\\)?" "ptype varv associated"
+
@ -2852,7 +2852,7 @@ new file mode 100644
+gdb_breakpoint [gdb_get_line_number "varx-deallocated"]
+gdb_continue_to_breakpoint "varx-deallocated"
+gdb_test "p varx" "\\$\[0-9\]* = <not allocated>" "p varx deallocated"
+gdb_test "ptype varx" {type = real\(kind=4\) \(:,:,:\)} "ptype varx deallocated"
+gdb_test "ptype varx" {type = real\(kind=4\), allocatable \(:,:,:\)} "ptype varx deallocated"
+gdb_test "p l" "\\$\[0-9\]* = \\.FALSE\\." "p l if varx deallocated"
+gdb_test "p varx(1,5,17)" {no such vector element \(vector not allocated\)} "p varx(1,5,17) deallocated"
+gdb_test "ptype varx(1,5,17)" {no such vector element \(vector not allocated\)} "ptype varx(1,5,17) deallocated"
@ -3690,7 +3690,7 @@ diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -170,6 +170,11 @@ proc gdb_unload {} {
send_gdb "y\n"
send_gdb "y\n" answer
exp_continue
}
+ -re "A program is being debugged already..*Are you sure you want to change the file.*y or n. $"\
@ -3699,7 +3699,7 @@ diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
+ exp_continue
+ }
-re "Discard symbol table from .*y or n.*$" {
send_gdb "y\n"
send_gdb "y\n" answer
exp_continue
diff --git a/gdb/testsuite/lib/pascal.exp b/gdb/testsuite/lib/pascal.exp
--- a/gdb/testsuite/lib/pascal.exp

View File

@ -14,22 +14,6 @@ commit 718a1618b2f691a7f407213bb50f100ac59f91c3
tromey/python
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -2082,6 +2082,12 @@ stamp-h: $(srcdir)/config.in config.status
CONFIG_LINKS= \
$(SHELL) config.status
+.gdbinit: $(srcdir)/gdbinit.in config.status
+ CONFIG_FILES=".gdbinit:gdbinit.in" \
+ CONFIG_COMMANDS= \
+ CONFIG_HEADERS= \
+ $(SHELL) config.status
+
config.status: $(srcdir)/configure configure.nat configure.tgt configure.host ../bfd/development.sh
$(SHELL) config.status --recheck
diff --git a/gdb/data-directory/Makefile.in b/gdb/data-directory/Makefile.in
--- a/gdb/data-directory/Makefile.in
+++ b/gdb/data-directory/Makefile.in
@ -41,47 +25,14 @@ diff --git a/gdb/data-directory/Makefile.in b/gdb/data-directory/Makefile.in
gdb/command/explore.py \
gdb/command/backtrace.py \
gdb/command/frame_filters.py \
@@ -92,6 +93,8 @@ PYTHON_FILE_LIST = \
@@ -92,6 +93,7 @@ PYTHON_FILE_LIST = \
gdb/function/as_string.py \
gdb/function/caller_is.py \
gdb/function/strfns.py \
+ gdb/function/caller_is.py \
+ gdb/function/in_scope.py \
gdb/printer/__init__.py \
gdb/printer/bound_registers.py
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -1251,6 +1251,16 @@ for remote debugging.
Run using @var{device} for your program's standard input and output.
@c FIXME: kingdon thinks there is more to -tty. Investigate.
+@item -P
+@cindex @code{-P}
+@itemx --python
+@cindex @code{--python}
+Change interpretation of command line so that the argument immediately
+following this switch is taken to be the name of a Python script file.
+This option stops option processing; subsequent options are passed to
+Python as @code{sys.argv}. This option is only available if Python
+scripting support was enabled when @value{GDBN} was configured.
+
@c resolve the situation of these eventually
@item -tui
@cindex @code{--tui}
diff --git a/gdb/doc/python.texi b/gdb/doc/python.texi
--- a/gdb/doc/python.texi
+++ b/gdb/doc/python.texi
@@ -90,8 +90,6 @@ containing @code{end}. For example:
@smallexample
(@value{GDBP}) python
-Type python script
-End with a line saying just "end".
>print 23
>end
23
diff --git a/gdb/gdb-gdb.gdb.in b/gdb/gdb-gdb.gdb.in
--- a/gdb/gdb-gdb.gdb.in
+++ b/gdb/gdb-gdb.gdb.in
@ -101,173 +52,6 @@ diff --git a/gdb/gdb-gdb.gdb.in b/gdb/gdb-gdb.gdb.in
if !$gdb_init_done
set variable $gdb_init_done = 1
diff --git a/gdb/main.c b/gdb/main.c
--- a/gdb/main.c
+++ b/gdb/main.c
@@ -33,6 +33,7 @@
#include "interps.h"
#include "main.h"
+#include "python/python.h"
#include "source.h"
#include "cli/cli-cmds.h"
#include "objfiles.h"
@@ -478,7 +479,7 @@ exec_or_core_file_attach (const char *filename, int from_tty)
}
static void
-captured_main_1 (struct captured_main_args *context)
+captured_main_1 (struct captured_main_args *context, int &python_script)
{
int argc = context->argc;
char **argv = context->argv;
@@ -698,10 +699,14 @@ captured_main_1 (struct captured_main_args *context)
{"args", no_argument, &set_args, 1},
{"l", required_argument, 0, 'l'},
{"return-child-result", no_argument, &return_child_result, 1},
+#if HAVE_PYTHON
+ {"python", no_argument, 0, 'P'},
+ {"P", no_argument, 0, 'P'},
+#endif
{0, no_argument, 0, 0}
};
- while (1)
+ while (!python_script)
{
int option_index;
@@ -719,6 +724,9 @@ captured_main_1 (struct captured_main_args *context)
case 0:
/* Long option that just sets a flag. */
break;
+ case 'P':
+ python_script = 1;
+ break;
case OPT_SE:
symarg = optarg;
execarg = optarg;
@@ -898,7 +906,31 @@ captured_main_1 (struct captured_main_args *context)
/* Now that gdb_init has created the initial inferior, we're in
position to set args for that inferior. */
- if (set_args)
+ if (python_script)
+ {
+ /* The first argument is a python script to evaluate, and
+ subsequent arguments are passed to the script for
+ processing there. */
+ if (optind >= argc)
+ {
+ fprintf_unfiltered (gdb_stderr,
+ _("%s: Python script file name required\n"),
+ argv[0]);
+ exit (1);
+ }
+
+ /* FIXME: should handle inferior I/O intelligently here.
+ E.g., should be possible to run gdb in pipeline and have
+ Python (and gdb) output go to stderr or file; and if a
+ prompt is needed, open the tty. */
+ quiet = 1;
+ /* FIXME: should read .gdbinit if, and only if, a prompt is
+ requested by the script. Though... maybe this is not
+ ideal? */
+ /* FIXME: likewise, reading in history. */
+ inhibit_gdbinit = 1;
+ }
+ else if (set_args)
{
/* The remaining options are the command-line options for the
inferior. The first one is the sym/exec file, and the rest
@@ -1199,7 +1231,8 @@ captured_main_1 (struct captured_main_args *context)
/* Read in the old history after all the command files have been
read. */
- init_history ();
+ if (!python_script)
+ init_history ();
if (batch_flag)
{
@@ -1215,24 +1248,37 @@ static void
captured_main (void *data)
{
struct captured_main_args *context = (struct captured_main_args *) data;
+ int python_script = 0;
- captured_main_1 (context);
+ captured_main_1 (context, python_script);
- /* NOTE: cagney/1999-11-07: There is probably no reason for not
- moving this loop and the code found in captured_command_loop()
- into the command_loop() proper. The main thing holding back that
- change - SET_TOP_LEVEL() - has been eliminated. */
- while (1)
+#if HAVE_PYTHON
+ if (python_script)
{
- TRY
- {
- captured_command_loop ();
- }
- CATCH (ex, RETURN_MASK_ALL)
+ extern int pagination_enabled;
+ pagination_enabled = 0;
+ run_python_script (context->argc - optind, &context->argv[optind]);
+ return;
+ }
+ else
+#endif
+ {
+ /* NOTE: cagney/1999-11-07: There is probably no reason for not
+ moving this loop and the code found in captured_command_loop()
+ into the command_loop() proper. The main thing holding back that
+ change - SET_TOP_LEVEL() - has been eliminated. */
+ while (1)
{
- exception_print (gdb_stderr, ex);
+ TRY
+ {
+ captured_command_loop ();
+ }
+ CATCH (ex, RETURN_MASK_ALL)
+ {
+ exception_print (gdb_stderr, ex);
+ }
+ END_CATCH
}
- END_CATCH
}
/* No exit -- exit is through quit_command. */
}
@@ -1275,6 +1321,12 @@ print_gdb_help (struct ui_file *stream)
fputs_unfiltered (_("\
This is the GNU debugger. Usage:\n\n\
gdb [options] [executable-file [core-file or process-id]]\n\
+ gdb [options] --args executable-file [inferior-arguments ...]\n"), stream);
+#if HAVE_PYTHON
+ fputs_unfiltered (_("\
+ gdb [options] [--python|-P] script-file [script-arguments ...]\n"), stream);
+#endif
+ fputs_unfiltered (_("\n\
gdb [options] --args executable-file [inferior-arguments ...]\n\n\
"), stream);
fputs_unfiltered (_("\
@@ -1320,6 +1372,13 @@ Output and user interface control:\n\n\
#endif
fputs_unfiltered (_("\
--dbx DBX compatibility mode.\n\
+"), stream);
+#if HAVE_PYTHON
+ fputs_unfiltered (_("\
+ --python, -P Following argument is Python script file; remaining\n\
+ arguments are passed to script.\n"), stream);
+#endif
+ fputs_unfiltered (_("\
-q, --quiet, --silent\n\
Do not print version number on startup.\n\n\
"), stream);
diff --git a/gdb/python/lib/gdb/command/ignore_errors.py b/gdb/python/lib/gdb/command/ignore_errors.py
new file mode 100644
--- /dev/null
@ -362,177 +146,6 @@ new file mode 100644
+ return wanted == found
+
+InScope ()
diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h
--- a/gdb/python/python-internal.h
+++ b/gdb/python/python-internal.h
@@ -709,6 +709,9 @@ private:
PyThreadState *m_save;
};
+struct cleanup *ensure_python_env (struct gdbarch *gdbarch,
+ const struct language_defn *language);
+
extern struct gdbarch *python_gdbarch;
extern const struct language_defn *python_language;
diff --git a/gdb/python/python.c b/gdb/python/python.c
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -94,6 +94,8 @@ const struct extension_language_defn extension_language_python =
#include "linespec.h"
#include "source.h"
#include "common/version.h"
+#include "inferior.h"
+#include "gdbthread.h"
#include "target.h"
#include "gdbthread.h"
#include "interps.h"
@@ -235,6 +237,29 @@ gdbpy_enter::~gdbpy_enter ()
restore_active_ext_lang (m_previous_active);
}
+static void
+restore_python_env (void *p)
+{
+ gdbpy_enter *env = (gdbpy_enter *) p;
+
+ delete env;
+}
+
+/* Called before entering the Python interpreter to install the
+ current language and architecture to be used for Python values.
+ Also set the active extension language for GDB so that SIGINT's
+ are directed our way, and if necessary install the right SIGINT
+ handler. */
+
+struct cleanup *
+ensure_python_env (struct gdbarch *gdbarch,
+ const struct language_defn *language)
+{
+ gdbpy_enter *env = new gdbpy_enter (gdbarch, language);
+
+ return make_cleanup (restore_python_env, env);
+}
+
/* Set the quit flag. */
static void
@@ -1283,6 +1308,92 @@ gdbpy_print_stack_or_quit ()
+/* True if 'gdb -P' was used, false otherwise. */
+static int running_python_script;
+
+/* True if we are currently in a call to 'gdb.cli', false otherwise. */
+static int in_cli;
+
+/* Enter the command loop. */
+
+static PyObject *
+gdbpy_cli (PyObject *unused1, PyObject *unused2)
+{
+ if (! running_python_script || in_cli)
+ return PyErr_Format (PyExc_RuntimeError, "cannot invoke CLI recursively");
+
+ if (current_uiout->is_mi_like_p ())
+ return PyErr_Format (PyExc_RuntimeError, _("Cannot invoke CLI from MI."));
+
+ in_cli = 1;
+ /* See captured_command_loop. */
+
+ /* Give the interpreter a chance to print a prompt. */
+ interp_pre_command_loop (top_level_interpreter ());
+
+ /* Now it's time to start the event loop. */
+ start_event_loop ();
+
+ in_cli = 0;
+
+ Py_RETURN_NONE;
+}
+
+/* Set up the Python argument vector and evaluate a script. This is
+ used to implement 'gdb -P'. */
+
+void
+run_python_script (int argc, char **argv)
+{
+ FILE *input;
+
+ /* We never free this, since we plan to exit at the end. */
+ ensure_python_env (get_current_arch (), current_language);
+
+ running_python_script = 1;
+
+#if PYTHON_ABI_VERSION < 3
+ PySys_SetArgv (argc - 1, argv + 1);
+#else
+ {
+ wchar_t **wargv = (wchar_t **) alloca (sizeof (*wargv) * (argc + 1));
+ int i;
+
+ for (i = 1; i < argc; i++)
+ {
+ size_t len = mbstowcs (NULL, argv[i], 0);
+ /* Python-related GDB sources are built with -DNDEBUG
+ https://sourceware.org/bugzilla/show_bug.cgi?id=20445 */
+ size_t len2 ATTRIBUTE_UNUSED;
+
+ if (len == (size_t) -1)
+ {
+ fprintf (stderr, "Invalid multibyte argument #%d \"%s\"\n",
+ i, argv[i]);
+ exit (1);
+ }
+ wargv[i] = (wchar_t *) alloca (sizeof (**wargv) * (len + 1));
+ len2 = mbstowcs (wargv[i], argv[i], len + 1);
+ assert (len2 == len);
+ }
+ wargv[argc] = NULL;
+ PySys_SetArgv (argc - 1, wargv + 1);
+ }
+#endif
+
+ input = fopen (argv[0], "r");
+ if (! input)
+ {
+ fprintf (stderr, "could not open %s: %s\n", argv[0], strerror (errno));
+ exit (1);
+ }
+ PyRun_SimpleFile (input, argv[0]);
+ fclose (input);
+ exit (0);
+}
+
+
+
/* Return a sequence holding all the Progspaces. */
static PyObject *
@@ -1937,6 +2048,8 @@ PyMethodDef python_GdbMethods[] =
Evaluate command, a string, as a gdb CLI command. Optionally returns\n\
a Python String containing the output of the command if to_string is\n\
set to True." },
+ { "cli", gdbpy_cli, METH_NOARGS,
+ "Enter the gdb CLI" },
{ "parameter", gdbpy_parameter, METH_VARARGS,
"Return a gdb parameter's value" },
diff --git a/gdb/python/python.h b/gdb/python/python.h
--- a/gdb/python/python.h
+++ b/gdb/python/python.h
@@ -25,7 +25,10 @@
/* This is all that python exports to gdb. */
extern const struct extension_language_defn extension_language_python;
+
/* Command element for the 'python' command. */
extern cmd_list_element *python_cmd_element;
+extern void run_python_script (int argc, char **argv);
+
#endif /* PYTHON_PYTHON_H */
diff --git a/gdb/testsuite/gdb.python/py-frame.exp b/gdb/testsuite/gdb.python/py-frame.exp
--- a/gdb/testsuite/gdb.python/py-frame.exp
+++ b/gdb/testsuite/gdb.python/py-frame.exp
@ -548,7 +161,7 @@ diff --git a/gdb/testsuite/gdb.python/py-frame.exp b/gdb/testsuite/gdb.python/py
diff --git a/gdb/testsuite/gdb.python/py-value.exp b/gdb/testsuite/gdb.python/py-value.exp
--- a/gdb/testsuite/gdb.python/py-value.exp
+++ b/gdb/testsuite/gdb.python/py-value.exp
@@ -399,6 +399,15 @@ proc test_value_after_death {} {
@@ -419,6 +419,15 @@ proc test_value_after_death {} {
"print value's type"
}
@ -564,7 +177,7 @@ diff --git a/gdb/testsuite/gdb.python/py-value.exp b/gdb/testsuite/gdb.python/py
# Regression test for invalid subscript operations. The bug was that
# the type of the value was not being checked before allowing a
# subscript operation to proceed.
@@ -585,6 +594,7 @@ test_value_in_inferior
@@ -606,6 +615,7 @@ test_value_in_inferior
test_value_from_buffer
test_inferior_function_call
test_value_after_death
@ -572,33 +185,3 @@ diff --git a/gdb/testsuite/gdb.python/py-value.exp b/gdb/testsuite/gdb.python/py
# Test either C or C++ values.
diff --git a/gdb/varobj.c b/gdb/varobj.c
--- a/gdb/varobj.c
+++ b/gdb/varobj.c
@@ -217,6 +217,14 @@ is_root_p (const struct varobj *var)
}
#ifdef HAVE_PYTHON
+/* Helper function to install a Python environment suitable for
+ use during operations on VAR. */
+struct cleanup *
+varobj_ensure_python_env (const struct varobj *var)
+{
+ return ensure_python_env (var->root->exp->gdbarch,
+ var->root->exp->language_defn);
+}
/* See python-internal.h. */
gdbpy_enter_varobj::gdbpy_enter_varobj (const struct varobj *var)
diff --git a/gdb/varobj.h b/gdb/varobj.h
--- a/gdb/varobj.h
+++ b/gdb/varobj.h
@@ -328,6 +328,8 @@ extern bool varobj_has_more (const struct varobj *var, int to);
extern bool varobj_is_dynamic_p (const struct varobj *var);
+extern struct cleanup *varobj_ensure_python_env (const struct varobj *var);
+
extern bool varobj_default_value_is_changeable_p (const struct varobj *var);
extern bool varobj_value_is_changeable_p (const struct varobj *var);

View File

@ -45,7 +45,7 @@ gdb/gdbserver/
diff --git a/gdb/config.in b/gdb/config.in
--- a/gdb/config.in
+++ b/gdb/config.in
@@ -267,6 +267,9 @@
@@ -251,6 +251,9 @@
/* Define if librpm library is being used. */
#undef HAVE_LIBRPM
@ -55,7 +55,7 @@ diff --git a/gdb/config.in b/gdb/config.in
/* Define to 1 if you have the <libunwind-ia64.h> header file. */
#undef HAVE_LIBUNWIND_IA64_H
@@ -390,6 +393,9 @@
@@ -386,6 +389,9 @@
/* Define to 1 if you have the `scm_new_smob' function. */
#undef HAVE_SCM_NEW_SMOB
@ -68,7 +68,7 @@ diff --git a/gdb/config.in b/gdb/config.in
diff --git a/gdb/configure b/gdb/configure
--- a/gdb/configure
+++ b/gdb/configure
@@ -15898,6 +15898,64 @@ cat >>confdefs.h <<_ACEOF
@@ -16434,6 +16434,64 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
@ -136,7 +136,7 @@ diff --git a/gdb/configure b/gdb/configure
diff --git a/gdb/configure.ac b/gdb/configure.ac
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -2051,6 +2051,10 @@ case $host_os in
@@ -1964,6 +1964,10 @@ case $host_os in
esac
AC_DEFINE_UNQUOTED(GDBINIT,"$gdbinit",[The .gdbinit filename.])
@ -150,9 +150,9 @@ diff --git a/gdb/configure.ac b/gdb/configure.ac
diff --git a/gdb/gdbserver/config.in b/gdb/gdbserver/config.in
--- a/gdb/gdbserver/config.in
+++ b/gdb/gdbserver/config.in
@@ -126,6 +126,9 @@
/* Define to 1 if you have the `mcheck' library (-lmcheck). */
#undef HAVE_LIBMCHECK
@@ -125,6 +125,9 @@
/* Define to 1 if you have the `dl' library (-ldl). */
#undef HAVE_LIBDL
+/* Define to 1 if you have the `selinux' library (-lselinux). */
+#undef HAVE_LIBSELINUX
@ -160,7 +160,7 @@ diff --git a/gdb/gdbserver/config.in b/gdb/gdbserver/config.in
/* Define if the target supports branch tracing. */
#undef HAVE_LINUX_BTRACE
@@ -202,6 +205,9 @@
@@ -210,6 +213,9 @@
/* Define to 1 if you have the `pwrite' function. */
#undef HAVE_PWRITE
@ -173,7 +173,7 @@ diff --git a/gdb/gdbserver/config.in b/gdb/gdbserver/config.in
diff --git a/gdb/gdbserver/configure b/gdb/gdbserver/configure
--- a/gdb/gdbserver/configure
+++ b/gdb/gdbserver/configure
@@ -8589,6 +8589,64 @@ if $want_ipa ; then
@@ -9398,6 +9398,64 @@ if $want_ipa ; then
fi
fi
@ -241,7 +241,7 @@ diff --git a/gdb/gdbserver/configure b/gdb/gdbserver/configure
diff --git a/gdb/gdbserver/configure.ac b/gdb/gdbserver/configure.ac
--- a/gdb/gdbserver/configure.ac
+++ b/gdb/gdbserver/configure.ac
@@ -478,6 +478,10 @@ if $want_ipa ; then
@@ -465,6 +465,10 @@ if $want_ipa ; then
fi
fi
@ -255,7 +255,7 @@ diff --git a/gdb/gdbserver/configure.ac b/gdb/gdbserver/configure.ac
diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -967,7 +967,16 @@ linux_ptrace_fun ()
@@ -968,7 +968,16 @@ linux_ptrace_fun ()
{
if (ptrace (PTRACE_TRACEME, 0, (PTRACE_TYPE_ARG3) 0,
(PTRACE_TYPE_ARG4) 0) < 0)
@ -276,22 +276,21 @@ diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -1099,7 +1099,17 @@ linux_nat_target::create_inferior (const char *exec_file,
@@ -1092,7 +1092,16 @@ linux_nat_target::create_inferior (const char *exec_file,
/* Make sure we report all signals during startup. */
pass_signals ({});
- inf_ptrace_target::create_inferior (exec_file, allargs, env, from_tty);
+ TRY
+ try
+ {
+ inf_ptrace_target::create_inferior (exec_file, allargs, env, from_tty);
+ }
+ CATCH (ex, RETURN_MASK_ERROR)
+ catch (const gdb_exception_error &ex)
+ {
+ std::string result = linux_ptrace_create_warnings ();
+
+ throw_error (ex.error, "%s%s", result.c_str (), ex.message);
+ throw_error (ex.error, "%s%s", result.c_str (), ex.message->c_str ());
+ }
+ END_CATCH
}
/* Callback for linux_proc_attach_tgid_threads. Attach to PTID if not

View File

@ -14,7 +14,7 @@ printed, but a default backtrace will occur in this case.
diff --git a/gdb/python/py-framefilter.c b/gdb/python/py-framefilter.c
--- a/gdb/python/py-framefilter.c
+++ b/gdb/python/py-framefilter.c
@@ -1139,6 +1139,7 @@ gdbpy_apply_frame_filter (const struct extension_language_defn *extlang,
@@ -1204,6 +1204,7 @@ gdbpy_apply_frame_filter (const struct extension_language_defn *extlang,
htab_eq_pointer,
NULL));
@ -22,7 +22,7 @@ diff --git a/gdb/python/py-framefilter.c b/gdb/python/py-framefilter.c
while (true)
{
gdbpy_ref<> item (PyIter_Next (iterable.get ()));
@@ -1147,8 +1148,8 @@ gdbpy_apply_frame_filter (const struct extension_language_defn *extlang,
@@ -1212,8 +1213,8 @@ gdbpy_apply_frame_filter (const struct extension_language_defn *extlang,
{
if (PyErr_Occurred ())
{
@ -33,7 +33,7 @@ diff --git a/gdb/python/py-framefilter.c b/gdb/python/py-framefilter.c
}
break;
}
@@ -1181,7 +1182,8 @@ gdbpy_apply_frame_filter (const struct extension_language_defn *extlang,
@@ -1245,7 +1246,8 @@ gdbpy_apply_frame_filter (const struct extension_language_defn *extlang,
/* Do not exit on error printing a single frame. Print the
error and continue with other frames. */
if (success == EXT_LANG_BT_ERROR)

View File

@ -80,7 +80,7 @@ gdb/testsuite/ChangeLog
diff --git a/gdb/main.c b/gdb/main.c
--- a/gdb/main.c
+++ b/gdb/main.c
@@ -1129,7 +1129,10 @@ captured_main_1 (struct captured_main_args *context)
@@ -1148,7 +1148,10 @@ captured_main_1 (struct captured_main_args *context)
{
ret = catch_command_errors (attach_command, pid_or_core_arg,
!batch_flag);

View File

@ -30,7 +30,7 @@ debugging problem of GOMP outside of the scope of this Bug.
diff --git a/gdb/infrun.c b/gdb/infrun.c
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -6499,6 +6499,16 @@ process_event_stop_test (struct execution_control_state *ecs)
@@ -6453,6 +6453,16 @@ process_event_stop_test (struct execution_control_state *ecs)
if (ecs->event_thread->control.step_over_calls == STEP_OVER_ALL)
{
@ -38,16 +38,16 @@ diff --git a/gdb/infrun.c b/gdb/infrun.c
+ struct minimal_symbol *stopf = lookup_minimal_symbol_by_pc (stop_pc).minsym;
+
+ if ((stop_fn == NULL
+ || strstr (SYMBOL_LINKAGE_NAME (stop_fn), ".omp_fn.") == NULL)
+ || strstr (stop_fn->linkage_name (), ".omp_fn.") == NULL)
+ /* gcc-4.7.2-9.fc19.x86_64 uses a new format. */
+ && (stopf == NULL
+ || strstr (MSYMBOL_LINKAGE_NAME (stopf), "._omp_fn.") == NULL))
+ || strstr (stopf->linkage_name (), "._omp_fn.") == NULL))
+{ /* ".omp_fn." */
+
/* We're doing a "next".
Normal (forward) execution: set a breakpoint at the
@@ -6532,6 +6542,7 @@ process_event_stop_test (struct execution_control_state *ecs)
@@ -6486,6 +6496,7 @@ process_event_stop_test (struct execution_control_state *ecs)
keep_going (ecs);
return;

View File

@ -1,175 +0,0 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-bz541866-rwatch-before-run.patch
;; Fix i386+x86_64 rwatch+awatch before run, regression against 6.8 (BZ 541866).
;; Fix i386 rwatch+awatch before run (BZ 688788, on top of BZ 541866).
;;=push+jan: It should be fixed properly instead.
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -8773,7 +8773,7 @@ init_breakpoint_sal (struct breakpoint *b, struct gdbarch *gdbarch,
int enabled, int internal, unsigned flags,
int display_canonical)
{
- int i;
+ int i ATTRIBUTE_UNUSED;
if (type == bp_hardware_breakpoint)
{
@@ -14271,7 +14271,7 @@ enable_breakpoint_disp (struct breakpoint *bpt, enum bpdisp disposition,
if (bpt->type == bp_hardware_breakpoint)
{
- int i;
+ int i ATTRIBUTE_UNUSED;
i = hw_breakpoint_used_count ();
target_resources_ok =
target_can_use_hardware_watchpoint (bp_hardware_breakpoint,
diff --git a/gdb/config/i386/nm-linux.h b/gdb/config/i386/nm-linux.h
new file mode 100644
--- /dev/null
+++ b/gdb/config/i386/nm-linux.h
@@ -0,0 +1,28 @@
+/* Native support for GNU/Linux i386.
+
+ Copyright 2010 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#ifndef NM_LINUX_H
+#define NM_LINUX_H
+
+#include "config/nm-linux.h"
+
+/* Red Hat backward compatibility with gdb-6.8. */
+#define target_can_use_hardware_watchpoint(type, cnt, ot) 1
+
+#endif /* NM_LINUX64_H */
diff --git a/gdb/config/i386/nm-linux64.h b/gdb/config/i386/nm-linux64.h
new file mode 100644
--- /dev/null
+++ b/gdb/config/i386/nm-linux64.h
@@ -0,0 +1,28 @@
+/* Native support for GNU/Linux amd64.
+
+ Copyright 2010 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#ifndef NM_LINUX64_H
+#define NM_LINUX64_H
+
+#include "config/nm-linux.h"
+
+/* Red Hat backward compatibility with gdb-6.8. */
+#define target_can_use_hardware_watchpoint(type, cnt, ot) 1
+
+#endif /* NM_LINUX64_H */
diff --git a/gdb/configure.nat b/gdb/configure.nat
--- a/gdb/configure.nat
+++ b/gdb/configure.nat
@@ -245,6 +245,7 @@ case ${gdb_host} in
;;
i386)
# Host: Intel 386 running GNU/Linux.
+ NAT_FILE="${srcdir}/config/${gdb_host_cpu}/nm-linux.h"
NATDEPFILES="${NATDEPFILES} x86-nat.o nat/x86-dregs.o \
i386-linux-nat.o x86-linux-nat.o nat/linux-btrace.o \
nat/x86-linux.o nat/x86-linux-dregs.o"
@@ -301,6 +302,7 @@ case ${gdb_host} in
case ${gdb_host_cpu} in
i386)
# Host: GNU/Linux x86-64
+ NAT_FILE="${srcdir}/config/${gdb_host_cpu}/nm-linux64.h"
NATDEPFILES="${NATDEPFILES} x86-nat.o nat/x86-dregs.o \
amd64-nat.o amd64-linux-nat.o x86-linux-nat.o \
nat/linux-btrace.o \
diff --git a/gdb/target.h b/gdb/target.h
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -1971,9 +1971,11 @@ extern struct thread_info *target_thread_handle_to_thread_info
one. OTHERTYPE is the number of watchpoints of other types than
this one used so far. */
+#ifndef target_can_use_hardware_watchpoint
#define target_can_use_hardware_watchpoint(TYPE,CNT,OTHERTYPE) \
(current_top_target ()->can_use_hw_breakpoint) ( \
TYPE, CNT, OTHERTYPE)
+#endif
/* Returns the number of debug registers needed to watch the given
memory region, or zero if not supported. */
diff --git a/gdb/testsuite/gdb.base/watchpoint-hw-before-run.exp b/gdb/testsuite/gdb.base/watchpoint-hw-before-run.exp
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/watchpoint-hw-before-run.exp
@@ -0,0 +1,40 @@
+# Copyright 2009, 2010 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/>.
+
+# Arch not supporting hw watchpoints does not imply no_hardware_watchpoints set.
+if {(![istarget "i?86-*-*"] && ![istarget "x86_64-*-*"]
+ && ![istarget "ia64-*-*"])
+ || [target_info exists gdb,no_hardware_watchpoints]} then {
+ verbose "Skipping watchpoint-hw-before-run test."
+ return
+}
+
+set test watchpoint-hw-before-run
+set srcfile watchpoint-hw-hit-once.c
+if { [prepare_for_testing ${test}.exp ${test} ${srcfile}] } {
+ return -1
+}
+
+gdb_test "rwatch watchee" "ardware read watchpoint 1: watchee"
+
+# `runto_main' or `runto main' would delete the watchpoint created above.
+
+if { [gdb_start_cmd] < 0 } {
+ untested start
+ return -1
+}
+gdb_test "" "main .* at .*" "start"
+
+gdb_test "continue" "Continuing.\r\n\r\nHardware read watchpoint \[0-9\]+: watchee\r\n\r\nValue = 0\r\n.*"

View File

@ -1,71 +0,0 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-bz568248-oom-is-error.patch
;; Out of memory is just an error, not fatal (uninitialized VLS vars, BZ 568248).
;;=push+jan: Inferior objects should be read in parts, then this patch gets obsoleted.
http://sourceware.org/ml/gdb-patches/2010-06/msg00005.html
Hi,
unfortunately I see this problem reproducible only with the
archer-jankratochvil-vla branch (VLA = Variable Length Arrays - char[var]).
OTOH this branch I hopefully submit in some form for FSF GDB later.
In this case (a general problem but tested for example on Fedora 13 i686):
int
main (int argc, char **argv)
{
char a[argc];
return a[0];
}
(gdb) start
(gdb) print a
../../gdb/utils.c:1251: internal-error: virtual memory exhausted: can't allocate 4294951689 bytes.
It is apparently because boundary for the variable `a' is not initialized
there. Users notice it due to Eclipse-CDT trying to automatically display all
the local variables on each step.
Apparentl no regressions on {x86_64,x86_64-m32,i686}-fedora13-linux-gnu.
But is anone aware of the reasons to use internal_error there?
I find simple error as a perfectly reasonable there.
(history only tracks it since the initial import)
IIRC this idea has been discussed with Tom Tromey, not sure of its origin.
I understand it may be offtopic for FSF GDB but from some GDB crashes I am not
sure if it can happen only due to the VLA variables.
Thanks,
Jan
gdb/
2010-06-01 Jan Kratochvil <jan.kratochvil@redhat.com>
Tom Tromey <tromey@redhat.com>
* utils.c (nomem): Change internal_error to error.
diff --git a/gdb/utils.c b/gdb/utils.c
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -721,13 +721,11 @@ malloc_failure (long size)
{
if (size > 0)
{
- internal_error (__FILE__, __LINE__,
- _("virtual memory exhausted: can't allocate %ld bytes."),
- size);
+ error (_("virtual memory exhausted: can't allocate %ld bytes."), size);
}
else
{
- internal_error (__FILE__, __LINE__, _("virtual memory exhausted."));
+ error (_("virtual memory exhausted."));
}
}

View File

@ -9,7 +9,7 @@ Subject: gdb-container-rh-pkg.patch
diff --git a/gdb/remote.c b/gdb/remote.c
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -13966,7 +13966,17 @@ remote_target::pid_to_exec_file (int pid)
@@ -13916,7 +13916,17 @@ remote_target::pid_to_exec_file (int pid)
char *annex = NULL;
if (packet_support (PACKET_qXfer_exec_file) != PACKET_ENABLE)

View File

@ -27,7 +27,7 @@ diff --git a/gdb/testsuite/gdb.base/solib-symbol.exp b/gdb/testsuite/gdb.base/so
if [get_compiler_info] {
return -1
@@ -72,8 +73,26 @@ gdb_test "br foo2" \
@@ -71,8 +72,26 @@ gdb_test "br foo2" \
"Breakpoint.*: foo2. .2 locations..*" \
"foo2 in mdlib"

View File

@ -1,123 +0,0 @@
DWARF reader: Reject sections with invalid sizes
This is another fuzzer bug, gdb/23567. This time, the fuzzer has
specifically altered the size of .debug_str:
$ eu-readelf -S objdump
Section Headers:
[Nr] Name Type Addr Off Size ES Flags Lk Inf Al
[31] .debug_str PROGBITS 0000000000000000 0057116d ffffffffffffffff 1 MS 0 0 1
When this file is loaded into GDB, the DWARF reader crashes attempting
to access the string table (or it may just store a bunch of nonsense):
[gdb-8.3-6-fc30]
$ gdb -nx -q objdump
BFD: warning: /path/to/objdump has a corrupt section with a size (ffffffffffffffff) larger than the file size
Reading symbols from /path/to/objdump...
Segmentation fault (core dumped)
Nick has already committed a BFD patch to issue the warning seen above.
[gdb master 6acc1a0b]
$ gdb -BFD: warning: /path/to/objdump has a corrupt section with a size (ffffffffffffffff) larger than the file size
Reading symbols from /path/to/objdump...
(gdb) inf func
All defined functions:
File ./../include/dwarf2.def:
186: const
8 *>(.:
;'@<40>B);
747: const
8 *<2A>(.:
;'@<40>B);
701: const
8 *<2A>D <20>
(.:
;'@<40>B);
71: const
8 *(.:
;'@<40>B);
/* and more gibberish */
Consider read_indirect_string_at_offset_from:
static const char *
read_indirect_string_at_offset_from (struct objfile *objfile,
bfd *abfd, LONGEST str_offset,
struct dwarf2_section_info *sect,
const char *form_name,
const char *sect_name)
{
dwarf2_read_section (objfile, sect);
if (sect->buffer == NULL)
error (_("%s used without %s section [in module %s]"),
form_name, sect_name, bfd_get_filename (abfd));
if (str_offset >= sect->size)
error (_("%s pointing outside of %s section [in module %s]"),
form_name, sect_name, bfd_get_filename (abfd));
gdb_assert (HOST_CHAR_BIT == 8);
if (sect->buffer[str_offset] == '\0')
return NULL;
return (const char *) (sect->buffer + str_offset);
}
With sect_size being ginormous, the code attempts to access
sect->buffer[GINORMOUS], and depending on the layout of memory,
GDB either stores a bunch of gibberish strings or crashes.
This is an attempt to mitigate this by implementing a similar approach
used by BFD. In our case, we simply reject the section with the invalid
length:
$ ./gdb -nx -q objdump
BFD: warning: /path/to/objdump has a corrupt section with a size (ffffffffffffffff) larger than the file size
Reading symbols from /path/to/objdump...
warning: Discarding section .debug_str which has a section size (ffffffffffffffff) larger than the file size [in module /path/to/objdump]
DW_FORM_strp used without .debug_str section [in module /path/to/objdump]
(No debugging symbols found in /path/to/objdump)
(gdb)
Unfortunately, I have not found a way to regression test this, since it
requires poking ELF section headers.
gdb/ChangeLog:
2019-10-16 Keith Seitz <keiths@redhat.com>
PR gdb/23567
* dwarf2read.c (dwarf2_per_objfile::locate_sections): Discard
sections whose size is greater than the file size.
Change-Id: I896ac3b4eb2207c54e8e05c16beab3051d9b4b2f
---
gdb/ChangeLog | 6 ++++++
gdb/dwarf2read.c | 9 +++++++++
2 files changed, 15 insertions(+)
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 0443b55d891..a78f818e0e8 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -2338,6 +2338,15 @@ dwarf2_per_objfile::locate_sections (bfd *abfd, asection *sectp,
if ((aflag & SEC_HAS_CONTENTS) == 0)
{
}
+ else if (elf_section_data (sectp)->this_hdr.sh_size
+ > bfd_get_file_size (abfd))
+ {
+ bfd_size_type size = elf_section_data (sectp)->this_hdr.sh_size;
+ warning (_("Discarding section %s which has a section size (%s"
+ ") larger than the file size [in module %s]"),
+ bfd_section_name (abfd, sectp), phex_nz (size, sizeof (size)),
+ bfd_get_filename (abfd));
+ }
else if (section_is_p (sectp->name, &names.info))
{
this->info.s.section = sectp;

View File

@ -12,7 +12,7 @@ https://bugzilla.redhat.com/show_bug.cgi?id=1270534
diff --git a/gdb/configure b/gdb/configure
--- a/gdb/configure
+++ b/gdb/configure
@@ -9418,6 +9418,7 @@ if test x"$prefer_curses" = xyes; then
@@ -9375,6 +9375,7 @@ if test x"$prefer_curses" = xyes; then
# search /usr/local/include, if ncurses is installed in /usr/local. A
# default installation of ncurses on alpha*-dec-osf* will lead to such
# a situation.
@ -20,7 +20,7 @@ diff --git a/gdb/configure b/gdb/configure
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing waddstr" >&5
$as_echo_n "checking for library containing waddstr... " >&6; }
if ${ac_cv_search_waddstr+:} false; then :
@@ -9442,7 +9443,7 @@ return waddstr ();
@@ -9399,7 +9400,7 @@ return waddstr ();
return 0;
}
_ACEOF
@ -29,7 +29,7 @@ diff --git a/gdb/configure b/gdb/configure
if test -z "$ac_lib"; then
ac_res="none required"
else
@@ -9516,6 +9517,7 @@ case $host_os in
@@ -9473,6 +9474,7 @@ case $host_os in
esac
# These are the libraries checked by Readline.
@ -37,7 +37,7 @@ diff --git a/gdb/configure b/gdb/configure
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing tgetent" >&5
$as_echo_n "checking for library containing tgetent... " >&6; }
if ${ac_cv_search_tgetent+:} false; then :
@@ -9540,7 +9542,7 @@ return tgetent ();
@@ -9497,7 +9499,7 @@ return tgetent ();
return 0;
}
_ACEOF
@ -49,7 +49,7 @@ diff --git a/gdb/configure b/gdb/configure
diff --git a/gdb/configure.ac b/gdb/configure.ac
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -743,7 +743,8 @@ if test x"$prefer_curses" = xyes; then
@@ -717,7 +717,8 @@ if test x"$prefer_curses" = xyes; then
# search /usr/local/include, if ncurses is installed in /usr/local. A
# default installation of ncurses on alpha*-dec-osf* will lead to such
# a situation.
@ -59,7 +59,7 @@ diff --git a/gdb/configure.ac b/gdb/configure.ac
if test "$ac_cv_search_waddstr" != no; then
curses_found=yes
@@ -785,7 +786,8 @@ case $host_os in
@@ -759,7 +760,8 @@ case $host_os in
esac
# These are the libraries checked by Readline.

View File

@ -0,0 +1,19 @@
Fix odr error
---
gdb/gdbserver/ax.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gdb/gdbserver/ax.c b/gdb/gdbserver/ax.c
index 213db410a0..42d28128fa 100644
--- a/gdb/gdbserver/ax.c
+++ b/gdb/gdbserver/ax.c
@@ -25,7 +25,7 @@
static void ax_vdebug (const char *, ...) ATTRIBUTE_PRINTF (1, 2);
#ifdef IN_PROCESS_AGENT
-int debug_agent = 0;
+bool debug_agent = 0;
#endif
static void

View File

@ -1,314 +0,0 @@
commit 55db11619271cc820adccf35abafe18966ecbf4d
Author: Tom de Vries <tdevries@suse.de>
Date: Thu May 2 17:48:44 2019 +0200
[gdb] Fix heap-use-after-free in typename_concat
When running gdb using AddressSanitizer, and loading a cc1plus binary built
with profiledbootstrap and -flto, we run into a heap-use-after-free error:
...
$ LD_PRELOAD=/usr/lib64/libasan.so.3 ./gdb -batch cc1plus
==26855==ERROR: AddressSanitizer: heap-use-after-free on address \
0x62100ad8a8b0 at pc 0x7f13803cc9e3 bp 0x7ffe55b0d090 sp 0x7ffe55b0c840
READ of size 47 at 0x62100ad8a8b0 thread T0
#0 0x7f13803cc9e2 (/usr/lib64/libasan.so.3+0x3e9e2)
#1 0x5e7a0d in typename_concat gdb/dwarf2read.c:22661
#2 0x5c6437 in partial_die_full_name gdb/dwarf2read.c:8876
#3 0x5c6555 in add_partial_symbol gdb/dwarf2read.c:8893
#4 0x5c6ecf in add_partial_subprogram gdb/dwarf2read.c:9156
#5 0x5c5e90 in scan_partial_symbols gdb/dwarf2read.c:8668
#6 0x5c6c0a in add_partial_namespace gdb/dwarf2read.c:9081
#7 0x5c5f99 in scan_partial_symbols gdb/dwarf2read.c:8702
#8 0x5c48b6 in process_psymtab_comp_unit_reader gdb/dwarf2read.c:8056
#9 0x5c3c1f in init_cutu_and_read_dies gdb/dwarf2read.c:7689
#10 0x5c4c03 in process_psymtab_comp_unit gdb/dwarf2read.c:8140
#11 0x5c58a2 in dwarf2_build_psymtabs_hard gdb/dwarf2read.c:8500
#12 0x5c0d03 in dwarf2_build_psymtabs(objfile*) gdb/dwarf2read.c:6337
#13 0x612359 in read_psyms gdb/elfread.c:1311
#14 0x798a64 in require_partial_symbols(objfile*, int) gdb/psymtab.c:115
#15 0x867d7b in read_symbols gdb/symfile.c:821
#16 0x8683d9 in syms_from_objfile_1 gdb/symfile.c:1000
#17 0x8684a1 in syms_from_objfile gdb/symfile.c:1017
#18 0x868873 in symbol_file_add_with_addrs gdb/symfile.c:1124
#19 0x868b0a in symbol_file_add_from_bfd(bfd*, char const*, \
enum_flags<symfile_add_flag>, std::vector<other_sections, \
std::allocator<other_sections> >*, \
enum_flags<objfile_flag>, objfile*) gdb/symfile.c:1204
#20 0x868b64 in symbol_file_add(char const*, \
enum_flags<symfile_add_flag>, \
std::vector<other_sections, \
std::allocator<other_sections> >*, \
enum_flags<objfile_flag>) gdb/symfile.c:1217
#21 0x868c39 in symbol_file_add_main_1 gdb/symfile.c:1240
#22 0x868bd0 in symbol_file_add_main(char const*, \
enum_flags<symfile_add_flag>) gdb/symfile.c:1231
#23 0x71f1b2 in symbol_file_add_main_adapter gdb/main.c:395
#24 0x71f10e in catch_command_errors gdb/main.c:372
#25 0x71ff5f in captured_main_1 gdb/main.c:1043
#26 0x72045d in captured_main gdb/main.c:1163
#27 0x7204c8 in gdb_main(captured_main_args*) gdb/main.c:1188
#28 0x40fd7d in main gdb/gdb.c:32
#29 0x7f137e300f49 in __libc_start_main (/lib64/libc.so.6+0x20f49)
#30 0x40fc89 in _start (/data/gdb_versions/devel/build/gdb/gdb+0x40fc89)
0x62100ad8a8b0 is located 944 bytes inside of 4064-byte region \
[0x62100ad8a500,0x62100ad8b4e0)
freed by thread T0 here:
#0 0x7f13804523a0 in __interceptor_free (/usr/lib64/libasan.so.3+0xc43a0)
#1 0x435e44 in xfree<void> gdb/common/common-utils.h:60
#2 0xa82c25 in call_freefun libiberty/obstack.c:103
#3 0xa83098 in _obstack_free libiberty/obstack.c:280
#4 0x4367da in auto_obstack::~auto_obstack() gdb/gdb_obstack.h:101
#5 0x5ed72c in dwarf2_cu::~dwarf2_cu() gdb/dwarf2read.c:25341
#6 0x5fb5bb in std::default_delete<dwarf2_cu>::operator()(dwarf2_cu*) const \
/usr/include/c++/7/bits/unique_ptr.h:78
#7 0x5f7334 in std::unique_ptr<dwarf2_cu, \
std::default_delete<dwarf2_cu> >::~unique_ptr() \
/usr/include/c++/7/bits/unique_ptr.h:268
#8 0x5c3ce5 in init_cutu_and_read_dies gdb/dwarf2read.c:7624
#9 0x5c4c03 in process_psymtab_comp_unit gdb/dwarf2read.c:8140
#10 0x5c58a2 in dwarf2_build_psymtabs_hard gdb/dwarf2read.c:8500
#11 0x5c0d03 in dwarf2_build_psymtabs(objfile*) gdb/dwarf2read.c:6337
#12 0x612359 in read_psyms gdb/elfread.c:1311
#13 0x798a64 in require_partial_symbols(objfile*, int) gdb/psymtab.c:115
#14 0x867d7b in read_symbols gdb/symfile.c:821
#15 0x8683d9 in syms_from_objfile_1 gdb/symfile.c:1000
#16 0x8684a1 in syms_from_objfile gdb/symfile.c:1017
#17 0x868873 in symbol_file_add_with_addrs gdb/symfile.c:1124
#18 0x868b0a in symbol_file_add_from_bfd(bfd*, char const*, \
enum_flags<symfile_add_flag>, std::vector<other_sections, \
std::allocator<other_sections> >*, \
enum_flags<objfile_flag>, objfile*) gdb/symfile.c:1204
#19 0x868b64 in symbol_file_add(char const*, \
enum_flags<symfile_add_flag>, std::vector<other_sections, \
std::allocator<other_sections> >*, \
enum_flags<objfile_flag>) gdb/symfile.c:1217
#20 0x868c39 in symbol_file_add_main_1 gdb/symfile.c:1240
#21 0x868bd0 in symbol_file_add_main(char const*, \
enum_flags<symfile_add_flag>) gdb/symfile.c:1231
#22 0x71f1b2 in symbol_file_add_main_adapter gdb/main.c:395
#23 0x71f10e in catch_command_errors gdb/main.c:372
#24 0x71ff5f in captured_main_1 gdb/main.c:1043
#25 0x72045d in captured_main gdb/main.c:1163
#26 0x7204c8 in gdb_main(captured_main_args*) gdb/main.c:1188
#27 0x40fd7d in main gdb/gdb.c:32
#28 0x7f137e300f49 in __libc_start_main (/lib64/libc.so.6+0x20f49)
previously allocated by thread T0 here:
#0 0x7f13804526b8 in __interceptor_malloc (/usr/lib64/libasan.so.3+0xc46b8)
#1 0x5114b5 in xmalloc gdb/common/common-utils.c:44
#2 0xa82bd5 in call_chunkfun libiberty/obstack.c:94
#3 0xa82eda in _obstack_newchunk libiberty/obstack.c:206
#4 0x477310 in allocate_on_obstack::operator new(unsigned long, obstack*) \
gdb/gdb_obstack.h:117
#5 0x5dea8c in load_partial_dies gdb/dwarf2read.c:18571
#6 0x5c487f in process_psymtab_comp_unit_reader gdb/dwarf2read.c:8054
#7 0x5c3c1f in init_cutu_and_read_dies gdb/dwarf2read.c:7689
#8 0x5c4c03 in process_psymtab_comp_unit gdb/dwarf2read.c:8140
#9 0x5c58a2 in dwarf2_build_psymtabs_hard gdb/dwarf2read.c:8500
#10 0x5c0d03 in dwarf2_build_psymtabs(objfile*) gdb/dwarf2read.c:6337
#11 0x612359 in read_psyms gdb/elfread.c:1311
#12 0x798a64 in require_partial_symbols(objfile*, int) gdb/psymtab.c:115
#13 0x867d7b in read_symbols gdb/symfile.c:821
#14 0x8683d9 in syms_from_objfile_1 gdb/symfile.c:1000
#15 0x8684a1 in syms_from_objfile gdb/symfile.c:1017
#16 0x868873 in symbol_file_add_with_addrs gdb/symfile.c:1124
#17 0x868b0a in symbol_file_add_from_bfd(bfd*, char const*, \
enum_flags<symfile_add_flag>, \
std::vector<other_sections, \
std::allocator<other_sections> >*, \
enum_flags<objfile_flag>, objfile*) gdb/symfile.c:1204
#18 0x868b64 in symbol_file_add(char const*, enum_flags<symfile_add_flag>, \
std::vector<other_sections, \
std::allocator<other_sections> >*, \
enum_flags<objfile_flag>) gdb/symfile.c:1217
#19 0x868c39 in symbol_file_add_main_1 gdb/symfile.c:1240
#20 0x868bd0 in symbol_file_add_main(char const*, \
enum_flags<symfile_add_flag>) gdb/symfile.c:1231
#21 0x71f1b2 in symbol_file_add_main_adapter gdb/main.c:395
#22 0x71f10e in catch_command_errors gdb/main.c:372
#23 0x71ff5f in captured_main_1 gdb/main.c:1043
#24 0x72045d in captured_main gdb/main.c:1163
#25 0x7204c8 in gdb_main(captured_main_args*) gdb/main.c:1188
#26 0x40fd7d in main gdb/gdb.c:32
#27 0x7f137e300f49 in __libc_start_main (/lib64/libc.so.6+0x20f49)
...
This error happens as follows.
The function find_partial_die has a cu argument, but returns a pdi which may
or may not be from that cu:
...
/* Find a partial DIE at OFFSET, which may or may not be in CU,
except in the case of .debug_types DIEs which do not reference
outside their CU (they do however referencing other types via
DW_FORM_ref_sig8). */
static struct partial_die_info *
find_partial_die (sect_offset sect_off, int offset_in_dwz, struct dwarf2_cu *cu)
...
So the pdi returned by find_partial_die here in partial_die_parent_scope may
be from another cu:
...
partial_die_parent_scope (struct partial_die_info *pdi,
struct dwarf2_cu *cu)
{
const char *grandparent_scope;
struct partial_die_info *parent, *real_pdi;
/* We need to look at our parent DIE; if we have a DW_AT_specification,
then this means the parent of the specification DIE. */
real_pdi = pdi;
while (real_pdi->has_specification)
real_pdi = find_partial_die (real_pdi->spec_offset,
real_pdi->spec_is_dwz, cu);
parent = real_pdi->die_parent;
...
in which case both real_pdi and parent will be not from cu, but from another
one, say cu2.
Subsequently, cu's comp_unit_obstack is used to set parent->scope:
...
parent->scope = typename_concat (&cu->comp_unit_obstack,
grandparent_scope,
parent->name, 0, cu);
...
So, we use cu->comp_unit_obstack to assign a value to the scope field of
a pdi belonging to cu2, and when cu is deleted, the scope field points to a
freed value.
Fix this by making find_partial_die return the cu corresponding to the
returned pdi, and handling this at the call sites.
Tested on x86_64-linux.
gdb/ChangeLog:
2019-05-03 Tom de Vries <tdevries@suse.de>
PR gdb/24094
* dwarf2read.c (struct cu_partial_die_info): New struct.
(find_partial_die): Return cu_partial_die_info.
(partial_die_parent_scope, guess_partial_die_structure_name)
(partial_die_info::fixup): Handle new return type of find_partial_die.
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index b0bdecf96f..442b618f6e 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -1518,8 +1518,14 @@ static unsigned int peek_abbrev_code (bfd *, const gdb_byte *);
static struct partial_die_info *load_partial_dies
(const struct die_reader_specs *, const gdb_byte *, int);
-static struct partial_die_info *find_partial_die (sect_offset, int,
- struct dwarf2_cu *);
+struct cu_partial_die_info
+{
+ struct dwarf2_cu *cu;
+ struct partial_die_info *pdi;
+};
+
+static struct cu_partial_die_info find_partial_die (sect_offset, int,
+ struct dwarf2_cu *);
static const gdb_byte *read_attribute (const struct die_reader_specs *,
struct attribute *, struct attr_abbrev *,
@@ -8771,14 +8777,19 @@ partial_die_parent_scope (struct partial_die_info *pdi,
{
const char *grandparent_scope;
struct partial_die_info *parent, *real_pdi;
+ struct cu_partial_die_info res;
/* We need to look at our parent DIE; if we have a DW_AT_specification,
then this means the parent of the specification DIE. */
real_pdi = pdi;
while (real_pdi->has_specification)
- real_pdi = find_partial_die (real_pdi->spec_offset,
- real_pdi->spec_is_dwz, cu);
+ {
+ res = find_partial_die (real_pdi->spec_offset,
+ real_pdi->spec_is_dwz, cu);
+ real_pdi = res.pdi;
+ cu = res.cu;
+ }
parent = real_pdi->die_parent;
if (parent == NULL)
@@ -18922,7 +18933,7 @@ dwarf2_cu::find_partial_die (sect_offset sect_off)
outside their CU (they do however referencing other types via
DW_FORM_ref_sig8). */
-static struct partial_die_info *
+static struct cu_partial_die_info
find_partial_die (sect_offset sect_off, int offset_in_dwz, struct dwarf2_cu *cu)
{
struct dwarf2_per_objfile *dwarf2_per_objfile
@@ -18936,7 +18947,12 @@ find_partial_die (sect_offset sect_off, int offset_in_dwz, struct dwarf2_cu *cu)
{
pd = cu->find_partial_die (sect_off);
if (pd != NULL)
- return pd;
+ {
+ struct cu_partial_die_info res;
+ res.pdi = pd;
+ res.cu = cu;
+ return res;
+ }
/* We missed recording what we needed.
Load all dies and try again. */
per_cu = cu->per_cu;
@@ -18984,7 +19000,12 @@ find_partial_die (sect_offset sect_off, int offset_in_dwz, struct dwarf2_cu *cu)
_("could not find partial DIE %s "
"in cache [from module %s]\n"),
sect_offset_str (sect_off), bfd_get_filename (objfile->obfd));
- return pd;
+ {
+ struct cu_partial_die_info res;
+ res.pdi = pd;
+ res.cu = per_cu->cu;
+ return res;
+ }
}
/* See if we can figure out if the class lives in a namespace. We do
@@ -19003,6 +19024,7 @@ guess_partial_die_structure_name (struct partial_die_info *struct_pdi,
struct partial_die_info *real_pdi;
struct partial_die_info *child_pdi;
+ struct cu_partial_die_info res;
/* If this DIE (this DIE's specification, if any) has a parent, then
we should not do this. We'll prepend the parent's fully qualified
@@ -19010,8 +19032,12 @@ guess_partial_die_structure_name (struct partial_die_info *struct_pdi,
real_pdi = struct_pdi;
while (real_pdi->has_specification)
- real_pdi = find_partial_die (real_pdi->spec_offset,
- real_pdi->spec_is_dwz, cu);
+ {
+ res = find_partial_die (real_pdi->spec_offset,
+ real_pdi->spec_is_dwz, cu);
+ real_pdi = res.pdi;
+ cu = res.cu;
+ }
if (real_pdi->die_parent != NULL)
return;
@@ -19056,8 +19082,11 @@ partial_die_info::fixup (struct dwarf2_cu *cu)
if (name == NULL && has_specification)
{
struct partial_die_info *spec_die;
+ struct cu_partial_die_info res;
- spec_die = find_partial_die (spec_offset, spec_is_dwz, cu);
+ res = find_partial_die (spec_offset, spec_is_dwz, cu);
+ spec_die = res.pdi;
+ cu = res.cu;
spec_die->fixup (cu);

View File

@ -1,32 +0,0 @@
Fix incorrect use of 'is' operator for comparison in python/lib/gdb/command/prompt.py
The 'is' operator is not meant to be used for comparisons. It currently working
is an implementation detail of CPython. CPython 3.8 has added a SyntaxWarning
for this.
---
gdb/python/lib/gdb/command/prompt.py | 4 ++--
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/gdb/python/lib/gdb/command/prompt.py b/gdb/python/lib/gdb/command/prompt.py
index 3d662a7d3f..04b9e49c22 100644
--- a/gdb/python/lib/gdb/command/prompt.py
+++ b/gdb/python/lib/gdb/command/prompt.py
@@ -45,7 +45,7 @@ The currently defined substitutions are:
self.hook_set = False
def get_show_string (self, pvalue):
- if self.value is not '':
+ if self.value:
return "The extended prompt is: " + self.value
else:
return "The extended prompt is not set."
@@ -57,7 +57,7 @@ The currently defined substitutions are:
return ""
def before_prompt_hook(self, current):
- if self.value is not '':
+ if self.value:
return gdb.prompt.substitute_prompt(self.value)
else:
return None

View File

@ -0,0 +1,216 @@
Fix Python3.9 related runtime problems
Python3.9b1 is now available on Rawhide. GDB w/ Python 3.9 support
can be built using the configure switch -with-python=/usr/bin/python3.9.
Attempting to run gdb/Python3.9 segfaults on startup:
#0 0x00007ffff7b0582c in PyEval_ReleaseLock () from /lib64/libpython3.9.so.1.0
#1 0x000000000069ccbf in do_start_initialization ()
at worktree-test1/gdb/python/python.c:1789
#2 _initialize_python ()
at worktree-test1/gdb/python/python.c:1877
#3 0x00000000007afb0a in initialize_all_files () at init.c:237
...
Consulting the the documentation...
https://docs.python.org/3/c-api/init.html
...we find that PyEval_ReleaseLock() has been deprecated since version
3.2. It recommends using PyEval_SaveThread or PyEval_ReleaseThread()
instead. In do_start_initialization, in gdb/python/python.c, we
can replace the calls to PyThreadState_Swap() and PyEval_ReleaseLock()
with a single call to PyEval_SaveThread. (Thanks to Keith Seitz
for working this out.)
With that in place, GDB gets a little bit further. It still dies
on startup, but the backtrace is different:
#0 0x00007ffff7b04306 in PyOS_InterruptOccurred ()
from /lib64/libpython3.9.so.1.0
#1 0x0000000000576e86 in check_quit_flag ()
at worktree-test1/gdb/extension.c:776
#2 0x0000000000576f8a in set_active_ext_lang (now_active=now_active@entry=0x983c00 <extension_language_python>)
at worktree-test1/gdb/extension.c:705
#3 0x000000000069d399 in gdbpy_enter::gdbpy_enter (this=0x7fffffffd2d0,
gdbarch=0x0, language=0x0)
at worktree-test1/gdb/python/python.c:211
#4 0x0000000000686e00 in python_new_inferior (inf=0xddeb10)
at worktree-test1/gdb/python/py-inferior.c:251
#5 0x00000000005d9fb9 in std::function<void (inferior*)>::operator()(inferior*) const (__args#0=<optimized out>, this=0xccad20)
at /usr/include/c++/10/bits/std_function.h:617
#6 gdb::observers::observable<inferior*>::notify (args#0=0xddeb10,
this=<optimized out>)
at worktree-test1/gdb/../gdbsupport/observable.h:106
#7 add_inferior_silent (pid=0)
at worktree-test1/gdb/inferior.c:113
#8 0x00000000005dbcb8 in initialize_inferiors ()
at worktree-test1/gdb/inferior.c:947
...
We checked with some Python Developers and were told that we should
acquire the GIL prior to calling any Python C API function. We
definitely don't have the GIL for calls of PyOS_InterruptOccurred().
I moved class_gdbpy_gil earlier in the file and use it in
gdbpy_check_quit_flag() to acquire (and automatically release) the
GIL.
With those changes in place, I was able to run to a GDB prompt. But,
when trying to quit, it segfaulted again due to due to some other
problems with gdbpy_check_quit_flag():
Thread 1 "gdb" received signal SIGSEGV, Segmentation fault.
0x00007ffff7bbab0c in new_threadstate () from /lib64/libpython3.9.so.1.0
(top-gdb) bt 8
#0 0x00007ffff7bbab0c in new_threadstate () from /lib64/libpython3.9.so.1.0
#1 0x00007ffff7afa5ea in PyGILState_Ensure.cold ()
from /lib64/libpython3.9.so.1.0
#2 0x000000000069b58c in gdbpy_gil::gdbpy_gil (this=<synthetic pointer>)
at worktree-test1/gdb/python/python.c:278
#3 gdbpy_check_quit_flag (extlang=<optimized out>)
at worktree-test1/gdb/python/python.c:278
#4 0x0000000000576e96 in check_quit_flag ()
at worktree-test1/gdb/extension.c:776
#5 0x000000000057700c in restore_active_ext_lang (previous=0xe9c050)
at worktree-test1/gdb/extension.c:729
#6 0x000000000088913a in do_my_cleanups (
pmy_chain=0xc31870 <final_cleanup_chain>,
old_chain=0xae5720 <sentinel_cleanup>)
at worktree-test1/gdbsupport/cleanups.cc:131
#7 do_final_cleanups ()
at worktree-test1/gdbsupport/cleanups.cc:143
In this case, we're trying to call a Python C API function after
Py_Finalize() has been called from finalize_python(). I made
finalize_python set gdb_python_initialized to false and then cause
check_quit_flag() to return early when it's false.
With these changes in place, GDB seems to be working again with
Python3.9b1. I think it likely that there are other problems lurking.
I wouldn't be surprised to find that there are other calls into Python
where we don't first make sure that we have the GIL. Further changes
may well be needed.
I see no regressions testing on Rawhide using a GDB built with the
default Python version (3.8.3) versus one built using Python 3.9b1.
I've also tested on Fedora 28, 29, 30, 31, and 32 (all x86_64) using
the default (though updated) system installed versions of Python on
those OSes. This means that I've tested against Python versions
2.7.15, 2.7.17, 2.7.18, 3.7.7, 3.8.2, and 3.8.3. In each case GDB
still builds without problem and shows no regressions after applying
this patch.
gdb/ChangeLog:
2020-MM-DD Kevin Buettner <kevinb@redhat.com>
Keith Seitz <keiths@redhat.com>
* python/python.c (do_start_initialization): For Python 3.9 and
later, call PyEval_SaveThread instead of PyEval_ReleaseLock.
(class gdbpy_gil): Move to earlier in file.
(finalize_python): Set gdb_python_initialized.
(gdbpy_check_quit_flag): Acquire GIL via gdbpy_gil. Return early
when not initialized.
---
gdb/python/python.c | 56 ++++++++++++++++++++++++++++-------------------------
2 files changed, 40 insertions(+), 26 deletions(-)
diff --git a/gdb/python/python.c b/gdb/python/python.c
index 67f362b852..4bdd2201ab 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -238,6 +238,30 @@ gdbpy_enter::~gdbpy_enter ()
PyGILState_Release (m_state);
}
+/* A helper class to save and restore the GIL, but without touching
+ the other globals that are handled by gdbpy_enter. */
+
+class gdbpy_gil
+{
+public:
+
+ gdbpy_gil ()
+ : m_state (PyGILState_Ensure ())
+ {
+ }
+
+ ~gdbpy_gil ()
+ {
+ PyGILState_Release (m_state);
+ }
+
+ DISABLE_COPY_AND_ASSIGN (gdbpy_gil);
+
+private:
+
+ PyGILState_STATE m_state;
+};
+
/* Set the quit flag. */
static void
@@ -251,6 +275,10 @@ gdbpy_set_quit_flag (const struct extension_language_defn *extlang)
static int
gdbpy_check_quit_flag (const struct extension_language_defn *extlang)
{
+ if (!gdb_python_initialized)
+ return 0;
+
+ gdbpy_gil gil;
return PyOS_InterruptOccurred ();
}
@@ -943,30 +971,6 @@ gdbpy_source_script (const struct extension_language_defn *extlang,
/* Posting and handling events. */
-/* A helper class to save and restore the GIL, but without touching
- the other globals that are handled by gdbpy_enter. */
-
-class gdbpy_gil
-{
-public:
-
- gdbpy_gil ()
- : m_state (PyGILState_Ensure ())
- {
- }
-
- ~gdbpy_gil ()
- {
- PyGILState_Release (m_state);
- }
-
- DISABLE_COPY_AND_ASSIGN (gdbpy_gil);
-
-private:
-
- PyGILState_STATE m_state;
-};
-
/* A single event. */
struct gdbpy_event
{
@@ -1616,6 +1620,7 @@ finalize_python (void *ignore)
Py_Finalize ();
+ gdb_python_initialized = false;
restore_active_ext_lang (previous_active);
}
@@ -1785,8 +1790,7 @@ do_start_initialization ()
return false;
/* Release the GIL while gdb runs. */
- PyThreadState_Swap (NULL);
- PyEval_ReleaseLock ();
+ PyEval_SaveThread ();
make_final_cleanup (finalize_python, NULL);

View File

@ -49,11 +49,11 @@ gdb/testsuite/ChangeLog:
gdb/testsuite/gdb.cp/cpexprs.exp | 14 ++++++++++++--
5 files changed, 45 insertions(+), 4 deletions(-)
diff --git a/gdb/linespec.c b/gdb/linespec.c
index e902b11c8e8..2231a5674c8 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -3680,12 +3680,12 @@ find_method (struct linespec_state *self, std::vector<symtab *> *file_symtabs,
Index: gdb-9.1/gdb/linespec.c
===================================================================
--- gdb-9.1.orig/gdb/linespec.c
+++ gdb-9.1/gdb/linespec.c
@@ -3670,12 +3670,12 @@ find_method (struct linespec_state *self
because we collect data across the program space before deciding
what to do. */
last_result_len = 0;
@ -67,7 +67,7 @@ index e902b11c8e8..2231a5674c8 100644
/* Program spaces that are executing startup should have
been filtered out earlier. */
@@ -3716,7 +3716,6 @@ find_method (struct linespec_state *self, std::vector<symtab *> *file_symtabs,
@@ -3706,7 +3706,6 @@ find_method (struct linespec_state *self
superclass_vec.clear ();
last_result_len = result_names.size ();
@ -75,11 +75,10 @@ index e902b11c8e8..2231a5674c8 100644
}
}
diff --git a/gdb/testsuite/gdb.cp/cpexprs-debug-types.exp b/gdb/testsuite/gdb.cp/cpexprs-debug-types.exp
new file mode 100644
index 00000000000..9499aecf4c6
Index: gdb-9.1/gdb/testsuite/gdb.cp/cpexprs-debug-types.exp
===================================================================
--- /dev/null
+++ b/gdb/testsuite/gdb.cp/cpexprs-debug-types.exp
+++ gdb-9.1/gdb/testsuite/gdb.cp/cpexprs-debug-types.exp
@@ -0,0 +1,20 @@
+# Copyright 2020 Free Software Foundation, Inc.
+#
@ -101,11 +100,11 @@ index 00000000000..9499aecf4c6
+# Run cpexprs.exp with -fdebug-types-section.
+set flags {additional_flags=-fdebug-types-section}
+source $srcdir/$subdir/cpexprs.exp
diff --git a/gdb/testsuite/gdb.cp/cpexprs.exp b/gdb/testsuite/gdb.cp/cpexprs.exp
index ecf3a2fbc8d..618388cef3d 100644
--- a/gdb/testsuite/gdb.cp/cpexprs.exp
+++ b/gdb/testsuite/gdb.cp/cpexprs.exp
@@ -690,13 +690,23 @@ if { [istarget "spu*-*-*"] } {
Index: gdb-9.1/gdb/testsuite/gdb.cp/cpexprs.exp
===================================================================
--- gdb-9.1.orig/gdb/testsuite/gdb.cp/cpexprs.exp
+++ gdb-9.1/gdb/testsuite/gdb.cp/cpexprs.exp
@@ -685,13 +685,23 @@ if {[skip_cplus_tests]} { continue }
# test running programs
#

View File

@ -1,30 +0,0 @@
In gdb-rhbz795424-bitpos-20of25.patch, the TYPE_LENGTH is changed from
unsigned to ULONGEST.
This breaks the build on RISC-V:
...
gdb/riscv-tdep.c: In function 'int riscv_type_alignment(type*)':
gdb/riscv-tdep.c:1648:64: error: no matching function for call to \
'min(ULONGEST&, unsigned int)'
return std::min (TYPE_LENGTH (t), (unsigned) BIGGEST_ALIGNMENT);
...
Fix this by backporting a fragment of an unrelated commit on master that
also changes TYPE_LENGTH from unsigned to ULONGEST.
...
$ git show --pretty=%p cc1defb1dc gdb/riscv-tdep.c
...
diff --git a/gdb/riscv-tdep.c b/gdb/riscv-tdep.c
index 8a996f32d3..ff5f36e762 100644
--- a/gdb/riscv-tdep.c
+++ b/gdb/riscv-tdep.c
@@ -1645,7 +1645,7 @@ riscv_type_alignment (struct type *t)
case TYPE_CODE_ARRAY:
if (TYPE_VECTOR (t))
- return std::min (TYPE_LENGTH (t), (unsigned) BIGGEST_ALIGNMENT);
+ return std::min (TYPE_LENGTH (t), (ULONGEST) BIGGEST_ALIGNMENT);
/* FALLTHROUGH */
case TYPE_CODE_COMPLEX:

View File

@ -1,76 +0,0 @@
Index: gdb-8.2/gdb/dwarf2read.c
===================================================================
--- gdb-8.2.orig/gdb/dwarf2read.c 2018-09-11 15:25:32.000000000 +0200
+++ gdb-8.2/gdb/dwarf2read.c 2018-09-12 15:44:50.000000000 +0200
@@ -3236,7 +3236,7 @@ create_addrmap_from_aranges (struct dwar
const uint8_t offset_size = dwarf5_is_dwarf64 ? 8 : 4;
if (addr + entry_length > section->buffer + section->size)
{
- warning (_("Section .debug_aranges in %s entry at offset %zu "
+ warning (_("Section .debug_aranges in %s entry at offset %td "
"length %s exceeds section length %s, "
"ignoring .debug_aranges."),
objfile_name (objfile), entry_addr - section->buffer,
@@ -3250,7 +3250,7 @@ create_addrmap_from_aranges (struct dwar
addr += 2;
if (version != 2)
{
- warning (_("Section .debug_aranges in %s entry at offset %zu "
+ warning (_("Section .debug_aranges in %s entry at offset %tu "
"has unsupported version %d, ignoring .debug_aranges."),
objfile_name (objfile), entry_addr - section->buffer,
version);
@@ -3264,7 +3264,7 @@ create_addrmap_from_aranges (struct dwar
= debug_info_offset_to_per_cu.find (sect_offset (debug_info_offset));
if (per_cu_it == debug_info_offset_to_per_cu.cend ())
{
- warning (_("Section .debug_aranges in %s entry at offset %zu "
+ warning (_("Section .debug_aranges in %s entry at offset %tu "
"debug_info_offset %s does not exists, "
"ignoring .debug_aranges."),
objfile_name (objfile), entry_addr - section->buffer,
@@ -3276,7 +3276,7 @@ create_addrmap_from_aranges (struct dwar
const uint8_t address_size = *addr++;
if (address_size < 1 || address_size > 8)
{
- warning (_("Section .debug_aranges in %s entry at offset %zu "
+ warning (_("Section .debug_aranges in %s entry at offset %tu "
"address_size %u is invalid, ignoring .debug_aranges."),
objfile_name (objfile), entry_addr - section->buffer,
address_size);
@@ -3286,7 +3286,7 @@ create_addrmap_from_aranges (struct dwar
const uint8_t segment_selector_size = *addr++;
if (segment_selector_size != 0)
{
- warning (_("Section .debug_aranges in %s entry at offset %zu "
+ warning (_("Section .debug_aranges in %s entry at offset %tu "
"segment_selector_size %u is not supported, "
"ignoring .debug_aranges."),
objfile_name (objfile), entry_addr - section->buffer,
@@ -3302,7 +3302,7 @@ create_addrmap_from_aranges (struct dwar
padding > 0; padding--)
if (*addr++ != 0)
{
- warning (_("Section .debug_aranges in %s entry at offset %zu "
+ warning (_("Section .debug_aranges in %s entry at offset %tu "
"padding is not zero, ignoring .debug_aranges."),
objfile_name (objfile), entry_addr - section->buffer);
return;
@@ -3312,7 +3312,7 @@ create_addrmap_from_aranges (struct dwar
{
if (addr + 2 * address_size > entry_end)
{
- warning (_("Section .debug_aranges in %s entry at offset %zu "
+ warning (_("Section .debug_aranges in %s entry at offset %tu "
"address list is not properly terminated, "
"ignoring .debug_aranges."),
objfile_name (objfile), entry_addr - section->buffer);
@@ -5537,7 +5537,7 @@ read_debug_names_from_section (struct ob
if (addr != abbrev_table_start + abbrev_table_size)
{
warning (_("Section .debug_names in %s has abbreviation_table "
- "of size %zu vs. written as %u, ignoring .debug_names."),
+ "of size %tu vs. written as %u, ignoring .debug_names."),
filename, addr - abbrev_table_start, abbrev_table_size);
return false;
}

View File

@ -0,0 +1,65 @@
Fix the thread-pool.c compilation
A recent commit removed DIAGNOSTIC_IGNORE_UNUSED_FUNCTION, which was
used in thread-pool.c. This patch changes this code to use
ATTRIBUTE_UNUSED instead.
Tested by rebuilding.
gdb/ChangeLog
2019-12-12 Tom Tromey <tromey@adacore.com>
* gdbsupport/thread-pool.c (set_thread_name): Use
ATTRIBUTE_UNUSED.
Change-Id: I56d46eaac73690565d0e52db1791411567a918dd
---
gdb/ChangeLog | 5 +++++
gdb/gdbsupport/thread-pool.c | 10 ++--------
2 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/gdb/gdbsupport/thread-pool.c b/gdb/gdbsupport/thread-pool.c
index 1b3e44c670..fc83ff765f 100644
--- a/gdb/gdbsupport/thread-pool.c
+++ b/gdb/gdbsupport/thread-pool.c
@@ -25,7 +25,6 @@
#include "gdbsupport/alt-stack.h"
#include "gdbsupport/block-signals.h"
#include <algorithm>
-#include "diagnostics.h"
/* On the off chance that we have the pthread library on a Windows
host, but std::thread is not using it, avoid calling
@@ -40,14 +39,11 @@
#include <pthread.h>
-DIAGNOSTIC_PUSH
-DIAGNOSTIC_IGNORE_UNUSED_FUNCTION
-
/* Handle platform discrepancies in pthread_setname_np: macOS uses a
single-argument form, while Linux uses a two-argument form. This
wrapper handles the difference. */
-static void
+ATTRIBUTE_UNUSED static void
set_thread_name (int (*set_name) (pthread_t, const char *), const char *name)
{
set_name (pthread_self (), name);
@@ -55,14 +51,12 @@ set_thread_name (int (*set_name) (pthread_t, const char *), const char *name)
/* The macOS man page says that pthread_setname_np returns "void", but
the headers actually declare it returning "int". */
-static void
+ATTRIBUTE_UNUSED static void
set_thread_name (int (*set_name) (const char *), const char *name)
{
set_name (name);
}
-DIAGNOSTIC_POP
-
#endif /* USE_PTHREAD_SETNAME_NP */
namespace gdb

View File

@ -1,43 +1,8 @@
gdb: Fix toplevel types with -fdebug-types-section
When debugging a program compiled with -fdebug-types-section,
only the first top-level type in each file is visible to gdb.
The problem was caused by moving the assignment to list_in_scope
from process_full_comp_unit and process_full_type_unit to
start_symtab. This was fine for process_full_comp_unit, because
symtabs and comp units are one-to-one. But there can be many type
units per symtab (one for each type), and we only call start_symtab
for the first one. This adds the necessary assignments on the paths
where start_symtab is not called.
gdb/Changelog:
2020-04-28 Mark Williams <mark@myosotissp.com>
PR gdb/24480
* dwarf2read.c: Add missing assingments to list_in_scope when
start_symtab was already called.
gdb/testsuite/Changelog:
2020-04-28 Mark Williams <mark@myosotissp.com>
PR gdb/24480
* dw4-toplevel-types.exp: Test for top level types.
* dw4-toplevel-types.cc: Test for top level types.
---
gdb/dwarf2read.c | 2 ++
gdb/testsuite/gdb.dwarf2/dw4-toplevel-types.cc | 21 +++++++++++++++
gdb/testsuite/gdb.dwarf2/dw4-toplevel-types.exp | 36 +++++++++++++++++++++++++
3 files changed, 59 insertions(+)
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 4251ed03b46..7e6f1a0ff62 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -11666,6 +11666,7 @@ dwarf2_cu::setup_type_unit_groups (struct die_info *die)
Index: gdb-9.1/gdb/dwarf2read.c
===================================================================
--- gdb-9.1.orig/gdb/dwarf2read.c
+++ gdb-9.1/gdb/dwarf2read.c
@@ -11759,6 +11759,7 @@ dwarf2_cu::setup_type_unit_groups (struc
COMPUNIT_DIRNAME (cust),
compunit_language (cust),
0, cust));
@ -45,19 +10,18 @@ index 4251ed03b46..7e6f1a0ff62 100644
}
return;
}
@@ -11717,6 +11718,7 @@ dwarf2_cu::setup_type_unit_groups (struct die_info *die)
@@ -11810,6 +11811,7 @@ dwarf2_cu::setup_type_unit_groups (struc
COMPUNIT_DIRNAME (cust),
compunit_language (cust),
0, cust));
+ list_in_scope = get_builder ()->get_file_symbols ();
for (i = 0; i < line_header->file_names.size (); ++i)
{
diff --git a/gdb/testsuite/gdb.dwarf2/dw4-toplevel-types.cc b/gdb/testsuite/gdb.dwarf2/dw4-toplevel-types.cc
new file mode 100644
index 00000000000..c47598c46ef
auto &file_names = line_header->file_names ();
for (i = 0; i < file_names.size (); ++i)
Index: gdb-9.1/gdb/testsuite/gdb.dwarf2/dw4-toplevel-types.cc
===================================================================
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/dw4-toplevel-types.cc
+++ gdb-9.1/gdb/testsuite/gdb.dwarf2/dw4-toplevel-types.cc
@@ -0,0 +1,21 @@
+/* This testcase is part of GDB, the GNU debugger.
+
@ -80,11 +44,10 @@ index 00000000000..c47598c46ef
+struct Y {} y;
+struct Z {} z;
+int main() {}
diff --git a/gdb/testsuite/gdb.dwarf2/dw4-toplevel-types.exp b/gdb/testsuite/gdb.dwarf2/dw4-toplevel-types.exp
new file mode 100644
index 00000000000..8e3875ad71e
Index: gdb-9.1/gdb/testsuite/gdb.dwarf2/dw4-toplevel-types.exp
===================================================================
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/dw4-toplevel-types.exp
+++ gdb-9.1/gdb/testsuite/gdb.dwarf2/dw4-toplevel-types.exp
@@ -0,0 +1,36 @@
+# Copyright 2020 Free Software Foundation, Inc.
+

View File

@ -0,0 +1,123 @@
Fix unused function error
Attempting to build GDB in Ubuntu 16.04.6 LTS on x86_64, I ran into warnings
that caused the build to fail:
binutils-gdb/gdb/gdbsupport/safe-strerror.c:44:1: error: char* select_strerror_r(char*, char*) defined but not used [-Werror=unused-function] select_strerror_r (char *res, char *)
The diagnostic macro DIAGNOSTIC_IGNORE_UNUSED_FUNCTION seems to expand
correctly to its respective pragma, but this doesn't seem to have an effect on
the warning. I tried to use the pragma explicitly and got the same result.
ATTRIBUTE_UNUSED works fine in this case if you put it in both functions,
which should fix warnings for both gdb and gdbserver builds.
The compiler version is gcc (Ubuntu 5.4.0-6ubuntu1~16.04.11) 5.4.0 20160609.
This is likely the result of PR64079 in GCC, which was fixed by commit
9e96f1e1b9731c4e1ef4fbbbf0997319973f0537.
To prevent other developers from attempting to use this macro, only to get
confused by it not working as expected, it seems better to not define this
particular macro.
gdb/ChangeLog:
2019-12-12 Luis Machado <luis.machado@linaro.org>
* gdbsupport/safe-strerror.c: Don't include diagnostics.h.
(select_strerror_r): Use ATTRIBUTE_UNUSED instead of the diagnostics
macros.
include/ChangeLog:
2019-12-12 Luis Machado <luis.machado@linaro.org>
* diagnostics.h (DIAGNOSTIC_IGNORE_UNUSED_FUNCTION). Remove
definitions.
Change-Id: Iad6123d61d76d111e3ef8d24aa8c60112304c749
---
gdb/ChangeLog | 6 ++++++
gdb/gdbsupport/safe-strerror.c | 12 ++----------
include/ChangeLog | 5 +++++
include/diagnostics.h | 9 ---------
4 files changed, 13 insertions(+), 19 deletions(-)
diff --git a/gdb/gdbsupport/safe-strerror.c b/gdb/gdbsupport/safe-strerror.c
index 9973fa6785..a5ddf74835 100644
--- a/gdb/gdbsupport/safe-strerror.c
+++ b/gdb/gdbsupport/safe-strerror.c
@@ -18,7 +18,6 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "common-defs.h"
-#include "diagnostics.h"
#include <string.h>
/* There are two different versions of strerror_r; one is GNU-specific, the
@@ -27,27 +26,20 @@
to solve this for us because IPA does not use Gnulib but uses this
function. */
-/* We only ever use one of the two overloads, so suppress the warning for
- an unused function. */
-DIAGNOSTIC_PUSH
-DIAGNOSTIC_IGNORE_UNUSED_FUNCTION
-
/* Called if we have a XSI-compliant strerror_r. */
-static char *
+ATTRIBUTE_UNUSED static char *
select_strerror_r (int res, char *buf)
{
return res == 0 ? buf : nullptr;
}
/* Called if we have a GNU strerror_r. */
-static char *
+ATTRIBUTE_UNUSED static char *
select_strerror_r (char *res, char *)
{
return res;
}
-DIAGNOSTIC_POP
-
/* Implementation of safe_strerror as defined in common-utils.h. */
const char *
diff --git a/include/diagnostics.h b/include/diagnostics.h
index 2adaa4d3a0..019ade2567 100644
--- a/include/diagnostics.h
+++ b/include/diagnostics.h
@@ -53,8 +53,6 @@
DIAGNOSTIC_IGNORE ("-Wdeprecated-declarations")
# define DIAGNOSTIC_IGNORE_DEPRECATED_REGISTER \
DIAGNOSTIC_IGNORE ("-Wdeprecated-register")
-# define DIAGNOSTIC_IGNORE_UNUSED_FUNCTION \
- DIAGNOSTIC_IGNORE ("-Wunused-function")
# if __has_warning ("-Wenum-compare-switch")
# define DIAGNOSTIC_IGNORE_SWITCH_DIFFERENT_ENUM_TYPES \
DIAGNOSTIC_IGNORE ("-Wenum-compare-switch")
@@ -65,9 +63,6 @@
#elif defined (__GNUC__) /* GCC */
-# define DIAGNOSTIC_IGNORE_UNUSED_FUNCTION \
- DIAGNOSTIC_IGNORE ("-Wunused-function")
-
# define DIAGNOSTIC_IGNORE_STRINGOP_TRUNCATION \
DIAGNOSTIC_IGNORE ("-Wstringop-truncation")
@@ -88,10 +83,6 @@
# define DIAGNOSTIC_IGNORE_DEPRECATED_REGISTER
#endif
-#ifndef DIAGNOSTIC_IGNORE_UNUSED_FUNCTION
-# define DIAGNOSTIC_IGNORE_UNUSED_FUNCTION
-#endif
-
#ifndef DIAGNOSTIC_IGNORE_SWITCH_DIFFERENT_ENUM_TYPES
# define DIAGNOSTIC_IGNORE_SWITCH_DIFFERENT_ENUM_TYPES
#endif

View File

@ -1,36 +0,0 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-follow-child-stale-parent.patch
;; Fix regression by python on ia64 due to stale current frame.
;;=push+jan
Problem occurs with python and its get_current_arch () as it selects
selected_frame and current_frame while still inferior_ptid is valid for the
original parent. But since this place it is already attached and later
unwinders try to access it, breaking:
-PASS: gdb.threads/watchpoint-fork.exp: child: singlethreaded: breakpoint after the first fork
-PASS: gdb.threads/watchpoint-fork.exp: child: singlethreaded: watchpoint after the first fork
-PASS: gdb.threads/watchpoint-fork.exp: child: singlethreaded: breakpoint after the second fork
-PASS: gdb.threads/watchpoint-fork.exp: child: singlethreaded: watchpoint after the second fork
-PASS: gdb.threads/watchpoint-fork.exp: child: singlethreaded: finish
+FAIL: gdb.threads/watchpoint-fork.exp: child: singlethreaded: breakpoint after the first fork
+FAIL: gdb.threads/watchpoint-fork.exp: child: singlethreaded: watchpoint after the first fork
+FAIL: gdb.threads/watchpoint-fork.exp: child: singlethreaded: breakpoint after the second fork
+FAIL: gdb.threads/watchpoint-fork.exp: child: singlethreaded: watchpoint after the second fork
+FAIL: gdb.threads/watchpoint-fork.exp: child: singlethreaded: finish
diff --git a/gdb/infrun.c b/gdb/infrun.c
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -754,6 +754,9 @@ follow_fork (void)
}
else
{
+ /* Possibly referenced PARENT is no longer valid. */
+ reinit_frame_cache ();
+
/* This pending follow fork event is now handled, one way
or another. The previous selected thread may be gone
from the lists by now, but if it is still around, need

View File

@ -6,5 +6,5 @@ index b9770ea415..3149f6e1fe 100644
-#!/usr/bin/env bash
+#!/bin/bash
# Copyright (C) 2003-2019 Free Software Foundation, Inc.
# Copyright (C) 2003-2020 Free Software Foundation, Inc.

View File

@ -42,7 +42,7 @@ gdb/
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -10588,6 +10588,13 @@ private:
@@ -10657,6 +10657,13 @@ private:
static void
process_die (struct die_info *die, struct dwarf2_cu *cu)
{
@ -59,8 +59,8 @@ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
diff --git a/gdb/infrun.c b/gdb/infrun.c
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -609,6 +609,13 @@ holding the child stopped. Try \"set detach-on-fork\" or \
target_pid_to_str (process_ptid));
@@ -601,6 +601,13 @@ holding the child stopped. Try \"set detach-on-fork\" or \
target_pid_to_str (process_ptid).c_str ());
}
+#ifdef NEED_DETACH_SIGSTOP
@ -76,7 +76,7 @@ diff --git a/gdb/infrun.c b/gdb/infrun.c
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -192,6 +192,12 @@ struct linux_nat_target *linux_target;
@@ -189,6 +189,12 @@ struct linux_nat_target *linux_target;
/* Does the current host support PTRACE_GETREGSET? */
enum tribool have_ptrace_getregset = TRIBOOL_UNKNOWN;
@ -89,7 +89,7 @@ diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
static unsigned int debug_linux_nat;
static void
show_debug_linux_nat (struct ui_file *file, int from_tty,
@@ -1037,6 +1043,9 @@ linux_nat_post_attach_wait (ptid_t ptid, int *signalled)
@@ -1030,6 +1036,9 @@ linux_nat_post_attach_wait (ptid_t ptid, int *signalled)
if (debug_linux_nat)
fprintf_unfiltered (gdb_stdlog,
"LNPAW: Attaching to a stopped process\n");
@ -99,7 +99,7 @@ diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
/* The process is definitely stopped. It is in a job control
stop, unless the kernel predates the TASK_STOPPED /
@@ -1369,6 +1378,25 @@ get_detach_signal (struct lwp_info *lp)
@@ -1361,6 +1370,25 @@ get_detach_signal (struct lwp_info *lp)
return gdb_signal_to_host (signo);
}
@ -125,7 +125,7 @@ diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
return 0;
}
@@ -1517,6 +1545,10 @@ linux_nat_target::detach (inferior *inf, int from_tty)
@@ -1509,6 +1537,10 @@ linux_nat_target::detach (inferior *inf, int from_tty)
detach_one_lwp (main_lwp, &signo);
detach_success (inf);
@ -136,7 +136,7 @@ diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
}
}
@@ -1775,6 +1807,16 @@ linux_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signo)
@@ -1766,6 +1798,16 @@ linux_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signo)
return;
}
@ -151,9 +151,9 @@ diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
+
+#endif
if (resume_many)
iterate_over_lwps (ptid, linux_nat_resume_callback, lp);
@@ -3763,6 +3805,10 @@ linux_nat_target::mourn_inferior ()
iterate_over_lwps (ptid, [=] (struct lwp_info *info)
{
@@ -3770,6 +3812,10 @@ linux_nat_target::mourn_inferior ()
/* Let the arch-specific native code know this process is gone. */
linux_target->low_forget_process (pid);

View File

@ -9,7 +9,7 @@ Subject: gdb-jit-reader-multilib.patch
diff --git a/gdb/configure b/gdb/configure
--- a/gdb/configure
+++ b/gdb/configure
@@ -9705,10 +9705,12 @@ _ACEOF
@@ -9694,10 +9694,12 @@ _ACEOF
@ -28,7 +28,7 @@ diff --git a/gdb/configure b/gdb/configure
diff --git a/gdb/configure.ac b/gdb/configure.ac
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -820,10 +820,12 @@ AC_CHECK_SIZEOF(unsigned long long)
@@ -808,10 +808,12 @@ AC_CHECK_SIZEOF(unsigned long long)
AC_CHECK_SIZEOF(unsigned long)
AC_CHECK_SIZEOF(unsigned __int128)

View File

@ -1,23 +0,0 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-libexec-add-index.patch
;; Fix gdb-headless /usr/bin/ executables (BZ 1390251).
;;=fedora
diff --git a/gdb/contrib/gdb-add-index.sh b/gdb/contrib/gdb-add-index.sh
--- a/gdb/contrib/gdb-add-index.sh
+++ b/gdb/contrib/gdb-add-index.sh
@@ -21,6 +21,11 @@
GDB=${GDB:=gdb}
OBJCOPY=${OBJCOPY:=objcopy}
+GDB2=/usr/libexec/gdb
+if test -x $GDB2 && ! which $GDB &>/dev/null; then
+ GDB=$GDB2
+fi
+
myname="${0##*/}"
dwarf5=""

View File

@ -9,7 +9,7 @@ Subject: gdb-linux_perf-bundle.patch
diff --git a/gdb/configure b/gdb/configure
--- a/gdb/configure
+++ b/gdb/configure
@@ -12137,7 +12137,7 @@ else
@@ -11905,7 +11905,7 @@ else
#include <linux/perf_event.h>
#ifndef PERF_ATTR_SIZE_VER5
@ -21,7 +21,7 @@ diff --git a/gdb/configure b/gdb/configure
diff --git a/gdb/configure.ac b/gdb/configure.ac
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -1500,7 +1500,7 @@ else
@@ -1414,7 +1414,7 @@ else
AC_PREPROC_IFELSE([AC_LANG_SOURCE([[
#include <linux/perf_event.h>
#ifndef PERF_ATTR_SIZE_VER5
@ -56,7 +56,7 @@ diff --git a/gdb/gdb.c b/gdb/gdb.c
diff --git a/gdb/nat/linux-btrace.h b/gdb/nat/linux-btrace.h
--- a/gdb/nat/linux-btrace.h
+++ b/gdb/nat/linux-btrace.h
@@ -28,6 +28,177 @@
@@ -27,6 +27,177 @@
# include <linux/perf_event.h>
#endif

View File

@ -14,7 +14,7 @@ Bug in FSF GDB exploited by the ptrace-on-utrace interaction.
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -11929,6 +11929,8 @@ update_global_location_list (enum ugll_insert_mode insert_mode)
@@ -11904,6 +11904,8 @@ update_global_location_list (enum ugll_insert_mode insert_mode)
traps we can no longer explain. */
old_loc->events_till_retirement = 3 * (thread_count () + 1);

View File

@ -1,178 +0,0 @@
[gdb] Only force INTERP_CONSOLE ui_out for breakpoint commands in MI mode
The problem reported in PR mi/25055 is that the output of the backtrace
command, when executed as breakpoint command does not show when executing
using the MI interpreter:
...
$ gdb a.out
Reading symbols from a.out...
(gdb) break main
Breakpoint 1 at 0x4003c0: file test.c, line 19.
(gdb) commands
Type commands for breakpoint(s) 1, one per line.
End with a line saying just "end".
>bt
>end
(gdb) interpreter-exec mi "-exec-run"
^done
Breakpoint 1, main () at test.c:19
19 return foo (4);
(gdb)
...
Interestingly, the function print_frame is called twice during -exec-run:
- once during tui_on_normal_stop where the ui_out is temporarily set to
tui->interp_ui_out (), resulting in the part after the comma in
"Breakpoint 1, main () at test.c:19"
- once during execute_control_command, where the ui_out is the default for the
current interpreter: mi_ui_out, which ignores calls to output text.
The commit 3a87ae656c2 "Use console uiout when executing breakpoint commands"
fixes the problem by temporarily switching to the ui_out of INTERP_CONSOLE in
execute_control_command.
This however caused a regression in redirection (escaping '#' using '\' for
git commit message convenience):
...
$ rm -f gdb.txt; gdb a.out
Reading symbols from a.out...
(gdb) break main
Breakpoint 1 at 0x4003c0: file test.c, line 19.
(gdb) commands
Type commands for breakpoint(s) 1, one per line.
End with a line saying just "end".
>bt
>end
(gdb) set logging redirect on
(gdb) set logging on
Redirecting output to gdb.txt.
Copying debug output to gdb.txt.
(gdb) run
\#0 main () at test.c:19
(gdb) q
A debugging session is active.
Inferior 1 [process 22428] will be killed.
Quit anyway? (y or n) y
$ cat gdb.txt
Starting program: /data/gdb_versions/devel/a.out
Breakpoint 1, main () at test.c:19
19 return foo (4);
...
The problem is that the '#0 main () at test.c:19' ends up in the gdb output
output rather than in gdb.txt. This is due to the fact that the redirect is
setup for the current ui_out (which is tui->interp_ui_out ()), while the
backtrace output is printed to the INTERP_CONSOLE ui_out.
Fix this by limiting switching to INTERP_CONSOLE ui_out to when INTERP_MI is
active.
Tested on x86_64-linux.
gdb/ChangeLog:
2019-10-02 Tom de Vries <tdevries@suse.de>
PR gdb/24956
* cli/cli-script.c (execute_control_command): Only switch to
INTERP_CONSOLE's ui_out when INTERP_MI is active.
gdb/testsuite/ChangeLog:
2019-10-02 Tom de Vries <tdevries@suse.de>
PR gdb/24956
* gdb.base/ui-redirect.exp: Test output of user-defined command.
Change-Id: Id1771e7fcc9496a7d97ec2b2ea6b1487596f1ef7
---
gdb/cli/cli-script.c | 3 +++
gdb/testsuite/gdb.base/ui-redirect.exp | 47 +++++++++++++++++++++++++++++++++-
2 files changed, 49 insertions(+), 1 deletion(-)
diff --git a/gdb/cli/cli-script.c b/gdb/cli/cli-script.c
index 85f00c75b3f..4d216f15dae 100644
--- a/gdb/cli/cli-script.c
+++ b/gdb/cli/cli-script.c
@@ -697,6 +697,9 @@ execute_control_command_1 (struct command_line *cmd, int from_tty)
enum command_control_type
execute_control_command (struct command_line *cmd, int from_tty)
{
+ if (!current_uiout->is_mi_like_p ())
+ return execute_control_command_1 (cmd, from_tty);
+
/* Make sure we use the console uiout. It's possible that we are executing
breakpoint commands while running the MI interpreter. */
interp *console = interp_lookup (current_ui, INTERP_CONSOLE);
diff --git a/gdb/testsuite/gdb.base/ui-redirect.exp b/gdb/testsuite/gdb.base/ui-redirect.exp
index 1ebff790e57..ab85eb059a0 100644
--- a/gdb/testsuite/gdb.base/ui-redirect.exp
+++ b/gdb/testsuite/gdb.base/ui-redirect.exp
@@ -17,7 +17,10 @@ if { [prepare_for_testing "failed to prepare" ui-redirect start.c] } {
return -1
}
-gdb_breakpoint main
+if ![runto_main] {
+ fail "can't run to main"
+ return -1
+}
set test "commands"
gdb_test_multiple $test $test {
@@ -34,8 +37,50 @@ gdb_test_multiple $test $test {
}
gdb_test_no_output "end"
+with_test_prefix "userdefined" {
+ set test "define userdefined"
+ gdb_test_multiple $test $test {
+ -re "End with a line saying just \"end\"\\.\r\n>$" {
+ pass $test
+ }
+ }
+
+ set test "bt"
+ gdb_test_multiple $test $test {
+ -re "\r\n>$" {
+ pass $test
+ }
+ }
+
+ gdb_test_no_output "end"
+}
+
gdb_test_no_output "set logging file /dev/null"
gdb_test "set logging on" "Copying output to /dev/null\\."
gdb_test "save breakpoints /dev/null" "Saved to file '/dev/null'\\."
+gdb_test "userdefined" "#0 main ().*"
gdb_test "set logging off" "Done logging to /dev/null\\."
gdb_test "help" "List of classes of commands:.*"
+
+with_test_prefix "redirect" {
+ gdb_test "set logging redirect on"
+ gdb_test "set logging on" \
+ "Redirecting output to /dev/null\\."
+ gdb_test_no_output "save breakpoints /dev/null" "Saved to file '/dev/null'\\."
+ gdb_test_no_output "userdefined"
+ gdb_test "set logging off" "Done logging to /dev/null\\."
+ gdb_test "help" "List of classes of commands:.*"
+}
+
+with_test_prefix "redirect while already logging" {
+ gdb_test_no_output "set logging redirect off"
+ gdb_test "set logging on" \
+ "Copying output to /dev/null\\."
+ gdb_test "set logging redirect on" \
+ ".*warning: Currently logging .*Turn the logging off and on to make the new setting effective.*"
+ gdb_test "save breakpoints /dev/null" "Saved to file '/dev/null'\\."
+ gdb_test "userdefined" "#0 main ().*"
+ gdb_test "set logging off" "Done logging to /dev/null\\."
+ gdb_test "help" "List of classes of commands:.*"
+ gdb_test_no_output "set logging redirect off"
+}

View File

@ -1,25 +0,0 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-readline62-ask-more-rh.patch
;; Work around readline-6.2 incompatibility not asking for --more-- (BZ 701131).
;;=fedora
diff --git a/gdb/event-top.c b/gdb/event-top.c
--- a/gdb/event-top.c
+++ b/gdb/event-top.c
@@ -1179,6 +1179,13 @@ gdb_setup_readline (int editing)
{
struct ui *ui = current_ui;
+#ifdef NEED_RL_STATE_FEDORA_GDB
+ /* 6.2 regression: no longed asks for --more--
+ gdb.base/readline-ask.exp
+ https://bugzilla.redhat.com/show_bug.cgi?id=701131 */
+ RL_SETSTATE (RL_STATE_FEDORA_GDB);
+#endif
+
/* This function is a noop for the sync case. The assumption is
that the sync setup is ALL done in gdb_init, and we would only
mess it up here. The sync stuff should really go away over

View File

@ -1,461 +0,0 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Sergio Durigan Junior <sergiodj@redhat.com>
Date: Tue, 23 Apr 2019 18:17:57 -0400
Subject: gdb-rhbz1371380-gcore-elf-headers.patch
;; Implement dump of mappings with ELF headers by gcore
;; RHBZ 1371380, Sergio Durigan Junior.
Implement dump of mappings with ELF headers by gcore
This patch has a long story, but it all started back in 2015, with
commit df8411da087dc05481926f4c4a82deabc5bc3859 ("Implement support
for checking /proc/PID/coredump_filter"). The purpose of that commit
was to bring GDB's corefile generation closer to what the Linux kernel
does. However, back then, I did not implement the full support for
the dumping of memory mappings containing ELF headers (like mappings
of DSOs or executables). These mappings were being dumped most of
time, though, because the default value of /proc/PID/coredump_filter
is 0x33, which would cause anonymous private mappings (DSOs/executable
code mappings have this type) to be dumped. Well, until something
happened on binutils...
A while ago, I noticed something strange was happening with one of our
local testcases on Fedora GDB: it was failing due to some strange
build-id problem. On Fedora GDB, we (unfortunately) carry a bunch of
"local" patches, and some of these patches actually extend upstream's
build-id support in order to generate more useful information for the
user of a Fedora system (for example, when the user loads a corefile
into GDB, we detect whether the executable that generated that
corefile is present, and if it's not we issue a warning suggesting
that it should be installed, while also providing the build-id of the
executable). A while ago, Fedora GDB stopped printing those warnings.
I wanted to investigate this right away, and spent some time trying to
determine what was going on, but other things happened and I got
sidetracked. Meanwhile, the bug started to be noticed by some of our
users, and its priority started changing. Then, someone on IRC also
mentioned the problem, and when I tried helping him, I noticed he
wasn't running Fedora. Hm... So maybe the bug was *also* present
upstream.
After "some" time investigating, and with a lot of help from Keith and
others, I was finally able to determine that yes, the bug is also
present upstream, and that even though it started with a change in ld,
it is indeed a GDB issue.
So, as I said, the problem started with binutils, more specifically
after the following commit was pushed:
commit f6aec96dce1ddbd8961a3aa8a2925db2021719bb
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Tue Feb 27 11:34:20 2018 -0800
ld: Add --enable-separate-code
This commit makes ld use "-z separate-code" by default on x86-64
machines. What this means is that code pages and data pages are now
separated in the binary, which is confusing GDB when it tries to decide
what to dump.
BTW, Fedora 28 binutils doesn't have this code, which means that
Fedora 28 GDB doesn't have the problem. From Fedora 29 on, binutils
was rebased and incorporated the commit above, which started causing
Fedora GDB to fail.
Anyway, the first thing I tried was to pass "-z max-page-size" and
specify a bigger page size (I saw a patch that did this and was
proposed to Linux, so I thought it might help). Obviously, this
didn't work, because the real "problem" is that ld will always use
separate pages for code and data. So I decided to look into how GDB
dumped the pages, and that's where I found the real issue.
What happens is that, because of "-z separate-code", the first two pages
of the ELF binary are (from /proc/PID/smaps):
00400000-00401000 r--p 00000000 fc:01 799548 /file
Size: 4 kB
KernelPageSize: 4 kB
MMUPageSize: 4 kB
Rss: 4 kB
Pss: 4 kB
Shared_Clean: 0 kB
Shared_Dirty: 0 kB
Private_Clean: 4 kB
Private_Dirty: 0 kB
Referenced: 4 kB
Anonymous: 0 kB
LazyFree: 0 kB
AnonHugePages: 0 kB
ShmemPmdMapped: 0 kB
Shared_Hugetlb: 0 kB
Private_Hugetlb: 0 kB
Swap: 0 kB
SwapPss: 0 kB
Locked: 0 kB
THPeligible: 0
VmFlags: rd mr mw me dw sd
00401000-00402000 r-xp 00001000 fc:01 799548 /file
Size: 4 kB
KernelPageSize: 4 kB
MMUPageSize: 4 kB
Rss: 4 kB
Pss: 4 kB
Shared_Clean: 0 kB
Shared_Dirty: 0 kB
Private_Clean: 0 kB
Private_Dirty: 4 kB
Referenced: 4 kB
Anonymous: 4 kB
LazyFree: 0 kB
AnonHugePages: 0 kB
ShmemPmdMapped: 0 kB
Shared_Hugetlb: 0 kB
Private_Hugetlb: 0 kB
Swap: 0 kB
SwapPss: 0 kB
Locked: 0 kB
THPeligible: 0
VmFlags: rd ex mr mw me dw sd
Whereas before, we had only one:
00400000-00401000 r-xp 00000000 fc:01 798593 /file
Size: 4 kB
KernelPageSize: 4 kB
MMUPageSize: 4 kB
Rss: 4 kB
Pss: 4 kB
Shared_Clean: 0 kB
Shared_Dirty: 0 kB
Private_Clean: 0 kB
Private_Dirty: 4 kB
Referenced: 4 kB
Anonymous: 4 kB
LazyFree: 0 kB
AnonHugePages: 0 kB
ShmemPmdMapped: 0 kB
Shared_Hugetlb: 0 kB
Private_Hugetlb: 0 kB
Swap: 0 kB
SwapPss: 0 kB
Locked: 0 kB
THPeligible: 0
VmFlags: rd ex mr mw me dw sd
Notice how we have "Anonymous" data mapped into the page. This will be
important.
So, the way GDB decides which pages it should dump has been revamped
by my patch in 2015, and now it takes the contents of
/proc/PID/coredump_filter into account. The default value for Linux
is 0x33, which means:
Dump anonymous private, anonymous shared, ELF headers and HugeTLB
private pages.
Or:
filter_flags filterflags = (COREFILTER_ANON_PRIVATE
| COREFILTER_ANON_SHARED
| COREFILTER_ELF_HEADERS
| COREFILTER_HUGETLB_PRIVATE);
Now, it is important to keep in mind that GDB doesn't always have *all*
of the necessary information to exactly determine the type of a page, so
the whole algorithm is based on heuristics (you can take a look at
linux-tdep.c:dump_mapping_p and
linux-tdep.c:linux_find_memory_regions_full for more info).
Before the patch to make ld use "-z separate-code", the (single) page
containing data and code was being flagged as an anonymous (due to the
non-zero "Anonymous:" field) private (due to the "r-xp" permission),
which means that it was being dumped into the corefile. That's why it
was working fine.
Now, as you can imagine, when "-z separate-code" is used, the *data*
page (which is where the ELF notes are, including the build-id one) now
doesn't have any "Anonymous:" mapping, so the heuristic is flagging it
as file-backed private, which is *not* dumped by default.
The next question I had to answer was: how come a corefile generated by
the Linux kernel was correct? Well, the answer is that GDB, unlike
Linux, doesn't actually implement the COREFILTER_ELF_HEADERS support.
On Linux, even though the data page is also treated as a file-backed
private mapping, it is also checked to see if there are any ELF headers
in the page, and then, because we *do* have ELF headers there, it is
dumped.
So, after more time trying to think of ways to fix this, I was able to
implement an algorithm that reads the first few bytes of the memory
mapping being processed, and checks to see if the ELF magic code is
present. This is basically what Linux does as well, except that, if
it finds the ELF magic code, it just dumps one page to the corefile,
whereas GDB will dump the whole mapping. But I don't think that's a
big issue, to be honest.
It's also important to explain that we *only* perform the ELF magic
code check if:
- The algorithm has decided *not* to dump the mapping so far, and;
- The mapping is private, and;
- The mapping's offset is zero, and;
- The user has requested us to dump mappings with ELF headers.
IOW, we're not going to blindly check every mapping.
As for the testcase, I struggled even more trying to write it. Since
our build-id support on upstream GDB is not very extensive, it's not
really possible to determine whether a corefile contains build-id
information or not just by using GDB. So, after thinking a lot about
the problem, I decided to rely on an external tool, eu-unstrip, in
order to verify whether the dump was successful. I verified the test
here on my machine, and everything seems to work as expected (i.e., it
fails without the patch, and works with the patch applied). We are
working hard to upstream our "local" Fedora GDB patches, and we intend
to submit our build-id extension patches "soon", so hopefully we'll be
able to use GDB itself to perform this verification.
I built and regtested this on the BuildBot, and no problems were
found.
gdb/ChangeLog:
2019-04-25 Sergio Durigan Junior <sergiodj@redhat.com>
PR corefiles/11608
PR corefiles/18187
* linux-tdep.c (dump_mapping_p): Add new parameters ADDR and
OFFSET. Verify if current mapping contains an ELF header.
(linux_find_memory_regions_full): Adjust call to
dump_mapping_p.
gdb/testsuite/ChangeLog:
2019-04-25 Sergio Durigan Junior <sergiodj@redhat.com>
PR corefiles/11608
PR corefiles/18187
* gdb.base/coredump-filter-build-id.exp: New file.
diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c
--- a/gdb/linux-tdep.c
+++ b/gdb/linux-tdep.c
@@ -591,8 +591,8 @@ mapping_is_anonymous_p (const char *filename)
}
/* Return 0 if the memory mapping (which is related to FILTERFLAGS, V,
- MAYBE_PRIVATE_P, and MAPPING_ANONYMOUS_P) should not be dumped, or
- greater than 0 if it should.
+ MAYBE_PRIVATE_P, MAPPING_ANONYMOUS_P, ADDR and OFFSET) should not
+ be dumped, or greater than 0 if it should.
In a nutshell, this is the logic that we follow in order to decide
if a mapping should be dumped or not.
@@ -630,12 +630,17 @@ mapping_is_anonymous_p (const char *filename)
see 'p' in the permission flags, then we assume that the mapping
is private, even though the presence of the 's' flag there would
mean VM_MAYSHARE, which means the mapping could still be private.
- This should work OK enough, however. */
+ This should work OK enough, however.
+
+ - Even if, at the end, we decided that we should not dump the
+ mapping, we still have to check if it is something like an ELF
+ header (of a DSO or an executable, for example). If it is, and
+ if the user is interested in dump it, then we should dump it. */
static int
dump_mapping_p (filter_flags filterflags, const struct smaps_vmflags *v,
int maybe_private_p, int mapping_anon_p, int mapping_file_p,
- const char *filename)
+ const char *filename, ULONGEST addr, ULONGEST offset)
{
/* Initially, we trust in what we received from our caller. This
value may not be very precise (i.e., it was probably gathered
@@ -645,6 +650,7 @@ dump_mapping_p (filter_flags filterflags, const struct smaps_vmflags *v,
(assuming that the version of the Linux kernel being used
supports it, of course). */
int private_p = maybe_private_p;
+ int dump_p;
/* We always dump vDSO and vsyscall mappings, because it's likely that
there'll be no file to read the contents from at core load time.
@@ -685,13 +691,13 @@ dump_mapping_p (filter_flags filterflags, const struct smaps_vmflags *v,
/* This is a special situation. It can happen when we see a
mapping that is file-backed, but that contains anonymous
pages. */
- return ((filterflags & COREFILTER_ANON_PRIVATE) != 0
- || (filterflags & COREFILTER_MAPPED_PRIVATE) != 0);
+ dump_p = ((filterflags & COREFILTER_ANON_PRIVATE) != 0
+ || (filterflags & COREFILTER_MAPPED_PRIVATE) != 0);
}
else if (mapping_anon_p)
- return (filterflags & COREFILTER_ANON_PRIVATE) != 0;
+ dump_p = (filterflags & COREFILTER_ANON_PRIVATE) != 0;
else
- return (filterflags & COREFILTER_MAPPED_PRIVATE) != 0;
+ dump_p = (filterflags & COREFILTER_MAPPED_PRIVATE) != 0;
}
else
{
@@ -700,14 +706,55 @@ dump_mapping_p (filter_flags filterflags, const struct smaps_vmflags *v,
/* This is a special situation. It can happen when we see a
mapping that is file-backed, but that contains anonymous
pages. */
- return ((filterflags & COREFILTER_ANON_SHARED) != 0
- || (filterflags & COREFILTER_MAPPED_SHARED) != 0);
+ dump_p = ((filterflags & COREFILTER_ANON_SHARED) != 0
+ || (filterflags & COREFILTER_MAPPED_SHARED) != 0);
}
else if (mapping_anon_p)
- return (filterflags & COREFILTER_ANON_SHARED) != 0;
+ dump_p = (filterflags & COREFILTER_ANON_SHARED) != 0;
else
- return (filterflags & COREFILTER_MAPPED_SHARED) != 0;
+ dump_p = (filterflags & COREFILTER_MAPPED_SHARED) != 0;
}
+
+ /* Even if we decided that we shouldn't dump this mapping, we still
+ have to check whether (a) the user wants us to dump mappings
+ containing an ELF header, and (b) the mapping in question
+ contains an ELF header. If (a) and (b) are true, then we should
+ dump this mapping.
+
+ A mapping contains an ELF header if it is a private mapping, its
+ offset is zero, and its first word is ELFMAG. */
+ if (!dump_p && private_p && offset == 0
+ && (filterflags & COREFILTER_ELF_HEADERS) != 0)
+ {
+ /* Let's check if we have an ELF header. */
+ gdb::unique_xmalloc_ptr<char> header;
+ int errcode;
+
+ /* Useful define specifying the size of the ELF magical
+ header. */
+#ifndef SELFMAG
+#define SELFMAG 4
+#endif
+
+ /* Read the first SELFMAG bytes and check if it is ELFMAG. */
+ if (target_read_string (addr, &header, SELFMAG, &errcode) == SELFMAG
+ && errcode == 0)
+ {
+ const char *h = header.get ();
+
+ /* The EI_MAG* and ELFMAG* constants come from
+ <elf/common.h>. */
+ if (h[EI_MAG0] == ELFMAG0 && h[EI_MAG1] == ELFMAG1
+ && h[EI_MAG2] == ELFMAG2 && h[EI_MAG3] == ELFMAG3)
+ {
+ /* This mapping contains an ELF header, so we
+ should dump it. */
+ dump_p = 1;
+ }
+ }
+ }
+
+ return dump_p;
}
/* Implement the "info proc" command. */
@@ -1311,7 +1358,7 @@ linux_find_memory_regions_full (struct gdbarch *gdbarch,
if (has_anonymous)
should_dump_p = dump_mapping_p (filterflags, &v, priv,
mapping_anon_p, mapping_file_p,
- filename);
+ filename, addr, offset);
else
{
/* Older Linux kernels did not support the "Anonymous:" counter.
diff --git a/gdb/testsuite/gdb.base/coredump-filter-build-id.exp b/gdb/testsuite/gdb.base/coredump-filter-build-id.exp
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/coredump-filter-build-id.exp
@@ -0,0 +1,69 @@
+# 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/>.
+
+# Test whether GDB's gcore/generate-core-file command can dump memory
+# mappings with ELF headers, containing a build-id note.
+#
+# Due to the fact that we don't have an easy way to process a corefile
+# and look for specific notes using GDB/dejagnu, we rely on an
+# external tool, eu-unstrip, to verify if the corefile contains
+# build-ids.
+
+standard_testfile "normal.c"
+
+# This test is Linux x86_64 only.
+if { ![istarget *-*-linux*] } {
+ untested "$testfile.exp"
+ return -1
+}
+if { ![istarget "x86_64-*-*"] || ![is_lp64_target] } {
+ untested "$testfile.exp"
+ return -1
+}
+
+if { [prepare_for_testing "failed to prepare" $testfile $srcfile debug] } {
+ return -1
+}
+
+if { ![runto_main] } {
+ untested "could not run to main"
+ return -1
+}
+
+# First we need to generate a corefile.
+set corefilename "[standard_output_file gcore.test]"
+if { ![gdb_gcore_cmd "$corefilename" "save corefile"] } {
+ verbose -log "Could not save corefile"
+ untested "$testfile.exp"
+ return -1
+}
+
+# Determine if GDB dumped the mapping containing the build-id. This
+# is done by invoking an external program (eu-unstrip).
+if { [catch "exec [gdb_find_eu-unstrip] -n --core $corefilename" output] == 0 } {
+ set line [lindex [split $output "\n"] 0]
+ set test "gcore dumped mapping with build-id"
+
+ verbose -log "First line of eu-unstrip: $line"
+
+ if { [regexp "^${hex}\\+${hex} \[a-f0-9\]+@${hex}.*[string_to_regexp $binfile]$" $line] } {
+ pass "$test"
+ } else {
+ fail "$test"
+ }
+} else {
+ verbose -log "Could not execute eu-unstrip program"
+ untested "$testfile.exp"
+}
diff --git a/gdb/testsuite/lib/future.exp b/gdb/testsuite/lib/future.exp
--- a/gdb/testsuite/lib/future.exp
+++ b/gdb/testsuite/lib/future.exp
@@ -162,6 +162,16 @@ proc gdb_find_readelf {} {
return $readelf
}
+proc gdb_find_eu-unstrip {} {
+ global EU_UNSTRIP_FOR_TARGET
+ if [info exists EU_UNSTRIP_FOR_TARGET] {
+ set eu_unstrip $EU_UNSTRIP_FOR_TARGET
+ } else {
+ set eu_unstrip [transform eu-unstrip]
+ }
+ return $eu_unstrip
+}
+
proc gdb_default_target_compile {source destfile type options} {
global target_triplet
global tool_root_dir

View File

@ -1,84 +0,0 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Nick Clifton <nickc@redhat.com>
Date: Tue, 2 Jul 2019 15:58:29 +0100
Subject: gdb-rhbz1553086-binutils-warning-loadable-section-outside-elf.patch
;; Fix 'gdb: warning: Loadable section ".note.gnu.property" outside of
;; ELF segments' (Nick Clifton, RH BZ 1553086).
;; This is a binutils patch.
Stop the BFD library from issuing a warning message when processing allocated sections in debuginfo files that lie outside of any loadable segment.
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.
diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
--- a/bfd/elf-bfd.h
+++ b/bfd/elf-bfd.h
@@ -2751,6 +2751,8 @@ extern bfd_vma elf64_r_sym (bfd_vma);
extern bfd_vma elf32_r_info (bfd_vma, bfd_vma);
extern bfd_vma elf32_r_sym (bfd_vma);
+extern bfd_boolean is_debuginfo_file (bfd *);
+
/* Large common section. */
extern asection _bfd_elf_large_com_section;
diff --git a/bfd/elf.c b/bfd/elf.c
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -5800,6 +5800,35 @@ assign_file_positions_for_load_sections (bfd *abfd,
return TRUE;
}
+/* Determine if a bfd is a debuginfo file. Unfortunately there
+ is no defined method for detecting such files, so we have to
+ use heuristics instead. */
+
+bfd_boolean
+is_debuginfo_file (bfd *abfd)
+{
+ if (abfd == NULL || bfd_get_flavour (abfd) != bfd_target_elf_flavour)
+ return FALSE;
+
+ Elf_Internal_Shdr **start_headers = elf_elfsections (abfd);
+ Elf_Internal_Shdr **end_headers = start_headers + elf_numsections (abfd);
+ Elf_Internal_Shdr **headerp;
+
+ for (headerp = start_headers; headerp < end_headers; headerp ++)
+ {
+ Elf_Internal_Shdr *header = * headerp;
+
+ /* Debuginfo files do not have any allocated SHT_PROGBITS sections.
+ The only allocated sections are SHT_NOBITS or SHT_NOTES. */
+ if ((header->sh_flags & SHF_ALLOC) == SHF_ALLOC
+ && header->sh_type != SHT_NOBITS
+ && header->sh_type != SHT_NOTE)
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
/* Assign file positions for the other sections. */
static bfd_boolean
@@ -5833,7 +5862,13 @@ assign_file_positions_for_non_load_sections (bfd *abfd,
BFD_ASSERT (hdr->sh_offset == hdr->bfd_section->filepos);
else if ((hdr->sh_flags & SHF_ALLOC) != 0)
{
- if (hdr->sh_size != 0)
+ if (hdr->sh_size != 0
+ /* PR 24717 - debuginfo files are known to be not strictly
+ compliant with the ELF standard. In particular they often
+ have .note.gnu.property sections that are outside of any
+ loadable segment. This is not a problem for such files,
+ so do not warn about them. */
+ && ! is_debuginfo_file (abfd))
_bfd_error_handler
/* xgettext:c-format */
(_("%pB: warning: allocated section `%s' not in segment"),

View File

@ -1,88 +0,0 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Tom Tromey <tromey@adacore.com>
Date: Tue, 14 May 2019 08:04:22 -0600
Subject: gdb-rhbz1704406-disable-style-log-output-1of3.patch
;; Fix 'Color control codes should not appear in logging output'
;; Tom Tromey, RH BZ 1704406
Add "style" proc to the test suite
This adds a "style" helper proc to the test suite, and updates
existing style tests to use it. Thanks to Sergio for the idea.
Tested on x86-64 Fedora 29.
gdb/testsuite/ChangeLog
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.
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
@@ -41,10 +41,10 @@ save_vars { env(TERM) } {
gdb_test_no_output "set style enabled on"
- set main_expr "\033\\\[33mmain\033\\\[m"
- set base_file_expr "\033\\\[32m.*style\\.c\033\\\[m"
+ set main_expr [style main function]
+ set base_file_expr [style ".*style\\.c" file]
set file_expr "$base_file_expr:\[0-9\]"
- set arg_expr "\033\\\[36marg.\033\\\[m"
+ set arg_expr [style "arg." variable]
gdb_test "frame" \
"$main_expr.*$arg_expr.*$arg_expr.*$file_expr.*"
@@ -58,7 +58,7 @@ save_vars { env(TERM) } {
gdb_test "break main" "file $base_file_expr.*"
- gdb_test "print &main" " = .* \033\\\[34m$hex\033\\\[m <$main_expr>"
+ gdb_test "print &main" " = .* [style $hex address] <$main_expr>"
# Regression test for a bug where line-wrapping would occur at the
# wrong spot with styling. There were different bugs at different
@@ -86,11 +86,12 @@ save_vars { env(TERM) } {
gdb_exit
gdb_spawn
- gdb_test "" "\033\\\[35;1mGNU gdb.*\033\\\[m.*" \
+ set vers [style "GNU gdb.*" "35;1"]
+ gdb_test "" "${vers}.*" \
"version is styled"
set quoted [string_to_regexp $binfile]
gdb_test "file $binfile" \
- "Reading symbols from \033\\\[32m${quoted}\033\\\[m..." \
+ "Reading symbols from [style $quoted file]..." \
"filename is styled when loading symbol file"
}
diff --git a/gdb/testsuite/lib/gdb-utils.exp b/gdb/testsuite/lib/gdb-utils.exp
--- a/gdb/testsuite/lib/gdb-utils.exp
+++ b/gdb/testsuite/lib/gdb-utils.exp
@@ -37,3 +37,21 @@ proc string_to_regexp {str} {
regsub -all {[]*+.|(){}^$\[\\]} $str {\\&} result
return $result
}
+
+# Wrap STR in an ANSI terminal escape sequences -- one to set the
+# style to STYLE, and one to reset the style to the default. The
+# return value is suitable for use as a regular expression.
+
+# STYLE can either be the payload part of an ANSI terminal sequence,
+# or a shorthand for one of the gdb standard styles: "file",
+# "function", "variable", or "address".
+
+proc style {str style} {
+ switch -exact -- $style {
+ file { set style 32 }
+ function { set style 33 }
+ variable { set style 36 }
+ address { set style 34 }
+ }
+ return "\033\\\[${style}m${str}\033\\\[m"
+}

View File

@ -1,194 +0,0 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Tom Tromey <tromey@adacore.com>
Date: Tue, 30 Apr 2019 11:17:15 -0600
Subject: gdb-rhbz1704406-disable-style-log-output-2of3.patch
;; Fix 'Color control codes should not appear in logging output'
;; Tom Tromey, RH BZ 1704406
Do not emit style escape sequences to log file
PR gdb/24502 requests that the "set logging" log file not contain
style escape sequences emitted by gdb.
This seemed like a reasonable request to me, so this patch implements
filtering for the log file.
This also updates a comment in ui-style.h that I noticed while writing
the patch.
Tested on x86-64 Fedora 29.
gdb/ChangeLog
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.
gdb/testsuite/ChangeLog
2019-06-14 Tom Tromey <tromey@adacore.com>
PR gdb/24502:
* gdb.base/style-logging.exp: New file.
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
@@ -117,7 +117,7 @@ handle_redirections (int from_tty)
return;
}
- stdio_file_up log (new stdio_file ());
+ stdio_file_up log (new no_terminal_escape_file ());
if (!log->open (logging_filename, logging_overwrite ? "w" : "a"))
perror_with_name (_("set logging"));
diff --git a/gdb/testsuite/gdb.base/style-logging.exp b/gdb/testsuite/gdb.base/style-logging.exp
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/style-logging.exp
@@ -0,0 +1,64 @@
+# 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/>.
+
+# Test that logging does not style.
+
+if {[is_remote host]} {
+ untested "does not work on remote host"
+ return 0
+}
+
+standard_testfile style.c
+
+save_vars { env(TERM) } {
+ # We need an ANSI-capable terminal to get the output.
+ setenv TERM ansi
+
+ if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} {
+ return -1
+ }
+
+ if {![runto_main]} {
+ fail "style tests failed"
+ return
+ }
+
+ gdb_test_no_output "set style enabled on"
+
+ set log_name [standard_output_file log.txt]
+ gdb_test_no_output "set logging file $log_name"
+ gdb_test_no_output "set logging overwrite on"
+ gdb_test "set logging on" "Copying output to .*"
+
+ set main_expr [style main function]
+ set base_file_expr [style ".*style\\.c" file]
+ set file_expr "$base_file_expr:\[0-9\]"
+ set arg_expr [style "arg." variable]
+ gdb_test "frame" \
+ "$main_expr.*$arg_expr.*$arg_expr.*$file_expr.*"
+
+ gdb_test "set logging off" "Done logging to .*"
+
+ set fd [open $log_name]
+ set data [read -nonewline $fd]
+ close $fd
+
+ set testname "log is escape-free"
+ if {[regexp "\033" $data]} {
+ fail $testname
+ } else {
+ pass $testname
+ }
+}
diff --git a/gdb/ui-file.c b/gdb/ui-file.c
--- a/gdb/ui-file.c
+++ b/gdb/ui-file.c
@@ -332,3 +332,33 @@ tee_file::isatty ()
{
return m_one->isatty ();
}
+
+void
+no_terminal_escape_file::write (const char *buf, long length_buf)
+{
+ std::string copy (buf, length_buf);
+ this->puts (copy.c_str ());
+}
+
+/* See ui-file.h. */
+
+void
+no_terminal_escape_file::puts (const char *buf)
+{
+ while (*buf != '\0')
+ {
+ const char *esc = strchr (buf, '\033');
+ if (esc == nullptr)
+ break;
+
+ int n_read = 0;
+ if (!skip_ansi_escape (esc, &n_read))
+ ++esc;
+
+ this->stdio_file::write (buf, esc - buf);
+ buf = esc + n_read;
+ }
+
+ if (*buf != '\0')
+ this->stdio_file::write (buf, strlen (buf));
+}
diff --git a/gdb/ui-file.h b/gdb/ui-file.h
--- a/gdb/ui-file.h
+++ b/gdb/ui-file.h
@@ -264,4 +264,20 @@ private:
bool m_close_one, m_close_two;
};
+/* A ui_file implementation that filters out terminal escape
+ sequences. */
+
+class no_terminal_escape_file : public stdio_file
+{
+public:
+ no_terminal_escape_file ()
+ {
+ }
+
+ /* Like the stdio_file methods, but these filter out terminal escape
+ sequences. */
+ void write (const char *buf, long length_buf) override;
+ void puts (const char *linebuffer) override;
+};
+
#endif
diff --git a/gdb/ui-style.h b/gdb/ui-style.h
--- a/gdb/ui-style.h
+++ b/gdb/ui-style.h
@@ -233,8 +233,8 @@ private:
/* Skip an ANSI escape sequence in BUF. BUF must begin with an ESC
character. Return true if an escape sequence was successfully
- skipped; false otherwise. In either case, N_READ is updated to
- reflect the number of chars read from BUF. */
+ skipped; false otherwise. If an escape sequence was skipped,
+ N_READ is updated to reflect the number of chars read from BUF. */
extern bool skip_ansi_escape (const char *buf, int *n_read);

View File

@ -1,30 +0,0 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Andrew Burgess <andrew.burgess@embecosm.com>
Date: Fri, 14 Jun 2019 23:31:10 +0100
Subject: gdb-rhbz1704406-disable-style-log-output-3of3.patch
;; Fix 'Color control codes should not appear in logging output'
;; Tom Tromey, RH BZ 1704406
gdb: Remove file path from test name
Having paths in test names makes comparing sum files difficult, rename
a test to avoid paths in test names.
gdb/testsuite/ChangeLog:
* gdb.base/style-logging.exp: Remove path from test name.
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
@@ -38,7 +38,8 @@ save_vars { env(TERM) } {
gdb_test_no_output "set style enabled on"
set log_name [standard_output_file log.txt]
- gdb_test_no_output "set logging file $log_name"
+ gdb_test_no_output "set logging file $log_name" \
+ "set logging filename"
gdb_test_no_output "set logging overwrite on"
gdb_test "set logging on" "Copying output to .*"

View File

@ -1,69 +0,0 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Sergio Durigan Junior <sergiodj@redhat.com>
Date: Fri, 10 May 2019 16:57:26 -0400
Subject: gdb-rhbz1708192-parse_macro_definition-crash.patch
;; "Fix" segfault that happens on parse_macro_definition because
;; debugedit corrupts the .debug_macro section.
;; Sergio Durigan Junior, RH BZ 1708192.
Don't crash if dwarf_decode_macro_bytes's 'body' is NULL
Hi,
Ref.: https://bugzilla.redhat.com/show_bug.cgi?id=1708192
https://bugzilla.redhat.com/show_bug.cgi?id=1708786
During the Fedora RPM build process, gdb-add-index is invoked to
extract the DWARF index from the binary, and GDB will segfault because
dwarf2read.c:parse_definition_macro's 'body' variable is NULL.
The underlying problem is that Fedora's rpm-build's "debugedit"
program will silently corrupt .debug_macro strings when a binary is
compiled with -g3. This is being taken care of by Mark Wielaard,
here:
https://bugzilla.redhat.com/show_bug.cgi?id=1708786
However, I still feel it's important to make GDB more resilient
against invalid DWARF input, so I'm proposing this rather simple patch
to catch the situation when "body == NULL" (i.e., it's probably been
corrupted) and issue a complaint. This is not a real fix to the
problem, of course, but at least GDB is able to finish without
segfaulting.
OK for master?
gdb/ChangeLog:
2019-05-15 Sergio Durigan Junior <sergiodj@redhat.com>
Ref.: https://bugzilla.redhat.com/show_bug.cgi?id=1708192
* dwarf2read.c (dwarf_decode_macro_bytes): Check whether 'body' is
NULL, and complain if that's the case.
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -24627,7 +24627,21 @@ dwarf_decode_macro_bytes (struct dwarf2_cu *cu,
is_define ? _("definition") : _("undefinition"),
line == 0 ? _("zero") : _("non-zero"), line, body);
- if (is_define)
+ if (body == NULL)
+ {
+ /* Fedora's rpm-build's "debugedit" binary
+ corrupted .debug_macro sections.
+
+ For more info, see
+ https://bugzilla.redhat.com/show_bug.cgi?id=1708786 */
+ complaint (_("debug info gives %s invalid macro %s "
+ "without body (corrupted?) at line %d "
+ "on file %s"),
+ at_commandline ? _("command-line") : _("in-file"),
+ is_define ? _("definition") : _("undefinition"),
+ line, current_file->filename);
+ }
+ else if (is_define)
parse_macro_definition (current_file, line, body);
else
{

View File

@ -1,110 +0,0 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Sergio Durigan Junior <sergiodj@redhat.com>
Date: Thu, 27 Jun 2019 13:14:26 -0400
Subject: gdb-rhbz1723564-gdb-crash-PYTHONMALLOC-debug.patch
;; Fix 'gdb crash when using PYTHONMALLOC=debug on Python'
;; RHBZ 1723564, Sergio Durigan Junior.
Fix crash when using PYTHONMALLOC=debug (PR python/24742)
This bug was originally reported against Fedora GDB:
https://bugzilla.redhat.com/show_bug.cgi?id=1723564
The problem is that GDB will crash in the following scenario:
- PYTHONMALLOC=debug or PYTHONDEVMODE=1 is set.
- The Python debuginfo is installed.
- GDB is used to debug Python.
The crash looks like this:
$ PYTHONMALLOC=debug gdb -args python3 -c pass
GNU gdb (GDB) Fedora 8.3-3.fc30
Reading symbols from python3...
Reading symbols from /usr/lib/debug/usr/bin/python3.7m-3.7.3-3.fc30.x86_64.debug...
(gdb) run
Starting program: /usr/bin/python3 -c pass
Missing separate debuginfos, use: dnf debuginfo-install glibc-2.29-9.fc30.x86_64
Debug memory block at address p=0x5603977bf330: API ''
8098648152243306496 bytes originally requested
The 7 pad bytes at p-7 are not all FORBIDDENBYTE (0xfb):
at p-7: 0x03 *** OUCH
at p-6: 0x00 *** OUCH
at p-5: 0x00 *** OUCH
at p-4: 0x00 *** OUCH
at p-3: 0x00 *** OUCH
at p-2: 0x00 *** OUCH
at p-1: 0x00 *** OUCH
Because memory is corrupted at the start, the count of bytes requested
may be bogus, and checking the trailing pad bytes may segfault.
The 8 pad bytes at tail=0x706483999ad1f330 are Segmentation fault (core dumped)
It's hard to determine what happens, but after doing some
investigation and talking to Victor Stinner I found that GDB should
not use the Python memory allocation functions before the Python
interpreter is initialized (which makes sense). However, we do just
that on python/python.c:do_start_initialization:
...
progsize = strlen (progname.get ());
progname_copy = (wchar_t *) PyMem_Malloc ((progsize + 1) * sizeof (wchar_t));
...
/* Note that Py_SetProgramName expects the string it is passed to
remain alive for the duration of the program's execution, so
it is not freed after this call. */
Py_SetProgramName (progname_copy);
...
Py_Initialize ();
PyEval_InitThreads ();
Upon reading the Python 3 C API documentation, I
found (https://docs.python.org/3.5/c-api/memory.html):
To avoid memory corruption, extension writers should never try to
operate on Python objects with the functions exported by the C
library: malloc(), calloc(), realloc() and free(). This will result in
mixed calls between the C allocator and the Python memory manager with
fatal consequences, because they implement different algorithms and
operate on different heaps. However, one may safely allocate and
release memory blocks with the C library allocator for individual
purposes[...]
And Py_SetProgramName seems like a very simple call that doesn't need
a Python-allocated memory to work on. So I'm proposing this patch,
which simply replaces PyMem_Malloc by xmalloc.
Testing this is more complicated. First, the crash is completely
non-deterministic; I was able to reproduce it 10 times in a row, and
then I wasn't able to reproduce it anymore. I found that if you
completely remove your build directory and rebuild GDB from scratch,
you can reproduce it again confidently. And with my patch, I
confirmed that the bug doesn't manifest even in this situation.
No regressions found.
OK to apply?
gdb/ChangeLog:
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'.
diff --git a/gdb/python/python.c b/gdb/python/python.c
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -1720,7 +1720,7 @@ do_start_initialization ()
std::string oldloc = setlocale (LC_ALL, NULL);
setlocale (LC_ALL, "");
progsize = strlen (progname.get ());
- progname_copy = (wchar_t *) PyMem_Malloc ((progsize + 1) * sizeof (wchar_t));
+ progname_copy = (wchar_t *) xmalloc ((progsize + 1) * sizeof (wchar_t));
if (!progname_copy)
{
fprintf (stderr, "out of memory\n");

View File

@ -1,3 +1,15 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Kevin Buettner <kevinb@redhat.com>
Date: Wed, 6 May 2020 10:02:22 -0700
Subject: gdb-rhbz1818011-bfd-gcc10-error.patch
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
;; Fix int conversion error from bfd/elf.c when compiling with gcc 10
Original commit message from H.J. Lu <hjl.tools@gmail.com> is below:
bfd: Change num_group to unsigned int
elf.c failed with to with GCC 10 as of
@ -23,15 +35,10 @@ Change num_group in elf_obj_tdata to unsigned int to compile with GCC 10.
PR binutils/25717
* elf-bfd.h (elf_obj_tdata): Change num_group to unsigned int.
---
bfd/elf-bfd.h | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
index c546b583b8..5f3a5cc04b 100644
--- a/bfd/elf-bfd.h
+++ b/bfd/elf-bfd.h
@@ -1953,7 +1953,7 @@ struct elf_obj_tdata
@@ -1937,7 +1937,7 @@ struct elf_obj_tdata
struct sdt_note *sdt_note_head;
Elf_Internal_Shdr **group_sect_ptr;

File diff suppressed because it is too large Load Diff

View File

@ -1,181 +0,0 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-rhbz795424-bitpos-21of25.patch
;; Fix `GDB cannot access struct member whose offset is larger than 256MB'
;; (RH BZ 795424).
;;=push
http://sourceware.org/ml/gdb-patches/2012-09/msg00632.html
--MP_/PnL6l3LUsXWpZ/olqawWlzb
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Hi,
This is part two of the bitpos expansion patch. This implements checks
in some places in the code to ensure that a type size in ULONGEST is
small enough to fit into host memory. Tested for regressions on x86_64
Fedora 16.
Regards,
Siddhesh
--MP_/PnL6l3LUsXWpZ/olqawWlzb
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment; filename=ChangeLog-ensure_sizet
gdb/ChangeLog
* alpha-tdep.c (alpha_push_dummy_call) Check for underflow in
SP.
* cp-valprint (cp_print_value): Ensure BASECLASS fits into
size_t.
* dwarf2loc.c (read_pieced_value): Ensure that THIS_SIZE fits
into size_t.
(write_pieced_value): Likewise.
* findcmd.c (parse_find_args): Ensure PATTERN_BUF_SIZE fits into
size_t.
* p-valprint (pascal_object_print_value): Ensure BASECLASS fits
into size_t.
* utils.c (ulongest_fits_host_or_error): New function to find if
a ULONGEST number fits into size_t.
* utils.h: Declare ulongest_fits_host_or_error.
* valops.c (search_struct_method): Ensure BASECLASS fits into
size_t.
* value.c (allocate_value_lazy): Ensure TYPE fits into size_t.
(allocate_value_contents): Likewise.
(set_value_enclosing_type): Ensure NEW_ENCL_TYPE fits into
size_t.
* vax-tdep.c (vax_return_value): Ensure that TYPE fits into
size_t.
--MP_/PnL6l3LUsXWpZ/olqawWlzb
Content-Type: text/x-patch
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename=bitpos-ensure-size_t.patch
diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c
--- a/gdb/alpha-tdep.c
+++ b/gdb/alpha-tdep.c
@@ -414,6 +414,13 @@ alpha_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
accumulate_size = 0;
else
accumulate_size -= sizeof(arg_reg_buffer);
+
+ /* Check for underflow. */
+ if (sp - accumulate_size > sp)
+ error (_("Insufficient memory in GDB host for arguments, "
+ "need %s bytes, but less than %s bytes available."),
+ plongest (accumulate_size), plongest (CORE_ADDR_MAX - sp));
+
sp -= accumulate_size;
/* Keep sp aligned to a multiple of 16 as the ABI requires. */
diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c
--- a/gdb/cp-valprint.c
+++ b/gdb/cp-valprint.c
@@ -529,6 +529,7 @@ cp_print_value (struct type *type, struct type *real_type,
if ((boffset + offset) < 0
|| (boffset + offset) >= TYPE_LENGTH (real_type))
{
+ ulongest_fits_host_or_error (TYPE_LENGTH (baseclass));
gdb::byte_vector buf (TYPE_LENGTH (baseclass));
if (target_read_memory (address + boffset, buf.data (),
diff --git a/gdb/defs.h b/gdb/defs.h
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -669,4 +669,6 @@ DEF_ENUM_FLAGS_TYPE (enum user_selected_what_flag, user_selected_what);
#include "utils.h"
+extern void ulongest_fits_host_or_error (ULONGEST num);
+
#endif /* #ifndef DEFS_H */
diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c
--- a/gdb/p-valprint.c
+++ b/gdb/p-valprint.c
@@ -775,6 +775,7 @@ pascal_object_print_value (struct type *type, const gdb_byte *valaddr,
if (boffset < 0 || boffset >= TYPE_LENGTH (type))
{
+ ulongest_fits_host_or_error (TYPE_LENGTH (baseclass));
buf.resize (TYPE_LENGTH (baseclass));
base_valaddr = buf.data ();
diff --git a/gdb/utils.c b/gdb/utils.c
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -2957,6 +2957,17 @@ string_to_core_addr (const char *my_string)
return addr;
}
+/* Ensure that the input NUM is not larger than the maximum capacity of the
+ host system. We choose SIZE_MAX / 8 as a conservative estimate of the size
+ of a resource that a system may allocate. */
+void
+ulongest_fits_host_or_error (ULONGEST num)
+{
+ if (num > SIZE_MAX / 8)
+ error (_("Insufficient memory in host GDB for object of size %s bytes, "
+ "maximum allowed %s bytes."), pulongest (num),
+ pulongest (SIZE_MAX / 8));
+}
#if GDB_SELF_TEST
static void
diff --git a/gdb/valops.c b/gdb/valops.c
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -2064,6 +2064,7 @@ search_struct_method (const char *name, struct value **arg1p,
{
CORE_ADDR address;
+ ulongest_fits_host_or_error (TYPE_LENGTH (baseclass));
gdb::byte_vector tmp (TYPE_LENGTH (baseclass));
address = value_address (*arg1p);
diff --git a/gdb/value.c b/gdb/value.c
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -933,6 +933,7 @@ allocate_value_lazy (struct type *type)
description correctly. */
check_typedef (type);
+ ulongest_fits_host_or_error (TYPE_LENGTH (type));
val = new struct value (type);
/* Values start out on the all_values chain. */
@@ -1015,6 +1016,8 @@ check_type_length_before_alloc (const struct type *type)
static void
allocate_value_contents (struct value *val)
{
+ ulongest_fits_host_or_error (TYPE_LENGTH (val->enclosing_type));
+
if (!val->contents)
{
check_type_length_before_alloc (val->enclosing_type);
@@ -2874,6 +2877,7 @@ set_value_enclosing_type (struct value *val, struct type *new_encl_type)
if (TYPE_LENGTH (new_encl_type) > TYPE_LENGTH (value_enclosing_type (val)))
{
check_type_length_before_alloc (new_encl_type);
+ ulongest_fits_host_or_error (TYPE_LENGTH (new_encl_type));
val->contents
.reset ((gdb_byte *) xrealloc (val->contents.release (),
TYPE_LENGTH (new_encl_type)));
diff --git a/gdb/vax-tdep.c b/gdb/vax-tdep.c
--- a/gdb/vax-tdep.c
+++ b/gdb/vax-tdep.c
@@ -219,6 +219,7 @@ vax_return_value (struct gdbarch *gdbarch, struct value *function,
ULONGEST addr;
regcache_raw_read_unsigned (regcache, VAX_R0_REGNUM, &addr);
+ ulongest_fits_host_or_error (TYPE_LENGTH (type));
read_memory (addr, readbuf, len);
}

View File

@ -1,558 +0,0 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-rhbz795424-bitpos-22of25.patch
;; Fix `GDB cannot access struct member whose offset is larger than 256MB'
;; (RH BZ 795424).
;;=push
http://sourceware.org/ml/gdb-patches/2012-09/msg00629.html
--MP_/6HRlH6vpyqtSy4CYyMrX6b2
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Hi,
This is part three of the bitpos expansion change. Some architectures
allow arbitrary length watchpoints and combined with the fact that type
lengths could be large enough, we need LONGEST for watchpoint lengths.
It is architecture dependent however, whether the LONGEST is needed or
not. This patch updates the signatures of watchpoint insertion and
removal functions of all architectures (to comply with the function
signatures in the callback struct), but expands types only in
architectures that need it. Tested on Fedora 16 x86_64.
Regards,
Siddhesh
--MP_/6HRlH6vpyqtSy4CYyMrX6b2
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment; filename=ChangeLog-wp
gdb/ChangeLog:
* arm-linux-nat.c (arm_linux_insert_watchpoint): Expand
parameter LEN to LONGEST.
(arm_linux_remove_watchpoint): Likewise.
(arm_linux_watchpoint_addr_within_range): Expand parameter
LENGTH to LONGEST.
* i386-nat.c (i386_insert_watchpoint): Expand parameter LEN to
LONGEST.
(i386_remove_watchpoint): Likewise.
* ia64-linux-nat.c (ia64_linux_insert_watchpoint): Likewise.
(ia64_linux_remove_watchpoint): Likewise.
* inf-ttrace.c (inf_ttrace_insert_watchpoint): Likewise.
Expand NUM_PAGES, PAGE to LONGEST.
(inf_ttrace_remove_watchpoint): Likewise.
* mips-linux-nat.c (mips_linux_insert_watchpoint): Expand
parameter LEN to LONGEST.
(mips_linux_remove_watchpoint): Likewise.
* nto-procfs.c (procfs_remove_hw_watchpoint): Likewise.
(procfs_insert_hw_watchpoint): Likewise.
* ppc-linux-nat.c (calculate_dvc): Likewise. Expand I,
NUM_BYTE_ENABLE to LONGEST.
(check_condition): Expand parameter LEN to point to LONGEST.
(ppc_linux_can_accel_watchpoint_condition): Expand parameter
LEN to LONGEST.
(create_watchpoint_request): Likewise.
(ppc_linux_insert_watchpoint): Likewise.
(ppc_linux_remove_watchpoint): Likewise.
(ppc_linux_watchpoint_addr_within_range): Expand parameter
LENGTH to LONGEST.
* procfs.c (proc_set_watchpoint): Expand parameter LEN to
LONGEST.
(procfs_set_watchpoint): Likewise.
(procfs_insert_watchpoint): Likewise.
(procfs_remove_watchpoint): Likewise.
* remote-m32r-sdi.c (m32r_insert_watchpoint): Likewise. Use
plongest to format print LEN.
(m32r_remove_watchpoint): Likewise.
* remote-mips.c (mips_insert_watchpoint): Expand parameter LEN
to LONGEST.
(mips_remove_watchpoint): Likewise.
* remote.c (remote_insert_watchpoint): Likewise.
Use phex_nz to format print LEN.
(remote_remove_watchpoint): Likewise.
(remote_watchpoint_addr_within_range): Expand parameter LENGTH
to LONGEST.
* s390-linux-nat.c (s390_insert_watchpoint): Expand parameter LEN to
LONGEST.
(s390_remove_watchpoint): Likewise.
* target.c (update_current_target): Expand parameter LEN for
callbacks to TO_INSERT_WATCHPOINT, TO_REMOVE_WATCHPOINT,
TO_CAN_ACCEL_WATCHPOINT_CONDITION, to LONGEST.
(default_watchpoint_addr_within_range): Expand parameter
LENGTH to LONGEST.
(debug_to_can_accel_watchpoint_condition): Expand parameter LEN
to LONGEST. Use plongest to format print LEN.
(debug_to_watchpoint_addr_within_range): Expand parameter LENGTH
to LONGEST. Use plongest to format print LENGTH.
(debug_to_insert_watchpoint): Expand parameter LEN to LONGEST.
Use plongest to format print LEN.
(debug_to_remove_watchpoint): Likewise.
* target.h (struct target_ops): Expand parameter LEN of
TO_REMOVE_WATCHPOINT, TO_INSERT_WATCHPOINT,
TO_WATCHPOINT_ADDR_WITHIN_RANGE and
TO_CAN_ACCEL_WATCHPOINT_CONDITION to LONGEST.
--MP_/6HRlH6vpyqtSy4CYyMrX6b2
Content-Type: text/x-patch
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename=bitpos-wp.patch
diff --git a/gdb/aarch64-linux-nat.c b/gdb/aarch64-linux-nat.c
--- a/gdb/aarch64-linux-nat.c
+++ b/gdb/aarch64-linux-nat.c
@@ -63,14 +63,14 @@ public:
int can_use_hw_breakpoint (enum bptype, int, int) override;
int insert_hw_breakpoint (struct gdbarch *, struct bp_target_info *) override;
int remove_hw_breakpoint (struct gdbarch *, struct bp_target_info *) override;
- int region_ok_for_hw_watchpoint (CORE_ADDR, int) override;
+ int region_ok_for_hw_watchpoint (CORE_ADDR, LONGEST) override;
int insert_watchpoint (CORE_ADDR, int, enum target_hw_bp_type,
struct expression *) override;
int remove_watchpoint (CORE_ADDR, int, enum target_hw_bp_type,
struct expression *) override;
bool stopped_by_watchpoint () override;
bool stopped_data_address (CORE_ADDR *) override;
- bool watchpoint_addr_within_range (CORE_ADDR, CORE_ADDR, int) override;
+ bool watchpoint_addr_within_range (CORE_ADDR, CORE_ADDR, LONGEST) override;
int can_do_single_step () override;
@@ -887,7 +887,8 @@ aarch64_linux_nat_target::stopped_by_watchpoint ()
bool
aarch64_linux_nat_target::watchpoint_addr_within_range (CORE_ADDR addr,
- CORE_ADDR start, int length)
+ CORE_ADDR start,
+ LONGEST length)
{
return start <= addr && start + length - 1 >= addr;
}
diff --git a/gdb/arm-linux-nat.c b/gdb/arm-linux-nat.c
--- a/gdb/arm-linux-nat.c
+++ b/gdb/arm-linux-nat.c
@@ -80,7 +80,7 @@ public:
int remove_hw_breakpoint (struct gdbarch *, struct bp_target_info *) override;
- int region_ok_for_hw_watchpoint (CORE_ADDR, int) override;
+ int region_ok_for_hw_watchpoint (CORE_ADDR, LONGEST) override;
int insert_watchpoint (CORE_ADDR, int, enum target_hw_bp_type,
struct expression *) override;
@@ -91,7 +91,7 @@ public:
bool stopped_data_address (CORE_ADDR *) override;
- bool watchpoint_addr_within_range (CORE_ADDR, CORE_ADDR, int) override;
+ bool watchpoint_addr_within_range (CORE_ADDR, CORE_ADDR, LONGEST) override;
const struct target_desc *read_description () override;
@@ -1203,7 +1203,7 @@ arm_linux_nat_target::stopped_by_watchpoint ()
bool
arm_linux_nat_target::watchpoint_addr_within_range (CORE_ADDR addr,
CORE_ADDR start,
- int length)
+ LONGEST length)
{
return start <= addr && start + length - 1 >= addr;
}
diff --git a/gdb/nat/aarch64-linux-hw-point.c b/gdb/nat/aarch64-linux-hw-point.c
--- a/gdb/nat/aarch64-linux-hw-point.c
+++ b/gdb/nat/aarch64-linux-hw-point.c
@@ -137,7 +137,7 @@ aarch64_point_encode_ctrl_reg (enum target_hw_bp_type type, int offset, int len)
Return 0 for any non-compliant ADDR and/or LEN; return 1 otherwise. */
static int
-aarch64_point_is_aligned (int is_watchpoint, CORE_ADDR addr, int len)
+aarch64_point_is_aligned (int is_watchpoint, CORE_ADDR addr, LONGEST len)
{
unsigned int alignment = 0;
@@ -212,9 +212,10 @@ aarch64_point_is_aligned (int is_watchpoint, CORE_ADDR addr, int len)
an address within the latter. */
static void
-aarch64_align_watchpoint (CORE_ADDR addr, int len, CORE_ADDR *aligned_addr_p,
+aarch64_align_watchpoint (CORE_ADDR addr, LONGEST len,
+ CORE_ADDR *aligned_addr_p,
int *aligned_offset_p, int *aligned_len_p,
- CORE_ADDR *next_addr_p, int *next_len_p,
+ CORE_ADDR *next_addr_p, LONGEST *next_len_p,
CORE_ADDR *next_addr_orig_p)
{
int aligned_len;
@@ -611,7 +612,7 @@ aarch64_handle_aligned_watchpoint (enum target_hw_bp_type type,
static int
aarch64_handle_unaligned_watchpoint (enum target_hw_bp_type type,
- CORE_ADDR addr, int len, int is_insert,
+ CORE_ADDR addr, LONGEST len, int is_insert,
struct aarch64_debug_reg_state *state)
{
CORE_ADDR addr_orig = addr;
@@ -641,12 +642,12 @@ aarch64_handle_unaligned_watchpoint (enum target_hw_bp_type type,
" "
"addr_orig: %s\n"
" "
- "next_addr: %s, next_len: %d\n"
+ "next_addr: %s, next_len: %s\n"
" "
"addr_orig_next: %s\n",
is_insert, core_addr_to_string_nz (aligned_addr),
aligned_len, core_addr_to_string_nz (addr_orig),
- core_addr_to_string_nz (addr), len,
+ core_addr_to_string_nz (addr), plongest (len),
core_addr_to_string_nz (addr_orig_next));
addr_orig = addr_orig_next;
@@ -660,7 +661,7 @@ aarch64_handle_unaligned_watchpoint (enum target_hw_bp_type type,
int
aarch64_handle_watchpoint (enum target_hw_bp_type type, CORE_ADDR addr,
- int len, int is_insert,
+ LONGEST len, int is_insert,
struct aarch64_debug_reg_state *state)
{
if (aarch64_point_is_aligned (1 /* is_watchpoint */ , addr, len))
@@ -742,14 +743,14 @@ aarch64_linux_any_set_debug_regs_state (aarch64_debug_reg_state *state,
void
aarch64_show_debug_reg_state (struct aarch64_debug_reg_state *state,
const char *func, CORE_ADDR addr,
- int len, enum target_hw_bp_type type)
+ LONGEST len, enum target_hw_bp_type type)
{
int i;
debug_printf ("%s", func);
if (addr || len)
- debug_printf (" (addr=0x%08lx, len=%d, type=%s)",
- (unsigned long) addr, len,
+ debug_printf (" (addr=0x%08lx, len=%s, type=%s)",
+ (unsigned long) addr, plongest (len),
type == hw_write ? "hw-write-watchpoint"
: (type == hw_read ? "hw-read-watchpoint"
: (type == hw_access ? "hw-access-watchpoint"
@@ -832,7 +833,7 @@ aarch64_linux_get_debug_reg_capacity (int tid)
ADDR and whose length is LEN in bytes. */
int
-aarch64_linux_region_ok_for_watchpoint (CORE_ADDR addr, int len)
+aarch64_linux_region_ok_for_watchpoint (CORE_ADDR addr, LONGEST len)
{
CORE_ADDR aligned_addr;
diff --git a/gdb/nat/aarch64-linux-hw-point.h b/gdb/nat/aarch64-linux-hw-point.h
--- a/gdb/nat/aarch64-linux-hw-point.h
+++ b/gdb/nat/aarch64-linux-hw-point.h
@@ -176,7 +176,7 @@ int aarch64_handle_breakpoint (enum target_hw_bp_type type, CORE_ADDR addr,
int len, int is_insert,
struct aarch64_debug_reg_state *state);
int aarch64_handle_watchpoint (enum target_hw_bp_type type, CORE_ADDR addr,
- int len, int is_insert,
+ LONGEST len, int is_insert,
struct aarch64_debug_reg_state *state);
void aarch64_linux_set_debug_regs (struct aarch64_debug_reg_state *state,
@@ -189,12 +189,12 @@ bool aarch64_linux_any_set_debug_regs_state (aarch64_debug_reg_state *state,
void aarch64_show_debug_reg_state (struct aarch64_debug_reg_state *state,
const char *func, CORE_ADDR addr,
- int len, enum target_hw_bp_type type);
+ LONGEST len, enum target_hw_bp_type type);
void aarch64_linux_get_debug_reg_capacity (int tid);
struct aarch64_debug_reg_state *aarch64_get_debug_reg_state (pid_t pid);
-int aarch64_linux_region_ok_for_watchpoint (CORE_ADDR addr, int len);
+int aarch64_linux_region_ok_for_watchpoint (CORE_ADDR addr, LONGEST len);
#endif /* NAT_AARCH64_LINUX_HW_POINT_H */
diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c
--- a/gdb/ppc-linux-nat.c
+++ b/gdb/ppc-linux-nat.c
@@ -284,7 +284,7 @@ struct ppc_linux_nat_target final : public linux_nat_target
int remove_hw_breakpoint (struct gdbarch *, struct bp_target_info *)
override;
- int region_ok_for_hw_watchpoint (CORE_ADDR, int) override;
+ int region_ok_for_hw_watchpoint (CORE_ADDR, LONGEST) override;
int insert_watchpoint (CORE_ADDR, int, enum target_hw_bp_type,
struct expression *) override;
@@ -302,9 +302,9 @@ struct ppc_linux_nat_target final : public linux_nat_target
bool stopped_data_address (CORE_ADDR *) override;
- bool watchpoint_addr_within_range (CORE_ADDR, CORE_ADDR, int) override;
+ bool watchpoint_addr_within_range (CORE_ADDR, CORE_ADDR, LONGEST) override;
- bool can_accel_watchpoint_condition (CORE_ADDR, int, int, struct expression *)
+ bool can_accel_watchpoint_condition (CORE_ADDR, LONGEST, int, struct expression *)
override;
int masked_watch_num_registers (CORE_ADDR, CORE_ADDR) override;
@@ -2065,11 +2065,11 @@ can_use_watchpoint_cond_accel (void)
CONDITION_VALUE will hold the value which should be put in the
DVC register. */
static void
-calculate_dvc (CORE_ADDR addr, int len, CORE_ADDR data_value,
+calculate_dvc (CORE_ADDR addr, LONGEST len, CORE_ADDR data_value,
uint32_t *condition_mode, uint64_t *condition_value)
{
- int i, num_byte_enable, align_offset, num_bytes_off_dvc,
- rightmost_enabled_byte;
+ LONGEST i, num_byte_enable;
+ int align_offset, num_bytes_off_dvc, rightmost_enabled_byte;
CORE_ADDR addr_end_data, addr_end_dvc;
/* The DVC register compares bytes within fixed-length windows which
@@ -2157,7 +2157,7 @@ num_memory_accesses (const std::vector<value_ref_ptr> &chain)
of the constant. */
static int
check_condition (CORE_ADDR watch_addr, struct expression *cond,
- CORE_ADDR *data_value, int *len)
+ CORE_ADDR *data_value, LONGEST *len)
{
int pc = 1, num_accesses_left, num_accesses_right;
struct value *left_val, *right_val;
@@ -2208,7 +2208,8 @@ check_condition (CORE_ADDR watch_addr, struct expression *cond,
the condition expression, thus only triggering the watchpoint when it is
true. */
bool
-ppc_linux_nat_target::can_accel_watchpoint_condition (CORE_ADDR addr, int len,
+ppc_linux_nat_target::can_accel_watchpoint_condition (CORE_ADDR addr,
+ LONGEST len,
int rw,
struct expression *cond)
{
@@ -2226,7 +2227,7 @@ ppc_linux_nat_target::can_accel_watchpoint_condition (CORE_ADDR addr, int len,
static void
create_watchpoint_request (struct ppc_hw_breakpoint *p, CORE_ADDR addr,
- int len, enum target_hw_bp_type type,
+ LONGEST len, enum target_hw_bp_type type,
struct expression *cond, int insert)
{
if (len == 1
@@ -2492,7 +2493,7 @@ ppc_linux_nat_target::stopped_by_watchpoint ()
bool
ppc_linux_nat_target::watchpoint_addr_within_range (CORE_ADDR addr,
CORE_ADDR start,
- int length)
+ LONGEST length)
{
int mask;
diff --git a/gdb/procfs.c b/gdb/procfs.c
--- a/gdb/procfs.c
+++ b/gdb/procfs.c
@@ -1546,7 +1546,7 @@ procfs_address_to_host_pointer (CORE_ADDR addr)
}
static int
-proc_set_watchpoint (procinfo *pi, CORE_ADDR addr, int len, int wflags)
+proc_set_watchpoint (procinfo *pi, CORE_ADDR addr, LONGEST len, int wflags)
{
struct {
procfs_ctl_t cmd;
@@ -3238,7 +3238,7 @@ procfs_target::pid_to_exec_file (int pid)
/* Insert a watchpoint. */
static int
-procfs_set_watchpoint (ptid_t ptid, CORE_ADDR addr, int len, int rwflag,
+procfs_set_watchpoint (ptid_t ptid, CORE_ADDR addr, LONGEST len, int rwflag,
int after)
{
int pflags = 0;
diff --git a/gdb/remote.c b/gdb/remote.c
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -450,7 +450,7 @@ public:
bool stopped_data_address (CORE_ADDR *) override;
- bool watchpoint_addr_within_range (CORE_ADDR, CORE_ADDR, int) override;
+ bool watchpoint_addr_within_range (CORE_ADDR, CORE_ADDR, LONGEST) override;
int can_use_hw_breakpoint (enum bptype, int, int) override;
@@ -10335,7 +10335,7 @@ remote_target::insert_watchpoint (CORE_ADDR addr, int len,
p = strchr (rs->buf.data (), '\0');
addr = remote_address_masked (addr);
p += hexnumstr (p, (ULONGEST) addr);
- xsnprintf (p, endbuf - p, ",%x", len);
+ xsnprintf (p, endbuf - p, ",%s", phex_nz (len, sizeof (len)));
putpkt (rs->buf);
getpkt (&rs->buf, 0);
@@ -10355,7 +10355,7 @@ remote_target::insert_watchpoint (CORE_ADDR addr, int len,
bool
remote_target::watchpoint_addr_within_range (CORE_ADDR addr,
- CORE_ADDR start, int length)
+ CORE_ADDR start, LONGEST length)
{
CORE_ADDR diff = remote_address_masked (addr - start);
@@ -10384,7 +10384,7 @@ remote_target::remove_watchpoint (CORE_ADDR addr, int len,
p = strchr (rs->buf.data (), '\0');
addr = remote_address_masked (addr);
p += hexnumstr (p, (ULONGEST) addr);
- xsnprintf (p, endbuf - p, ",%x", len);
+ xsnprintf (p, endbuf - p, ",%s", phex_nz (len, sizeof (len)));
putpkt (rs->buf);
getpkt (&rs->buf, 0);
diff --git a/gdb/s390-linux-nat.c b/gdb/s390-linux-nat.c
--- a/gdb/s390-linux-nat.c
+++ b/gdb/s390-linux-nat.c
@@ -121,7 +121,7 @@ public:
override;
int remove_hw_breakpoint (struct gdbarch *, struct bp_target_info *)
override;
- int region_ok_for_hw_watchpoint (CORE_ADDR, int) override;
+ int region_ok_for_hw_watchpoint (CORE_ADDR, LONGEST) override;
bool stopped_by_watchpoint () override;
int insert_watchpoint (CORE_ADDR, int, enum target_hw_bp_type,
struct expression *) override;
diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c
--- a/gdb/target-delegates.c
+++ b/gdb/target-delegates.c
@@ -37,9 +37,9 @@ struct dummy_target : public target_ops
bool stopped_by_watchpoint () override;
bool have_steppable_watchpoint () override;
bool stopped_data_address (CORE_ADDR *arg0) override;
- bool watchpoint_addr_within_range (CORE_ADDR arg0, CORE_ADDR arg1, int arg2) override;
+ bool watchpoint_addr_within_range (CORE_ADDR arg0, CORE_ADDR arg1, LONGEST arg2) override;
int region_ok_for_hw_watchpoint (CORE_ADDR arg0, LONGEST arg1) override;
- bool can_accel_watchpoint_condition (CORE_ADDR arg0, int arg1, int arg2, struct expression *arg3) override;
+ bool can_accel_watchpoint_condition (CORE_ADDR arg0, LONGEST arg1, int arg2, struct expression *arg3) override;
int masked_watch_num_registers (CORE_ADDR arg0, CORE_ADDR arg1) override;
int can_do_single_step () override;
bool supports_terminal_ours () override;
@@ -204,9 +204,9 @@ struct debug_target : public target_ops
bool stopped_by_watchpoint () override;
bool have_steppable_watchpoint () override;
bool stopped_data_address (CORE_ADDR *arg0) override;
- bool watchpoint_addr_within_range (CORE_ADDR arg0, CORE_ADDR arg1, int arg2) override;
+ bool watchpoint_addr_within_range (CORE_ADDR arg0, CORE_ADDR arg1, LONGEST arg2) override;
int region_ok_for_hw_watchpoint (CORE_ADDR arg0, LONGEST arg1) override;
- bool can_accel_watchpoint_condition (CORE_ADDR arg0, int arg1, int arg2, struct expression *arg3) override;
+ bool can_accel_watchpoint_condition (CORE_ADDR arg0, LONGEST arg1, int arg2, struct expression *arg3) override;
int masked_watch_num_registers (CORE_ADDR arg0, CORE_ADDR arg1) override;
int can_do_single_step () override;
bool supports_terminal_ours () override;
@@ -1041,19 +1041,19 @@ debug_target::stopped_data_address (CORE_ADDR *arg0)
}
bool
-target_ops::watchpoint_addr_within_range (CORE_ADDR arg0, CORE_ADDR arg1, int arg2)
+target_ops::watchpoint_addr_within_range (CORE_ADDR arg0, CORE_ADDR arg1, LONGEST arg2)
{
return this->beneath ()->watchpoint_addr_within_range (arg0, arg1, arg2);
}
bool
-dummy_target::watchpoint_addr_within_range (CORE_ADDR arg0, CORE_ADDR arg1, int arg2)
+dummy_target::watchpoint_addr_within_range (CORE_ADDR arg0, CORE_ADDR arg1, LONGEST arg2)
{
return default_watchpoint_addr_within_range (this, arg0, arg1, arg2);
}
bool
-debug_target::watchpoint_addr_within_range (CORE_ADDR arg0, CORE_ADDR arg1, int arg2)
+debug_target::watchpoint_addr_within_range (CORE_ADDR arg0, CORE_ADDR arg1, LONGEST arg2)
{
bool result;
fprintf_unfiltered (gdb_stdlog, "-> %s->watchpoint_addr_within_range (...)\n", this->beneath ()->shortname ());
@@ -1063,7 +1063,7 @@ debug_target::watchpoint_addr_within_range (CORE_ADDR arg0, CORE_ADDR arg1, int
fputs_unfiltered (", ", gdb_stdlog);
target_debug_print_CORE_ADDR (arg1);
fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_int (arg2);
+ target_debug_print_LONGEST (arg2);
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_bool (result);
fputs_unfiltered ("\n", gdb_stdlog);
@@ -1099,19 +1099,19 @@ debug_target::region_ok_for_hw_watchpoint (CORE_ADDR arg0, LONGEST arg1)
}
bool
-target_ops::can_accel_watchpoint_condition (CORE_ADDR arg0, int arg1, int arg2, struct expression *arg3)
+target_ops::can_accel_watchpoint_condition (CORE_ADDR arg0, LONGEST arg1, int arg2, struct expression *arg3)
{
return this->beneath ()->can_accel_watchpoint_condition (arg0, arg1, arg2, arg3);
}
bool
-dummy_target::can_accel_watchpoint_condition (CORE_ADDR arg0, int arg1, int arg2, struct expression *arg3)
+dummy_target::can_accel_watchpoint_condition (CORE_ADDR arg0, LONGEST arg1, int arg2, struct expression *arg3)
{
return false;
}
bool
-debug_target::can_accel_watchpoint_condition (CORE_ADDR arg0, int arg1, int arg2, struct expression *arg3)
+debug_target::can_accel_watchpoint_condition (CORE_ADDR arg0, LONGEST arg1, int arg2, struct expression *arg3)
{
bool result;
fprintf_unfiltered (gdb_stdlog, "-> %s->can_accel_watchpoint_condition (...)\n", this->beneath ()->shortname ());
@@ -1119,7 +1119,7 @@ debug_target::can_accel_watchpoint_condition (CORE_ADDR arg0, int arg1, int arg2
fprintf_unfiltered (gdb_stdlog, "<- %s->can_accel_watchpoint_condition (", this->beneath ()->shortname ());
target_debug_print_CORE_ADDR (arg0);
fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_int (arg1);
+ target_debug_print_LONGEST (arg1);
fputs_unfiltered (", ", gdb_stdlog);
target_debug_print_int (arg2);
fputs_unfiltered (", ", gdb_stdlog);
diff --git a/gdb/target.c b/gdb/target.c
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -55,7 +55,7 @@ static void generic_tls_error (void) ATTRIBUTE_NORETURN;
static void default_terminal_info (struct target_ops *, const char *, int);
static int default_watchpoint_addr_within_range (struct target_ops *,
- CORE_ADDR, CORE_ADDR, int);
+ CORE_ADDR, CORE_ADDR, LONGEST);
static int default_region_ok_for_hw_watchpoint (struct target_ops *,
CORE_ADDR, LONGEST);
@@ -3111,7 +3111,7 @@ default_region_ok_for_hw_watchpoint (struct target_ops *self,
static int
default_watchpoint_addr_within_range (struct target_ops *target,
CORE_ADDR addr,
- CORE_ADDR start, int length)
+ CORE_ADDR start, LONGEST length)
{
return addr >= start && addr < start + length;
}
diff --git a/gdb/target.h b/gdb/target.h
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -561,7 +561,7 @@ struct target_ops
TARGET_DEFAULT_RETURN (false);
virtual bool stopped_data_address (CORE_ADDR *)
TARGET_DEFAULT_RETURN (false);
- virtual bool watchpoint_addr_within_range (CORE_ADDR, CORE_ADDR, int)
+ virtual bool watchpoint_addr_within_range (CORE_ADDR, CORE_ADDR, LONGEST)
TARGET_DEFAULT_FUNC (default_watchpoint_addr_within_range);
/* Documentation of this routine is provided with the corresponding
@@ -569,7 +569,7 @@ struct target_ops
virtual int region_ok_for_hw_watchpoint (CORE_ADDR, LONGEST)
TARGET_DEFAULT_FUNC (default_region_ok_for_hw_watchpoint);
- virtual bool can_accel_watchpoint_condition (CORE_ADDR, int, int,
+ virtual bool can_accel_watchpoint_condition (CORE_ADDR, LONGEST, int,
struct expression *)
TARGET_DEFAULT_RETURN (false);
virtual int masked_watch_num_registers (CORE_ADDR, CORE_ADDR)

File diff suppressed because it is too large Load Diff

View File

@ -1,638 +0,0 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-rhbz795424-bitpos-25of25-test.patch
;; Fix `GDB cannot access struct member whose offset is larger than 256MB'
;; (RH BZ 795424).
;;=push
http://sourceware.org/ml/gdb-patches/2012-10/msg00231.html
On Mon, 15 Oct 2012 15:25:55 +0200, Jan Kratochvil wrote:
> I have filed for it now:
> Invalid debug/ array bounds w/-fno-range-check and 32-bit target
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54934
Therefore it looks as a valid gfortran FSF GCC HEAD bug so provided
a hand-patched .S file for i386; patched GDB PASSes with it.
Thanks,
Jan
2012-10-15 Siddhesh Poyarekar <siddhesh@redhat.com>
Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.fortran/array-bounds.exp: New test file.
* gdb.fortran/array-bounds.f: New test file.
* gdb.fortran/array-bounds.S: New test file.
diff --git a/gdb/testsuite/gdb.fortran/array-bounds.S b/gdb/testsuite/gdb.fortran/array-bounds.S
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.fortran/array-bounds.S
@@ -0,0 +1,529 @@
+/* Copyright 2012 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/>.
+
+ This file is part of the gdb testsuite. */
+
+ .file "array-bounds.f"
+ .text
+.Ltext0:
+ .type MAIN__, @function
+MAIN__:
+.LFB0:
+ .file 1 "gdb.fortran/array-bounds.f"
+ # gdb.fortran/array-bounds.f:16
+ .loc 1 16 0
+ .cfi_startproc
+# BLOCK 2 seq:0
+# PRED: ENTRY (FALLTHRU)
+ pushl %ebp
+.LCFI0:
+ .cfi_def_cfa_offset 8
+ .cfi_offset 5, -8
+ movl %esp, %ebp
+.LCFI1:
+ .cfi_def_cfa_register 5
+ subl $40, %esp
+.LBB2:
+# SUCC: 3 (FALLTHRU)
+ # gdb.fortran/array-bounds.f:18
+ .loc 1 18 0
+ movl $-1, %eax
+# BLOCK 3 seq:1
+# PRED: 2 (FALLTHRU) 4 [100.0%]
+.L3:
+ # gdb.fortran/array-bounds.f:18
+ .loc 1 18 0 is_stmt 0 discriminator 1
+ testl %eax, %eax
+# SUCC: 5 4 (FALLTHRU)
+ jg .L2
+# BLOCK 4 seq:2
+# PRED: 3 (FALLTHRU)
+ # gdb.fortran/array-bounds.f:18
+ .loc 1 18 0 discriminator 2
+ leal 1(%eax), %ecx
+ movl .LC0, %edx
+ movl %edx, -16(%ebp,%ecx,4)
+ addl $1, %eax
+# SUCC: 3 [100.0%]
+ jmp .L3
+# BLOCK 5 seq:3
+# PRED: 3
+.L2:
+.LBE2:
+ # gdb.fortran/array-bounds.f:19
+ .loc 1 19 0 is_stmt 1
+ movl -16(%ebp), %eax
+ movl -12(%ebp), %edx
+ movl %eax, -24(%ebp)
+ movl %edx, -20(%ebp)
+ # gdb.fortran/array-bounds.f:20
+ .loc 1 20 0
+ movl $0, 4(%esp)
+ movl $0, (%esp)
+# SUCC:
+ call _gfortran_stop_string
+ .cfi_endproc
+.LFE0:
+ .size MAIN__, .-MAIN__
+ .globl main
+ .type main, @function
+main:
+.LFB1:
+ # gdb.fortran/array-bounds.f:21
+ .loc 1 21 0
+ .cfi_startproc
+# BLOCK 2 seq:0
+# PRED: ENTRY (FALLTHRU)
+ pushl %ebp
+.LCFI2:
+ .cfi_def_cfa_offset 8
+ .cfi_offset 5, -8
+ movl %esp, %ebp
+.LCFI3:
+ .cfi_def_cfa_register 5
+ andl $-16, %esp
+ subl $16, %esp
+ # gdb.fortran/array-bounds.f:21
+ .loc 1 21 0
+ movl 12(%ebp), %eax
+ movl %eax, 4(%esp)
+ movl 8(%ebp), %eax
+ movl %eax, (%esp)
+ call _gfortran_set_args
+ movl $options.1.1824, 4(%esp)
+ movl $7, (%esp)
+ call _gfortran_set_options
+ call MAIN__
+ movl $0, %eax
+ leave
+.LCFI4:
+ .cfi_restore 5
+ .cfi_def_cfa 4, 4
+# SUCC: EXIT [100.0%]
+ ret
+ .cfi_endproc
+.LFE1:
+ .size main, .-main
+ .section .rodata
+ .align 4
+ .type options.1.1824, @object
+ .size options.1.1824, 28
+options.1.1824:
+ .long 68
+ .long 1023
+ .long 0
+ .long 0
+ .long 1
+ .long 1
+ .long 0
+ .align 4
+.LC0:
+ .long 1109917696
+ .text
+.Letext0:
+ .section .debug_info,"",@progbits
+.Ldebug_info0:
+ .long 2f - 1f # Length of Compilation Unit Info
+1:
+ .value 0x2 # DWARF version number
+ .long .Ldebug_abbrev0 # Offset Into Abbrev. Section
+ .byte 0x4 # Pointer Size (in bytes)
+dieb: .uleb128 0x1 # (DIE (0xb) DW_TAG_compile_unit)
+ .long .LASF5 # DW_AT_producer: "GNU Fortran 4.8.0 20121015 (experimental) -ffixed-form -m32 -mtune=generic -march=x86-64 -g -gdwarf-2 -fintrinsic-modules-path .../gcchead-root/lib/gcc/x86_64-unknown-linux-gnu/4.8.0/finclude"
+ .byte 0xe # DW_AT_language
+ .byte 0x2 # DW_AT_identifier_case
+ .long .LASF6 # DW_AT_name: "gdb.fortran/array-bounds.f"
+ .long .LASF7 # DW_AT_comp_dir: ""
+ .long .Ltext0 # DW_AT_low_pc
+ .long .Letext0 # DW_AT_high_pc
+ .long .Ldebug_line0 # DW_AT_stmt_list
+die26: .uleb128 0x2 # (DIE (0x26) DW_TAG_subprogram)
+ .long .LASF8 # DW_AT_name: "MAIN__"
+ .byte 0x1 # DW_AT_decl_file (gdb.fortran/array-bounds.f)
+ .byte 0x10 # DW_AT_decl_line
+ .long .LFB0 # DW_AT_low_pc
+ .long .LFE0 # DW_AT_high_pc
+ .long .LLST0 # DW_AT_frame_base
+ .byte 0x1 # DW_AT_GNU_all_tail_call_sites
+ .byte 0x1 # DW_AT_main_subprogram
+ .byte 0x2 # DW_AT_calling_convention
+ .long die66 - .Ldebug_info0 # DW_AT_sibling
+die40: .uleb128 0x3 # (DIE (0x40) DW_TAG_variable)
+ .ascii "bar\0" # DW_AT_name
+ .byte 0x1 # DW_AT_decl_file (gdb.fortran/array-bounds.f)
+ .byte 0x11 # DW_AT_decl_line
+ .long die66 - .Ldebug_info0 # DW_AT_type
+ .byte 0x2 # DW_AT_location
+ .byte 0x91 # DW_OP_fbreg
+ .sleb128 -24
+die4e: .uleb128 0x3 # (DIE (0x4e) DW_TAG_variable)
+ .ascii "foo\0" # DW_AT_name
+ .byte 0x1 # DW_AT_decl_file (gdb.fortran/array-bounds.f)
+ .byte 0x10 # DW_AT_decl_line
+ .long die88 - .Ldebug_info0 # DW_AT_type
+ .byte 0x2 # DW_AT_location
+ .byte 0x91 # DW_OP_fbreg
+ .sleb128 -32
+die5c: .uleb128 0x4 # (DIE (0x5c) DW_TAG_lexical_block)
+ .long .LBB2 # DW_AT_low_pc
+ .long .LBE2 # DW_AT_high_pc
+ .byte 0 # end of children of DIE 0x26
+die66: .uleb128 0x5 # (DIE (0x66) DW_TAG_array_type)
+ .long die81 - .Ldebug_info0 # DW_AT_type
+ .long die7a - .Ldebug_info0 # DW_AT_sibling
+die6f: .uleb128 0x6 # (DIE (0x6f) DW_TAG_subrange_type)
+ .long die7a - .Ldebug_info0 # DW_AT_type
+#if 0
+ .long 0xffffffff # DW_AT_lower_bound
+ .byte 0 # DW_AT_upper_bound
+#else
+ .quad 0xfffffffeffffffff # DW_AT_lower_bound
+ .quad 0xffffffff00000000 # DW_AT_upper_bound
+#endif
+ .byte 0 # end of children of DIE 0x66
+die7a: .uleb128 0x7 # (DIE (0x7a) DW_TAG_base_type)
+#if 0
+ .byte 0x4 # DW_AT_byte_size
+#else
+ .byte 0x8 # DW_AT_byte_size
+#endif
+ .byte 0x5 # DW_AT_encoding
+ .long .LASF0 # DW_AT_name: "integer(kind=4)"
+die81: .uleb128 0x7 # (DIE (0x81) DW_TAG_base_type)
+ .byte 0x4 # DW_AT_byte_size
+ .byte 0x4 # DW_AT_encoding
+ .long .LASF1 # DW_AT_name: "real(kind=4)"
+die88: .uleb128 0x5 # (DIE (0x88) DW_TAG_array_type)
+ .long die81 - .Ldebug_info0 # DW_AT_type
+ .long die99 - .Ldebug_info0 # DW_AT_sibling
+die91: .uleb128 0x8 # (DIE (0x91) DW_TAG_subrange_type)
+ .long die7a - .Ldebug_info0 # DW_AT_type
+#if 0
+ .byte 0 # DW_AT_lower_bound
+ .byte 0x1 # DW_AT_upper_bound
+#else
+ .quad 0x100000000 # DW_AT_lower_bound
+ .quad 0x100000001 # DW_AT_upper_bound
+#endif
+ .byte 0 # end of children of DIE 0x88
+die99: .uleb128 0x9 # (DIE (0x99) DW_TAG_subprogram)
+ .byte 0x1 # DW_AT_external
+ .long .LASF9 # DW_AT_name: "main"
+ .byte 0x1 # DW_AT_decl_file (gdb.fortran/array-bounds.f)
+ .byte 0x15 # DW_AT_decl_line
+ .long die7a - .Ldebug_info0 # DW_AT_type
+ .long .LFB1 # DW_AT_low_pc
+ .long .LFE1 # DW_AT_high_pc
+ .long .LLST1 # DW_AT_frame_base
+ .byte 0x1 # DW_AT_GNU_all_tail_call_sites
+ .long died4 - .Ldebug_info0 # DW_AT_sibling
+dieb6: .uleb128 0xa # (DIE (0xb6) DW_TAG_formal_parameter)
+ .long .LASF2 # DW_AT_name: "argc"
+ .byte 0x1 # DW_AT_decl_file (gdb.fortran/array-bounds.f)
+ .byte 0x15 # DW_AT_decl_line
+ .long died4 - .Ldebug_info0 # DW_AT_type
+ .byte 0x2 # DW_AT_location
+ .byte 0x91 # DW_OP_fbreg
+ .sleb128 0
+diec4: .uleb128 0xa # (DIE (0xc4) DW_TAG_formal_parameter)
+ .long .LASF3 # DW_AT_name: "argv"
+ .byte 0x1 # DW_AT_decl_file (gdb.fortran/array-bounds.f)
+ .byte 0x15 # DW_AT_decl_line
+ .long died9 - .Ldebug_info0 # DW_AT_type
+ .byte 0x3 # DW_AT_location
+ .byte 0x91 # DW_OP_fbreg
+ .sleb128 4
+ .byte 0x6 # DW_OP_deref
+ .byte 0 # end of children of DIE 0x99
+died4: .uleb128 0xb # (DIE (0xd4) DW_TAG_const_type)
+ .long die7a - .Ldebug_info0 # DW_AT_type
+died9: .uleb128 0xc # (DIE (0xd9) DW_TAG_pointer_type)
+ .byte 0x4 # DW_AT_byte_size
+ .long diedf - .Ldebug_info0 # DW_AT_type
+diedf: .uleb128 0x7 # (DIE (0xdf) DW_TAG_base_type)
+ .byte 0x1 # DW_AT_byte_size
+ .byte 0x8 # DW_AT_encoding
+ .long .LASF4 # DW_AT_name: "character(kind=1)"
+ .byte 0 # end of children of DIE 0xb
+2:
+ .section .debug_abbrev,"",@progbits
+.Ldebug_abbrev0:
+ .uleb128 0x1 # (abbrev code)
+ .uleb128 0x11 # (TAG: DW_TAG_compile_unit)
+ .byte 0x1 # DW_children_yes
+ .uleb128 0x25 # (DW_AT_producer)
+ .uleb128 0xe # (DW_FORM_strp)
+ .uleb128 0x13 # (DW_AT_language)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x42 # (DW_AT_identifier_case)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x3 # (DW_AT_name)
+ .uleb128 0xe # (DW_FORM_strp)
+ .uleb128 0x1b # (DW_AT_comp_dir)
+ .uleb128 0xe # (DW_FORM_strp)
+ .uleb128 0x11 # (DW_AT_low_pc)
+ .uleb128 0x1 # (DW_FORM_addr)
+ .uleb128 0x12 # (DW_AT_high_pc)
+ .uleb128 0x1 # (DW_FORM_addr)
+ .uleb128 0x10 # (DW_AT_stmt_list)
+ .uleb128 0x6 # (DW_FORM_data4)
+ .byte 0
+ .byte 0
+ .uleb128 0x2 # (abbrev code)
+ .uleb128 0x2e # (TAG: DW_TAG_subprogram)
+ .byte 0x1 # DW_children_yes
+ .uleb128 0x3 # (DW_AT_name)
+ .uleb128 0xe # (DW_FORM_strp)
+ .uleb128 0x3a # (DW_AT_decl_file)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x3b # (DW_AT_decl_line)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x11 # (DW_AT_low_pc)
+ .uleb128 0x1 # (DW_FORM_addr)
+ .uleb128 0x12 # (DW_AT_high_pc)
+ .uleb128 0x1 # (DW_FORM_addr)
+ .uleb128 0x40 # (DW_AT_frame_base)
+ .uleb128 0x6 # (DW_FORM_data4)
+ .uleb128 0x2116 # (DW_AT_GNU_all_tail_call_sites)
+ .uleb128 0xc # (DW_FORM_flag)
+ .uleb128 0x6a # (DW_AT_main_subprogram)
+ .uleb128 0xc # (DW_FORM_flag)
+ .uleb128 0x36 # (DW_AT_calling_convention)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x1 # (DW_AT_sibling)
+ .uleb128 0x13 # (DW_FORM_ref4)
+ .byte 0
+ .byte 0
+ .uleb128 0x3 # (abbrev code)
+ .uleb128 0x34 # (TAG: DW_TAG_variable)
+ .byte 0 # DW_children_no
+ .uleb128 0x3 # (DW_AT_name)
+ .uleb128 0x8 # (DW_FORM_string)
+ .uleb128 0x3a # (DW_AT_decl_file)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x3b # (DW_AT_decl_line)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x49 # (DW_AT_type)
+ .uleb128 0x13 # (DW_FORM_ref4)
+ .uleb128 0x2 # (DW_AT_location)
+ .uleb128 0xa # (DW_FORM_block1)
+ .byte 0
+ .byte 0
+ .uleb128 0x4 # (abbrev code)
+ .uleb128 0xb # (TAG: DW_TAG_lexical_block)
+ .byte 0 # DW_children_no
+ .uleb128 0x11 # (DW_AT_low_pc)
+ .uleb128 0x1 # (DW_FORM_addr)
+ .uleb128 0x12 # (DW_AT_high_pc)
+ .uleb128 0x1 # (DW_FORM_addr)
+ .byte 0
+ .byte 0
+ .uleb128 0x5 # (abbrev code)
+ .uleb128 0x1 # (TAG: DW_TAG_array_type)
+ .byte 0x1 # DW_children_yes
+ .uleb128 0x49 # (DW_AT_type)
+ .uleb128 0x13 # (DW_FORM_ref4)
+ .uleb128 0x1 # (DW_AT_sibling)
+ .uleb128 0x13 # (DW_FORM_ref4)
+ .byte 0
+ .byte 0
+ .uleb128 0x6 # (abbrev code)
+ .uleb128 0x21 # (TAG: DW_TAG_subrange_type)
+ .byte 0 # DW_children_no
+ .uleb128 0x49 # (DW_AT_type)
+ .uleb128 0x13 # (DW_FORM_ref4)
+#if 0
+ .uleb128 0x22 # (DW_AT_lower_bound)
+ .uleb128 0x6 # (DW_FORM_data4)
+ .uleb128 0x2f # (DW_AT_upper_bound)
+ .uleb128 0xb # (DW_FORM_data1)
+#else
+ .uleb128 0x22 # (DW_AT_lower_bound)
+ .uleb128 0x7 # (DW_FORM_data8)
+ .uleb128 0x2f # (DW_AT_upper_bound)
+ .uleb128 0x7 # (DW_FORM_data8)
+#endif
+ .byte 0
+ .byte 0
+ .uleb128 0x7 # (abbrev code)
+ .uleb128 0x24 # (TAG: DW_TAG_base_type)
+ .byte 0 # DW_children_no
+ .uleb128 0xb # (DW_AT_byte_size)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x3e # (DW_AT_encoding)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x3 # (DW_AT_name)
+ .uleb128 0xe # (DW_FORM_strp)
+ .byte 0
+ .byte 0
+ .uleb128 0x8 # (abbrev code)
+ .uleb128 0x21 # (TAG: DW_TAG_subrange_type)
+ .byte 0 # DW_children_no
+ .uleb128 0x49 # (DW_AT_type)
+ .uleb128 0x13 # (DW_FORM_ref4)
+#if 0
+ .uleb128 0x22 # (DW_AT_lower_bound)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x2f # (DW_AT_upper_bound)
+ .uleb128 0xb # (DW_FORM_data1)
+#else
+ .uleb128 0x22 # (DW_AT_lower_bound)
+ .uleb128 0x7 # (DW_FORM_data8)
+ .uleb128 0x2f # (DW_AT_upper_bound)
+ .uleb128 0x7 # (DW_FORM_data8)
+#endif
+ .byte 0
+ .byte 0
+ .uleb128 0x9 # (abbrev code)
+ .uleb128 0x2e # (TAG: DW_TAG_subprogram)
+ .byte 0x1 # DW_children_yes
+ .uleb128 0x3f # (DW_AT_external)
+ .uleb128 0xc # (DW_FORM_flag)
+ .uleb128 0x3 # (DW_AT_name)
+ .uleb128 0xe # (DW_FORM_strp)
+ .uleb128 0x3a # (DW_AT_decl_file)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x3b # (DW_AT_decl_line)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x49 # (DW_AT_type)
+ .uleb128 0x13 # (DW_FORM_ref4)
+ .uleb128 0x11 # (DW_AT_low_pc)
+ .uleb128 0x1 # (DW_FORM_addr)
+ .uleb128 0x12 # (DW_AT_high_pc)
+ .uleb128 0x1 # (DW_FORM_addr)
+ .uleb128 0x40 # (DW_AT_frame_base)
+ .uleb128 0x6 # (DW_FORM_data4)
+ .uleb128 0x2116 # (DW_AT_GNU_all_tail_call_sites)
+ .uleb128 0xc # (DW_FORM_flag)
+ .uleb128 0x1 # (DW_AT_sibling)
+ .uleb128 0x13 # (DW_FORM_ref4)
+ .byte 0
+ .byte 0
+ .uleb128 0xa # (abbrev code)
+ .uleb128 0x5 # (TAG: DW_TAG_formal_parameter)
+ .byte 0 # DW_children_no
+ .uleb128 0x3 # (DW_AT_name)
+ .uleb128 0xe # (DW_FORM_strp)
+ .uleb128 0x3a # (DW_AT_decl_file)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x3b # (DW_AT_decl_line)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x49 # (DW_AT_type)
+ .uleb128 0x13 # (DW_FORM_ref4)
+ .uleb128 0x2 # (DW_AT_location)
+ .uleb128 0xa # (DW_FORM_block1)
+ .byte 0
+ .byte 0
+ .uleb128 0xb # (abbrev code)
+ .uleb128 0x26 # (TAG: DW_TAG_const_type)
+ .byte 0 # DW_children_no
+ .uleb128 0x49 # (DW_AT_type)
+ .uleb128 0x13 # (DW_FORM_ref4)
+ .byte 0
+ .byte 0
+ .uleb128 0xc # (abbrev code)
+ .uleb128 0xf # (TAG: DW_TAG_pointer_type)
+ .byte 0 # DW_children_no
+ .uleb128 0xb # (DW_AT_byte_size)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x49 # (DW_AT_type)
+ .uleb128 0x13 # (DW_FORM_ref4)
+ .byte 0
+ .byte 0
+ .byte 0
+ .section .debug_loc,"",@progbits
+.Ldebug_loc0:
+.LLST0:
+ .long .LFB0-.Ltext0 # Location list begin address (*.LLST0)
+ .long .LCFI0-.Ltext0 # Location list end address (*.LLST0)
+ .value 0x2 # Location expression size
+ .byte 0x74 # DW_OP_breg4
+ .sleb128 4
+ .long .LCFI0-.Ltext0 # Location list begin address (*.LLST0)
+ .long .LCFI1-.Ltext0 # Location list end address (*.LLST0)
+ .value 0x2 # Location expression size
+ .byte 0x74 # DW_OP_breg4
+ .sleb128 8
+ .long .LCFI1-.Ltext0 # Location list begin address (*.LLST0)
+ .long .LFE0-.Ltext0 # Location list end address (*.LLST0)
+ .value 0x2 # Location expression size
+ .byte 0x75 # DW_OP_breg5
+ .sleb128 8
+ .long 0 # Location list terminator begin (*.LLST0)
+ .long 0 # Location list terminator end (*.LLST0)
+.LLST1:
+ .long .LFB1-.Ltext0 # Location list begin address (*.LLST1)
+ .long .LCFI2-.Ltext0 # Location list end address (*.LLST1)
+ .value 0x2 # Location expression size
+ .byte 0x74 # DW_OP_breg4
+ .sleb128 4
+ .long .LCFI2-.Ltext0 # Location list begin address (*.LLST1)
+ .long .LCFI3-.Ltext0 # Location list end address (*.LLST1)
+ .value 0x2 # Location expression size
+ .byte 0x74 # DW_OP_breg4
+ .sleb128 8
+ .long .LCFI3-.Ltext0 # Location list begin address (*.LLST1)
+ .long .LCFI4-.Ltext0 # Location list end address (*.LLST1)
+ .value 0x2 # Location expression size
+ .byte 0x75 # DW_OP_breg5
+ .sleb128 8
+ .long .LCFI4-.Ltext0 # Location list begin address (*.LLST1)
+ .long .LFE1-.Ltext0 # Location list end address (*.LLST1)
+ .value 0x2 # Location expression size
+ .byte 0x74 # DW_OP_breg4
+ .sleb128 4
+ .long 0 # Location list terminator begin (*.LLST1)
+ .long 0 # Location list terminator end (*.LLST1)
+ .section .debug_aranges,"",@progbits
+ .long 0x1c # Length of Address Ranges Info
+ .value 0x2 # DWARF Version
+ .long .Ldebug_info0 # Offset of Compilation Unit Info
+ .byte 0x4 # Size of Address
+ .byte 0 # Size of Segment Descriptor
+ .value 0 # Pad to 8 byte boundary
+ .value 0
+ .long .Ltext0 # Address
+ .long .Letext0-.Ltext0 # Length
+ .long 0
+ .long 0
+ .section .debug_line,"",@progbits
+.Ldebug_line0:
+ .section .debug_str,"MS",@progbits,1
+.LASF4:
+ .string "character(kind=1)"
+.LASF5:
+ .string "GNU Fortran 4.8.0 20121015 (experimental) -ffixed-form -m32 -mtune=generic -march=x86-64 -g -gdwarf-2 -fintrinsic-modules-path .../gcchead-root/lib/gcc/x86_64-unknown-linux-gnu/4.8.0/finclude"
+.LASF7:
+ .string ""
+.LASF0:
+#if 0
+ .string "integer(kind=4)"
+#else
+ .string "integer(kind=8)"
+#endif
+.LASF9:
+ .string "main"
+.LASF8:
+ .string "MAIN__"
+.LASF6:
+ .string "gdb.fortran/array-bounds.f"
+.LASF2:
+ .string "argc"
+.LASF1:
+ .string "real(kind=4)"
+.LASF3:
+ .string "argv"
+ .ident "GCC: (GNU) 4.8.0 20121015 (experimental)"
+ .section .note.GNU-stack,"",@progbits
diff --git a/gdb/testsuite/gdb.fortran/array-bounds.exp b/gdb/testsuite/gdb.fortran/array-bounds.exp
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.fortran/array-bounds.exp
@@ -0,0 +1,43 @@
+# Copyright 2012 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/>.
+
+# This file is part of the gdb testsuite. It contains test to ensure that
+# array bounds accept LONGEST.
+
+if { [skip_fortran_tests] } { return -1 }
+
+set testfile "array-bounds"
+
+if { [is_ilp32_target] && ([istarget "i\[34567\]86-*-linux*"]
+ || [istarget "x86_64-*-linux*"]) } {
+ set srcfile ${testfile}.S
+ set opts {nodebug f90}
+} else {
+ set srcfile ${testfile}.f
+ set opts {debug f90}
+}
+
+if {[prepare_for_testing $testfile.exp $testfile $srcfile $opts]} {
+ print "compile failed"
+ return -1
+}
+
+if { ![runto MAIN__] } {
+ perror "Could not run to breakpoint `MAIN__'."
+ continue
+}
+
+gdb_test "print &foo" {.*\(4294967296:4294967297\).*}
+gdb_test "print &bar" {.*\(-4294967297:-4294967296\).*}
diff --git a/gdb/testsuite/gdb.fortran/array-bounds.f b/gdb/testsuite/gdb.fortran/array-bounds.f
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.fortran/array-bounds.f
@@ -0,0 +1,22 @@
+c Copyright 2012 Free Software Foundation, Inc.
+
+c This program is free software; you can redistribute it and/or modify
+c it under the terms of the GNU General Public License as published by
+c the Free Software Foundation; either version 3 of the License, or
+c (at your option) any later version.
+c
+c This program is distributed in the hope that it will be useful,
+c but WITHOUT ANY WARRANTY; without even the implied warranty of
+c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+c GNU General Public License for more details.
+c
+c You should have received a copy of the GNU General Public License
+c along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+ dimension foo(4294967296_8:4294967297_8)
+ dimension bar(-4294967297_8:-4294967296_8)
+ bar = 42
+ foo=bar
+ stop
+ end
+

View File

@ -1,140 +0,0 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-rhbz795424-bitpos-25of25.patch
;; Fix `GDB cannot access struct member whose offset is larger than 256MB'
;; (RH BZ 795424).
;;=push
http://sourceware.org/ml/gdb-patches/2012-08/msg00562.html
--MP_/90J7bck2fqDySEX9JkZtaqL
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Hi,
Range bounds for a gdb type can have LONGEST values for low and high
bounds. Fortran range bounds functions however use only int. The larger
ranges don't compile by default on gcc, but it is possible to override
the check in the compiler by using -fno-range-check. As a result, this
check is necessary so that we don't print junk in case of an overflow.
Attached patch does this expansion and also includes a test case that
verifies that the problem is fixed. I have also verified on x86_64 that
this patch does not cause any regressions.
Regards,
Siddhesh
gdb/ChangeLog:
* f-lang.h (f77_get_upperbound): Return LONGEST.
(f77_get_lowerbound): Likewise.
* f-typeprint.c (f_type_print_varspec_suffix): Expand
UPPER_BOUND and LOWER_BOUND to LONGEST. Use plongest to format
print them.
(f_type_print_base): Expand UPPER_BOUND to LONGEST. Use
plongest to format print it.
* f-valprint.c (f77_get_lowerbound): Return LONGEST.
(f77_get_upperbound): Likewise.
(f77_get_dynamic_length_of_aggregate): Expand UPPER_BOUND,
LOWER_BOUND to LONGEST.
(f77_create_arrayprint_offset_tbl): Likewise.
testsuite/ChangeLog:
* gdb.fortran/array-bounds.exp: New test case.
* gdb.fortran/array-bounds.f: New test case.
--MP_/90J7bck2fqDySEX9JkZtaqL
Content-Type: text/x-patch
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename=f77-bounds.patch
diff --git a/gdb/f-lang.h b/gdb/f-lang.h
--- a/gdb/f-lang.h
+++ b/gdb/f-lang.h
@@ -50,9 +50,9 @@ struct common_block
struct symbol *contents[1];
};
-extern int f77_get_upperbound (struct type *);
+extern LONGEST f77_get_upperbound (struct type *);
-extern int f77_get_lowerbound (struct type *);
+extern LONGEST f77_get_lowerbound (struct type *);
extern void f77_get_dynamic_array_length (struct type *);
diff --git a/gdb/f-typeprint.c b/gdb/f-typeprint.c
--- a/gdb/f-typeprint.c
+++ b/gdb/f-typeprint.c
@@ -149,7 +149,7 @@ f_type_print_varspec_suffix (struct type *type, struct ui_file *stream,
int show, int passed_a_ptr, int demangled_args,
int arrayprint_recurse_level, int print_rank_only)
{
- int upper_bound, lower_bound;
+ LONGEST upper_bound, lower_bound;
/* No static variables are permitted as an error call may occur during
execution of this function. */
@@ -196,7 +196,7 @@ f_type_print_varspec_suffix (struct type *type, struct ui_file *stream,
{
lower_bound = f77_get_lowerbound (type);
if (lower_bound != 1) /* Not the default. */
- fprintf_filtered (stream, "%d:", lower_bound);
+ fprintf_filtered (stream, "%s:", plongest (lower_bound));
/* Make sure that, if we have an assumed size array, we
print out a warning and print the upperbound as '*'. */
@@ -206,7 +206,7 @@ f_type_print_varspec_suffix (struct type *type, struct ui_file *stream,
else
{
upper_bound = f77_get_upperbound (type);
- fprintf_filtered (stream, "%d", upper_bound);
+ fprintf_filtered (stream, "%s", plongest (upper_bound));
}
}
@@ -278,7 +278,7 @@ void
f_type_print_base (struct type *type, struct ui_file *stream, int show,
int level)
{
- int upper_bound;
+ LONGEST upper_bound;
int index;
QUIT;
@@ -370,7 +370,7 @@ f_type_print_base (struct type *type, struct ui_file *stream, int show,
else
{
upper_bound = f77_get_upperbound (type);
- fprintf_filtered (stream, "character*%d", upper_bound);
+ fprintf_filtered (stream, "character*%s", plongest (upper_bound));
}
break;
diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c
--- a/gdb/f-valprint.c
+++ b/gdb/f-valprint.c
@@ -41,7 +41,7 @@ LONGEST f77_array_offset_tbl[MAX_FORTRAN_DIMS + 1][2];
/* Array which holds offsets to be applied to get a row's elements
for a given array. Array also holds the size of each subarray. */
-int
+LONGEST
f77_get_lowerbound (struct type *type)
{
if (TYPE_ARRAY_LOWER_BOUND_IS_UNDEFINED (type))
@@ -50,7 +50,7 @@ f77_get_lowerbound (struct type *type)
return TYPE_ARRAY_LOWER_BOUND_VALUE (type);
}
-int
+LONGEST
f77_get_upperbound (struct type *type)
{
if (TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (type))

View File

@ -1,60 +0,0 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Sergio Durigan Junior <sergiodj@redhat.com>
Date: Wed, 12 Sep 2018 00:02:17 -0400
Subject: gdb-rhbz795424-bitpos-arrayview.patch
;; This patch is needed to compile GDB after -Werror=narrowing has
;; been enabled by default.
;; Author: Sergio Durigan Junior.
diff --git a/gdb/common/array-view.h b/gdb/common/array-view.h
--- a/gdb/common/array-view.h
+++ b/gdb/common/array-view.h
@@ -85,7 +85,7 @@ public:
using value_type = T;
using reference = T &;
using const_reference = const T &;
- using size_type = size_t;
+ using size_type = ULONGEST;
/* Default construction creates an empty view. */
constexpr array_view () noexcept
@@ -114,7 +114,7 @@ public:
count. */
template<typename U,
typename = Requires<DecayedConvertible<U>>>
- constexpr array_view (U *array, size_t size) noexcept
+ constexpr array_view (U *array, ULONGEST size) noexcept
: m_array (array), m_size (size)
{}
@@ -128,7 +128,7 @@ public:
{}
/* Create an array view from an array. */
- template<typename U, size_t Size,
+ template<typename U, ULONGEST Size,
typename = Requires<DecayedConvertible<U>>>
constexpr array_view (U (&array)[Size]) noexcept
: m_array (array), m_size (Size)
@@ -161,9 +161,9 @@ public:
/*constexpr14*/ T *end () noexcept { return m_array + m_size; }
constexpr const T *end () const noexcept { return m_array + m_size; }
- /*constexpr14*/ reference operator[] (size_t index) noexcept
+ /*constexpr14*/ reference operator[] (ULONGEST index) noexcept
{ return m_array[index]; }
- constexpr const_reference operator[] (size_t index) const noexcept
+ constexpr const_reference operator[] (ULONGEST index) const noexcept
{ return m_array[index]; }
constexpr size_type size () const noexcept { return m_size; }
@@ -196,7 +196,7 @@ operator== (const gdb::array_view<T> &lhs, const gdb::array_view<T> &rhs)
if (lhs.size () != rhs.size ())
return false;
- for (size_t i = 0; i < lhs.size (); i++)
+ for (ULONGEST i = 0; i < lhs.size (); i++)
if (!(lhs[i] == rhs[i]))
return false;

View File

@ -1,432 +0,0 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-rhbz795424-bitpos-lazyvalue.patch
;; Fix `GDB cannot access struct member whose offset is larger than 256MB'
;; (RH BZ 795424).
;;=push
diff --git a/gdb/testsuite/gdb.base/longest-types-64bit.S b/gdb/testsuite/gdb.base/longest-types-64bit.S
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/longest-types-64bit.S
@@ -0,0 +1,249 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2012 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/>. */
+
+ .file "longest-types-64bit.c"
+ .text
+.Ltext0:
+ .globl main
+main:
+ .comm f,8,8
+.Letext0:
+ .file 1 "gdb.base/longest-types-64bit.c"
+ .section .debug_info,"",@progbits
+.Ldebug_info0:
+ .4byte 0x9a /* Length of Compilation Unit Info */
+ .2byte 0x2 /* DWARF version number */
+ .4byte .Ldebug_abbrev0 /* Offset Into Abbrev. Section */
+ .byte 0x8 /* Pointer Size (in bytes) */
+ .uleb128 0x1 /* (DIE (0xb) DW_TAG_compile_unit) */
+ .4byte .LASF3 /* DW_AT_producer: "GNU C 4.7.3 20121109 (prerelease)" */
+ .byte 0x1 /* DW_AT_language */
+ .4byte .LASF4 /* DW_AT_name: "gdb.base/longest-types-64bit.c" */
+ .4byte .LASF5 /* DW_AT_comp_dir: "" */
+ .4byte .Ldebug_line0 /* DW_AT_stmt_list */
+ .uleb128 0x2 /* (DIE (0x1d) DW_TAG_structure_type) */
+ .ascii "foo\0" /* DW_AT_name */
+ .4byte 0xff000002 /* DW_AT_byte_size */
+ .byte 0x1 /* DW_AT_decl_file (gdb.base/longest-types-64bit.c) */
+ .byte 0x12 /* DW_AT_decl_line */
+ .4byte 0x4e /* DW_AT_sibling */
+ .uleb128 0x3 /* (DIE (0x2c) DW_TAG_member) */
+ .ascii "buf\0" /* DW_AT_name */
+ .byte 0x1 /* DW_AT_decl_file (gdb.base/longest-types-64bit.c) */
+ .byte 0x14 /* DW_AT_decl_line */
+ .4byte 0x4e /* DW_AT_type */
+ .byte 0x2 /* DW_AT_data_member_location */
+ .byte 0x23 /* DW_OP_plus_uconst */
+ .uleb128 0
+ .uleb128 0x4 /* (DIE (0x3a) DW_TAG_member) */
+ .4byte .LASF0 /* DW_AT_name: "buf2" */
+ .byte 0x1 /* DW_AT_decl_file (gdb.base/longest-types-64bit.c) */
+ .byte 0x15 /* DW_AT_decl_line */
+ .4byte 0x73 /* DW_AT_type */
+ .byte 0x7 /* DW_AT_data_member_location */
+ .byte 0x23 /* DW_OP_plus_uconst */
+ .uleb128 0xffff000000
+ .byte 0 /* end of children of DIE 0x1d */
+ .uleb128 0x5 /* (DIE (0x4e) DW_TAG_array_type) */
+ .4byte 0x6c /* DW_AT_type */
+ .4byte 0x65 /* DW_AT_sibling */
+ .uleb128 0x6 /* (DIE (0x57) DW_TAG_subrange_type) */
+ .4byte 0x65 /* DW_AT_type */
+ .quad 0xfffeffffff /* DW_AT_upper_bound */
+ .byte 0 /* end of children of DIE 0x4e */
+ .uleb128 0x7 /* (DIE (0x65) DW_TAG_base_type) */
+ .byte 0x8 /* DW_AT_byte_size */
+ .byte 0x7 /* DW_AT_encoding */
+ .4byte .LASF1 /* DW_AT_name: "sizetype" */
+ .uleb128 0x7 /* (DIE (0x6c) DW_TAG_base_type) */
+ .byte 0x1 /* DW_AT_byte_size */
+ .byte 0x6 /* DW_AT_encoding */
+ .4byte .LASF2 /* DW_AT_name: "char" */
+ .uleb128 0x5 /* (DIE (0x73) DW_TAG_array_type) */
+ .4byte 0x6c /* DW_AT_type */
+ .4byte 0x83 /* DW_AT_sibling */
+ .uleb128 0x8 /* (DIE (0x7c) DW_TAG_subrange_type) */
+ .4byte 0x65 /* DW_AT_type */
+ .byte 0x1 /* DW_AT_upper_bound */
+ .byte 0 /* end of children of DIE 0x73 */
+ .uleb128 0x9 /* (DIE (0x83) DW_TAG_variable) */
+ .ascii "f\0" /* DW_AT_name */
+ .byte 0x1 /* DW_AT_decl_file (gdb.base/longest-types-64bit.c) */
+ .byte 0x16 /* DW_AT_decl_line */
+ .4byte 0x97 /* DW_AT_type */
+ .byte 0x1 /* DW_AT_external */
+ .byte 0x9 /* DW_AT_location */
+ .byte 0x3 /* DW_OP_addr */
+ .quad f
+ .uleb128 0xa /* (DIE (0x97) DW_TAG_pointer_type) */
+ .byte 0x8 /* DW_AT_byte_size */
+ .4byte 0x1d /* DW_AT_type */
+ .byte 0 /* end of children of DIE 0xb */
+ .section .debug_abbrev,"",@progbits
+.Ldebug_abbrev0:
+ .uleb128 0x1 /* (abbrev code) */
+ .uleb128 0x11 /* (TAG: DW_TAG_compile_unit) */
+ .byte 0x1 /* DW_children_yes */
+ .uleb128 0x25 /* (DW_AT_producer) */
+ .uleb128 0xe /* (DW_FORM_strp) */
+ .uleb128 0x13 /* (DW_AT_language) */
+ .uleb128 0xb /* (DW_FORM_data1) */
+ .uleb128 0x3 /* (DW_AT_name) */
+ .uleb128 0xe /* (DW_FORM_strp) */
+ .uleb128 0x1b /* (DW_AT_comp_dir) */
+ .uleb128 0xe /* (DW_FORM_strp) */
+ .uleb128 0x10 /* (DW_AT_stmt_list) */
+ .uleb128 0x6 /* (DW_FORM_data4) */
+ .byte 0
+ .byte 0
+ .uleb128 0x2 /* (abbrev code) */
+ .uleb128 0x13 /* (TAG: DW_TAG_structure_type) */
+ .byte 0x1 /* DW_children_yes */
+ .uleb128 0x3 /* (DW_AT_name) */
+ .uleb128 0x8 /* (DW_FORM_string) */
+ .uleb128 0xb /* (DW_AT_byte_size) */
+ .uleb128 0x6 /* (DW_FORM_data4) */
+ .uleb128 0x3a /* (DW_AT_decl_file) */
+ .uleb128 0xb /* (DW_FORM_data1) */
+ .uleb128 0x3b /* (DW_AT_decl_line) */
+ .uleb128 0xb /* (DW_FORM_data1) */
+ .uleb128 0x1 /* (DW_AT_sibling) */
+ .uleb128 0x13 /* (DW_FORM_ref4) */
+ .byte 0
+ .byte 0
+ .uleb128 0x3 /* (abbrev code) */
+ .uleb128 0xd /* (TAG: DW_TAG_member) */
+ .byte 0 /* DW_children_no */
+ .uleb128 0x3 /* (DW_AT_name) */
+ .uleb128 0x8 /* (DW_FORM_string) */
+ .uleb128 0x3a /* (DW_AT_decl_file) */
+ .uleb128 0xb /* (DW_FORM_data1) */
+ .uleb128 0x3b /* (DW_AT_decl_line) */
+ .uleb128 0xb /* (DW_FORM_data1) */
+ .uleb128 0x49 /* (DW_AT_type) */
+ .uleb128 0x13 /* (DW_FORM_ref4) */
+ .uleb128 0x38 /* (DW_AT_data_member_location) */
+ .uleb128 0xa /* (DW_FORM_block1) */
+ .byte 0
+ .byte 0
+ .uleb128 0x4 /* (abbrev code) */
+ .uleb128 0xd /* (TAG: DW_TAG_member) */
+ .byte 0 /* DW_children_no */
+ .uleb128 0x3 /* (DW_AT_name) */
+ .uleb128 0xe /* (DW_FORM_strp) */
+ .uleb128 0x3a /* (DW_AT_decl_file) */
+ .uleb128 0xb /* (DW_FORM_data1) */
+ .uleb128 0x3b /* (DW_AT_decl_line) */
+ .uleb128 0xb /* (DW_FORM_data1) */
+ .uleb128 0x49 /* (DW_AT_type) */
+ .uleb128 0x13 /* (DW_FORM_ref4) */
+ .uleb128 0x38 /* (DW_AT_data_member_location) */
+ .uleb128 0xa /* (DW_FORM_block1) */
+ .byte 0
+ .byte 0
+ .uleb128 0x5 /* (abbrev code) */
+ .uleb128 0x1 /* (TAG: DW_TAG_array_type) */
+ .byte 0x1 /* DW_children_yes */
+ .uleb128 0x49 /* (DW_AT_type) */
+ .uleb128 0x13 /* (DW_FORM_ref4) */
+ .uleb128 0x1 /* (DW_AT_sibling) */
+ .uleb128 0x13 /* (DW_FORM_ref4) */
+ .byte 0
+ .byte 0
+ .uleb128 0x6 /* (abbrev code) */
+ .uleb128 0x21 /* (TAG: DW_TAG_subrange_type) */
+ .byte 0 /* DW_children_no */
+ .uleb128 0x49 /* (DW_AT_type) */
+ .uleb128 0x13 /* (DW_FORM_ref4) */
+ .uleb128 0x2f /* (DW_AT_upper_bound) */
+ .uleb128 0x7 /* (DW_FORM_data8) */
+ .byte 0
+ .byte 0
+ .uleb128 0x7 /* (abbrev code) */
+ .uleb128 0x24 /* (TAG: DW_TAG_base_type) */
+ .byte 0 /* DW_children_no */
+ .uleb128 0xb /* (DW_AT_byte_size) */
+ .uleb128 0xb /* (DW_FORM_data1) */
+ .uleb128 0x3e /* (DW_AT_encoding) */
+ .uleb128 0xb /* (DW_FORM_data1) */
+ .uleb128 0x3 /* (DW_AT_name) */
+ .uleb128 0xe /* (DW_FORM_strp) */
+ .byte 0
+ .byte 0
+ .uleb128 0x8 /* (abbrev code) */
+ .uleb128 0x21 /* (TAG: DW_TAG_subrange_type) */
+ .byte 0 /* DW_children_no */
+ .uleb128 0x49 /* (DW_AT_type) */
+ .uleb128 0x13 /* (DW_FORM_ref4) */
+ .uleb128 0x2f /* (DW_AT_upper_bound) */
+ .uleb128 0xb /* (DW_FORM_data1) */
+ .byte 0
+ .byte 0
+ .uleb128 0x9 /* (abbrev code) */
+ .uleb128 0x34 /* (TAG: DW_TAG_variable) */
+ .byte 0 /* DW_children_no */
+ .uleb128 0x3 /* (DW_AT_name) */
+ .uleb128 0x8 /* (DW_FORM_string) */
+ .uleb128 0x3a /* (DW_AT_decl_file) */
+ .uleb128 0xb /* (DW_FORM_data1) */
+ .uleb128 0x3b /* (DW_AT_decl_line) */
+ .uleb128 0xb /* (DW_FORM_data1) */
+ .uleb128 0x49 /* (DW_AT_type) */
+ .uleb128 0x13 /* (DW_FORM_ref4) */
+ .uleb128 0x3f /* (DW_AT_external) */
+ .uleb128 0xc /* (DW_FORM_flag) */
+ .uleb128 0x2 /* (DW_AT_location) */
+ .uleb128 0xa /* (DW_FORM_block1) */
+ .byte 0
+ .byte 0
+ .uleb128 0xa /* (abbrev code) */
+ .uleb128 0xf /* (TAG: DW_TAG_pointer_type) */
+ .byte 0 /* DW_children_no */
+ .uleb128 0xb /* (DW_AT_byte_size) */
+ .uleb128 0xb /* (DW_FORM_data1) */
+ .uleb128 0x49 /* (DW_AT_type) */
+ .uleb128 0x13 /* (DW_FORM_ref4) */
+ .byte 0
+ .byte 0
+ .byte 0
+ .section .debug_aranges,"",@progbits
+ .4byte 0x1c /* Length of Address Ranges Info */
+ .2byte 0x2 /* DWARF Version */
+ .4byte .Ldebug_info0 /* Offset of Compilation Unit Info */
+ .byte 0x8 /* Size of Address */
+ .byte 0 /* Size of Segment Descriptor */
+ .2byte 0 /* Pad to 16 byte boundary */
+ .2byte 0
+ .quad 0
+ .quad 0
+ .section .debug_line,"",@progbits
+.Ldebug_line0:
+ .section .debug_str,"MS",@progbits,1
+.LASF4:
+ .string "gdb.base/longest-types-64bit.c"
+.LASF3:
+ .string "GNU C 4.7.3 20121109 (prerelease)"
+.LASF0:
+ .string "buf2"
+.LASF1:
+ .string "sizetype"
+.LASF5:
+ .string ""
+.LASF2:
+ .string "char"
+ .ident "GCC: (GNU) 4.7.3 20121109 (prerelease)"
+ .section .note.GNU-stack,"",@progbits
diff --git a/gdb/testsuite/gdb.base/longest-types-64bit.bz2.uu b/gdb/testsuite/gdb.base/longest-types-64bit.bz2.uu
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/longest-types-64bit.bz2.uu
@@ -0,0 +1,67 @@
+begin 755 gdb.base/longest-types-64bit.bz2
+M0EIH.3%!62936<'N#OH`"G/________^______?_Y______//]7SQD5'^/_%
+M=VY7?F_[X`F]]SG7531-==V:Z-.FW;M.U7=';:UH@<&FD31,E3]J'HE-/TR@
+M]4_5/32;%/U3]1--HU/U$#$R'I'J,FC0T-,)B'J#:CU,F@]0`/4:>F@CU/4,
+MA@$S2>IH!H`TR/0-$$:9`C(&FHU3VE-J;4\%,@>4T:#]49-J/4`>HT!H#3)^
+MJ`!H-``T]0&@-```:'J``&@`:9!`R9,@&3(`#3!#0!H``-#$--`,@``T`T#(
+M:`:`&0&@::,0:-```:``-`E-$1#4-3:4]3R9-39(Q/)#3R-30:9#$T!D!H&@
+M,CTGI!H#(#0T`#0``T`T`:``-``T`0,F3(!DR``TP0T`:``#0Q#30#(``-`-
+M`R&@&@!D!H&FC$&C0``&@`#0)%)H32>JGZ&!)Z1B1X@)DTVC4>H`&0:``R&@
+M,C0:``T``,C0``!H``#(`T`:#0U^\?]7K8M.96V/2[?M*DC)>WIUF)H7T\<T
+M[0D)70G25.YB!,:;8Q(;&XPAB4+$Q%:P)PA-;E=!-&$KNR22EM>$:KKRE&\Q
+M..M]L1*,!>D!X)RW,[,1I,9N%X-N&2+*:&)DJY4(VFQG%9K[/?J06WACF6-I
+MJ&JJ9,ZK4;X28M@[==%ME(A54:%>+3->MRK(G!8#TY>@E$6DR&<_5:C&/RZE
+MI<ON+RY5`LA"@DD$$DF!I9O]5X%G985_=V<.;?K9:G2R-#K<CB,1;26A<H4G
+M3R3I!)WX,-%>,!E6#`;*8R*E@++*))U)[6=OKFM%'+$-H5\X@1D)_Y*"NKV.
+M&\F8?SXW^<O]_DW.8WD@HY.NMMIBXFVROM_SKZ#4-`>HQ:Y@(Q[.>PEG=]@^
+M%C"3EZ/1X'H*02ZQH":6"@;8Z0LEW6<OKJ%$`01%`B;O!N*W1V.HC$``,:CS
+M6(/OTI'-:O6=7$/#?0T9Q[GSY1)6V`+CV@#XWMF`<S:AG<!43X"VGD,E=>)>
+M6^V=*`FB'5G4MD8L3J5XT#SW;J1]ZO+"SPIS%J(P46+Q=CC2$H-`-B&TD)M`
+M&A:066DA%AB0C6,460>M8B+$:-BR&@NM()F`S',,F8+#&0.SMOK@.G<'83N.
+MDA"#5-`JVC("1*TA;/M()&8J0+YH%IFV)+OA@4,`E?3M$[$@&Q`3]A!$&A(-
+M$PBT+2,@PU+2H9(T-H3N6'(2;""%2T*1I2P@`L?AG8&A!=31J7)1(9FB'8X=
+MWJ0S#YEG9K$.#.[L.[CNA"4JSJ^GK2*)UH=MC0.R8+E75'.09<NU&R0G1>[G
+MMQ1*[GI:>#>K`_NZS:V6>$K;OX6#!!N'"2413$DTL&]7KY>B<3V5!!C8#X5+
+MF%9<N\]C%B6OS;LH@1LR3R<LS+<]N]9\JZ<LJ#2_S2'UW('DZ!N>X!8NOKM5
+M+"N&P4.75C16!A9Q;:C.6N`WZDV=-]!<BTB<1Q*P(T4'&*2:@$=J@(M8)!5=
+MO;[ECS>,5PG<T[XC594XI0@RVPD86,M11%(T>]SNP[GV^L?YGI]7_'D8N?XV
+M'[7KZJWYVMXGBQS[`!)YI%3:D)I2!;%'R`W&YB<`9O2#F"C/)F;JK9P+@3&(
+MAH31[W)=YCODQDUKNM7A"3.C!2%CHTJNZ"Z\+#F-?(DLE>XAC%07B8;$%J_L
+MJPK48QC&,916=IM+<1&WRKLB6&Q2O79*!7S$,`7J8*!`!=K:5W550[NH9M#_
+MKL!LT,&;59GZW7S"5Z4%`%&!`9"J9`0:IR&H=MTKT=PEYC$,4K90M9AT'%;_
+MB0HVLE)(W&YWF,C:TURXO:`M[RX(A-GT97456Q4Z*HPU*4J:*[WU-4GD.9UV
+MSA#L4X[[*Y+)8IF.EO<.TP4IC2?(4HX)W1#:GOMOD2F;HM1BV#<E%PM+0&N5
+MP@$\$FD4C-Q^L"H^)NP2-.^JTT!8+!;'Z=KM7%'K@\)*PSETF&M6<Q#>;PH[
+M7:PJ-!#,!6N<3')-0C,>15'IZ>@U^CJJJ+>+>%%)%BBATD\)*F6&BLMIR&?\
+MQ2_?33@"NR1/CN\:)>5DG6`>$;$3QA94'-3]*CU6YG])<=2)'GC"RP-RK&-3
+MZDT-M_)R+F06DS?CR>E@^!,33"U6X<@OXO$Q>U$\T@IU<H-42=0YE[$,T`\H
+M('>'@T=>K`G7H8K5GLXMS3*^@JLVBHHE'.&?9RKC?Y`&&3J5!/C$++<@U#Q'
+M9R3I.$+S`%]-.UO>WH^C73F<&;RIJR+(Q@7(3PP*W[-O,,DD3S7BUK^I@D%*
+M`Y<*2TXJ&7;2'6'R.U>]0-="M`K+&N%/==N4U@9%@M1)U&251C($^S"WL"]T
+M-XN'D2[II3-$K%+&`3['O)%,8G*E%_8RV6A5B_4(2/?-AIC.\/>,YFJ<(G.8
+MAVP?UN*=ME:7&T!C%)I:&4H:-5>&^!&0>A.O'0G'/6&ZZ964@04&=#DC`%&:
+MUNLOS?,?'T:T!8L80<H_W1>='M:96K4;JX)6.('1#J$.1/L)$IS<4/*'2D34
+M/@J\BA(I2T40JS%9G8F!7U5_!#'U!+[7$ES&)@:*QAET-IBX6'_N5^7/#>@V
+MN3&,-6(AG[8&!8LV+F_U"W?/)+Y^,;=1K:SW28<0WA2"UPHP^8FG#R$!`Y`,
+MLF<`U*NNU\[6N03"*?I8D=K7.Z*H=A_3<H1Z%.Q8%2SR@I45('.EGR<N^\`Z
+M\[Z\D+/3>7;S=LVC(BQ,5<M0A"#`]7UK7W3%5(:FBMER3XSP15N!)`-^ZJZ%
+M:4)>8Q_\#G`'P*_-]T!G4$`V0BS]'S)D/;V7R?.2F?SF)N+2+#P2_<G#1B)C
+M(8?NF/+?:UMR3B#9$MBDCI2G7&N'T`FV!ERQ[21DOJ_8I73#BILTTSK)B5P<
+MG22S=*7TI>G(49TCE&*UIVT-MP808VTVV-$(*`VT<%>%96AHOL`(7%SI2%-R
+M#G2F02VQQH-7KT3E05I9Z)E\$Y8ED1KU`(4QHT%B]1$F:F1&8DAN.Q4&*?F@
+M.8D965.$PRH<VD+()"8&I%<R"P,Y[A,)^B(O%1(J%,)M(O6)8E%LY?C6X@@K
+M(F!2TA\,RE<O"E2*G?JE2YF\*OJM?$KWXW6R(3LR-)W.[:ZJC?ZE4,("J$()
+M5@U!62M"WBJ=&Q(L$5,4494K=.0B0#,C3$*``XLTF$DN!6P#%,4K%HTIC[*O
+M6"4S,;RN&@=NP7@72:=U#&JPBQ-60OEAWY;CUYF+$73.R>T5HD,G=G!KTF3D
+M94"&ZA-F,.19=8`\(Q;A07Q%!19*3#*F9Q+D(0K@V87@O.=7EJIM6`!4`>D!
+M)49QHA!BV+:4O@K00$$!5*6>A@2@4D)@R\"%$2F"O:24J*L(RP#N;O4K7I&2
+M[#)KR47H-N[<O^S-)"_Q\>VJ%3>$`9,AF8QID&I3G+D`*]BX98B$2K":A7_\
+M_]7LT!4,$NL5)NE>9[:MK2_/'GO:7"P`=<X'"U9""0<PJ`3`.:*(Z]-.GQ,9
+M>P(\L]O?"-APH(834$,W!IJS+U1F1C.!D$!&KS^-6%F90PQ[F]F=$^QE\X+-
+M@.W*LPH_78B>MHH@69RU[*'1J@8QAC\KSV@IG\(;_CUW:ZR2.,0$E3LZ_^P=
+M<_DCP"Q<`;+_;YP#^U%&E^#2M%,T?F3UN^>TSH)GFL"\%RF[KNZ+[R+@<&.$
+MC42)B96\1-.O_I).K7)X]W>EQ):4C(XB*+:S%0_37D^EBP+1HU(D?3"%_O2R
+M6-#X>AU#<$*!/,W6QC^;O^%]LR&_X'<8X$<3CUU_QFAJ;">H)2443GD4W!4#
+?<55!2^6_8J$)-O<>\H0U/6Q^>UG0%W)%.%"0P>X.^@``
+`
+end
diff --git a/gdb/testsuite/gdb.base/longest-types-64bit.c b/gdb/testsuite/gdb.base/longest-types-64bit.c
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/longest-types-64bit.c
@@ -0,0 +1,28 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2012 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/>. */
+
+struct foo
+{
+ char buf[0xffff000000];
+ char buf2[2];
+} *f;
+
+int
+main (void)
+{
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.base/longest-types-64bit.exp b/gdb/testsuite/gdb.base/longest-types-64bit.exp
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/longest-types-64bit.exp
@@ -0,0 +1,59 @@
+# This testcase is part of GDB, the GNU debugger.
+
+# Copyright 2012 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/>.
+
+standard_testfile .c longest-types-64bit.S
+
+proc test { name } { with_test_prefix $name {
+ # 64-bit array size should not overflow
+ gdb_test "print &f->buf" {= \(char \(\*\)\[1099494850560\]\) 0x0}
+
+ # The offset should not overflow
+ gdb_test "print &f->buf2" {= \(char \(\*\)\[2\]\) 0xffff000000}
+}}
+
+
+# Test 64-bit file first as it is not compiled so its compilation never fails.
+
+set file64bitbz2uu ${srcdir}/${subdir}/${testfile}.bz2.uu
+set file64bit [standard_output_file ${testfile}]
+
+if {[catch "system \"uudecode -o - ${file64bitbz2uu} | bzip2 -dc >${file64bit}\""] != 0} {
+ untested "failed uudecode or bzip2"
+ return -1
+}
+file stat ${file64bit} file64bitstat
+if {$file64bitstat(size) != 9501} {
+ untested "uudecode or bzip2 produce invalid result"
+ return -1
+}
+
+clean_restart ${file64bit}
+
+#if { [prepare_for_testing ${testfile}.exp ${testfile} $srcfile2 {nodebug}] } {
+# return -1
+#}
+
+test "64bit"
+
+
+# And here is the native build test.
+
+if { [prepare_for_testing ${testfile}.exp ${testfile} $srcfile {debug quiet}] } {
+ return -1
+}
+
+test "native"

View File

@ -25,7 +25,7 @@ a problem with make -j parallelization of the testsuite.
diff --git a/gdb/testsuite/lib/future.exp b/gdb/testsuite/lib/future.exp
--- a/gdb/testsuite/lib/future.exp
+++ b/gdb/testsuite/lib/future.exp
@@ -185,6 +185,10 @@ proc gdb_default_target_compile {source destfile type options} {
@@ -195,6 +195,10 @@ proc gdb_default_target_compile {source destfile type options} {
set ldflags ""
set dest [target_info name]
@ -36,7 +36,7 @@ diff --git a/gdb/testsuite/lib/future.exp b/gdb/testsuite/lib/future.exp
if {[info exists CFLAGS_FOR_TARGET]} {
append add_flags " $CFLAGS_FOR_TARGET"
}
@@ -519,10 +523,6 @@ proc gdb_default_target_compile {source destfile type options} {
@@ -529,10 +533,6 @@ proc gdb_default_target_compile {source destfile type options} {
}
}

View File

@ -1,168 +0,0 @@
commit 6d9d6da48e84a65871a9d72fa785105d603990a6
Author: Andreas Arnez <arnez@linux.ibm.com>
Date: Wed Oct 9 11:09:22 2019 +0200
s390: Add record/replay support for arch13 instructions
Enable recording most of the new "arch13" instructions on z/Architecture
targets, except for the specialized-function-assist instructions:
SORTL - sort lists
DFLTCC - deflate conversion call
KDSA - compute digital signature authentication
gdb/ChangeLog:
* s390-tdep.c (390_process_record): Handle new arch13 instructions
except SORTL, DFLTCC, and KDSA.
diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c
index 463c0a0..e7f1215 100644
--- a/gdb/s390-tdep.c
+++ b/gdb/s390-tdep.c
@@ -4134,6 +4134,7 @@ ex:
case 0xb998: /* ALCR - add logical with carry */
case 0xb999: /* SLBR - subtract logical with borrow */
case 0xb9f4: /* NRK - and */
+ case 0xb9f5: /* NCRK - and with complement */
case 0xb9f6: /* ORK - or */
case 0xb9f7: /* XRK - xor */
case 0xb9f8: /* ARK - add */
@@ -4166,20 +4167,32 @@ ex:
case 0xb919: /* SGFR - subtract */
case 0xb91a: /* ALGFR - add logical */
case 0xb91b: /* SLGFR - subtract logical */
+ case 0xb964: /* NNGRK - and 64 bit */
+ case 0xb965: /* OCGRK - or with complement 64 bit */
+ case 0xb966: /* NOGRK - or 64 bit */
+ case 0xb967: /* NXGRK - not exclusive or 64 bit */
+ case 0xb974: /* NNRK - and 32 bit */
+ case 0xb975: /* OCRK - or with complement 32 bit */
+ case 0xb976: /* NORK - or 32 bit */
+ case 0xb977: /* NXRK - not exclusive or 32 bit */
case 0xb980: /* NGR - and */
case 0xb981: /* OGR - or */
case 0xb982: /* XGR - xor */
case 0xb988: /* ALCGR - add logical with carry */
case 0xb989: /* SLBGR - subtract logical with borrow */
+ case 0xb9c0: /* SELFHR - select high */
case 0xb9e1: /* POPCNT - population count */
case 0xb9e4: /* NGRK - and */
+ case 0xb9e5: /* NCGRK - and with complement */
case 0xb9e6: /* OGRK - or */
case 0xb9e7: /* XGRK - xor */
case 0xb9e8: /* AGRK - add */
case 0xb9e9: /* SGRK - subtract */
case 0xb9ea: /* ALGRK - add logical */
+ case 0xb9e3: /* SELGR - select 64 bit */
case 0xb9eb: /* SLGRK - subtract logical */
case 0xb9ed: /* MSGRKC - multiply single 64x64 -> 64 */
+ case 0xb9f0: /* SELR - select 32 bit */
case 0xb9fd: /* MSRKC - multiply single 32x32 -> 32 */
/* 64-bit gpr destination + flags */
if (s390_record_gpr_g (gdbarch, regcache, inib[6]))
@@ -4555,7 +4568,13 @@ ex:
return -1;
break;
- /* 0xb932-0xb93b undefined */
+ /* 0xb932-0xb937 undefined */
+
+ /* 0xb938 unsupported: SORTL - sort lists */
+ /* 0xb939 unsupported: DFLTCC - deflate conversion call */
+ /* 0xb93a unsupported: KDSA - compute dig. signature auth. */
+
+ /* 0xb93b undefined */
case 0xb93c: /* PPNO - perform pseudorandom number operation [partial] */
regcache_raw_read_unsigned (regcache, S390_R1_REGNUM, &tmp);
@@ -5485,6 +5504,13 @@ ex:
/* 0xe3ce undefined */
/* 0xe3d0-0xe3ff undefined */
+ case 0xe601: /* VLEBRH - vector load byte reversed element */
+ case 0xe602: /* VLEBRG - vector load byte reversed element */
+ case 0xe603: /* VLEBRF - vector load byte reversed element */
+ case 0xe604: /* VLLEBRZ - vector load byte rev. el. and zero */
+ case 0xe605: /* VLBRREP - vector load byte rev. el. and replicate */
+ case 0xe606: /* VLBR - vector load byte reversed elements */
+ case 0xe607: /* VLER - vector load elements reversed */
case 0xe634: /* VPKZ - vector pack zoned */
case 0xe635: /* VLRL - vector load rightmost with immed. length */
case 0xe637: /* VLRLR - vector load rightmost with length */
@@ -5547,6 +5573,9 @@ ex:
case 0xe77f: /* VSRAB - vector shift right arithmetic by byte */
case 0xe784: /* VPDI - vector permute doubleword immediate */
case 0xe785: /* VBPERM - vector bit permute */
+ case 0xe786: /* VSLD - vector shift left double by bit */
+ case 0xe787: /* VSRD - vector shift right double by bit */
+ case 0xe78b: /* VSTRS - vector string search */
case 0xe78c: /* VPERM - vector permute */
case 0xe78d: /* VSEL - vector select */
case 0xe78e: /* VFMS - vector fp multiply and subtract */
@@ -5575,10 +5604,10 @@ ex:
case 0xe7bc: /* VGFMA - vector Galois field multiply sum and accumulate */
case 0xe7bd: /* VSBCBI - vector subtract with borrow compute borrow indication */
case 0xe7bf: /* VSBI - vector subtract with borrow indication */
- case 0xe7c0: /* VCLGD - vector convert to logical 64-bit */
- case 0xe7c1: /* VCDLG - vector convert from logical 64-bit */
- case 0xe7c2: /* VCGD - vector convert to fixed 64-bit */
- case 0xe7c3: /* VCDG - vector convert from fixed 64-bit */
+ case 0xe7c0: /* VCLFP - vector fp convert to logical */
+ case 0xe7c1: /* VCFPL - vector fp convert from logical */
+ case 0xe7c2: /* VCSFP - vector fp convert to fixed */
+ case 0xe7c3: /* VCFPS - vector fp convert from fixed */
case 0xe7c4: /* VLDE/VFLL - vector fp load lengthened */
case 0xe7c5: /* VLED/VFLR - vector fp load rounded */
case 0xe7c7: /* VFI - vector load fp integer */
@@ -5629,6 +5658,7 @@ ex:
return -1;
break;
+ case 0xe609: /* VSTEBRH - vector store byte reversed element */
case 0xe709: /* VSTEH - vector store element */
oaddr = s390_record_calc_disp (gdbarch, regcache, inib[3], insn[1], 0);
if (record_full_arch_list_add_mem (oaddr, 2))
@@ -5637,6 +5667,7 @@ ex:
return -1;
break;
+ case 0xe60a: /* VSTEBRG - vector store byte reversed element */
case 0xe70a: /* VSTEG - vector store element */
oaddr = s390_record_calc_disp (gdbarch, regcache, inib[3], insn[1], 0);
if (record_full_arch_list_add_mem (oaddr, 8))
@@ -5645,6 +5676,7 @@ ex:
return -1;
break;
+ case 0xe60b: /* VSTEBRF - vector store byte reversed element */
case 0xe70b: /* VSTEF - vector store element */
oaddr = s390_record_calc_disp (gdbarch, regcache, inib[3], insn[1], 0);
if (record_full_arch_list_add_mem (oaddr, 4))
@@ -5655,6 +5687,8 @@ ex:
/* 0xe70c-0xe70d undefined */
+ case 0xe60e: /* VSTBR - vector store byte reversed elements */
+ case 0xe60f: /* VSTER - vector store elements reversed */
case 0xe70e: /* VST - vector store */
oaddr = s390_record_calc_disp (gdbarch, regcache, inib[3], insn[1], 0);
if (record_full_arch_list_add_mem (oaddr, 16))
@@ -6234,7 +6268,16 @@ ex:
/* SSE/SIL-format instruction */
switch (insn[0])
{
- /* 0xe500-0xe543 undefined, privileged, or unsupported */
+ /* 0xe500-0xe509 undefined, privileged, or unsupported */
+
+ case 0xe50a: /* MVCRL - move right to left */
+ regcache_raw_read_unsigned (regcache, S390_R0_REGNUM, &tmp);
+ oaddr = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], 0);
+ if (record_full_arch_list_add_mem (oaddr, (tmp & 0xff) + 1))
+ return -1;
+ break;
+
+ /* 0xe50b-0xe543 undefined, privileged, or unsupported */
case 0xe544: /* MVHHI - move */
oaddr = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], 0);

View File

@ -1,232 +0,0 @@
[gdb/symtab] Prefer var def over decl
Consider the DWARF as generated by gcc with the tentative patch to fix gcc
PR91507 - "wrong debug for completed array with previous incomplete
declaration":
...
<1><f4>: Abbrev Number: 2 (DW_TAG_array_type)
<f5> DW_AT_type : <0xff>
<f9> DW_AT_sibling : <0xff>
<2><fd>: Abbrev Number: 3 (DW_TAG_subrange_type)
<2><fe>: Abbrev Number: 0
<1><ff>: Abbrev Number: 4 (DW_TAG_pointer_type)
<100> DW_AT_byte_size : 8
<101> DW_AT_type : <0x105>
<1><105>: Abbrev Number: 5 (DW_TAG_base_type)
<106> DW_AT_byte_size : 1
<107> DW_AT_encoding : 6 (signed char)
<108> DW_AT_name : (indirect string, offset: 0x19f): char
<1><10c>: Abbrev Number: 6 (DW_TAG_variable)
<10d> DW_AT_name : zzz
<111> DW_AT_decl_file : 1
<112> DW_AT_decl_line : 1
<113> DW_AT_decl_column : 14
<114> DW_AT_type : <0xf4>
<118> DW_AT_external : 1
<118> DW_AT_declaration : 1
<1><118>: Abbrev Number: 2 (DW_TAG_array_type)
<119> DW_AT_type : <0xff>
<11d> DW_AT_sibling : <0x128>
<1><12f>: Abbrev Number: 8 (DW_TAG_variable)
<130> DW_AT_specification: <0x10c>
<134> DW_AT_decl_line : 2
<135> DW_AT_decl_column : 7
<136> DW_AT_type : <0x118>
<13a> DW_AT_location : 9 byte block: 3 30 10 60 0 0 0 0 0 (DW_OP_addr: 601030)
...
The DWARF will result in two entries in the symbol table, a decl with type
char *[] and a def with type char*[2].
When trying to print the value of zzz:
...
$ gdb a.spec.out -batch -ex "p zzz"
...
the decl (rather than the def) will be found in the symbol table, which is
missing the location information, and consequently we get:
...
$1 = 0x601030 <zzz>
...
[ There is a fallback mechanism that finds the address of the variable in the
minimal symbol table, but that's not used here, because the type of the decl
does not specify a size. We could use the symbol size here to get the size
of the type, but that's currently not done: PR exp/24989. Still, fixing that
PR would not fix the generic case, where minimal symbol info is not
available. ]
Fix this by preferring defs over decls when searching in the symbol table.
Build and reg-tested on x86_64-linux.
[ The test-case is a bit simpler than the DWARF example listed above, because
the new variable varval3 that is used is not listed in the minimal symbols, so
there's no need to work around the fallback mechanism to trigger the problem. ]
gdb/ChangeLog:
2019-09-10 Tom de Vries <tdevries@suse.de>
PR symtab/24971
* block.c (best_symbol, better_symbol): New function.
(block_lookup_symbol_primary): Prefer def over decl.
gdb/testsuite/ChangeLog:
2019-09-10 Tom de Vries <tdevries@suse.de>
* gdb.dwarf2/varval.exp: Add decl before def test.
Change-Id: Id92326cb8ef9903b121ef9e320658eb565d0f5a9
---
gdb/block.c | 68 +++++++++++++++++++++++++++++++++++--
gdb/testsuite/gdb.dwarf2/varval.exp | 28 +++++++++++++--
2 files changed, 92 insertions(+), 4 deletions(-)
diff --git a/gdb/block.c b/gdb/block.c
index 3192b33e9e9..37f9d4f8d21 100644
--- a/gdb/block.c
+++ b/gdb/block.c
@@ -726,6 +726,43 @@ block_lookup_symbol (const struct block *block, const char *name,
}
}
+/* Return true if symbol A is the best match possible for DOMAIN. */
+
+static bool
+best_symbol (struct symbol *a, const domain_enum domain)
+{
+ return (SYMBOL_DOMAIN (a) == domain
+ && SYMBOL_CLASS (a) != LOC_UNRESOLVED);
+}
+
+/* Return symbol B if it is a better match than symbol A for DOMAIN.
+ Otherwise return A. */
+
+static struct symbol *
+better_symbol (struct symbol *a, struct symbol *b, const domain_enum domain)
+{
+ if (a == NULL)
+ return b;
+ if (b == NULL)
+ return a;
+
+ if (SYMBOL_DOMAIN (a) == domain
+ && SYMBOL_DOMAIN (b) != domain)
+ return a;
+ if (SYMBOL_DOMAIN (b) == domain
+ && SYMBOL_DOMAIN (a) != domain)
+ return b;
+
+ if (SYMBOL_CLASS (a) != LOC_UNRESOLVED
+ && SYMBOL_CLASS (b) == LOC_UNRESOLVED)
+ return a;
+ if (SYMBOL_CLASS (b) != LOC_UNRESOLVED
+ && SYMBOL_CLASS (a) == LOC_UNRESOLVED)
+ return b;
+
+ return a;
+}
+
/* See block.h. */
struct symbol *
@@ -747,7 +784,34 @@ block_lookup_symbol_primary (const struct block *block, const char *name,
sym != NULL;
sym = mdict_iter_match_next (lookup_name, &mdict_iter))
{
- if (SYMBOL_DOMAIN (sym) == domain)
+ /* With the fix for PR gcc/debug/91507, we get for:
+ ...
+ extern char *zzz[];
+ char *zzz[ ] = {
+ "abc",
+ "cde"
+ };
+ ...
+ DWARF which will result in two entries in the symbol table, a decl
+ with type char *[] and a def with type char *[2].
+
+ If we return the decl here, we don't get the value of zzz:
+ ...
+ $ gdb a.spec.out -batch -ex "p zzz"
+ $1 = 0x601030 <zzz>
+ ...
+ because we're returning the symbol without location information, and
+ because the fallback that uses the address from the minimal symbols
+ doesn't work either because the type of the decl does not specify a
+ size.
+
+ To fix this, we prefer def over decl in best_symbol and
+ better_symbol.
+
+ In absence of the gcc fix, both def and decl have type char *[], so
+ the only option to make this work is improve the fallback to use the
+ size of the minimal symbol. Filed as PR exp/24989. */
+ if (best_symbol (sym, domain))
return sym;
/* This is a bit of a hack, but symbol_matches_domain might ignore
@@ -756,7 +820,7 @@ block_lookup_symbol_primary (const struct block *block, const char *name,
exactly the same domain. PR 16253. */
if (symbol_matches_domain (SYMBOL_LANGUAGE (sym),
SYMBOL_DOMAIN (sym), domain))
- other = sym;
+ other = better_symbol (other, sym, domain);
}
return other;
diff --git a/gdb/testsuite/gdb.dwarf2/varval.exp b/gdb/testsuite/gdb.dwarf2/varval.exp
index 4711f4a24ae..fa3d90eb3d9 100644
--- a/gdb/testsuite/gdb.dwarf2/varval.exp
+++ b/gdb/testsuite/gdb.dwarf2/varval.exp
@@ -51,7 +51,7 @@ Dwarf::assemble ${asm_file} {
var_b_label var_c_label var_p_label var_bad_label \
varval_label var_s_label var_untyped_label \
var_a_abstract_label var_a_concrete_label \
- varval2_label
+ varval2_label varval3_decl_label varval3_def_label
set int_size [get_sizeof "int" -1]
@@ -165,6 +165,18 @@ Dwarf::assemble ${asm_file} {
{DW_AT_location {DW_OP_addr [gdb_target_symbol "var_b"]} SPECIAL_expr}
}
+ varval3_decl_label: DW_TAG_variable {
+ {DW_AT_name "varval3"}
+ {DW_AT_type :${int_label}}
+ {DW_AT_external 1 DW_FORM_flag}
+ {DW_AT_declaration 1 DW_FORM_flag}
+ }
+ varval3_def_label: DW_TAG_variable {
+ {DW_AT_name "varval3"}
+ {DW_AT_external 1 DW_FORM_flag}
+ {DW_AT_type :${int_label}}
+ {DW_AT_location {DW_OP_addr [gdb_target_symbol "var_a"]} SPECIAL_expr}
+ }
DW_TAG_subprogram {
{MACRO_AT_func { "main" "${srcdir}/${subdir}/${srcfile}" }}
{DW_AT_type :${int_label}}
@@ -274,7 +286,19 @@ if ![runto_main] {
}
gdb_test "print varval" "= 8"
-gdb_test "print varval2" "= 8"
+#gdb_test "print varval2" "= 8"
+set test "print varval2"
+set pass_pattern "= 8"
+set kfail_pattern "value has been optimized out"
+gdb_test_multiple $test "" {
+ -re "\[\r\n\]*(?:$pass_pattern)\[\r\n\]+$gdb_prompt $" {
+ pass $test
+ }
+ -re "\[\r\n\]*(?:$kfail_pattern)\[\r\n\]+$gdb_prompt $" {
+ kfail gdb/24515 $test
+ }
+}
+gdb_test "print varval3" "= 8"
gdb_test "print constval" "= 53"
gdb_test "print mixedval" "= 42"
gdb_test "print pointerval" "= \\(int \\*\\) $hex <var_b>"

View File

@ -1,948 +0,0 @@
- [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,59 +0,0 @@
[gdb/testsuite] Add missing initial prompt read in multidictionary.exp
When running multidictionary.exp in conjunction with:
...
$ stress -c $(($(cat /proc/cpuinfo | grep -c "^processor") + 1))
...
we get:
...
Running gdb/testsuite/gdb.dwarf2/multidictionary.exp ...
ERROR: Couldn't load multidictionary into gdb.
=== gdb Summary ===
nr of unresolved testcases 1
...
The multidictionary test-case needs -readnow, and achieves this using:
...
gdb_spawn_with_cmdline_opts "-readnow"
gdb_load
...
but the initial gdb prompt is not read. Usually, the following gdb_load
command accidentally consumes that initial prompt (at the gdb_expect for the
kill command in gdb_file_cmd). But under high load, that doesn't happen and
we run into the error.
Fix this by consuming the initial gdb prompt after spawning gdb.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2019-07-23 Tom de Vries <tdevries@suse.de>
PR testsuite/24842
* gdb.dwarf2/multidictionary.exp: Consume initial prompt after
gdb_spawn_with_cmdline_opts.
---
gdb/testsuite/gdb.dwarf2/multidictionary.exp | 6 ++++++
2 files changed, 12 insertions(+)
diff --git a/gdb/testsuite/gdb.dwarf2/multidictionary.exp b/gdb/testsuite/gdb.dwarf2/multidictionary.exp
index 5588ef2144..c307ed8adc 100644
--- a/gdb/testsuite/gdb.dwarf2/multidictionary.exp
+++ b/gdb/testsuite/gdb.dwarf2/multidictionary.exp
@@ -148,6 +148,12 @@ if {[build_executable $testfile.exp $testfile [list $asm_file $srcfile] {}] \
# We force the DIEs above to be read in via "-readnow".
gdb_spawn_with_cmdline_opts "-readnow"
+set test "initial prompt"
+gdb_test_multiple "" $test {
+ -re ".*$gdb_prompt $" {
+ pass "$test"
+ }
+}
gdb_load $binfile
# All we need to do is check whether GDB is alive. Without

View File

@ -1,47 +0,0 @@
commit 1512d3b7b9de3a1943623f2e1f373459d5d80a98
Author: Tom de Vries <tdevries@suse.de>
Date: Fri Jul 26 21:49:45 2019 +0200
[gdb/testsuite] Fix unterminated string in i386-pkru.exp
I ran into this error:
...
ERROR: tcl error sourcing gdb/testsuite/gdb.arch/i386-pkru.exp.
ERROR: missing "
while executing
"untested ""
invoked from within
"if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
[list debug additional_flags=${comp_flags}]] } {
untested "failed to c..."
(file "gdb/testsuite/gdb.arch/i386-pkru.exp" line 25)
invoked from within
...
caused by:
...
untested "failed to compile x86 PKEYS test.
...
Fix the unterminated string.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2019-07-26 Tom de Vries <tdevries@suse.de>
* gdb.arch/i386-pkru.exp: Fix unterminated string.
diff --git a/gdb/testsuite/gdb.arch/i386-pkru.exp b/gdb/testsuite/gdb.arch/i386-pkru.exp
index 7a2c65799e..db271522f0 100644
--- a/gdb/testsuite/gdb.arch/i386-pkru.exp
+++ b/gdb/testsuite/gdb.arch/i386-pkru.exp
@@ -24,7 +24,7 @@ set comp_flags "-I${srcdir}/../nat/"
if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
[list debug additional_flags=${comp_flags}]] } {
- untested "failed to compile x86 PKEYS test.
+ untested "failed to compile x86 PKEYS test."
return -1
}

View File

@ -1,397 +0,0 @@
- 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
---------------------------------------------------------
[gdb/testsuite] Fail in gdb_compile if pie results in non-PIE executable
When running gdb.base/break-idempotent.exp with
--target_board=unix/-fno-PIE/-no-pie, we get:
...
nr of expected passes 140
...
The test-case is compiled once with nopie and once with pie, but in both cases
we end up with a non-PIE executable. The "-fno-PIE -no-pie" options specified
using the target_board are interpreted by dejagnu as multilib_flags, and end up
overriding the pie flags.
Fix this by checking in gdb_compile if the resulting exec is non-PIE despite of
a pie setting, and if so return an error:
...
Running gdb/testsuite/gdb.base/break-idempotent.exp ...
gdb compile failed, pie failed to generate PIE executable
=== gdb Summary ===
nr of expected passes 70
nr of untested testcases 1
...
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2019-08-05 Tom de Vries <tdevries@suse.de>
* lib/gdb.exp (version_at_least): Factor out of ...
(tcl_version_at_least): ... here.
(gdb_compile): Fail if pie results in non-PIE executable.
(readelf_version, readelf_prints_pie): New proc.
(exec_is_pie): Return -1 if unknown.
---------------------------------------------------------
[gdb/testsuite] Fail in gdb_compile if nopie results in PIE executable
When running gdb.base/dump.exp with --target_board=unix/-fPIE/-pie, we get:
...
Running gdb/testsuite/gdb.base/dump.exp ...
FAIL: gdb.base/dump.exp: dump array as value, intel hex
...
The FAIL happens because although the test specifies nopie, the exec is
in fact compiled as PIE. The "-fPIE -pie" options specified using the
target_board are interpreted by dejagnu as multilib_flags, and end up
overriding the nopie flags.
Fix this by checking in gdb_compile if the resulting exec is PIE despite of
a nopie setting, and if so return an error:
...
Running gdb/testsuite/gdb.base/dump.exp ...
gdb compile failed, nopie failed to prevent PIE executable
=== gdb Summary ===
nr of untested testcases 1
...
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2019-07-30 Tom de Vries <tdevries@suse.de>
PR testsuite/24834
* lib/gdb.exp (gdb_compile): Fail if nopie results in PIE executable.
(exec_is_pie): New proc.
---------------------------------------------------------
Testsuite: Remove pie from trace tests
Ubuntu/Debian defaults PIE to enabled. This causes the trace tests
to fall over due to variables being returned as "unavailable". The
tests were never designed to work with pie.
Simply ensure the nopie flag is always used for the failing tests.
This removes 100+ failures when running native-gdbserver on Ubuntu 18.04.
gdb/testsuite/ChangeLog:
* gdb.trace/backtrace.exp: Use nopie flag.
* gdb.trace/circ.exp: Likewise.
* gdb.trace/collection.exp: Likewise.
* gdb.trace/ftrace.exp: Likewise.
* gdb.trace/mi-trace-unavailable.exp: Likewise.
* gdb.trace/mi-traceframe-changed.exp: Likewise.
* gdb.trace/qtro.exp: Likewise.
* gdb.trace/read-memory.exp: Likewise.
* gdb.trace/report.exp: Likewise.
* gdb.trace/tfile.exp: Likewise.
* gdb.trace/tfind.exp: Likewise.
* gdb.trace/unavailable.exp: Likewise.
---------------------------------------------------------
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
+++ b/gdb/testsuite/gdb.trace/backtrace.exp
@@ -27,7 +27,7 @@ if ![gdb_trace_common_supports_arch] {
}
if [prepare_for_testing "failed to prepare" $executable $srcfile \
- [list debug nowarnings]] {
+ [list debug nowarnings nopie]] {
return -1
}
diff --git a/gdb/testsuite/gdb.trace/circ.exp b/gdb/testsuite/gdb.trace/circ.exp
index d48eca5deb..30ec9b47fc 100644
--- a/gdb/testsuite/gdb.trace/circ.exp
+++ b/gdb/testsuite/gdb.trace/circ.exp
@@ -17,7 +17,7 @@ load_lib "trace-support.exp"
standard_testfile
-if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug nowarnings}]} {
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug nowarnings nopie}]} {
return -1
}
diff --git a/gdb/testsuite/gdb.trace/collection.exp b/gdb/testsuite/gdb.trace/collection.exp
index 8c064385ba..44eccbe865 100644
--- a/gdb/testsuite/gdb.trace/collection.exp
+++ b/gdb/testsuite/gdb.trace/collection.exp
@@ -19,7 +19,7 @@ load_lib "trace-support.exp"
standard_testfile
set executable $testfile
-if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug nowarnings}]} {
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug nowarnings nopie}]} {
return -1
}
diff --git a/gdb/testsuite/gdb.trace/ftrace.exp b/gdb/testsuite/gdb.trace/ftrace.exp
index f97c2c6193..702efe76bb 100644
--- a/gdb/testsuite/gdb.trace/ftrace.exp
+++ b/gdb/testsuite/gdb.trace/ftrace.exp
@@ -53,7 +53,7 @@ set remote_libipa [gdb_load_shlib $libipa]
# file unused because linking not done" when building the object.
if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
- executable [list debug $additional_flags shlib=$libipa] ] != "" } {
+ executable [list debug nopie $additional_flags shlib=$libipa] ] != "" } {
untested "failed to compile"
return -1
}
diff --git a/gdb/testsuite/gdb.trace/mi-trace-unavailable.exp b/gdb/testsuite/gdb.trace/mi-trace-unavailable.exp
index 5ec4bbc152..f0b3c52728 100644
--- a/gdb/testsuite/gdb.trace/mi-trace-unavailable.exp
+++ b/gdb/testsuite/gdb.trace/mi-trace-unavailable.exp
@@ -17,7 +17,7 @@ load_lib trace-support.exp
standard_testfile trace-unavailable.c
-if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug}] } {
+if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug nopie}] } {
return -1
}
diff --git a/gdb/testsuite/gdb.trace/mi-traceframe-changed.exp b/gdb/testsuite/gdb.trace/mi-traceframe-changed.exp
index 781d3646cb..1244b5b273 100644
--- a/gdb/testsuite/gdb.trace/mi-traceframe-changed.exp
+++ b/gdb/testsuite/gdb.trace/mi-traceframe-changed.exp
@@ -32,7 +32,7 @@ if {![is_remote host] && ![is_remote target]} {
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
executable \
- [list debug nowarnings \
+ [list debug nowarnings nopie\
"additional_flags=-DTFILE_DIR=\"$tfile_dir\""]] \
!= "" } {
untested "failed to compile"
diff --git a/gdb/testsuite/gdb.trace/qtro.exp b/gdb/testsuite/gdb.trace/qtro.exp
index 9eabfeb51e..d5d912b5b9 100644
--- a/gdb/testsuite/gdb.trace/qtro.exp
+++ b/gdb/testsuite/gdb.trace/qtro.exp
@@ -22,7 +22,7 @@ load_lib trace-support.exp
standard_testfile
-if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} {
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug nopie}]} {
return -1
}
clean_restart $testfile
diff --git a/gdb/testsuite/gdb.trace/read-memory.exp b/gdb/testsuite/gdb.trace/read-memory.exp
index 61fc137916..4d19f0074d 100644
--- a/gdb/testsuite/gdb.trace/read-memory.exp
+++ b/gdb/testsuite/gdb.trace/read-memory.exp
@@ -17,7 +17,7 @@ load_lib "trace-support.exp"
standard_testfile
-if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} {
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug nopie}]} {
return -1
}
diff --git a/gdb/testsuite/gdb.trace/report.exp b/gdb/testsuite/gdb.trace/report.exp
index f43fbb7c62..c847ab0c5b 100644
--- a/gdb/testsuite/gdb.trace/report.exp
+++ b/gdb/testsuite/gdb.trace/report.exp
@@ -27,7 +27,7 @@ if ![gdb_trace_common_supports_arch] {
return -1
}
if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
- executable {debug nowarnings}] != "" } {
+ executable {debug nowarnings nopie}] != "" } {
untested "failed to compile"
return -1
}
diff --git a/gdb/testsuite/gdb.trace/tfile.exp b/gdb/testsuite/gdb.trace/tfile.exp
index 04f3e98e99..23f4fc58d0 100644
--- a/gdb/testsuite/gdb.trace/tfile.exp
+++ b/gdb/testsuite/gdb.trace/tfile.exp
@@ -37,7 +37,7 @@ if {![is_remote host] && ![is_remote target]} {
standard_testfile
if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
executable \
- [list debug \
+ [list debug nopie\
"additional_flags=-DTFILE_DIR=\"$tfile_dir\""]] \
!= "" } {
untested "failed to compile"
diff --git a/gdb/testsuite/gdb.trace/tfind.exp b/gdb/testsuite/gdb.trace/tfind.exp
index 2c9996b040..fb58f80196 100644
--- a/gdb/testsuite/gdb.trace/tfind.exp
+++ b/gdb/testsuite/gdb.trace/tfind.exp
@@ -29,7 +29,7 @@ if ![gdb_trace_common_supports_arch] {
}
if { [gdb_compile "$srcdir/$subdir/$srcfile" "$binfile" \
- executable {debug nowarnings}] != "" } {
+ executable {debug nowarnings nopie}] != "" } {
untested "failed to compile"
return -1
}
diff --git a/gdb/testsuite/gdb.trace/unavailable.exp b/gdb/testsuite/gdb.trace/unavailable.exp
index 23d593e7d3..f3bb54db34 100644
--- a/gdb/testsuite/gdb.trace/unavailable.exp
+++ b/gdb/testsuite/gdb.trace/unavailable.exp
@@ -19,7 +19,7 @@ standard_testfile unavailable.cc
set executable $testfile
if {[prepare_for_testing "failed to prepare" $testfile $srcfile \
- {debug nowarnings c++}]} {
+ {debug nowarnings c++ nopie}]} {
return -1
}
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 3d5f8726f7..cf7739aee3 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -3722,6 +3722,12 @@ proc gdb_compile {source dest type options} {
regsub "\[\r\n\]*$" "$result" "" result
regsub "^\[\r\n\]*" "$result" "" result
+ if { $type == "executable" && $result == "" && $nopie != -1 } {
+ if { [exec_is_pie "$dest"] } {
+ set result "nopie failed to prevent PIE executable"
+ }
+ }
+
if {[lsearch $options quiet] < 0} {
# We shall update this on a per language basis, to avoid
# changing the entire testsuite in one go.
@@ -5083,6 +5089,18 @@ proc rerun_to_main {} {
}
}
+# Return true if EXECUTABLE is a Position Independent Executable.
+
+proc exec_is_pie { executable } {
+ set readelf_program [gdb_find_readelf]
+ set res [catch {exec $readelf_program -d $executable \
+ | grep -E "(FLAGS_1).*Flags:.* PIE($| )" }]
+ if { $res == 0 } {
+ return 1
+ }
+ return 0
+}
+
# Return true if a test should be skipped due to lack of floating
# point support or GDB can't fetch the contents from floating point
# registers.
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index cf7739aee3..896e0f1b40 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -1097,6 +1097,18 @@ proc gdb_test { args } {
}]
}
+# Return 1 if version MAJOR.MINOR is at least AT_LEAST_MAJOR.AT_LEAST_MINOR.
+proc version_at_least { major minor at_least_major at_least_minor} {
+ if { $major > $at_least_major } {
+ return 1
+ } elseif { $major == $at_least_major \
+ && $minor >= $at_least_minor } {
+ return 1
+ } else {
+ return 0
+ }
+}
+
# gdb_test_no_output COMMAND MESSAGE
# Send a command to GDB and verify that this command generated no output.
#
@@ -3722,9 +3734,13 @@ proc gdb_compile {source dest type options} {
regsub "\[\r\n\]*$" "$result" "" result
regsub "^\[\r\n\]*" "$result" "" result
- if { $type == "executable" && $result == "" && $nopie != -1 } {
- if { [exec_is_pie "$dest"] } {
+ if { $type == "executable" && $result == "" \
+ && ($nopie != -1 || $pie != -1) } {
+ set is_pie [exec_is_pie "$dest"]
+ if { $nopie != -1 && $is_pie == 1 } {
set result "nopie failed to prevent PIE executable"
+ } elseif { $pie != -1 && $is_pie == 0 } {
+ set result "pie failed to generate PIE executable"
}
}
@@ -5089,13 +5105,53 @@ proc rerun_to_main {} {
}
}
-# Return true if EXECUTABLE is a Position Independent Executable.
+# Return list with major and minor version of readelf, or an empty list.
+gdb_caching_proc readelf_version {
+ set readelf_program [gdb_find_readelf]
+ set res [catch {exec $readelf_program --version} output]
+ if { $res != 0 } {
+ return [list]
+ }
+ set lines [split $output \n]
+ set line [lindex $lines 0]
+ set res [regexp {[ \t]+([0-9]+)[.]([0-9]+)[^ \t]*$} \
+ $line dummy major minor]
+ if { $res != 1 } {
+ return [list]
+ }
+ return [list $major $minor]
+}
+
+# Return 1 if readelf prints the PIE flag, 0 if is doesn't, and -1 if unknown.
+proc readelf_prints_pie { } {
+ set version [readelf_version]
+ if { [llength $version] == 0 } {
+ return -1
+ }
+ set major [lindex $version 0]
+ set minor [lindex $version 1]
+ # It would be better to construct a PIE executable and test if the PIE
+ # flag is printed by readelf, but we cannot reliably construct a PIE
+ # executable if the multilib_flags dictate otherwise
+ # (--target_board=unix/-no-pie/-fno-PIE).
+ return [version_at_least $major $minor 2 26]
+}
+
+# Return 1 if EXECUTABLE is a Position Independent Executable, 0 if it is not,
+# and -1 if unknown.
proc exec_is_pie { executable } {
+ set res [readelf_prints_pie]
+ if { $res != 1 } {
+ return -1
+ }
set readelf_program [gdb_find_readelf]
- set res [catch {exec $readelf_program -d $executable \
- | grep -E "(FLAGS_1).*Flags:.* PIE($| )" }]
- if { $res == 0 } {
+ set res [catch {exec $readelf_program -d $executable} output]
+ if { $res != 0 } {
+ return -1
+ }
+ set res [regexp -line {\(FLAGS_1\).*Flags:.* PIE($| )} $output]
+ if { $res == 1 } {
return 1
}
return 0

View File

@ -1,312 +0,0 @@
- Fix test_gdb_complete_tab_multiple race
- [gdb/testsuite] Don't expect gdb_prompt in mi_skip_python_test
- [gdb/testsuite] Fix gdb.base/maint.exp with check-read1
- [gdb/testsuite] Fix mi-catch-cpp-exceptions.exp and mi-nonstop.exp with check-read1
- [gdb/testsuite] Fix python.exp with check-read1
- [gdb/testsuite, 1/2] Fix gdb.linespec/explicit.exp with check-read1
- [gdb/testsuite, 2/2] Fix gdb.linespec/explicit.exp with check-read1
- [gdb/testsuite] Test skip_libstdcxx_probe_tests in mi-catch-cpp-exceptions.exp
diff --git a/gdb/testsuite/gdb.base/maint.exp b/gdb/testsuite/gdb.base/maint.exp
index 38e9a1ec4b..810c7c9b8c 100644
--- a/gdb/testsuite/gdb.base/maint.exp
+++ b/gdb/testsuite/gdb.base/maint.exp
@@ -69,15 +69,15 @@ set saw_registers 0
set saw_headers 0
set test "maint print registers"
gdb_test_multiple $test $test {
- -re "\[^\r\n\]+Name\[^\r\n\]+Nr\[^\r\n\]+Rel\[^\r\n\]+Offset\[^\r\n\]+Size\[^\r\n\]+Type\[^\r\n\]+\[\r\n\]+" {
+ -re "\[^\r\n\]+Name\[^\r\n\]+Nr\[^\r\n\]+Rel\[^\r\n\]+Offset\[^\r\n\]+Size\[^\r\n\]+Type\[^\r\n\]+\r\n" {
set saw_headers 1
exp_continue
}
- -re "^\[^\r\n\]+\[0-9\]+\[^\r\n\]+\[0-9\]+\[^\r\n\]+\[0-9\]+\[^\r\n\]+\[0-9\]+\[^\r\n\]+\[\r\n\]+" {
+ -re "^\[^\r\n\]+\[0-9\]+\[^\r\n\]+\[0-9\]+\[^\r\n\]+\[0-9\]+\[^\r\n\]+\[0-9\]+\[^\r\n\]+\r\n" {
set saw_registers 1
exp_continue
}
- -re "^\\*\[0-9\]+\[^\r\n\]+\[\r\n\]+" {
+ -re "^\\*\[0-9\]+\[^\r\n\]+\r\n" {
exp_continue
}
-re "$gdb_prompt $" {
diff --git a/gdb/testsuite/gdb.linespec/explicit.exp b/gdb/testsuite/gdb.linespec/explicit.exp
index 11656ca5c5..e50e503343 100644
--- a/gdb/testsuite/gdb.linespec/explicit.exp
+++ b/gdb/testsuite/gdb.linespec/explicit.exp
@@ -241,20 +241,7 @@ namespace eval $testfile {
-re "break -source exp\\\x07licit" {
send_gdb "\t\t"
gdb_test_multiple "" $tst {
- -re "\\\x07\r\nexplicit.c\[ \t\]+explicit2.c\[ \t\]+\r\n$gdb_prompt" {
- send_gdb "\n"
- gdb_test "" \
- {Source filename requires function, label, or line offset.} \
- $tst
- }
- }
- }
-
- -re "break -source exp\\\x07l" {
- # This pattern may occur when glibc debuginfo is installed.
- send_gdb "\t\t"
- gdb_test_multiple "" $tst {
- -re "\\\x07\r\nexplicit.c\[ \t\]+explicit2.c\[ \t\]+expl.*\r\n$gdb_prompt" {
+ -re "\\\x07\r\nexplicit.c\[ \t\]+explicit2.c\[ \t\]+\(expl.*\)?\r\n$gdb_prompt" {
send_gdb "\n"
gdb_test "" \
{Source filename requires function, label, or line offset.} \
@@ -486,7 +473,7 @@ namespace eval $testfile {
send_gdb "break \t"
gdb_test_multiple "" $tst {
"break \\\x07" {
- send_gdb "\t\t"
+ send_gdb "\t"
gdb_test_multiple "" $tst {
"Display all" {
send_gdb "y"
diff --git a/gdb/testsuite/gdb.python/python.exp b/gdb/testsuite/gdb.python/python.exp
index b62572ceb8..f5c1d1b261 100644
--- a/gdb/testsuite/gdb.python/python.exp
+++ b/gdb/testsuite/gdb.python/python.exp
@@ -450,7 +450,7 @@ gdb_py_test_multiple "prompt substitution readline" \
"end" ""
gdb_test_multiple "python gdb.prompt_hook = error_prompt" "set the hook" {
- -re "Python Exception (exceptions.RuntimeError|<(type 'exceptions.|class ')RuntimeError'>) Python exception called.*" {
+ -re "Python Exception (exceptions.RuntimeError|<(type 'exceptions.|class ')RuntimeError'>) Python exception called.*$gdb_prompt $" {
pass "set hook"
}
}
@@ -462,7 +462,7 @@ gdb_py_test_silent_cmd "set python print-stack full" \
"set print-stack full for prompt error test" 1
gdb_test_multiple "python gdb.prompt_hook = error_prompt" "set the hook" {
- -re "Traceback.*File.*line.*RuntimeError.*Python exception called.*" {
+ -re "Traceback.*File.*line.*RuntimeError.*Python exception called.*$gdb_prompt $" {
pass "set hook"
}
}
diff --git a/gdb/testsuite/lib/completion-support.exp b/gdb/testsuite/lib/completion-support.exp
index 3e498d3c63..8a75b0d785 100644
--- a/gdb/testsuite/lib/completion-support.exp
+++ b/gdb/testsuite/lib/completion-support.exp
@@ -144,8 +144,12 @@ proc test_gdb_complete_tab_multiple { input_line add_completed_line \
set maybe_bell ""
}
gdb_test_multiple "" "$test (second tab)" {
- -re "^${maybe_bell}\r\n$expected_re\r\n$gdb_prompt $input_line_re$add_completed_line_re$" {
- pass "$test"
+ -re "^${maybe_bell}\r\n$expected_re\r\n$gdb_prompt " {
+ gdb_test_multiple "" "$test (second tab)" {
+ -re "^$input_line_re$add_completed_line_re$" {
+ pass "$test"
+ }
+ }
}
}
}
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 896e0f1b40..2eb00d58b9 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -695,7 +695,7 @@ proc gdb_internal_error_resync {} {
}
-# gdb_test_multiple COMMAND MESSAGE EXPECT_ARGUMENTS
+# gdb_test_multiple COMMAND MESSAGE EXPECT_ARGUMENTS PROMPT_REGEXP
# Send a command to gdb; test the result.
#
# COMMAND is the command to execute, send to GDB with send_gdb. If
@@ -707,6 +707,8 @@ proc gdb_internal_error_resync {} {
# context; action elements will be executed in the caller's context.
# Unlike patterns for gdb_test, these patterns should generally include
# the final newline and prompt.
+# PROMPT_REGEXP is a regexp matching the expected prompt after the command
+# output. If empty, defaults to "$gdb_prompt $"
#
# Returns:
# 1 if the test failed, according to a built-in failure pattern
@@ -744,7 +746,7 @@ proc gdb_internal_error_resync {} {
# expected from $gdb_spawn_id. IOW, callers do not need to worry
# about resetting "-i" back to $gdb_spawn_id explicitly.
#
-proc gdb_test_multiple { command message user_code } {
+proc gdb_test_multiple { command message user_code { prompt_regexp "" } } {
global verbose use_gdb_stub
global gdb_prompt pagination_prompt
global GDB
@@ -754,6 +756,10 @@ proc gdb_test_multiple { command message user_code } {
upvar expect_out expect_out
global any_spawn_id
+ if { "$prompt_regexp" == "" } {
+ set prompt_regexp "$gdb_prompt $"
+ }
+
if { $message == "" } {
set message $command
}
@@ -913,7 +919,7 @@ proc gdb_test_multiple { command message user_code } {
}
append code {
- -re "Ending remote debugging.*$gdb_prompt $" {
+ -re "Ending remote debugging.*$prompt_regexp" {
if ![isnative] then {
warning "Can`t communicate to remote target."
}
@@ -921,17 +927,17 @@ proc gdb_test_multiple { command message user_code } {
gdb_start
set result -1
}
- -re "Undefined\[a-z\]* command:.*$gdb_prompt $" {
+ -re "Undefined\[a-z\]* command:.*$prompt_regexp" {
perror "Undefined command \"$command\"."
fail "$message"
set result 1
}
- -re "Ambiguous command.*$gdb_prompt $" {
+ -re "Ambiguous command.*$prompt_regexp" {
perror "\"$command\" is not a unique command name."
fail "$message"
set result 1
}
- -re "$inferior_exited_re with code \[0-9\]+.*$gdb_prompt $" {
+ -re "$inferior_exited_re with code \[0-9\]+.*$prompt_regexp" {
if ![string match "" $message] then {
set errmsg "$message (the program exited)"
} else {
@@ -940,7 +946,7 @@ proc gdb_test_multiple { command message user_code } {
fail "$errmsg"
set result -1
}
- -re "$inferior_exited_re normally.*$gdb_prompt $" {
+ -re "$inferior_exited_re normally.*$prompt_regexp" {
if ![string match "" $message] then {
set errmsg "$message (the program exited)"
} else {
@@ -949,7 +955,7 @@ proc gdb_test_multiple { command message user_code } {
fail "$errmsg"
set result -1
}
- -re "The program is not being run.*$gdb_prompt $" {
+ -re "The program is not being run.*$prompt_regexp" {
if ![string match "" $message] then {
set errmsg "$message (the program is no longer running)"
} else {
@@ -958,7 +964,7 @@ proc gdb_test_multiple { command message user_code } {
fail "$errmsg"
set result -1
}
- -re "\r\n$gdb_prompt $" {
+ -re "\r\n$prompt_regexp" {
if ![string match "" $message] then {
fail "$message"
}
@@ -972,13 +978,13 @@ proc gdb_test_multiple { command message user_code } {
}
-re "\\((y or n|y or \\\[n\\\]|\\\[y\\\] or n)\\) " {
send_gdb "n\n"
- gdb_expect -re "$gdb_prompt $"
+ gdb_expect -re "$prompt_regexp"
fail "$message (got interactive prompt)"
set result -1
}
-re "\\\[0\\\] cancel\r\n\\\[1\\\] all.*\r\n> $" {
send_gdb "0\n"
- gdb_expect -re "$gdb_prompt $"
+ gdb_expect -re "$prompt_regexp"
fail "$message (got breakpoint menu)"
set result -1
}
@@ -1842,7 +1848,7 @@ proc skip_python_tests_prompt { prompt_regexp } {
return 1
}
-re "$prompt_regexp" {}
- }
+ } "$prompt_regexp"
set gdb_py_is_py24 0
gdb_test_multiple "python print (sys.version_info\[0\])" "check if python 3" {
@@ -1852,7 +1858,7 @@ proc skip_python_tests_prompt { prompt_regexp } {
-re ".*$prompt_regexp" {
set gdb_py_is_py3k 0
}
- }
+ } "$prompt_regexp"
if { $gdb_py_is_py3k == 0 } {
gdb_test_multiple "python print (sys.version_info\[1\])" "check if python 2.4" {
-re "\[45\].*$prompt_regexp" {
@@ -1861,7 +1867,7 @@ proc skip_python_tests_prompt { prompt_regexp } {
-re ".*$prompt_regexp" {
set gdb_py_is_py24 0
}
- }
+ } "$prompt_regexp"
}
return 0
@@ -3079,22 +3085,27 @@ proc skip_unwinder_tests {} {
# Return 0 if we should skip tests that require the libstdc++ stap
# probes. This must be invoked while gdb is running, after shared
-# libraries have been loaded.
-
-proc skip_libstdcxx_probe_tests {} {
- global gdb_prompt
+# libraries have been loaded. PROMPT_REGEXP is the expected prompt.
+proc skip_libstdcxx_probe_tests_prompt { prompt_regexp } {
set ok 0
gdb_test_multiple "info probe" "check for stap probe in libstdc++" {
- -re ".*libstdcxx.*catch.*\r\n$gdb_prompt $" {
+ -re ".*libstdcxx.*catch.*\r\n$prompt_regexp" {
set ok 1
}
- -re "\r\n$gdb_prompt $" {
+ -re "\r\n$prompt_regexp" {
}
- }
+ } "$prompt_regexp"
return $ok
}
+# As skip_libstdcxx_probe_tests_prompt, with gdb_prompt.
+
+proc skip_libstdcxx_probe_tests {} {
+ global gdb_prompt
+ return [skip_libstdcxx_probe_tests_prompt "$gdb_prompt $"]
+}
+
# Return 1 if we should skip tests of the "compile" feature.
# This must be invoked after the inferior has been started.
@@ -3131,7 +3142,7 @@ proc gdb_is_target_1 { target_name target_stack_regexp prompt_regexp } {
-re "$prompt_regexp" {
pass $test
}
- }
+ } "$prompt_regexp"
return 0
}
diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp
index a58c4f6e11..d0ee5ca744 100644
--- a/gdb/testsuite/lib/mi-support.exp
+++ b/gdb/testsuite/lib/mi-support.exp
@@ -2596,6 +2596,13 @@ proc mi_skip_python_tests {} {
return [skip_python_tests_prompt "$mi_gdb_prompt$"]
}
+# As skip_libstdcxx_probe_tests_prompt, with mi_gdb_prompt.
+
+proc mi_skip_libstdcxx_probe_tests {} {
+ global mi_gdb_prompt
+ return [skip_libstdcxx_probe_tests_prompt "$mi_gdb_prompt$"]
+}
+
# Check whether we're testing with the remote or extended-remote
# targets.

View File

@ -1,46 +0,0 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-testsuite-readline63-sigint.patch
;; [testsuite] Fix false selftest.exp FAIL from system readline-6.3+ (Patrick Palka).
;;=fedoratest
gdb/users/ppalka/readline-7.0-update
commit 379059215e823555a37a8dc7e02cef8fd86566e4
https://sourceware.org/ml/gdb-patches/2015-07/msg00422.html
Message-Id: <1436927724-4059-1-git-send-email-patrick@parcs.ath.cx>
https://bugzilla.redhat.com/show_bug.cgi?id=1301175
diff --git a/gdb/testsuite/gdb.gdb/selftest.exp b/gdb/testsuite/gdb.gdb/selftest.exp
--- a/gdb/testsuite/gdb.gdb/selftest.exp
+++ b/gdb/testsuite/gdb.gdb/selftest.exp
@@ -113,9 +113,25 @@ proc test_with_self { } {
}
set description "send SIGINT signal to child process"
- gdb_test "signal SIGINT" \
- "Continuing with signal SIGINT.*" \
- "$description"
+ gdb_test_multiple "signal SIGINT" "$description" {
+ -re "^signal SIGINT\r\nContinuing with signal SIGINT.\r\nQuit\r\n" {
+ pass "$description"
+ }
+ }
+
+ set description "send ^C to child process again"
+ send_gdb "\003"
+ gdb_expect {
+ -re "(Thread .*|Program) received signal SIGINT.*$gdb_prompt $" {
+ pass "$description"
+ }
+ -re ".*$gdb_prompt $" {
+ fail "$description"
+ }
+ timeout {
+ fail "$description (timeout)"
+ }
+ }
# Switch back to the GDB thread if Guile support is linked in.
# "signal SIGINT" could also switch the current thread.

View File

@ -1,113 +1,8 @@
[gdb/threads] Fix hang in stop_all_threads after killing inferior
Consider a two-threaded testcase a.out, sleeping in both its threads:
...
$ gdb -ex r --args a.out
Reading symbols from a.out...
Starting program: /data/gdb_versions/devel/a.out
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
[New Thread 0x7ffff77fe700 (LWP 31268)]
...
Typing ^C causes stop_all_threads to be executed, and if an external SIGKILL
(such as caused by killall -9 a.out) arrives at the start of stop_all_threads,
gdb hangs in stop_all_threads after giving this warning:
...
warning: unable to open /proc file '/proc/24938/status'
...
Using "set debug infrun 1" we can see in more detail where we hang:
...
infrun: stop_all_threads
infrun: stop_all_threads, pass=0, iterations=0
infrun: Thread 0x7ffff7fa6740 (LWP 10264) not executing
infrun: Thread 0x7ffff77fe700 (LWP 10268) executing, need stop
infrun: target_wait (-1.0.0, status) =
infrun: 10264.10268.0 [Thread 0x7ffff77fe700 (LWP 10268)],
infrun: status->kind = signalled, signal = GDB_SIGNAL_KILL
infrun: stop_all_threads status->kind = signalled, signal = GDB_SIGNAL_KILL \
Thread 0x7ffff77fe700 (LWP 10268)
infrun: Thread 0x7ffff7fa6740 (LWP 10264) not executing
infrun: Thread 0x7ffff77fe700 (LWP 10268) executing, already stopping
warning: unable to open /proc file '/proc/10264/status'
infrun: target_wait (-1.0.0, status) =
infrun: -1.0.0 [process -1],
infrun: status->kind = no-resumed
infrun: infrun_async(0)
infrun: stop_all_threads status->kind = no-resumed process -1
infrun: Thread 0x7ffff7fa6740 (LWP 10264) not executing
infrun: Thread 0x7ffff77fe700 (LWP 10268) executing, already stopping
infrun: stop_all_threads status->kind = no-resumed process -1
infrun: Thread 0x7ffff7fa6740 (LWP 10264) not executing
infrun: Thread 0x7ffff77fe700 (LWP 10268) executing, already stopping
infrun: stop_all_threads status->kind = no-resumed process -1
infrun: Thread 0x7ffff7fa6740 (LWP 10264) not executing
infrun: Thread 0x7ffff77fe700 (LWP 10268) executing, already stopping
<repeat>
......
So, we're hanging in the 'while (1)' loop in stop_all_threads as follows:
- thread t is tested, and both t->executing and t->stop_requested are found
to be 1 (noted with 'executing, already stopping')
- consequently need_wait is set 1
- consequently wait_one is executed
- wait_one returns a TARGET_WAITKIND_NO_RESUMED event, which is handled by
continuing at the start of the loop
The loop actually starts with update_thread_list (), but that doesn't seem
to change the state of the threads.
Fix the hang by:
- detecting the first sign of trouble: the TARGET_WAITKIND_SIGNALLED event
with signal GDB_SIGNAL_KILL,
- making that event pending again,
- making sure the corresponding thread will not set need_wait again
(by setting t->executing == 0)
- making sure that the corresponding thread keeps t->resumed == 1 in the
the all_non_exited_threads loop
This results in the ^C being handled without showing the user that the
test-case was killed:
...
^C
Thread 1 received signal SIGINT, Interrupt.
0x00007ffff78c50f0 in nanosleep () from /lib64/libc.so.6
(gdb)
...
But a subsequent continue does show that:
...
(gdb) c
Continuing.
Program terminated with signal SIGKILL, Killed.
The program no longer exists.
(gdb)
....
Build and reg-tested on x86_64-linux.
gdb/ChangeLog:
2020-01-29 Tom de Vries <tdevries@suse.de>
PR threads/25478
* infrun.c (stop_all_threads): Detecting event
TARGET_WAITKIND_SIGNALLED with signal GDB_SIGNAL_KILL, make event
pending again, set t->executing to 0 and keep t->resumed set to 1.
Change-Id: Ibe1f29251fe2ff1c1991f041babbe18373c113b1
---
gdb/infrun.c | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 9d20036fcf..16e9e136c0 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -4344,7 +4344,12 @@ stop_all_threads (void)
Index: gdb-9.1/gdb/infrun.c
===================================================================
--- gdb-9.1.orig/gdb/infrun.c
+++ gdb-9.1/gdb/infrun.c
@@ -4354,7 +4354,12 @@ stop_all_threads (void)
/* The thread may be not executing, but still be
resumed with a pending status to process. */
@ -121,11 +16,14 @@ index 9d20036fcf..16e9e136c0 100644
}
}
@@ -4359,7 +4364,15 @@ stop_all_threads (void)
@@ -4376,10 +4381,18 @@ stop_all_threads (void)
target_pid_to_str (event_ptid).c_str ());
}
event_ptid = wait_one (&ws);
- if (ws.kind == TARGET_WAITKIND_NO_RESUMED)
- if (ws.kind == TARGET_WAITKIND_NO_RESUMED
- || ws.kind == TARGET_WAITKIND_THREAD_EXITED
- || ws.kind == TARGET_WAITKIND_EXITED
- || ws.kind == TARGET_WAITKIND_SIGNALLED)
+ if (ws.kind == TARGET_WAITKIND_SIGNALLED
+ && ws.value.sig == GDB_SIGNAL_KILL)
+ {
@ -134,7 +32,10 @@ index 9d20036fcf..16e9e136c0 100644
+ t->resumed = 1;
+ t->executing = 0;
+ }
+ else if (ws.kind == TARGET_WAITKIND_NO_RESUMED)
+ else if (ws.kind == TARGET_WAITKIND_NO_RESUMED
+ || ws.kind == TARGET_WAITKIND_THREAD_EXITED
+ || ws.kind == TARGET_WAITKIND_EXITED
+ || ws.kind == TARGET_WAITKIND_SIGNALLED)
{
/* All resumed threads exited. */
}
/* All resumed threads exited
or one thread/process exited/signalled. */

View File

@ -22,7 +22,7 @@ And adjust its testcase.
diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c
--- a/gdb/f-valprint.c
+++ b/gdb/f-valprint.c
@@ -313,8 +313,22 @@ f_val_print (struct type *type, LONGEST embedded_offset,
@@ -319,8 +319,22 @@ f_val_print (struct type *type, int embedded_offset,
original_value, &opts, 0, stream);
}
else

View File

@ -34,162 +34,10 @@ dbfd7140bf4c0500d1f5d192be781f83f78f7922
gdb/value.h | 2 +
23 files changed, 1242 insertions(+), 183 deletions(-)
diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -2429,11 +2429,14 @@ dwarf2_locexpr_baton_eval (const struct dwarf2_locexpr_baton *dlbaton,
/* See dwarf2loc.h. */
int
-dwarf2_evaluate_property (const struct dynamic_prop *prop,
+dwarf2_evaluate_property_signed (const struct dynamic_prop *prop,
struct frame_info *frame,
struct property_addr_info *addr_stack,
- CORE_ADDR *value)
+ CORE_ADDR *value,
+ int is_signed)
{
+ int rc = 0;
+
if (prop == NULL)
return 0;
@@ -2457,7 +2460,7 @@ dwarf2_evaluate_property (const struct dynamic_prop *prop,
*value = value_as_address (val);
}
- return 1;
+ rc = 1;
}
}
break;
@@ -2479,7 +2482,7 @@ dwarf2_evaluate_property (const struct dynamic_prop *prop,
if (!value_optimized_out (val))
{
*value = value_as_address (val);
- return 1;
+ rc = 1;
}
}
}
@@ -2487,8 +2490,8 @@ dwarf2_evaluate_property (const struct dynamic_prop *prop,
case PROP_CONST:
*value = prop->data.const_val;
- return 1;
-
+ rc = 1;
+ break;
case PROP_ADDR_OFFSET:
{
struct dwarf2_property_baton *baton
@@ -2509,11 +2512,38 @@ dwarf2_evaluate_property (const struct dynamic_prop *prop,
val = value_at (baton->offset_info.type,
pinfo->addr + baton->offset_info.offset);
*value = value_as_address (val);
- return 1;
+ rc = 1;
}
+ break;
}
- return 0;
+ if (rc == 1 && is_signed == 1)
+ {
+ /* If we have a valid return candidate and it's value is signed,
+ we have to sign-extend the value because CORE_ADDR on 64bit machine has
+ 8 bytes but address size of an 32bit application is 4 bytes. */
+ struct gdbarch * gdbarch = target_gdbarch ();
+ const int addr_bit = gdbarch_addr_bit (gdbarch);
+ const CORE_ADDR neg_mask = ((~0) << (addr_bit - 1));
+
+ /* Check if signed bit is set and sign-extend values. */
+ if (*value & (neg_mask))
+ *value |= (neg_mask );
+ }
+ return rc;
+}
+
+int
+dwarf2_evaluate_property (const struct dynamic_prop *prop,
+ struct frame_info *frame,
+ struct property_addr_info *addr_stack,
+ CORE_ADDR *value)
+{
+ return dwarf2_evaluate_property_signed (prop,
+ frame,
+ addr_stack,
+ value,
+ 0);
}
/* See dwarf2loc.h. */
diff --git a/gdb/dwarf2loc.h b/gdb/dwarf2loc.h
--- a/gdb/dwarf2loc.h
+++ b/gdb/dwarf2loc.h
@@ -143,6 +143,12 @@ int dwarf2_evaluate_property (const struct dynamic_prop *prop,
struct property_addr_info *addr_stack,
CORE_ADDR *value);
+int dwarf2_evaluate_property_signed (const struct dynamic_prop *prop,
+ struct frame_info *frame,
+ struct property_addr_info *addr_stack,
+ CORE_ADDR *value,
+ int is_signed);
+
/* A helper for the compiler interface that compiles a single dynamic
property to C code.
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -17773,7 +17773,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
struct type *base_type, *orig_base_type;
struct type *range_type;
struct attribute *attr;
- struct dynamic_prop low, high;
+ struct dynamic_prop low, high, stride;
int low_default_is_valid;
int high_bound_is_count = 0;
const char *name;
@@ -17793,7 +17793,9 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
low.kind = PROP_CONST;
high.kind = PROP_CONST;
+ stride.kind = PROP_CONST;
high.data.const_val = 0;
+ stride.data.const_val = 0;
/* Set LOW_DEFAULT_IS_VALID if current language and DWARF version allow
omitting DW_AT_lower_bound. */
@@ -17826,6 +17828,14 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
break;
}
+ attr = dwarf2_attr (die, DW_AT_byte_stride, cu);
+ if (attr)
+ if (!attr_to_dynamic_prop (attr, die, cu, &stride))
+ complaint (_("Missing DW_AT_byte_stride "
+ "- DIE at 0x%s [in module %s]"),
+ sect_offset_str (die->sect_off),
+ objfile_name (cu->per_cu->dwarf2_per_objfile->objfile));
+
attr = dwarf2_attr (die, DW_AT_lower_bound, cu);
if (attr)
attr_to_dynamic_prop (attr, die, cu, &low);
@@ -17918,7 +17928,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
&& !TYPE_UNSIGNED (base_type) && (high.data.const_val & negative_mask))
high.data.const_val |= negative_mask;
- range_type = create_range_type (NULL, orig_base_type, &low, &high);
+ range_type = create_range_type (NULL, orig_base_type, &low, &high, &stride);
if (high_bound_is_count)
TYPE_RANGE_DATA (range_type)->flag_upper_bound_is_count = 1;
diff --git a/gdb/eval.c b/gdb/eval.c
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -377,29 +377,324 @@ init_array_element (struct value *array, struct value *element,
@@ -372,29 +372,324 @@ init_array_element (struct value *array, struct value *element,
return index;
}
@ -533,7 +381,7 @@ diff --git a/gdb/eval.c b/gdb/eval.c
}
@@ -1242,19 +1537,6 @@ evaluate_funcall (type *expect_type, expression *exp, int *pos,
@@ -1235,19 +1530,6 @@ evaluate_funcall (type *expect_type, expression *exp, int *pos,
return eval_call (exp, noside, nargs, argvec, var_func_name, expect_type);
}
@ -553,7 +401,7 @@ diff --git a/gdb/eval.c b/gdb/eval.c
struct value *
evaluate_subexp_standard (struct type *expect_type,
struct expression *exp, int *pos,
@@ -1949,33 +2231,8 @@ evaluate_subexp_standard (struct type *expect_type,
@@ -1942,33 +2224,8 @@ evaluate_subexp_standard (struct type *expect_type,
switch (code)
{
case TYPE_CODE_ARRAY:
@ -588,7 +436,7 @@ diff --git a/gdb/eval.c b/gdb/eval.c
case TYPE_CODE_PTR:
case TYPE_CODE_FUNC:
@@ -2372,49 +2629,6 @@ evaluate_subexp_standard (struct type *expect_type,
@@ -2388,49 +2645,6 @@ evaluate_subexp_standard (struct type *expect_type,
}
return (arg1);
@ -638,7 +486,7 @@ diff --git a/gdb/eval.c b/gdb/eval.c
case BINOP_LOGICAL_AND:
arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
if (noside == EVAL_SKIP)
@@ -3334,6 +3548,9 @@ calc_f77_array_dims (struct type *array_type)
@@ -3350,6 +3564,9 @@ calc_f77_array_dims (struct type *array_type)
int ndimen = 1;
struct type *tmp_type;
@ -651,7 +499,7 @@ diff --git a/gdb/eval.c b/gdb/eval.c
diff --git a/gdb/expprint.c b/gdb/expprint.c
--- a/gdb/expprint.c
+++ b/gdb/expprint.c
@@ -578,17 +578,14 @@ print_subexp_standard (struct expression *exp, int *pos,
@@ -580,17 +580,14 @@ print_subexp_standard (struct expression *exp, int *pos,
longest_to_int (exp->elts[pc + 1].longconst);
*pos += 2;
@ -673,7 +521,7 @@ diff --git a/gdb/expprint.c b/gdb/expprint.c
print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
fputs_filtered (")", stream);
return;
@@ -1105,22 +1102,24 @@ dump_subexp_body_standard (struct expression *exp,
@@ -1107,22 +1104,24 @@ dump_subexp_body_standard (struct expression *exp,
switch (range_type)
{
@ -706,7 +554,7 @@ diff --git a/gdb/expprint.c b/gdb/expprint.c
fputs_filtered ("ExclusiveRange 'EXP..EXP'", stream);
break;
default:
@@ -1128,11 +1127,9 @@ dump_subexp_body_standard (struct expression *exp,
@@ -1130,11 +1129,9 @@ dump_subexp_body_standard (struct expression *exp,
break;
}
@ -723,7 +571,7 @@ diff --git a/gdb/expprint.c b/gdb/expprint.c
diff --git a/gdb/expression.h b/gdb/expression.h
--- a/gdb/expression.h
+++ b/gdb/expression.h
@@ -150,28 +150,27 @@ extern void dump_raw_expression (struct expression *,
@@ -167,28 +167,27 @@ extern void dump_raw_expression (struct expression *,
struct ui_file *, const char *);
extern void dump_prefix_expression (struct expression *, struct ui_file *);
@ -775,12 +623,12 @@ diff --git a/gdb/expression.h b/gdb/expression.h
diff --git a/gdb/f-exp.y b/gdb/f-exp.y
--- a/gdb/f-exp.y
+++ b/gdb/f-exp.y
@@ -257,31 +257,63 @@ arglist : subrange
@@ -282,31 +282,63 @@ arglist : subrange
arglist : arglist ',' exp %prec ABOVE_COMMA
{ arglist_len++; }
{ pstate->arglist_len++; }
+ | arglist ',' subrange %prec ABOVE_COMMA
+ { arglist_len++; }
+ { pstate->arglist_len++; }
;
/* There are four sorts of subrange types in F90. */
@ -847,148 +695,52 @@ diff --git a/gdb/f-exp.y b/gdb/f-exp.y
diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c
--- a/gdb/f-valprint.c
+++ b/gdb/f-valprint.c
@@ -119,8 +119,14 @@ f77_print_array_1 (int nss, int ndimensions, struct type *type,
if (nss != ndimensions)
{
- size_t dim_size = TYPE_LENGTH (TYPE_TARGET_TYPE (type));
+ size_t dim_size;
@@ -129,6 +129,11 @@ f77_print_array_1 (int nss, int ndimensions, struct type *type,
byte_stride = dim_size;
size_t offs = 0;
+ LONGEST byte_stride = abs (TYPE_BYTE_STRIDE (range_type));
+
+ if (byte_stride)
+ dim_size = byte_stride;
+ else
+ dim_size = TYPE_LENGTH (TYPE_TARGET_TYPE (type));
+
for (i = lowerbound;
(i < upperbound + 1 && (*elts) < options->print_max);
i++)
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -911,7 +911,8 @@ operator== (const range_bounds &l, const range_bounds &r)
struct type *
create_range_type (struct type *result_type, struct type *index_type,
const struct dynamic_prop *low_bound,
- const struct dynamic_prop *high_bound)
+ const struct dynamic_prop *high_bound,
+ const struct dynamic_prop *stride)
{
if (result_type == NULL)
result_type = alloc_type_copy (index_type);
@@ -926,6 +927,7 @@ create_range_type (struct type *result_type, struct type *index_type,
TYPE_ZALLOC (result_type, sizeof (struct range_bounds));
TYPE_RANGE_DATA (result_type)->low = *low_bound;
@@ -936,7 +936,7 @@ create_range_type (struct type *result_type, struct type *index_type,
TYPE_RANGE_DATA (result_type)->high = *high_bound;
+ TYPE_RANGE_DATA (result_type)->stride = *stride;
TYPE_RANGE_DATA (result_type)->bias = bias;
if (low_bound->kind == PROP_CONST && low_bound->data.const_val >= 0)
TYPE_UNSIGNED (result_type) = 1;
@@ -954,7 +956,7 @@ struct type *
create_static_range_type (struct type *result_type, struct type *index_type,
LONGEST low_bound, LONGEST high_bound)
{
- struct dynamic_prop low, high;
+ struct dynamic_prop low, high, stride;
- /* Initialize the stride to be a constant, the value will already be zero
+ /* bias the stride to be a constant, the value will already be zero
thanks to the use of TYPE_ZALLOC above. */
TYPE_RANGE_DATA (result_type)->stride.kind = PROP_CONST;
low.kind = PROP_CONST;
low.data.const_val = low_bound;
@@ -962,7 +964,11 @@ create_static_range_type (struct type *result_type, struct type *index_type,
@@ -1001,7 +1001,8 @@ create_static_range_type (struct type *result_type, struct type *index_type,
high.kind = PROP_CONST;
high.data.const_val = high_bound;
- result_type = create_range_type (result_type, index_type, &low, &high);
+ stride.kind = PROP_CONST;
+ stride.data.const_val = 0;
+
- result_type = create_range_type (result_type, index_type, &low, &high, 0);
+ result_type = create_range_type (result_type, index_type,
+ &low, &high, &stride);
+ &low, &high, 0);
return result_type;
}
@@ -1180,16 +1186,20 @@ create_array_type_with_stride (struct type *result_type,
&& (!type_not_associated (result_type)
&& !type_not_allocated (result_type)))
{
- LONGEST low_bound, high_bound;
+ LONGEST low_bound, high_bound, byte_stride;
@@ -1236,6 +1237,7 @@ create_array_type_with_stride (struct type *result_type,
if (get_discrete_bounds (range_type, &low_bound, &high_bound) < 0)
low_bound = high_bound = 0;
element_type = check_typedef (element_type);
+ byte_stride = abs (TYPE_BYTE_STRIDE (range_type));
+
/* Be careful when setting the array length. Ada arrays can be
empty arrays with the high_bound being smaller than the low_bound.
In such cases, the array length should be zero. */
if (high_bound < low_bound)
TYPE_LENGTH (result_type) = 0;
+ else if (byte_stride > 0)
+ TYPE_LENGTH (result_type) = byte_stride * (high_bound - low_bound + 1);
else if (bit_stride > 0)
TYPE_LENGTH (result_type) =
(bit_stride * (high_bound - low_bound + 1) + 7) / 8;
@@ -1990,12 +2000,12 @@ resolve_dynamic_range (struct type *dyn_range_type,
CORE_ADDR value;
struct type *static_range_type, *static_target_type;
const struct dynamic_prop *prop;
- struct dynamic_prop low_bound, high_bound;
+ struct dynamic_prop low_bound, high_bound, stride;
gdb_assert (TYPE_CODE (dyn_range_type) == TYPE_CODE_RANGE);
prop = &TYPE_RANGE_DATA (dyn_range_type)->low;
- if (dwarf2_evaluate_property (prop, NULL, addr_stack, &value))
+ if (dwarf2_evaluate_property_signed (prop, NULL, addr_stack, &value, 1))
{
low_bound.kind = PROP_CONST;
low_bound.data.const_val = value;
@@ -2007,7 +2017,7 @@ resolve_dynamic_range (struct type *dyn_range_type,
}
prop = &TYPE_RANGE_DATA (dyn_range_type)->high;
- if (dwarf2_evaluate_property (prop, NULL, addr_stack, &value))
+ if (dwarf2_evaluate_property_signed (prop, NULL, addr_stack, &value, 1))
{
high_bound.kind = PROP_CONST;
high_bound.data.const_val = value;
@@ -2022,12 +2032,20 @@ resolve_dynamic_range (struct type *dyn_range_type,
high_bound.data.const_val = 0;
}
+ prop = &TYPE_RANGE_DATA (dyn_range_type)->stride;
+ if (dwarf2_evaluate_property_signed (prop, NULL, addr_stack, &value, 1))
+ {
+ stride.kind = PROP_CONST;
+ stride.data.const_val = value;
+ }
+
static_target_type
= resolve_dynamic_type_internal (TYPE_TARGET_TYPE (dyn_range_type),
addr_stack, 0);
static_range_type = create_range_type (copy_type (dyn_range_type),
static_target_type,
- &low_bound, &high_bound);
+ &low_bound, &high_bound, &stride);
+
TYPE_RANGE_DATA (static_range_type)->flag_bound_evaluated = 1;
return static_range_type;
}
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -614,6 +614,10 @@ struct range_bounds
struct dynamic_prop high;
+ /* * Stride of range. */
+
+ struct dynamic_prop stride;
+
/* True if HIGH range bound contains the number of elements in the
subrange. This affects how the final hight bound is computed. */
@@ -778,7 +782,6 @@ struct main_type
@@ -803,7 +803,6 @@ struct main_type
/* * Union member used for range types. */
struct range_bounds *bounds;
@ -996,10 +748,10 @@ diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
} flds_bnds;
/* * Slot to point to additional language-specific fields of this
@@ -1327,6 +1330,15 @@ extern bool set_type_align (struct type *, ULONGEST);
TYPE_RANGE_DATA(range_type)->high.kind
#define TYPE_LOW_BOUND_KIND(range_type) \
TYPE_RANGE_DATA(range_type)->low.kind
@@ -1365,6 +1364,15 @@ extern bool set_type_align (struct type *, ULONGEST);
#define TYPE_BIT_STRIDE(range_type) \
(TYPE_RANGE_DATA(range_type)->stride.data.const_val \
* (TYPE_RANGE_DATA(range_type)->flag_is_byte_stride ? 8 : 1))
+#define TYPE_BYTE_STRIDE(range_type) \
+ TYPE_RANGE_DATA(range_type)->stride.data.const_val
+#define TYPE_BYTE_STRIDE_BLOCK(range_type) \
@ -1012,7 +764,7 @@ diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
/* Property accessors for the type data location. */
#define TYPE_DATA_LOCATION(thistype) \
@@ -1361,6 +1373,9 @@ extern bool set_type_align (struct type *, ULONGEST);
@@ -1400,6 +1408,9 @@ extern bool set_type_align (struct type *, ULONGEST);
TYPE_HIGH_BOUND_UNDEFINED(TYPE_INDEX_TYPE(arraytype))
#define TYPE_ARRAY_LOWER_BOUND_IS_UNDEFINED(arraytype) \
TYPE_LOW_BOUND_UNDEFINED(TYPE_INDEX_TYPE(arraytype))
@ -1022,18 +774,10 @@ diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
#define TYPE_ARRAY_UPPER_BOUND_VALUE(arraytype) \
(TYPE_HIGH_BOUND(TYPE_INDEX_TYPE((arraytype))))
@@ -1896,6 +1911,7 @@ extern struct type *create_array_type_with_stride
struct dynamic_prop *, unsigned int);
extern struct type *create_range_type (struct type *, struct type *,
+ const struct dynamic_prop *,
const struct dynamic_prop *,
const struct dynamic_prop *);
diff --git a/gdb/parse.c b/gdb/parse.c
--- a/gdb/parse.c
+++ b/gdb/parse.c
@@ -989,24 +989,20 @@ operator_length_standard (const struct expression *expr, int endpos,
@@ -919,24 +919,20 @@ operator_length_standard (const struct expression *expr, int endpos,
case OP_RANGE:
oplen = 3;
@ -1072,7 +816,7 @@ diff --git a/gdb/parse.c b/gdb/parse.c
diff --git a/gdb/rust-exp.y b/gdb/rust-exp.y
--- a/gdb/rust-exp.y
+++ b/gdb/rust-exp.y
@@ -2475,24 +2475,28 @@ rust_parser::convert_ast_to_expression (const struct rust_op *operation,
@@ -2492,24 +2492,28 @@ rust_parser::convert_ast_to_expression (const struct rust_op *operation,
case OP_RANGE:
{
@ -1112,7 +856,7 @@ diff --git a/gdb/rust-exp.y b/gdb/rust-exp.y
diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c
--- a/gdb/rust-lang.c
+++ b/gdb/rust-lang.c
@@ -1193,13 +1193,11 @@ rust_range (struct expression *exp, int *pos, enum noside noside)
@@ -1224,13 +1224,11 @@ rust_range (struct expression *exp, int *pos, enum noside noside)
kind = (enum range_type) longest_to_int (exp->elts[*pos + 1].longconst);
*pos += 3;
@ -1129,7 +873,7 @@ diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c
if (noside == EVAL_SKIP)
return value_from_longest (builtin_type (exp->gdbarch)->builtin_int, 1);
@@ -1288,7 +1286,7 @@ rust_compute_range (struct type *type, struct value *range,
@@ -1319,7 +1317,7 @@ rust_compute_range (struct type *type, struct value *range,
*low = 0;
*high = 0;
@ -1138,7 +882,7 @@ diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c
if (TYPE_NFIELDS (type) == 0)
return;
@@ -1296,15 +1294,14 @@ rust_compute_range (struct type *type, struct value *range,
@@ -1327,15 +1325,14 @@ rust_compute_range (struct type *type, struct value *range,
i = 0;
if (strcmp (TYPE_FIELD_NAME (type, 0), "start") == 0)
{
@ -1156,7 +900,7 @@ diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c
*high = value_as_long (value_field (range, i));
if (rust_inclusive_range_type_p (type))
@@ -1322,7 +1319,7 @@ rust_subscript (struct expression *exp, int *pos, enum noside noside,
@@ -1353,7 +1350,7 @@ rust_subscript (struct expression *exp, int *pos, enum noside noside,
struct type *rhstype;
LONGEST low, high_bound;
/* Initialized to appease the compiler. */
@ -1165,7 +909,7 @@ diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c
LONGEST high = 0;
int want_slice = 0;
@@ -1420,7 +1417,7 @@ rust_subscript (struct expression *exp, int *pos, enum noside noside,
@@ -1451,7 +1448,7 @@ rust_subscript (struct expression *exp, int *pos, enum noside noside,
error (_("Cannot subscript non-array type"));
if (want_slice
@ -1174,7 +918,7 @@ diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c
low = low_bound;
if (low < 0)
error (_("Index less than zero"));
@@ -1438,7 +1435,7 @@ rust_subscript (struct expression *exp, int *pos, enum noside noside,
@@ -1469,7 +1466,7 @@ rust_subscript (struct expression *exp, int *pos, enum noside noside,
CORE_ADDR addr;
struct value *addrval, *tem;
@ -1669,33 +1413,53 @@ new file mode 100644
+program testprog
+ call sub
+end
diff --git a/gdb/testsuite/gdb.fortran/vla-ptype.exp b/gdb/testsuite/gdb.fortran/vla-ptype.exp
--- a/gdb/testsuite/gdb.fortran/vla-ptype.exp
+++ b/gdb/testsuite/gdb.fortran/vla-ptype.exp
@@ -98,3 +98,7 @@ gdb_test "ptype vla2" "type = <not allocated>" "ptype vla2 not allocated"
gdb_test "ptype vla2(5, 45, 20)" \
"no such vector element \\\(vector not allocated\\\)" \
"ptype vla2(5, 45, 20) not allocated"
+
+gdb_breakpoint [gdb_get_line_number "vla1-neg-bounds"]
+gdb_continue_to_breakpoint "vla1-neg-bounds"
+gdb_test "ptype vla1" "type = $real \\(-2:1,-5:4,-3:-1\\)" "ptype vla1 negative bounds"
diff --git a/gdb/testsuite/gdb.fortran/vla-sizeof.exp b/gdb/testsuite/gdb.fortran/vla-sizeof.exp
--- a/gdb/testsuite/gdb.fortran/vla-sizeof.exp
+++ b/gdb/testsuite/gdb.fortran/vla-sizeof.exp
@@ -44,3 +44,7 @@ gdb_test "print sizeof(pvla)" " = 0" "print sizeof non-associated pvla"
gdb_breakpoint [gdb_get_line_number "pvla-associated"]
gdb_continue_to_breakpoint "pvla-associated"
@@ -32,7 +32,8 @@ gdb_test "print sizeof(vla1)" " = 0" "print sizeof non-allocated vla1"
gdb_test "print sizeof(vla1(3,2,1))" \
"no such vector element \\(vector not allocated\\)" \
"print sizeof non-allocated indexed vla1"
-gdb_test "print sizeof(vla1(3:4,2,1))" "array not allocated" \
+gdb_test "print sizeof(vla1(3:4,2,1))" \
+ "provided bound\\(s\\) outside array bound\\(s\\)" \
"print sizeof non-allocated sliced vla1"
# Try to access value in allocated VLA
@@ -41,7 +42,7 @@ gdb_continue_to_breakpoint "vla1-allocated"
gdb_test "print sizeof(vla1)" " = 4000" "print sizeof allocated vla1"
gdb_test "print sizeof(vla1(3,2,1))" "4" \
"print sizeof element from allocated vla1"
-gdb_test "print sizeof(vla1(3:4,2,1))" "800" \
+gdb_test "print sizeof(vla1(3:4,2,1))" "8" \
"print sizeof sliced vla1"
# Try to access values in undefined pointer to VLA (dangling)
@@ -49,7 +50,8 @@ gdb_test "print sizeof(pvla)" " = 0" "print sizeof non-associated pvla"
gdb_test "print sizeof(pvla(3,2,1))" \
"no such vector element \\(vector not associated\\)" \
"print sizeof non-associated indexed pvla"
-gdb_test "print sizeof(pvla(3:4,2,1))" "array not associated" \
+gdb_test "print sizeof(pvla(3:4,2,1))" \
+ "provided bound\\(s\\) outside array bound\\(s\\)" \
"print sizeof non-associated sliced pvla"
# Try to access values in pointer to VLA and compare them
@@ -58,7 +60,8 @@ gdb_continue_to_breakpoint "pvla-associated"
gdb_test "print sizeof(pvla)" " = 4000" "print sizeof associated pvla"
gdb_test "print sizeof(pvla(3,2,1))" "4" \
"print sizeof element from associated pvla"
-gdb_test "print sizeof(pvla(3:4,2,1))" "800" "print sizeof sliced pvla"
+
+gdb_breakpoint [gdb_get_line_number "vla1-neg-bounds"]
+gdb_continue_to_breakpoint "vla1-neg-bounds"
+gdb_test "print sizeof(vla1)" " = 480" "print sizeof vla1 negative bounds"
+gdb_test "print sizeof(pvla(3:4,2,1))" "8" "print sizeof sliced pvla"
gdb_breakpoint [gdb_get_line_number "vla1-neg-bounds-v1"]
gdb_continue_to_breakpoint "vla1-neg-bounds-v1"
diff --git a/gdb/testsuite/gdb.fortran/vla-stride.exp b/gdb/testsuite/gdb.fortran/vla-stride.exp
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.fortran/vla-stride.exp
@@ -0,0 +1,44 @@
@@ -0,0 +1,47 @@
+# Copyright 2016 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
@ -1723,6 +1487,9 @@ new file mode 100644
+ continue
+}
+
+gdb_test_no_output "set max-value-size unlimited" \
+ "set max-value-size to unlimited"
+
+gdb_breakpoint [gdb_get_line_number "re-reverse-elements"]
+gdb_continue_to_breakpoint "re-reverse-elements"
+gdb_test "print pvla" " = \\\(1, 2, 3, 4, 5, 6, 7, 8, 9, 10\\\)" \
@ -1774,51 +1541,10 @@ new file mode 100644
+
+ pvla => null() ! single-element
+end program vla_stride
diff --git a/gdb/testsuite/gdb.fortran/vla.f90 b/gdb/testsuite/gdb.fortran/vla.f90
--- a/gdb/testsuite/gdb.fortran/vla.f90
+++ b/gdb/testsuite/gdb.fortran/vla.f90
@@ -54,4 +54,14 @@ program vla
allocate (vla3 (2,2)) ! vla2-deallocated
vla3(:,:) = 13
+
+ allocate (vla1 (-2:1, -5:4, -3:-1))
+ l = allocated(vla1)
+
+ vla1(:, :, :) = 1
+ vla1(-2, -3, -1) = -231
+
+ deallocate (vla1) ! vla1-neg-bounds
+ l = allocated(vla1)
+
end program vla
diff --git a/gdb/valarith.c b/gdb/valarith.c
--- a/gdb/valarith.c
+++ b/gdb/valarith.c
@@ -187,11 +187,17 @@ value_subscripted_rvalue (struct value *array, LONGEST index, int lowerbound)
struct type *array_type = check_typedef (value_type (array));
struct type *elt_type = check_typedef (TYPE_TARGET_TYPE (array_type));
ULONGEST elt_size = type_length_units (elt_type);
- ULONGEST elt_offs = elt_size * (index - lowerbound);
+ LONGEST elt_offs = index - lowerbound;
+ LONGEST elt_stride = TYPE_BYTE_STRIDE (TYPE_INDEX_TYPE (array_type));
+
+ if (elt_stride != 0)
+ elt_offs *= elt_stride;
+ else
+ elt_offs *= elt_size;
if (index < lowerbound
|| (!TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (array_type)
- && elt_offs >= type_length_units (array_type))
+ && abs (elt_offs) >= type_length_units (array_type))
|| (VALUE_LVAL (array) != lval_memory
&& TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (array_type)))
{
diff --git a/gdb/valops.c b/gdb/valops.c
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -3792,56 +3792,195 @@ value_of_this_silent (const struct language_defn *lang)
@@ -3797,13 +3797,42 @@ value_of_this_silent (const struct language_defn *lang)
struct value *
value_slice (struct value *array, int lowbound, int length)
@ -1865,6 +1591,9 @@ diff --git a/gdb/valops.c b/gdb/valops.c
if (TYPE_CODE (array_type) != TYPE_CODE_ARRAY
&& TYPE_CODE (array_type) != TYPE_CODE_STRING)
error (_("cannot take slice of non-array"));
@@ -3813,45 +3842,155 @@ value_slice (struct value *array, int lowbound, int length)
if (type_not_associated (array_type))
error (_("array not associated"));
- range_type = TYPE_INDEX_TYPE (array_type);
- if (get_discrete_bounds (range_type, &lowerbound, &upperbound) < 0)
@ -1932,7 +1661,7 @@ diff --git a/gdb/valops.c b/gdb/valops.c
/* FIXME-type-allocation: need a way to free this type when we are
- done with it. */
- slice_range_type = create_static_range_type ((struct type *) NULL,
- slice_range_type = create_static_range_type (NULL,
- TYPE_TARGET_TYPE (range_type),
- lowbound,
- lowbound + length - 1);
@ -1954,7 +1683,7 @@ diff --git a/gdb/valops.c b/gdb/valops.c
+
+ slice_type = create_array_type (NULL, element_type, slice_range_type);
- slice_type = create_array_type ((struct type *) NULL,
- slice_type = create_array_type (NULL,
- element_type,
- slice_range_type);
- TYPE_CODE (slice_type) = TYPE_CODE (array_type);
@ -2047,7 +1776,7 @@ diff --git a/gdb/valops.c b/gdb/valops.c
diff --git a/gdb/value.h b/gdb/value.h
--- a/gdb/value.h
+++ b/gdb/value.h
@@ -1139,6 +1139,8 @@ extern struct value *varying_to_slice (struct value *);
@@ -1145,6 +1145,8 @@ extern struct value *varying_to_slice (struct value *);
extern struct value *value_slice (struct value *, int, int);

File diff suppressed because it is too large Load Diff

View File

@ -30,15 +30,7 @@ Jan
diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -42,6 +42,7 @@
#include <algorithm>
#include <vector>
#include <unordered_set>
+#include <functional>
#include "common/underlying.h"
#include "common/byte-vector.h"
@@ -2158,6 +2159,20 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame,
@@ -2154,6 +2154,20 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame,
ctx.per_cu = per_cu;
ctx.obj_address = 0;

View File

@ -5,6 +5,25 @@ Subject: gdb-vla-intel-tests.patch
;;=fedoratest
diff --git a/gdb/testsuite/gdb.fortran/ptr-indentation.exp b/gdb/testsuite/gdb.fortran/ptr-indentation.exp
--- a/gdb/testsuite/gdb.fortran/ptr-indentation.exp
+++ b/gdb/testsuite/gdb.fortran/ptr-indentation.exp
@@ -37,5 +37,5 @@ gdb_continue_to_breakpoint "BP1"
gdb_test "ptype tinsta" \
[multi_line "type = Type tuserdef" \
" $int :: i" \
- " PTR TO -> \\( $real :: ptr \\)" \
+ " PTR TO -> \\( $real :: ptr\\)" \
"End Type tuserdef"]
diff --git a/gdb/testsuite/gdb.fortran/ptype-on-functions.exp b/gdb/testsuite/gdb.fortran/ptype-on-functions.exp
--- a/gdb/testsuite/gdb.fortran/ptype-on-functions.exp
+++ b/gdb/testsuite/gdb.fortran/ptype-on-functions.exp
@@ -42,4 +42,4 @@ gdb_test "ptype say_numbers" \
"type = void \\(integer\\(kind=4\\), integer\\(kind=4\\), integer\\(kind=4\\)\\)"
gdb_test "ptype fun_ptr" \
- "type = PTR TO -> \\( integer\\(kind=4\\) \\(\\) \\(REF TO -> \\( integer\\(kind=4\\) \\)\\) \\)"
+ "type = PTR TO -> \\( integer\\(kind=4\\) \\(\\) \\(REF TO -> \\( integer\\(kind=4\\)\\)\\)\\)"
diff --git a/gdb/testsuite/gdb.fortran/vla-func.exp b/gdb/testsuite/gdb.fortran/vla-func.exp
new file mode 100644
--- /dev/null
@ -42,7 +61,7 @@ new file mode 100644
+gdb_continue_to_breakpoint "func1-vla-passed"
+gdb_test "print vla" " = \\( *\\( *22, *22, *22,\[()22, .\]*\\)" \
+ "print vla (func1)"
+gdb_test "ptype vla" "type = integer\\\(kind=4\\\) \\\(10,10\\\)" \
+gdb_test "ptype vla" "type = integer\\\(kind=4\\\), allocatable \\\(10,10\\\)" \
+ "ptype vla (func1)"
+
+gdb_breakpoint [gdb_get_line_number "func1-vla-modified"]
@ -69,7 +88,7 @@ new file mode 100644
+gdb_continue_to_breakpoint "func2-returned"
+gdb_test "print vla3" " = \\\(1, 2, 44, 4, 44, 44, 44, 8, 44, 44\\\)" \
+ "print vla3 (after func2)"
+gdb_test "ptype vla3" "type = integer\\\(kind=4\\\) \\\(10\\\)" \
+gdb_test "ptype vla3" "type = integer\\\(kind=4\\\), allocatable \\\(10\\\)" \
+ "ptype vla3 (after func2)"
diff --git a/gdb/testsuite/gdb.fortran/vla-func.f90 b/gdb/testsuite/gdb.fortran/vla-func.f90
new file mode 100644
@ -147,6 +166,16 @@ new file mode 100644
+
+ ret = .TRUE. ! func2-returned
+end program vla_func
diff --git a/gdb/testsuite/gdb.fortran/vla-ptr-info.exp b/gdb/testsuite/gdb.fortran/vla-ptr-info.exp
--- a/gdb/testsuite/gdb.fortran/vla-ptr-info.exp
+++ b/gdb/testsuite/gdb.fortran/vla-ptr-info.exp
@@ -28,5 +28,5 @@ if ![runto_main] {
# Check the status of a pointer to a dynamic array.
gdb_breakpoint [gdb_get_line_number "pvla-associated"]
gdb_continue_to_breakpoint "pvla-associated"
-gdb_test "print &pvla" " = \\(PTR TO -> \\( real\\(kind=4\\) \\(10,10,10\\) \\)\\) ${hex}" \
+gdb_test "print &pvla" " = \\(PTR TO -> \\( real\\(kind=4\\) \\(10,10,10\\)\\)\\) ${hex}" \
"print pvla pointer information"
diff --git a/gdb/testsuite/gdb.fortran/vla-stringsold.exp b/gdb/testsuite/gdb.fortran/vla-stringsold.exp
new file mode 100644
--- /dev/null
@ -298,3 +327,21 @@ new file mode 100644
+ var_char_p => null()
+ l = associated(var_char_p) ! var_char_p-not-associated
+end program vla_strings
diff --git a/gdb/testsuite/gdb.fortran/whatis_type.exp b/gdb/testsuite/gdb.fortran/whatis_type.exp
--- a/gdb/testsuite/gdb.fortran/whatis_type.exp
+++ b/gdb/testsuite/gdb.fortran/whatis_type.exp
@@ -44,7 +44,7 @@ gdb_test "whatis t2" "type = Type t2"
gdb_test "whatis t2v" "type = Type t2"
gdb_test "whatis t3" "type = Type t3"
gdb_test "whatis t3v" "type = Type t3"
-gdb_test "whatis t3p" "type = PTR TO -> \\( Type t3 \\)"
+gdb_test "whatis t3p" "type = PTR TO -> \\( Type t3\\)"
gdb_test "ptype t1" \
[multi_line "type = Type t1" \
@@ -73,4 +73,4 @@ gdb_test "ptype t3p" \
[multi_line "type = PTR TO -> \\( Type t3" \
" $int :: t3_i" \
" Type t2 :: t2_n" \
- "End Type t3 \\)"]
+ "End Type t3\\)"]

View File

@ -1,3 +1,104 @@
-------------------------------------------------------------------
Tue Jul 14 14:33:12 UTC 2020 - Tom de Vries <tdevries@suse.com>
- Fix SLE-11 build. Gdb 9.1 requires make 3.82, but SLE-11 has
make 3.81:
* gdbserver-fix-build-with-make-3.81.patch
-------------------------------------------------------------------
Tue Jul 14 08:31:27 UTC 2020 - Tom de Vries <tdevries@suse.com>
- Fix patch context:
* gdb-fix-the-thread-pool.c-compilation.patch
-------------------------------------------------------------------
Mon Jul 13 22:13:07 UTC 2020 - Tom de Vries <tdevries@suse.com>
- Fix build error due to missing DIAGNOSTIC_IGNORE_UNUSED_FUNCTION.
* gdb-fix-the-thread-pool.c-compilation.patch
-------------------------------------------------------------------
Mon Jul 13 15:36:16 UTC 2020 - Tom de Vries <tdevries@suse.com>
- Drop ChangeLog part of patch:
* gdb-fix-unused-function-error.patch
-------------------------------------------------------------------
Mon Jul 13 15:24:53 UTC 2020 - Tom de Vries <tdevries@suse.com>
- Fix Werror=unused-function with gcc 4.8 (for Leap 42.3).
* gdb-fix-unused-function-error.patch
-------------------------------------------------------------------
Mon Jul 13 13:56:50 UTC 2020 - Tom de Vries <tdevries@suse.com>
- Require %{suse_version} >= 1500 for --with-system-readline.
-------------------------------------------------------------------
Mon Jul 13 12:21:04 UTC 2020 - Tom de Vries <tdevries@suse.com>
- Rebase to 9.1 release (as in fedora 32 @ 1735910).
* Breakpoints on nested functions and subroutines in Fortran.
* Multithreaded symbol loading, disabled by default. Enable
using 'maint set worker-threads unlimited'.
* Multi-target debugging support.
* New command pipe.
* New command set logging debugredirect [on|off].
* New fortran commands info modules, info module functions,
info module variables.
- Fedora-specific patches dropped:
* gdb-libexec-add-index.patch
* gdb-6.3-rh-testversion-20041202.patch
* gdb-6.6-buildid-locate-misleading-warning-missing-debuginfo-rhbz981154.patch
- Obsoleted fedora patches dropped:
* gdb-6.5-bz216711-clone-is-outermost.patch
* gdb-6.6-scheduler_locking-step-is-default.patch
* gdb-6.8-bz436037-reg-no-longer-active.patch
* gdb-bz541866-rwatch-before-run.patch
* gdb-bz568248-oom-is-error.patch
* gdb-follow-child-stale-parent.patch
* gdb-readline62-ask-more-rh.patch
* gdb-rhbz1371380-gcore-elf-headers.patch
* gdb-rhbz1553086-binutils-warning-loadable-section-outside-elf.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-rhbz1708192-parse_macro_definition-crash.patch
* gdb-rhbz1723564-gdb-crash-PYTHONMALLOC-debug.patch
* gdb-rhbz795424-bitpos-20of25.patch
* gdb-rhbz795424-bitpos-21of25.patch
* gdb-rhbz795424-bitpos-22of25.patch
* gdb-rhbz795424-bitpos-23of25.patch
* gdb-rhbz795424-bitpos-25of25-test.patch
* gdb-rhbz795424-bitpos-25of25.patch
* gdb-rhbz795424-bitpos-arrayview.patch
* gdb-rhbz795424-bitpos-lazyvalue.patch
* gdb-testsuite-readline63-sigint.patch
- Fedora patches added:
* gdb-rhbz1818011-bfd-gcc10-error.patch
- Obsoleted patched dropped:
* gdb-fix-s390-build.diff
* gdb-fix-riscv-tdep.patch
* gdb-testsuite-add-missing-initial-prompt-read-in-multidictionary.exp.patch
* gdb-testsuite-pie-no-pie.patch
* gdb-testsuite-read1-fixes.patch
* gdb-testsuite-i386-pkru-exp.patch
* gdb-s390-handle-arch13.diff
* gdb-fix-heap-use-after-free-in-typename-concat.patch
* gdb-dwarf-reader-reject-sections-with-invalid-sizes.patch
* gdb-0001-remove-alloca-0-calls.patch
* gdb-arch13-1.diff
* gdb-arch13-2.diff
* gdb-arch13-3.diff
* bfd-change-num_group-to-unsigned-int.patch
* gdb-fix-incorrect-use-of-is-operator-for-comparison-in-python-lib-gdb-command-prompt.py.patch
* gdb-symtab-prefer-var-def-over-decl.patch
* gdb-only-force-interp_console-ui_out-for-breakpoint-commands-in-mi-mode.patch
* gdb-testsuite-8.3-kfail-xfail-unsupported.patch
- Backport from master:
* gdb-fix-debug-agent-odr-bool-int.patch
* gdb-fix-python3.9-related-runtime-problems.patch
-------------------------------------------------------------------
Wed May 6 03:46:31 UTC 2020 - Tom de Vries <tdevries@suse.com>

275
gdb.spec
View File

@ -29,7 +29,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.1
Version: 9.1
Release: 0
# The release always contains a leading reserved number, start it at 1.
@ -98,7 +98,6 @@ Source12: baselibs.conf
Source13: gdb-rpmlintrc
#Fedora Packages begin
Patch1: gdb-6.3-rh-testversion-20041202.patch
Patch2: gdb-vla-intel-fortran-strides.patch
Patch3: gdb-vla-intel-fortran-vla-strings.patch
Patch4: gdb-vla-intel-stringbt-fix.patch
@ -115,111 +114,92 @@ Patch14: gdb-6.5-sharedlibrary-path.patch
Patch15: gdb-6.5-BEA-testsuite.patch
Patch16: gdb-6.5-last-address-space-byte-test.patch
Patch17: gdb-6.5-readline-long-line-crash-test.patch
Patch18: gdb-6.5-bz216711-clone-is-outermost.patch
Patch19: gdb-6.5-bz218379-ppc-solib-trampoline-test.patch
Patch20: gdb-6.5-bz218379-solib-trampoline-lookup-lock-fix.patch
Patch21: gdb-6.5-bz109921-DW_AT_decl_file-test.patch
Patch22: gdb-6.3-bz140532-ppc-unwinding-test.patch
Patch23: gdb-6.3-bz202689-exec-from-pthread-test.patch
Patch24: gdb-6.6-bz230000-power6-disassembly-test.patch
Patch25: gdb-6.6-bz229517-gcore-without-terminal.patch
Patch26: gdb-6.6-testsuite-timeouts.patch
Patch27: gdb-6.6-bz237572-ppc-atomic-sequence-test.patch
Patch28: gdb-6.6-scheduler_locking-step-is-default.patch
Patch29: gdb-6.3-attach-see-vdso-test.patch
Patch30: gdb-6.5-bz243845-stale-testing-zombie-test.patch
Patch31: gdb-6.6-buildid-locate.patch
Patch32: gdb-6.6-buildid-locate-solib-missing-ids.patch
Patch33: gdb-6.6-buildid-locate-rpm.patch
Patch34: gdb-6.7-charsign-test.patch
Patch35: gdb-6.7-ppc-clobbered-registers-O2-test.patch
Patch36: gdb-6.7-testsuite-stable-results.patch
Patch37: gdb-6.5-ia64-libunwind-leak-test.patch
Patch38: gdb-6.5-missed-trap-on-step-test.patch
Patch39: gdb-6.5-gcore-buffer-limit-test.patch
Patch40: gdb-6.3-mapping-zero-inode-test.patch
Patch41: gdb-6.3-focus-cmd-prev-test.patch
Patch42: gdb-6.8-bz442765-threaded-exec-test.patch
Patch43: gdb-6.5-section-num-fixup-test.patch
Patch44: gdb-6.8-bz436037-reg-no-longer-active.patch
Patch45: gdb-6.8-bz466901-backtrace-full-prelinked.patch
Patch46: gdb-simultaneous-step-resume-breakpoint-test.patch
Patch47: gdb-core-open-vdso-warning.patch
Patch49: gdb-bz533176-fortran-omp-step.patch
Patch50: gdb-follow-child-stale-parent.patch
Patch51: gdb-ccache-workaround.patch
Patch52: gdb-archer-pie-addons.patch
Patch53: gdb-archer-pie-addons-keep-disabled.patch
Patch54: gdb-lineno-makeup-test.patch
Patch55: gdb-ppc-power7-test.patch
Patch56: gdb-bz541866-rwatch-before-run.patch
Patch57: gdb-moribund-utrace-workaround.patch
Patch58: gdb-archer-next-over-throw-cxx-exec.patch
Patch59: gdb-bz601887-dwarf4-rh-test.patch
Patch60: gdb-6.6-buildid-locate-core-as-arg.patch
Patch61: gdb-6.6-buildid-locate-rpm-librpm-workaround.patch
Patch62: gdb-test-bt-cfi-without-die.patch
Patch63: gdb-bz568248-oom-is-error.patch
Patch64: gdb-bz634108-solib_address.patch
Patch65: gdb-test-pid0-core.patch
Patch66: gdb-test-dw2-aranges.patch
Patch67: gdb-test-expr-cumulative-archer.patch
Patch68: gdb-physname-pr11734-test.patch
Patch69: gdb-physname-pr12273-test.patch
Patch70: gdb-test-ivy-bridge.patch
Patch71: gdb-runtest-pie-override.patch
Patch72: gdb-attach-fail-reasons-5of5.patch
Patch73: gdb-glibc-strstr-workaround.patch
Patch74: gdb-rhel5.9-testcase-xlf-var-inside-mod.patch
Patch75: gdb-rhbz-818343-set-solib-absolute-prefix-testcase.patch
Patch76: gdb-rhbz795424-bitpos-20of25.patch
Patch77: gdb-rhbz795424-bitpos-21of25.patch
Patch78: gdb-rhbz795424-bitpos-22of25.patch
Patch79: gdb-rhbz795424-bitpos-23of25.patch
Patch80: gdb-rhbz795424-bitpos-25of25.patch
Patch81: gdb-rhbz795424-bitpos-25of25-test.patch
Patch82: gdb-rhbz795424-bitpos-lazyvalue.patch
Patch83: gdb-rhbz947564-findvar-assertion-frame-failed-testcase.patch
Patch84: gdb-gnat-dwarf-crash-3of3.patch
Patch85: gdb-rhbz1007614-memleak-infpy_read_memory-test.patch
Patch86: gdb-6.6-buildid-locate-misleading-warning-missing-debuginfo-rhbz981154.patch
Patch87: gdb-archer-vla-tests.patch
Patch88: gdb-vla-intel-tests.patch
Patch89: gdb-btrobust.patch
Patch90: gdb-fortran-frame-string.patch
Patch91: gdb-rhbz1156192-recursive-dlopen-test.patch
Patch92: gdb-jit-reader-multilib.patch
Patch93: gdb-rhbz1149205-catch-syscall-after-fork-test.patch
Patch94: gdb-rhbz1186476-internal-error-unqualified-name-re-set-test.patch
Patch95: gdb-rhbz1350436-type-printers-error.patch
Patch96: gdb-rhbz1084404-ppc64-s390x-wrong-prologue-skip-O2-g-3of3.patch
Patch97: gdb-bz1219747-attach-kills.patch
Patch98: gdb-fedora-libncursesw.patch
Patch99: gdb-opcodes-clflushopt-test.patch
Patch100: gdb-dts-rhel6-python-compat.patch
Patch101: gdb-6.6-buildid-locate-rpm-scl.patch
Patch102: gdb-readline62-ask-more-rh.patch
Patch103: gdb-6.8-quit-never-aborts.patch
Patch104: gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch
Patch105: gdb-container-rh-pkg.patch
Patch106: gdb-rhbz1325795-framefilters-test.patch
Patch107: gdb-linux_perf-bundle.patch
Patch108: gdb-libexec-add-index.patch
Patch109: gdb-rhbz1398387-tab-crash-test.patch
Patch110: gdb-testsuite-readline63-sigint.patch
Patch111: gdb-archer.patch
Patch112: gdb-vla-intel-fix-print-char-array.patch
Patch113: gdb-rhbz1553104-s390x-arch12-test.patch
Patch114: gdb-rhbz795424-bitpos-arrayview.patch
Patch115: gdb-rhbz1371380-gcore-elf-headers.patch
Patch116: gdb-rhbz1708192-parse_macro_definition-crash.patch
Patch117: gdb-rhbz1704406-disable-style-log-output-1of3.patch
Patch118: gdb-rhbz1704406-disable-style-log-output-2of3.patch
Patch119: gdb-rhbz1704406-disable-style-log-output-3of3.patch
Patch120: gdb-rhbz1723564-gdb-crash-PYTHONMALLOC-debug.patch
Patch121: gdb-rhbz1553086-binutils-warning-loadable-section-outside-elf.patch
Patch18: gdb-6.5-bz218379-ppc-solib-trampoline-test.patch
Patch19: gdb-6.5-bz218379-solib-trampoline-lookup-lock-fix.patch
Patch20: gdb-6.5-bz109921-DW_AT_decl_file-test.patch
Patch21: gdb-6.3-bz140532-ppc-unwinding-test.patch
Patch22: gdb-6.3-bz202689-exec-from-pthread-test.patch
Patch23: gdb-6.6-bz230000-power6-disassembly-test.patch
Patch24: gdb-6.6-bz229517-gcore-without-terminal.patch
Patch25: gdb-6.6-testsuite-timeouts.patch
Patch26: gdb-6.6-bz237572-ppc-atomic-sequence-test.patch
Patch27: gdb-6.3-attach-see-vdso-test.patch
Patch28: gdb-6.5-bz243845-stale-testing-zombie-test.patch
Patch29: gdb-6.6-buildid-locate.patch
Patch30: gdb-6.6-buildid-locate-solib-missing-ids.patch
Patch31: gdb-6.6-buildid-locate-rpm.patch
Patch32: gdb-6.7-charsign-test.patch
Patch33: gdb-6.7-ppc-clobbered-registers-O2-test.patch
Patch34: gdb-6.7-testsuite-stable-results.patch
Patch35: gdb-6.5-ia64-libunwind-leak-test.patch
Patch36: gdb-6.5-missed-trap-on-step-test.patch
Patch37: gdb-6.5-gcore-buffer-limit-test.patch
Patch38: gdb-6.3-mapping-zero-inode-test.patch
Patch39: gdb-6.3-focus-cmd-prev-test.patch
Patch40: gdb-6.8-bz442765-threaded-exec-test.patch
Patch41: gdb-6.5-section-num-fixup-test.patch
Patch42: gdb-6.8-bz466901-backtrace-full-prelinked.patch
Patch43: gdb-simultaneous-step-resume-breakpoint-test.patch
Patch44: gdb-core-open-vdso-warning.patch
Patch45: gdb-bz533176-fortran-omp-step.patch
Patch46: gdb-ccache-workaround.patch
Patch47: gdb-archer-pie-addons.patch
Patch48: gdb-archer-pie-addons-keep-disabled.patch
Patch49: gdb-lineno-makeup-test.patch
Patch50: gdb-ppc-power7-test.patch
Patch51: gdb-moribund-utrace-workaround.patch
Patch52: gdb-archer-next-over-throw-cxx-exec.patch
Patch53: gdb-bz601887-dwarf4-rh-test.patch
Patch54: gdb-6.6-buildid-locate-core-as-arg.patch
Patch55: gdb-6.6-buildid-locate-rpm-librpm-workaround.patch
Patch56: gdb-test-bt-cfi-without-die.patch
Patch57: gdb-bz634108-solib_address.patch
Patch58: gdb-test-pid0-core.patch
Patch59: gdb-test-dw2-aranges.patch
Patch60: gdb-test-expr-cumulative-archer.patch
Patch61: gdb-physname-pr11734-test.patch
Patch62: gdb-physname-pr12273-test.patch
Patch63: gdb-test-ivy-bridge.patch
Patch64: gdb-runtest-pie-override.patch
Patch65: gdb-attach-fail-reasons-5of5.patch
Patch66: gdb-glibc-strstr-workaround.patch
Patch67: gdb-rhel5.9-testcase-xlf-var-inside-mod.patch
Patch68: gdb-rhbz-818343-set-solib-absolute-prefix-testcase.patch
Patch69: gdb-rhbz947564-findvar-assertion-frame-failed-testcase.patch
Patch70: gdb-gnat-dwarf-crash-3of3.patch
Patch71: gdb-rhbz1007614-memleak-infpy_read_memory-test.patch
Patch73: gdb-archer-vla-tests.patch
Patch74: gdb-vla-intel-tests.patch
Patch75: gdb-btrobust.patch
Patch76: gdb-fortran-frame-string.patch
Patch77: gdb-rhbz1156192-recursive-dlopen-test.patch
Patch78: gdb-jit-reader-multilib.patch
Patch79: gdb-rhbz1149205-catch-syscall-after-fork-test.patch
Patch80: gdb-rhbz1186476-internal-error-unqualified-name-re-set-test.patch
Patch81: gdb-rhbz1350436-type-printers-error.patch
Patch82: gdb-rhbz1084404-ppc64-s390x-wrong-prologue-skip-O2-g-3of3.patch
Patch83: gdb-bz1219747-attach-kills.patch
Patch84: gdb-fedora-libncursesw.patch
Patch85: gdb-opcodes-clflushopt-test.patch
Patch86: gdb-dts-rhel6-python-compat.patch
Patch87: gdb-6.6-buildid-locate-rpm-scl.patch
Patch88: gdb-6.8-quit-never-aborts.patch
Patch89: gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch
Patch90: gdb-container-rh-pkg.patch
Patch91: gdb-rhbz1325795-framefilters-test.patch
Patch92: gdb-linux_perf-bundle.patch
Patch94: gdb-rhbz1398387-tab-crash-test.patch
Patch95: gdb-archer.patch
Patch96: gdb-vla-intel-fix-print-char-array.patch
Patch97: gdb-rhbz1553104-s390x-arch12-test.patch
Patch98: gdb-rhbz1818011-bfd-gcc10-error.patch
#Fedora Packages end
# Fedora Packages not copied:
# - gdb-libexec-add-index.patch
# - gdb-6.3-rh-testversion-20041202.patch
# - gdb-6.6-buildid-locate-misleading-warning-missing-debuginfo-rhbz981154.patch
# Fedora patches fixup
Patch500: gdb-testsuite-avoid-pagination-in-attach-32.exp.patch
@ -232,41 +212,23 @@ Patch1002: gdb-6.6-buildid-locate-rpm-suse.patch
Patch1003: gdb-testsuite-ada-pie.patch
# Patches to upstream
# 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
Patch1500: gdb-fix-debug-agent-odr-bool-int.patch
Patch1501: gdbserver-fix-build-with-make-3.81.patch
# Backports from master
Patch2001: gdb-fix-riscv-tdep.patch
Patch2004: gdb-testsuite-add-missing-initial-prompt-read-in-multidictionary.exp.patch
Patch2005: gdb-testsuite-pie-no-pie.patch
Patch2007: gdb-testsuite-read1-fixes.patch
Patch2008: gdb-testsuite-i386-pkru-exp.patch
Patch2009: gdb-s390-handle-arch13.diff
Patch2010: gdb-fix-heap-use-after-free-in-typename-concat.patch
Patch2011: gdb-dwarf-reader-reject-sections-with-invalid-sizes.patch
Patch2012: gdb-0001-remove-alloca-0-calls.patch
Patch2013: gdb-arch13-1.diff
Patch2014: gdb-arch13-2.diff
Patch2015: gdb-arch13-3.diff
Patch2016: bfd-change-num_group-to-unsigned-int.patch
Patch2017: gdb-fix-incorrect-use-of-is-operator-for-comparison-in-python-lib-gdb-command-prompt.py.patch
Patch2018: gdb-fix-toplevel-types-with-fdebug-types-section.patch
Patch2019: gdb-fix-range-loop-index-in-find_method.patch
# Proposed patch for PR symtab/24971
Patch2500: gdb-symtab-prefer-var-def-over-decl.patch
# Proposed patch for PR gdb/24956
Patch2501: gdb-only-force-interp_console-ui_out-for-breakpoint-commands-in-mi-mode.patch
Patch2020: gdb-fix-python3.9-related-runtime-problems.patch
Patch2021: gdb-fix-unused-function-error.patch
Patch2022: gdb-fix-the-thread-pool.c-compilation.patch
# Proposed patch for PR threads/25478
Patch2502: gdb-threads-fix-hang-in-stop_all_threads-after-killing-inferior.patch
# Testsuite patches
Patch2600: gdb-testsuite-8.3-kfail-xfail-unsupported.patch
# -
# libipt support
Patch3000: v1.5-libipt-static.patch
@ -471,7 +433,6 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c gdb/go-exp.c
find -name "*.info*"|xargs rm -f
#Fedora patching start
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
@ -518,6 +479,7 @@ find -name "*.info*"|xargs rm -f
%patch45 -p1
%patch46 -p1
%patch47 -p1
%patch48 -p1
%patch49 -p1
%patch50 -p1
%patch51 -p1
@ -541,7 +503,6 @@ find -name "*.info*"|xargs rm -f
%patch69 -p1
%patch70 -p1
%patch71 -p1
%patch72 -p1
%patch73 -p1
%patch74 -p1
%patch75 -p1
@ -562,35 +523,11 @@ find -name "*.info*"|xargs rm -f
%patch90 -p1
%patch91 -p1
%patch92 -p1
%patch93 -p1
%patch94 -p1
%patch95 -p1
%patch96 -p1
%patch97 -p1
%patch98 -p1
%patch99 -p1
%patch100 -p1
%patch101 -p1
%patch102 -p1
%patch103 -p1
%patch104 -p1
%patch105 -p1
%patch106 -p1
%patch107 -p1
%patch108 -p1
%patch109 -p1
%patch110 -p1
%patch111 -p1
%patch112 -p1
%patch113 -p1
%patch114 -p1
%patch115 -p1
%patch116 -p1
%patch117 -p1
%patch118 -p1
%patch119 -p1
%patch120 -p1
%patch121 -p1
#Fedora patching end
%patch500 -p1
@ -600,31 +537,17 @@ find -name "*.info*"|xargs rm -f
%patch1002 -p1
%patch1003 -p1
%patch1007 -p1
%patch1500 -p1
%patch1501 -p1
%patch2001 -p1
%patch2004 -p1
%patch2005 -p1
%patch2007 -p1
%patch2008 -p1
%patch2009 -p1
%patch2010 -p1
%patch2011 -p1
%patch2012 -p1
%patch2013 -p1
%patch2014 -p1
%patch2015 -p1
%patch2016 -p1
%patch2017 -p1
%patch2018 -p1
%patch2019 -p1
%patch2020 -p1
%patch2021 -p1
%patch2022 -p1
%patch2500 -p1
%patch2501 -p1
%patch2502 -p1
%patch2600 -p1
#unpack libipt
%if 0%{have_libipt}
tar xzf %{SOURCE7}
@ -751,7 +674,7 @@ EXTRA_TARGETS=
--disable-sim \
--disable-rpath \
--with-system-zlib \
%if %{suse_version} > 1110
%if %{suse_version} >= 1500
--with-system-readline \
%else
--without-system-readline \

View File

@ -0,0 +1,33 @@
[gdbserver] Fix build with make 3.81
---
gdb/gdbserver/Makefile.in | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in
index 16a9f2fd38..687bee2658 100644
--- a/gdb/gdbserver/Makefile.in
+++ b/gdb/gdbserver/Makefile.in
@@ -580,9 +580,22 @@ ax.o: ax.c
$(COMPILE) $(WARN_CFLAGS_NO_FORMAT) $<
$(POSTCOMPILE)
+ifeq ($(WORKAROUND_ALLOC_IPA),)
+ifeq ($(MAKE_VERSION),3.81)
+WORKAROUND_ALLOC_IPA = 1
+else
+WORKAROUND_ALLOC_IPA = 0
+endif
+endif
+
+ifeq ($(WORKAROUND_ALLOC_IPA),0)
alloc-ipa.o: ../alloc.c
$(IPAGENT_COMPILE) $(WARN_CFLAGS_NO_FORMAT) $<
$(POSTCOMPILE)
+else
+alloc-ipa.o: ../alloc.c
+ @$(MAKE) $(FLAGS_TO_PASS) WORKAROUND_ALLOC_IPA=0 alloc-ipa.o
+endif
# Rules for objects that go in the in-process agent.