- 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
188 lines
6.6 KiB
Diff
188 lines
6.6 KiB
Diff
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-archer.patch
|
|
|
|
;; Python patches of: http://sourceware.org/gdb/wiki/ProjectArcher
|
|
;;=push
|
|
|
|
http://sourceware.org/gdb/wiki/ProjectArcher
|
|
http://sourceware.org/gdb/wiki/ArcherBranchManagement
|
|
|
|
GIT snapshot:
|
|
commit 718a1618b2f691a7f407213bb50f100ac59f91c3
|
|
|
|
tromey/python
|
|
|
|
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
|
|
@@ -80,6 +80,7 @@ PYTHON_FILE_LIST = \
|
|
gdb/unwinder.py \
|
|
gdb/xmethod.py \
|
|
gdb/command/__init__.py \
|
|
+ gdb/command/ignore_errors.py \
|
|
gdb/command/explore.py \
|
|
gdb/command/backtrace.py \
|
|
gdb/command/frame_filters.py \
|
|
@@ -92,6 +93,7 @@ PYTHON_FILE_LIST = \
|
|
gdb/function/as_string.py \
|
|
gdb/function/caller_is.py \
|
|
gdb/function/strfns.py \
|
|
+ gdb/function/in_scope.py \
|
|
gdb/printer/__init__.py \
|
|
gdb/printer/bound_registers.py
|
|
|
|
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
|
|
@@ -1,5 +1,15 @@
|
|
echo Setting up the environment for debugging gdb.\n
|
|
|
|
+# Set up the Python library and "require" command.
|
|
+python
|
|
+from os.path import abspath
|
|
+gdb.datadir = abspath ('@srcdir@/python/lib')
|
|
+gdb.pythonlibdir = gdb.datadir
|
|
+gdb.__path__ = [gdb.datadir + '/gdb']
|
|
+sys.path.insert(0, gdb.datadir)
|
|
+end
|
|
+source @srcdir@/python/lib/gdb/__init__.py
|
|
+
|
|
if !$gdb_init_done
|
|
set variable $gdb_init_done = 1
|
|
|
|
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
|
|
+++ b/gdb/python/lib/gdb/command/ignore_errors.py
|
|
@@ -0,0 +1,37 @@
|
|
+# Ignore errors in user commands.
|
|
+
|
|
+# Copyright (C) 2008 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/>.
|
|
+
|
|
+import gdb
|
|
+
|
|
+class IgnoreErrorsCommand (gdb.Command):
|
|
+ """Execute a single command, ignoring all errors.
|
|
+Only one-line commands are supported.
|
|
+This is primarily useful in scripts."""
|
|
+
|
|
+ def __init__ (self):
|
|
+ super (IgnoreErrorsCommand, self).__init__ ("ignore-errors",
|
|
+ gdb.COMMAND_OBSCURE,
|
|
+ # FIXME...
|
|
+ gdb.COMPLETE_COMMAND)
|
|
+
|
|
+ def invoke (self, arg, from_tty):
|
|
+ try:
|
|
+ gdb.execute (arg, from_tty)
|
|
+ except:
|
|
+ pass
|
|
+
|
|
+IgnoreErrorsCommand ()
|
|
diff --git a/gdb/python/lib/gdb/function/in_scope.py b/gdb/python/lib/gdb/function/in_scope.py
|
|
new file mode 100644
|
|
--- /dev/null
|
|
+++ b/gdb/python/lib/gdb/function/in_scope.py
|
|
@@ -0,0 +1,47 @@
|
|
+# In-scope function.
|
|
+
|
|
+# Copyright (C) 2008 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/>.
|
|
+
|
|
+import gdb
|
|
+
|
|
+class InScope (gdb.Function):
|
|
+ """Return True if all the given variables or macros are in scope.
|
|
+Takes one argument for each variable name to be checked."""
|
|
+
|
|
+ def __init__ (self):
|
|
+ super (InScope, self).__init__ ("in_scope")
|
|
+
|
|
+ def invoke (self, *vars):
|
|
+ if len (vars) == 0:
|
|
+ raise (TypeError, "in_scope takes at least one argument")
|
|
+
|
|
+ # gdb.Value isn't hashable so it can't be put in a map.
|
|
+ # Convert to string first.
|
|
+ wanted = set (map (lambda x: x.string (), vars))
|
|
+ found = set ()
|
|
+ block = gdb.selected_frame ().block ()
|
|
+ while block:
|
|
+ for sym in block:
|
|
+ if (sym.is_argument or sym.is_constant
|
|
+ or sym.is_function or sym.is_variable):
|
|
+ if sym.name in wanted:
|
|
+ found.add (sym.name)
|
|
+
|
|
+ block = block.superblock
|
|
+
|
|
+ return wanted == found
|
|
+
|
|
+InScope ()
|
|
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
|
|
@@ -95,6 +95,8 @@ gdb_test "python print ('result = %s' % f0.read_var ('a'))" " = 1" "test Frame.r
|
|
|
|
gdb_test "python print ('result = %s' % (gdb.selected_frame () == f1))" " = True" "test gdb.selected_frame"
|
|
|
|
+gdb_test "python print ('result = %s' % (f0.block ()))" "<gdb.Block object at 0x\[\[:xdigit:\]\]+>" "test Frame.block"
|
|
+
|
|
# Can read SP register.
|
|
gdb_test "python print ('result = %s' % (gdb.selected_frame ().read_register ('sp') == gdb.parse_and_eval ('\$sp')))" \
|
|
" = True" \
|
|
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
|
|
@@ -419,6 +419,15 @@ proc test_value_after_death {} {
|
|
"print value's type"
|
|
}
|
|
|
|
+# Regression test for a cast failure. The bug was that if we cast a
|
|
+# value to its own type, gdb could crash. This happened because we
|
|
+# could end up double-freeing a struct value.
|
|
+proc test_cast_regression {} {
|
|
+ gdb_test "python v = gdb.Value(5)" "" "create value for cast test"
|
|
+ gdb_test "python v = v.cast(v.type)" "" "cast value for cast test"
|
|
+ gdb_test "python print(v)" "5" "print value for cast test"
|
|
+}
|
|
+
|
|
# 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.
|
|
@@ -606,6 +615,7 @@ test_value_in_inferior
|
|
test_value_from_buffer
|
|
test_inferior_function_call
|
|
test_value_after_death
|
|
+test_cast_regression
|
|
|
|
# Test either C or C++ values.
|
|
|