Compare commits
No commits in common. "c8" and "c9s" have entirely different histories.
|
@ -1,3 +1,3 @@
|
|||
ee66294d87a109f88a459d0da5d0bb2da5135f45 SOURCES/gdb-8.2.tar.xz
|
||||
1ad1d2c6f0141b37bbe32b8add91b5691ecc6412 SOURCES/gdb-libstdc++-v3-python-8.1.1-20180626.tar.xz
|
||||
a08830edc095f4ea8ae516a154942105379c5f67 SOURCES/v2.0.tar.gz
|
||||
1056e2743a825ecce46ec9eec37f0b357831012b gdb-10.2.tar.xz
|
||||
1ad1d2c6f0141b37bbe32b8add91b5691ecc6412 gdb-libstdc++-v3-python-8.1.1-20180626.tar.xz
|
||||
89b3dd85676090dd4a923425f7668446d729f5f3 v2.0.4.tar.gz
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
SOURCES/gdb-8.2.tar.xz
|
||||
SOURCES/gdb-libstdc++-v3-python-8.1.1-20180626.tar.xz
|
||||
SOURCES/v2.0.tar.gz
|
||||
/binutils-gdb
|
||||
/gdb-libstdc++-v3-python-8.1.1-20180626.tar.xz
|
||||
/gdb-10.2.tar.xz
|
||||
/v2.0.4.tar.gz
|
||||
|
|
|
@ -0,0 +1,104 @@
|
|||
# Fedora GDB local patches policy
|
||||
|
||||
In order to make things easier for the Fedora GDB maintainer, we
|
||||
choose to auto-generate the local patches by making use of an upstream
|
||||
git repository. Below you can find a few instructions on how to work
|
||||
using this method.
|
||||
|
||||
You need to run the following commands from the directory that
|
||||
contains the "gdb.spec" file.
|
||||
|
||||
## Importing the GDB patches into a git repository
|
||||
|
||||
1) The local patches (`*.patch`) need to be imported into an upstream
|
||||
git repository. For example, let's assume you cloned the repository
|
||||
by doing:
|
||||
|
||||
`$ git clone git://sourceware.org/git/binutils-gdb.git`
|
||||
|
||||
> TIP: if you already have the repository cloned somewhere in your
|
||||
> system, you can pass a "--reference <dir>" to the "git clone"
|
||||
> command and it will use your local repository as much as possible
|
||||
> to make the clone, speeding up things.
|
||||
|
||||
2) After cloning the upstream repository, you can import your patches
|
||||
by using the script "generate-git-repo-from-patches.sh":
|
||||
|
||||
`$ sh generate-git-repo-from-patches.sh <REPOSITORY_DIR>`
|
||||
|
||||
The script will basically cd into the repository, checkout the
|
||||
revision specified in the file `_git_upstream_commit`, iterate through
|
||||
the file `_patch_order` and "git-am" every patch *in that order*.
|
||||
This operation should complete without errors; if you find a problem
|
||||
with `git-am`, it probably means that the revision specified in the
|
||||
file `_git_upstream_commit` is wrong.
|
||||
|
||||
## Rebasing the patches against a newer version/release
|
||||
|
||||
1) First, cd into the upstream repository. All you have to do is
|
||||
choose the revision against which you plan to rebase the patches, and
|
||||
`git rebase <REVISION>`. git will do the rest, and you will be able
|
||||
to perform conflict resolution by git's algorithm, which is smarter.
|
||||
|
||||
## Creating new patches
|
||||
|
||||
1) Create the new patch on top of the the others, as usual. Note that
|
||||
you can use `git rebase` whenever you want to reorder patch order, or
|
||||
even to delete a patch.
|
||||
|
||||
2) When writing the commit log, you must obey a few rules. The
|
||||
subject line *must* be the filename of the patch. This line will be
|
||||
used when exporting the patches from the git repository, and
|
||||
(obviously) it gives the filename that should be used for this
|
||||
specific patch.
|
||||
|
||||
3) You can also add comments that will go into the auto-generated
|
||||
`Patch:` file (see below). To do that, use the special marker `;;` at
|
||||
the beginning of the line. This way, a commit log that says:
|
||||
|
||||
~~~~~~~~~~~
|
||||
test-patch.patch
|
||||
|
||||
;; This is a test patch
|
||||
;; Second line
|
||||
~~~~~~~~~~~
|
||||
|
||||
Will generate the following entry in the auto-generated `Patch:` file:
|
||||
|
||||
~~~~~~~~~~~
|
||||
# This is a test patch
|
||||
# Second line
|
||||
PatchXYZ: test-patch.patch
|
||||
~~~~~~~~~~~
|
||||
|
||||
## Exporting the GDB patches from the git repository
|
||||
|
||||
1) When you're done working with the patches, go back to the directory
|
||||
that contains the `gdb.spec` file, and from there you run:
|
||||
|
||||
`$ sh generate-patches-from-git-repo.sh <REPOSITORY_DIR>`
|
||||
|
||||
This will regenerate all of the `*.patch` files (excluding the ones that
|
||||
were also excluded from the git repository), and also regenerate a few
|
||||
control files. These control files are:
|
||||
|
||||
- `_gdb.spec.Patch.include`: This file contains the `Patch:` directives.
|
||||
|
||||
- `_gdb.spec.patch.include`: This file contains the `%patch` directives.
|
||||
|
||||
- `_patch_order`: This file contains the patches, in the exact order
|
||||
that they must be applied. It is used when importing the patches
|
||||
into the git repository.
|
||||
|
||||
- `_git_upstream_commit`: This file contains the last upstream commit
|
||||
against which the patches were rebased. It is used when importing
|
||||
the patches into the git repository.
|
||||
|
||||
NOTE: If you did a rebase against a newer upstream version, you need
|
||||
to specify the commit/tag/branch against which you rebased:
|
||||
|
||||
`$ sh generate-patches-from-git-repo.sh <REPOSITORY_DIR> <COMMIT_OR_TAG_OR_BRANCH>`
|
||||
|
||||
For example, if you rebased against `gdb-8.1-release`:
|
||||
|
||||
`$ sh generate-patches-from-git-repo.sh <REPOSITORY_DIR> gdb-8.1-release`
|
|
@ -1,830 +0,0 @@
|
|||
# Match the Fedora's version info.
|
||||
#=fedora
|
||||
Patch001: gdb-6.3-rh-testversion-20041202.patch
|
||||
|
||||
# VLA (Fortran dynamic arrays) from Intel + archer-jankratochvil-vla tests.
|
||||
#=push
|
||||
Patch002: gdb-vla-intel-fortran-strides.patch
|
||||
|
||||
#=push
|
||||
Patch003: gdb-vla-intel-fortran-vla-strings.patch
|
||||
|
||||
#=push+jan
|
||||
Patch004: gdb-vla-intel-stringbt-fix.patch
|
||||
|
||||
# Better parse 64-bit PPC system call prologues.
|
||||
#=push: Write new testcase.
|
||||
Patch005: gdb-6.3-ppc64syscall-20040622.patch
|
||||
|
||||
# Include the pc's section when doing a symbol lookup so that the
|
||||
# correct symbol is found.
|
||||
#=push: Write new testcase.
|
||||
Patch006: gdb-6.3-ppc64displaysymbol-20041124.patch
|
||||
|
||||
# Add a wrapper script to GDB that implements pstack using the
|
||||
# --readnever option.
|
||||
#=push
|
||||
Patch007: gdb-6.3-gstack-20050411.patch
|
||||
|
||||
# VSYSCALL and PIE
|
||||
#=fedoratest
|
||||
Patch008: gdb-6.3-test-pie-20050107.patch
|
||||
|
||||
# Get selftest working with sep-debug-info
|
||||
#=fedoratest
|
||||
Patch009: gdb-6.3-test-self-20050110.patch
|
||||
|
||||
# Test support of multiple destructors just like multiple constructors
|
||||
#=fedoratest
|
||||
Patch010: gdb-6.3-test-dtorfix-20050121.patch
|
||||
|
||||
# Fix to support executable moving
|
||||
#=fedoratest
|
||||
Patch011: gdb-6.3-test-movedir-20050125.patch
|
||||
|
||||
# Test sibling threads to set threaded watchpoints for x86 and x86-64
|
||||
#=fedoratest
|
||||
Patch012: gdb-6.3-threaded-watchpoints2-20050225.patch
|
||||
|
||||
# Notify observers that the inferior has been created
|
||||
#=fedoratest
|
||||
Patch013: gdb-6.3-inferior-notification-20050721.patch
|
||||
|
||||
# Verify printing of inherited members test
|
||||
#=fedoratest
|
||||
Patch014: gdb-6.3-inheritancetest-20050726.patch
|
||||
|
||||
# Add readnever option
|
||||
#=push
|
||||
Patch015: gdb-6.3-readnever-20050907.patch
|
||||
|
||||
# Fix debuginfo addresses resolving for --emit-relocs Linux kernels (BZ 203661).
|
||||
#=push+jan: There was some mail thread about it, this patch may be a hack.
|
||||
Patch016: gdb-6.5-bz203661-emit-relocs.patch
|
||||
|
||||
# Support TLS symbols (+`errno' suggestion if no pthread is found) (BZ 185337).
|
||||
#=push+jan: It should be replaced by Infinity project.
|
||||
Patch017: gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch
|
||||
|
||||
# Fix TLS symbols resolving for shared libraries with a relative pathname.
|
||||
# The testsuite needs `gdb-6.5-tls-of-separate-debuginfo.patch'.
|
||||
#=fedoratest: One should recheck if it is really fixed upstream.
|
||||
Patch018: gdb-6.5-sharedlibrary-path.patch
|
||||
|
||||
# Improved testsuite results by the testsuite provided by the courtesy of BEA.
|
||||
#=fedoratest: For upstream it should be rewritten as a dejagnu test, the test of no "??" was useful.
|
||||
Patch019: gdb-6.5-BEA-testsuite.patch
|
||||
|
||||
# Testcase for deadlocking on last address space byte; for corrupted backtraces.
|
||||
#=fedoratest
|
||||
Patch020: gdb-6.5-last-address-space-byte-test.patch
|
||||
|
||||
# Fix readline segfault on excessively long hand-typed lines.
|
||||
#=fedoratest
|
||||
Patch021: gdb-6.5-readline-long-line-crash-test.patch
|
||||
|
||||
# Fix bogus 0x0 unwind of the thread's topmost function clone(3) (BZ 216711).
|
||||
#=fedora
|
||||
Patch022: gdb-6.5-bz216711-clone-is-outermost.patch
|
||||
|
||||
# Test sideeffects of skipping ppc .so libs trampolines (BZ 218379).
|
||||
#=fedoratest
|
||||
Patch023: gdb-6.5-bz218379-ppc-solib-trampoline-test.patch
|
||||
|
||||
# Fix lockup on trampoline vs. its function lookup; unreproducible (BZ 218379).
|
||||
#=fedora
|
||||
Patch024: gdb-6.5-bz218379-solib-trampoline-lookup-lock-fix.patch
|
||||
|
||||
# Find symbols properly at their original (included) file (BZ 109921).
|
||||
#=fedoratest
|
||||
Patch025: gdb-6.5-bz109921-DW_AT_decl_file-test.patch
|
||||
|
||||
# Update PPC unwinding patches to their upstream variants (BZ 140532).
|
||||
#=fedoratest
|
||||
Patch026: gdb-6.3-bz140532-ppc-unwinding-test.patch
|
||||
|
||||
# Testcase for exec() from threaded program (BZ 202689).
|
||||
#=fedoratest
|
||||
Patch027: gdb-6.3-bz202689-exec-from-pthread-test.patch
|
||||
|
||||
# Testcase for PPC Power6/DFP instructions disassembly (BZ 230000).
|
||||
#=fedoratest
|
||||
Patch028: gdb-6.6-bz230000-power6-disassembly-test.patch
|
||||
|
||||
# Allow running `/usr/bin/gcore' with provided but inaccessible tty (BZ 229517).
|
||||
#=fedoratest
|
||||
Patch029: gdb-6.6-bz229517-gcore-without-terminal.patch
|
||||
|
||||
# Avoid too long timeouts on failing cases of "annota1.exp annota3.exp".
|
||||
#=fedoratest
|
||||
Patch030: gdb-6.6-testsuite-timeouts.patch
|
||||
|
||||
# Support for stepping over PPC atomic instruction sequences (BZ 237572).
|
||||
#=fedoratest
|
||||
Patch031: gdb-6.6-bz237572-ppc-atomic-sequence-test.patch
|
||||
|
||||
# Make upstream `set scheduler-locking step' as default.
|
||||
#=push+jan: How much is scheduler-locking relevant after non-stop?
|
||||
Patch032: gdb-6.6-scheduler_locking-step-is-default.patch
|
||||
|
||||
# Test kernel VDSO decoding while attaching to an i386 process.
|
||||
#=fedoratest
|
||||
Patch033: gdb-6.3-attach-see-vdso-test.patch
|
||||
|
||||
# Test leftover zombie process (BZ 243845).
|
||||
#=fedoratest
|
||||
Patch034: gdb-6.5-bz243845-stale-testing-zombie-test.patch
|
||||
|
||||
# New locating of the matching binaries from the pure core file (build-id).
|
||||
#=push+jan
|
||||
Patch035: gdb-6.6-buildid-locate.patch
|
||||
|
||||
# Fix loading of core files without build-ids but with build-ids in executables.
|
||||
# Load strictly build-id-checked core files only if no executable is specified
|
||||
# (Jan Kratochvil, RH BZ 1339862).
|
||||
#=push+jan
|
||||
Patch036: gdb-6.6-buildid-locate-solib-missing-ids.patch
|
||||
|
||||
#=push+jan
|
||||
Patch037: gdb-6.6-buildid-locate-rpm.patch
|
||||
|
||||
# Fix displaying of numeric char arrays as strings (BZ 224128).
|
||||
#=fedoratest: But it is failing anyway, one should check the behavior more.
|
||||
Patch038: gdb-6.7-charsign-test.patch
|
||||
|
||||
# Test PPC hiding of call-volatile parameter register.
|
||||
#=fedoratest
|
||||
Patch039: gdb-6.7-ppc-clobbered-registers-O2-test.patch
|
||||
|
||||
# Testsuite fixes for more stable/comparable results.
|
||||
#=fedoratest
|
||||
Patch040: gdb-6.7-testsuite-stable-results.patch
|
||||
|
||||
# Test ia64 memory leaks of the code using libunwind.
|
||||
#=fedoratest
|
||||
Patch041: gdb-6.5-ia64-libunwind-leak-test.patch
|
||||
|
||||
# Test hiding unexpected breakpoints on intentional step commands.
|
||||
#=fedoratest
|
||||
Patch042: gdb-6.5-missed-trap-on-step-test.patch
|
||||
|
||||
# Test gcore memory and time requirements for large inferiors.
|
||||
#=fedoratest
|
||||
Patch043: gdb-6.5-gcore-buffer-limit-test.patch
|
||||
|
||||
# Test GCORE for shmid 0 shared memory mappings.
|
||||
#=fedoratest: But it is broken anyway, sometimes the case being tested is not reproducible.
|
||||
Patch044: gdb-6.3-mapping-zero-inode-test.patch
|
||||
|
||||
# Test a crash on `focus cmd', `focus prev' commands.
|
||||
#=fedoratest
|
||||
Patch045: gdb-6.3-focus-cmd-prev-test.patch
|
||||
|
||||
# Test various forms of threads tracking across exec() (BZ 442765).
|
||||
#=fedoratest
|
||||
Patch046: gdb-6.8-bz442765-threaded-exec-test.patch
|
||||
|
||||
# Silence memcpy check which returns false positive (sparc64)
|
||||
#=push: But it is just a GCC workaround, look up the existing GCC PR for it.
|
||||
Patch047: gdb-6.8-sparc64-silence-memcpy-check.patch
|
||||
|
||||
# Test a crash on libraries missing the .text section.
|
||||
#=fedoratest
|
||||
Patch048: gdb-6.5-section-num-fixup-test.patch
|
||||
|
||||
# Fix register assignments with no GDB stack frames (BZ 436037).
|
||||
#=push+jan: This fix is incorrect.
|
||||
Patch049: gdb-6.8-bz436037-reg-no-longer-active.patch
|
||||
|
||||
# Test the watchpoints conditionals works.
|
||||
#=fedoratest
|
||||
Patch050: gdb-6.8-watchpoint-conditionals-test.patch
|
||||
|
||||
# Fix resolving of variables at locations lists in prelinked libs (BZ 466901).
|
||||
#=fedoratest
|
||||
Patch051: gdb-6.8-bz466901-backtrace-full-prelinked.patch
|
||||
|
||||
# New test for step-resume breakpoint placed in multiple threads at once.
|
||||
#=fedoratest
|
||||
Patch052: gdb-simultaneous-step-resume-breakpoint-test.patch
|
||||
|
||||
# Fix GNU/Linux core open: Can't read pathname for load map: Input/output error.
|
||||
# Fix regression of undisplayed missing shared libraries caused by a fix for.
|
||||
#=fedoratest: It should be in glibc: libc-alpha: <20091004161706.GA27450@.*>
|
||||
Patch053: gdb-core-open-vdso-warning.patch
|
||||
|
||||
# Fix syscall restarts for amd64->i386 biarch.
|
||||
#=push+jan
|
||||
Patch054: gdb-x86_64-i386-syscall-restart.patch
|
||||
|
||||
# Fix stepping with OMP parallel Fortran sections (BZ 533176).
|
||||
#=push+jan: It requires some better DWARF annotations.
|
||||
Patch055: gdb-bz533176-fortran-omp-step.patch
|
||||
|
||||
# Fix regression by python on ia64 due to stale current frame.
|
||||
#=push+jan
|
||||
Patch056: gdb-follow-child-stale-parent.patch
|
||||
|
||||
# Workaround ccache making lineno non-zero for command-line definitions.
|
||||
#=fedoratest: ccache is rarely used and it is even fixed now.
|
||||
Patch057: gdb-ccache-workaround.patch
|
||||
|
||||
#=push+jan: May get obsoleted by Tom's unrelocated objfiles patch.
|
||||
Patch058: gdb-archer-pie-addons.patch
|
||||
|
||||
#=push+jan: Breakpoints disabling matching should not be based on address.
|
||||
Patch059: gdb-archer-pie-addons-keep-disabled.patch
|
||||
|
||||
# Testcase for "Do not make up line information" fix by Daniel Jacobowitz.
|
||||
#=fedoratest
|
||||
Patch060: gdb-lineno-makeup-test.patch
|
||||
|
||||
# Test power7 ppc disassembly.
|
||||
#=fedoratest
|
||||
Patch061: gdb-ppc-power7-test.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.
|
||||
Patch062: gdb-bz541866-rwatch-before-run.patch
|
||||
|
||||
# Workaround non-stop moribund locations exploited by kernel utrace (BZ 590623).
|
||||
#=push+jan: Currently it is still not fully safe.
|
||||
Patch063: gdb-moribund-utrace-workaround.patch
|
||||
|
||||
# Fix follow-exec for C++ programs (bugreported by Martin Stransky).
|
||||
#=fedoratest
|
||||
Patch064: gdb-archer-next-over-throw-cxx-exec.patch
|
||||
|
||||
# Backport DWARF-4 support (BZ 601887, Tom Tromey).
|
||||
#=fedoratest
|
||||
Patch065: gdb-bz601887-dwarf4-rh-test.patch
|
||||
|
||||
#=push+jan
|
||||
Patch066: gdb-6.6-buildid-locate-core-as-arg.patch
|
||||
|
||||
# Workaround librpm BZ 643031 due to its unexpected exit() calls (BZ 642879).
|
||||
#=push+jan
|
||||
Patch067: gdb-6.6-buildid-locate-rpm-librpm-workaround.patch
|
||||
|
||||
# [delayed-symfile] Test a backtrace regression on CFIs without DIE (BZ 614604).
|
||||
#=fedoratest
|
||||
Patch068: gdb-test-bt-cfi-without-die.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.
|
||||
Patch069: gdb-bz568248-oom-is-error.patch
|
||||
|
||||
# Verify GDB Python built-in function gdb.solib_address exists (BZ # 634108).
|
||||
#=fedoratest
|
||||
Patch070: gdb-bz634108-solib_address.patch
|
||||
|
||||
# New test gdb.arch/x86_64-pid0-core.exp for kernel PID 0 cores (BZ 611435).
|
||||
#=fedoratest
|
||||
Patch071: gdb-test-pid0-core.patch
|
||||
|
||||
# [archer-tromey-delayed-symfile] New test gdb.dwarf2/dw2-aranges.exp.
|
||||
#=fedoratest
|
||||
Patch072: gdb-test-dw2-aranges.patch
|
||||
|
||||
# [archer-keiths-expr-cumulative+upstream] Import C++ testcases.
|
||||
#=fedoratest
|
||||
Patch073: gdb-test-expr-cumulative-archer.patch
|
||||
|
||||
# Fix regressions on C++ names resolving (PR 11734, PR 12273, Keith Seitz).
|
||||
#=fedoratest
|
||||
Patch074: gdb-physname-pr11734-test.patch
|
||||
|
||||
# Fix regressions on C++ names resolving (PR 11734, PR 12273, Keith Seitz).
|
||||
#=fedoratest
|
||||
Patch075: gdb-physname-pr12273-test.patch
|
||||
|
||||
# Toolchain on sparc is slightly broken and debuginfo files are generated
|
||||
# with non 64bit aligned tables/offsets.
|
||||
# See for example readelf -S ../Xvnc.debug.
|
||||
#
|
||||
# As a consenquence calculation of sectp->filepos as used in
|
||||
# dwarf2_read_section (gdb/dwarf2read.c:1525) will return a non aligned buffer
|
||||
# that cannot be used directly as done with MMAP.
|
||||
# Usage will result in a BusError.
|
||||
#
|
||||
# While we figure out what's wrong in the toolchain and do a full archive
|
||||
# rebuild to fix it, we need to be able to use gdb :)
|
||||
#=push
|
||||
Patch076: gdb-7.2.50-sparc-add-workaround-to-broken-debug-files.patch
|
||||
|
||||
# Test GDB opcodes/ disassembly of Intel Ivy Bridge instructions (BZ 696890).
|
||||
#=fedoratest
|
||||
Patch077: gdb-test-ivy-bridge.patch
|
||||
|
||||
# Hack for proper PIE run of the testsuite.
|
||||
#=fedoratest
|
||||
Patch078: gdb-runtest-pie-override.patch
|
||||
|
||||
# Print reasons for failed attach/spawn incl. SELinux deny_ptrace (BZ 786878).
|
||||
#=push+jan
|
||||
Patch079: gdb-attach-fail-reasons-5of5.patch
|
||||
|
||||
# Workaround PR libc/14166 for inferior calls of strstr.
|
||||
#=fedora: Compatibility with RHELs (unchecked which ones).
|
||||
Patch080: gdb-glibc-strstr-workaround.patch
|
||||
|
||||
# Include testcase for `Unable to see a variable inside a module (XLF)' (BZ 823789).
|
||||
#=fedoratest
|
||||
Patch081: gdb-rhel5.9-testcase-xlf-var-inside-mod.patch
|
||||
|
||||
# Testcase for `Setting solib-absolute-prefix breaks vDSO' (BZ 818343).
|
||||
#=fedoratest
|
||||
Patch082: gdb-rhbz-818343-set-solib-absolute-prefix-testcase.patch
|
||||
|
||||
# Fix `GDB cannot access struct member whose offset is larger than 256MB'
|
||||
# (RH BZ 795424).
|
||||
#=push
|
||||
Patch083: gdb-rhbz795424-bitpos-20of25.patch
|
||||
|
||||
# Fix `GDB cannot access struct member whose offset is larger than 256MB'
|
||||
# (RH BZ 795424).
|
||||
#=push
|
||||
Patch084: gdb-rhbz795424-bitpos-21of25.patch
|
||||
|
||||
# Fix `GDB cannot access struct member whose offset is larger than 256MB'
|
||||
# (RH BZ 795424).
|
||||
#=push
|
||||
Patch085: gdb-rhbz795424-bitpos-22of25.patch
|
||||
|
||||
# Fix `GDB cannot access struct member whose offset is larger than 256MB'
|
||||
# (RH BZ 795424).
|
||||
#=push
|
||||
Patch086: gdb-rhbz795424-bitpos-23of25.patch
|
||||
|
||||
# Fix `GDB cannot access struct member whose offset is larger than 256MB'
|
||||
# (RH BZ 795424).
|
||||
#=push
|
||||
Patch087: gdb-rhbz795424-bitpos-25of25.patch
|
||||
|
||||
# Fix `GDB cannot access struct member whose offset is larger than 256MB'
|
||||
# (RH BZ 795424).
|
||||
#=push
|
||||
Patch088: gdb-rhbz795424-bitpos-25of25-test.patch
|
||||
|
||||
# Fix `GDB cannot access struct member whose offset is larger than 256MB'
|
||||
# (RH BZ 795424).
|
||||
#=push
|
||||
Patch089: gdb-rhbz795424-bitpos-lazyvalue.patch
|
||||
|
||||
# Import regression test for `gdb/findvar.c:417: internal-error:
|
||||
# read_var_value: Assertion `frame' failed.' (RH BZ 947564) from RHEL 6.5.
|
||||
#=fedoratest
|
||||
Patch090: gdb-rhbz947564-findvar-assertion-frame-failed-testcase.patch
|
||||
|
||||
# Fix crash of -readnow /usr/lib/debug/usr/bin/gnatbind.debug (BZ 1069211).
|
||||
#=push+jan
|
||||
Patch091: gdb-gnat-dwarf-crash-3of3.patch
|
||||
|
||||
# Fix 'memory leak in infpy_read_memory()' (RH BZ 1007614)
|
||||
#=fedoratest
|
||||
Patch092: gdb-rhbz1007614-memleak-infpy_read_memory-test.patch
|
||||
|
||||
# Fix 'gdb gives highly misleading error when debuginfo pkg is present,
|
||||
# but not corresponding binary pkg' (RH BZ 981154).
|
||||
#=push+jan
|
||||
Patch093: gdb-6.6-buildid-locate-misleading-warning-missing-debuginfo-rhbz981154.patch
|
||||
|
||||
#=fedoratest
|
||||
Patch094: gdb-archer-vla-tests.patch
|
||||
|
||||
#=fedoratest
|
||||
Patch095: gdb-vla-intel-tests.patch
|
||||
|
||||
# Continue backtrace even if a frame filter throws an exception (Phil Muldoon).
|
||||
#=push
|
||||
Patch096: gdb-btrobust.patch
|
||||
|
||||
# Display Fortran strings in backtraces.
|
||||
#=fedoratest
|
||||
Patch097: gdb-fortran-frame-string.patch
|
||||
|
||||
# Fix Python GIL with gdb.execute("continue") (Phil Muldoon, BZ 1116957).
|
||||
#=push
|
||||
Patch098: gdb-python-gil.patch
|
||||
|
||||
# Testcase for '[SAP] Recursive dlopen causes SAP HANA installer to
|
||||
# crash.' (RH BZ 1156192).
|
||||
#=fedoratest
|
||||
Patch099: gdb-rhbz1156192-recursive-dlopen-test.patch
|
||||
|
||||
# Fix jit-reader.h for multi-lib.
|
||||
#=push+jan
|
||||
Patch100: gdb-jit-reader-multilib.patch
|
||||
|
||||
# Fix '`catch syscall' doesn't work for parent after `fork' is called'
|
||||
# (Philippe Waroquiers, RH BZ 1149205).
|
||||
#=fedoratest
|
||||
Patch101: gdb-rhbz1149205-catch-syscall-after-fork-test.patch
|
||||
|
||||
# Fix 'backport GDB 7.4 fix to RHEL 6.6 GDB' [Original Sourceware bug
|
||||
# description: 'C++ (and objc): Internal error on unqualified name
|
||||
# re-set', PR 11657] (RH BZ 1186476).
|
||||
#=fedoratest
|
||||
Patch102: gdb-rhbz1186476-internal-error-unqualified-name-re-set-test.patch
|
||||
|
||||
# Test 'info type-printers' Python error (RH BZ 1350436).
|
||||
#=fedoratest
|
||||
Patch103: gdb-rhbz1350436-type-printers-error.patch
|
||||
|
||||
# Fix '[ppc64] and [s390x] wrong prologue skip on -O2 -g code' (Jan
|
||||
# Kratochvil, RH BZ 1084404).
|
||||
#=fedoratest
|
||||
Patch104: gdb-rhbz1084404-ppc64-s390x-wrong-prologue-skip-O2-g-3of3.patch
|
||||
|
||||
# Never kill PID on: gdb exec PID (Jan Kratochvil, RH BZ 1219747).
|
||||
#=push+jan
|
||||
Patch105: gdb-bz1219747-attach-kills.patch
|
||||
|
||||
# Force libncursesw over libncurses to match the includes (RH BZ 1270534).
|
||||
#=push+jan
|
||||
Patch106: gdb-fedora-libncursesw.patch
|
||||
|
||||
# Test clflushopt instruction decode (for RH BZ 1262471).
|
||||
#=fedoratest
|
||||
Patch107: gdb-opcodes-clflushopt-test.patch
|
||||
|
||||
# [rhel6] DTS backward Python compatibility API (BZ 1020004, Phil Muldoon).
|
||||
#=fedora
|
||||
Patch108: gdb-dts-rhel6-python-compat.patch
|
||||
|
||||
# [SCL] Skip deprecated .gdb_index warning for Red Hat built files (BZ 953585).
|
||||
#=push+jan
|
||||
Patch109: gdb-6.6-buildid-locate-rpm-scl.patch
|
||||
|
||||
# Work around readline-6.2 incompatibility not asking for --more-- (BZ 701131).
|
||||
#=fedora
|
||||
Patch110: gdb-readline62-ask-more-rh.patch
|
||||
|
||||
# Make the GDB quit processing non-abortable to cleanup everything properly.
|
||||
#=fedora: It was useful only after gdb-6.8-attach-signalled-detach-stopped.patch .
|
||||
Patch111: gdb-6.8-quit-never-aborts.patch
|
||||
|
||||
# [aarch64] Fix hardware watchpoints (RH BZ 1261564).
|
||||
#=fedoratest
|
||||
Patch112: gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch
|
||||
|
||||
# Add messages suggesting more recent RHEL gdbserver (RH BZ 1321114).
|
||||
#=fedora
|
||||
Patch113: gdb-container-rh-pkg.patch
|
||||
|
||||
# New test for Python "Cannot locate object file for block" (for RH BZ 1325795).
|
||||
#=fedoratest
|
||||
Patch114: gdb-rhbz1325795-framefilters-test.patch
|
||||
|
||||
# [dts+el7] [x86*] Bundle linux_perf.h for libipt (RH BZ 1256513).
|
||||
#=fedora
|
||||
Patch115: gdb-linux_perf-bundle.patch
|
||||
|
||||
# Fix gdb-headless /usr/bin/ executables (BZ 1390251).
|
||||
#=fedora
|
||||
Patch116: gdb-libexec-add-index.patch
|
||||
|
||||
# New testcase for: Fix <tab>-completion crash (Gary Benson, RH BZ 1398387).
|
||||
#=fedoratest
|
||||
Patch117: gdb-rhbz1398387-tab-crash-test.patch
|
||||
|
||||
# [testsuite] Fix false selftest.exp FAIL from system readline-6.3+ (Patrick Palka).
|
||||
#=fedoratest
|
||||
Patch118: gdb-testsuite-readline63-sigint.patch
|
||||
|
||||
# Python patches of: http://sourceware.org/gdb/wiki/ProjectArcher
|
||||
#=push
|
||||
Patch119: gdb-archer.patch
|
||||
|
||||
# Revert upstream commit 469412dd9ccc4de5874fd3299b105833f36b34cd
|
||||
Patch120: gdb-vla-intel-fix-print-char-array.patch
|
||||
|
||||
# [s390x] Backport arch12 instructions decoding (RH BZ 1553104).
|
||||
# =fedoratest
|
||||
Patch121: gdb-rhbz1553104-s390x-arch12-test.patch
|
||||
|
||||
# Implement IPv6 support for GDB/gdbserver (RH BZ 881849, Sergio Durigan Junior).
|
||||
Patch122: gdb-rhbz881849-ipv6-1of3.patch
|
||||
|
||||
|
||||
Patch123: gdb-rhbz881849-ipv6-2of3.patch
|
||||
|
||||
|
||||
Patch124: gdb-rhbz881849-ipv6-3of3.patch
|
||||
|
||||
# Add GDB support to access/display POWER8 registers (IBM, RH BZ 1187581).
|
||||
Patch125: gdb-rhbz1187581-power8-regs-1of7.patch
|
||||
|
||||
# Add GDB support to access/display POWER8 registers (IBM, RH BZ 1187581).
|
||||
Patch126: gdb-rhbz1187581-power8-regs-2of7.patch
|
||||
|
||||
# Add GDB support to access/display POWER8 registers (IBM, RH BZ 1187581).
|
||||
Patch127: gdb-rhbz1187581-power8-regs-3of7.patch
|
||||
|
||||
# Add GDB support to access/display POWER8 registers (IBM, RH BZ 1187581).
|
||||
Patch128: gdb-rhbz1187581-power8-regs-4of7.patch
|
||||
|
||||
# Add GDB support to access/display POWER8 registers (IBM, RH BZ 1187581).
|
||||
Patch129: gdb-rhbz1187581-power8-regs-5of7.patch
|
||||
|
||||
# Add GDB support to access/display POWER8 registers (IBM, RH BZ 1187581).
|
||||
Patch130: gdb-rhbz1187581-power8-regs-6of7.patch
|
||||
|
||||
# Add GDB support to access/display POWER8 registers (IBM, RH BZ 1187581).
|
||||
Patch131: gdb-rhbz1187581-power8-regs-7of7.patch
|
||||
|
||||
# Fix for 'gdb in batch mode always exit with status 0' (Gary Benson)
|
||||
# RHBZ #1491128
|
||||
Patch132: gdb-rhbz1491128-batch-mode-exit-status-1of2.patch
|
||||
|
||||
# Fix for 'gdb in batch mode always exit with status 0' (Gary Benson)
|
||||
# RHBZ #1491128
|
||||
Patch133: gdb-rhbz1491128-batch-mode-exit-status-2of2.patch
|
||||
|
||||
# Use pulongest in aarch64-linux-tdep.c.
|
||||
# This patch was forgotten during the 8.2 release process, and is
|
||||
# needed to unbreak GDB when compiling on 32-bit arches.
|
||||
Patch134: gdb-use-pulongest-aarch64-linux-tdep.patch
|
||||
|
||||
# Fix for 'GDB crashes when running from a deleted directory'
|
||||
# (Tom Tromey, RHBZ#1653410)
|
||||
Patch135: gdb-rhbz1653410-avoid-crash-when-calling-warning-too-early.patch
|
||||
|
||||
# Fix for 'py-bt is broken, results in exception'.
|
||||
# RHBZ 1639242
|
||||
Patch136: gdb-rhbz1639242-fix-dwarf2_find_containing_comp_unit-binary-search.patch
|
||||
|
||||
# Fix 'Assertion `SYMBOL_LANGUAGE (sym) == DICT_LANGUAGE (dict)->la_language' failed.'
|
||||
# Keith Seitz, RHBZ#1560010.
|
||||
Patch137: gdb-rhbz1560010-fix-assertion-symbol-language-dict-language-1of5.patch
|
||||
|
||||
# Fix 'Assertion `SYMBOL_LANGUAGE (sym) == DICT_LANGUAGE (dict)->la_language' failed.'
|
||||
# Keith Seitz, RHBZ#1560010.
|
||||
Patch138: gdb-rhbz1560010-fix-assertion-symbol-language-dict-language-2of5.patch
|
||||
|
||||
# Fix 'Assertion `SYMBOL_LANGUAGE (sym) == DICT_LANGUAGE (dict)->la_language' failed.'
|
||||
# Keith Seitz, RHBZ#1560010.
|
||||
Patch139: gdb-rhbz1560010-fix-assertion-symbol-language-dict-language-3of5.patch
|
||||
|
||||
# Fix 'Assertion `SYMBOL_LANGUAGE (sym) == DICT_LANGUAGE (dict)->la_language' failed.'
|
||||
# Keith Seitz, RHBZ#1560010.
|
||||
Patch140: gdb-rhbz1560010-fix-assertion-symbol-language-dict-language-4of5.patch
|
||||
|
||||
# Fix 'Assertion `SYMBOL_LANGUAGE (sym) == DICT_LANGUAGE (dict)->la_language' failed.'
|
||||
# Keith Seitz, RHBZ#1560010.
|
||||
Patch141: gdb-rhbz1560010-fix-assertion-symbol-language-dict-language-5of5.patch
|
||||
|
||||
# Fix 'gdb suggests using "dnf debuginfo-install'
|
||||
# Keith Seitz, RHBZ 1666249
|
||||
Patch142: gdb-rhbz1666249-suggest-yum-instead-of-dnf.patch
|
||||
|
||||
# Fix 'libiberty: Memory leak in demangle_template function resulting in a denial of service"
|
||||
# Simon Marchi, RH BZ 1668635
|
||||
Patch143: gdb-rhbz1668635-libiberty-demangle_template-memleak.patch
|
||||
|
||||
# Fix 'gdb fails to read zN registers from corefile with aarch64 SVE'
|
||||
# Alan Hayward, RH BZ 1669953
|
||||
Patch144: gdb-rhbz1669953-aarch64-sve-binutils.patch
|
||||
|
||||
# Fix remote.c build failure
|
||||
# Szabolcs Nagy, RH BZ 1187581
|
||||
Patch145: gdb-rhbz1187581-power8-regs-not-in-8.2-01of15.patch
|
||||
|
||||
# Add grok/write functions for new ppc core note sections
|
||||
# Edjunior Barbosa Machado, RH BZ 1187581
|
||||
Patch146: gdb-rhbz1187581-power8-regs-not-in-8.2-02of15.patch
|
||||
|
||||
# Zero-initialize linux note sections
|
||||
# Pedro Franco de Carvalho, RH BZ 1187581
|
||||
Patch147: gdb-rhbz1187581-power8-regs-not-in-8.2-03of15.patch
|
||||
|
||||
# [PowerPC] Don't zero-initialize vector register buffers
|
||||
# Pedro Franco de Carvalho, RH BZ 1187581
|
||||
Patch148: gdb-rhbz1187581-power8-regs-not-in-8.2-04of15.patch
|
||||
|
||||
# Add decfloat registers to float reggroup
|
||||
# Pedro Franco de Carvalho, RH BZ 1187581
|
||||
Patch149: gdb-rhbz1187581-power8-regs-not-in-8.2-05of15.patch
|
||||
|
||||
# [PowerPC] Remove rs6000_pseudo_register_reggroup_p
|
||||
# Pedro Franco de Carvalho, RH BZ 1187581
|
||||
Patch150: gdb-rhbz1187581-power8-regs-not-in-8.2-06of15.patch
|
||||
|
||||
# [PowerPC] Fix two if statements in gdb/ppc-linux-nat.c
|
||||
# Pedro Franco de Carvalho, RH BZ 1187581
|
||||
Patch151: gdb-rhbz1187581-power8-regs-not-in-8.2-07of15.patch
|
||||
|
||||
# [PowerPC] Fix indentation in arch/ppc-linux-common.c
|
||||
# Pedro Franco de Carvalho, RH BZ 1187581
|
||||
Patch152: gdb-rhbz1187581-power8-regs-not-in-8.2-08of15.patch
|
||||
|
||||
# [PowerPC] Refactor have_ initializers in rs6000-tdep.c
|
||||
# Pedro Franco de Carvalho, RH BZ 1187581
|
||||
Patch153: gdb-rhbz1187581-power8-regs-not-in-8.2-09of15.patch
|
||||
|
||||
# [PowerPC] Add support for PPR and DSCR
|
||||
# Edjunior Barbosa Machado and Pedro Franco de Carvalho, RH BZ 1187581
|
||||
Patch154: gdb-rhbz1187581-power8-regs-not-in-8.2-10of15.patch
|
||||
|
||||
# [PowerPC] Add support for TAR
|
||||
# Edjunior Barbosa Machado and Pedro Franco de Carvalho, RH BZ 1187581
|
||||
Patch155: gdb-rhbz1187581-power8-regs-not-in-8.2-11of15.patch
|
||||
|
||||
# [PowerPC] Add support for EBB and PMU registers
|
||||
# Edjunior Barbosa Machado and Pedro Franco de Carvalho, RH BZ 1187581m
|
||||
Patch156: gdb-rhbz1187581-power8-regs-not-in-8.2-12of15.patch
|
||||
|
||||
# [PowerPC] Reject tdescs with VSX and no FPU or Altivec
|
||||
# Pedro Franco de Carvalho, RH BZ 1187581
|
||||
Patch157: gdb-rhbz1187581-power8-regs-not-in-8.2-13of15.patch
|
||||
|
||||
# [PowerPC] Add support for HTM registers
|
||||
# Edjunior Barbosa Machado and Pedro Franco de Carvalho, RH BZ 1187581
|
||||
Patch158: gdb-rhbz1187581-power8-regs-not-in-8.2-14of15.patch
|
||||
|
||||
# [PowerPC] Document requirements for VSX feature
|
||||
# Pedro Franco de Carvalho, RH BZ 1187581
|
||||
Patch159: gdb-rhbz1187581-power8-regs-not-in-8.2-15of15.patch
|
||||
|
||||
# "Fix" segfault that happens on parse_macro_definition because
|
||||
# debugedit corrupts the .debug_macro section.
|
||||
# Sergio Durigan Junior, RH BZ 1708192.
|
||||
Patch160: gdb-rhbz1708192-parse_macro_definition-crash.patch
|
||||
|
||||
# Prevent buffer overflow with sections with invalid sizes.
|
||||
# Keith Seitz, RH BZ 1740299.
|
||||
Patch161: gdb-rhbz1742099-reject-sections-with-invalid-sizes.patch
|
||||
|
||||
# Fix 'GDB needs s390x arch13 binutils patches'
|
||||
# RHBZ 1768593, Andreas Krebbel
|
||||
# This patch contains only the opcodes change.
|
||||
Patch162: gdb-rhbz1768593-s390x-arch13-01.patch
|
||||
|
||||
# Fix 'GDB needs s390x arch13 binutils patches'
|
||||
# RHBZ 1768593, Andreas Krebbel
|
||||
# This patch contains only the opcodes and include changes.
|
||||
Patch163: gdb-rhbz1768593-s390x-arch13-02.patch
|
||||
|
||||
# Fix 'GDB needs s390x arch13 binutils patches'
|
||||
# RHBZ 1768593, Andreas Krebbel
|
||||
Patch164: gdb-rhbz1768593-s390x-arch13-03.patch
|
||||
|
||||
# Backport z15 record/replay
|
||||
# Andreas Arnaz, RH BZ 1659535
|
||||
Patch165: gdb-rhbz1659535-z15-record-replay.patch
|
||||
|
||||
# Fix terminal problems when error() is called
|
||||
# Alan Hayward (RH BZ 1852580)
|
||||
Patch166: gdb-rhbz1852580-terminal-woes.patch
|
||||
|
||||
# Remove hack for GDB which sets the section size to 0
|
||||
# Kevin Buettner, RH BZ 1842691
|
||||
Patch167: gdb-rhbz1842691-corefile-mem-access-1of15.patch
|
||||
|
||||
# Adjust corefile.exp test to show regression after bfd hack removal
|
||||
# Kevin Buettner, RH BZ 1842691
|
||||
Patch168: gdb-rhbz1842691-corefile-mem-access-2of15.patch
|
||||
|
||||
# section_table_xfer_memory: Replace section name with callback predicate
|
||||
# Kevin Buettner, RH BZ 1842691
|
||||
Patch169: gdb-rhbz1842691-corefile-mem-access-3of15.patch
|
||||
|
||||
# Provide access to non SEC_HAS_CONTENTS core file sections
|
||||
# Kevin Buettner, RH BZ 1842961
|
||||
Patch170: gdb-rhbz1842691-corefile-mem-access-4of15.patch
|
||||
|
||||
# Test ability to access unwritten-to mmap data in core file
|
||||
# Kevin Buettner, RH BZ 1842961
|
||||
Patch171: gdb-rhbz1842691-corefile-mem-access-5of15.patch
|
||||
|
||||
# Update binary_get_section_contents to seek using section's file position
|
||||
# Kevin Buettner, RH BZ 1842961
|
||||
Patch172: gdb-rhbz1842691-corefile-mem-access-6of15.patch
|
||||
|
||||
# Add new gdbarch method, read_core_file_mappings
|
||||
# Kevin Buettner, RH BZ 1842961
|
||||
Patch173: gdb-rhbz1842691-corefile-mem-access-7of15.patch
|
||||
|
||||
# Use NT_FILE note section for reading core target memory
|
||||
# Kevin Buettner, RH BZ 1842961
|
||||
Patch174: gdb-rhbz1842691-corefile-mem-access-8of15.patch
|
||||
|
||||
# Add test for accessing read-only mmapped data in a core file
|
||||
# Kevin Buettner, RH BZ 1842691
|
||||
Patch175: gdb-rhbz1842691-corefile-mem-access-9of15.patch
|
||||
|
||||
# gcore command: Place all file-backed mappings in NT_FILE note
|
||||
# Kevin Buettner, RH BZ 1842961
|
||||
Patch176: gdb-rhbz1842691-corefile-mem-access-10of15.patch
|
||||
|
||||
# Adjust coredump-filter.exp to account for NT_FILE note handling
|
||||
# Kevin Buettner, RH BZ 1842961
|
||||
Patch177: gdb-rhbz1842691-corefile-mem-access-11of15.patch
|
||||
|
||||
# Add new command "maint print core-file-backed-mappings"
|
||||
# Kevin Buettner, RH BZ 1842961
|
||||
Patch178: gdb-rhbz1842691-corefile-mem-access-12of15.patch
|
||||
|
||||
# Add documentation for "maint print core-file-backed-mappings"
|
||||
# Kevin Buettner, RH BZ 1842961
|
||||
Patch179: gdb-rhbz1842691-corefile-mem-access-13of15.patch
|
||||
|
||||
# New core file tests with mappings over existing program memory
|
||||
# Kevin Buettner, RH BZ 1842961
|
||||
Patch180: gdb-rhbz1842691-corefile-mem-access-14of15.patch
|
||||
|
||||
# Add period to help text for maint print core-file-backed-mappings
|
||||
# Kevin Buettner, RH BZ 1842961
|
||||
Patch181: gdb-rhbz1842691-corefile-mem-access-15of15.patch
|
||||
|
||||
# Backport "Stop the BFD library from issuing a warning message when
|
||||
# processing allocated sections in debuginfo files that lie outside of
|
||||
# Nick Clifton and Keith Seitz, RH BZ 1878810
|
||||
Patch182: gdb-rhbz1878810-bfd-suppress-loadable-section-outside-ELF-sections.patch
|
||||
|
||||
# Backport "fortran dynamic type related fixes"
|
||||
# Andrew Burgess (RH BZ 1905701)
|
||||
Patch183: gdb-rhbz1905701-DWARF-data_location.patch
|
||||
|
||||
# Backport of "Correct recording of 'store on condition' insns"
|
||||
# Andreas Arnaz (RH BZ 1903374)
|
||||
Patch184: gdb-rhbz1903374-s390x-store-on-condition.patch
|
||||
|
||||
# Fix segfault with nameless fortran modules.
|
||||
# Bernhard Heckel, RH BZ 1943673
|
||||
Patch185: gdb-rhbz1934673-fortran-nameless-modules.patch
|
||||
|
||||
# Backport "Add low_new_clone method to linux_nat_target."
|
||||
# (Pedro Franco de Carvalho, RH BZ 1854784)
|
||||
Patch186: gdb-rhbz1854784-powerpc-remove-region-limit-dawr-1of7.patch
|
||||
|
||||
# Backport "Add linux_get_hwcap"
|
||||
# (Alan Hayward, RH BZ 1854784)
|
||||
Patch187: gdb-rhbz1854784-powerpc-remove-region-limit-dawr-2of7.patch
|
||||
|
||||
# Backport "[PowerPC] Move up some register access routines"
|
||||
# (Pedro Franco de Carvalho, RH BZ 1854784)
|
||||
Patch188: gdb-rhbz1854784-powerpc-remove-region-limit-dawr-3of7.patch
|
||||
|
||||
# Backport "[PowerPC] Fix debug register issues in ppc-linux-nat"
|
||||
# (Pedro Franco de Carvalho, RH BZ 1854784)
|
||||
Patch189: gdb-rhbz1854784-powerpc-remove-region-limit-dawr-4of7.patch
|
||||
|
||||
# Backport "[PowerPC] Use < 0 and >= 0 for watchpoint ptrace calls"
|
||||
# (Pedro Franco de Carvalho, RH BZ 1854784)
|
||||
Patch190: gdb-rhbz1854784-powerpc-remove-region-limit-dawr-5of7.patch
|
||||
|
||||
# Backport "[PowerPC] Always clear watchpoint with PTRACE_SET_DEBUGREG"
|
||||
# (Pedro Franco de Carvalho, RH BZ 1854784)
|
||||
Patch191: gdb-rhbz1854784-powerpc-remove-region-limit-dawr-6of7.patch
|
||||
|
||||
# Backport "PowerPC remove 512 bytes region limit if 2nd DAWR is available."
|
||||
# (Rogerio Alves, RH BZ 1854784)
|
||||
Patch192: gdb-rhbz1854784-powerpc-remove-region-limit-dawr-7of7.patch
|
||||
|
||||
# IBM Z: Add support for HLASM extended mnemonics
|
||||
# (Andreas Krebbel, RHBZ 2012818)
|
||||
Patch193: gdb-rhbz2012818-ibmz-update-1of5.patch
|
||||
|
||||
# IBM Z: Add risbgz and risbgnz extended mnemonics
|
||||
# (Andreas Krebbel, RHBZ 2012818)
|
||||
Patch194: gdb-rhbz2012818-ibmz-update-2of5.patch
|
||||
|
||||
# IBM Z: Implement instruction set extensions
|
||||
# (Andreas Krebbel, RHBZ 2012818)
|
||||
Patch195: gdb-rhbz2012818-ibmz-update-3of5.patch
|
||||
|
||||
# IBM Z: Remove lpswey parameter
|
||||
# (Andreas Krebbel, RHBZ 2012818)
|
||||
Patch196: gdb-rhbz2012818-ibmz-update-4of5.patch
|
||||
|
||||
# IBM Z: Add another arch14 instruction
|
||||
# (Andreas Krebbel, RHBZ 2012818)
|
||||
Patch197: gdb-rhbz2012818-ibmz-update-5of5.patch
|
||||
|
||||
# Backport gdb/20948 (--write option to GDB causes segfault)
|
||||
# (Jozef Lawrynowicz, RHBZ 2018504)
|
||||
Patch198: gdb-rhbz2018504-do-not-update-elf-headers.patch
|
||||
|
||||
# Fix restoring of inferior terminal settings
|
||||
# (Simon Marchi, RHBZ 2015131)
|
||||
Patch199: gdb-rhbz2015131-restore-inferior-terminal-1of2.patch
|
||||
|
||||
# Avoid GDB SIGTTOU on catch exec + set follow-exec-mode new (PR 23368)
|
||||
# (Simon Marchi, related to RHBZ 2015131)
|
||||
Patch200: gdb-rhbz2015131-avoid-sigttou-forks-2of2.patch
|
||||
|
||||
# Change assertion to warning in dw2_find_pc_sect_compunit_symtab
|
||||
# Based on "Fix crash in new DWARF indexer"
|
||||
# (Tom Tromey, RHBZ 2150363)
|
||||
Patch201: gdb-rhbz2150363-warn-dw2_find_pc_sect_compunit_symtab.patch
|
||||
|
||||
# Backport "Fix assertion failure in copy_type"
|
||||
# (Tom Tromey, RHBZ 2156888)
|
||||
Patch202: gdb-rhbz2156888-copy_type-assertion-1of2.patch
|
||||
|
||||
# Backport of "Fix PR20630 regression test in gdb.base/printcmds.exp"
|
||||
# (Tom deVries, RHBZ 2156888)
|
||||
Patch203: gdb-rhbz2156888-copy_type-assertion-2of2.patch
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Andrew Cagney <cagney@gnu.org>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-6.3-ppc64displaysymbol-20041124.patch
|
||||
|
||||
;; Include the pc's section when doing a symbol lookup so that the
|
||||
;; correct symbol is found.
|
||||
;;=push: Write new testcase.
|
||||
|
||||
2004-11-24 Andrew Cagney <cagney@gnu.org>
|
||||
|
||||
* printcmd.c (build_address_symbolic): Find a section for the
|
||||
address.
|
||||
|
||||
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
|
||||
--- a/gdb/printcmd.c
|
||||
+++ b/gdb/printcmd.c
|
||||
@@ -587,6 +587,14 @@ build_address_symbolic (struct gdbarch *gdbarch,
|
||||
addr = overlay_mapped_address (addr, section);
|
||||
}
|
||||
}
|
||||
+ /* To ensure that the symbol returned belongs to the correct setion
|
||||
+ (and that the last [random] symbol from the previous section
|
||||
+ isn't returned) try to find the section containing PC. First try
|
||||
+ the overlay code (which by default returns NULL); and second try
|
||||
+ the normal section code (which almost always succeeds). */
|
||||
+ section = find_pc_overlay (addr);
|
||||
+ if (section == NULL)
|
||||
+ section = find_pc_section (addr);
|
||||
|
||||
/* First try to find the address in the symbol table, then
|
||||
in the minsyms. Take the closest one. */
|
|
@ -1,118 +0,0 @@
|
|||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Andrew Cagney <cagney@gnu.org>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-6.3-ppc64syscall-20040622.patch
|
||||
|
||||
;; Better parse 64-bit PPC system call prologues.
|
||||
;;=push: Write new testcase.
|
||||
|
||||
2004-06-22 Andrew Cagney <cagney@gnu.org>
|
||||
|
||||
* rs6000-tdep.c (struct rs6000_framedata): Add field "func_start".
|
||||
(skip_prologue): Delete local variable "orig_pc", use
|
||||
"func_start". Add local variable "num_skip_linux_syscall_insn",
|
||||
use to skip over first half of a GNU/Linux syscall and update
|
||||
"func_start".
|
||||
|
||||
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
|
||||
--- a/gdb/rs6000-tdep.c
|
||||
+++ b/gdb/rs6000-tdep.c
|
||||
@@ -134,6 +134,7 @@ static const char *powerpc_vector_abi_string = "auto";
|
||||
|
||||
struct rs6000_framedata
|
||||
{
|
||||
+ CORE_ADDR func_start; /* True function start. */
|
||||
int offset; /* total size of frame --- the distance
|
||||
by which we decrement sp to allocate
|
||||
the frame */
|
||||
@@ -1426,7 +1427,6 @@ static CORE_ADDR
|
||||
skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR lim_pc,
|
||||
struct rs6000_framedata *fdata)
|
||||
{
|
||||
- CORE_ADDR orig_pc = pc;
|
||||
CORE_ADDR last_prologue_pc = pc;
|
||||
CORE_ADDR li_found_pc = 0;
|
||||
gdb_byte buf[4];
|
||||
@@ -1445,12 +1445,14 @@ skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR lim_pc,
|
||||
int minimal_toc_loaded = 0;
|
||||
int prev_insn_was_prologue_insn = 1;
|
||||
int num_skip_non_prologue_insns = 0;
|
||||
+ int num_skip_ppc64_gnu_linux_syscall_insn = 0;
|
||||
int r0_contains_arg = 0;
|
||||
const struct bfd_arch_info *arch_info = gdbarch_bfd_arch_info (gdbarch);
|
||||
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
|
||||
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
|
||||
|
||||
memset (fdata, 0, sizeof (struct rs6000_framedata));
|
||||
+ fdata->func_start = pc;
|
||||
fdata->saved_gpr = -1;
|
||||
fdata->saved_fpr = -1;
|
||||
fdata->saved_vr = -1;
|
||||
@@ -1484,6 +1486,55 @@ skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR lim_pc,
|
||||
break;
|
||||
op = extract_unsigned_integer (buf, 4, byte_order);
|
||||
|
||||
+ /* A PPC64 GNU/Linux system call function is split into two
|
||||
+ sub-functions: a non-threaded fast-path (__NAME_nocancel)
|
||||
+ which does not use a frame; and a threaded slow-path
|
||||
+ (Lpseudo_cancel) that does create a frame. Ref:
|
||||
+ nptl/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h
|
||||
+
|
||||
+ *INDENT-OFF*
|
||||
+ NAME:
|
||||
+ SINGLE_THREAD_P
|
||||
+ bne- .Lpseudo_cancel
|
||||
+ __NAME_nocancel:
|
||||
+ li r0,162
|
||||
+ sc
|
||||
+ bnslr+
|
||||
+ b 0x7fe014ef64 <.__syscall_error>
|
||||
+ Lpseudo_cancel:
|
||||
+ stdu r1,-128(r1)
|
||||
+ ...
|
||||
+ *INDENT-ON*
|
||||
+
|
||||
+ Unfortunatly, because the latter case uses a local label (not
|
||||
+ in the symbol table) a PC in "Lpseudo_cancel" appears to be
|
||||
+ in "__NAME_nocancel". The following code recognizes this,
|
||||
+ adjusting FUNC_START to point to where "Lpseudo_cancel"
|
||||
+ should be, and parsing the prologue sequence as if
|
||||
+ "Lpseudo_cancel" was the entry point. */
|
||||
+
|
||||
+ if (((op & 0xffff0000) == 0x38000000 /* li r0,N */
|
||||
+ && pc == fdata->func_start + 0
|
||||
+ && num_skip_ppc64_gnu_linux_syscall_insn == 0)
|
||||
+ || (op == 0x44000002 /* sc */
|
||||
+ && pc == fdata->func_start + 4
|
||||
+ && num_skip_ppc64_gnu_linux_syscall_insn == 1)
|
||||
+ || (op == 0x4ca30020 /* bnslr+ */
|
||||
+ && pc == fdata->func_start + 8
|
||||
+ && num_skip_ppc64_gnu_linux_syscall_insn == 2))
|
||||
+ {
|
||||
+ num_skip_ppc64_gnu_linux_syscall_insn++;
|
||||
+ continue;
|
||||
+ }
|
||||
+ else if ((op & 0xfc000003) == 0x48000000 /* b __syscall_error */
|
||||
+ && pc == fdata->func_start + 12
|
||||
+ && num_skip_ppc64_gnu_linux_syscall_insn == 3)
|
||||
+ {
|
||||
+ num_skip_ppc64_gnu_linux_syscall_insn = -1;
|
||||
+ fdata->func_start = pc;
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
if ((op & 0xfc1fffff) == 0x7c0802a6)
|
||||
{ /* mflr Rx */
|
||||
/* Since shared library / PIC code, which needs to get its
|
||||
@@ -1673,9 +1724,9 @@ skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR lim_pc,
|
||||
we have no line table information or the line info tells
|
||||
us that the subroutine call is not part of the line
|
||||
associated with the prologue. */
|
||||
- if ((pc - orig_pc) > 8)
|
||||
+ if ((pc - fdata->func_start) > 8)
|
||||
{
|
||||
- struct symtab_and_line prologue_sal = find_pc_line (orig_pc, 0);
|
||||
+ struct symtab_and_line prologue_sal = find_pc_line (fdata->func_start, 0);
|
||||
struct symtab_and_line this_sal = find_pc_line (pc, 0);
|
||||
|
||||
if ((prologue_sal.line == 0)
|
|
@ -1,35 +0,0 @@
|
|||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Andrew Cagney <cagney@gnu.org>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-6.3-readnever-20050907.patch
|
||||
|
||||
;; Add readnever option
|
||||
;;=push
|
||||
|
||||
2004-11-18 Andrew Cagney <cagney@gnu.org>
|
||||
|
||||
* dwarf2read.c: Include "top.c".
|
||||
(dwarf2_has_info): Check for readnever_symbol_files.
|
||||
* symfile.c (readnever_symbol_files): Define.
|
||||
* top.h (readnever_symbol_files): Declare.
|
||||
* main.c (captured_main): Add --readnever option.
|
||||
(print_gdb_help): Ditto.
|
||||
|
||||
2004-11-18 Andrew Cagney <cagney@gnu.org>
|
||||
|
||||
* gdb.texinfo (File Options): Document --readnever.
|
||||
|
||||
Pushed upstream: https://sourceware.org/ml/gdb-cvs/2017-12/msg00007.html
|
||||
|
||||
diff --git a/gdb/gcore.in b/gdb/gcore.in
|
||||
--- a/gdb/gcore.in
|
||||
+++ b/gdb/gcore.in
|
||||
@@ -97,7 +97,7 @@ for pid in "$@"
|
||||
do
|
||||
# `</dev/null' to avoid touching interactive terminal if it is
|
||||
# available but not accessible as GDB would get stopped on SIGTTIN.
|
||||
- "$binary_path/@GDB_TRANSFORM_NAME@" </dev/null --nx --batch \
|
||||
+ "$binary_path/@GDB_TRANSFORM_NAME@" </dev/null --nx --batch --readnever \
|
||||
-ex "set pagination off" -ex "set height 0" -ex "set width 0" \
|
||||
"${dump_all_cmds[@]}" \
|
||||
-ex "attach $pid" -ex "gcore $name.$pid" -ex detach -ex quit
|
File diff suppressed because it is too large
Load Diff
|
@ -1,42 +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-test-self-20050110.patch
|
||||
|
||||
;; Get selftest working with sep-debug-info
|
||||
;;=fedoratest
|
||||
|
||||
2004-02-23 Elena Zannoni <ezannoni@redhat.com>
|
||||
|
||||
* gdb.gdb/selftest.exp: Make sure that the debug directory is
|
||||
set up properly.
|
||||
* gdb.gdb/complaints.exp: Ditto.
|
||||
* gdb.gdb/xfullpath.exp: Ditto.
|
||||
* gdb.gdb/observer.exp: Ditto.
|
||||
|
||||
diff --git a/gdb/testsuite/lib/selftest-support.exp b/gdb/testsuite/lib/selftest-support.exp
|
||||
--- a/gdb/testsuite/lib/selftest-support.exp
|
||||
+++ b/gdb/testsuite/lib/selftest-support.exp
|
||||
@@ -151,18 +151,18 @@ proc do_self_tests {function body} {
|
||||
}
|
||||
|
||||
# Remove any old copy lying around.
|
||||
- remote_file host delete $xgdb
|
||||
+ #remote_file host delete $xgdb
|
||||
|
||||
gdb_start
|
||||
- set file [remote_download host $GDB_FULLPATH $xgdb]
|
||||
+ #set file [remote_download host $GDB_FULLPATH $xgdb]
|
||||
|
||||
- set result [selftest_setup $file $function]
|
||||
+ set result [selftest_setup $GDB_FULLPATH $function]
|
||||
if {$result == 0} then {
|
||||
set result [uplevel $body]
|
||||
}
|
||||
|
||||
gdb_exit
|
||||
- catch "remote_file host delete $file"
|
||||
+ #catch "remote_file host delete $file"
|
||||
|
||||
if {$result < 0} then {
|
||||
warning "Couldn't test self"
|
|
@ -1,24 +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.5-bz203661-emit-relocs.patch
|
||||
|
||||
;; Fix debuginfo addresses resolving for --emit-relocs Linux kernels (BZ 203661).
|
||||
;;=push+jan: There was some mail thread about it, this patch may be a hack.
|
||||
|
||||
diff --git a/gdb/symfile.c b/gdb/symfile.c
|
||||
--- a/gdb/symfile.c
|
||||
+++ b/gdb/symfile.c
|
||||
@@ -3584,6 +3584,12 @@ default_symfile_relocate (struct objfile *objfile, asection *sectp,
|
||||
DWO file. */
|
||||
bfd *abfd = sectp->owner;
|
||||
|
||||
+ /* Executable files have all the relocations already resolved.
|
||||
+ Handle files linked with --emit-relocs.
|
||||
+ http://sources.redhat.com/ml/gdb/2006-08/msg00137.html */
|
||||
+ if ((abfd->flags & EXEC_P) != 0)
|
||||
+ return NULL;
|
||||
+
|
||||
/* We're only interested in sections with relocation
|
||||
information. */
|
||||
if ((sectp->flags & SEC_RELOC) == 0)
|
|
@ -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
|
||||
@@ -2595,6 +2595,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;
|
||||
@@ -2603,6 +2604,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;
|
||||
}
|
||||
|
||||
@@ -2737,6 +2742,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));
|
||||
@@ -2745,6 +2751,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
|
||||
@@ -8406,6 +8406,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"
|
||||
+ }
|
||||
+}
|
|
@ -1,102 +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.5-bz218379-ppc-solib-trampoline-test.patch
|
||||
|
||||
;; Test sideeffects of skipping ppc .so libs trampolines (BZ 218379).
|
||||
;;=fedoratest
|
||||
|
||||
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=218379
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/step-over-trampoline.c b/gdb/testsuite/gdb.base/step-over-trampoline.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/step-over-trampoline.c
|
||||
@@ -0,0 +1,28 @@
|
||||
+/* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
+
|
||||
+ Please email any bugs, comments, and/or additions to this file to:
|
||||
+ bug-gdb@prep.ai.mit.edu */
|
||||
+
|
||||
+#include <stdio.h>
|
||||
+
|
||||
+int main (void)
|
||||
+{
|
||||
+ puts ("hello world");
|
||||
+ return 0;
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.base/step-over-trampoline.exp b/gdb/testsuite/gdb.base/step-over-trampoline.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/step-over-trampoline.exp
|
||||
@@ -0,0 +1,54 @@
|
||||
+# 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.
|
||||
+
|
||||
+if $tracelevel then {
|
||||
+ strace $tracelevel
|
||||
+}
|
||||
+
|
||||
+set testfile step-over-trampoline
|
||||
+set srcfile ${testfile}.c
|
||||
+set binfile [standard_output_file ${testfile}]
|
||||
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
|
||||
+ untested "Couldn't compile test program"
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+# Get things started.
|
||||
+
|
||||
+gdb_exit
|
||||
+gdb_start
|
||||
+gdb_reinitialize_dir $srcdir/$subdir
|
||||
+gdb_load ${binfile}
|
||||
+
|
||||
+# For C programs, "start" should stop in main().
|
||||
+
|
||||
+gdb_test "start" \
|
||||
+ "main \\(\\) at .*$srcfile.*" \
|
||||
+ "start"
|
||||
+
|
||||
+# main () at hello2.c:5
|
||||
+# 5 puts("hello world\n");
|
||||
+# (gdb) next
|
||||
+# 0x100007e0 in call___do_global_ctors_aux ()
|
||||
+
|
||||
+gdb_test_multiple "next" "invalid `next' output" {
|
||||
+ -re "\nhello world.*return 0;.*" {
|
||||
+ pass "stepped over"
|
||||
+ }
|
||||
+ -re " in call___do_global_ctors_aux \\(\\).*" {
|
||||
+ fail "stepped into trampoline"
|
||||
+ }
|
||||
+}
|
|
@ -1,141 +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.5-readline-long-line-crash-test.patch
|
||||
|
||||
;; Fix readline segfault on excessively long hand-typed lines.
|
||||
;;=fedoratest
|
||||
|
||||
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=214196
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/readline-overflow.exp b/gdb/testsuite/gdb.base/readline-overflow.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/readline-overflow.exp
|
||||
@@ -0,0 +1,126 @@
|
||||
+# 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.
|
||||
+
|
||||
+# Please email any bugs, comments, and/or additions to this file to:
|
||||
+# bug-gdb@prep.ai.mit.edu
|
||||
+
|
||||
+# This file was written by Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
+
|
||||
+# This file is part of the gdb testsuite.
|
||||
+
|
||||
+#
|
||||
+# Tests for readline buffer overflow.
|
||||
+#
|
||||
+
|
||||
+if $tracelevel {
|
||||
+ strace $tracelevel
|
||||
+}
|
||||
+
|
||||
+# Don't let a .inputrc file or an existing setting of INPUTRC mess up
|
||||
+# the test results. Even if /dev/null doesn't exist on the particular
|
||||
+# platform, the readline library will use the default setting just by
|
||||
+# failing to open the file. OTOH, opening /dev/null successfully will
|
||||
+# also result in the default settings being used since nothing will be
|
||||
+# read from this file.
|
||||
+global env
|
||||
+if [info exists env(INPUTRC)] {
|
||||
+ set old_inputrc $env(INPUTRC)
|
||||
+}
|
||||
+set env(INPUTRC) "/dev/null"
|
||||
+
|
||||
+set oldtimeout1 $timeout
|
||||
+set timeout 600
|
||||
+
|
||||
+if [info exists env(GDBHISTFILE)] {
|
||||
+ set old_gdbhistfile $env(GDBHISTFILE)
|
||||
+}
|
||||
+if [info exists env(HISTSIZE)] {
|
||||
+ set old_histsize $env(HISTSIZE)
|
||||
+}
|
||||
+set env(GDBHISTFILE) "${srcdir}/${subdir}/gdb_history"
|
||||
+set env(HISTSIZE) "10"
|
||||
+
|
||||
+gdb_exit
|
||||
+gdb_start
|
||||
+gdb_reinitialize_dir $srcdir/$subdir
|
||||
+
|
||||
+
|
||||
+set width 11
|
||||
+gdb_test "set width $width" \
|
||||
+ "" \
|
||||
+ "Setting width to $width."
|
||||
+#gdb_test "set height 1" \
|
||||
+# "" \
|
||||
+# "Setting height to 1."
|
||||
+send_gdb "run X"
|
||||
+set i 0
|
||||
+# It crashes using `set width 7' on `set total 3560'.
|
||||
+# Sometimes it corrupts screen on `set width 7'.
|
||||
+# Bugreport used `set total 130001':
|
||||
+# https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=214196
|
||||
+# Check also `timeout' above.
|
||||
+set total 4200
|
||||
+gdb_expect {
|
||||
+ -re X {
|
||||
+ incr i
|
||||
+ if {$i <= $total} {
|
||||
+ send_gdb "X"
|
||||
+ exp_continue
|
||||
+ }
|
||||
+ }
|
||||
+ -re "\[ \b\r\n\]" {
|
||||
+ exp_continue
|
||||
+ }
|
||||
+ eof {
|
||||
+ fail "gdb sending total $total characters"
|
||||
+ note "Failed after sending $i characters, reason: EOF"
|
||||
+ gdb_clear_suppressed
|
||||
+ }
|
||||
+ timeout {
|
||||
+ fail "gdb sending total $total characters"
|
||||
+ note "Failed after sending $i characters (timeout $timeout), reason: TIMEOUT"
|
||||
+ gdb_clear_suppressed
|
||||
+ }
|
||||
+ default {
|
||||
+ fail "gdb sending total $total characters"
|
||||
+ note "Failed after sending $i characters, reason: 0=\[$expect_out(0,string)\] buffer=\[$expect_out(buffer)\]"
|
||||
+ gdb_clear_suppressed
|
||||
+ }
|
||||
+}
|
||||
+send_gdb "\r"
|
||||
+gdb_test "" \
|
||||
+ "No executable file specified..*" \
|
||||
+ "All the characters transferred"
|
||||
+
|
||||
+
|
||||
+# Restore globals modified in this test...
|
||||
+if [info exists old_inputrc] {
|
||||
+ set env(INPUTRC) $old_inputrc
|
||||
+} else {
|
||||
+ unset env(INPUTRC)
|
||||
+}
|
||||
+if [info exists old_gdbhistfile] {
|
||||
+ set env(GDBHISTFILE) $old_gdbhistfile
|
||||
+} else {
|
||||
+ unset env(GDBHISTFILE)
|
||||
+}
|
||||
+if [info exists old_histsize] {
|
||||
+ set env(HISTSIZE) $old_histsize
|
||||
+} else {
|
||||
+ unset env(HISTSIZE)
|
||||
+}
|
||||
+set timeout $oldtimeout1
|
||||
+
|
|
@ -1,197 +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-core-as-arg.patch
|
||||
|
||||
;;=push+jan
|
||||
|
||||
http://sourceware.org/ml/gdb-patches/2010-01/msg00558.html
|
||||
|
||||
[ Fixed up since the mail. ]
|
||||
|
||||
On Thu, 21 Jan 2010 18:17:15 +0100, Doug Evans wrote:
|
||||
> Not an exhaustive list, but if we go down the path of converting "gdb
|
||||
> corefile" to "gdb -c corefile", then we also need to think about "file
|
||||
> corefile" being converted to "core corefile" [or "target core
|
||||
> corefile", "core" is apparently deprecated in favor of "target core"]
|
||||
> and "target exec corefile" -> "target core corefile". Presumably
|
||||
> "file corefile" (and "target exec corefile") would discard the
|
||||
> currently selected executable. But maybe not. Will that be confusing
|
||||
> for users? I don't know.
|
||||
|
||||
While thinking about it overriding some GDB _commands_ was not my intention.
|
||||
|
||||
There is a general assumption if I have a shell COMMAND and some FILE I can do
|
||||
$ COMMAND FILE
|
||||
and COMMAND will appropriately load the FILE.
|
||||
|
||||
FSF GDB currently needs to specify also the executable file for core files
|
||||
which already inhibits this intuitive expectation. OTOH with the build-id
|
||||
locating patch which could allow such intuitive start notneeding the
|
||||
executable file. Still it currently did not work due to the required "-c":
|
||||
$ COMMAND -c COREFILE
|
||||
|
||||
Entering "file", "core-file" or "attach" commands is already explicit enough
|
||||
so that it IMO should do what the command name says without any
|
||||
autodetections. The second command line argument
|
||||
(captured_main->pid_or_core_arg) is also autodetected (for PID or CORE) but
|
||||
neither "attach" accepts a core file nor "core-file" accepts a PID.
|
||||
|
||||
The patch makes sense only with the build-id patchset so this is not submit
|
||||
for FSF GDB inclusion yet. I am fine with your patch (+/- Hui Zhu's pending
|
||||
bfd_check_format_matches) as the patch below is its natural extension.
|
||||
|
||||
Sorry for the delay,
|
||||
Jan
|
||||
|
||||
2010-01-25 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* exceptions.h (enum errors <IS_CORE_ERROR>): New.
|
||||
* exec.c: Include exceptions.h.
|
||||
(exec_file_attach <bfd_core>): Call throw_error (IS_CORE_ERROR, ...).
|
||||
* main.c (exec_or_core_file_attach): New.
|
||||
(captured_main <optind < argc>): Set also corearg.
|
||||
(captured_main <strcmp (execarg, symarg) == 0>): New variable func.
|
||||
Call exec_or_core_file_attach if COREARG matches EXECARG. Call
|
||||
symbol_file_add_main only if CORE_BFD remained NULL.
|
||||
|
||||
Http://sourceware.org/ml/gdb-patches/2010-01/msg00517.html
|
||||
2010-01-20 Doug Evans <dje@google.com>
|
||||
|
||||
* 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"
|
||||
|
||||
#include <fcntl.h>
|
||||
#include "readline/readline.h"
|
||||
@@ -357,12 +358,27 @@ exec_file_attach (const char *filename, int from_tty)
|
||||
|
||||
if (!bfd_check_format_matches (exec_bfd, bfd_object, &matching))
|
||||
{
|
||||
+ int is_core;
|
||||
+
|
||||
+ /* If the user accidentally did "gdb core", print a useful
|
||||
+ error message. Check it only after bfd_object has been checked as
|
||||
+ a valid executable may get recognized for example also as
|
||||
+ "trad-core". */
|
||||
+ is_core = bfd_check_format (exec_bfd, bfd_core);
|
||||
+
|
||||
/* Make sure to close exec_bfd, or else "run" might try to use
|
||||
it. */
|
||||
exec_close ();
|
||||
- error (_("\"%s\": not in executable format: %s"),
|
||||
- scratch_pathname,
|
||||
- gdb_bfd_errmsg (bfd_get_error (), matching));
|
||||
+
|
||||
+ if (is_core != 0)
|
||||
+ throw_error (IS_CORE_ERROR,
|
||||
+ _("\"%s\" is a core file.\n"
|
||||
+ "Please specify an executable to debug."),
|
||||
+ scratch_pathname);
|
||||
+ else
|
||||
+ error (_("\"%s\": not in executable format: %s"),
|
||||
+ scratch_pathname,
|
||||
+ gdb_bfd_errmsg (bfd_get_error (), matching));
|
||||
}
|
||||
|
||||
if (build_section_table (exec_bfd, §ions, §ions_end))
|
||||
diff --git a/gdb/main.c b/gdb/main.c
|
||||
--- a/gdb/main.c
|
||||
+++ b/gdb/main.c
|
||||
@@ -447,6 +447,37 @@ struct cmdarg
|
||||
char *string;
|
||||
};
|
||||
|
||||
+/* Call exec_file_attach. If it detected FILENAME is a core file call
|
||||
+ core_file_command. Print the original exec_file_attach error only if
|
||||
+ core_file_command failed to find a matching executable. */
|
||||
+
|
||||
+static void
|
||||
+exec_or_core_file_attach (const char *filename, int from_tty)
|
||||
+{
|
||||
+ volatile struct gdb_exception e;
|
||||
+
|
||||
+ gdb_assert (exec_bfd == NULL);
|
||||
+
|
||||
+ TRY
|
||||
+ {
|
||||
+ exec_file_attach (filename, from_tty);
|
||||
+ }
|
||||
+ CATCH (e, RETURN_MASK_ALL)
|
||||
+ {
|
||||
+ if (e.error == IS_CORE_ERROR)
|
||||
+ {
|
||||
+ core_file_command ((char *) filename, from_tty);
|
||||
+
|
||||
+ /* Iff the core file found its executable suppress the error message
|
||||
+ from exec_file_attach. */
|
||||
+ if (exec_bfd != NULL)
|
||||
+ return;
|
||||
+ }
|
||||
+ throw_exception (e);
|
||||
+ }
|
||||
+ END_CATCH
|
||||
+}
|
||||
+
|
||||
static void
|
||||
captured_main_1 (struct captured_main_args *context)
|
||||
{
|
||||
@@ -883,6 +914,8 @@ captured_main_1 (struct captured_main_args *context)
|
||||
{
|
||||
symarg = argv[optind];
|
||||
execarg = argv[optind];
|
||||
+ if (optind + 1 == argc && corearg == NULL)
|
||||
+ corearg = argv[optind];
|
||||
optind++;
|
||||
}
|
||||
|
||||
@@ -1033,11 +1066,25 @@ captured_main_1 (struct captured_main_args *context)
|
||||
&& symarg != NULL
|
||||
&& strcmp (execarg, symarg) == 0)
|
||||
{
|
||||
+ catch_command_errors_const_ftype *func;
|
||||
+
|
||||
+ /* Call exec_or_core_file_attach only if the file was specified as
|
||||
+ a command line argument (and not an a command line option). */
|
||||
+ if (corearg != NULL && strcmp (corearg, execarg) == 0)
|
||||
+ {
|
||||
+ func = exec_or_core_file_attach;
|
||||
+ corearg = NULL;
|
||||
+ }
|
||||
+ else
|
||||
+ func = exec_file_attach;
|
||||
+
|
||||
/* The exec file and the symbol-file are the same. If we can't
|
||||
open it, better only print one error message.
|
||||
- catch_command_errors returns non-zero on success! */
|
||||
- if (catch_command_errors (exec_file_attach, execarg,
|
||||
- !batch_flag))
|
||||
+ catch_command_errors returns non-zero on success!
|
||||
+ Do not load EXECARG as a symbol file if it has been already processed
|
||||
+ as a core file. */
|
||||
+ if (catch_command_errors (func, execarg, !batch_flag)
|
||||
+ && core_bfd == NULL)
|
||||
catch_command_errors (symbol_file_add_main_adapter, symarg,
|
||||
!batch_flag);
|
||||
}
|
|
@ -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
|
||||
@@ -2193,7 +2193,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 {
|
|
@ -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
|
||||
@@ -1104,6 +1104,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
|
||||
@@ -1113,8 +1115,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."));
|
||||
|
|
@ -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.8-quit-never-aborts.patch
|
||||
|
||||
;; Make the GDB quit processing non-abortable to cleanup everything properly.
|
||||
;;=fedora: It was useful only after gdb-6.8-attach-signalled-detach-stopped.patch .
|
||||
|
||||
We may abort the process of detaching threads with multiple SIGINTs - which are
|
||||
being sent during a testcase terminating its child GDB.
|
||||
|
||||
Some of the threads may not be properly PTRACE_DETACHed which hurts if they
|
||||
should have been detached with SIGSTOP (as they are accidentally left running
|
||||
on the debugger termination).
|
||||
|
||||
diff --git a/gdb/defs.h b/gdb/defs.h
|
||||
--- a/gdb/defs.h
|
||||
+++ b/gdb/defs.h
|
||||
@@ -168,6 +168,10 @@ extern void default_quit_handler (void);
|
||||
/* Flag that function quit should call quit_force. */
|
||||
extern volatile int sync_quit_force_run;
|
||||
|
||||
+#ifdef NEED_DETACH_SIGSTOP
|
||||
+extern int quit_flag_cleanup;
|
||||
+#endif
|
||||
+
|
||||
extern void quit (void);
|
||||
|
||||
/* Helper for the QUIT macro. */
|
||||
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)
|
||||
int i, result = 0;
|
||||
const struct extension_language_defn *extlang;
|
||||
|
||||
+#ifdef NEED_DETACH_SIGSTOP
|
||||
+ if (quit_flag_cleanup)
|
||||
+ return 0;
|
||||
+#endif
|
||||
+
|
||||
ALL_ENABLED_EXTENSION_LANGUAGES (i, extlang)
|
||||
{
|
||||
if (extlang->ops->check_quit_flag != NULL)
|
||||
diff --git a/gdb/top.c b/gdb/top.c
|
||||
--- a/gdb/top.c
|
||||
+++ b/gdb/top.c
|
||||
@@ -1606,7 +1606,13 @@ quit_force (int *exit_arg, int from_tty)
|
||||
|
||||
qt.from_tty = from_tty;
|
||||
|
||||
+#ifndef NEED_DETACH_SIGSTOP
|
||||
/* We want to handle any quit errors and exit regardless. */
|
||||
+#else
|
||||
+ /* We want to handle any quit errors and exit regardless but we should never
|
||||
+ get user-interrupted to properly detach the inferior. */
|
||||
+ quit_flag_cleanup = 1;
|
||||
+#endif
|
||||
|
||||
/* Get out of tfind mode, and kill or detach all inferiors. */
|
||||
TRY
|
||||
diff --git a/gdb/utils.c b/gdb/utils.c
|
||||
--- a/gdb/utils.c
|
||||
+++ b/gdb/utils.c
|
||||
@@ -108,6 +108,13 @@ static std::chrono::steady_clock::duration prompt_for_continue_wait_time;
|
||||
|
||||
static int debug_timestamp = 0;
|
||||
|
||||
+#ifdef NEED_DETACH_SIGSTOP
|
||||
+/* Nonzero means we are already processing the quitting cleanups and we should
|
||||
+ no longer get aborted. */
|
||||
+
|
||||
+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
|
||||
international character, and the terminal or window can cope.) */
|
|
@ -1,19 +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-sparc64-silence-memcpy-check.patch
|
||||
|
||||
;; Silence memcpy check which returns false positive (sparc64)
|
||||
;;=push: But it is just a GCC workaround, look up the existing GCC PR for it.
|
||||
|
||||
diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c
|
||||
--- a/gdb/sparc-tdep.c
|
||||
+++ b/gdb/sparc-tdep.c
|
||||
@@ -1462,6 +1462,7 @@ sparc32_store_return_value (struct type *type, struct regcache *regcache,
|
||||
if (sparc_floating_p (type) || sparc_complex_floating_p (type))
|
||||
{
|
||||
/* Floating return values. */
|
||||
+ len = (len <= 8) ? len : 8;
|
||||
memcpy (buf, valbuf, len);
|
||||
regcache->cooked_write (SPARC_F0_REGNUM, buf);
|
||||
if (len > 4)
|
|
@ -1,90 +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-watchpoint-conditionals-test.patch
|
||||
|
||||
;; Test the watchpoints conditionals works.
|
||||
;;=fedoratest
|
||||
|
||||
For:
|
||||
http://sourceware.org/ml/gdb-patches/2008-04/msg00379.html
|
||||
http://sourceware.org/ml/gdb-cvs/2008-04/msg00104.html
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/watchpoint-cond.c b/gdb/testsuite/gdb.base/watchpoint-cond.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/watchpoint-cond.c
|
||||
@@ -0,0 +1,31 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 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/>.
|
||||
+
|
||||
+ Please email any bugs, comments, and/or additions to this file to:
|
||||
+ bug-gdb@prep.ai.mit.edu */
|
||||
+
|
||||
+int
|
||||
+main (int argc, char **argv)
|
||||
+{
|
||||
+ static int i = 0; /* `static' to start initialized. */
|
||||
+ int j = 2;
|
||||
+
|
||||
+ for (j = 0; j < 30; j++)
|
||||
+ i = 30 - j;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.base/watchpoint-cond.exp b/gdb/testsuite/gdb.base/watchpoint-cond.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/watchpoint-cond.exp
|
||||
@@ -0,0 +1,37 @@
|
||||
+# Copyright 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/>.
|
||||
+
|
||||
+set testfile watchpoint-cond
|
||||
+set srcfile ${testfile}.c
|
||||
+set binfile [standard_output_file ${testfile}]
|
||||
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
|
||||
+ untested "Couldn't compile test program"
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+# Get things started.
|
||||
+
|
||||
+gdb_exit
|
||||
+gdb_start
|
||||
+gdb_reinitialize_dir $srcdir/$subdir
|
||||
+gdb_load ${binfile}
|
||||
+
|
||||
+if { [runto_main] < 0 } {
|
||||
+ untested watchpoint-cond
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+gdb_test "watch i if i < 20" "atchpoint \[0-9\]+: i"
|
||||
+gdb_test "cont" "atchpoint \[0-9\]+: i.*Old value = 20.*New value = 19.*"
|
|
@ -1,68 +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-7.2.50-sparc-add-workaround-to-broken-debug-files.patch
|
||||
|
||||
;; Toolchain on sparc is slightly broken and debuginfo files are generated
|
||||
;; with non 64bit aligned tables/offsets.
|
||||
;; See for example readelf -S ../Xvnc.debug.
|
||||
;;
|
||||
;; As a consenquence calculation of sectp->filepos as used in
|
||||
;; dwarf2_read_section (gdb/dwarf2read.c:1525) will return a non aligned buffer
|
||||
;; that cannot be used directly as done with MMAP.
|
||||
;; Usage will result in a BusError.
|
||||
;;
|
||||
;; While we figure out what's wrong in the toolchain and do a full archive
|
||||
;; rebuild to fix it, we need to be able to use gdb :)
|
||||
;;=push
|
||||
|
||||
diff --git a/gdb/gdb_bfd.c b/gdb/gdb_bfd.c
|
||||
--- a/gdb/gdb_bfd.c
|
||||
+++ b/gdb/gdb_bfd.c
|
||||
@@ -24,12 +24,14 @@
|
||||
#include "hashtab.h"
|
||||
#include "filestuff.h"
|
||||
#include "vec.h"
|
||||
+#ifndef __sparc__
|
||||
#ifdef HAVE_MMAP
|
||||
#include <sys/mman.h>
|
||||
#ifndef MAP_FAILED
|
||||
#define MAP_FAILED ((void *) -1)
|
||||
#endif
|
||||
#endif
|
||||
+#endif
|
||||
#include "target.h"
|
||||
#include "gdb/fileio.h"
|
||||
#include "inferior.h"
|
||||
@@ -484,6 +486,7 @@ free_one_bfd_section (bfd *abfd, asection *sectp, void *ignore)
|
||||
|
||||
if (sect != NULL && sect->data != NULL)
|
||||
{
|
||||
+#ifndef __sparc__
|
||||
#ifdef HAVE_MMAP
|
||||
if (sect->map_addr != NULL)
|
||||
{
|
||||
@@ -493,6 +496,7 @@ free_one_bfd_section (bfd *abfd, asection *sectp, void *ignore)
|
||||
gdb_assert (res == 0);
|
||||
}
|
||||
else
|
||||
+#endif
|
||||
#endif
|
||||
xfree (sect->data);
|
||||
}
|
||||
@@ -659,6 +663,7 @@ gdb_bfd_map_section (asection *sectp, bfd_size_type *size)
|
||||
if (descriptor->data != NULL)
|
||||
goto done;
|
||||
|
||||
+#ifndef __sparc__
|
||||
#ifdef HAVE_MMAP
|
||||
if (!bfd_is_section_compressed (abfd, sectp))
|
||||
{
|
||||
@@ -693,6 +698,7 @@ gdb_bfd_map_section (asection *sectp, bfd_size_type *size)
|
||||
}
|
||||
}
|
||||
#endif /* HAVE_MMAP */
|
||||
+#endif
|
||||
|
||||
/* Handle compressed sections, or ordinary uncompressed sections in
|
||||
the no-mmap case. */
|
|
@ -1,89 +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-archer-pie-addons-keep-disabled.patch
|
||||
|
||||
;;=push+jan: Breakpoints disabling matching should not be based on address.
|
||||
|
||||
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
|
||||
--- a/gdb/breakpoint.c
|
||||
+++ b/gdb/breakpoint.c
|
||||
@@ -15522,6 +15522,50 @@ initialize_breakpoint_ops (void)
|
||||
|
||||
static struct cmd_list_element *enablebreaklist = NULL;
|
||||
|
||||
+void
|
||||
+breakpoints_relocate (struct objfile *objfile, struct section_offsets *delta)
|
||||
+{
|
||||
+ struct bp_location *bl, **blp_tmp;
|
||||
+ int changed = 0;
|
||||
+
|
||||
+ gdb_assert (objfile->separate_debug_objfile_backlink == NULL);
|
||||
+
|
||||
+ ALL_BP_LOCATIONS (bl, blp_tmp)
|
||||
+ {
|
||||
+ struct obj_section *osect;
|
||||
+
|
||||
+ /* BL->SECTION can be correctly NULL for breakpoints with multiple
|
||||
+ locations expanded through symtab. */
|
||||
+
|
||||
+ ALL_OBJFILE_OSECTIONS (objfile, osect)
|
||||
+ {
|
||||
+ CORE_ADDR relocated_address;
|
||||
+ CORE_ADDR delta_offset;
|
||||
+
|
||||
+ delta_offset = ANOFFSET (delta, osect->the_bfd_section->index);
|
||||
+ if (delta_offset == 0)
|
||||
+ continue;
|
||||
+ relocated_address = bl->address + delta_offset;
|
||||
+
|
||||
+ if (obj_section_addr (osect) <= relocated_address
|
||||
+ && relocated_address < obj_section_endaddr (osect))
|
||||
+ {
|
||||
+ if (bl->inserted)
|
||||
+ remove_breakpoint (bl);
|
||||
+
|
||||
+ bl->address += delta_offset;
|
||||
+ bl->requested_address += delta_offset;
|
||||
+
|
||||
+ changed = 1;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (changed)
|
||||
+ qsort (bp_locations, bp_locations_count, sizeof (*bp_locations),
|
||||
+ bp_locations_compare);
|
||||
+}
|
||||
+
|
||||
void
|
||||
_initialize_breakpoint (void)
|
||||
{
|
||||
diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h
|
||||
--- a/gdb/breakpoint.h
|
||||
+++ b/gdb/breakpoint.h
|
||||
@@ -1679,6 +1679,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);
|
||||
|
||||
+extern void breakpoints_relocate (struct objfile *objfile,
|
||||
+ struct section_offsets *delta);
|
||||
+
|
||||
/* Print the specified breakpoint. */
|
||||
extern void print_breakpoint (breakpoint *bp);
|
||||
|
||||
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
|
||||
--- a/gdb/objfiles.c
|
||||
+++ b/gdb/objfiles.c
|
||||
@@ -883,6 +883,11 @@ objfile_relocate1 (struct objfile *objfile,
|
||||
obj_section_addr (s));
|
||||
}
|
||||
|
||||
+ /* Final call of breakpoint_re_set can keep breakpoint locations disabled if
|
||||
+ their addresses match. */
|
||||
+ if (objfile->separate_debug_objfile_backlink == NULL)
|
||||
+ breakpoints_relocate (objfile, delta);
|
||||
+
|
||||
/* Data changed. */
|
||||
return 1;
|
||||
}
|
|
@ -1,63 +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-archer-pie-addons.patch
|
||||
|
||||
;;=push+jan: May get obsoleted by Tom's unrelocated objfiles patch.
|
||||
|
||||
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
|
||||
--- a/gdb/gdbtypes.h
|
||||
+++ b/gdb/gdbtypes.h
|
||||
@@ -505,6 +505,7 @@ enum field_loc_kind
|
||||
{
|
||||
FIELD_LOC_KIND_BITPOS, /**< bitpos */
|
||||
FIELD_LOC_KIND_ENUMVAL, /**< enumval */
|
||||
+ /* This address is unrelocated by the objfile's ANOFFSET. */
|
||||
FIELD_LOC_KIND_PHYSADDR, /**< physaddr */
|
||||
FIELD_LOC_KIND_PHYSNAME, /**< physname */
|
||||
FIELD_LOC_KIND_DWARF_BLOCK /**< dwarf_block */
|
||||
@@ -556,6 +557,7 @@ union field_location
|
||||
field. Otherwise, physname is the mangled label of the
|
||||
static field. */
|
||||
|
||||
+ /* This address is unrelocated by the objfile's ANOFFSET. */
|
||||
CORE_ADDR physaddr;
|
||||
const char *physname;
|
||||
|
||||
@@ -1438,6 +1440,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)
|
||||
+/* This address is unrelocated by the objfile's ANOFFSET. */
|
||||
#define FIELD_STATIC_PHYSADDR(thisfld) ((thisfld).loc.physaddr)
|
||||
#define FIELD_DWARF_BLOCK(thisfld) ((thisfld).loc.dwarf_block)
|
||||
#define SET_FIELD_BITPOS(thisfld, bitpos) \
|
||||
@@ -1449,6 +1452,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))
|
||||
+/* This address is unrelocated by the objfile's ANOFFSET. */
|
||||
#define SET_FIELD_PHYSADDR(thisfld, addr) \
|
||||
(FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_PHYSADDR, \
|
||||
FIELD_STATIC_PHYSADDR (thisfld) = (addr))
|
||||
@@ -1465,6 +1469,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))
|
||||
+/* This address is unrelocated by the objfile's ANOFFSET. */
|
||||
#define TYPE_FIELD_STATIC_PHYSADDR(thistype, n) FIELD_STATIC_PHYSADDR (TYPE_FIELD (thistype, n))
|
||||
#define TYPE_FIELD_DWARF_BLOCK(thistype, n) FIELD_DWARF_BLOCK (TYPE_FIELD (thistype, n))
|
||||
#define TYPE_FIELD_ARTIFICIAL(thistype, n) FIELD_ARTIFICIAL(TYPE_FIELD(thistype,n))
|
||||
diff --git a/gdb/value.c b/gdb/value.c
|
||||
--- a/gdb/value.c
|
||||
+++ b/gdb/value.c
|
||||
@@ -2829,7 +2829,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)))));
|
||||
break;
|
||||
case FIELD_LOC_KIND_PHYSNAME:
|
||||
{
|
File diff suppressed because it is too large
Load Diff
|
@ -1,600 +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-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/Makefile.in b/gdb/Makefile.in
|
||||
--- a/gdb/Makefile.in
|
||||
+++ b/gdb/Makefile.in
|
||||
@@ -2112,6 +2112,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
|
||||
@@ -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,8 @@ 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
|
||||
@@ -1245,6 +1245,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
|
||||
@@ -88,8 +88,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
|
||||
@@ -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/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"
|
||||
@@ -479,7 +480,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;
|
||||
@@ -695,10 +696,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;
|
||||
|
||||
@@ -716,6 +721,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;
|
||||
@@ -890,7 +898,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
|
||||
@@ -1180,7 +1212,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)
|
||||
{
|
||||
@@ -1193,24 +1226,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. */
|
||||
}
|
||||
@@ -1253,6 +1299,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 (_("\
|
||||
@@ -1298,6 +1350,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
|
||||
+++ 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/python/python-internal.h b/gdb/python/python-internal.h
|
||||
--- a/gdb/python/python-internal.h
|
||||
+++ b/gdb/python/python-internal.h
|
||||
@@ -644,6 +644,9 @@ class gdbpy_enter_varobj : public gdbpy_enter
|
||||
|
||||
};
|
||||
|
||||
+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
|
||||
@@ -95,6 +95,8 @@ const struct extension_language_defn extension_language_python =
|
||||
#include "linespec.h"
|
||||
#include "source.h"
|
||||
#include "version.h"
|
||||
+#include "inferior.h"
|
||||
+#include "gdbthread.h"
|
||||
#include "target.h"
|
||||
#include "gdbthread.h"
|
||||
#include "interps.h"
|
||||
@@ -237,6 +239,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
|
||||
@@ -1367,6 +1392,92 @@ gdbpy_print_stack (void)
|
||||
|
||||
/* Return the current Progspace.
|
||||
There always is one. */
|
||||
+/* 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);
|
||||
+}
|
||||
+
|
||||
+
|
||||
+
|
||||
|
||||
static PyObject *
|
||||
gdbpy_get_current_progspace (PyObject *unused1, PyObject *unused2)
|
||||
@@ -2057,6 +2168,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,4 +25,6 @@
|
||||
/* This is all that python exports to gdb. */
|
||||
extern const struct extension_language_defn extension_language_python;
|
||||
|
||||
+extern void run_python_script (int argc, char **argv);
|
||||
+
|
||||
#endif /* GDB_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
|
||||
@@ -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
|
||||
@@ -384,6 +384,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.
|
||||
@@ -512,6 +521,7 @@ if ![runto_main] then {
|
||||
test_value_in_inferior
|
||||
test_inferior_function_call
|
||||
test_value_after_death
|
||||
+test_cast_regression
|
||||
|
||||
# Test either C or C++ values.
|
||||
|
||||
diff --git a/gdb/varobj.c b/gdb/varobj.c
|
||||
--- a/gdb/varobj.c
|
||||
+++ b/gdb/varobj.c
|
||||
@@ -218,6 +218,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);
|
||||
|
|
@ -1,357 +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-attach-fail-reasons-5of5.patch
|
||||
|
||||
;; Print reasons for failed attach/spawn incl. SELinux deny_ptrace (BZ 786878).
|
||||
;;=push+jan
|
||||
|
||||
http://sourceware.org/ml/gdb-patches/2012-03/msg00171.html
|
||||
|
||||
Hi,
|
||||
|
||||
and here is the last bit for new SELinux 'deny_ptrace':
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=786878
|
||||
|
||||
As even PTRACE_TRACEME fails in such case it needs to install hook for even
|
||||
that event.
|
||||
|
||||
Thanks,
|
||||
Jan
|
||||
|
||||
gdb/
|
||||
2012-03-06 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* common/linux-ptrace.c [HAVE_SELINUX_SELINUX_H]: include
|
||||
selinux/selinux.h.
|
||||
(linux_ptrace_attach_warnings): Call linux_ptrace_create_warnings.
|
||||
(linux_ptrace_create_warnings): New.
|
||||
* common/linux-ptrace.h (linux_ptrace_create_warnings): New declaration.
|
||||
* config.in: Regenerate.
|
||||
* configure: Regenerate.
|
||||
* configure.ac: Check selinux/selinux.h and the selinux library.
|
||||
* inf-ptrace.c (inf_ptrace_me): Check the ptrace result.
|
||||
* linux-nat.c (linux_nat_create_inferior): New variable ex. Wrap
|
||||
to_create_inferior into TRY_CATCH, call linux_ptrace_create_warnings.
|
||||
|
||||
gdb/gdbserver/
|
||||
* config.in: Regenerate.
|
||||
* configure: Regenerate.
|
||||
* configure.ac: Check selinux/selinux.h and the selinux library.
|
||||
* linux-low.c (linux_traceme): New function.
|
||||
(linux_create_inferior, linux_tracefork_child): Call it instead of
|
||||
direct ptrace.
|
||||
|
||||
diff --git a/gdb/config.in b/gdb/config.in
|
||||
--- a/gdb/config.in
|
||||
+++ b/gdb/config.in
|
||||
@@ -276,6 +276,9 @@
|
||||
/* Define if librpm library is being used. */
|
||||
#undef HAVE_LIBRPM
|
||||
|
||||
+/* Define to 1 if you have the `selinux' library (-lselinux). */
|
||||
+#undef HAVE_LIBSELINUX
|
||||
+
|
||||
/* Define to 1 if you have the <libunwind-ia64.h> header file. */
|
||||
#undef HAVE_LIBUNWIND_IA64_H
|
||||
|
||||
@@ -399,6 +402,9 @@
|
||||
/* Define to 1 if you have the `scm_new_smob' function. */
|
||||
#undef HAVE_SCM_NEW_SMOB
|
||||
|
||||
+/* Define to 1 if you have the <selinux/selinux.h> header file. */
|
||||
+#undef HAVE_SELINUX_SELINUX_H
|
||||
+
|
||||
/* Define to 1 if you have the `setlocale' function. */
|
||||
#undef HAVE_SETLOCALE
|
||||
|
||||
diff --git a/gdb/configure b/gdb/configure
|
||||
--- a/gdb/configure
|
||||
+++ b/gdb/configure
|
||||
@@ -15854,6 +15854,64 @@ cat >>confdefs.h <<_ACEOF
|
||||
_ACEOF
|
||||
|
||||
|
||||
+for ac_header in selinux/selinux.h
|
||||
+do :
|
||||
+ ac_fn_c_check_header_mongrel "$LINENO" "selinux/selinux.h" "ac_cv_header_selinux_selinux_h" "$ac_includes_default"
|
||||
+if test "x$ac_cv_header_selinux_selinux_h" = x""yes; then :
|
||||
+ cat >>confdefs.h <<_ACEOF
|
||||
+#define HAVE_SELINUX_SELINUX_H 1
|
||||
+_ACEOF
|
||||
+
|
||||
+fi
|
||||
+
|
||||
+done
|
||||
+
|
||||
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for security_get_boolean_active in -lselinux" >&5
|
||||
+$as_echo_n "checking for security_get_boolean_active in -lselinux... " >&6; }
|
||||
+if test "${ac_cv_lib_selinux_security_get_boolean_active+set}" = set; then :
|
||||
+ $as_echo_n "(cached) " >&6
|
||||
+else
|
||||
+ ac_check_lib_save_LIBS=$LIBS
|
||||
+LIBS="-lselinux $LIBS"
|
||||
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
+/* end confdefs.h. */
|
||||
+
|
||||
+/* Override any GCC internal prototype to avoid an error.
|
||||
+ Use char because int might match the return type of a GCC
|
||||
+ builtin and then its argument prototype would still apply. */
|
||||
+#ifdef __cplusplus
|
||||
+extern "C"
|
||||
+#endif
|
||||
+char security_get_boolean_active ();
|
||||
+int
|
||||
+main ()
|
||||
+{
|
||||
+return security_get_boolean_active ();
|
||||
+ ;
|
||||
+ return 0;
|
||||
+}
|
||||
+_ACEOF
|
||||
+if ac_fn_c_try_link "$LINENO"; then :
|
||||
+ ac_cv_lib_selinux_security_get_boolean_active=yes
|
||||
+else
|
||||
+ ac_cv_lib_selinux_security_get_boolean_active=no
|
||||
+fi
|
||||
+rm -f core conftest.err conftest.$ac_objext \
|
||||
+ conftest$ac_exeext conftest.$ac_ext
|
||||
+LIBS=$ac_check_lib_save_LIBS
|
||||
+fi
|
||||
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_selinux_security_get_boolean_active" >&5
|
||||
+$as_echo "$ac_cv_lib_selinux_security_get_boolean_active" >&6; }
|
||||
+if test "x$ac_cv_lib_selinux_security_get_boolean_active" = x""yes; then :
|
||||
+ cat >>confdefs.h <<_ACEOF
|
||||
+#define HAVE_LIBSELINUX 1
|
||||
+_ACEOF
|
||||
+
|
||||
+ LIBS="-lselinux $LIBS"
|
||||
+
|
||||
+fi
|
||||
+
|
||||
+
|
||||
|
||||
# Support for --with-sysroot is a copy of GDB_AC_WITH_DIR,
|
||||
# except that the argument to --with-sysroot is optional.
|
||||
diff --git a/gdb/configure.ac b/gdb/configure.ac
|
||||
--- a/gdb/configure.ac
|
||||
+++ b/gdb/configure.ac
|
||||
@@ -2054,6 +2054,10 @@ case $host_os in
|
||||
esac
|
||||
AC_DEFINE_UNQUOTED(GDBINIT,"$gdbinit",[The .gdbinit filename.])
|
||||
|
||||
+dnl Check security_get_boolean_active availability.
|
||||
+AC_CHECK_HEADERS(selinux/selinux.h)
|
||||
+AC_CHECK_LIB(selinux, security_get_boolean_active)
|
||||
+
|
||||
dnl Handle optional features that can be enabled.
|
||||
|
||||
# Support for --with-sysroot is a copy of GDB_AC_WITH_DIR,
|
||||
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
|
||||
|
||||
+/* Define to 1 if you have the `selinux' library (-lselinux). */
|
||||
+#undef HAVE_LIBSELINUX
|
||||
+
|
||||
/* Define if the target supports branch tracing. */
|
||||
#undef HAVE_LINUX_BTRACE
|
||||
|
||||
@@ -202,6 +205,9 @@
|
||||
/* Define to 1 if you have the `pwrite' function. */
|
||||
#undef HAVE_PWRITE
|
||||
|
||||
+/* Define to 1 if you have the <selinux/selinux.h> header file. */
|
||||
+#undef HAVE_SELINUX_SELINUX_H
|
||||
+
|
||||
/* Define to 1 if you have the `setns' function. */
|
||||
#undef HAVE_SETNS
|
||||
|
||||
diff --git a/gdb/gdbserver/configure b/gdb/gdbserver/configure
|
||||
--- a/gdb/gdbserver/configure
|
||||
+++ b/gdb/gdbserver/configure
|
||||
@@ -8535,6 +8535,64 @@ if $want_ipa ; then
|
||||
fi
|
||||
fi
|
||||
|
||||
+for ac_header in selinux/selinux.h
|
||||
+do :
|
||||
+ ac_fn_c_check_header_mongrel "$LINENO" "selinux/selinux.h" "ac_cv_header_selinux_selinux_h" "$ac_includes_default"
|
||||
+if test "x$ac_cv_header_selinux_selinux_h" = x""yes; then :
|
||||
+ cat >>confdefs.h <<_ACEOF
|
||||
+#define HAVE_SELINUX_SELINUX_H 1
|
||||
+_ACEOF
|
||||
+
|
||||
+fi
|
||||
+
|
||||
+done
|
||||
+
|
||||
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for security_get_boolean_active in -lselinux" >&5
|
||||
+$as_echo_n "checking for security_get_boolean_active in -lselinux... " >&6; }
|
||||
+if test "${ac_cv_lib_selinux_security_get_boolean_active+set}" = set; then :
|
||||
+ $as_echo_n "(cached) " >&6
|
||||
+else
|
||||
+ ac_check_lib_save_LIBS=$LIBS
|
||||
+LIBS="-lselinux $LIBS"
|
||||
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
+/* end confdefs.h. */
|
||||
+
|
||||
+/* Override any GCC internal prototype to avoid an error.
|
||||
+ Use char because int might match the return type of a GCC
|
||||
+ builtin and then its argument prototype would still apply. */
|
||||
+#ifdef __cplusplus
|
||||
+extern "C"
|
||||
+#endif
|
||||
+char security_get_boolean_active ();
|
||||
+int
|
||||
+main ()
|
||||
+{
|
||||
+return security_get_boolean_active ();
|
||||
+ ;
|
||||
+ return 0;
|
||||
+}
|
||||
+_ACEOF
|
||||
+if ac_fn_c_try_link "$LINENO"; then :
|
||||
+ ac_cv_lib_selinux_security_get_boolean_active=yes
|
||||
+else
|
||||
+ ac_cv_lib_selinux_security_get_boolean_active=no
|
||||
+fi
|
||||
+rm -f core conftest.err conftest.$ac_objext \
|
||||
+ conftest$ac_exeext conftest.$ac_ext
|
||||
+LIBS=$ac_check_lib_save_LIBS
|
||||
+fi
|
||||
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_selinux_security_get_boolean_active" >&5
|
||||
+$as_echo "$ac_cv_lib_selinux_security_get_boolean_active" >&6; }
|
||||
+if test "x$ac_cv_lib_selinux_security_get_boolean_active" = x""yes; then :
|
||||
+ cat >>confdefs.h <<_ACEOF
|
||||
+#define HAVE_LIBSELINUX 1
|
||||
+_ACEOF
|
||||
+
|
||||
+ LIBS="-lselinux $LIBS"
|
||||
+
|
||||
+fi
|
||||
+
|
||||
+
|
||||
|
||||
|
||||
|
||||
diff --git a/gdb/gdbserver/configure.ac b/gdb/gdbserver/configure.ac
|
||||
--- a/gdb/gdbserver/configure.ac
|
||||
+++ b/gdb/gdbserver/configure.ac
|
||||
@@ -486,6 +486,10 @@ if $want_ipa ; then
|
||||
fi
|
||||
fi
|
||||
|
||||
+dnl Check security_get_boolean_active availability.
|
||||
+AC_CHECK_HEADERS(selinux/selinux.h)
|
||||
+AC_CHECK_LIB(selinux, security_get_boolean_active)
|
||||
+
|
||||
AC_SUBST(GDBSERVER_DEPFILES)
|
||||
AC_SUBST(GDBSERVER_LIBS)
|
||||
AC_SUBST(srv_xmlbuiltin)
|
||||
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 ()
|
||||
{
|
||||
if (ptrace (PTRACE_TRACEME, 0, (PTRACE_TYPE_ARG3) 0,
|
||||
(PTRACE_TYPE_ARG4) 0) < 0)
|
||||
- trace_start_error_with_name ("ptrace");
|
||||
+ {
|
||||
+ int save_errno = errno;
|
||||
+
|
||||
+ std::string msg (linux_ptrace_create_warnings ());
|
||||
+
|
||||
+ msg += _("Cannot trace created process");
|
||||
+
|
||||
+ errno = save_errno;
|
||||
+ trace_start_error_with_name (msg.c_str ());
|
||||
+ }
|
||||
|
||||
if (setpgid (0, 0) < 0)
|
||||
trace_start_error_with_name ("setpgid");
|
||||
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
|
||||
--- a/gdb/linux-nat.c
|
||||
+++ b/gdb/linux-nat.c
|
||||
@@ -1089,7 +1089,17 @@ linux_nat_target::create_inferior (const char *exec_file,
|
||||
/* Make sure we report all signals during startup. */
|
||||
pass_signals (0, NULL);
|
||||
|
||||
- inf_ptrace_target::create_inferior (exec_file, allargs, env, from_tty);
|
||||
+ TRY
|
||||
+ {
|
||||
+ inf_ptrace_target::create_inferior (exec_file, allargs, env, from_tty);
|
||||
+ }
|
||||
+ CATCH (ex, RETURN_MASK_ERROR)
|
||||
+ {
|
||||
+ std::string result = linux_ptrace_create_warnings ();
|
||||
+
|
||||
+ throw_error (ex.error, "%s%s", result.c_str (), ex.message);
|
||||
+ }
|
||||
+ END_CATCH
|
||||
}
|
||||
|
||||
/* Callback for linux_proc_attach_tgid_threads. Attach to PTID if not
|
||||
diff --git a/gdb/nat/linux-ptrace.c b/gdb/nat/linux-ptrace.c
|
||||
--- a/gdb/nat/linux-ptrace.c
|
||||
+++ b/gdb/nat/linux-ptrace.c
|
||||
@@ -25,6 +25,10 @@
|
||||
#include <sys/procfs.h>
|
||||
#endif
|
||||
|
||||
+#ifdef HAVE_SELINUX_SELINUX_H
|
||||
+# include <selinux/selinux.h>
|
||||
+#endif /* HAVE_SELINUX_SELINUX_H */
|
||||
+
|
||||
/* Stores the ptrace options supported by the running kernel.
|
||||
A value of -1 means we did not check for features yet. A value
|
||||
of 0 means there are no supported features. */
|
||||
@@ -50,6 +54,8 @@ linux_ptrace_attach_fail_reason (pid_t pid)
|
||||
"terminated"),
|
||||
(int) pid);
|
||||
|
||||
+ result += linux_ptrace_create_warnings ();
|
||||
+
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -583,6 +589,25 @@ linux_ptrace_init_warnings (void)
|
||||
linux_ptrace_test_ret_to_nx ();
|
||||
}
|
||||
|
||||
+/* Print all possible reasons we could fail to create a traced process. */
|
||||
+
|
||||
+std::string
|
||||
+linux_ptrace_create_warnings ()
|
||||
+{
|
||||
+ std::string result;
|
||||
+
|
||||
+#ifdef HAVE_LIBSELINUX
|
||||
+ /* -1 is returned for errors, 0 if it has no effect, 1 if PTRACE_ATTACH is
|
||||
+ forbidden. */
|
||||
+ if (security_get_boolean_active ("deny_ptrace") == 1)
|
||||
+ string_appendf (result,
|
||||
+ _("the SELinux boolean 'deny_ptrace' is enabled, "
|
||||
+ "you can disable this process attach protection by: "
|
||||
+ "(gdb) shell sudo setsebool deny_ptrace=0\n"));
|
||||
+#endif /* HAVE_LIBSELINUX */
|
||||
+ return result;
|
||||
+}
|
||||
+
|
||||
/* Extract extended ptrace event from wait status. */
|
||||
|
||||
int
|
||||
diff --git a/gdb/nat/linux-ptrace.h b/gdb/nat/linux-ptrace.h
|
||||
--- a/gdb/nat/linux-ptrace.h
|
||||
+++ b/gdb/nat/linux-ptrace.h
|
||||
@@ -184,6 +184,7 @@ extern std::string linux_ptrace_attach_fail_reason (pid_t pid);
|
||||
extern std::string linux_ptrace_attach_fail_reason_string (ptid_t ptid, int err);
|
||||
|
||||
extern void linux_ptrace_init_warnings (void);
|
||||
+extern std::string linux_ptrace_create_warnings ();
|
||||
extern void linux_check_ptrace_features (void);
|
||||
extern void linux_enable_event_reporting (pid_t pid, int attached);
|
||||
extern void linux_disable_event_reporting (pid_t pid);
|
|
@ -1,45 +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-btrobust.patch
|
||||
|
||||
;; Continue backtrace even if a frame filter throws an exception (Phil Muldoon).
|
||||
;;=push
|
||||
|
||||
This should fix the error with glib. An error message will still be
|
||||
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
|
||||
@@ -1151,6 +1151,7 @@ gdbpy_apply_frame_filter (const struct extension_language_defn *extlang,
|
||||
htab_eq_pointer,
|
||||
NULL));
|
||||
|
||||
+ int count_printed = 0;
|
||||
while (true)
|
||||
{
|
||||
gdbpy_ref<> item (PyIter_Next (iterable.get ()));
|
||||
@@ -1159,8 +1160,8 @@ gdbpy_apply_frame_filter (const struct extension_language_defn *extlang,
|
||||
{
|
||||
if (PyErr_Occurred ())
|
||||
{
|
||||
- throw_quit_or_print_exception ();
|
||||
- return EXT_LANG_BT_ERROR;
|
||||
+ gdbpy_print_stack ();
|
||||
+ return count_printed > 0 ? EXT_LANG_BT_ERROR : EXT_LANG_BT_NO_FILTERS;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -1193,7 +1194,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)
|
||||
- throw_quit_or_print_exception ();
|
||||
+ gdbpy_print_stack ();
|
||||
+ count_printed++;
|
||||
}
|
||||
|
||||
return success;
|
|
@ -1,178 +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-bz1219747-attach-kills.patch
|
||||
|
||||
;; Never kill PID on: gdb exec PID (Jan Kratochvil, RH BZ 1219747).
|
||||
;;=push+jan
|
||||
|
||||
http://sourceware.org/ml/gdb-patches/2015-10/msg00301.html
|
||||
|
||||
Hi,
|
||||
|
||||
in some cases with deleted main executable GDB will want to kill the inferior.
|
||||
|
||||
$ cp /bin/sleep /tmp/sleep;/tmp/sleep 1h&p=$!
|
||||
$ rm /tmp/sleep
|
||||
$ gdb /tmp/sleep $p
|
||||
GNU gdb (GDB) 7.10.50.20151016-cvs
|
||||
/tmp/sleep: No such file or directory.
|
||||
Attaching to process 9694
|
||||
/tmp/sleep (deleted): No such file or directory.
|
||||
A program is being debugged already. Kill it? (y or n) _
|
||||
|
||||
The first attachment of "/tmp/sleep" commandline argument errors at:
|
||||
|
||||
267 if (scratch_chan < 0)
|
||||
268 perror_with_name (filename);
|
||||
1051 if (catch_command_errors_const (exec_file_attach, execarg,
|
||||
1052 !batch_flag))
|
||||
|
||||
Then GDB tries to attach to the process $p:
|
||||
|
||||
1082 if (catch_command_errors (attach_command, pid_or_core_arg,
|
||||
1083 !batch_flag) == 0)
|
||||
|
||||
This succeeds and since this moment GDB has a valid inferior. But despite that
|
||||
the lines
|
||||
1082 if (catch_command_errors (attach_command, pid_or_core_arg,
|
||||
1083 !batch_flag) == 0)
|
||||
still fail because consequently attach_command() fails to find the associated
|
||||
executable file:
|
||||
|
||||
267 if (scratch_chan < 0)
|
||||
268 perror_with_name (filename);
|
||||
1082 if (catch_command_errors (attach_command, pid_or_core_arg,
|
||||
1083 !batch_flag) == 0)
|
||||
|
||||
and therefore GDB executes the following:
|
||||
|
||||
(gdb) bt
|
||||
2179 if (have_inferiors ())
|
||||
2180 {
|
||||
2181 if (!from_tty
|
||||
2182 || !have_live_inferiors ()
|
||||
2183 || query (_("A program is being debugged already. Kill it? ")))
|
||||
2184 iterate_over_inferiors (dispose_inferior, NULL);
|
||||
2185 else
|
||||
2186 error (_("Program not killed."));
|
||||
2187 }
|
||||
1084 catch_command_errors (core_file_command, pid_or_core_arg,
|
||||
1085 !batch_flag);
|
||||
|
||||
No regressions on {x86_64,x86_64-m32,i686}-fedora24pre-linux-gnu.
|
||||
|
||||
Thanks,
|
||||
Jan
|
||||
|
||||
gdb/ChangeLog
|
||||
2015-10-16 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* main.c (captured_main): Run core_file_command for pid_or_core_arg
|
||||
only if not have_inferiors ().
|
||||
|
||||
gdb/testsuite/ChangeLog
|
||||
2015-10-16 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* gdb.base/attach-kills.c: New.
|
||||
* gdb.base/attach-kills.exp: New.
|
||||
|
||||
diff --git a/gdb/main.c b/gdb/main.c
|
||||
--- a/gdb/main.c
|
||||
+++ b/gdb/main.c
|
||||
@@ -1115,7 +1115,10 @@ captured_main_1 (struct captured_main_args *context)
|
||||
if (isdigit (pid_or_core_arg[0]))
|
||||
{
|
||||
if (catch_command_errors (attach_command, pid_or_core_arg,
|
||||
- !batch_flag) == 0)
|
||||
+ !batch_flag) == 0
|
||||
+ /* attach_command could succeed partially and core_file_command
|
||||
+ would try to kill it. */
|
||||
+ && !have_inferiors ())
|
||||
catch_command_errors (core_file_command, pid_or_core_arg,
|
||||
!batch_flag);
|
||||
}
|
||||
diff --git a/gdb/testsuite/gdb.base/attach-kills.c b/gdb/testsuite/gdb.base/attach-kills.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/attach-kills.c
|
||||
@@ -0,0 +1,25 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2015 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+#include <unistd.h>
|
||||
+
|
||||
+int
|
||||
+main (void)
|
||||
+{
|
||||
+ sleep (600);
|
||||
+ return 0;
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.base/attach-kills.exp b/gdb/testsuite/gdb.base/attach-kills.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/attach-kills.exp
|
||||
@@ -0,0 +1,49 @@
|
||||
+# Copyright (C) 2015 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/>.
|
||||
+
|
||||
+if { ![can_spawn_for_attach] } {
|
||||
+ return 0
|
||||
+}
|
||||
+
|
||||
+standard_testfile
|
||||
+
|
||||
+if { [build_executable ${testfile}.exp $testfile] == -1 } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+# Start the program running and then wait for a bit, to be sure
|
||||
+# that it can be attached to.
|
||||
+
|
||||
+set test_spawn_id [spawn_wait_for_attach $binfile]
|
||||
+set testpid [spawn_id_get_pid $test_spawn_id]
|
||||
+
|
||||
+remote_exec target "cp -pf -- $binfile $binfile-copy"
|
||||
+remote_exec target "rm -f -- $binfile"
|
||||
+
|
||||
+set test "start gdb"
|
||||
+set res [gdb_spawn_with_cmdline_opts \
|
||||
+ "-iex \"set height 0\" -iex \"set width 0\" /DoEsNoTeXySt $testpid"]
|
||||
+if { $res != 0} {
|
||||
+ fail "$test (spawn)"
|
||||
+ kill_wait_spawned_process $test_spawn_id
|
||||
+ return -1
|
||||
+}
|
||||
+gdb_test_multiple "" $test {
|
||||
+ -re "\r\nAttaching to .*\r\n$gdb_prompt $" {
|
||||
+ pass $test
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+kill_wait_spawned_process $test_spawn_id
|
|
@ -1,130 +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-bz533176-fortran-omp-step.patch
|
||||
|
||||
;; Fix stepping with OMP parallel Fortran sections (BZ 533176).
|
||||
;;=push+jan: It requires some better DWARF annotations.
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=533176#c4
|
||||
|
||||
I find it a bug in DWARF and gdb behaves correctly according to it. From the
|
||||
current DWARF's point of view the is a function call which you skip by "next".
|
||||
|
||||
If you hide any /usr/lib/debug such as using:
|
||||
gdb -nx -ex 'set debug-file-directory /qwe' -ex 'file ./tpcommon_gfortran44'
|
||||
and use "step" command instead of "next" there it will work.
|
||||
(You need to hide debuginfo from libgomp as you would step into libgomp sources
|
||||
to maintain the threads for execution.)
|
||||
|
||||
There should be some DWARF extension for it, currently tried to detect
|
||||
substring ".omp_fn." as this function is called "MAIN__.omp_fn.0" and do not
|
||||
consider such sub-function as a skippable by "next".
|
||||
|
||||
Another problem is that with "set scheduler-locking" being "off" (default
|
||||
upstream) or "step" (default in F/RHEL) the simultaneous execution of the
|
||||
threads is inconvenient. Setting it to "on" will lockup the debugging as the
|
||||
threads need to get synchronized at some point. This is a more general
|
||||
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
|
||||
@@ -6695,6 +6695,16 @@ process_event_stop_test (struct execution_control_state *ecs)
|
||||
|
||||
if (ecs->event_thread->control.step_over_calls == STEP_OVER_ALL)
|
||||
{
|
||||
+ struct symbol *stop_fn = find_pc_function (stop_pc);
|
||||
+ 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)
|
||||
+ /* gcc-4.7.2-9.fc19.x86_64 uses a new format. */
|
||||
+ && (stopf == NULL
|
||||
+ || strstr (MSYMBOL_LINKAGE_NAME (stopf), "._omp_fn.") == NULL))
|
||||
+{ /* ".omp_fn." */
|
||||
+
|
||||
/* We're doing a "next".
|
||||
|
||||
Normal (forward) execution: set a breakpoint at the
|
||||
@@ -6728,6 +6738,7 @@ process_event_stop_test (struct execution_control_state *ecs)
|
||||
|
||||
keep_going (ecs);
|
||||
return;
|
||||
+} /* ".omp_fn." */
|
||||
}
|
||||
|
||||
/* If we are in a function call trampoline (a stub between the
|
||||
diff --git a/gdb/testsuite/gdb.fortran/omp-step.exp b/gdb/testsuite/gdb.fortran/omp-step.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.fortran/omp-step.exp
|
||||
@@ -0,0 +1,31 @@
|
||||
+# Copyright 2009 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/>.
|
||||
+
|
||||
+set testfile "omp-step"
|
||||
+set srcfile ${testfile}.f90
|
||||
+if { [prepare_for_testing $testfile.exp $testfile $srcfile {debug f90 additional_flags=-fopenmp}] } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+if ![runto [gdb_get_line_number "start-here"]] {
|
||||
+ perror "Couldn't run to start-here"
|
||||
+ return 0
|
||||
+}
|
||||
+
|
||||
+gdb_test "next" {!\$omp parallel} "step closer"
|
||||
+gdb_test "next" {a\(omp_get_thread_num\(\) \+ 1\) = 1} "step into omp"
|
||||
+
|
||||
+gdb_breakpoint [gdb_get_line_number "success"]
|
||||
+gdb_continue_to_breakpoint "success" ".*success.*"
|
||||
diff --git a/gdb/testsuite/gdb.fortran/omp-step.f90 b/gdb/testsuite/gdb.fortran/omp-step.f90
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.fortran/omp-step.f90
|
||||
@@ -0,0 +1,32 @@
|
||||
+! Copyright 2009 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/>.
|
||||
+
|
||||
+ use omp_lib
|
||||
+ integer nthreads, i, a(1000)
|
||||
+ nthreads = omp_get_num_threads()
|
||||
+ if (nthreads .gt. 1000) call abort
|
||||
+
|
||||
+ do i = 1, nthreads
|
||||
+ a(i) = 0
|
||||
+ end do
|
||||
+ print *, "start-here"
|
||||
+!$omp parallel
|
||||
+ a(omp_get_thread_num() + 1) = 1
|
||||
+!$omp end parallel
|
||||
+ do i = 1, nthreads
|
||||
+ if (a(i) .ne. 1) call abort
|
||||
+ end do
|
||||
+ print *, "success"
|
||||
+ end
|
|
@ -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
|
||||
@@ -8807,7 +8807,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)
|
||||
{
|
||||
@@ -14356,7 +14356,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
|
||||
@@ -238,6 +238,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 x86-dregs.o \
|
||||
i386-linux-nat.o x86-linux-nat.o linux-btrace.o \
|
||||
x86-linux.o x86-linux-dregs.o"
|
||||
@@ -290,6 +291,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 x86-dregs.o \
|
||||
amd64-nat.o amd64-linux-nat.o x86-linux-nat.o linux-btrace.o \
|
||||
x86-linux.o x86-linux-dregs.o amd64-linux-siginfo.o"
|
||||
diff --git a/gdb/target.h b/gdb/target.h
|
||||
--- a/gdb/target.h
|
||||
+++ b/gdb/target.h
|
||||
@@ -1953,9 +1953,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.*"
|
|
@ -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
|
||||
@@ -746,13 +746,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."));
|
||||
}
|
||||
}
|
||||
|
|
@ -1,315 +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-dts-rhel6-python-compat.patch
|
||||
|
||||
;; [rhel6] DTS backward Python compatibility API (BZ 1020004, Phil Muldoon).
|
||||
;;=fedora
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1020004
|
||||
|
||||
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
|
||||
@@ -71,6 +71,8 @@ PYTHON_FILE_LIST = \
|
||||
gdb/__init__.py \
|
||||
gdb/FrameDecorator.py \
|
||||
gdb/FrameIterator.py \
|
||||
+ gdb/FrameWrapper.py \
|
||||
+ gdb/backtrace.py \
|
||||
gdb/frames.py \
|
||||
gdb/printing.py \
|
||||
gdb/prompt.py \
|
||||
@@ -79,6 +81,7 @@ PYTHON_FILE_LIST = \
|
||||
gdb/xmethod.py \
|
||||
gdb/command/__init__.py \
|
||||
gdb/command/explore.py \
|
||||
+ gdb/command/backtrace.py \
|
||||
gdb/command/frame_filters.py \
|
||||
gdb/command/pretty_printers.py \
|
||||
gdb/command/prompt.py \
|
||||
diff --git a/gdb/python/lib/gdb/FrameWrapper.py b/gdb/python/lib/gdb/FrameWrapper.py
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/python/lib/gdb/FrameWrapper.py
|
||||
@@ -0,0 +1,122 @@
|
||||
+# Wrapper API for frames.
|
||||
+
|
||||
+# Copyright (C) 2008, 2009 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
|
||||
+
|
||||
+# FIXME: arguably all this should be on Frame somehow.
|
||||
+class FrameWrapper:
|
||||
+ def __init__ (self, frame):
|
||||
+ self.frame = frame;
|
||||
+
|
||||
+ def write_symbol (self, stream, sym, block):
|
||||
+ if len (sym.linkage_name):
|
||||
+ nsym, is_field_of_this = gdb.lookup_symbol (sym.linkage_name, block)
|
||||
+ if nsym.addr_class != gdb.SYMBOL_LOC_REGISTER:
|
||||
+ sym = nsym
|
||||
+
|
||||
+ stream.write (sym.print_name + "=")
|
||||
+ try:
|
||||
+ val = self.read_var (sym)
|
||||
+ if val != None:
|
||||
+ val = str (val)
|
||||
+ # FIXME: would be nice to have a more precise exception here.
|
||||
+ except RuntimeError as text:
|
||||
+ val = text
|
||||
+ if val == None:
|
||||
+ stream.write ("???")
|
||||
+ else:
|
||||
+ stream.write (str (val))
|
||||
+
|
||||
+ def print_frame_locals (self, stream, func):
|
||||
+
|
||||
+ try:
|
||||
+ block = self.frame.block()
|
||||
+ except RuntimeError:
|
||||
+ block = None
|
||||
+
|
||||
+ while block != None:
|
||||
+ if block.is_global or block.is_static:
|
||||
+ break
|
||||
+
|
||||
+ for sym in block:
|
||||
+ if sym.is_argument:
|
||||
+ continue;
|
||||
+
|
||||
+ self.write_symbol (stream, sym, block)
|
||||
+ stream.write ('\n')
|
||||
+
|
||||
+ def print_frame_args (self, stream, func):
|
||||
+
|
||||
+ try:
|
||||
+ block = self.frame.block()
|
||||
+ except RuntimeError:
|
||||
+ block = None
|
||||
+
|
||||
+ while block != None:
|
||||
+ if block.function != None:
|
||||
+ break
|
||||
+ block = block.superblock
|
||||
+
|
||||
+ first = True
|
||||
+ for sym in block:
|
||||
+ if not sym.is_argument:
|
||||
+ continue;
|
||||
+
|
||||
+ if not first:
|
||||
+ stream.write (", ")
|
||||
+
|
||||
+ self.write_symbol (stream, sym, block)
|
||||
+ first = False
|
||||
+
|
||||
+ # FIXME: this should probably just be a method on gdb.Frame.
|
||||
+ # But then we need stream wrappers.
|
||||
+ def describe (self, stream, full):
|
||||
+ if self.type () == gdb.DUMMY_FRAME:
|
||||
+ stream.write (" <function called from gdb>\n")
|
||||
+ elif self.type () == gdb.SIGTRAMP_FRAME:
|
||||
+ stream.write (" <signal handler called>\n")
|
||||
+ else:
|
||||
+ sal = self.find_sal ()
|
||||
+ pc = self.pc ()
|
||||
+ name = self.name ()
|
||||
+ if not name:
|
||||
+ name = "??"
|
||||
+ if pc != sal.pc or not sal.symtab:
|
||||
+ stream.write (" 0x%08x in" % pc)
|
||||
+ stream.write (" " + name + " (")
|
||||
+
|
||||
+ func = self.function ()
|
||||
+ self.print_frame_args (stream, func)
|
||||
+
|
||||
+ stream.write (")")
|
||||
+
|
||||
+ if sal.symtab and sal.symtab.filename:
|
||||
+ stream.write (" at " + sal.symtab.filename)
|
||||
+ stream.write (":" + str (sal.line))
|
||||
+
|
||||
+ if not self.name () or (not sal.symtab or not sal.symtab.filename):
|
||||
+ lib = gdb.solib_name (pc)
|
||||
+ if lib:
|
||||
+ stream.write (" from " + lib)
|
||||
+
|
||||
+ stream.write ("\n")
|
||||
+
|
||||
+ if full:
|
||||
+ self.print_frame_locals (stream, func)
|
||||
+
|
||||
+ def __getattr__ (self, name):
|
||||
+ return getattr (self.frame, name)
|
||||
diff --git a/gdb/python/lib/gdb/backtrace.py b/gdb/python/lib/gdb/backtrace.py
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/python/lib/gdb/backtrace.py
|
||||
@@ -0,0 +1,42 @@
|
||||
+# Filtering backtrace.
|
||||
+
|
||||
+# Copyright (C) 2008, 2011 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
|
||||
+import itertools
|
||||
+
|
||||
+# Our only exports.
|
||||
+__all__ = ['push_frame_filter', 'create_frame_filter']
|
||||
+
|
||||
+old_frame_filter = None
|
||||
+
|
||||
+def push_frame_filter (constructor):
|
||||
+ """Register a new backtrace filter class with the 'backtrace' command.
|
||||
+The filter will be passed an iterator as an argument. The iterator
|
||||
+will return gdb.Frame-like objects. The filter should in turn act as
|
||||
+an iterator returning such objects."""
|
||||
+ global old_frame_filter
|
||||
+ if old_frame_filter == None:
|
||||
+ old_frame_filter = constructor
|
||||
+ else:
|
||||
+ old_frame_filter = lambda iterator, filter = frame_filter: constructor (filter(iterator))
|
||||
+
|
||||
+def create_frame_filter (iter):
|
||||
+ global old_frame_filter
|
||||
+ if old_frame_filter is None:
|
||||
+ return iter
|
||||
+ return old_frame_filter (iter)
|
||||
+
|
||||
diff --git a/gdb/python/lib/gdb/command/backtrace.py b/gdb/python/lib/gdb/command/backtrace.py
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/python/lib/gdb/command/backtrace.py
|
||||
@@ -0,0 +1,106 @@
|
||||
+# New backtrace command.
|
||||
+
|
||||
+# Copyright (C) 2008, 2009, 2011 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
|
||||
+import gdb.backtrace
|
||||
+import itertools
|
||||
+from gdb.FrameIterator import FrameIterator
|
||||
+from gdb.FrameWrapper import FrameWrapper
|
||||
+import sys
|
||||
+
|
||||
+class ReverseBacktraceParameter (gdb.Parameter):
|
||||
+ """The new-backtrace command can show backtraces in 'reverse' order.
|
||||
+This means that the innermost frame will be printed last.
|
||||
+Note that reverse backtraces are more expensive to compute."""
|
||||
+
|
||||
+ set_doc = "Enable or disable reverse backtraces."
|
||||
+ show_doc = "Show whether backtraces will be printed in reverse order."
|
||||
+
|
||||
+ def __init__(self):
|
||||
+ gdb.Parameter.__init__ (self, "reverse-backtrace",
|
||||
+ gdb.COMMAND_STACK, gdb.PARAM_BOOLEAN)
|
||||
+ # Default to compatibility with gdb.
|
||||
+ self.value = False
|
||||
+
|
||||
+class FilteringBacktrace (gdb.Command):
|
||||
+ """Print backtrace of all stack frames, or innermost COUNT frames.
|
||||
+With a negative argument, print outermost -COUNT frames.
|
||||
+Use of the 'full' qualifier also prints the values of the local variables.
|
||||
+Use of the 'raw' qualifier avoids any filtering by loadable modules.
|
||||
+"""
|
||||
+
|
||||
+ def __init__ (self):
|
||||
+ # FIXME: this is not working quite well enough to replace
|
||||
+ # "backtrace" yet.
|
||||
+ gdb.Command.__init__ (self, "new-backtrace", gdb.COMMAND_STACK)
|
||||
+ self.reverse = ReverseBacktraceParameter()
|
||||
+
|
||||
+ def reverse_iter (self, iter):
|
||||
+ result = []
|
||||
+ for item in iter:
|
||||
+ result.append (item)
|
||||
+ result.reverse()
|
||||
+ return result
|
||||
+
|
||||
+ def final_n (self, iter, x):
|
||||
+ result = []
|
||||
+ for item in iter:
|
||||
+ result.append (item)
|
||||
+ return result[x:]
|
||||
+
|
||||
+ def invoke (self, arg, from_tty):
|
||||
+ i = 0
|
||||
+ count = 0
|
||||
+ filter = True
|
||||
+ full = False
|
||||
+
|
||||
+ for word in arg.split (" "):
|
||||
+ if word == '':
|
||||
+ continue
|
||||
+ elif word == 'raw':
|
||||
+ filter = False
|
||||
+ elif word == 'full':
|
||||
+ full = True
|
||||
+ else:
|
||||
+ count = int (word)
|
||||
+
|
||||
+ # FIXME: provide option to start at selected frame
|
||||
+ # However, should still number as if starting from newest
|
||||
+ newest_frame = gdb.newest_frame()
|
||||
+ iter = itertools.imap (FrameWrapper,
|
||||
+ FrameIterator (newest_frame))
|
||||
+ if filter:
|
||||
+ iter = gdb.backtrace.create_frame_filter (iter)
|
||||
+
|
||||
+ # Now wrap in an iterator that numbers the frames.
|
||||
+ iter = itertools.izip (itertools.count (0), iter)
|
||||
+
|
||||
+ # Reverse if the user wanted that.
|
||||
+ if self.reverse.value:
|
||||
+ iter = self.reverse_iter (iter)
|
||||
+
|
||||
+ # Extract sub-range user wants.
|
||||
+ if count < 0:
|
||||
+ iter = self.final_n (iter, count)
|
||||
+ elif count > 0:
|
||||
+ iter = itertools.islice (iter, 0, count)
|
||||
+
|
||||
+ for pair in iter:
|
||||
+ sys.stdout.write ("#%-2d" % pair[0])
|
||||
+ pair[1].describe (sys.stdout, full)
|
||||
+
|
||||
+FilteringBacktrace()
|
|
@ -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
|
||||
@@ -752,6 +752,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
|
|
@ -1,236 +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-gnat-dwarf-crash-3of3.patch
|
||||
|
||||
;; Fix crash of -readnow /usr/lib/debug/usr/bin/gnatbind.debug (BZ 1069211).
|
||||
;;=push+jan
|
||||
|
||||
http://sourceware.org/ml/gdb-patches/2014-02/msg00731.html
|
||||
|
||||
--6TrnltStXW4iwmi0
|
||||
Content-Type: text/plain; charset=us-ascii
|
||||
Content-Disposition: inline
|
||||
|
||||
Hi,
|
||||
|
||||
PR 16581:
|
||||
GDB crash on inherit_abstract_dies infinite recursion
|
||||
https://sourceware.org/bugzilla/show_bug.cgi?id=16581
|
||||
|
||||
fixed crash from an infinite recursion. But in rare cases the new code can
|
||||
now gdb_assert() due to weird DWARF file.
|
||||
|
||||
I do not yet fully understand why the DWARF is as it is but just GDB should
|
||||
never crash due to invalid DWARF anyway. The "invalid" DWARF I see only in
|
||||
Fedora GCC build, not in FSF GCC build, more info at:
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1069382
|
||||
http://people.redhat.com/jkratoch/gcc-debuginfo-4.8.2-7.fc20.x86_64-gnatbind.debug
|
||||
|
||||
Thanks,
|
||||
Jan
|
||||
|
||||
--6TrnltStXW4iwmi0
|
||||
Content-Type: text/plain; charset=us-ascii
|
||||
Content-Disposition: inline; filename="complaint.patch"
|
||||
|
||||
gdb/
|
||||
2014-02-24 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* dwarf2read.c (process_die): Change gdb_assert to complaint.
|
||||
|
||||
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
|
||||
--- a/gdb/dwarf2read.c
|
||||
+++ b/gdb/dwarf2read.c
|
||||
@@ -10499,6 +10499,13 @@ private:
|
||||
static void
|
||||
process_die (struct die_info *die, struct dwarf2_cu *cu)
|
||||
{
|
||||
+ if (die->in_process)
|
||||
+ {
|
||||
+ complaint (_("DIE at 0x%s attempted to be processed twice"),
|
||||
+ sect_offset_str (die->sect_off));
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
process_die_scope scope (die, cu);
|
||||
|
||||
switch (die->tag)
|
||||
diff --git a/gdb/infrun.c b/gdb/infrun.c
|
||||
--- a/gdb/infrun.c
|
||||
+++ b/gdb/infrun.c
|
||||
@@ -607,6 +607,13 @@ holding the child stopped. Try \"set detach-on-fork\" or \
|
||||
target_pid_to_str (process_ptid));
|
||||
}
|
||||
|
||||
+#ifdef NEED_DETACH_SIGSTOP
|
||||
+ /* We should check PID_WAS_STOPPED and detach it stopped accordingly.
|
||||
+ In this point of code it cannot be 1 as we would not get FORK
|
||||
+ executed without CONTINUE first which resets PID_WAS_STOPPED.
|
||||
+ We would have to first TARGET_STOP and WAITPID it as with running
|
||||
+ inferior PTRACE_DETACH, SIGSTOP will ignore the signal. */
|
||||
+#endif
|
||||
target_detach (parent_inf, 0);
|
||||
}
|
||||
|
||||
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
|
||||
--- a/gdb/linux-nat.c
|
||||
+++ b/gdb/linux-nat.c
|
||||
@@ -191,6 +191,12 @@ struct linux_nat_target *linux_target;
|
||||
/* Does the current host support PTRACE_GETREGSET? */
|
||||
enum tribool have_ptrace_getregset = TRIBOOL_UNKNOWN;
|
||||
|
||||
+#ifdef NEED_DETACH_SIGSTOP
|
||||
+/* PID of the inferior stopped by SIGSTOP before attaching (or zero). */
|
||||
+static pid_t pid_was_stopped;
|
||||
+
|
||||
+#endif
|
||||
+
|
||||
/* The saved to_close method, inherited from inf-ptrace.c.
|
||||
Called by our to_close. */
|
||||
static void (*super_close) (struct target_ops *);
|
||||
@@ -1027,6 +1033,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");
|
||||
+#ifdef NEED_DETACH_SIGSTOP
|
||||
+ pid_was_stopped = ptid.pid ();
|
||||
+#endif
|
||||
|
||||
/* The process is definitely stopped. It is in a job control
|
||||
stop, unless the kernel predates the TASK_STOPPED /
|
||||
@@ -1359,6 +1368,25 @@ get_detach_signal (struct lwp_info *lp)
|
||||
return gdb_signal_to_host (signo);
|
||||
}
|
||||
|
||||
+#ifdef NEED_DETACH_SIGSTOP
|
||||
+ /* Workaround RHEL-5 kernel which has unreliable PTRACE_DETACH, SIGSTOP (that
|
||||
+ many TIDs are left unstopped). See RH Bug 496732. */
|
||||
+ if (lp->ptid.pid () == pid_was_stopped)
|
||||
+ {
|
||||
+ int err;
|
||||
+
|
||||
+ errno = 0;
|
||||
+ err = kill_lwp (lp->ptid.lwp (), SIGSTOP);
|
||||
+ if (debug_linux_nat)
|
||||
+ {
|
||||
+ fprintf_unfiltered (gdb_stdlog,
|
||||
+ "SC: lwp kill %d %s\n",
|
||||
+ err,
|
||||
+ errno ? safe_strerror (errno) : "ERRNO-OK");
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1507,6 +1535,10 @@ linux_nat_target::detach (inferior *inf, int from_tty)
|
||||
detach_one_lwp (main_lwp, &signo);
|
||||
|
||||
detach_success (inf);
|
||||
+
|
||||
+#ifdef NEED_DETACH_SIGSTOP
|
||||
+ pid_was_stopped = 0;
|
||||
+#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1765,6 +1797,16 @@ linux_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signo)
|
||||
return;
|
||||
}
|
||||
|
||||
+#ifdef NEED_DETACH_SIGSTOP
|
||||
+ /* At this point, we are going to resume the inferior and if we
|
||||
+ have attached to a stopped process, we no longer should leave
|
||||
+ it as stopped if the user detaches. PTID variable has PID set to LWP
|
||||
+ while we need to check the real PID here. */
|
||||
+
|
||||
+ if (!step && lp && pid_was_stopped == lp->ptid.pid ())
|
||||
+ pid_was_stopped = 0;
|
||||
+
|
||||
+#endif
|
||||
if (resume_many)
|
||||
iterate_over_lwps (ptid, linux_nat_resume_callback, lp);
|
||||
|
||||
@@ -3761,6 +3803,10 @@ linux_nat_target::mourn_inferior ()
|
||||
|
||||
/* Let the arch-specific native code know this process is gone. */
|
||||
linux_target->low_forget_process (pid);
|
||||
+#ifdef NEED_DETACH_SIGSTOP
|
||||
+
|
||||
+ pid_was_stopped = 0;
|
||||
+#endif
|
||||
}
|
||||
|
||||
/* Convert a native/host siginfo object, into/from the siginfo in the
|
||||
diff --git a/gdb/testsuite/gdb.threads/attach-stopped.exp b/gdb/testsuite/gdb.threads/attach-stopped.exp
|
||||
--- a/gdb/testsuite/gdb.threads/attach-stopped.exp
|
||||
+++ b/gdb/testsuite/gdb.threads/attach-stopped.exp
|
||||
@@ -56,7 +56,65 @@ proc corefunc { threadtype } {
|
||||
gdb_reinitialize_dir $srcdir/$subdir
|
||||
gdb_load ${binfile}
|
||||
|
||||
- # Verify that we can attach to the stopped process.
|
||||
+ # Verify that we can attach to the process by first giving its
|
||||
+ # executable name via the file command, and using attach with the
|
||||
+ # process ID.
|
||||
+
|
||||
+ set test "$threadtype: set file, before attach1 to stopped process"
|
||||
+ gdb_test_multiple "file $binfile" "$test" {
|
||||
+ -re "Load new symbol table from.*y or n. $" {
|
||||
+ gdb_test "y" "Reading symbols from $escapedbinfile\.\.\.*done." \
|
||||
+ "$test (re-read)"
|
||||
+ }
|
||||
+ -re "Reading symbols from $escapedbinfile\.\.\.*done.*$gdb_prompt $" {
|
||||
+ pass "$test"
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ set test "$threadtype: attach1 to stopped, after setting file"
|
||||
+ gdb_test_multiple "attach $testpid" "$test" {
|
||||
+ -re "Attaching to program.*`?$escapedbinfile'?, process $testpid.*$gdb_prompt $" {
|
||||
+ pass "$test"
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ # ".*sleep.*clone.*" would fail on s390x as bt stops at START_THREAD there.
|
||||
+ if {[string equal $threadtype threaded]} {
|
||||
+ gdb_test "thread apply all bt" ".*sleep.*start_thread.*" "$threadtype: attach1 to stopped bt"
|
||||
+ } else {
|
||||
+ gdb_test "bt" ".*sleep.*main.*" "$threadtype: attach1 to stopped bt"
|
||||
+ }
|
||||
+
|
||||
+ # Exit and detach the process.
|
||||
+
|
||||
+ gdb_exit
|
||||
+
|
||||
+ # Avoid some race:
|
||||
+ sleep 2
|
||||
+
|
||||
+ if [catch {open /proc/${testpid}/status r} fileid] {
|
||||
+ set line2 "NOTFOUND"
|
||||
+ } else {
|
||||
+ gets $fileid line1;
|
||||
+ gets $fileid line2;
|
||||
+ close $fileid;
|
||||
+ }
|
||||
+
|
||||
+ set test "$threadtype: attach1, exit leaves process stopped"
|
||||
+ if {[string match "*(stopped)*" $line2]} {
|
||||
+ pass $test
|
||||
+ } else {
|
||||
+ fail $test
|
||||
+ }
|
||||
+
|
||||
+ # At this point, the process should still be stopped
|
||||
+
|
||||
+ gdb_start
|
||||
+ gdb_reinitialize_dir $srcdir/$subdir
|
||||
+ gdb_load ${binfile}
|
||||
+
|
||||
+ # Verify that we can attach to the process just by giving the
|
||||
+ # process ID.
|
||||
|
||||
set test "$threadtype: attach2 to stopped, after setting file"
|
||||
gdb_test_multiple "attach $testpid" "$test" {
|
|
@ -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-jit-reader-multilib.patch
|
||||
|
||||
;; Fix jit-reader.h for multi-lib.
|
||||
;;=push+jan
|
||||
|
||||
diff --git a/gdb/configure b/gdb/configure
|
||||
--- a/gdb/configure
|
||||
+++ b/gdb/configure
|
||||
@@ -9680,10 +9680,12 @@ _ACEOF
|
||||
|
||||
|
||||
|
||||
-if test "x${ac_cv_sizeof_unsigned_long}" = "x8"; then
|
||||
- TARGET_PTR="unsigned long"
|
||||
-elif test "x${ac_cv_sizeof_unsigned_long_long}" = "x8"; then
|
||||
+# Try to keep TARGET_PTR the same across archs so that jit-reader.h file
|
||||
+# content is the same for multilib distributions.
|
||||
+if test "x${ac_cv_sizeof_unsigned_long_long}" = "x8"; then
|
||||
TARGET_PTR="unsigned long long"
|
||||
+elif test "x${ac_cv_sizeof_unsigned_long}" = "x8"; then
|
||||
+ TARGET_PTR="unsigned long"
|
||||
elif test "x${ac_cv_sizeof_unsigned___int128}" = "x16"; then
|
||||
TARGET_PTR="unsigned __int128"
|
||||
else
|
||||
diff --git a/gdb/configure.ac b/gdb/configure.ac
|
||||
--- a/gdb/configure.ac
|
||||
+++ b/gdb/configure.ac
|
||||
@@ -843,10 +843,12 @@ AC_CHECK_SIZEOF(unsigned long long)
|
||||
AC_CHECK_SIZEOF(unsigned long)
|
||||
AC_CHECK_SIZEOF(unsigned __int128)
|
||||
|
||||
-if test "x${ac_cv_sizeof_unsigned_long}" = "x8"; then
|
||||
- TARGET_PTR="unsigned long"
|
||||
-elif test "x${ac_cv_sizeof_unsigned_long_long}" = "x8"; then
|
||||
+# Try to keep TARGET_PTR the same across archs so that jit-reader.h file
|
||||
+# content is the same for multilib distributions.
|
||||
+if test "x${ac_cv_sizeof_unsigned_long_long}" = "x8"; then
|
||||
TARGET_PTR="unsigned long long"
|
||||
+elif test "x${ac_cv_sizeof_unsigned_long}" = "x8"; then
|
||||
+ TARGET_PTR="unsigned long"
|
||||
elif test "x${ac_cv_sizeof_unsigned___int128}" = "x16"; then
|
||||
TARGET_PTR="unsigned __int128"
|
||||
else
|
|
@ -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-moribund-utrace-workaround.patch
|
||||
|
||||
;; Workaround non-stop moribund locations exploited by kernel utrace (BZ 590623).
|
||||
;;=push+jan: Currently it is still not fully safe.
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=590623
|
||||
http://sources.redhat.com/bugzilla/show_bug.cgi?id=11593
|
||||
|
||||
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
|
||||
@@ -12016,6 +12016,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);
|
||||
+ /* Red Hat Bug 590623. */
|
||||
+ old_loc->events_till_retirement *= 10;
|
||||
old_loc->owner = NULL;
|
||||
|
||||
VEC_safe_push (bp_location_p, moribund_locations, old_loc);
|
|
@ -1,241 +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-python-gil.patch
|
||||
|
||||
;; Fix Python GIL with gdb.execute("continue") (Phil Muldoon, BZ 1116957).
|
||||
;;=push
|
||||
|
||||
diff --git a/gdb/doc/python.texi b/gdb/doc/python.texi
|
||||
--- a/gdb/doc/python.texi
|
||||
+++ b/gdb/doc/python.texi
|
||||
@@ -232,6 +232,14 @@ returned as a string. The default is @code{False}, in which case the
|
||||
return value is @code{None}. If @var{to_string} is @code{True}, the
|
||||
@value{GDBN} virtual terminal will be temporarily set to unlimited width
|
||||
and height, and its pagination will be disabled; @pxref{Screen Size}.
|
||||
+
|
||||
+The @var{release_gil} flag specifies whether @value{GDBN} ought to
|
||||
+release the Python GIL before executing the command. This is useful
|
||||
+in multi-threaded Python programs where by default the Python
|
||||
+interpreter will acquire the GIL and lock other threads from
|
||||
+executing. After the command has completed executing in @value{GDBN}
|
||||
+the Python GIL is reacquired. This flag must be a boolean value. If
|
||||
+omitted, it defaults to @code{False}.
|
||||
@end defun
|
||||
|
||||
@findex gdb.breakpoints
|
||||
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
|
||||
@@ -148,6 +148,8 @@ typedef int Py_ssize_t;
|
||||
#define PyGILState_Release(ARG) ((void)(ARG))
|
||||
#define PyEval_InitThreads()
|
||||
#define PyThreadState_Swap(ARG) ((void)(ARG))
|
||||
+#define PyEval_SaveThread() ((void)(ARG))
|
||||
+#define PyEval_RestoreThread(ARG) ((void)(ARG))
|
||||
#define PyEval_ReleaseLock()
|
||||
#endif
|
||||
|
||||
diff --git a/gdb/python/python.c b/gdb/python/python.c
|
||||
--- a/gdb/python/python.c
|
||||
+++ b/gdb/python/python.c
|
||||
@@ -556,12 +556,16 @@ execute_gdb_command (PyObject *self, PyObject *args, PyObject *kw)
|
||||
{
|
||||
const char *arg;
|
||||
PyObject *from_tty_obj = NULL, *to_string_obj = NULL;
|
||||
- int from_tty, to_string;
|
||||
- static const char *keywords[] = { "command", "from_tty", "to_string", NULL };
|
||||
+ int from_tty, to_string, release_gil;
|
||||
+ static const char *keywords[] = {"command", "from_tty", "to_string", "release_gil", NULL };
|
||||
+ PyObject *release_gil_obj = NULL;
|
||||
+ /* Initialize it just to avoid a GCC false warning. */
|
||||
+ PyThreadState *state = NULL;
|
||||
|
||||
- if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "s|O!O!", keywords, &arg,
|
||||
+ if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "s|O!O!O!", keywords, &arg,
|
||||
&PyBool_Type, &from_tty_obj,
|
||||
- &PyBool_Type, &to_string_obj))
|
||||
+ &PyBool_Type, &to_string_obj,
|
||||
+ &PyBool_Type, &release_gil_obj))
|
||||
return NULL;
|
||||
|
||||
from_tty = 0;
|
||||
@@ -582,6 +586,15 @@ execute_gdb_command (PyObject *self, PyObject *args, PyObject *kw)
|
||||
to_string = cmp;
|
||||
}
|
||||
|
||||
+ release_gil = 0;
|
||||
+ if (release_gil_obj)
|
||||
+ {
|
||||
+ int cmp = PyObject_IsTrue (release_gil_obj);
|
||||
+ if (cmp < 0)
|
||||
+ return NULL;
|
||||
+ release_gil = cmp;
|
||||
+ }
|
||||
+
|
||||
std::string to_string_res;
|
||||
|
||||
TRY
|
||||
@@ -602,6 +615,13 @@ execute_gdb_command (PyObject *self, PyObject *args, PyObject *kw)
|
||||
|
||||
counted_command_line lines = read_command_lines_1 (reader, 1, nullptr);
|
||||
|
||||
+ /* In the case of long running GDB commands, allow the user to
|
||||
+ release the Python GIL acquired by Python. Restore the GIL
|
||||
+ after the command has completed before handing back to
|
||||
+ Python. */
|
||||
+ if (release_gil)
|
||||
+ state = PyEval_SaveThread();
|
||||
+
|
||||
scoped_restore save_async = make_scoped_restore (¤t_ui->async, 0);
|
||||
|
||||
scoped_restore save_uiout = make_scoped_restore (¤t_uiout);
|
||||
@@ -617,10 +637,22 @@ execute_gdb_command (PyObject *self, PyObject *args, PyObject *kw)
|
||||
from_tty);
|
||||
else
|
||||
execute_control_commands (lines.get (), from_tty);
|
||||
+
|
||||
+ /* Reacquire the GIL if it was released earlier. */
|
||||
+ if (release_gil)
|
||||
+ PyEval_RestoreThread (state);
|
||||
}
|
||||
CATCH (except, RETURN_MASK_ALL)
|
||||
{
|
||||
- GDB_PY_HANDLE_EXCEPTION (except);
|
||||
+ if (except.reason < 0)
|
||||
+ {
|
||||
+ /* Reacquire the GIL if it was released earlier. */
|
||||
+ if (release_gil)
|
||||
+ PyEval_RestoreThread (state);
|
||||
+
|
||||
+ gdbpy_convert_exception (except);
|
||||
+ return NULL;
|
||||
+ }
|
||||
}
|
||||
END_CATCH
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.python/py-gil-mthread.c b/gdb/testsuite/gdb.python/py-gil-mthread.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.python/py-gil-mthread.c
|
||||
@@ -0,0 +1,13 @@
|
||||
+#include <stdio.h>
|
||||
+#include <unistd.h>
|
||||
+
|
||||
+int
|
||||
+main (void)
|
||||
+{
|
||||
+ int i;
|
||||
+ for (i = 0; i < 10; i++)
|
||||
+ {
|
||||
+ sleep (1); /* break-here */
|
||||
+ printf ("Sleeping %d\n", i);
|
||||
+ }
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.python/py-gil-mthread.exp b/gdb/testsuite/gdb.python/py-gil-mthread.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.python/py-gil-mthread.exp
|
||||
@@ -0,0 +1,69 @@
|
||||
+# 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 .c .py
|
||||
+set executable $testfile
|
||||
+
|
||||
+if { [prepare_for_testing $testfile.exp $executable $srcfile] } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+# Skip all tests if Python scripting is not enabled.
|
||||
+if { [skip_python_tests] } { continue }
|
||||
+
|
||||
+if ![runto_main] {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+gdb_breakpoint $srcfile:[gdb_get_line_number "break-here"] temporary
|
||||
+gdb_continue_to_breakpoint "break-here" ".* break-here .*"
|
||||
+
|
||||
+set test "response"
|
||||
+set timeout 60
|
||||
+set sleeping_last -1
|
||||
+set hello_last 0
|
||||
+set minimal 5
|
||||
+gdb_test_multiple "python exec (open ('$srcdir/$subdir/$srcfile2').read ())" $test {
|
||||
+ -re "Error: unable to start thread\r\n" {
|
||||
+ fail $test
|
||||
+ # Not $gdb_prompt-synced!
|
||||
+ }
|
||||
+ -re "Sleeping (\[0-9\]+)\r\n" {
|
||||
+ set n $expect_out(1,string)
|
||||
+ if { $sleeping_last + 1 != $n } {
|
||||
+ fail $test
|
||||
+ } else {
|
||||
+ set sleeping_last $n
|
||||
+ if { $sleeping_last >= $minimal && $hello_last >= $minimal } {
|
||||
+ pass $test
|
||||
+ } else {
|
||||
+ exp_continue
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ -re "Hello \\( (\[0-9\]+) \\)\r\n" {
|
||||
+ set n $expect_out(1,string)
|
||||
+ if { $hello_last + 1 != $n } {
|
||||
+ fail $test
|
||||
+ } else {
|
||||
+ set hello_last $n
|
||||
+ if { $sleeping_last >= $minimal && $hello_last >= $minimal } {
|
||||
+ pass $test
|
||||
+ } else {
|
||||
+ exp_continue
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.python/py-gil-mthread.py b/gdb/testsuite/gdb.python/py-gil-mthread.py
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.python/py-gil-mthread.py
|
||||
@@ -0,0 +1,28 @@
|
||||
+try:
|
||||
+ import thread
|
||||
+except:
|
||||
+ import _thread
|
||||
+import time
|
||||
+import gdb
|
||||
+
|
||||
+# Define a function for the thread
|
||||
+def print_thread_hello():
|
||||
+ count = 0
|
||||
+ while count < 10:
|
||||
+ time.sleep(1)
|
||||
+ count += 1
|
||||
+ print ("Hello ( %d )" % count)
|
||||
+
|
||||
+# Create a threads a continue
|
||||
+try:
|
||||
+ thread.start_new_thread (print_thread_hello, ())
|
||||
+ gdb.execute ("continue", release_gil=True)
|
||||
+except:
|
||||
+ try:
|
||||
+ _thread.start_new_thread (print_thread_hello, ())
|
||||
+ gdb.execute ("continue", release_gil=True)
|
||||
+ except:
|
||||
+ print ("Error: unable to start thread")
|
||||
+
|
||||
+while 1:
|
||||
+ pass
|
|
@ -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
|
||||
@@ -1183,6 +1183,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
|
|
@ -1,65 +0,0 @@
|
|||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
Date: Thu, 9 Aug 2018 17:09:48 +0200
|
||||
Subject: gdb-rhbz1187581-power8-regs-1of7.patch
|
||||
|
||||
;; Add GDB support to access/display POWER8 registers (IBM, RH BZ 1187581).
|
||||
|
||||
commit 05abfc39c719e740530000059bb963ad33462479
|
||||
Author: Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
|
||||
Date: Mon Aug 6 16:24:55 2018 -0300
|
||||
|
||||
Fix indentation in remote_target::download_tracepoint
|
||||
|
||||
gdb/ChangeLog:
|
||||
2018-08-06 Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
|
||||
|
||||
* remote.c (remote_target::download_tracepoint): Fix indentation
|
||||
in for block.
|
||||
|
||||
diff --git a/gdb/remote.c b/gdb/remote.c
|
||||
--- a/gdb/remote.c
|
||||
+++ b/gdb/remote.c
|
||||
@@ -12912,24 +12912,24 @@ remote_target::download_tracepoint (struct bp_location *loc)
|
||||
error (_("Error on target while setting tracepoints."));
|
||||
}
|
||||
|
||||
- for (auto action_it = stepping_actions.begin ();
|
||||
- action_it != stepping_actions.end (); action_it++)
|
||||
- {
|
||||
- QUIT; /* Allow user to bail out with ^C. */
|
||||
-
|
||||
- bool is_first = action_it == stepping_actions.begin ();
|
||||
- bool has_more = action_it != stepping_actions.end ();
|
||||
-
|
||||
- xsnprintf (buf, BUF_SIZE, "QTDP:-%x:%s:%s%s%s",
|
||||
- b->number, addrbuf, /* address */
|
||||
- is_first ? "S" : "",
|
||||
- action_it->c_str (),
|
||||
- has_more ? "-" : "");
|
||||
- putpkt (buf);
|
||||
- remote_get_noisy_reply ();
|
||||
- if (strcmp (rs->buf, "OK"))
|
||||
- error (_("Error on target while setting tracepoints."));
|
||||
- }
|
||||
+ for (auto action_it = stepping_actions.begin ();
|
||||
+ action_it != stepping_actions.end (); action_it++)
|
||||
+ {
|
||||
+ QUIT; /* Allow user to bail out with ^C. */
|
||||
+
|
||||
+ bool is_first = action_it == stepping_actions.begin ();
|
||||
+ bool has_more = action_it != stepping_actions.end ();
|
||||
+
|
||||
+ xsnprintf (buf, BUF_SIZE, "QTDP:-%x:%s:%s%s%s",
|
||||
+ b->number, addrbuf, /* address */
|
||||
+ is_first ? "S" : "",
|
||||
+ action_it->c_str (),
|
||||
+ has_more ? "-" : "");
|
||||
+ putpkt (buf);
|
||||
+ remote_get_noisy_reply ();
|
||||
+ if (strcmp (rs->buf, "OK"))
|
||||
+ error (_("Error on target while setting tracepoints."));
|
||||
+ }
|
||||
|
||||
if (packet_support (PACKET_TracepointSource) == PACKET_ENABLE)
|
||||
{
|
|
@ -1,45 +0,0 @@
|
|||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
Date: Thu, 9 Aug 2018 17:10:46 +0200
|
||||
Subject: gdb-rhbz1187581-power8-regs-2of7.patch
|
||||
|
||||
;; Add GDB support to access/display POWER8 registers (IBM, RH BZ 1187581).
|
||||
|
||||
commit aa6f3694ce867884e43d1c0406c64df08ea24bd3
|
||||
Author: Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
|
||||
Date: Mon Aug 6 16:24:55 2018 -0300
|
||||
|
||||
Remove trailing '-' from the last QTDP action packet
|
||||
|
||||
The has_more predicate in remote_target::download_tracepoint always
|
||||
evaluates to true, so the last action packet will be sent with a
|
||||
trailing '-'. This patch changes the predicate to remove the last
|
||||
trailing '-'.
|
||||
|
||||
gdb/ChangeLog:
|
||||
2018-08-06 Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
|
||||
|
||||
* remote.c (remote_target::download_tracepoint): Fix the has_more
|
||||
predicate in the QTDP action list iteration.
|
||||
|
||||
diff --git a/gdb/remote.c b/gdb/remote.c
|
||||
--- a/gdb/remote.c
|
||||
+++ b/gdb/remote.c
|
||||
@@ -12899,7 +12899,7 @@ remote_target::download_tracepoint (struct bp_location *loc)
|
||||
{
|
||||
QUIT; /* Allow user to bail out with ^C. */
|
||||
|
||||
- bool has_more = (action_it != tdp_actions.end ()
|
||||
+ bool has_more = ((action_it + 1) != tdp_actions.end ()
|
||||
|| !stepping_actions.empty ());
|
||||
|
||||
xsnprintf (buf, BUF_SIZE, "QTDP:-%x:%s:%s%c",
|
||||
@@ -12918,7 +12918,7 @@ remote_target::download_tracepoint (struct bp_location *loc)
|
||||
QUIT; /* Allow user to bail out with ^C. */
|
||||
|
||||
bool is_first = action_it == stepping_actions.begin ();
|
||||
- bool has_more = action_it != stepping_actions.end ();
|
||||
+ bool has_more = (action_it + 1) != stepping_actions.end ();
|
||||
|
||||
xsnprintf (buf, BUF_SIZE, "QTDP:-%x:%s:%s%s%s",
|
||||
b->number, addrbuf, /* address */
|
|
@ -1,258 +0,0 @@
|
|||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
Date: Thu, 9 Aug 2018 17:11:09 +0200
|
||||
Subject: gdb-rhbz1187581-power8-regs-3of7.patch
|
||||
|
||||
;; Add GDB support to access/display POWER8 registers (IBM, RH BZ 1187581).
|
||||
|
||||
commit 3df3a985a475db004706d64f83d9085f99053611
|
||||
Author: Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
|
||||
Date: Mon Aug 6 16:24:55 2018 -0300
|
||||
|
||||
Use get_remote_packet_size in download_tracepoint
|
||||
|
||||
This patch changes the remote target to use the remote packet size to
|
||||
build QTDP packets, and to check if there is enough room for the
|
||||
packet.
|
||||
|
||||
I changed the function to raise an error if the packet is too small,
|
||||
instead of aborting gdb (through xsnprintf). It isn't clear if gdb
|
||||
will be in a consistent state with respect to the stub after this,
|
||||
since it's possible that some packets will be sent but not others, and
|
||||
there could be an incomplete tracepoint on the stub.
|
||||
|
||||
The char array used to build the packets is changed to a
|
||||
gdb::char_vector and sized with the result from
|
||||
get_remote_packet_size.
|
||||
|
||||
When checking if the buffer is large enough to hold the tracepoint
|
||||
condition agent expression, the length of the expression is multiplied
|
||||
by two, since it is encoded with two hex digits per expression
|
||||
byte. For simplicity, I assume that the result won't overflow, which
|
||||
can happen for very long condition expressions.
|
||||
|
||||
gdb/ChangeLog:
|
||||
2018-08-06 Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
|
||||
|
||||
* remote.c (remote_target::download_tracepoint): Remove BUF_SIZE.
|
||||
Replace array buf with gdb::char_vector buf, of size
|
||||
get_remote_packet_size (). Replace references to buf and
|
||||
BUF_SIZE to buf.data () and buf.size (). Replace strcpy, strcat
|
||||
and xsnprintf with snprintf. Raise errors if the buffer is too
|
||||
small.
|
||||
|
||||
diff --git a/gdb/remote.c b/gdb/remote.c
|
||||
--- a/gdb/remote.c
|
||||
+++ b/gdb/remote.c
|
||||
@@ -12799,26 +12799,35 @@ remote_target::remote_download_command_source (int num, ULONGEST addr,
|
||||
void
|
||||
remote_target::download_tracepoint (struct bp_location *loc)
|
||||
{
|
||||
-#define BUF_SIZE 2048
|
||||
-
|
||||
CORE_ADDR tpaddr;
|
||||
char addrbuf[40];
|
||||
- char buf[BUF_SIZE];
|
||||
std::vector<std::string> tdp_actions;
|
||||
std::vector<std::string> stepping_actions;
|
||||
char *pkt;
|
||||
struct breakpoint *b = loc->owner;
|
||||
struct tracepoint *t = (struct tracepoint *) b;
|
||||
struct remote_state *rs = get_remote_state ();
|
||||
+ int ret;
|
||||
+ char *err_msg = _("Tracepoint packet too large for target.");
|
||||
+ size_t size_left;
|
||||
+
|
||||
+ /* We use a buffer other than rs->buf because we'll build strings
|
||||
+ across multiple statements, and other statements in between could
|
||||
+ modify rs->buf. */
|
||||
+ gdb::char_vector buf (get_remote_packet_size ());
|
||||
|
||||
encode_actions_rsp (loc, &tdp_actions, &stepping_actions);
|
||||
|
||||
tpaddr = loc->address;
|
||||
sprintf_vma (addrbuf, tpaddr);
|
||||
- xsnprintf (buf, BUF_SIZE, "QTDP:%x:%s:%c:%lx:%x", b->number,
|
||||
- addrbuf, /* address */
|
||||
- (b->enable_state == bp_enabled ? 'E' : 'D'),
|
||||
- t->step_count, t->pass_count);
|
||||
+ ret = snprintf (buf.data (), buf.size (), "QTDP:%x:%s:%c:%lx:%x",
|
||||
+ b->number, addrbuf, /* address */
|
||||
+ (b->enable_state == bp_enabled ? 'E' : 'D'),
|
||||
+ t->step_count, t->pass_count);
|
||||
+
|
||||
+ if (ret < 0 || ret >= buf.size ())
|
||||
+ error (err_msg);
|
||||
+
|
||||
/* Fast tracepoints are mostly handled by the target, but we can
|
||||
tell the target how big of an instruction block should be moved
|
||||
around. */
|
||||
@@ -12830,8 +12839,15 @@ remote_target::download_tracepoint (struct bp_location *loc)
|
||||
{
|
||||
if (gdbarch_fast_tracepoint_valid_at (loc->gdbarch, tpaddr,
|
||||
NULL))
|
||||
- xsnprintf (buf + strlen (buf), BUF_SIZE - strlen (buf), ":F%x",
|
||||
- gdb_insn_length (loc->gdbarch, tpaddr));
|
||||
+ {
|
||||
+ size_left = buf.size () - strlen (buf.data ());
|
||||
+ ret = snprintf (buf.data () + strlen (buf.data ()),
|
||||
+ size_left, ":F%x",
|
||||
+ gdb_insn_length (loc->gdbarch, tpaddr));
|
||||
+
|
||||
+ if (ret < 0 || ret >= size_left)
|
||||
+ error (err_msg);
|
||||
+ }
|
||||
else
|
||||
/* If it passed validation at definition but fails now,
|
||||
something is very wrong. */
|
||||
@@ -12855,7 +12871,14 @@ remote_target::download_tracepoint (struct bp_location *loc)
|
||||
struct static_tracepoint_marker marker;
|
||||
|
||||
if (target_static_tracepoint_marker_at (tpaddr, &marker))
|
||||
- strcat (buf, ":S");
|
||||
+ {
|
||||
+ size_left = buf.size () - strlen (buf.data ());
|
||||
+ ret = snprintf (buf.data () + strlen (buf.data ()),
|
||||
+ size_left, ":S");
|
||||
+
|
||||
+ if (ret < 0 || ret >= size_left)
|
||||
+ error (err_msg);
|
||||
+ }
|
||||
else
|
||||
error (_("Static tracepoint not valid during download"));
|
||||
}
|
||||
@@ -12873,10 +12896,26 @@ remote_target::download_tracepoint (struct bp_location *loc)
|
||||
capabilities at definition time. */
|
||||
if (remote_supports_cond_tracepoints ())
|
||||
{
|
||||
- agent_expr_up aexpr = gen_eval_for_expr (tpaddr, loc->cond.get ());
|
||||
- xsnprintf (buf + strlen (buf), BUF_SIZE - strlen (buf), ":X%x,",
|
||||
- aexpr->len);
|
||||
- pkt = buf + strlen (buf);
|
||||
+ agent_expr_up aexpr = gen_eval_for_expr (tpaddr,
|
||||
+ loc->cond.get ());
|
||||
+
|
||||
+ size_left = buf.size () - strlen (buf.data ());
|
||||
+
|
||||
+ ret = snprintf (buf.data () + strlen (buf.data ()),
|
||||
+ size_left, ":X%x,", aexpr->len);
|
||||
+
|
||||
+ if (ret < 0 || ret >= size_left)
|
||||
+ error (err_msg);
|
||||
+
|
||||
+ size_left = buf.size () - strlen (buf.data ());
|
||||
+
|
||||
+ /* Two bytes to encode each aexpr byte, plus the terminating
|
||||
+ null byte. */
|
||||
+ if (aexpr->len * 2 + 1 > size_left)
|
||||
+ error (err_msg);
|
||||
+
|
||||
+ pkt = buf.data () + strlen (buf.data ());
|
||||
+
|
||||
for (int ndx = 0; ndx < aexpr->len; ++ndx)
|
||||
pkt = pack_hex_byte (pkt, aexpr->buf[ndx]);
|
||||
*pkt = '\0';
|
||||
@@ -12887,8 +12926,17 @@ remote_target::download_tracepoint (struct bp_location *loc)
|
||||
}
|
||||
|
||||
if (b->commands || *default_collect)
|
||||
- strcat (buf, "-");
|
||||
- putpkt (buf);
|
||||
+ {
|
||||
+ size_left = buf.size () - strlen (buf.data ());
|
||||
+
|
||||
+ ret = snprintf (buf.data () + strlen (buf.data ()),
|
||||
+ size_left, "-");
|
||||
+
|
||||
+ if (ret < 0 || ret >= size_left)
|
||||
+ error (err_msg);
|
||||
+ }
|
||||
+
|
||||
+ putpkt (buf.data ());
|
||||
remote_get_noisy_reply ();
|
||||
if (strcmp (rs->buf, "OK"))
|
||||
error (_("Target does not support tracepoints."));
|
||||
@@ -12902,11 +12950,15 @@ remote_target::download_tracepoint (struct bp_location *loc)
|
||||
bool has_more = ((action_it + 1) != tdp_actions.end ()
|
||||
|| !stepping_actions.empty ());
|
||||
|
||||
- xsnprintf (buf, BUF_SIZE, "QTDP:-%x:%s:%s%c",
|
||||
- b->number, addrbuf, /* address */
|
||||
- action_it->c_str (),
|
||||
- has_more ? '-' : 0);
|
||||
- putpkt (buf);
|
||||
+ ret = snprintf (buf.data (), buf.size (), "QTDP:-%x:%s:%s%c",
|
||||
+ b->number, addrbuf, /* address */
|
||||
+ action_it->c_str (),
|
||||
+ has_more ? '-' : 0);
|
||||
+
|
||||
+ if (ret < 0 || ret >= buf.size ())
|
||||
+ error (err_msg);
|
||||
+
|
||||
+ putpkt (buf.data ());
|
||||
remote_get_noisy_reply ();
|
||||
if (strcmp (rs->buf, "OK"))
|
||||
error (_("Error on target while setting tracepoints."));
|
||||
@@ -12920,12 +12972,16 @@ remote_target::download_tracepoint (struct bp_location *loc)
|
||||
bool is_first = action_it == stepping_actions.begin ();
|
||||
bool has_more = (action_it + 1) != stepping_actions.end ();
|
||||
|
||||
- xsnprintf (buf, BUF_SIZE, "QTDP:-%x:%s:%s%s%s",
|
||||
- b->number, addrbuf, /* address */
|
||||
- is_first ? "S" : "",
|
||||
- action_it->c_str (),
|
||||
- has_more ? "-" : "");
|
||||
- putpkt (buf);
|
||||
+ ret = snprintf (buf.data (), buf.size (), "QTDP:-%x:%s:%s%s%s",
|
||||
+ b->number, addrbuf, /* address */
|
||||
+ is_first ? "S" : "",
|
||||
+ action_it->c_str (),
|
||||
+ has_more ? "-" : "");
|
||||
+
|
||||
+ if (ret < 0 || ret >= buf.size ())
|
||||
+ error (err_msg);
|
||||
+
|
||||
+ putpkt (buf.data ());
|
||||
remote_get_noisy_reply ();
|
||||
if (strcmp (rs->buf, "OK"))
|
||||
error (_("Error on target while setting tracepoints."));
|
||||
@@ -12935,22 +12991,32 @@ remote_target::download_tracepoint (struct bp_location *loc)
|
||||
{
|
||||
if (b->location != NULL)
|
||||
{
|
||||
- strcpy (buf, "QTDPsrc:");
|
||||
+ ret = snprintf (buf.data (), buf.size (), "QTDPsrc:");
|
||||
+
|
||||
+ if (ret < 0 || ret >= buf.size ())
|
||||
+ error (err_msg);
|
||||
+
|
||||
encode_source_string (b->number, loc->address, "at",
|
||||
event_location_to_string (b->location.get ()),
|
||||
- buf + strlen (buf), 2048 - strlen (buf));
|
||||
- putpkt (buf);
|
||||
+ buf.data () + strlen (buf.data ()),
|
||||
+ buf.size () - strlen (buf.data ()));
|
||||
+ putpkt (buf.data ());
|
||||
remote_get_noisy_reply ();
|
||||
if (strcmp (rs->buf, "OK"))
|
||||
warning (_("Target does not support source download."));
|
||||
}
|
||||
if (b->cond_string)
|
||||
{
|
||||
- strcpy (buf, "QTDPsrc:");
|
||||
+ ret = snprintf (buf.data (), buf.size (), "QTDPsrc:");
|
||||
+
|
||||
+ if (ret < 0 || ret >= buf.size ())
|
||||
+ error (err_msg);
|
||||
+
|
||||
encode_source_string (b->number, loc->address,
|
||||
- "cond", b->cond_string, buf + strlen (buf),
|
||||
- 2048 - strlen (buf));
|
||||
- putpkt (buf);
|
||||
+ "cond", b->cond_string,
|
||||
+ buf.data () + strlen (buf.data ()),
|
||||
+ buf.size () - strlen (buf.data ()));
|
||||
+ putpkt (buf.data ());
|
||||
remote_get_noisy_reply ();
|
||||
if (strcmp (rs->buf, "OK"))
|
||||
warning (_("Target does not support source download."));
|
|
@ -1,449 +0,0 @@
|
|||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
Date: Thu, 9 Aug 2018 17:17:16 +0200
|
||||
Subject: gdb-rhbz1187581-power8-regs-4of7.patch
|
||||
|
||||
;; Add GDB support to access/display POWER8 registers (IBM, RH BZ 1187581).
|
||||
|
||||
commit 4277c4b87addb5354cc47b98d7a73e44cfaf22c2
|
||||
Author: Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
|
||||
Date: Mon Aug 6 16:24:55 2018 -0300
|
||||
|
||||
Use remote register numbers in tracepoint mask
|
||||
|
||||
Currently, tracepoint register masks in the QTDP packets include both
|
||||
internal and remote register numbers, as well as pseudo-register
|
||||
numbers.
|
||||
|
||||
This patch changes this so that the mask only includes remote register
|
||||
numbers.
|
||||
|
||||
Register numbers from agent expressions are already set in the mask
|
||||
using remote numbers. Other tracepoint actions used internal numbers,
|
||||
e.g. "collect $regs" or "collect $<pseudoreg>". To handle pseudoreg
|
||||
numbers, an empty agent expression is created and ax_reg_mask is
|
||||
called for this expression and the pseudoreg. This will cause the ax
|
||||
to set its mask with the corresponding remote raw register
|
||||
numbers (using ax_regs_mask, which calls
|
||||
gdbarch_ax_pseudo_register_collect).
|
||||
|
||||
If ax_regs_mask and gdbarch_ax_pseudo_register_collect also generate
|
||||
more ax bytecode, the ax is also appended to the collection list. It
|
||||
isn't clear that this was the original intent for
|
||||
gdbarch_ax_pseudo_register_collect, and none of the arches seem to do
|
||||
this, but if this changes in the future, it should work.
|
||||
|
||||
The patch also refactors the code used by validate_action line to
|
||||
validate axs into a function that is now called from every place that
|
||||
generates axs. Previously, some parts of tracepoint.c that generated
|
||||
axs didn't check if the ax length was greater than MAX_AGENT_EXPR_LEN.
|
||||
|
||||
gdb/ChangeLog:
|
||||
2018-08-06 Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
|
||||
|
||||
* tracepoint.h (class collection_list) <add_register>: Remove.
|
||||
<add_remote_register, add_ax_registers, add_local_register>:
|
||||
Declare.
|
||||
<add_memrange>: Add scope parameter.
|
||||
* tracepoint.c (encode_actions_1): Likewise.
|
||||
(collection_list::add_register): Rename to ...
|
||||
(collection_list::add_remote_register): ... this. Update
|
||||
comment.
|
||||
(collection_list::add_ax_registers, add_local_register): New
|
||||
methods.
|
||||
(collection_list::add_memrange): Add scope parameter. Call
|
||||
add_local_register instead of add_register.
|
||||
(finalize_tracepoint_aexpr): New function.
|
||||
(collection_list::collect_symbol): Update calls to add_memrange.
|
||||
Call add_local_register instead of add_register. Call
|
||||
add_ax_registers. Call finalize_tracepoint_aexpr.
|
||||
(encode_actions_1): Get remote regnos for $reg action. Call
|
||||
add_remote_register, add_ax_registers, and add_local_register.
|
||||
Update call to add_memrange. Call finalize_tracepoint_aexpr.
|
||||
(validate_actionline): Call finalize_tracepoint_aexpr.
|
||||
|
||||
+2018-08-06 Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
|
||||
+
|
||||
+ * tracepoint.h (class collection_list) <add_register>: Remove.
|
||||
+ <add_remote_register, add_ax_registers, add_local_register>:
|
||||
+ Declare.
|
||||
+ <add_memrange>: Add scope parameter.
|
||||
+ * tracepoint.c (encode_actions_1): Likewise.
|
||||
+ (collection_list::add_register): Rename to ...
|
||||
+ (collection_list::add_remote_register): ... this. Update
|
||||
+ comment.
|
||||
+ (collection_list::add_ax_registers, add_local_register): New
|
||||
+ methods.
|
||||
+ (collection_list::add_memrange): Add scope parameter. Call
|
||||
+ add_local_register instead of add_register.
|
||||
+ (finalize_tracepoint_aexpr): New function.
|
||||
+ (collection_list::collect_symbol): Update calls to add_memrange.
|
||||
+ Call add_local_register instead of add_register. Call
|
||||
+ add_ax_registers. Call finalize_tracepoint_aexpr.
|
||||
+ (encode_actions_1): Get remote regnos for $reg action. Call
|
||||
+ add_remote_register, add_ax_registers, and add_local_register.
|
||||
+ Update call to add_memrange. Call finalize_tracepoint_aexpr.
|
||||
+ (validate_actionline): Call finalize_tracepoint_aexpr.
|
||||
+
|
||||
2018-08-06 Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
|
||||
|
||||
* remote.c (remote_target::download_tracepoint): Remove BUF_SIZE.
|
||||
|
||||
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
|
||||
--- a/gdb/tracepoint.c
|
||||
+++ b/gdb/tracepoint.c
|
||||
@@ -615,6 +615,19 @@ report_agent_reqs_errors (struct agent_expr *aexpr)
|
||||
error (_("Expression is too complicated."));
|
||||
}
|
||||
|
||||
+/* Call ax_reqs on AEXPR and raise an error if something is wrong. */
|
||||
+
|
||||
+static void
|
||||
+finalize_tracepoint_aexpr (struct agent_expr *aexpr)
|
||||
+{
|
||||
+ ax_reqs (aexpr);
|
||||
+
|
||||
+ if (aexpr->len > MAX_AGENT_EXPR_LEN)
|
||||
+ error (_("Expression is too complicated."));
|
||||
+
|
||||
+ report_agent_reqs_errors (aexpr);
|
||||
+}
|
||||
+
|
||||
/* worker function */
|
||||
void
|
||||
validate_actionline (const char *line, struct breakpoint *b)
|
||||
@@ -699,12 +712,7 @@ validate_actionline (const char *line, struct breakpoint *b)
|
||||
exp.get (),
|
||||
trace_string);
|
||||
|
||||
- if (aexpr->len > MAX_AGENT_EXPR_LEN)
|
||||
- error (_("Expression is too complicated."));
|
||||
-
|
||||
- ax_reqs (aexpr.get ());
|
||||
-
|
||||
- report_agent_reqs_errors (aexpr.get ());
|
||||
+ finalize_tracepoint_aexpr (aexpr.get ());
|
||||
}
|
||||
}
|
||||
while (p && *p++ == ',');
|
||||
@@ -731,11 +739,7 @@ validate_actionline (const char *line, struct breakpoint *b)
|
||||
long. */
|
||||
agent_expr_up aexpr = gen_eval_for_expr (loc->address, exp.get ());
|
||||
|
||||
- if (aexpr->len > MAX_AGENT_EXPR_LEN)
|
||||
- error (_("Expression is too complicated."));
|
||||
-
|
||||
- ax_reqs (aexpr.get ());
|
||||
- report_agent_reqs_errors (aexpr.get ());
|
||||
+ finalize_tracepoint_aexpr (aexpr.get ());
|
||||
}
|
||||
}
|
||||
while (p && *p++ == ',');
|
||||
@@ -811,10 +815,10 @@ memrange_sortmerge (std::vector<memrange> &memranges)
|
||||
}
|
||||
}
|
||||
|
||||
-/* Add a register to a collection list. */
|
||||
+/* Add remote register number REGNO to the collection list mask. */
|
||||
|
||||
void
|
||||
-collection_list::add_register (unsigned int regno)
|
||||
+collection_list::add_remote_register (unsigned int regno)
|
||||
{
|
||||
if (info_verbose)
|
||||
printf_filtered ("collect register %d\n", regno);
|
||||
@@ -824,12 +828,74 @@ collection_list::add_register (unsigned int regno)
|
||||
m_regs_mask[regno / 8] |= 1 << (regno % 8);
|
||||
}
|
||||
|
||||
+/* Add all the registers from the mask in AEXPR to the mask in the
|
||||
+ collection list. Registers in the AEXPR mask are already remote
|
||||
+ register numbers. */
|
||||
+
|
||||
+void
|
||||
+collection_list::add_ax_registers (struct agent_expr *aexpr)
|
||||
+{
|
||||
+ if (aexpr->reg_mask_len > 0)
|
||||
+ {
|
||||
+ for (int ndx1 = 0; ndx1 < aexpr->reg_mask_len; ndx1++)
|
||||
+ {
|
||||
+ QUIT; /* Allow user to bail out with ^C. */
|
||||
+ if (aexpr->reg_mask[ndx1] != 0)
|
||||
+ {
|
||||
+ /* Assume chars have 8 bits. */
|
||||
+ for (int ndx2 = 0; ndx2 < 8; ndx2++)
|
||||
+ if (aexpr->reg_mask[ndx1] & (1 << ndx2))
|
||||
+ /* It's used -- record it. */
|
||||
+ add_remote_register (ndx1 * 8 + ndx2);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+/* If REGNO is raw, add its corresponding remote register number to
|
||||
+ the mask. If REGNO is a pseudo-register, figure out the necessary
|
||||
+ registers using a temporary agent expression, and add it to the
|
||||
+ list if it needs more than just a mask. */
|
||||
+
|
||||
+void
|
||||
+collection_list::add_local_register (struct gdbarch *gdbarch,
|
||||
+ unsigned int regno,
|
||||
+ CORE_ADDR scope)
|
||||
+{
|
||||
+ if (regno < gdbarch_num_regs (gdbarch))
|
||||
+ {
|
||||
+ int remote_regno = gdbarch_remote_register_number (gdbarch, regno);
|
||||
+
|
||||
+ if (remote_regno < 0)
|
||||
+ error (_("Can't collect register %d"), regno);
|
||||
+
|
||||
+ add_remote_register (remote_regno);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ agent_expr_up aexpr (new agent_expr (gdbarch, scope));
|
||||
+
|
||||
+ ax_reg_mask (aexpr.get (), regno);
|
||||
+
|
||||
+ finalize_tracepoint_aexpr (aexpr.get ());
|
||||
+
|
||||
+ add_ax_registers (aexpr.get ());
|
||||
+
|
||||
+ /* Usually ax_reg_mask for a pseudo-regiser only sets the
|
||||
+ corresponding raw registers in the ax mask, but if this isn't
|
||||
+ the case add the expression that is generated to the
|
||||
+ collection list. */
|
||||
+ if (aexpr->len > 0)
|
||||
+ add_aexpr (std::move (aexpr));
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
/* Add a memrange to a collection list. */
|
||||
|
||||
void
|
||||
collection_list::add_memrange (struct gdbarch *gdbarch,
|
||||
int type, bfd_signed_vma base,
|
||||
- ULONGEST len)
|
||||
+ ULONGEST len, CORE_ADDR scope)
|
||||
{
|
||||
if (info_verbose)
|
||||
printf_filtered ("(%d,%s,%s)\n", type, paddress (gdbarch, base), pulongest (len));
|
||||
@@ -840,7 +906,7 @@ collection_list::add_memrange (struct gdbarch *gdbarch,
|
||||
m_memranges.emplace_back (type, base, base + len);
|
||||
|
||||
if (type != memrange_absolute) /* Better collect the base register! */
|
||||
- add_register (type);
|
||||
+ add_local_register (gdbarch, type, scope);
|
||||
}
|
||||
|
||||
/* Add a symbol to a collection list. */
|
||||
@@ -882,19 +948,19 @@ collection_list::collect_symbol (struct symbol *sym,
|
||||
if (TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_STRUCT)
|
||||
treat_as_expr = 1;
|
||||
else
|
||||
- add_memrange (gdbarch, memrange_absolute, offset, len);
|
||||
+ add_memrange (gdbarch, memrange_absolute, offset, len, scope);
|
||||
break;
|
||||
case LOC_REGISTER:
|
||||
reg = SYMBOL_REGISTER_OPS (sym)->register_number (sym, gdbarch);
|
||||
if (info_verbose)
|
||||
printf_filtered ("LOC_REG[parm] %s: ",
|
||||
SYMBOL_PRINT_NAME (sym));
|
||||
- add_register (reg);
|
||||
+ add_local_register (gdbarch, reg, scope);
|
||||
/* Check for doubles stored in two registers. */
|
||||
/* FIXME: how about larger types stored in 3 or more regs? */
|
||||
if (TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_FLT &&
|
||||
len > register_size (gdbarch, reg))
|
||||
- add_register (reg + 1);
|
||||
+ add_local_register (gdbarch, reg + 1, scope);
|
||||
break;
|
||||
case LOC_REF_ARG:
|
||||
printf_filtered ("Sorry, don't know how to do LOC_REF_ARG yet.\n");
|
||||
@@ -911,7 +977,7 @@ collection_list::collect_symbol (struct symbol *sym,
|
||||
SYMBOL_PRINT_NAME (sym), pulongest (len),
|
||||
paddress (gdbarch, offset), reg);
|
||||
}
|
||||
- add_memrange (gdbarch, reg, offset, len);
|
||||
+ add_memrange (gdbarch, reg, offset, len, scope);
|
||||
break;
|
||||
case LOC_REGPARM_ADDR:
|
||||
reg = SYMBOL_VALUE (sym);
|
||||
@@ -923,7 +989,7 @@ collection_list::collect_symbol (struct symbol *sym,
|
||||
SYMBOL_PRINT_NAME (sym), pulongest (len),
|
||||
paddress (gdbarch, offset), reg);
|
||||
}
|
||||
- add_memrange (gdbarch, reg, offset, len);
|
||||
+ add_memrange (gdbarch, reg, offset, len, scope);
|
||||
break;
|
||||
case LOC_LOCAL:
|
||||
reg = frame_regno;
|
||||
@@ -935,7 +1001,7 @@ collection_list::collect_symbol (struct symbol *sym,
|
||||
SYMBOL_PRINT_NAME (sym), pulongest (len),
|
||||
paddress (gdbarch, offset), reg);
|
||||
}
|
||||
- add_memrange (gdbarch, reg, offset, len);
|
||||
+ add_memrange (gdbarch, reg, offset, len, scope);
|
||||
break;
|
||||
|
||||
case LOC_UNRESOLVED:
|
||||
@@ -968,26 +1034,10 @@ collection_list::collect_symbol (struct symbol *sym,
|
||||
return;
|
||||
}
|
||||
|
||||
- ax_reqs (aexpr.get ());
|
||||
-
|
||||
- report_agent_reqs_errors (aexpr.get ());
|
||||
+ finalize_tracepoint_aexpr (aexpr.get ());
|
||||
|
||||
/* Take care of the registers. */
|
||||
- if (aexpr->reg_mask_len > 0)
|
||||
- {
|
||||
- for (int ndx1 = 0; ndx1 < aexpr->reg_mask_len; ndx1++)
|
||||
- {
|
||||
- QUIT; /* Allow user to bail out with ^C. */
|
||||
- if (aexpr->reg_mask[ndx1] != 0)
|
||||
- {
|
||||
- /* Assume chars have 8 bits. */
|
||||
- for (int ndx2 = 0; ndx2 < 8; ndx2++)
|
||||
- if (aexpr->reg_mask[ndx1] & (1 << ndx2))
|
||||
- /* It's used -- record it. */
|
||||
- add_register (ndx1 * 8 + ndx2);
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
+ add_ax_registers (aexpr.get ());
|
||||
|
||||
add_aexpr (std::move (aexpr));
|
||||
}
|
||||
@@ -1257,8 +1307,18 @@ encode_actions_1 (struct command_line *action,
|
||||
|
||||
if (0 == strncasecmp ("$reg", action_exp, 4))
|
||||
{
|
||||
- for (i = 0; i < gdbarch_num_regs (target_gdbarch ()); i++)
|
||||
- collect->add_register (i);
|
||||
+ for (i = 0; i < gdbarch_num_regs (target_gdbarch ());
|
||||
+ i++)
|
||||
+ {
|
||||
+ int remote_regno = (gdbarch_remote_register_number
|
||||
+ (target_gdbarch (), i));
|
||||
+
|
||||
+ /* Ignore arch regnos without a corresponding
|
||||
+ remote regno. This can happen for regnos not
|
||||
+ in the tdesc. */
|
||||
+ if (remote_regno >= 0)
|
||||
+ collect->add_remote_register (remote_regno);
|
||||
+ }
|
||||
action_exp = strchr (action_exp, ','); /* more? */
|
||||
}
|
||||
else if (0 == strncasecmp ("$arg", action_exp, 4))
|
||||
@@ -1288,27 +1348,10 @@ encode_actions_1 (struct command_line *action,
|
||||
target_gdbarch (),
|
||||
trace_string);
|
||||
|
||||
- ax_reqs (aexpr.get ());
|
||||
- report_agent_reqs_errors (aexpr.get ());
|
||||
+ finalize_tracepoint_aexpr (aexpr.get ());
|
||||
|
||||
/* take care of the registers */
|
||||
- if (aexpr->reg_mask_len > 0)
|
||||
- {
|
||||
- for (int ndx1 = 0; ndx1 < aexpr->reg_mask_len; ndx1++)
|
||||
- {
|
||||
- QUIT; /* allow user to bail out with ^C */
|
||||
- if (aexpr->reg_mask[ndx1] != 0)
|
||||
- {
|
||||
- /* assume chars have 8 bits */
|
||||
- for (int ndx2 = 0; ndx2 < 8; ndx2++)
|
||||
- if (aexpr->reg_mask[ndx1] & (1 << ndx2))
|
||||
- {
|
||||
- /* It's used -- record it. */
|
||||
- collect->add_register (ndx1 * 8 + ndx2);
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
+ collect->add_ax_registers (aexpr.get ());
|
||||
|
||||
collect->add_aexpr (std::move (aexpr));
|
||||
action_exp = strchr (action_exp, ','); /* more? */
|
||||
@@ -1340,7 +1383,8 @@ encode_actions_1 (struct command_line *action,
|
||||
name);
|
||||
if (info_verbose)
|
||||
printf_filtered ("OP_REGISTER: ");
|
||||
- collect->add_register (i);
|
||||
+ collect->add_local_register (target_gdbarch (),
|
||||
+ i, tloc->address);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1352,7 +1396,8 @@ encode_actions_1 (struct command_line *action,
|
||||
check_typedef (exp->elts[1].type);
|
||||
collect->add_memrange (target_gdbarch (),
|
||||
memrange_absolute, addr,
|
||||
- TYPE_LENGTH (exp->elts[1].type));
|
||||
+ TYPE_LENGTH (exp->elts[1].type),
|
||||
+ tloc->address);
|
||||
collect->append_exp (exp.get ());
|
||||
break;
|
||||
|
||||
@@ -1376,28 +1421,10 @@ encode_actions_1 (struct command_line *action,
|
||||
exp.get (),
|
||||
trace_string);
|
||||
|
||||
- ax_reqs (aexpr.get ());
|
||||
-
|
||||
- report_agent_reqs_errors (aexpr.get ());
|
||||
+ finalize_tracepoint_aexpr (aexpr.get ());
|
||||
|
||||
/* Take care of the registers. */
|
||||
- if (aexpr->reg_mask_len > 0)
|
||||
- {
|
||||
- for (int ndx1 = 0; ndx1 < aexpr->reg_mask_len; ndx1++)
|
||||
- {
|
||||
- QUIT; /* Allow user to bail out with ^C. */
|
||||
- if (aexpr->reg_mask[ndx1] != 0)
|
||||
- {
|
||||
- /* Assume chars have 8 bits. */
|
||||
- for (int ndx2 = 0; ndx2 < 8; ndx2++)
|
||||
- if (aexpr->reg_mask[ndx1] & (1 << ndx2))
|
||||
- {
|
||||
- /* It's used -- record it. */
|
||||
- collect->add_register (ndx1 * 8 + ndx2);
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
+ collect->add_ax_registers (aexpr.get ());
|
||||
|
||||
collect->add_aexpr (std::move (aexpr));
|
||||
collect->append_exp (exp.get ());
|
||||
@@ -1422,8 +1449,7 @@ encode_actions_1 (struct command_line *action,
|
||||
agent_expr_up aexpr = gen_eval_for_expr (tloc->address,
|
||||
exp.get ());
|
||||
|
||||
- ax_reqs (aexpr.get ());
|
||||
- report_agent_reqs_errors (aexpr.get ());
|
||||
+ finalize_tracepoint_aexpr (aexpr.get ());
|
||||
|
||||
/* Even though we're not officially collecting, add
|
||||
to the collect list anyway. */
|
||||
diff --git a/gdb/tracepoint.h b/gdb/tracepoint.h
|
||||
--- a/gdb/tracepoint.h
|
||||
+++ b/gdb/tracepoint.h
|
||||
@@ -263,9 +263,14 @@ public:
|
||||
void add_aexpr (agent_expr_up aexpr);
|
||||
|
||||
void add_register (unsigned int regno);
|
||||
+ void add_remote_register (unsigned int regno);
|
||||
+ void add_ax_registers (struct agent_expr *aexpr);
|
||||
+ void add_local_register (struct gdbarch *gdbarch,
|
||||
+ unsigned int regno,
|
||||
+ CORE_ADDR scope);
|
||||
void add_memrange (struct gdbarch *gdbarch,
|
||||
int type, bfd_signed_vma base,
|
||||
- ULONGEST len);
|
||||
+ ULONGEST len, CORE_ADDR scope);
|
||||
void collect_symbol (struct symbol *sym,
|
||||
struct gdbarch *gdbarch,
|
||||
long frame_regno, long frame_offset,
|
|
@ -1,215 +0,0 @@
|
|||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
Date: Thu, 9 Aug 2018 17:17:46 +0200
|
||||
Subject: gdb-rhbz1187581-power8-regs-5of7.patch
|
||||
|
||||
;; Add GDB support to access/display POWER8 registers (IBM, RH BZ 1187581).
|
||||
|
||||
commit a04b9d62a234923826e431a209d396a628661548
|
||||
Author: Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
|
||||
Date: Mon Aug 6 16:24:55 2018 -0300
|
||||
|
||||
Variable size for regs mask in collection list
|
||||
|
||||
This patch changes collection_list to allow larger register masks.
|
||||
|
||||
The mask is changed from an array to a vector and is initialized to
|
||||
hold the maximum possible remote register number. The stringify
|
||||
method is updated to resize temp_buf if needed.
|
||||
|
||||
gdb/ChangeLog:
|
||||
2018-08-06 Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
|
||||
|
||||
* tracepoint.h (collection_list) <m_regs_mask>: Change type to
|
||||
std::vector<unsigned char>.
|
||||
* tracepoint.c (collection_list::collection_list): Remove
|
||||
m_regs_mask initializer from initializer list. Resize
|
||||
m_regs_mask using the largest remote register number.
|
||||
(collection_list::add_remote_register): Remove size check on
|
||||
m_regs_mask. Use at to access element.
|
||||
(collection_list::stringify): Change type of temp_buf to
|
||||
gdb::char_vector. Update uses of temp_buf. Resize if needed to
|
||||
stringify the register mask. Use pack_hex_byte for the register
|
||||
mask.
|
||||
|
||||
+2018-08-06 Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
|
||||
+
|
||||
+ * tracepoint.h (collection_list) <m_regs_mask>: Change type to
|
||||
+ std::vector<unsigned char>.
|
||||
+ * tracepoint.c (collection_list::collection_list): Remove
|
||||
+ m_regs_mask initializer from initializer list. Resize
|
||||
+ m_regs_mask using the largest remote register number.
|
||||
+ (collection_list::add_remote_register): Remove size check on
|
||||
+ m_regs_mask. Use at to access element.
|
||||
+ (collection_list::stringify): Change type of temp_buf to
|
||||
+ gdb::char_vector. Update uses of temp_buf. Resize if needed to
|
||||
+ stringify the register mask. Use pack_hex_byte for the register
|
||||
+ mask.
|
||||
+
|
||||
2018-08-06 Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
|
||||
|
||||
* tracepoint.h (class collection_list) <add_register>: Remove.
|
||||
|
||||
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
|
||||
--- a/gdb/tracepoint.c
|
||||
+++ b/gdb/tracepoint.c
|
||||
@@ -822,10 +822,8 @@ collection_list::add_remote_register (unsigned int regno)
|
||||
{
|
||||
if (info_verbose)
|
||||
printf_filtered ("collect register %d\n", regno);
|
||||
- if (regno >= (8 * sizeof (m_regs_mask)))
|
||||
- error (_("Internal: register number %d too large for tracepoint"),
|
||||
- regno);
|
||||
- m_regs_mask[regno / 8] |= 1 << (regno % 8);
|
||||
+
|
||||
+ m_regs_mask.at (regno / 8) |= 1 << (regno % 8);
|
||||
}
|
||||
|
||||
/* Add all the registers from the mask in AEXPR to the mask in the
|
||||
@@ -1136,9 +1134,20 @@ collection_list::add_static_trace_data ()
|
||||
}
|
||||
|
||||
collection_list::collection_list ()
|
||||
- : m_regs_mask (),
|
||||
- m_strace_data (false)
|
||||
+ : m_strace_data (false)
|
||||
{
|
||||
+ int max_remote_regno = 0;
|
||||
+ for (int i = 0; i < gdbarch_num_regs (target_gdbarch ()); i++)
|
||||
+ {
|
||||
+ int remote_regno = (gdbarch_remote_register_number
|
||||
+ (target_gdbarch (), i));
|
||||
+
|
||||
+ if (remote_regno >= 0 && remote_regno > max_remote_regno)
|
||||
+ max_remote_regno = remote_regno;
|
||||
+ }
|
||||
+
|
||||
+ m_regs_mask.resize ((max_remote_regno / 8) + 1);
|
||||
+
|
||||
m_memranges.reserve (128);
|
||||
m_aexprs.reserve (128);
|
||||
}
|
||||
@@ -1148,7 +1157,8 @@ collection_list::collection_list ()
|
||||
std::vector<std::string>
|
||||
collection_list::stringify ()
|
||||
{
|
||||
- char temp_buf[2048];
|
||||
+ gdb::char_vector temp_buf (2048);
|
||||
+
|
||||
int count;
|
||||
char *end;
|
||||
long i;
|
||||
@@ -1158,35 +1168,45 @@ collection_list::stringify ()
|
||||
{
|
||||
if (info_verbose)
|
||||
printf_filtered ("\nCollecting static trace data\n");
|
||||
- end = temp_buf;
|
||||
+ end = temp_buf.data ();
|
||||
*end++ = 'L';
|
||||
- str_list.emplace_back (temp_buf, end - temp_buf);
|
||||
+ str_list.emplace_back (temp_buf.data (), end - temp_buf.data ());
|
||||
}
|
||||
|
||||
- for (i = sizeof (m_regs_mask) - 1; i > 0; i--)
|
||||
+ for (i = m_regs_mask.size () - 1; i > 0; i--)
|
||||
if (m_regs_mask[i] != 0) /* Skip leading zeroes in regs_mask. */
|
||||
break;
|
||||
if (m_regs_mask[i] != 0) /* Prepare to send regs_mask to the stub. */
|
||||
{
|
||||
if (info_verbose)
|
||||
printf_filtered ("\nCollecting registers (mask): 0x");
|
||||
- end = temp_buf;
|
||||
+
|
||||
+ /* One char for 'R', one for the null terminator and two per
|
||||
+ mask byte. */
|
||||
+ std::size_t new_size = (i + 1) * 2 + 2;
|
||||
+ if (new_size > temp_buf.size ())
|
||||
+ temp_buf.resize (new_size);
|
||||
+
|
||||
+ end = temp_buf.data ();
|
||||
*end++ = 'R';
|
||||
for (; i >= 0; i--)
|
||||
{
|
||||
QUIT; /* Allow user to bail out with ^C. */
|
||||
if (info_verbose)
|
||||
printf_filtered ("%02X", m_regs_mask[i]);
|
||||
- sprintf (end, "%02X", m_regs_mask[i]);
|
||||
- end += 2;
|
||||
+
|
||||
+ end = pack_hex_byte (end, m_regs_mask[i]);
|
||||
}
|
||||
- str_list.emplace_back (temp_buf);
|
||||
+ *end = '\0';
|
||||
+
|
||||
+ str_list.emplace_back (temp_buf.data ());
|
||||
}
|
||||
if (info_verbose)
|
||||
printf_filtered ("\n");
|
||||
if (!m_memranges.empty () && info_verbose)
|
||||
printf_filtered ("Collecting memranges: \n");
|
||||
- for (i = 0, count = 0, end = temp_buf; i < m_memranges.size (); i++)
|
||||
+ for (i = 0, count = 0, end = temp_buf.data ();
|
||||
+ i < m_memranges.size (); i++)
|
||||
{
|
||||
QUIT; /* Allow user to bail out with ^C. */
|
||||
if (info_verbose)
|
||||
@@ -1200,9 +1220,9 @@ collection_list::stringify ()
|
||||
}
|
||||
if (count + 27 > MAX_AGENT_EXPR_LEN)
|
||||
{
|
||||
- str_list.emplace_back (temp_buf, count);
|
||||
+ str_list.emplace_back (temp_buf.data (), count);
|
||||
count = 0;
|
||||
- end = temp_buf;
|
||||
+ end = temp_buf.data ();
|
||||
}
|
||||
|
||||
{
|
||||
@@ -1222,7 +1242,7 @@ collection_list::stringify ()
|
||||
}
|
||||
|
||||
count += strlen (end);
|
||||
- end = temp_buf + count;
|
||||
+ end = temp_buf.data () + count;
|
||||
}
|
||||
|
||||
for (i = 0; i < m_aexprs.size (); i++)
|
||||
@@ -1230,9 +1250,9 @@ collection_list::stringify ()
|
||||
QUIT; /* Allow user to bail out with ^C. */
|
||||
if ((count + 10 + 2 * m_aexprs[i]->len) > MAX_AGENT_EXPR_LEN)
|
||||
{
|
||||
- str_list.emplace_back (temp_buf, count);
|
||||
+ str_list.emplace_back (temp_buf.data (), count);
|
||||
count = 0;
|
||||
- end = temp_buf;
|
||||
+ end = temp_buf.data ();
|
||||
}
|
||||
sprintf (end, "X%08X,", m_aexprs[i]->len);
|
||||
end += 10; /* 'X' + 8 hex digits + ',' */
|
||||
@@ -1244,9 +1264,9 @@ collection_list::stringify ()
|
||||
|
||||
if (count != 0)
|
||||
{
|
||||
- str_list.emplace_back (temp_buf, count);
|
||||
+ str_list.emplace_back (temp_buf.data (), count);
|
||||
count = 0;
|
||||
- end = temp_buf;
|
||||
+ end = temp_buf.data ();
|
||||
}
|
||||
|
||||
return str_list;
|
||||
diff --git a/gdb/tracepoint.h b/gdb/tracepoint.h
|
||||
--- a/gdb/tracepoint.h
|
||||
+++ b/gdb/tracepoint.h
|
||||
@@ -293,8 +293,9 @@ public:
|
||||
{ return m_computed; }
|
||||
|
||||
private:
|
||||
- /* room for up to 256 regs */
|
||||
- unsigned char m_regs_mask[32];
|
||||
+ /* We need the allocator zero-initialize the mask, so we don't use
|
||||
+ gdb::byte_vector. */
|
||||
+ std::vector<unsigned char> m_regs_mask;
|
||||
|
||||
std::vector<memrange> m_memranges;
|
||||
|
|
@ -1,187 +0,0 @@
|
|||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
Date: Thu, 9 Aug 2018 17:18:15 +0200
|
||||
Subject: gdb-rhbz1187581-power8-regs-6of7.patch
|
||||
|
||||
;; Add GDB support to access/display POWER8 registers (IBM, RH BZ 1187581).
|
||||
|
||||
commit 296956befef3711ed458c7cba8041fde0dab9c50
|
||||
Author: Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
|
||||
Date: Mon Aug 6 16:24:55 2018 -0300
|
||||
|
||||
Allow larger regblock sizes when saving tracefiles
|
||||
|
||||
The tracefile.c:trace_save function assumes trace_regblock_size won't
|
||||
be larger than the MAX_TRACE_UPLOAD constant, used to size the buffer
|
||||
which holds trace data. This can cause buffer overruns when this is
|
||||
not the case. This patch changes this function so that the larger
|
||||
size is used to size the buffer.
|
||||
|
||||
gdb/ChangeLog:
|
||||
2018-08-06 Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
|
||||
|
||||
* tracefile.c: Include common/byte-vector.h.
|
||||
(trace_save): Change type of buf to gdb::byte_vector. Initialize
|
||||
with trace_regblock_size if needed. Update uses of buf.
|
||||
|
||||
+2018-08-06 Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
|
||||
+
|
||||
+ * tracefile.c: Include common/byte-vector.h.
|
||||
+ (trace_save): Change type of buf to gdb::byte_vector. Initialize
|
||||
+ with trace_regblock_size if needed. Update uses of buf.
|
||||
+
|
||||
2018-08-06 Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
|
||||
|
||||
* tracepoint.h (collection_list) <m_regs_mask>: Change type to
|
||||
|
||||
diff --git a/gdb/tracefile.c b/gdb/tracefile.c
|
||||
--- a/gdb/tracefile.c
|
||||
+++ b/gdb/tracefile.c
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "ctf.h"
|
||||
#include "exec.h"
|
||||
#include "regcache.h"
|
||||
+#include "common/byte-vector.h"
|
||||
|
||||
/* Helper macros. */
|
||||
|
||||
@@ -67,7 +68,7 @@ trace_save (const char *filename, struct trace_file_writer *writer,
|
||||
|
||||
ULONGEST offset = 0;
|
||||
#define MAX_TRACE_UPLOAD 2000
|
||||
- gdb_byte buf[MAX_TRACE_UPLOAD];
|
||||
+ gdb::byte_vector buf (std::max (MAX_TRACE_UPLOAD, trace_regblock_size));
|
||||
enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
|
||||
|
||||
/* If the target is to save the data to a file on its own, then just
|
||||
@@ -144,7 +145,7 @@ trace_save (const char *filename, struct trace_file_writer *writer,
|
||||
/* We ask for big blocks, in the hopes of efficiency, but
|
||||
will take less if the target has packet size limitations
|
||||
or some such. */
|
||||
- gotten = target_get_raw_trace_data (buf, offset,
|
||||
+ gotten = target_get_raw_trace_data (buf.data (), offset,
|
||||
MAX_TRACE_UPLOAD);
|
||||
if (gotten < 0)
|
||||
error (_("Failure to get requested trace buffer data"));
|
||||
@@ -152,7 +153,7 @@ trace_save (const char *filename, struct trace_file_writer *writer,
|
||||
if (gotten == 0)
|
||||
break;
|
||||
|
||||
- writer->ops->write_trace_buffer (writer, buf, gotten);
|
||||
+ writer->ops->write_trace_buffer (writer, buf.data (), gotten);
|
||||
|
||||
offset += gotten;
|
||||
}
|
||||
@@ -163,7 +164,7 @@ trace_save (const char *filename, struct trace_file_writer *writer,
|
||||
/* Parse the trace buffers according to how data are stored
|
||||
in trace buffer in GDBserver. */
|
||||
|
||||
- gotten = target_get_raw_trace_data (buf, offset, 6);
|
||||
+ gotten = target_get_raw_trace_data (buf.data (), offset, 6);
|
||||
|
||||
if (gotten == 0)
|
||||
break;
|
||||
@@ -171,10 +172,10 @@ trace_save (const char *filename, struct trace_file_writer *writer,
|
||||
/* Read the first six bytes in, which is the tracepoint
|
||||
number and trace frame size. */
|
||||
tp_num = (uint16_t)
|
||||
- extract_unsigned_integer (&buf[0], 2, byte_order);
|
||||
+ extract_unsigned_integer (&((buf.data ())[0]), 2, byte_order);
|
||||
|
||||
tf_size = (uint32_t)
|
||||
- extract_unsigned_integer (&buf[2], 4, byte_order);
|
||||
+ extract_unsigned_integer (&((buf.data ())[2]), 4, byte_order);
|
||||
|
||||
writer->ops->frame_ops->start (writer, tp_num);
|
||||
gotten = 6;
|
||||
@@ -192,7 +193,8 @@ trace_save (const char *filename, struct trace_file_writer *writer,
|
||||
/* We'll fetch one block each time, in order to
|
||||
handle the extremely large 'M' block. We first
|
||||
fetch one byte to get the type of the block. */
|
||||
- gotten = target_get_raw_trace_data (buf, offset, 1);
|
||||
+ gotten = target_get_raw_trace_data (buf.data (),
|
||||
+ offset, 1);
|
||||
if (gotten < 1)
|
||||
error (_("Failure to get requested trace buffer data"));
|
||||
|
||||
@@ -205,13 +207,13 @@ trace_save (const char *filename, struct trace_file_writer *writer,
|
||||
{
|
||||
case 'R':
|
||||
gotten
|
||||
- = target_get_raw_trace_data (buf, offset,
|
||||
+ = target_get_raw_trace_data (buf.data (), offset,
|
||||
trace_regblock_size);
|
||||
if (gotten < trace_regblock_size)
|
||||
error (_("Failure to get requested trace"
|
||||
" buffer data"));
|
||||
|
||||
- TRACE_WRITE_R_BLOCK (writer, buf,
|
||||
+ TRACE_WRITE_R_BLOCK (writer, buf.data (),
|
||||
trace_regblock_size);
|
||||
break;
|
||||
case 'M':
|
||||
@@ -221,7 +223,8 @@ trace_save (const char *filename, struct trace_file_writer *writer,
|
||||
LONGEST t;
|
||||
int j;
|
||||
|
||||
- t = target_get_raw_trace_data (buf,offset, 10);
|
||||
+ t = target_get_raw_trace_data (buf.data (),
|
||||
+ offset, 10);
|
||||
if (t < 10)
|
||||
error (_("Failure to get requested trace"
|
||||
" buffer data"));
|
||||
@@ -231,10 +234,10 @@ trace_save (const char *filename, struct trace_file_writer *writer,
|
||||
|
||||
gotten = 0;
|
||||
addr = (ULONGEST)
|
||||
- extract_unsigned_integer (buf, 8,
|
||||
+ extract_unsigned_integer (buf.data (), 8,
|
||||
byte_order);
|
||||
mlen = (unsigned short)
|
||||
- extract_unsigned_integer (&buf[8], 2,
|
||||
+ extract_unsigned_integer (&((buf.data ())[8]), 2,
|
||||
byte_order);
|
||||
|
||||
TRACE_WRITE_M_BLOCK_HEADER (writer, addr,
|
||||
@@ -252,14 +255,15 @@ trace_save (const char *filename, struct trace_file_writer *writer,
|
||||
else
|
||||
read_length = mlen - j;
|
||||
|
||||
- t = target_get_raw_trace_data (buf,
|
||||
+ t = target_get_raw_trace_data (buf.data (),
|
||||
offset + j,
|
||||
read_length);
|
||||
if (t < read_length)
|
||||
error (_("Failure to get requested"
|
||||
" trace buffer data"));
|
||||
|
||||
- TRACE_WRITE_M_BLOCK_MEMORY (writer, buf,
|
||||
+ TRACE_WRITE_M_BLOCK_MEMORY (writer,
|
||||
+ buf.data (),
|
||||
read_length);
|
||||
|
||||
j += read_length;
|
||||
@@ -274,18 +278,18 @@ trace_save (const char *filename, struct trace_file_writer *writer,
|
||||
LONGEST val;
|
||||
|
||||
gotten
|
||||
- = target_get_raw_trace_data (buf, offset,
|
||||
- 12);
|
||||
+ = target_get_raw_trace_data (buf.data (),
|
||||
+ offset, 12);
|
||||
if (gotten < 12)
|
||||
error (_("Failure to get requested"
|
||||
" trace buffer data"));
|
||||
|
||||
- vnum = (int) extract_signed_integer (buf,
|
||||
+ vnum = (int) extract_signed_integer (buf.data (),
|
||||
4,
|
||||
byte_order);
|
||||
val
|
||||
- = extract_signed_integer (&buf[4], 8,
|
||||
- byte_order);
|
||||
+ = extract_signed_integer (&((buf.data ())[4]),
|
||||
+ 8, byte_order);
|
||||
|
||||
TRACE_WRITE_V_BLOCK (writer, vnum, val);
|
||||
}
|
|
@ -1,129 +0,0 @@
|
|||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
Date: Thu, 9 Aug 2018 17:18:49 +0200
|
||||
Subject: gdb-rhbz1187581-power8-regs-7of7.patch
|
||||
|
||||
;; Add GDB support to access/display POWER8 registers (IBM, RH BZ 1187581).
|
||||
|
||||
commit a7f25a84f4cc1df5248c46346337f19a2a66af5a
|
||||
Author: Simon Marchi <simon.marchi@ericsson.com>
|
||||
Date: Mon Aug 6 16:54:47 2018 -0400
|
||||
|
||||
Fix compilation failure in remote.c
|
||||
|
||||
A recent patch introduced a few of these:
|
||||
|
||||
/home/emaisin/src/binutils-gdb/gdb/remote.c:12862:19: error: format not a string literal and no format arguments [-Werror=format-security]
|
||||
error (err_msg);
|
||||
^
|
||||
|
||||
Fix them by replacing the call to error with
|
||||
|
||||
error ("%s", err_msg);
|
||||
|
||||
gdb/ChangeLog:
|
||||
|
||||
* remote.c (remote_target::download_tracepoint): Fix format
|
||||
string errors.
|
||||
|
||||
+2018-08-06 Simon Marchi <simon.marchi@ericsson.com>
|
||||
+
|
||||
+ * remote.c (remote_target::download_tracepoint): Fix format
|
||||
+ string errors.
|
||||
+
|
||||
2018-08-06 Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
|
||||
|
||||
* tracefile.c: Include common/byte-vector.h.
|
||||
|
||||
diff --git a/gdb/remote.c b/gdb/remote.c
|
||||
--- a/gdb/remote.c
|
||||
+++ b/gdb/remote.c
|
||||
@@ -12826,7 +12826,7 @@ remote_target::download_tracepoint (struct bp_location *loc)
|
||||
t->step_count, t->pass_count);
|
||||
|
||||
if (ret < 0 || ret >= buf.size ())
|
||||
- error (err_msg);
|
||||
+ error ("%s", err_msg);
|
||||
|
||||
/* Fast tracepoints are mostly handled by the target, but we can
|
||||
tell the target how big of an instruction block should be moved
|
||||
@@ -12846,7 +12846,7 @@ remote_target::download_tracepoint (struct bp_location *loc)
|
||||
gdb_insn_length (loc->gdbarch, tpaddr));
|
||||
|
||||
if (ret < 0 || ret >= size_left)
|
||||
- error (err_msg);
|
||||
+ error ("%s", err_msg);
|
||||
}
|
||||
else
|
||||
/* If it passed validation at definition but fails now,
|
||||
@@ -12877,7 +12877,7 @@ remote_target::download_tracepoint (struct bp_location *loc)
|
||||
size_left, ":S");
|
||||
|
||||
if (ret < 0 || ret >= size_left)
|
||||
- error (err_msg);
|
||||
+ error ("%s", err_msg);
|
||||
}
|
||||
else
|
||||
error (_("Static tracepoint not valid during download"));
|
||||
@@ -12905,14 +12905,14 @@ remote_target::download_tracepoint (struct bp_location *loc)
|
||||
size_left, ":X%x,", aexpr->len);
|
||||
|
||||
if (ret < 0 || ret >= size_left)
|
||||
- error (err_msg);
|
||||
+ error ("%s", err_msg);
|
||||
|
||||
size_left = buf.size () - strlen (buf.data ());
|
||||
|
||||
/* Two bytes to encode each aexpr byte, plus the terminating
|
||||
null byte. */
|
||||
if (aexpr->len * 2 + 1 > size_left)
|
||||
- error (err_msg);
|
||||
+ error ("%s", err_msg);
|
||||
|
||||
pkt = buf.data () + strlen (buf.data ());
|
||||
|
||||
@@ -12933,7 +12933,7 @@ remote_target::download_tracepoint (struct bp_location *loc)
|
||||
size_left, "-");
|
||||
|
||||
if (ret < 0 || ret >= size_left)
|
||||
- error (err_msg);
|
||||
+ error ("%s", err_msg);
|
||||
}
|
||||
|
||||
putpkt (buf.data ());
|
||||
@@ -12956,7 +12956,7 @@ remote_target::download_tracepoint (struct bp_location *loc)
|
||||
has_more ? '-' : 0);
|
||||
|
||||
if (ret < 0 || ret >= buf.size ())
|
||||
- error (err_msg);
|
||||
+ error ("%s", err_msg);
|
||||
|
||||
putpkt (buf.data ());
|
||||
remote_get_noisy_reply ();
|
||||
@@ -12979,7 +12979,7 @@ remote_target::download_tracepoint (struct bp_location *loc)
|
||||
has_more ? "-" : "");
|
||||
|
||||
if (ret < 0 || ret >= buf.size ())
|
||||
- error (err_msg);
|
||||
+ error ("%s", err_msg);
|
||||
|
||||
putpkt (buf.data ());
|
||||
remote_get_noisy_reply ();
|
||||
@@ -12994,7 +12994,7 @@ remote_target::download_tracepoint (struct bp_location *loc)
|
||||
ret = snprintf (buf.data (), buf.size (), "QTDPsrc:");
|
||||
|
||||
if (ret < 0 || ret >= buf.size ())
|
||||
- error (err_msg);
|
||||
+ error ("%s", err_msg);
|
||||
|
||||
encode_source_string (b->number, loc->address, "at",
|
||||
event_location_to_string (b->location.get ()),
|
||||
@@ -13010,7 +13010,7 @@ remote_target::download_tracepoint (struct bp_location *loc)
|
||||
ret = snprintf (buf.data (), buf.size (), "QTDPsrc:");
|
||||
|
||||
if (ret < 0 || ret >= buf.size ())
|
||||
- error (err_msg);
|
||||
+ error ("%s", err_msg);
|
||||
|
||||
encode_source_string (b->number, loc->address,
|
||||
"cond", b->cond_string,
|
|
@ -1,35 +0,0 @@
|
|||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Keith Seitz <keiths@redhat.com>
|
||||
Date: Fri, 11 Jan 2019 17:02:12 -0500
|
||||
Subject: gdb-rhbz1187581-power8-regs-not-in-8.2-01of15.patch
|
||||
|
||||
;; Fix remote.c build failure
|
||||
;; Szabolcs Nagy, RH BZ 1187581
|
||||
|
||||
Fix gdb/remote.c build failure
|
||||
|
||||
Add const qualifier to fix
|
||||
|
||||
/S/gdb/common/gdb_locale.h:35:27: error: deprecated conversion from string c
|
||||
# define _(String) (String)
|
||||
^
|
||||
/S/gdb/remote.c:12844:19: note: in expansion of macro '_'
|
||||
char *err_msg = _("Tracepoint packet too large for target.");
|
||||
^
|
||||
gdb/ChangeLog:
|
||||
|
||||
* remote.c (remote_target::download_tracepoint): Change char* to
|
||||
const char*.
|
||||
|
||||
diff --git a/gdb/remote.c b/gdb/remote.c
|
||||
--- a/gdb/remote.c
|
||||
+++ b/gdb/remote.c
|
||||
@@ -12808,7 +12808,7 @@ remote_target::download_tracepoint (struct bp_location *loc)
|
||||
struct tracepoint *t = (struct tracepoint *) b;
|
||||
struct remote_state *rs = get_remote_state ();
|
||||
int ret;
|
||||
- char *err_msg = _("Tracepoint packet too large for target.");
|
||||
+ const char *err_msg = _("Tracepoint packet too large for target.");
|
||||
size_t size_left;
|
||||
|
||||
/* We use a buffer other than rs->buf because we'll build strings
|
|
@ -1,479 +0,0 @@
|
|||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Keith Seitz <keiths@redhat.com>
|
||||
Date: Fri, 11 Jan 2019 17:02:12 -0500
|
||||
Subject: gdb-rhbz1187581-power8-regs-not-in-8.2-02of15.patch
|
||||
|
||||
;; Add grok/write functions for new ppc core note sections
|
||||
;; Edjunior Barbosa Machado, RH BZ 1187581
|
||||
|
||||
Add grok/write functions for new ppc core note sections
|
||||
|
||||
This patch adds functions for grokking and writing more register core
|
||||
note sections (NT_PPC_TAR, NT_PPC_PPR, NT_PPC_DSCR, NT_PPC_EBB,
|
||||
NT_PPC_PMU, NT_PPC_TM_CGPR, NT_PPC_TM_CFPR, NT_PPC_TM_CVMX,
|
||||
NT_PPC_TM_CVSX, NT_PPC_TM_SPR, NT_PPC_TM_CTAR, NT_PPC_TM_CPPR,
|
||||
NT_PPC_TM_CDSCR).
|
||||
|
||||
2018-07-16 Edjunior Barbosa Machado <emachado@linux.vnet.ibm.com>
|
||||
|
||||
bfd/
|
||||
* elf-bfd.h (elfcore_write_ppc_tar): Add prototype.
|
||||
(elfcore_write_ppc_ppr): Likewise.
|
||||
(elfcore_write_ppc_dscr): Likewise.
|
||||
(elfcore_write_ppc_ebb): Likewise.
|
||||
(elfcore_write_ppc_pmu): Likewise.
|
||||
(elfcore_write_ppc_tm_cgpr): Likewise.
|
||||
(elfcore_write_ppc_tm_cfpr): Likewise.
|
||||
(elfcore_write_ppc_tm_cvmx): Likewise.
|
||||
(elfcore_write_ppc_tm_cvsx): Likewise.
|
||||
(elfcore_write_ppc_tm_spr): Likewise.
|
||||
(elfcore_write_ppc_tm_ctar): Likewise.
|
||||
(elfcore_write_ppc_tm_cppr): Likewise.
|
||||
(elfcore_write_ppc_tm_cdscr): Likewise.
|
||||
* elf.c (elfcore_write_ppc_tar): New function.
|
||||
(elfcore_write_ppc_ppr): Likewise.
|
||||
(elfcore_write_ppc_dscr): Likewise.
|
||||
(elfcore_write_ppc_ebb): Likewise.
|
||||
(elfcore_write_ppc_pmu): Likewise.
|
||||
(elfcore_write_ppc_tm_cgpr): Likewise.
|
||||
(elfcore_write_ppc_tm_cfpr): Likewise.
|
||||
(elfcore_write_ppc_tm_cvmx): Likewise.
|
||||
(elfcore_write_ppc_tm_cvsx): Likewise.
|
||||
(elfcore_write_ppc_tm_spr): Likewise.
|
||||
(elfcore_write_ppc_tm_ctar): Likewise.
|
||||
(elfcore_write_ppc_tm_cppr): Likewise.
|
||||
(elfcore_write_ppc_tm_cdscr): Likewise.
|
||||
(elfcore_write_register_note): Call them.
|
||||
(elfcore_grok_ppc_tar): New function.
|
||||
(elfcore_grok_ppc_ppr): Likewise.
|
||||
(elfcore_grok_ppc_dscr): Likewise.
|
||||
(elfcore_grok_ppc_ebb): Likewise.
|
||||
(elfcore_grok_ppc_pmu): Likewise.
|
||||
(elfcore_grok_ppc_tm_cgpr): Likewise.
|
||||
(elfcore_grok_ppc_tm_cfpr): Likewise.
|
||||
(elfcore_grok_ppc_tm_cvmx): Likewise.
|
||||
(elfcore_grok_ppc_tm_cvsx): Likewise.
|
||||
(elfcore_grok_ppc_tm_spr): Likewise.
|
||||
(elfcore_grok_ppc_tm_ctar): Likewise.
|
||||
(elfcore_grok_ppc_tm_cppr): Likewise.
|
||||
(elfcore_grok_ppc_tm_cdscr): Likewise.
|
||||
(elfcore_grok_note): Call them.
|
||||
|
||||
diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
|
||||
--- a/bfd/elf-bfd.h
|
||||
+++ b/bfd/elf-bfd.h
|
||||
@@ -2569,6 +2569,32 @@ extern char *elfcore_write_ppc_vmx
|
||||
(bfd *, char *, int *, const void *, int);
|
||||
extern char *elfcore_write_ppc_vsx
|
||||
(bfd *, char *, int *, const void *, int);
|
||||
+extern char *elfcore_write_ppc_tar
|
||||
+ (bfd *, char *, int *, const void *, int);
|
||||
+extern char *elfcore_write_ppc_ppr
|
||||
+ (bfd *, char *, int *, const void *, int);
|
||||
+extern char *elfcore_write_ppc_dscr
|
||||
+ (bfd *, char *, int *, const void *, int);
|
||||
+extern char *elfcore_write_ppc_ebb
|
||||
+ (bfd *, char *, int *, const void *, int);
|
||||
+extern char *elfcore_write_ppc_pmu
|
||||
+ (bfd *, char *, int *, const void *, int);
|
||||
+extern char *elfcore_write_ppc_tm_cgpr
|
||||
+ (bfd *, char *, int *, const void *, int);
|
||||
+extern char *elfcore_write_ppc_tm_cfpr
|
||||
+ (bfd *, char *, int *, const void *, int);
|
||||
+extern char *elfcore_write_ppc_tm_cvmx
|
||||
+ (bfd *, char *, int *, const void *, int);
|
||||
+extern char *elfcore_write_ppc_tm_cvsx
|
||||
+ (bfd *, char *, int *, const void *, int);
|
||||
+extern char *elfcore_write_ppc_tm_spr
|
||||
+ (bfd *, char *, int *, const void *, int);
|
||||
+extern char *elfcore_write_ppc_tm_ctar
|
||||
+ (bfd *, char *, int *, const void *, int);
|
||||
+extern char *elfcore_write_ppc_tm_cppr
|
||||
+ (bfd *, char *, int *, const void *, int);
|
||||
+extern char *elfcore_write_ppc_tm_cdscr
|
||||
+ (bfd *, char *, int *, const void *, int);
|
||||
extern char *elfcore_write_s390_timer
|
||||
(bfd *, char *, int *, const void *, int);
|
||||
extern char *elfcore_write_s390_todcmp
|
||||
diff --git a/bfd/elf.c b/bfd/elf.c
|
||||
--- a/bfd/elf.c
|
||||
+++ b/bfd/elf.c
|
||||
@@ -9238,6 +9238,84 @@ elfcore_grok_ppc_vsx (bfd *abfd, Elf_Internal_Note *note)
|
||||
return elfcore_make_note_pseudosection (abfd, ".reg-ppc-vsx", note);
|
||||
}
|
||||
|
||||
+static bfd_boolean
|
||||
+elfcore_grok_ppc_tar (bfd *abfd, Elf_Internal_Note *note)
|
||||
+{
|
||||
+ return elfcore_make_note_pseudosection (abfd, ".reg-ppc-tar", note);
|
||||
+}
|
||||
+
|
||||
+static bfd_boolean
|
||||
+elfcore_grok_ppc_ppr (bfd *abfd, Elf_Internal_Note *note)
|
||||
+{
|
||||
+ return elfcore_make_note_pseudosection (abfd, ".reg-ppc-ppr", note);
|
||||
+}
|
||||
+
|
||||
+static bfd_boolean
|
||||
+elfcore_grok_ppc_dscr (bfd *abfd, Elf_Internal_Note *note)
|
||||
+{
|
||||
+ return elfcore_make_note_pseudosection (abfd, ".reg-ppc-dscr", note);
|
||||
+}
|
||||
+
|
||||
+static bfd_boolean
|
||||
+elfcore_grok_ppc_ebb (bfd *abfd, Elf_Internal_Note *note)
|
||||
+{
|
||||
+ return elfcore_make_note_pseudosection (abfd, ".reg-ppc-ebb", note);
|
||||
+}
|
||||
+
|
||||
+static bfd_boolean
|
||||
+elfcore_grok_ppc_pmu (bfd *abfd, Elf_Internal_Note *note)
|
||||
+{
|
||||
+ return elfcore_make_note_pseudosection (abfd, ".reg-ppc-pmu", note);
|
||||
+}
|
||||
+
|
||||
+static bfd_boolean
|
||||
+elfcore_grok_ppc_tm_cgpr (bfd *abfd, Elf_Internal_Note *note)
|
||||
+{
|
||||
+ return elfcore_make_note_pseudosection (abfd, ".reg-ppc-tm-cgpr", note);
|
||||
+}
|
||||
+
|
||||
+static bfd_boolean
|
||||
+elfcore_grok_ppc_tm_cfpr (bfd *abfd, Elf_Internal_Note *note)
|
||||
+{
|
||||
+ return elfcore_make_note_pseudosection (abfd, ".reg-ppc-tm-cfpr", note);
|
||||
+}
|
||||
+
|
||||
+static bfd_boolean
|
||||
+elfcore_grok_ppc_tm_cvmx (bfd *abfd, Elf_Internal_Note *note)
|
||||
+{
|
||||
+ return elfcore_make_note_pseudosection (abfd, ".reg-ppc-tm-cvmx", note);
|
||||
+}
|
||||
+
|
||||
+static bfd_boolean
|
||||
+elfcore_grok_ppc_tm_cvsx (bfd *abfd, Elf_Internal_Note *note)
|
||||
+{
|
||||
+ return elfcore_make_note_pseudosection (abfd, ".reg-ppc-tm-cvsx", note);
|
||||
+}
|
||||
+
|
||||
+static bfd_boolean
|
||||
+elfcore_grok_ppc_tm_spr (bfd *abfd, Elf_Internal_Note *note)
|
||||
+{
|
||||
+ return elfcore_make_note_pseudosection (abfd, ".reg-ppc-tm-spr", note);
|
||||
+}
|
||||
+
|
||||
+static bfd_boolean
|
||||
+elfcore_grok_ppc_tm_ctar (bfd *abfd, Elf_Internal_Note *note)
|
||||
+{
|
||||
+ return elfcore_make_note_pseudosection (abfd, ".reg-ppc-tm-ctar", note);
|
||||
+}
|
||||
+
|
||||
+static bfd_boolean
|
||||
+elfcore_grok_ppc_tm_cppr (bfd *abfd, Elf_Internal_Note *note)
|
||||
+{
|
||||
+ return elfcore_make_note_pseudosection (abfd, ".reg-ppc-tm-cppr", note);
|
||||
+}
|
||||
+
|
||||
+static bfd_boolean
|
||||
+elfcore_grok_ppc_tm_cdscr (bfd *abfd, Elf_Internal_Note *note)
|
||||
+{
|
||||
+ return elfcore_make_note_pseudosection (abfd, ".reg-ppc-tm-cdscr", note);
|
||||
+}
|
||||
+
|
||||
static bfd_boolean
|
||||
elfcore_grok_s390_high_gprs (bfd *abfd, Elf_Internal_Note *note)
|
||||
{
|
||||
@@ -9723,6 +9801,97 @@ elfcore_grok_note (bfd *abfd, Elf_Internal_Note *note)
|
||||
else
|
||||
return TRUE;
|
||||
|
||||
+ case NT_PPC_TAR:
|
||||
+ if (note->namesz == 6
|
||||
+ && strcmp (note->namedata, "LINUX") == 0)
|
||||
+ return elfcore_grok_ppc_tar (abfd, note);
|
||||
+ else
|
||||
+ return TRUE;
|
||||
+
|
||||
+ case NT_PPC_PPR:
|
||||
+ if (note->namesz == 6
|
||||
+ && strcmp (note->namedata, "LINUX") == 0)
|
||||
+ return elfcore_grok_ppc_ppr (abfd, note);
|
||||
+ else
|
||||
+ return TRUE;
|
||||
+
|
||||
+ case NT_PPC_DSCR:
|
||||
+ if (note->namesz == 6
|
||||
+ && strcmp (note->namedata, "LINUX") == 0)
|
||||
+ return elfcore_grok_ppc_dscr (abfd, note);
|
||||
+ else
|
||||
+ return TRUE;
|
||||
+
|
||||
+ case NT_PPC_EBB:
|
||||
+ if (note->namesz == 6
|
||||
+ && strcmp (note->namedata, "LINUX") == 0)
|
||||
+ return elfcore_grok_ppc_ebb (abfd, note);
|
||||
+ else
|
||||
+ return TRUE;
|
||||
+
|
||||
+ case NT_PPC_PMU:
|
||||
+ if (note->namesz == 6
|
||||
+ && strcmp (note->namedata, "LINUX") == 0)
|
||||
+ return elfcore_grok_ppc_pmu (abfd, note);
|
||||
+ else
|
||||
+ return TRUE;
|
||||
+
|
||||
+ case NT_PPC_TM_CGPR:
|
||||
+ if (note->namesz == 6
|
||||
+ && strcmp (note->namedata, "LINUX") == 0)
|
||||
+ return elfcore_grok_ppc_tm_cgpr (abfd, note);
|
||||
+ else
|
||||
+ return TRUE;
|
||||
+
|
||||
+ case NT_PPC_TM_CFPR:
|
||||
+ if (note->namesz == 6
|
||||
+ && strcmp (note->namedata, "LINUX") == 0)
|
||||
+ return elfcore_grok_ppc_tm_cfpr (abfd, note);
|
||||
+ else
|
||||
+ return TRUE;
|
||||
+
|
||||
+ case NT_PPC_TM_CVMX:
|
||||
+ if (note->namesz == 6
|
||||
+ && strcmp (note->namedata, "LINUX") == 0)
|
||||
+ return elfcore_grok_ppc_tm_cvmx (abfd, note);
|
||||
+ else
|
||||
+ return TRUE;
|
||||
+
|
||||
+ case NT_PPC_TM_CVSX:
|
||||
+ if (note->namesz == 6
|
||||
+ && strcmp (note->namedata, "LINUX") == 0)
|
||||
+ return elfcore_grok_ppc_tm_cvsx (abfd, note);
|
||||
+ else
|
||||
+ return TRUE;
|
||||
+
|
||||
+ case NT_PPC_TM_SPR:
|
||||
+ if (note->namesz == 6
|
||||
+ && strcmp (note->namedata, "LINUX") == 0)
|
||||
+ return elfcore_grok_ppc_tm_spr (abfd, note);
|
||||
+ else
|
||||
+ return TRUE;
|
||||
+
|
||||
+ case NT_PPC_TM_CTAR:
|
||||
+ if (note->namesz == 6
|
||||
+ && strcmp (note->namedata, "LINUX") == 0)
|
||||
+ return elfcore_grok_ppc_tm_ctar (abfd, note);
|
||||
+ else
|
||||
+ return TRUE;
|
||||
+
|
||||
+ case NT_PPC_TM_CPPR:
|
||||
+ if (note->namesz == 6
|
||||
+ && strcmp (note->namedata, "LINUX") == 0)
|
||||
+ return elfcore_grok_ppc_tm_cppr (abfd, note);
|
||||
+ else
|
||||
+ return TRUE;
|
||||
+
|
||||
+ case NT_PPC_TM_CDSCR:
|
||||
+ if (note->namesz == 6
|
||||
+ && strcmp (note->namedata, "LINUX") == 0)
|
||||
+ return elfcore_grok_ppc_tm_cdscr (abfd, note);
|
||||
+ else
|
||||
+ return TRUE;
|
||||
+
|
||||
case NT_S390_HIGH_GPRS:
|
||||
if (note->namesz == 6
|
||||
&& strcmp (note->namedata, "LINUX") == 0)
|
||||
@@ -10830,6 +10999,162 @@ elfcore_write_ppc_vsx (bfd *abfd,
|
||||
note_name, NT_PPC_VSX, ppc_vsx, size);
|
||||
}
|
||||
|
||||
+char *
|
||||
+elfcore_write_ppc_tar (bfd *abfd,
|
||||
+ char *buf,
|
||||
+ int *bufsiz,
|
||||
+ const void *ppc_tar,
|
||||
+ int size)
|
||||
+{
|
||||
+ char *note_name = "LINUX";
|
||||
+ return elfcore_write_note (abfd, buf, bufsiz,
|
||||
+ note_name, NT_PPC_TAR, ppc_tar, size);
|
||||
+}
|
||||
+
|
||||
+char *
|
||||
+elfcore_write_ppc_ppr (bfd *abfd,
|
||||
+ char *buf,
|
||||
+ int *bufsiz,
|
||||
+ const void *ppc_ppr,
|
||||
+ int size)
|
||||
+{
|
||||
+ char *note_name = "LINUX";
|
||||
+ return elfcore_write_note (abfd, buf, bufsiz,
|
||||
+ note_name, NT_PPC_PPR, ppc_ppr, size);
|
||||
+}
|
||||
+
|
||||
+char *
|
||||
+elfcore_write_ppc_dscr (bfd *abfd,
|
||||
+ char *buf,
|
||||
+ int *bufsiz,
|
||||
+ const void *ppc_dscr,
|
||||
+ int size)
|
||||
+{
|
||||
+ char *note_name = "LINUX";
|
||||
+ return elfcore_write_note (abfd, buf, bufsiz,
|
||||
+ note_name, NT_PPC_DSCR, ppc_dscr, size);
|
||||
+}
|
||||
+
|
||||
+char *
|
||||
+elfcore_write_ppc_ebb (bfd *abfd,
|
||||
+ char *buf,
|
||||
+ int *bufsiz,
|
||||
+ const void *ppc_ebb,
|
||||
+ int size)
|
||||
+{
|
||||
+ char *note_name = "LINUX";
|
||||
+ return elfcore_write_note (abfd, buf, bufsiz,
|
||||
+ note_name, NT_PPC_EBB, ppc_ebb, size);
|
||||
+}
|
||||
+
|
||||
+char *
|
||||
+elfcore_write_ppc_pmu (bfd *abfd,
|
||||
+ char *buf,
|
||||
+ int *bufsiz,
|
||||
+ const void *ppc_pmu,
|
||||
+ int size)
|
||||
+{
|
||||
+ char *note_name = "LINUX";
|
||||
+ return elfcore_write_note (abfd, buf, bufsiz,
|
||||
+ note_name, NT_PPC_PMU, ppc_pmu, size);
|
||||
+}
|
||||
+
|
||||
+char *
|
||||
+elfcore_write_ppc_tm_cgpr (bfd *abfd,
|
||||
+ char *buf,
|
||||
+ int *bufsiz,
|
||||
+ const void *ppc_tm_cgpr,
|
||||
+ int size)
|
||||
+{
|
||||
+ char *note_name = "LINUX";
|
||||
+ return elfcore_write_note (abfd, buf, bufsiz,
|
||||
+ note_name, NT_PPC_TM_CGPR, ppc_tm_cgpr, size);
|
||||
+}
|
||||
+
|
||||
+char *
|
||||
+elfcore_write_ppc_tm_cfpr (bfd *abfd,
|
||||
+ char *buf,
|
||||
+ int *bufsiz,
|
||||
+ const void *ppc_tm_cfpr,
|
||||
+ int size)
|
||||
+{
|
||||
+ char *note_name = "LINUX";
|
||||
+ return elfcore_write_note (abfd, buf, bufsiz,
|
||||
+ note_name, NT_PPC_TM_CFPR, ppc_tm_cfpr, size);
|
||||
+}
|
||||
+
|
||||
+char *
|
||||
+elfcore_write_ppc_tm_cvmx (bfd *abfd,
|
||||
+ char *buf,
|
||||
+ int *bufsiz,
|
||||
+ const void *ppc_tm_cvmx,
|
||||
+ int size)
|
||||
+{
|
||||
+ char *note_name = "LINUX";
|
||||
+ return elfcore_write_note (abfd, buf, bufsiz,
|
||||
+ note_name, NT_PPC_TM_CVMX, ppc_tm_cvmx, size);
|
||||
+}
|
||||
+
|
||||
+char *
|
||||
+elfcore_write_ppc_tm_cvsx (bfd *abfd,
|
||||
+ char *buf,
|
||||
+ int *bufsiz,
|
||||
+ const void *ppc_tm_cvsx,
|
||||
+ int size)
|
||||
+{
|
||||
+ char *note_name = "LINUX";
|
||||
+ return elfcore_write_note (abfd, buf, bufsiz,
|
||||
+ note_name, NT_PPC_TM_CVSX, ppc_tm_cvsx, size);
|
||||
+}
|
||||
+
|
||||
+char *
|
||||
+elfcore_write_ppc_tm_spr (bfd *abfd,
|
||||
+ char *buf,
|
||||
+ int *bufsiz,
|
||||
+ const void *ppc_tm_spr,
|
||||
+ int size)
|
||||
+{
|
||||
+ char *note_name = "LINUX";
|
||||
+ return elfcore_write_note (abfd, buf, bufsiz,
|
||||
+ note_name, NT_PPC_TM_SPR, ppc_tm_spr, size);
|
||||
+}
|
||||
+
|
||||
+char *
|
||||
+elfcore_write_ppc_tm_ctar (bfd *abfd,
|
||||
+ char *buf,
|
||||
+ int *bufsiz,
|
||||
+ const void *ppc_tm_ctar,
|
||||
+ int size)
|
||||
+{
|
||||
+ char *note_name = "LINUX";
|
||||
+ return elfcore_write_note (abfd, buf, bufsiz,
|
||||
+ note_name, NT_PPC_TM_CTAR, ppc_tm_ctar, size);
|
||||
+}
|
||||
+
|
||||
+char *
|
||||
+elfcore_write_ppc_tm_cppr (bfd *abfd,
|
||||
+ char *buf,
|
||||
+ int *bufsiz,
|
||||
+ const void *ppc_tm_cppr,
|
||||
+ int size)
|
||||
+{
|
||||
+ char *note_name = "LINUX";
|
||||
+ return elfcore_write_note (abfd, buf, bufsiz,
|
||||
+ note_name, NT_PPC_TM_CPPR, ppc_tm_cppr, size);
|
||||
+}
|
||||
+
|
||||
+char *
|
||||
+elfcore_write_ppc_tm_cdscr (bfd *abfd,
|
||||
+ char *buf,
|
||||
+ int *bufsiz,
|
||||
+ const void *ppc_tm_cdscr,
|
||||
+ int size)
|
||||
+{
|
||||
+ char *note_name = "LINUX";
|
||||
+ return elfcore_write_note (abfd, buf, bufsiz,
|
||||
+ note_name, NT_PPC_TM_CDSCR, ppc_tm_cdscr, size);
|
||||
+}
|
||||
+
|
||||
static char *
|
||||
elfcore_write_s390_high_gprs (bfd *abfd,
|
||||
char *buf,
|
||||
@@ -11070,6 +11395,32 @@ elfcore_write_register_note (bfd *abfd,
|
||||
return elfcore_write_ppc_vmx (abfd, buf, bufsiz, data, size);
|
||||
if (strcmp (section, ".reg-ppc-vsx") == 0)
|
||||
return elfcore_write_ppc_vsx (abfd, buf, bufsiz, data, size);
|
||||
+ if (strcmp (section, ".reg-ppc-tar") == 0)
|
||||
+ return elfcore_write_ppc_tar (abfd, buf, bufsiz, data, size);
|
||||
+ if (strcmp (section, ".reg-ppc-ppr") == 0)
|
||||
+ return elfcore_write_ppc_ppr (abfd, buf, bufsiz, data, size);
|
||||
+ if (strcmp (section, ".reg-ppc-dscr") == 0)
|
||||
+ return elfcore_write_ppc_dscr (abfd, buf, bufsiz, data, size);
|
||||
+ if (strcmp (section, ".reg-ppc-ebb") == 0)
|
||||
+ return elfcore_write_ppc_ebb (abfd, buf, bufsiz, data, size);
|
||||
+ if (strcmp (section, ".reg-ppc-pmu") == 0)
|
||||
+ return elfcore_write_ppc_pmu (abfd, buf, bufsiz, data, size);
|
||||
+ if (strcmp (section, ".reg-ppc-tm-cgpr") == 0)
|
||||
+ return elfcore_write_ppc_tm_cgpr (abfd, buf, bufsiz, data, size);
|
||||
+ if (strcmp (section, ".reg-ppc-tm-cfpr") == 0)
|
||||
+ return elfcore_write_ppc_tm_cfpr (abfd, buf, bufsiz, data, size);
|
||||
+ if (strcmp (section, ".reg-ppc-tm-cvmx") == 0)
|
||||
+ return elfcore_write_ppc_tm_cvmx (abfd, buf, bufsiz, data, size);
|
||||
+ if (strcmp (section, ".reg-ppc-tm-cvsx") == 0)
|
||||
+ return elfcore_write_ppc_tm_cvsx (abfd, buf, bufsiz, data, size);
|
||||
+ if (strcmp (section, ".reg-ppc-tm-spr") == 0)
|
||||
+ return elfcore_write_ppc_tm_spr (abfd, buf, bufsiz, data, size);
|
||||
+ if (strcmp (section, ".reg-ppc-tm-ctar") == 0)
|
||||
+ return elfcore_write_ppc_tm_ctar (abfd, buf, bufsiz, data, size);
|
||||
+ if (strcmp (section, ".reg-ppc-tm-cppr") == 0)
|
||||
+ return elfcore_write_ppc_tm_cppr (abfd, buf, bufsiz, data, size);
|
||||
+ if (strcmp (section, ".reg-ppc-tm-cdscr") == 0)
|
||||
+ return elfcore_write_ppc_tm_cdscr (abfd, buf, bufsiz, data, size);
|
||||
if (strcmp (section, ".reg-s390-high-gprs") == 0)
|
||||
return elfcore_write_s390_high_gprs (abfd, buf, bufsiz, data, size);
|
||||
if (strcmp (section, ".reg-s390-timer") == 0)
|
|
@ -1,61 +0,0 @@
|
|||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Keith Seitz <keiths@redhat.com>
|
||||
Date: Fri, 11 Jan 2019 17:02:13 -0500
|
||||
Subject: gdb-rhbz1187581-power8-regs-not-in-8.2-03of15.patch
|
||||
|
||||
;; Zero-initialize linux note sections
|
||||
;; Pedro Franco de Carvalho, RH BZ 1187581
|
||||
|
||||
Zero-initialize linux note sections
|
||||
|
||||
This patches changes linux-tdep.c so that the buffer used to write
|
||||
note sections when generating a core file is zero-initialized. This
|
||||
way, bytes that are not collected won't contain random
|
||||
data (e.g. padding bytes).
|
||||
|
||||
gdb/ChangeLog:
|
||||
2018-10-26 Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
|
||||
|
||||
* linux-tdep.c (linux_collect_regset_section_cb): Use
|
||||
std::vector<gdb_byte> instead of char * and malloc for buf.
|
||||
Remove xfree.
|
||||
|
||||
diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c
|
||||
--- a/gdb/linux-tdep.c
|
||||
+++ b/gdb/linux-tdep.c
|
||||
@@ -1584,7 +1584,6 @@ linux_collect_regset_section_cb (const char *sect_name, int supply_size,
|
||||
int collect_size, const struct regset *regset,
|
||||
const char *human_name, void *cb_data)
|
||||
{
|
||||
- char *buf;
|
||||
struct linux_collect_regset_section_cb_data *data
|
||||
= (struct linux_collect_regset_section_cb_data *) cb_data;
|
||||
bool variable_size_section = (regset != NULL
|
||||
@@ -1598,19 +1597,22 @@ linux_collect_regset_section_cb (const char *sect_name, int supply_size,
|
||||
|
||||
gdb_assert (regset && regset->collect_regset);
|
||||
|
||||
- buf = (char *) xmalloc (collect_size);
|
||||
- regset->collect_regset (regset, data->regcache, -1, buf, collect_size);
|
||||
+ /* This is intentionally zero-initialized by using std::vector, so
|
||||
+ that any padding bytes in the core file will show as 0. */
|
||||
+ std::vector<gdb_byte> buf (collect_size);
|
||||
+
|
||||
+ regset->collect_regset (regset, data->regcache, -1, buf.data (),
|
||||
+ collect_size);
|
||||
|
||||
/* PRSTATUS still needs to be treated specially. */
|
||||
if (strcmp (sect_name, ".reg") == 0)
|
||||
data->note_data = (char *) elfcore_write_prstatus
|
||||
(data->obfd, data->note_data, data->note_size, data->lwp,
|
||||
- gdb_signal_to_host (data->stop_signal), buf);
|
||||
+ gdb_signal_to_host (data->stop_signal), buf.data ());
|
||||
else
|
||||
data->note_data = (char *) elfcore_write_register_note
|
||||
(data->obfd, data->note_data, data->note_size,
|
||||
- sect_name, buf, collect_size);
|
||||
- xfree (buf);
|
||||
+ sect_name, buf.data (), collect_size);
|
||||
|
||||
if (data->note_data == NULL)
|
||||
data->abort_iteration = 1;
|
|
@ -1,88 +0,0 @@
|
|||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Keith Seitz <keiths@redhat.com>
|
||||
Date: Fri, 11 Jan 2019 17:02:13 -0500
|
||||
Subject: gdb-rhbz1187581-power8-regs-not-in-8.2-04of15.patch
|
||||
|
||||
;; [PowerPC] Don't zero-initialize vector register buffers
|
||||
;; Pedro Franco de Carvalho, RH BZ 1187581
|
||||
|
||||
[PowerPC] Don't zero-initialize vector register buffers
|
||||
|
||||
Now that linux-tdep.c already zero-initializes the buffer used for
|
||||
generating core file notes, there is no need to do this in the linux
|
||||
collect functions for the vector regset. The memsets in gdbserver were
|
||||
not useful to begin with.
|
||||
|
||||
gdb/ChangeLog:
|
||||
2018-10-26 Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
|
||||
|
||||
* ppc-linux-tdep.c (ppc_linux_collect_vrregset): Remove.
|
||||
(ppc32_le_linux_vrregset, ppc32_be_linux_vrregset): Replace
|
||||
ppc_linux_collect_vrregset by regcache_collect_regset.
|
||||
|
||||
gdb/gdbserver/ChangeLog:
|
||||
2018-10-26 Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
|
||||
|
||||
* linux-ppc-low.c (ppc_fill_vrregset): Remove memset calls.
|
||||
|
||||
diff --git a/gdb/gdbserver/linux-ppc-low.c b/gdb/gdbserver/linux-ppc-low.c
|
||||
--- a/gdb/gdbserver/linux-ppc-low.c
|
||||
+++ b/gdb/gdbserver/linux-ppc-low.c
|
||||
@@ -495,13 +495,9 @@ ppc_fill_vrregset (struct regcache *regcache, void *buf)
|
||||
if (__BYTE_ORDER == __BIG_ENDIAN)
|
||||
vscr_offset = 12;
|
||||
|
||||
- /* Zero-pad the unused bytes in the fields for vscr and vrsave in
|
||||
- case they get displayed somewhere. */
|
||||
- memset (®set[32 * 16], 0, 16);
|
||||
collect_register_by_name (regcache, "vscr",
|
||||
®set[32 * 16 + vscr_offset]);
|
||||
|
||||
- memset (®set[33 * 16], 0, 16);
|
||||
collect_register_by_name (regcache, "vrsave", ®set[33 * 16]);
|
||||
}
|
||||
|
||||
diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c
|
||||
--- a/gdb/ppc-linux-tdep.c
|
||||
+++ b/gdb/ppc-linux-tdep.c
|
||||
@@ -444,24 +444,6 @@ ppc_linux_collect_gregset (const struct regset *regset,
|
||||
}
|
||||
}
|
||||
|
||||
-static void
|
||||
-ppc_linux_collect_vrregset (const struct regset *regset,
|
||||
- const struct regcache *regcache,
|
||||
- int regnum, void *buf, size_t len)
|
||||
-{
|
||||
- gdb_byte *vrregs = (gdb_byte *) buf;
|
||||
-
|
||||
- /* Zero-pad the unused bytes in the fields for vscr and vrsave
|
||||
- in case they get displayed somewhere (e.g. in core files). */
|
||||
- if (regnum == PPC_VSCR_REGNUM || regnum == -1)
|
||||
- memset (&vrregs[32 * 16], 0, 16);
|
||||
-
|
||||
- if (regnum == PPC_VRSAVE_REGNUM || regnum == -1)
|
||||
- memset (&vrregs[33 * 16], 0, 16);
|
||||
-
|
||||
- regcache_collect_regset (regset, regcache, regnum, buf, len);
|
||||
-}
|
||||
-
|
||||
/* Regset descriptions. */
|
||||
static const struct ppc_reg_offsets ppc32_linux_reg_offsets =
|
||||
{
|
||||
@@ -544,13 +526,13 @@ static const struct regcache_map_entry ppc32_be_linux_vrregmap[] =
|
||||
static const struct regset ppc32_le_linux_vrregset = {
|
||||
ppc32_le_linux_vrregmap,
|
||||
regcache_supply_regset,
|
||||
- ppc_linux_collect_vrregset
|
||||
+ regcache_collect_regset
|
||||
};
|
||||
|
||||
static const struct regset ppc32_be_linux_vrregset = {
|
||||
ppc32_be_linux_vrregmap,
|
||||
regcache_supply_regset,
|
||||
- ppc_linux_collect_vrregset
|
||||
+ regcache_collect_regset
|
||||
};
|
||||
|
||||
static const struct regcache_map_entry ppc32_linux_vsxregmap[] =
|
|
@ -1,34 +0,0 @@
|
|||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Keith Seitz <keiths@redhat.com>
|
||||
Date: Fri, 11 Jan 2019 17:02:14 -0500
|
||||
Subject: gdb-rhbz1187581-power8-regs-not-in-8.2-05of15.patch
|
||||
|
||||
;; Add decfloat registers to float reggroup
|
||||
;; Pedro Franco de Carvalho, RH BZ 1187581
|
||||
|
||||
Add decfloat registers to float reggroup
|
||||
|
||||
This patch changes default_register_reggroup_p to return true when the
|
||||
register type is decimal floating point and the reggroup is
|
||||
float_reggroup.
|
||||
|
||||
gdb/ChangeLog:
|
||||
2018-10-26 Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
|
||||
|
||||
* reggroups.c (default_register_reggroup_p): Return true for
|
||||
decfloat registers and float_reggroup.
|
||||
|
||||
diff --git a/gdb/reggroups.c b/gdb/reggroups.c
|
||||
--- a/gdb/reggroups.c
|
||||
+++ b/gdb/reggroups.c
|
||||
@@ -202,7 +202,9 @@ default_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
|
||||
if (group == all_reggroup)
|
||||
return 1;
|
||||
vector_p = TYPE_VECTOR (register_type (gdbarch, regnum));
|
||||
- float_p = TYPE_CODE (register_type (gdbarch, regnum)) == TYPE_CODE_FLT;
|
||||
+ float_p = (TYPE_CODE (register_type (gdbarch, regnum)) == TYPE_CODE_FLT
|
||||
+ || (TYPE_CODE (register_type (gdbarch, regnum))
|
||||
+ == TYPE_CODE_DECFLOAT));
|
||||
raw_p = regnum < gdbarch_num_regs (gdbarch);
|
||||
if (group == float_reggroup)
|
||||
return float_p;
|
|
@ -1,72 +0,0 @@
|
|||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Keith Seitz <keiths@redhat.com>
|
||||
Date: Fri, 11 Jan 2019 17:02:14 -0500
|
||||
Subject: gdb-rhbz1187581-power8-regs-not-in-8.2-06of15.patch
|
||||
|
||||
;; [PowerPC] Remove rs6000_pseudo_register_reggroup_p
|
||||
;; Pedro Franco de Carvalho, RH BZ 1187581
|
||||
|
||||
[PowerPC] Remove rs6000_pseudo_register_reggroup_p
|
||||
|
||||
This patch removes rs6000_pseudo_register_reggroup_p.
|
||||
|
||||
Group membership for the pseudoregisters can be detected through their
|
||||
types in default_register_reggroup_p through
|
||||
tdesc_register_reggroup_p.
|
||||
|
||||
gdb/ChangeLog:
|
||||
2018-10-26 Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
|
||||
|
||||
* rs6000-tdep.c: Remove reggroups.h include.
|
||||
(rs6000_pseudo_register_reggroup_p): Remove.
|
||||
(rs6000_gdbarch_init): Remove call to
|
||||
set_tdesc_pseudo_register_reggroup_p.
|
||||
|
||||
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
|
||||
--- a/gdb/rs6000-tdep.c
|
||||
+++ b/gdb/rs6000-tdep.c
|
||||
@@ -36,7 +36,6 @@
|
||||
#include "infcall.h"
|
||||
#include "sim-regno.h"
|
||||
#include "gdb/sim-ppc.h"
|
||||
-#include "reggroups.h"
|
||||
#include "dwarf2-frame.h"
|
||||
#include "target-descriptions.h"
|
||||
#include "user-regs.h"
|
||||
@@ -2461,27 +2460,6 @@ rs6000_pseudo_register_type (struct gdbarch *gdbarch, int regnum)
|
||||
return builtin_type (gdbarch)->builtin_double;
|
||||
}
|
||||
|
||||
-/* Is REGNUM a member of REGGROUP? */
|
||||
-static int
|
||||
-rs6000_pseudo_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
|
||||
- struct reggroup *group)
|
||||
-{
|
||||
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
|
||||
-
|
||||
- /* These are the only pseudo-registers we support. */
|
||||
- gdb_assert (IS_SPE_PSEUDOREG (tdep, regnum)
|
||||
- || IS_DFP_PSEUDOREG (tdep, regnum)
|
||||
- || IS_VSX_PSEUDOREG (tdep, regnum)
|
||||
- || IS_EFP_PSEUDOREG (tdep, regnum));
|
||||
-
|
||||
- /* These are the e500 pseudo-registers or the POWER7 VSX registers. */
|
||||
- if (IS_SPE_PSEUDOREG (tdep, regnum) || IS_VSX_PSEUDOREG (tdep, regnum))
|
||||
- return group == all_reggroup || group == vector_reggroup;
|
||||
- else
|
||||
- /* PPC decimal128 or Extended FP pseudo-registers. */
|
||||
- return group == all_reggroup || group == float_reggroup;
|
||||
-}
|
||||
-
|
||||
/* The register format for RS/6000 floating point registers is always
|
||||
double, we need a conversion if the memory format is float. */
|
||||
|
||||
@@ -6493,8 +6471,6 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
|
||||
}
|
||||
|
||||
set_tdesc_pseudo_register_type (gdbarch, rs6000_pseudo_register_type);
|
||||
- set_tdesc_pseudo_register_reggroup_p (gdbarch,
|
||||
- rs6000_pseudo_register_reggroup_p);
|
||||
tdesc_use_registers (gdbarch, tdesc, tdesc_data);
|
||||
|
||||
/* Override the normal target description method to make the SPE upper
|
|
@ -1,41 +0,0 @@
|
|||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Keith Seitz <keiths@redhat.com>
|
||||
Date: Fri, 11 Jan 2019 17:02:15 -0500
|
||||
Subject: gdb-rhbz1187581-power8-regs-not-in-8.2-07of15.patch
|
||||
|
||||
;; [PowerPC] Fix two if statements in gdb/ppc-linux-nat.c
|
||||
;; Pedro Franco de Carvalho, RH BZ 1187581
|
||||
|
||||
[PowerPC] Fix two if statements in gdb/ppc-linux-nat.c
|
||||
|
||||
This patch changes two if statements to else if statements in
|
||||
ppc-linux-nat.c:fetch_register for clarity.
|
||||
|
||||
gdb/ChangeLog:
|
||||
2018-10-26 Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
|
||||
|
||||
* ppc-linux-nat.c (fetch_register): Change if statement to else
|
||||
if.
|
||||
(store_register): Likewise.
|
||||
|
||||
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
|
||||
@@ -554,7 +554,7 @@ fetch_register (struct regcache *regcache, int tid, int regno)
|
||||
AltiVec registers, fall through and return zeroes, because
|
||||
regaddr will be -1 in this case. */
|
||||
}
|
||||
- if (vsx_register_p (gdbarch, regno))
|
||||
+ else if (vsx_register_p (gdbarch, regno))
|
||||
{
|
||||
if (have_ptrace_getsetvsxregs)
|
||||
{
|
||||
@@ -933,7 +933,7 @@ store_register (const struct regcache *regcache, int tid, int regno)
|
||||
store_altivec_registers (regcache, tid, regno);
|
||||
return;
|
||||
}
|
||||
- if (vsx_register_p (gdbarch, regno))
|
||||
+ else if (vsx_register_p (gdbarch, regno))
|
||||
{
|
||||
store_vsx_registers (regcache, tid, regno);
|
||||
return;
|
|
@ -1,64 +0,0 @@
|
|||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Keith Seitz <keiths@redhat.com>
|
||||
Date: Fri, 11 Jan 2019 17:02:15 -0500
|
||||
Subject: gdb-rhbz1187581-power8-regs-not-in-8.2-08of15.patch
|
||||
|
||||
;; [PowerPC] Fix indentation in arch/ppc-linux-common.c
|
||||
;; Pedro Franco de Carvalho, RH BZ 1187581
|
||||
|
||||
[PowerPC] Fix indentation in arch/ppc-linux-common.c
|
||||
|
||||
This patch parenthesizes the tdesc selection expressions in
|
||||
arch/ppc-linux-common.c so that they can be tab-indented.
|
||||
|
||||
gdb/ChangeLog:
|
||||
2018-10-26 Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
|
||||
|
||||
* arch/ppc-linux-common.c (ppc_linux_match_description):
|
||||
Parenthesize tdesc assignements and indent them properly.
|
||||
|
||||
diff --git a/gdb/arch/ppc-linux-common.c b/gdb/arch/ppc-linux-common.c
|
||||
--- a/gdb/arch/ppc-linux-common.c
|
||||
+++ b/gdb/arch/ppc-linux-common.c
|
||||
@@ -53,14 +53,14 @@ ppc_linux_match_description (struct ppc_linux_features features)
|
||||
if (features.cell)
|
||||
tdesc = tdesc_powerpc_cell64l;
|
||||
else if (features.vsx)
|
||||
- tdesc = features.isa205
|
||||
- ? tdesc_powerpc_isa205_vsx64l : tdesc_powerpc_vsx64l;
|
||||
+ tdesc = (features.isa205? tdesc_powerpc_isa205_vsx64l
|
||||
+ : tdesc_powerpc_vsx64l);
|
||||
else if (features.altivec)
|
||||
- tdesc = features.isa205
|
||||
- ? tdesc_powerpc_isa205_altivec64l : tdesc_powerpc_altivec64l;
|
||||
+ tdesc = (features.isa205? tdesc_powerpc_isa205_altivec64l
|
||||
+ : tdesc_powerpc_altivec64l);
|
||||
else
|
||||
- tdesc = features.isa205?
|
||||
- tdesc_powerpc_isa205_64l : tdesc_powerpc_64l;
|
||||
+ tdesc = (features.isa205? tdesc_powerpc_isa205_64l
|
||||
+ : tdesc_powerpc_64l);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -69,14 +69,14 @@ ppc_linux_match_description (struct ppc_linux_features features)
|
||||
if (features.cell)
|
||||
tdesc = tdesc_powerpc_cell32l;
|
||||
else if (features.vsx)
|
||||
- tdesc = features.isa205
|
||||
- ? tdesc_powerpc_isa205_vsx32l : tdesc_powerpc_vsx32l;
|
||||
+ tdesc = (features.isa205? tdesc_powerpc_isa205_vsx32l
|
||||
+ : tdesc_powerpc_vsx32l);
|
||||
else if (features.altivec)
|
||||
- tdesc = features.isa205
|
||||
- ? tdesc_powerpc_isa205_altivec32l : tdesc_powerpc_altivec32l;
|
||||
+ tdesc = (features.isa205? tdesc_powerpc_isa205_altivec32l
|
||||
+ : tdesc_powerpc_altivec32l);
|
||||
else
|
||||
- tdesc = features.isa205
|
||||
- ? tdesc_powerpc_isa205_32l : tdesc_powerpc_32l;
|
||||
+ tdesc = (features.isa205? tdesc_powerpc_isa205_32l
|
||||
+ : tdesc_powerpc_32l);
|
||||
}
|
||||
|
||||
gdb_assert (tdesc != NULL);
|
|
@ -1,36 +0,0 @@
|
|||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Keith Seitz <keiths@redhat.com>
|
||||
Date: Fri, 11 Jan 2019 17:02:16 -0500
|
||||
Subject: gdb-rhbz1187581-power8-regs-not-in-8.2-09of15.patch
|
||||
|
||||
;; [PowerPC] Refactor have_ initializers in rs6000-tdep.c
|
||||
;; Pedro Franco de Carvalho, RH BZ 1187581
|
||||
|
||||
[PowerPC] Refactor have_ initializers in rs6000-tdep.c
|
||||
|
||||
This patch refactors a series of initializers in rs6000_gdbarch_init
|
||||
for clarity. The have_fpu initializer is also changed to set the
|
||||
variable to 0, like the other similar variables. This doesn't affect
|
||||
program behavior.
|
||||
|
||||
gdb/ChangeLog:
|
||||
2018-10-26 Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
|
||||
|
||||
* rs6000-tdep.c (rs6000_gdbarch_init): Replace line wrapping by a
|
||||
second initializer line for the have_* variables. Initialize
|
||||
have_fpu to 0 instead of 1.
|
||||
|
||||
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
|
||||
--- a/gdb/rs6000-tdep.c
|
||||
+++ b/gdb/rs6000-tdep.c
|
||||
@@ -5845,8 +5845,8 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
|
||||
enum powerpc_long_double_abi long_double_abi = POWERPC_LONG_DOUBLE_AUTO;
|
||||
enum powerpc_vector_abi vector_abi = powerpc_vector_abi_global;
|
||||
enum powerpc_elf_abi elf_abi = POWERPC_ELF_AUTO;
|
||||
- int have_fpu = 1, have_spe = 0, have_mq = 0, have_altivec = 0, have_dfp = 0,
|
||||
- have_vsx = 0;
|
||||
+ int have_fpu = 0, have_spe = 0, have_mq = 0, have_altivec = 0;
|
||||
+ int have_dfp = 0, have_vsx = 0;
|
||||
int tdesc_wordsize = -1;
|
||||
const struct target_desc *tdesc = info.target_desc;
|
||||
struct tdesc_arch_data *tdesc_data = NULL;
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,779 +0,0 @@
|
|||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Keith Seitz <keiths@redhat.com>
|
||||
Date: Fri, 11 Jan 2019 17:02:17 -0500
|
||||
Subject: gdb-rhbz1187581-power8-regs-not-in-8.2-12of15.patch
|
||||
|
||||
;; [PowerPC] Add support for EBB and PMU registers
|
||||
;; Edjunior Barbosa Machado and Pedro Franco de Carvalho, RH BZ 1187581m
|
||||
|
||||
[PowerPC] Add support for EBB and PMU registers
|
||||
|
||||
This patch adds support for registers of the Event Based Branching and
|
||||
Performance Monitoring Units for the powerpc linux native and core
|
||||
file targets, and for the powerpc linux server stub.
|
||||
|
||||
All three EBB registers are accessible. Only a subset of the PMU
|
||||
registers can be accessed through ptrace. Because of this, the PMU
|
||||
registers are enumerated individually in gdbarch_tdep, as opposed to
|
||||
having a single "have_pmu" flag. This is intended to make it easier
|
||||
to add additional PMU registers in the future, since checking a
|
||||
"have_pmu" flag elsewhere in the code would no longer be correct. The
|
||||
tdesc feature is named org.gnu.gdb.power.linux.pmu because of this.
|
||||
|
||||
It's unclear if it makes sense to save and restore these registers
|
||||
across function calls, since some of them can be modified
|
||||
asynchronously. They are also not tracked in record-replay mode.
|
||||
|
||||
The kernel can return ENODATA when ptrace is used to get the EBB
|
||||
registers, unless a linux performance event that uses EBB is open in
|
||||
the inferior. For this reason, the "fill" functions in the server
|
||||
stub for the ebb register sets is not implemented.
|
||||
|
||||
Since gdbserver writes all registers in one go before resuming the
|
||||
inferior, this error would not be detected at the time the user tries
|
||||
to write to one of the registers on the client side, and gdbserver
|
||||
would print out warnings every time it resumes the inferior when no
|
||||
ebb performance event is opened, so there is currently no
|
||||
straightforward way to handle this case. This means the ebb registers
|
||||
in the client-side regcache can become dirty when the user tries to
|
||||
write to them, until the inferior is resumed and stopped again.
|
||||
|
||||
A related issue is that 'G' packets used to write to unrelated
|
||||
registers will include bad data for the EBB registers if they are
|
||||
unavailable, since no register status information is included in the
|
||||
'G' packet. This data won't be written to the inferior by the
|
||||
gdbserver stub because the "fill" functions are not implemented, and
|
||||
currently the gdbserver stub doesn't change the status of the
|
||||
registers in its own regcache in response to 'G' packets.
|
||||
|
||||
Another limitation for the ebb registers is that traceframes don't
|
||||
record if registers are available or not, so if these registers are
|
||||
collected when a tracepoint is hit and the inferior has no ebb event
|
||||
opened, the user will see zero values for all of them, instead of the
|
||||
usual <unavailable>.
|
||||
|
||||
Because these registers are often unavailable, trying to store them
|
||||
with target_store_registers with -1 for the regno argument (all
|
||||
registers) would almost always fail, so they are ignored in this case.
|
||||
|
||||
gdb/ChangeLog:
|
||||
2018-10-26 Edjunior Barbosa Machado <emachado@linux.vnet.ibm.com>
|
||||
Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
|
||||
|
||||
* arch/ppc-linux-common.h (PPC_LINUX_SIZEOF_EBBREGSET)
|
||||
(PPC_LINUX_SIZEOF_PMUREGSET): Declare.
|
||||
* nat/ppc-linux.h (PPC_FEATURE2_EBB, NT_PPC_EBB, NT_PPC_PMU):
|
||||
Define if not already defined.
|
||||
* features/rs6000/power-ebb.xml: New file.
|
||||
* features/rs6000/power-linux-pmu.xml: New file.
|
||||
* features/rs6000/powerpc-isa207-vsx32l.xml: Include ebb and pmu
|
||||
features.
|
||||
* features/rs6000/powerpc-isa207-vsx64l.xml: Likewise.
|
||||
* features/rs6000/powerpc-isa207-vsx32l.c: Re-generate.
|
||||
* features/rs6000/powerpc-isa207-vsx64l.c: Re-generate.
|
||||
* regformats/rs6000/powerpc-isa207-vsx32l.dat: Re-generate.
|
||||
* regformats/rs6000/powerpc-isa207-vsx64l.dat: Re-generate.
|
||||
* ppc-linux-nat.c (fetch_register, fetch_ppc_registers): Call
|
||||
fetch_regset with ebb and pmu regsets.
|
||||
(store_register, store_ppc_registers): Call store_regset with ebb
|
||||
and pmu regsets.
|
||||
(ppc_linux_nat_target::read_description): Set isa207 field in the
|
||||
features struct if ebb and pmu are avaiable.
|
||||
* ppc-linux-tdep.c (ppc32_regmap_ebb, ppc32_regmap_pmu)
|
||||
(ppc32_linux_ebbregset, ppc32_linux_pmuregset): New globals.
|
||||
(ppc_linux_iterate_over_regset_sections): Call back with the ebb
|
||||
and pmu regsets.
|
||||
(ppc_linux_core_read_description): Check if the pmu section is
|
||||
present and set isa207 in the features struct.
|
||||
* ppc-linux-tdep.h (ppc32_linux_ebbregset)
|
||||
(ppc32_linux_pmuregset): Declare.
|
||||
* ppc-tdep.h (struct gdbarch_tdep) <ppc_mmcr0_regnum>: New field.
|
||||
<ppc_mmcr2_regnum, ppc_siar_regnum, ppc_sdar_regnum>: New fields.
|
||||
<ppc_sier_regnum>: New field.
|
||||
(enum): <PPC_BESCR_REGNUM, PPC_EBBHR_REGNUM, PPC_EBBRR_REGNUM>:
|
||||
New enum values.
|
||||
<PPC_MMCR0_REGNUM, PPC_MMCR2_REGNUM, PPC_SIAR_REGNUM>: New enum
|
||||
values.
|
||||
<PPC_SDAR_REGNUM, PPC_SIER_REGNUM>: New enum values.
|
||||
(PPC_IS_EBB_REGNUM, PPC_IS_PMU_REGNUM): Define.
|
||||
* rs6000-tdep.c (rs6000_gdbarch_init): Look for and validate the
|
||||
ebb and pmu features.
|
||||
|
||||
gdb/gdbserver/ChangeLog:
|
||||
2018-10-26 Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
|
||||
|
||||
* configure.srv (powerpc*-*-linux*): Add rs6000/power-ebb.xml and
|
||||
rs6000/power-linux-pmu.xml to srv_xmlfiles.
|
||||
* linux-ppc-low.c (ppc_store_ebbregset, ppc_fill_pmuregset)
|
||||
(ppc_store_pmuregset): New functions.
|
||||
(ppc_regsets): Add entries for ebb and pmu regsets.
|
||||
(ppc_arch_setup): Set isa207 in features struct if the ebb and
|
||||
pmu regsets are available. Set sizes for these regsets.
|
||||
|
||||
gdb/doc/ChangeLog:
|
||||
2018-10-26 Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
|
||||
|
||||
* gdb.texinfo (PowerPC Features): Describe new features
|
||||
"org.gnu.gdb.power.ebb" and "org.gnu.gdb.power.linux.pmu".
|
||||
|
||||
diff --git a/gdb/arch/ppc-linux-common.h b/gdb/arch/ppc-linux-common.h
|
||||
--- a/gdb/arch/ppc-linux-common.h
|
||||
+++ b/gdb/arch/ppc-linux-common.h
|
||||
@@ -33,6 +33,8 @@ struct target_desc;
|
||||
#define PPC_LINUX_SIZEOF_PPRREGSET 8
|
||||
#define PPC_LINUX_SIZEOF_DSCRREGSET 8
|
||||
#define PPC_LINUX_SIZEOF_TARREGSET 8
|
||||
+#define PPC_LINUX_SIZEOF_EBBREGSET (3*8)
|
||||
+#define PPC_LINUX_SIZEOF_PMUREGSET (5*8)
|
||||
|
||||
/* Check if the hwcap auxv entry indicates that isa205 is supported. */
|
||||
bool ppc_linux_has_isa205 (CORE_ADDR hwcap);
|
||||
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
|
||||
--- a/gdb/doc/gdb.texinfo
|
||||
+++ b/gdb/doc/gdb.texinfo
|
||||
@@ -42564,6 +42564,15 @@ contain the 64-bit register @samp{dscr}.
|
||||
The @samp{org.gnu.gdb.power.tar} feature is optional. It should
|
||||
contain the 64-bit register @samp{tar}.
|
||||
|
||||
+The @samp{org.gnu.gdb.power.ebb} feature is optional. It should
|
||||
+contain registers @samp{bescr}, @samp{ebbhr} and @samp{ebbrr}, all
|
||||
+64-bit wide.
|
||||
+
|
||||
+The @samp{org.gnu.gdb.power.linux.pmu} feature is optional. It should
|
||||
+contain registers @samp{mmcr0}, @samp{mmcr2}, @samp{siar}, @samp{sdar}
|
||||
+and @samp{sier}, all 64-bit wide. This is the subset of the isa 2.07
|
||||
+server PMU registers provided by @sc{gnu}/Linux.
|
||||
+
|
||||
@node S/390 and System z Features
|
||||
@subsection S/390 and System z Features
|
||||
@cindex target descriptions, S/390 features
|
||||
diff --git a/gdb/features/rs6000/power-ebb.xml b/gdb/features/rs6000/power-ebb.xml
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/features/rs6000/power-ebb.xml
|
||||
@@ -0,0 +1,14 @@
|
||||
+<?xml version="1.0"?>
|
||||
+<!-- Copyright (C) 2018 Free Software Foundation, Inc.
|
||||
+
|
||||
+ Copying and distribution of this file, with or without modification,
|
||||
+ are permitted in any medium without royalty provided the copyright
|
||||
+ notice and this notice are preserved. -->
|
||||
+
|
||||
+<!-- POWER8 Event-based Branching Registers. -->
|
||||
+<!DOCTYPE feature SYSTEM "gdb-target.dtd">
|
||||
+<feature name="org.gnu.gdb.power.ebb">
|
||||
+ <reg name="bescr" bitsize="64" type="uint64" save-restore="no"/>
|
||||
+ <reg name="ebbhr" bitsize="64" type="uint64" save-restore="no"/>
|
||||
+ <reg name="ebbrr" bitsize="64" type="uint64" save-restore="no"/>
|
||||
+</feature>
|
||||
diff --git a/gdb/features/rs6000/power-linux-pmu.xml b/gdb/features/rs6000/power-linux-pmu.xml
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/features/rs6000/power-linux-pmu.xml
|
||||
@@ -0,0 +1,17 @@
|
||||
+<?xml version="1.0"?>
|
||||
+<!-- Copyright (C) 2018 Free Software Foundation, Inc.
|
||||
+
|
||||
+ Copying and distribution of this file, with or without modification,
|
||||
+ are permitted in any medium without royalty provided the copyright
|
||||
+ notice and this notice are preserved. -->
|
||||
+
|
||||
+<!-- Subset of the POWER8 ISA 2.07 Performance Monitor Registers
|
||||
+ provided by Linux. -->
|
||||
+<!DOCTYPE feature SYSTEM "gdb-target.dtd">
|
||||
+<feature name="org.gnu.gdb.power.linux.pmu">
|
||||
+ <reg name="mmcr0" bitsize="64" type="uint64" save-restore="no"/>
|
||||
+ <reg name="mmcr2" bitsize="64" type="uint64" save-restore="no"/>
|
||||
+ <reg name="siar" bitsize="64" type="uint64" save-restore="no"/>
|
||||
+ <reg name="sdar" bitsize="64" type="uint64" save-restore="no"/>
|
||||
+ <reg name="sier" bitsize="64" type="uint64" save-restore="no"/>
|
||||
+</feature>
|
||||
diff --git a/gdb/features/rs6000/powerpc-isa207-vsx32l.c b/gdb/features/rs6000/powerpc-isa207-vsx32l.c
|
||||
--- a/gdb/features/rs6000/powerpc-isa207-vsx32l.c
|
||||
+++ b/gdb/features/rs6000/powerpc-isa207-vsx32l.c
|
||||
@@ -199,5 +199,17 @@ initialize_tdesc_powerpc_isa207_vsx32l (void)
|
||||
feature = tdesc_create_feature (result, "org.gnu.gdb.power.tar");
|
||||
tdesc_create_reg (feature, "tar", 141, 1, NULL, 64, "uint64");
|
||||
|
||||
+ feature = tdesc_create_feature (result, "org.gnu.gdb.power.ebb");
|
||||
+ tdesc_create_reg (feature, "bescr", 142, 0, NULL, 64, "uint64");
|
||||
+ tdesc_create_reg (feature, "ebbhr", 143, 0, NULL, 64, "uint64");
|
||||
+ tdesc_create_reg (feature, "ebbrr", 144, 0, NULL, 64, "uint64");
|
||||
+
|
||||
+ feature = tdesc_create_feature (result, "org.gnu.gdb.power.linux.pmu");
|
||||
+ tdesc_create_reg (feature, "mmcr0", 145, 0, NULL, 64, "uint64");
|
||||
+ tdesc_create_reg (feature, "mmcr2", 146, 0, NULL, 64, "uint64");
|
||||
+ tdesc_create_reg (feature, "siar", 147, 0, NULL, 64, "uint64");
|
||||
+ tdesc_create_reg (feature, "sdar", 148, 0, NULL, 64, "uint64");
|
||||
+ tdesc_create_reg (feature, "sier", 149, 0, NULL, 64, "uint64");
|
||||
+
|
||||
tdesc_powerpc_isa207_vsx32l = result;
|
||||
}
|
||||
diff --git a/gdb/features/rs6000/powerpc-isa207-vsx32l.xml b/gdb/features/rs6000/powerpc-isa207-vsx32l.xml
|
||||
--- a/gdb/features/rs6000/powerpc-isa207-vsx32l.xml
|
||||
+++ b/gdb/features/rs6000/powerpc-isa207-vsx32l.xml
|
||||
@@ -16,4 +16,6 @@
|
||||
<xi:include href="power-ppr.xml"/>
|
||||
<xi:include href="power-dscr.xml"/>
|
||||
<xi:include href="power-tar.xml"/>
|
||||
+ <xi:include href="power-ebb.xml"/>
|
||||
+ <xi:include href="power-linux-pmu.xml"/>
|
||||
</target>
|
||||
diff --git a/gdb/features/rs6000/powerpc-isa207-vsx64l.c b/gdb/features/rs6000/powerpc-isa207-vsx64l.c
|
||||
--- a/gdb/features/rs6000/powerpc-isa207-vsx64l.c
|
||||
+++ b/gdb/features/rs6000/powerpc-isa207-vsx64l.c
|
||||
@@ -199,5 +199,17 @@ initialize_tdesc_powerpc_isa207_vsx64l (void)
|
||||
feature = tdesc_create_feature (result, "org.gnu.gdb.power.tar");
|
||||
tdesc_create_reg (feature, "tar", 141, 1, NULL, 64, "uint64");
|
||||
|
||||
+ feature = tdesc_create_feature (result, "org.gnu.gdb.power.ebb");
|
||||
+ tdesc_create_reg (feature, "bescr", 142, 0, NULL, 64, "uint64");
|
||||
+ tdesc_create_reg (feature, "ebbhr", 143, 0, NULL, 64, "uint64");
|
||||
+ tdesc_create_reg (feature, "ebbrr", 144, 0, NULL, 64, "uint64");
|
||||
+
|
||||
+ feature = tdesc_create_feature (result, "org.gnu.gdb.power.linux.pmu");
|
||||
+ tdesc_create_reg (feature, "mmcr0", 145, 0, NULL, 64, "uint64");
|
||||
+ tdesc_create_reg (feature, "mmcr2", 146, 0, NULL, 64, "uint64");
|
||||
+ tdesc_create_reg (feature, "siar", 147, 0, NULL, 64, "uint64");
|
||||
+ tdesc_create_reg (feature, "sdar", 148, 0, NULL, 64, "uint64");
|
||||
+ tdesc_create_reg (feature, "sier", 149, 0, NULL, 64, "uint64");
|
||||
+
|
||||
tdesc_powerpc_isa207_vsx64l = result;
|
||||
}
|
||||
diff --git a/gdb/features/rs6000/powerpc-isa207-vsx64l.xml b/gdb/features/rs6000/powerpc-isa207-vsx64l.xml
|
||||
--- a/gdb/features/rs6000/powerpc-isa207-vsx64l.xml
|
||||
+++ b/gdb/features/rs6000/powerpc-isa207-vsx64l.xml
|
||||
@@ -16,4 +16,6 @@
|
||||
<xi:include href="power-ppr.xml"/>
|
||||
<xi:include href="power-dscr.xml"/>
|
||||
<xi:include href="power-tar.xml"/>
|
||||
+ <xi:include href="power-ebb.xml"/>
|
||||
+ <xi:include href="power-linux-pmu.xml"/>
|
||||
</target>
|
||||
diff --git a/gdb/gdbserver/configure.srv b/gdb/gdbserver/configure.srv
|
||||
--- a/gdb/gdbserver/configure.srv
|
||||
+++ b/gdb/gdbserver/configure.srv
|
||||
@@ -249,6 +249,8 @@ case "${target}" in
|
||||
srv_xmlfiles="${srv_xmlfiles} rs6000/power-dscr.xml"
|
||||
srv_xmlfiles="${srv_xmlfiles} rs6000/power-ppr.xml"
|
||||
srv_xmlfiles="${srv_xmlfiles} rs6000/power-tar.xml"
|
||||
+ srv_xmlfiles="${srv_xmlfiles} rs6000/power-ebb.xml"
|
||||
+ srv_xmlfiles="${srv_xmlfiles} rs6000/power-linux-pmu.xml"
|
||||
srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-e500l.xml"
|
||||
srv_xmlfiles="${srv_xmlfiles} rs6000/power-spe.xml"
|
||||
srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-64l.xml"
|
||||
diff --git a/gdb/gdbserver/linux-ppc-low.c b/gdb/gdbserver/linux-ppc-low.c
|
||||
--- a/gdb/gdbserver/linux-ppc-low.c
|
||||
+++ b/gdb/gdbserver/linux-ppc-low.c
|
||||
@@ -545,6 +545,61 @@ ppc_store_tarregset (struct regcache *regcache, const void *buf)
|
||||
supply_register_by_name (regcache, "tar", tar);
|
||||
}
|
||||
|
||||
+/* Event-Based Branching regset store function. Unless the inferior
|
||||
+ has a perf event open, ptrace can return in error when reading and
|
||||
+ writing to the regset, with ENODATA. For reading, the registers
|
||||
+ will correctly show as unavailable. For writing, gdbserver
|
||||
+ currently only caches any register writes from P and G packets and
|
||||
+ the stub always tries to write all the regsets when resuming the
|
||||
+ inferior, which would result in frequent warnings. For this
|
||||
+ reason, we don't define a fill function. This also means that the
|
||||
+ client-side regcache will be dirty if the user tries to write to
|
||||
+ the EBB registers. G packets that the client sends to write to
|
||||
+ unrelated registers will also include data for EBB registers, even
|
||||
+ if they are unavailable. */
|
||||
+
|
||||
+static void
|
||||
+ppc_store_ebbregset (struct regcache *regcache, const void *buf)
|
||||
+{
|
||||
+ const char *regset = (const char *) buf;
|
||||
+
|
||||
+ /* The order in the kernel regset is: EBBRR, EBBHR, BESCR. In the
|
||||
+ .dat file is BESCR, EBBHR, EBBRR. */
|
||||
+ supply_register_by_name (regcache, "ebbrr", ®set[0]);
|
||||
+ supply_register_by_name (regcache, "ebbhr", ®set[8]);
|
||||
+ supply_register_by_name (regcache, "bescr", ®set[16]);
|
||||
+}
|
||||
+
|
||||
+/* Performance Monitoring Unit regset fill function. */
|
||||
+
|
||||
+static void
|
||||
+ppc_fill_pmuregset (struct regcache *regcache, void *buf)
|
||||
+{
|
||||
+ char *regset = (char *) buf;
|
||||
+
|
||||
+ /* The order in the kernel regset is SIAR, SDAR, SIER, MMCR2, MMCR0.
|
||||
+ In the .dat file is MMCR0, MMCR2, SIAR, SDAR, SIER. */
|
||||
+ collect_register_by_name (regcache, "siar", ®set[0]);
|
||||
+ collect_register_by_name (regcache, "sdar", ®set[8]);
|
||||
+ collect_register_by_name (regcache, "sier", ®set[16]);
|
||||
+ collect_register_by_name (regcache, "mmcr2", ®set[24]);
|
||||
+ collect_register_by_name (regcache, "mmcr0", ®set[32]);
|
||||
+}
|
||||
+
|
||||
+/* Performance Monitoring Unit regset store function. */
|
||||
+
|
||||
+static void
|
||||
+ppc_store_pmuregset (struct regcache *regcache, const void *buf)
|
||||
+{
|
||||
+ const char *regset = (const char *) buf;
|
||||
+
|
||||
+ supply_register_by_name (regcache, "siar", ®set[0]);
|
||||
+ supply_register_by_name (regcache, "sdar", ®set[8]);
|
||||
+ supply_register_by_name (regcache, "sier", ®set[16]);
|
||||
+ supply_register_by_name (regcache, "mmcr2", ®set[24]);
|
||||
+ supply_register_by_name (regcache, "mmcr0", ®set[32]);
|
||||
+}
|
||||
+
|
||||
static void
|
||||
ppc_fill_vsxregset (struct regcache *regcache, void *buf)
|
||||
{
|
||||
@@ -654,6 +709,10 @@ static struct regset_info ppc_regsets[] = {
|
||||
fetch them every time, but still fall back to PTRACE_PEEKUSER for the
|
||||
general registers. Some kernels support these, but not the newer
|
||||
PPC_PTRACE_GETREGS. */
|
||||
+ { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_PPC_EBB, 0, EXTENDED_REGS,
|
||||
+ NULL, ppc_store_ebbregset },
|
||||
+ { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_PPC_PMU, 0, EXTENDED_REGS,
|
||||
+ ppc_fill_pmuregset, ppc_store_pmuregset },
|
||||
{ PTRACE_GETREGSET, PTRACE_SETREGSET, NT_PPC_TAR, 0, EXTENDED_REGS,
|
||||
ppc_fill_tarregset, ppc_store_tarregset },
|
||||
{ PTRACE_GETREGSET, PTRACE_SETREGSET, NT_PPC_PPR, 0, EXTENDED_REGS,
|
||||
@@ -734,8 +793,13 @@ ppc_arch_setup (void)
|
||||
features.ppr_dscr = true;
|
||||
if ((ppc_hwcap2 & PPC_FEATURE2_ARCH_2_07)
|
||||
&& (ppc_hwcap2 & PPC_FEATURE2_TAR)
|
||||
+ && (ppc_hwcap2 & PPC_FEATURE2_EBB)
|
||||
&& ppc_check_regset (tid, NT_PPC_TAR,
|
||||
- PPC_LINUX_SIZEOF_TARREGSET))
|
||||
+ PPC_LINUX_SIZEOF_TARREGSET)
|
||||
+ && ppc_check_regset (tid, NT_PPC_EBB,
|
||||
+ PPC_LINUX_SIZEOF_EBBREGSET)
|
||||
+ && ppc_check_regset (tid, NT_PPC_PMU,
|
||||
+ PPC_LINUX_SIZEOF_PMUREGSET))
|
||||
features.isa207 = true;
|
||||
}
|
||||
|
||||
@@ -798,6 +862,14 @@ ppc_arch_setup (void)
|
||||
regset->size = (features.isa207 ?
|
||||
PPC_LINUX_SIZEOF_TARREGSET : 0);
|
||||
break;
|
||||
+ case NT_PPC_EBB:
|
||||
+ regset->size = (features.isa207 ?
|
||||
+ PPC_LINUX_SIZEOF_EBBREGSET : 0);
|
||||
+ break;
|
||||
+ case NT_PPC_PMU:
|
||||
+ regset->size = (features.isa207 ?
|
||||
+ PPC_LINUX_SIZEOF_PMUREGSET : 0);
|
||||
+ break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
diff --git a/gdb/nat/ppc-linux.h b/gdb/nat/ppc-linux.h
|
||||
--- a/gdb/nat/ppc-linux.h
|
||||
+++ b/gdb/nat/ppc-linux.h
|
||||
@@ -60,6 +60,9 @@
|
||||
#ifndef PPC_FEATURE2_TAR
|
||||
#define PPC_FEATURE2_TAR 0x04000000
|
||||
#endif
|
||||
+#ifndef PPC_FEATURE2_EBB
|
||||
+#define PPC_FEATURE2_EBB 0x10000000
|
||||
+#endif
|
||||
|
||||
/* Glibc's headers don't define PTRACE_GETVRREGS so we cannot use a
|
||||
configure time check. Some older glibc's (for instance 2.2.1)
|
||||
@@ -106,6 +109,16 @@
|
||||
#define NT_PPC_DSCR 0x105
|
||||
#endif
|
||||
|
||||
+/* Event Based Branch Registers. */
|
||||
+#ifndef NT_PPC_EBB
|
||||
+#define NT_PPC_EBB 0x106
|
||||
+#endif
|
||||
+
|
||||
+/* Performance Monitor Registers. */
|
||||
+#ifndef NT_PPC_PMU
|
||||
+#define NT_PPC_PMU 0x107
|
||||
+#endif
|
||||
+
|
||||
/* Return the wordsize of the target, either 4 or 8 bytes. */
|
||||
int ppc_linux_target_wordsize (int tid);
|
||||
|
||||
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
|
||||
@@ -667,6 +667,24 @@ fetch_register (struct regcache *regcache, int tid, int regno)
|
||||
&ppc32_linux_tarregset);
|
||||
return;
|
||||
}
|
||||
+ else if (PPC_IS_EBB_REGNUM (regno))
|
||||
+ {
|
||||
+ gdb_assert (tdep->have_ebb);
|
||||
+
|
||||
+ fetch_regset (regcache, tid, NT_PPC_EBB,
|
||||
+ PPC_LINUX_SIZEOF_EBBREGSET,
|
||||
+ &ppc32_linux_ebbregset);
|
||||
+ return;
|
||||
+ }
|
||||
+ else if (PPC_IS_PMU_REGNUM (regno))
|
||||
+ {
|
||||
+ gdb_assert (tdep->ppc_mmcr0_regnum != -1);
|
||||
+
|
||||
+ fetch_regset (regcache, tid, NT_PPC_PMU,
|
||||
+ PPC_LINUX_SIZEOF_PMUREGSET,
|
||||
+ &ppc32_linux_pmuregset);
|
||||
+ return;
|
||||
+ }
|
||||
|
||||
if (regaddr == -1)
|
||||
{
|
||||
@@ -875,6 +893,14 @@ fetch_ppc_registers (struct regcache *regcache, int tid)
|
||||
fetch_regset (regcache, tid, NT_PPC_TAR,
|
||||
PPC_LINUX_SIZEOF_TARREGSET,
|
||||
&ppc32_linux_tarregset);
|
||||
+ if (tdep->have_ebb)
|
||||
+ fetch_regset (regcache, tid, NT_PPC_EBB,
|
||||
+ PPC_LINUX_SIZEOF_EBBREGSET,
|
||||
+ &ppc32_linux_ebbregset);
|
||||
+ if (tdep->ppc_mmcr0_regnum != -1)
|
||||
+ fetch_regset (regcache, tid, NT_PPC_PMU,
|
||||
+ PPC_LINUX_SIZEOF_PMUREGSET,
|
||||
+ &ppc32_linux_pmuregset);
|
||||
}
|
||||
|
||||
/* Fetch registers from the child process. Fetch all registers if
|
||||
@@ -1082,6 +1108,24 @@ store_register (const struct regcache *regcache, int tid, int regno)
|
||||
&ppc32_linux_tarregset);
|
||||
return;
|
||||
}
|
||||
+ else if (PPC_IS_EBB_REGNUM (regno))
|
||||
+ {
|
||||
+ gdb_assert (tdep->have_ebb);
|
||||
+
|
||||
+ store_regset (regcache, tid, regno, NT_PPC_EBB,
|
||||
+ PPC_LINUX_SIZEOF_EBBREGSET,
|
||||
+ &ppc32_linux_ebbregset);
|
||||
+ return;
|
||||
+ }
|
||||
+ else if (PPC_IS_PMU_REGNUM (regno))
|
||||
+ {
|
||||
+ gdb_assert (tdep->ppc_mmcr0_regnum != -1);
|
||||
+
|
||||
+ store_regset (regcache, tid, regno, NT_PPC_PMU,
|
||||
+ PPC_LINUX_SIZEOF_PMUREGSET,
|
||||
+ &ppc32_linux_pmuregset);
|
||||
+ return;
|
||||
+ }
|
||||
|
||||
if (regaddr == -1)
|
||||
return;
|
||||
@@ -1308,6 +1352,15 @@ store_ppc_registers (const struct regcache *regcache, int tid)
|
||||
store_regset (regcache, tid, -1, NT_PPC_TAR,
|
||||
PPC_LINUX_SIZEOF_TARREGSET,
|
||||
&ppc32_linux_tarregset);
|
||||
+
|
||||
+ if (tdep->ppc_mmcr0_regnum != -1)
|
||||
+ store_regset (regcache, tid, -1, NT_PPC_PMU,
|
||||
+ PPC_LINUX_SIZEOF_PMUREGSET,
|
||||
+ &ppc32_linux_pmuregset);
|
||||
+
|
||||
+ /* Because the EBB registers can be unavailable, attempts to store
|
||||
+ them here would cause this function to fail most of the time, so
|
||||
+ we ignore them. */
|
||||
}
|
||||
|
||||
/* Fetch the AT_HWCAP entry from the aux vector. */
|
||||
@@ -2439,7 +2492,10 @@ ppc_linux_nat_target::read_description ()
|
||||
features.ppr_dscr = true;
|
||||
if ((hwcap2 & PPC_FEATURE2_ARCH_2_07)
|
||||
&& (hwcap2 & PPC_FEATURE2_TAR)
|
||||
- && check_regset (tid, NT_PPC_TAR, PPC_LINUX_SIZEOF_TARREGSET))
|
||||
+ && (hwcap2 & PPC_FEATURE2_EBB)
|
||||
+ && check_regset (tid, NT_PPC_TAR, PPC_LINUX_SIZEOF_TARREGSET)
|
||||
+ && check_regset (tid, NT_PPC_EBB, PPC_LINUX_SIZEOF_EBBREGSET)
|
||||
+ && check_regset (tid, NT_PPC_PMU, PPC_LINUX_SIZEOF_PMUREGSET))
|
||||
features.isa207 = true;
|
||||
}
|
||||
|
||||
diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c
|
||||
--- a/gdb/ppc-linux-tdep.c
|
||||
+++ b/gdb/ppc-linux-tdep.c
|
||||
@@ -599,6 +599,44 @@ const struct regset ppc32_linux_tarregset = {
|
||||
regcache_collect_regset
|
||||
};
|
||||
|
||||
+/* Event-Based Branching regmap. */
|
||||
+
|
||||
+static const struct regcache_map_entry ppc32_regmap_ebb[] =
|
||||
+ {
|
||||
+ { 1, PPC_EBBRR_REGNUM, 8 },
|
||||
+ { 1, PPC_EBBHR_REGNUM, 8 },
|
||||
+ { 1, PPC_BESCR_REGNUM, 8 },
|
||||
+ { 0 }
|
||||
+ };
|
||||
+
|
||||
+/* Event-Based Branching regset. */
|
||||
+
|
||||
+const struct regset ppc32_linux_ebbregset = {
|
||||
+ ppc32_regmap_ebb,
|
||||
+ regcache_supply_regset,
|
||||
+ regcache_collect_regset
|
||||
+};
|
||||
+
|
||||
+/* Performance Monitoring Unit regmap. */
|
||||
+
|
||||
+static const struct regcache_map_entry ppc32_regmap_pmu[] =
|
||||
+ {
|
||||
+ { 1, PPC_SIAR_REGNUM, 8 },
|
||||
+ { 1, PPC_SDAR_REGNUM, 8 },
|
||||
+ { 1, PPC_SIER_REGNUM, 8 },
|
||||
+ { 1, PPC_MMCR2_REGNUM, 8 },
|
||||
+ { 1, PPC_MMCR0_REGNUM, 8 },
|
||||
+ { 0 }
|
||||
+ };
|
||||
+
|
||||
+/* Performance Monitoring Unit regset. */
|
||||
+
|
||||
+const struct regset ppc32_linux_pmuregset = {
|
||||
+ ppc32_regmap_pmu,
|
||||
+ regcache_supply_regset,
|
||||
+ regcache_collect_regset
|
||||
+};
|
||||
+
|
||||
const struct regset *
|
||||
ppc_linux_gregset (int wordsize)
|
||||
{
|
||||
@@ -674,6 +712,22 @@ ppc_linux_iterate_over_regset_sections (struct gdbarch *gdbarch,
|
||||
cb (".reg-ppc-tar", PPC_LINUX_SIZEOF_TARREGSET,
|
||||
PPC_LINUX_SIZEOF_TARREGSET,
|
||||
&ppc32_linux_tarregset, "Target Address Register", cb_data);
|
||||
+
|
||||
+ /* EBB registers are unavailable when ptrace returns ENODATA. Check
|
||||
+ availability when generating a core file (regcache != NULL). */
|
||||
+ if (tdep->have_ebb)
|
||||
+ if (regcache == NULL
|
||||
+ || REG_VALID == regcache->get_register_status (PPC_BESCR_REGNUM))
|
||||
+ cb (".reg-ppc-ebb", PPC_LINUX_SIZEOF_EBBREGSET,
|
||||
+ PPC_LINUX_SIZEOF_EBBREGSET,
|
||||
+ &ppc32_linux_ebbregset, "Event-based Branching Registers",
|
||||
+ cb_data);
|
||||
+
|
||||
+ if (tdep->ppc_mmcr0_regnum != -1)
|
||||
+ cb (".reg-ppc-pmu", PPC_LINUX_SIZEOF_PMUREGSET,
|
||||
+ PPC_LINUX_SIZEOF_PMUREGSET,
|
||||
+ &ppc32_linux_pmuregset, "Performance Monitor Registers",
|
||||
+ cb_data);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1089,6 +1143,7 @@ ppc_linux_core_read_description (struct gdbarch *gdbarch,
|
||||
asection *ppr = bfd_get_section_by_name (abfd, ".reg-ppc-ppr");
|
||||
asection *dscr = bfd_get_section_by_name (abfd, ".reg-ppc-dscr");
|
||||
asection *tar = bfd_get_section_by_name (abfd, ".reg-ppc-tar");
|
||||
+ asection *pmu = bfd_get_section_by_name (abfd, ".reg-ppc-pmu");
|
||||
|
||||
if (! section)
|
||||
return NULL;
|
||||
@@ -1124,7 +1179,12 @@ ppc_linux_core_read_description (struct gdbarch *gdbarch,
|
||||
if (ppr && dscr)
|
||||
{
|
||||
features.ppr_dscr = true;
|
||||
- if (tar)
|
||||
+
|
||||
+ /* We don't require the EBB note section to be present in the
|
||||
+ core file to select isa207 because these registers could have
|
||||
+ been unavailable when the core file was created. They will
|
||||
+ be in the tdep but will show as unavailable. */
|
||||
+ if (tar && pmu)
|
||||
features.isa207 = true;
|
||||
}
|
||||
|
||||
diff --git a/gdb/ppc-linux-tdep.h b/gdb/ppc-linux-tdep.h
|
||||
--- a/gdb/ppc-linux-tdep.h
|
||||
+++ b/gdb/ppc-linux-tdep.h
|
||||
@@ -48,5 +48,7 @@ int ppc_linux_trap_reg_p (struct gdbarch *gdbarch);
|
||||
extern const struct regset ppc32_linux_pprregset;
|
||||
extern const struct regset ppc32_linux_dscrregset;
|
||||
extern const struct regset ppc32_linux_tarregset;
|
||||
+extern const struct regset ppc32_linux_ebbregset;
|
||||
+extern const struct regset ppc32_linux_pmuregset;
|
||||
|
||||
#endif /* PPC_LINUX_TDEP_H */
|
||||
diff --git a/gdb/ppc-tdep.h b/gdb/ppc-tdep.h
|
||||
--- a/gdb/ppc-tdep.h
|
||||
+++ b/gdb/ppc-tdep.h
|
||||
@@ -265,6 +265,15 @@ struct gdbarch_tdep
|
||||
/* Decimal 128 registers. */
|
||||
int ppc_dl0_regnum; /* First Decimal128 argument register pair. */
|
||||
|
||||
+ int have_ebb;
|
||||
+
|
||||
+ /* PMU registers. */
|
||||
+ int ppc_mmcr0_regnum;
|
||||
+ int ppc_mmcr2_regnum;
|
||||
+ int ppc_siar_regnum;
|
||||
+ int ppc_sdar_regnum;
|
||||
+ int ppc_sier_regnum;
|
||||
+
|
||||
/* Offset to ABI specific location where link register is saved. */
|
||||
int lr_frame_offset;
|
||||
|
||||
@@ -321,12 +330,31 @@ enum {
|
||||
PPC_PPR_REGNUM = 172,
|
||||
PPC_DSCR_REGNUM = 173,
|
||||
PPC_TAR_REGNUM = 174,
|
||||
+
|
||||
+ /* EBB registers. */
|
||||
+ PPC_BESCR_REGNUM = 175,
|
||||
+ PPC_EBBHR_REGNUM = 176,
|
||||
+ PPC_EBBRR_REGNUM = 177,
|
||||
+
|
||||
+ /* PMU registers. */
|
||||
+ PPC_MMCR0_REGNUM = 178,
|
||||
+ PPC_MMCR2_REGNUM = 179,
|
||||
+ PPC_SIAR_REGNUM = 180,
|
||||
+ PPC_SDAR_REGNUM = 181,
|
||||
+ PPC_SIER_REGNUM = 182,
|
||||
+
|
||||
PPC_NUM_REGS
|
||||
};
|
||||
|
||||
/* Big enough to hold the size of the largest register in bytes. */
|
||||
#define PPC_MAX_REGISTER_SIZE 64
|
||||
|
||||
+#define PPC_IS_EBB_REGNUM(i) \
|
||||
+ ((i) >= PPC_BESCR_REGNUM && (i) <= PPC_EBBRR_REGNUM)
|
||||
+
|
||||
+#define PPC_IS_PMU_REGNUM(i) \
|
||||
+ ((i) >= PPC_MMCR0_REGNUM && (i) <= PPC_SIER_REGNUM)
|
||||
+
|
||||
/* An instruction to match. */
|
||||
|
||||
struct ppc_insn_pattern
|
||||
diff --git a/gdb/regformats/rs6000/powerpc-isa207-vsx32l.dat b/gdb/regformats/rs6000/powerpc-isa207-vsx32l.dat
|
||||
--- a/gdb/regformats/rs6000/powerpc-isa207-vsx32l.dat
|
||||
+++ b/gdb/regformats/rs6000/powerpc-isa207-vsx32l.dat
|
||||
@@ -145,3 +145,11 @@ expedite:r1,pc
|
||||
64:ppr
|
||||
64:dscr
|
||||
64:tar
|
||||
+64:bescr
|
||||
+64:ebbhr
|
||||
+64:ebbrr
|
||||
+64:mmcr0
|
||||
+64:mmcr2
|
||||
+64:siar
|
||||
+64:sdar
|
||||
+64:sier
|
||||
diff --git a/gdb/regformats/rs6000/powerpc-isa207-vsx64l.dat b/gdb/regformats/rs6000/powerpc-isa207-vsx64l.dat
|
||||
--- a/gdb/regformats/rs6000/powerpc-isa207-vsx64l.dat
|
||||
+++ b/gdb/regformats/rs6000/powerpc-isa207-vsx64l.dat
|
||||
@@ -145,3 +145,11 @@ expedite:r1,pc
|
||||
64:ppr
|
||||
64:dscr
|
||||
64:tar
|
||||
+64:bescr
|
||||
+64:ebbhr
|
||||
+64:ebbrr
|
||||
+64:mmcr0
|
||||
+64:mmcr2
|
||||
+64:siar
|
||||
+64:sdar
|
||||
+64:sier
|
||||
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
|
||||
--- a/gdb/rs6000-tdep.c
|
||||
+++ b/gdb/rs6000-tdep.c
|
||||
@@ -5871,7 +5871,7 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
|
||||
enum powerpc_elf_abi elf_abi = POWERPC_ELF_AUTO;
|
||||
int have_fpu = 0, have_spe = 0, have_mq = 0, have_altivec = 0;
|
||||
int have_dfp = 0, have_vsx = 0, have_ppr = 0, have_dscr = 0;
|
||||
- int have_tar = 0;
|
||||
+ int have_tar = 0, have_ebb = 0, have_pmu = 0;
|
||||
int tdesc_wordsize = -1;
|
||||
const struct target_desc *tdesc = info.target_desc;
|
||||
struct tdesc_arch_data *tdesc_data = NULL;
|
||||
@@ -6211,6 +6211,64 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
|
||||
}
|
||||
else
|
||||
have_tar = 0;
|
||||
+
|
||||
+ /* Event-based Branching Registers. */
|
||||
+ feature = tdesc_find_feature (tdesc,
|
||||
+ "org.gnu.gdb.power.ebb");
|
||||
+ if (feature != NULL)
|
||||
+ {
|
||||
+ static const char *const ebb_regs[] = {
|
||||
+ "bescr", "ebbhr", "ebbrr"
|
||||
+ };
|
||||
+
|
||||
+ valid_p = 1;
|
||||
+ for (i = 0; i < ARRAY_SIZE (ebb_regs); i++)
|
||||
+ valid_p &= tdesc_numbered_register (feature, tdesc_data,
|
||||
+ PPC_BESCR_REGNUM + i,
|
||||
+ ebb_regs[i]);
|
||||
+ if (!valid_p)
|
||||
+ {
|
||||
+ tdesc_data_cleanup (tdesc_data);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+ have_ebb = 1;
|
||||
+ }
|
||||
+ else
|
||||
+ have_ebb = 0;
|
||||
+
|
||||
+ /* Subset of the ISA 2.07 Performance Monitor Registers provided
|
||||
+ by Linux. */
|
||||
+ feature = tdesc_find_feature (tdesc,
|
||||
+ "org.gnu.gdb.power.linux.pmu");
|
||||
+ if (feature != NULL)
|
||||
+ {
|
||||
+ valid_p = 1;
|
||||
+
|
||||
+ valid_p &= tdesc_numbered_register (feature, tdesc_data,
|
||||
+ PPC_MMCR0_REGNUM,
|
||||
+ "mmcr0");
|
||||
+ valid_p &= tdesc_numbered_register (feature, tdesc_data,
|
||||
+ PPC_MMCR2_REGNUM,
|
||||
+ "mmcr2");
|
||||
+ valid_p &= tdesc_numbered_register (feature, tdesc_data,
|
||||
+ PPC_SIAR_REGNUM,
|
||||
+ "siar");
|
||||
+ valid_p &= tdesc_numbered_register (feature, tdesc_data,
|
||||
+ PPC_SDAR_REGNUM,
|
||||
+ "sdar");
|
||||
+ valid_p &= tdesc_numbered_register (feature, tdesc_data,
|
||||
+ PPC_SIER_REGNUM,
|
||||
+ "sier");
|
||||
+
|
||||
+ if (!valid_p)
|
||||
+ {
|
||||
+ tdesc_data_cleanup (tdesc_data);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+ have_pmu = 1;
|
||||
+ }
|
||||
+ else
|
||||
+ have_pmu = 0;
|
||||
}
|
||||
|
||||
/* If we have a 64-bit binary on a 32-bit target, complain. Also
|
||||
@@ -6408,6 +6466,20 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
|
||||
tdep->ppc_ppr_regnum = have_ppr ? PPC_PPR_REGNUM : -1;
|
||||
tdep->ppc_dscr_regnum = have_dscr ? PPC_DSCR_REGNUM : -1;
|
||||
tdep->ppc_tar_regnum = have_tar ? PPC_TAR_REGNUM : -1;
|
||||
+ tdep->have_ebb = have_ebb;
|
||||
+
|
||||
+ /* If additional pmu registers are added, care must be taken when
|
||||
+ setting new fields in the tdep below, to maintain compatibility
|
||||
+ with features that only provide some of the registers. Currently
|
||||
+ gdb access to the pmu registers is only supported in linux, and
|
||||
+ linux only provides a subset of the pmu registers defined in the
|
||||
+ architecture. */
|
||||
+
|
||||
+ tdep->ppc_mmcr0_regnum = have_pmu ? PPC_MMCR0_REGNUM : -1;
|
||||
+ tdep->ppc_mmcr2_regnum = have_pmu ? PPC_MMCR2_REGNUM : -1;
|
||||
+ tdep->ppc_siar_regnum = have_pmu ? PPC_SIAR_REGNUM : -1;
|
||||
+ tdep->ppc_sdar_regnum = have_pmu ? PPC_SDAR_REGNUM : -1;
|
||||
+ tdep->ppc_sier_regnum = have_pmu ? PPC_SIER_REGNUM : -1;
|
||||
|
||||
set_gdbarch_pc_regnum (gdbarch, PPC_PC_REGNUM);
|
||||
set_gdbarch_sp_regnum (gdbarch, PPC_R0_REGNUM + 1);
|
|
@ -1,38 +0,0 @@
|
|||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Keith Seitz <keiths@redhat.com>
|
||||
Date: Fri, 11 Jan 2019 17:02:18 -0500
|
||||
Subject: gdb-rhbz1187581-power8-regs-not-in-8.2-13of15.patch
|
||||
|
||||
;; [PowerPC] Reject tdescs with VSX and no FPU or Altivec
|
||||
;; Pedro Franco de Carvalho, RH BZ 1187581
|
||||
|
||||
[PowerPC] Reject tdescs with VSX and no FPU or Altivec
|
||||
|
||||
Currently rs6000_gdbarch_init will accept a tdesc with the
|
||||
"org.gnu.gdb.power.vsx" feature but without the
|
||||
"org.gnu.gdb.power.altivec" or "org.gnu.gdb.power.fpu".
|
||||
|
||||
It isn't clear from the standard features documentation that these are
|
||||
requirements. However, these tdescs would cause trouble in the VSX
|
||||
pseudo-register functions, so this patch will cause them to be
|
||||
rejected.
|
||||
|
||||
gdb/ChangeLog:
|
||||
2018-10-26 Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
|
||||
|
||||
* rs6000-tdep.c (rs6000_gdbarch_init): Reject tdescs with vsx but
|
||||
without altivec or fpu.
|
||||
|
||||
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
|
||||
--- a/gdb/rs6000-tdep.c
|
||||
+++ b/gdb/rs6000-tdep.c
|
||||
@@ -6096,7 +6096,8 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
|
||||
valid_p &= tdesc_numbered_register (feature, tdesc_data,
|
||||
PPC_VSR0_UPPER_REGNUM + i,
|
||||
vsx_regs[i]);
|
||||
- if (!valid_p)
|
||||
+
|
||||
+ if (!valid_p || !have_fpu || !have_altivec)
|
||||
{
|
||||
tdesc_data_cleanup (tdesc_data);
|
||||
return NULL;
|
File diff suppressed because it is too large
Load Diff
|
@ -1,43 +0,0 @@
|
|||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Keith Seitz <keiths@redhat.com>
|
||||
Date: Fri, 11 Jan 2019 17:02:19 -0500
|
||||
Subject: gdb-rhbz1187581-power8-regs-not-in-8.2-15of15.patch
|
||||
|
||||
;; [PowerPC] Document requirements for VSX feature
|
||||
;; Pedro Franco de Carvalho, RH BZ 1187581
|
||||
|
||||
[PowerPC] Document requirements for VSX feature
|
||||
|
||||
As suggested in
|
||||
https://sourceware.org/ml/gdb-patches/2018-10/msg00510.html, this
|
||||
patch changes the documentation for the VSX tdesc feature to make it
|
||||
clear that the altivec and FPU features are requirements.
|
||||
|
||||
gdb/doc/ChangeLog:
|
||||
2018-11-09 Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
|
||||
|
||||
* gdb.texinfo (PowerPC Features): Document the altivec and fpu
|
||||
requirements for the org.gnu.gdb.power.vsx feature.
|
||||
|
||||
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
|
||||
--- a/gdb/doc/gdb.texinfo
|
||||
+++ b/gdb/doc/gdb.texinfo
|
||||
@@ -42541,11 +42541,13 @@ contain registers @samp{vr0} through @samp{vr31}, @samp{vscr},
|
||||
and @samp{vrsave}.
|
||||
|
||||
The @samp{org.gnu.gdb.power.vsx} feature is optional. It should
|
||||
-contain registers @samp{vs0h} through @samp{vs31h}. @value{GDBN}
|
||||
-will combine these registers with the floating point registers
|
||||
-(@samp{f0} through @samp{f31}) and the altivec registers (@samp{vr0}
|
||||
-through @samp{vr31}) to present the 128-bit wide registers @samp{vs0}
|
||||
-through @samp{vs63}, the set of vector registers for POWER7.
|
||||
+contain registers @samp{vs0h} through @samp{vs31h}. @value{GDBN} will
|
||||
+combine these registers with the floating point registers (@samp{f0}
|
||||
+through @samp{f31}) and the altivec registers (@samp{vr0} through
|
||||
+@samp{vr31}) to present the 128-bit wide registers @samp{vs0} through
|
||||
+@samp{vs63}, the set of vector-scalar registers for POWER7.
|
||||
+Therefore, this feature requires both @samp{org.gnu.gdb.power.fpu} and
|
||||
+@samp{org.gnu.gdb.power.altivec}.
|
||||
|
||||
The @samp{org.gnu.gdb.power.spe} feature is optional. It should
|
||||
contain registers @samp{ev0h} through @samp{ev31h}, @samp{acc}, and
|
|
@ -1,323 +0,0 @@
|
|||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Gary Benson <gbenson@redhat.com>
|
||||
Date: Wed, 29 Aug 2018 16:11:50 +0100
|
||||
Subject: gdb-rhbz1491128-batch-mode-exit-status-1of2.patch
|
||||
|
||||
;; Fix for 'gdb in batch mode always exit with status 0' (Gary Benson)
|
||||
;; RHBZ #1491128
|
||||
|
||||
Indicate batch mode failures by exiting with nonzero status
|
||||
|
||||
This commit causes GDB in batch mode to exit with nonzero status
|
||||
if the last command to be executed fails.
|
||||
|
||||
gdb/ChangeLog:
|
||||
|
||||
PR gdb/13000:
|
||||
* gdb/main.c (captured_main_1): Exit with nonzero status
|
||||
in batch mode if the last command to be executed failed.
|
||||
* NEWS: Mention the above.
|
||||
|
||||
gdb/testsuite/ChangeLog:
|
||||
|
||||
PR gdb/13000:
|
||||
* gdb.base/batch-exit-status.exp: New file.
|
||||
* gdb.base/batch-exit-status.good-commands: Likewise.
|
||||
* gdb.base/batch-exit-status.bad-commands: Likewise.
|
||||
|
||||
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
|
||||
--- a/gdb/ChangeLog
|
||||
+++ b/gdb/ChangeLog
|
||||
@@ -1,3 +1,10 @@
|
||||
+2018-08-16 Gary Benson <gbenson@redhat.com>
|
||||
+
|
||||
+ PR gdb/13000:
|
||||
+ * gdb/main.c (captured_main_1): Exit with nonzero status
|
||||
+ in batch mode if the last command to be executed failed.
|
||||
+ * NEWS: Mention the above.
|
||||
+
|
||||
2018-08-03 Sergio Durigan Junior <sergiodj@redhat.com>
|
||||
|
||||
* ser-tcp.c (net_open): Fix thinko when deciding whether to
|
||||
diff --git a/gdb/NEWS b/gdb/NEWS
|
||||
--- a/gdb/NEWS
|
||||
+++ b/gdb/NEWS
|
||||
@@ -7,6 +7,9 @@
|
||||
can be passed using the '[ADDRESS]:PORT' notation, or the regular
|
||||
'ADDRESS:PORT' method.
|
||||
|
||||
+* GDB in batch mode now exits with status 1 if the last command to be
|
||||
+ executed failed.
|
||||
+
|
||||
*** Changes in GDB 8.2
|
||||
|
||||
* The 'set disassembler-options' command now supports specifying options
|
||||
diff --git a/gdb/main.c b/gdb/main.c
|
||||
--- a/gdb/main.c
|
||||
+++ b/gdb/main.c
|
||||
@@ -518,6 +518,7 @@ captured_main_1 (struct captured_main_args *context, int &python_script)
|
||||
int i;
|
||||
int save_auto_load;
|
||||
struct objfile *objfile;
|
||||
+ int ret = 1;
|
||||
|
||||
#ifdef HAVE_SBRK
|
||||
/* Set this before constructing scoped_command_stats. */
|
||||
@@ -1051,7 +1052,7 @@ captured_main_1 (struct captured_main_args *context, int &python_script)
|
||||
processed; it sets global parameters, which are independent of
|
||||
what file you are debugging or what directory you are in. */
|
||||
if (system_gdbinit && !inhibit_gdbinit)
|
||||
- catch_command_errors (source_script, system_gdbinit, 0);
|
||||
+ ret = catch_command_errors (source_script, system_gdbinit, 0);
|
||||
|
||||
/* Read and execute $HOME/.gdbinit file, if it exists. This is done
|
||||
*before* all the command line arguments are processed; it sets
|
||||
@@ -1059,7 +1060,7 @@ captured_main_1 (struct captured_main_args *context, int &python_script)
|
||||
debugging or what directory you are in. */
|
||||
|
||||
if (home_gdbinit && !inhibit_gdbinit && !inhibit_home_gdbinit)
|
||||
- catch_command_errors (source_script, home_gdbinit, 0);
|
||||
+ ret = catch_command_errors (source_script, home_gdbinit, 0);
|
||||
|
||||
/* Process '-ix' and '-iex' options early. */
|
||||
for (i = 0; i < cmdarg_vec.size (); i++)
|
||||
@@ -1069,12 +1070,12 @@ captured_main_1 (struct captured_main_args *context, int &python_script)
|
||||
switch (cmdarg_p.type)
|
||||
{
|
||||
case CMDARG_INIT_FILE:
|
||||
- catch_command_errors (source_script, cmdarg_p.string,
|
||||
- !batch_flag);
|
||||
+ ret = catch_command_errors (source_script, cmdarg_p.string,
|
||||
+ !batch_flag);
|
||||
break;
|
||||
case CMDARG_INIT_COMMAND:
|
||||
- catch_command_errors (execute_command, cmdarg_p.string,
|
||||
- !batch_flag);
|
||||
+ ret = catch_command_errors (execute_command, cmdarg_p.string,
|
||||
+ !batch_flag);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1082,11 +1083,11 @@ captured_main_1 (struct captured_main_args *context, int &python_script)
|
||||
/* Now perform all the actions indicated by the arguments. */
|
||||
if (cdarg != NULL)
|
||||
{
|
||||
- catch_command_errors (cd_command, cdarg, 0);
|
||||
+ ret = catch_command_errors (cd_command, cdarg, 0);
|
||||
}
|
||||
|
||||
for (i = 0; i < dirarg.size (); i++)
|
||||
- catch_command_errors (directory_switch, dirarg[i], 0);
|
||||
+ ret = catch_command_errors (directory_switch, dirarg[i], 0);
|
||||
|
||||
/* Skip auto-loading section-specified scripts until we've sourced
|
||||
local_gdbinit (which is often used to augment the source search
|
||||
@@ -1115,19 +1116,19 @@ captured_main_1 (struct captured_main_args *context, int &python_script)
|
||||
catch_command_errors returns non-zero on success!
|
||||
Do not load EXECARG as a symbol file if it has been already processed
|
||||
as a core file. */
|
||||
- if (catch_command_errors (func, execarg, !batch_flag)
|
||||
- && core_bfd == NULL)
|
||||
- catch_command_errors (symbol_file_add_main_adapter, symarg,
|
||||
- !batch_flag);
|
||||
+ ret = catch_command_errors (func, execarg, !batch_flag);
|
||||
+ if (ret != 0 && core_bfd == NULL)
|
||||
+ ret = catch_command_errors (symbol_file_add_main_adapter,
|
||||
+ symarg, !batch_flag);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (execarg != NULL)
|
||||
- catch_command_errors (exec_file_attach, execarg,
|
||||
- !batch_flag);
|
||||
+ ret = catch_command_errors (exec_file_attach, execarg,
|
||||
+ !batch_flag);
|
||||
if (symarg != NULL)
|
||||
- catch_command_errors (symbol_file_add_main_adapter, symarg,
|
||||
- !batch_flag);
|
||||
+ ret = catch_command_errors (symbol_file_add_main_adapter,
|
||||
+ symarg, !batch_flag);
|
||||
}
|
||||
|
||||
if (corearg && pidarg)
|
||||
@@ -1135,9 +1136,14 @@ captured_main_1 (struct captured_main_args *context, int &python_script)
|
||||
"a core file at the same time."));
|
||||
|
||||
if (corearg != NULL)
|
||||
- catch_command_errors (core_file_command, corearg, !batch_flag);
|
||||
+ {
|
||||
+ ret = catch_command_errors (core_file_command, corearg,
|
||||
+ !batch_flag);
|
||||
+ }
|
||||
else if (pidarg != NULL)
|
||||
- catch_command_errors (attach_command, pidarg, !batch_flag);
|
||||
+ {
|
||||
+ ret = catch_command_errors (attach_command, pidarg, !batch_flag);
|
||||
+ }
|
||||
else if (pid_or_core_arg)
|
||||
{
|
||||
/* The user specified 'gdb program pid' or gdb program core'.
|
||||
@@ -1146,17 +1152,23 @@ captured_main_1 (struct captured_main_args *context, int &python_script)
|
||||
|
||||
if (isdigit (pid_or_core_arg[0]))
|
||||
{
|
||||
- if (catch_command_errors (attach_command, pid_or_core_arg,
|
||||
- !batch_flag) == 0
|
||||
+ ret = catch_command_errors (attach_command, pid_or_core_arg,
|
||||
+ !batch_flag);
|
||||
+ if (ret == 0
|
||||
/* attach_command could succeed partially and core_file_command
|
||||
would try to kill it. */
|
||||
&& !have_inferiors ())
|
||||
- catch_command_errors (core_file_command, pid_or_core_arg,
|
||||
- !batch_flag);
|
||||
+ ret = catch_command_errors (core_file_command,
|
||||
+ pid_or_core_arg,
|
||||
+ !batch_flag);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ /* Can't be a pid, better be a corefile. */
|
||||
+ ret = catch_command_errors (core_file_command,
|
||||
+ pid_or_core_arg,
|
||||
+ !batch_flag);
|
||||
}
|
||||
- else /* Can't be a pid, better be a corefile. */
|
||||
- catch_command_errors (core_file_command, pid_or_core_arg,
|
||||
- !batch_flag);
|
||||
}
|
||||
|
||||
if (ttyarg != NULL)
|
||||
@@ -1180,7 +1192,7 @@ captured_main_1 (struct captured_main_args *context, int &python_script)
|
||||
{
|
||||
auto_load_local_gdbinit_loaded = 1;
|
||||
|
||||
- catch_command_errors (source_script, local_gdbinit, 0);
|
||||
+ ret = catch_command_errors (source_script, local_gdbinit, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1200,12 +1212,12 @@ captured_main_1 (struct captured_main_args *context, int &python_script)
|
||||
switch (cmdarg_p.type)
|
||||
{
|
||||
case CMDARG_FILE:
|
||||
- catch_command_errors (source_script, cmdarg_p.string,
|
||||
- !batch_flag);
|
||||
+ ret = catch_command_errors (source_script, cmdarg_p.string,
|
||||
+ !batch_flag);
|
||||
break;
|
||||
case CMDARG_COMMAND:
|
||||
- catch_command_errors (execute_command, cmdarg_p.string,
|
||||
- !batch_flag);
|
||||
+ ret = catch_command_errors (execute_command, cmdarg_p.string,
|
||||
+ !batch_flag);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1217,8 +1229,11 @@ captured_main_1 (struct captured_main_args *context, int &python_script)
|
||||
|
||||
if (batch_flag)
|
||||
{
|
||||
+ int error_status = EXIT_FAILURE;
|
||||
+ int *exit_arg = ret == 0 ? &error_status : NULL;
|
||||
+
|
||||
/* We have hit the end of the batch file. */
|
||||
- quit_force (NULL, 0);
|
||||
+ quit_force (exit_arg, 0);
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
|
||||
--- a/gdb/testsuite/ChangeLog
|
||||
+++ b/gdb/testsuite/ChangeLog
|
||||
@@ -1,3 +1,10 @@
|
||||
+2018-08-16 Gary Benson <gbenson@redhat.com>
|
||||
+
|
||||
+ PR gdb/13000:
|
||||
+ * gdb.base/batch-exit-status.exp: New file.
|
||||
+ * gdb.base/batch-exit-status.good-commands: Likewise.
|
||||
+ * gdb.base/batch-exit-status.bad-commands: Likewise.
|
||||
+
|
||||
2018-07-11 Sergio Durigan Junior <sergiodj@redhat.com>
|
||||
Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
Paul Fertser <fercerpav@gmail.com>
|
||||
diff --git a/gdb/testsuite/gdb.base/batch-exit-status.bad-commands b/gdb/testsuite/gdb.base/batch-exit-status.bad-commands
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/batch-exit-status.bad-commands
|
||||
@@ -0,0 +1 @@
|
||||
+bork
|
||||
diff --git a/gdb/testsuite/gdb.base/batch-exit-status.exp b/gdb/testsuite/gdb.base/batch-exit-status.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/batch-exit-status.exp
|
||||
@@ -0,0 +1,63 @@
|
||||
+# Copyright (C) 2018 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+# Check that "gdb -batch" exits with appropriate status.
|
||||
+
|
||||
+standard_testfile
|
||||
+
|
||||
+set good_commands "$srcdir/$subdir/batch-exit-status.good-commands"
|
||||
+set bad_commands "$srcdir/$subdir/batch-exit-status.bad-commands"
|
||||
+
|
||||
+proc _test_exit_status {expect_status cmdline_opts} {
|
||||
+ global gdb_spawn_id
|
||||
+
|
||||
+ gdb_exit
|
||||
+ if {[gdb_spawn_with_cmdline_opts $cmdline_opts] != 0} {
|
||||
+ fail "spawn"
|
||||
+ return
|
||||
+ }
|
||||
+
|
||||
+ set result [wait -i $gdb_spawn_id]
|
||||
+ verbose $result
|
||||
+ gdb_assert { [lindex $result 2] == 0 }
|
||||
+ set actual_status [lindex $result 3]
|
||||
+ gdb_assert { $actual_status == $expect_status }
|
||||
+}
|
||||
+
|
||||
+proc test_exit_status {expect_status cmdline_opts} {
|
||||
+ with_test_prefix $cmdline_opts {
|
||||
+ _test_exit_status $expect_status $cmdline_opts
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+# gdb -batch with nothing to do should exit 0.
|
||||
+test_exit_status 0 "-batch"
|
||||
+
|
||||
+# Bad command-line options should cause exit 1.
|
||||
+test_exit_status 1 "-batch -jslkflsdjlkfjlksdjf"
|
||||
+
|
||||
+# gdb -batch with good commands should exit 0.
|
||||
+test_exit_status 0 "-batch -ex \"info source\""
|
||||
+test_exit_status 0 "-batch -x $good_commands"
|
||||
+
|
||||
+# gdb -batch with bad commands should exit 1.
|
||||
+test_exit_status 1 "-batch -ex \"set not-a-thing 4\""
|
||||
+test_exit_status 1 "-batch -x $bad_commands"
|
||||
+
|
||||
+# Success or failure of the last thing determines the exit code.
|
||||
+test_exit_status 0 "-batch -ex \"set not-a-thing 4\" -x $good_commands"
|
||||
+test_exit_status 0 "-batch -x $bad_commands -ex \"info source\""
|
||||
+test_exit_status 1 "-batch -x $good_commands -x $bad_commands"
|
||||
+test_exit_status 1 "-batch -x $good_commands -ex \"set not-a-thing 4\""
|
||||
diff --git a/gdb/testsuite/gdb.base/batch-exit-status.good-commands b/gdb/testsuite/gdb.base/batch-exit-status.good-commands
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/batch-exit-status.good-commands
|
||||
@@ -0,0 +1 @@
|
||||
+info mem
|
|
@ -1,65 +0,0 @@
|
|||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Gary Benson <gbenson@redhat.com>
|
||||
Date: Mon, 3 Sep 2018 16:14:55 +0100
|
||||
Subject: gdb-rhbz1491128-batch-mode-exit-status-2of2.patch
|
||||
|
||||
;; Fix for 'gdb in batch mode always exit with status 0' (Gary Benson)
|
||||
;; RHBZ #1491128
|
||||
|
||||
Fix batch exit status test failure on Fedora 28
|
||||
|
||||
This commit adds calls to remote_close and clear_gdb_spawn_id to
|
||||
gdb.base/batch-exit-status.exp, fixing failures reported by buildbot
|
||||
on Fedora 28 where gdb_spawn_id not being reset by the previous test
|
||||
caused default_gdb_spawn to return without spawning.
|
||||
|
||||
This commit also changes the test to use detect GDB's exit using
|
||||
gdb_test_multiple expecting 'eof', rather than using 'wait -i' alone.
|
||||
This means the testcase won't hang forever on failure as fixed in
|
||||
gdb.base/quit.exp by commit 15763a09d4ae ("Fix 'gdb.base/quit.exp
|
||||
hangs forever' if the test fails").
|
||||
|
||||
gdb/testsuite/ChangeLog:
|
||||
|
||||
* gdb.base/batch-exit-status.exp: Use gdb_test_multiple and expect
|
||||
'eof' before 'wait -i'. Use remote_close and clear_gdb_spawn_id.
|
||||
|
||||
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
|
||||
--- a/gdb/testsuite/ChangeLog
|
||||
+++ b/gdb/testsuite/ChangeLog
|
||||
@@ -1,3 +1,8 @@
|
||||
+2018-09-04 Gary Benson <gbenson@redhat.com>
|
||||
+
|
||||
+ * gdb.base/batch-exit-status.exp: Use gdb_test_multiple and expect
|
||||
+ 'eof' before 'wait -i'. Use remote_close and clear_gdb_spawn_id.
|
||||
+
|
||||
2018-08-16 Gary Benson <gbenson@redhat.com>
|
||||
|
||||
PR gdb/13000:
|
||||
diff --git a/gdb/testsuite/gdb.base/batch-exit-status.exp b/gdb/testsuite/gdb.base/batch-exit-status.exp
|
||||
--- a/gdb/testsuite/gdb.base/batch-exit-status.exp
|
||||
+++ b/gdb/testsuite/gdb.base/batch-exit-status.exp
|
||||
@@ -29,11 +29,18 @@ proc _test_exit_status {expect_status cmdline_opts} {
|
||||
return
|
||||
}
|
||||
|
||||
- set result [wait -i $gdb_spawn_id]
|
||||
- verbose $result
|
||||
- gdb_assert { [lindex $result 2] == 0 }
|
||||
- set actual_status [lindex $result 3]
|
||||
- gdb_assert { $actual_status == $expect_status }
|
||||
+ gdb_test_multiple "" "run til exit" {
|
||||
+ eof {
|
||||
+ set result [wait -i $gdb_spawn_id]
|
||||
+ verbose $result
|
||||
+
|
||||
+ gdb_assert { [lindex $result 2] == 0 }
|
||||
+ gdb_assert { [lindex $result 3] == $expect_status }
|
||||
+
|
||||
+ remote_close host
|
||||
+ clear_gdb_spawn_id
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
|
||||
proc test_exit_status {expect_status cmdline_opts} {
|
|
@ -1,746 +0,0 @@
|
|||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Sergio Durigan Junior <sergiodj@redhat.com>
|
||||
Date: Fri, 11 Jan 2019 10:52:17 -0500
|
||||
Subject:
|
||||
gdb-rhbz1560010-fix-assertion-symbol-language-dict-language-1of5.patch
|
||||
|
||||
;; Fix 'Assertion `SYMBOL_LANGUAGE (sym) == DICT_LANGUAGE (dict)->la_language' failed.'
|
||||
;; Keith Seitz, RHBZ#1560010.
|
||||
|
||||
gdb/23712: Introduce multidictionary's
|
||||
|
||||
gdb/23712 is a new manifestation of the now-infamous (at least to me)
|
||||
symtab/23010 assertion failure (DICT_LANGUAGE == SYMBOL_LANGAUGE).
|
||||
|
||||
An example of the problem (using test case from symtab/23010):
|
||||
|
||||
Reading symbols from /home/rdiez/rdiez/arduino/JtagDue/BuildOutput/JtagDue-obj-release/firmware.elf...done.
|
||||
(gdb) p SysTick_Handler
|
||||
dwarf2read.c:9715: internal-error: void dw2_add_symbol_to_list(symbol*, pending**): Assertion `(*listhead) == NULL || (SYMBOL_LANGUAGE ((*listhead)->symbol[0]) == SYMBOL_LANGUAGE (symbol))' failed.
|
||||
A problem internal to GDB has been detected,
|
||||
further debugging may prove unreliable.
|
||||
Quit this debugging session? (y or n)
|
||||
|
||||
This assertion was added specifically to catch this condition (of adding
|
||||
symbols of different languages to a single pending list).
|
||||
|
||||
The problems we're now seeing on systems utilizing DWARF debugging seem to
|
||||
be caused by the use of LTO, which adds a CU with an artificial DIE of
|
||||
language C99 which references DIEs in other CUs of language C++.
|
||||
|
||||
Thus, we create a dictionary containing symbols of C99 but end up
|
||||
stuffing C++ symbols into it, and the dw2_add_symbol_to_list triggers.
|
||||
|
||||
The approach taken here to fix this is to introduce multi-language
|
||||
dictionaries to "replace" the standard, single-language dictionaries
|
||||
used today.
|
||||
|
||||
Note to reviewers: This patch introduces some temporary functions to
|
||||
aide with review. This and other artifacts (such as "See dictionary.h"
|
||||
which appear incorrect) will all be valid at the end of the series.
|
||||
|
||||
This first patch introduces the new multidictionary and its API (which
|
||||
is, by design, identical to the old dictionary interface). It also
|
||||
mutates dict_create_hashed and dict_create_linear so that they take
|
||||
a std::vector instead of the usual struct pending linked list. This will
|
||||
be needed later on.
|
||||
|
||||
This patch does /not/ actually enable multidictionary's. That is left
|
||||
for a subsequent patch in the series.
|
||||
|
||||
I've done exhaustive performance testing with this approach, and I've
|
||||
attempted to minimize the overhead for the (overwhelmingly) most common
|
||||
one-language scenario.
|
||||
|
||||
On average, a -g3 -O0 GDB (the one we developers use) will see
|
||||
approximately a 4% slowdown when initially reading symbols. [I've
|
||||
tested only GDB and firefox with -readnow.] When using -O2, this
|
||||
difference shrinks to ~0.5%. Since a number of runs with these
|
||||
patches actually run /faster/ than unpatched GDB, I conclude that
|
||||
these tests have at least a 0.5% error margin.
|
||||
|
||||
On our own gdb.perf test suite, again, results appear to be pretty
|
||||
negligible. Differences to unpatched GDB range from -7.8% (yes,
|
||||
patched version is again faster than unpatched) to 27%. All tests
|
||||
lying outside "negligible," such as the 27% slowdown, involve a total
|
||||
run time of 0.0007 (or less) with smaller numbers of CUs/DSOs (usually 10
|
||||
or 100). In all cases, the follow-up tests with more CUs/DSOs is never
|
||||
more than 3% difference to the baseline, unpatched GDB.
|
||||
|
||||
In my opinion, these results are satisfactory.
|
||||
|
||||
gdb/ChangeLog:
|
||||
|
||||
PR gdb/23712
|
||||
PR symtab/23010
|
||||
* dictionary.c: Include unordered_map.
|
||||
(pending_to_vector): New function.
|
||||
(dict_create_hashed_1, dict_create_linear_1, dict_add_pending_1):
|
||||
Rewrite the non-"_1" functions to take vector instead
|
||||
of linked list.
|
||||
(dict_create_hashed, dict_create_linear, dict_add_pending): Use the
|
||||
"new" _1 versions of the same name.
|
||||
(multidictionary): Define.
|
||||
(std::hash<enum language): New definition.
|
||||
(collate_pending_symbols_by_language, mdict_create_hashed)
|
||||
(mdict_create_hashed_expandable, mdict_create_linear)
|
||||
(mdict_create_linear_expandable, mdict_free)
|
||||
(find_language_dictionary, create_new_language_dictionary)
|
||||
(mdict_add_symbol, mdict_add_pending, mdict_iterator_first)
|
||||
(mdict_iterator_next, mdict_iter_match_first, mdict_iter_match_next)
|
||||
(mdict_size, mdict_empty): New functions.
|
||||
* dictionary.h (mdict_iterator): Define.
|
||||
|
||||
diff --git a/gdb/dictionary.c b/gdb/dictionary.c
|
||||
--- a/gdb/dictionary.c
|
||||
+++ b/gdb/dictionary.c
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "buildsym.h"
|
||||
#include "dictionary.h"
|
||||
#include "safe-ctype.h"
|
||||
+#include <unordered_map>
|
||||
|
||||
/* This file implements dictionaries, which are tables that associate
|
||||
symbols to names. They are represented by an opaque type 'struct
|
||||
@@ -341,53 +342,66 @@ static void insert_symbol_hashed (struct dictionary *dict,
|
||||
|
||||
static void expand_hashtable (struct dictionary *dict);
|
||||
|
||||
+/* A function to convert a linked list into a vector. */
|
||||
+
|
||||
+static std::vector<symbol *>
|
||||
+pending_to_vector (const struct pending *symbol_list)
|
||||
+{
|
||||
+ std::vector<symbol *> symlist;
|
||||
+
|
||||
+ for (const struct pending *list_counter = symbol_list;
|
||||
+ list_counter != nullptr; list_counter = list_counter->next)
|
||||
+ {
|
||||
+ for (int i = list_counter->nsyms - 1; i >= 0; --i)
|
||||
+ symlist.push_back (list_counter->symbol[i]);
|
||||
+ }
|
||||
+
|
||||
+ return symlist;
|
||||
+}
|
||||
+
|
||||
/* The creation functions. */
|
||||
|
||||
-/* See dictionary.h. */
|
||||
+/* A function to transition dict_create_hashed to new API. */
|
||||
|
||||
-struct dictionary *
|
||||
-dict_create_hashed (struct obstack *obstack,
|
||||
- enum language language,
|
||||
- const struct pending *symbol_list)
|
||||
+static struct dictionary *
|
||||
+dict_create_hashed_1 (struct obstack *obstack,
|
||||
+ enum language language,
|
||||
+ const std::vector<symbol *> &symbol_list)
|
||||
{
|
||||
- struct dictionary *retval;
|
||||
- int nsyms = 0, nbuckets, i;
|
||||
- struct symbol **buckets;
|
||||
- const struct pending *list_counter;
|
||||
-
|
||||
- retval = XOBNEW (obstack, struct dictionary);
|
||||
+ /* Allocate the dictionary. */
|
||||
+ struct dictionary *retval = XOBNEW (obstack, struct dictionary);
|
||||
DICT_VECTOR (retval) = &dict_hashed_vector;
|
||||
DICT_LANGUAGE (retval) = language_def (language);
|
||||
|
||||
- /* Calculate the number of symbols, and allocate space for them. */
|
||||
- for (list_counter = symbol_list;
|
||||
- list_counter != NULL;
|
||||
- list_counter = list_counter->next)
|
||||
- {
|
||||
- nsyms += list_counter->nsyms;
|
||||
- }
|
||||
- nbuckets = DICT_HASHTABLE_SIZE (nsyms);
|
||||
+ /* Allocate space for symbols. */
|
||||
+ int nsyms = symbol_list.size ();
|
||||
+ int nbuckets = DICT_HASHTABLE_SIZE (nsyms);
|
||||
DICT_HASHED_NBUCKETS (retval) = nbuckets;
|
||||
- buckets = XOBNEWVEC (obstack, struct symbol *, nbuckets);
|
||||
+ struct symbol **buckets = XOBNEWVEC (obstack, struct symbol *, nbuckets);
|
||||
memset (buckets, 0, nbuckets * sizeof (struct symbol *));
|
||||
DICT_HASHED_BUCKETS (retval) = buckets;
|
||||
|
||||
/* Now fill the buckets. */
|
||||
- for (list_counter = symbol_list;
|
||||
- list_counter != NULL;
|
||||
- list_counter = list_counter->next)
|
||||
- {
|
||||
- for (i = list_counter->nsyms - 1; i >= 0; --i)
|
||||
- {
|
||||
- insert_symbol_hashed (retval, list_counter->symbol[i]);
|
||||
- }
|
||||
- }
|
||||
+ for (const auto &sym : symbol_list)
|
||||
+ insert_symbol_hashed (retval, sym);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
/* See dictionary.h. */
|
||||
|
||||
+struct dictionary *
|
||||
+dict_create_hashed (struct obstack *obstack,
|
||||
+ enum language language,
|
||||
+ const struct pending *symbol_list)
|
||||
+{
|
||||
+ std::vector<symbol *> symlist = pending_to_vector (symbol_list);
|
||||
+
|
||||
+ return dict_create_hashed_1 (obstack, language, symlist);
|
||||
+}
|
||||
+
|
||||
+/* See dictionary.h. */
|
||||
+
|
||||
extern struct dictionary *
|
||||
dict_create_hashed_expandable (enum language language)
|
||||
{
|
||||
@@ -403,52 +417,45 @@ dict_create_hashed_expandable (enum language language)
|
||||
return retval;
|
||||
}
|
||||
|
||||
-/* See dictionary.h. */
|
||||
+/* A function to transition dict_create_linear to new API. */
|
||||
|
||||
-struct dictionary *
|
||||
-dict_create_linear (struct obstack *obstack,
|
||||
- enum language language,
|
||||
- const struct pending *symbol_list)
|
||||
+static struct dictionary *
|
||||
+dict_create_linear_1 (struct obstack *obstack,
|
||||
+ enum language language,
|
||||
+ const std::vector<symbol *> &symbol_list)
|
||||
{
|
||||
- struct dictionary *retval;
|
||||
- int nsyms = 0, i, j;
|
||||
- struct symbol **syms;
|
||||
- const struct pending *list_counter;
|
||||
-
|
||||
- retval = XOBNEW (obstack, struct dictionary);
|
||||
+ struct dictionary *retval = XOBNEW (obstack, struct dictionary);
|
||||
DICT_VECTOR (retval) = &dict_linear_vector;
|
||||
DICT_LANGUAGE (retval) = language_def (language);
|
||||
|
||||
- /* Calculate the number of symbols, and allocate space for them. */
|
||||
- for (list_counter = symbol_list;
|
||||
- list_counter != NULL;
|
||||
- list_counter = list_counter->next)
|
||||
- {
|
||||
- nsyms += list_counter->nsyms;
|
||||
- }
|
||||
+ /* Allocate space for symbols. */
|
||||
+ int nsyms = symbol_list.size ();
|
||||
DICT_LINEAR_NSYMS (retval) = nsyms;
|
||||
- syms = XOBNEWVEC (obstack, struct symbol *, nsyms );
|
||||
+ struct symbol **syms = XOBNEWVEC (obstack, struct symbol *, nsyms);
|
||||
DICT_LINEAR_SYMS (retval) = syms;
|
||||
|
||||
- /* Now fill in the symbols. Start filling in from the back, so as
|
||||
- to preserve the original order of the symbols. */
|
||||
- for (list_counter = symbol_list, j = nsyms - 1;
|
||||
- list_counter != NULL;
|
||||
- list_counter = list_counter->next)
|
||||
- {
|
||||
- for (i = list_counter->nsyms - 1;
|
||||
- i >= 0;
|
||||
- --i, --j)
|
||||
- {
|
||||
- syms[j] = list_counter->symbol[i];
|
||||
- }
|
||||
- }
|
||||
+ /* Now fill in the symbols. */
|
||||
+ int idx = nsyms - 1;
|
||||
+ for (const auto &sym : symbol_list)
|
||||
+ syms[idx--] = sym;
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
/* See dictionary.h. */
|
||||
|
||||
+struct dictionary *
|
||||
+dict_create_linear (struct obstack *obstack,
|
||||
+ enum language language,
|
||||
+ const struct pending *symbol_list)
|
||||
+{
|
||||
+ std::vector<symbol *> symlist = pending_to_vector (symbol_list);
|
||||
+
|
||||
+ return dict_create_linear_1 (obstack, language, symlist);
|
||||
+}
|
||||
+
|
||||
+/* See dictionary.h. */
|
||||
+
|
||||
struct dictionary *
|
||||
dict_create_linear_expandable (enum language language)
|
||||
{
|
||||
@@ -483,20 +490,26 @@ dict_add_symbol (struct dictionary *dict, struct symbol *sym)
|
||||
(DICT_VECTOR (dict))->add_symbol (dict, sym);
|
||||
}
|
||||
|
||||
+/* A function to transition dict_add_pending to new API. */
|
||||
+
|
||||
+static void
|
||||
+dict_add_pending_1 (struct dictionary *dict,
|
||||
+ const std::vector<symbol *> &symbol_list)
|
||||
+{
|
||||
+ /* Preserve ordering by reversing the list. */
|
||||
+ for (auto sym = symbol_list.rbegin (); sym != symbol_list.rend (); ++sym)
|
||||
+ dict_add_symbol (dict, *sym);
|
||||
+}
|
||||
+
|
||||
/* Utility to add a list of symbols to a dictionary.
|
||||
DICT must be an expandable dictionary. */
|
||||
|
||||
void
|
||||
dict_add_pending (struct dictionary *dict, const struct pending *symbol_list)
|
||||
{
|
||||
- const struct pending *list;
|
||||
- int i;
|
||||
+ std::vector<symbol *> symlist = pending_to_vector (symbol_list);
|
||||
|
||||
- for (list = symbol_list; list != NULL; list = list->next)
|
||||
- {
|
||||
- for (i = 0; i < list->nsyms; ++i)
|
||||
- dict_add_symbol (dict, list->symbol[i]);
|
||||
- }
|
||||
+ dict_add_pending_1 (dict, symlist);
|
||||
}
|
||||
|
||||
/* Initialize ITERATOR to point at the first symbol in DICT, and
|
||||
@@ -929,3 +942,408 @@ add_symbol_linear_expandable (struct dictionary *dict,
|
||||
|
||||
DICT_LINEAR_SYM (dict, nsyms - 1) = sym;
|
||||
}
|
||||
+
|
||||
+/* Multi-language dictionary support. */
|
||||
+
|
||||
+/* The structure describing a multi-language dictionary. */
|
||||
+
|
||||
+struct multidictionary
|
||||
+{
|
||||
+ /* An array of dictionaries, one per language. All dictionaries
|
||||
+ must be of the same type. This should be free'd for expandable
|
||||
+ dictionary types. */
|
||||
+ struct dictionary **dictionaries;
|
||||
+
|
||||
+ /* The number of language dictionaries currently allocated.
|
||||
+ Only used for expandable dictionaries. */
|
||||
+ unsigned short n_allocated_dictionaries;
|
||||
+};
|
||||
+
|
||||
+/* A hasher for enum language. Injecting this into std is a convenience
|
||||
+ when using unordered_map with C++11. */
|
||||
+
|
||||
+namespace std
|
||||
+{
|
||||
+ template<> struct hash<enum language>
|
||||
+ {
|
||||
+ typedef enum language argument_type;
|
||||
+ typedef std::size_t result_type;
|
||||
+
|
||||
+ result_type operator() (const argument_type &l) const noexcept
|
||||
+ {
|
||||
+ return static_cast<result_type> (l);
|
||||
+ }
|
||||
+ };
|
||||
+} /* namespace std */
|
||||
+
|
||||
+/* A helper function to collate symbols on the pending list by language. */
|
||||
+
|
||||
+static std::unordered_map<enum language, std::vector<symbol *>>
|
||||
+collate_pending_symbols_by_language (const struct pending *symbol_list)
|
||||
+{
|
||||
+ std::unordered_map<enum language, std::vector<symbol *>> nsyms;
|
||||
+
|
||||
+ for (const struct pending *list_counter = symbol_list;
|
||||
+ list_counter != nullptr; list_counter = list_counter->next)
|
||||
+ {
|
||||
+ for (int i = list_counter->nsyms - 1; i >= 0; --i)
|
||||
+ {
|
||||
+ enum language language = SYMBOL_LANGUAGE (list_counter->symbol[i]);
|
||||
+ nsyms[language].push_back (list_counter->symbol[i]);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return nsyms;
|
||||
+}
|
||||
+
|
||||
+/* See dictionary.h. */
|
||||
+
|
||||
+struct multidictionary *
|
||||
+mdict_create_hashed (struct obstack *obstack,
|
||||
+ const struct pending *symbol_list)
|
||||
+{
|
||||
+ struct multidictionary *retval
|
||||
+ = XOBNEW (obstack, struct multidictionary);
|
||||
+ std::unordered_map<enum language, std::vector<symbol *>> nsyms
|
||||
+ = collate_pending_symbols_by_language (symbol_list);
|
||||
+
|
||||
+ /* Loop over all languages and create/populate dictionaries. */
|
||||
+ retval->dictionaries
|
||||
+ = XOBNEWVEC (obstack, struct dictionary *, nsyms.size ());
|
||||
+ retval->n_allocated_dictionaries = nsyms.size ();
|
||||
+
|
||||
+ int idx = 0;
|
||||
+ for (const auto &pair : nsyms)
|
||||
+ {
|
||||
+ enum language language = pair.first;
|
||||
+ std::vector<symbol *> symlist = pair.second;
|
||||
+
|
||||
+ retval->dictionaries[idx++]
|
||||
+ = dict_create_hashed_1 (obstack, language, symlist);
|
||||
+ }
|
||||
+
|
||||
+ return retval;
|
||||
+}
|
||||
+
|
||||
+/* See dictionary.h. */
|
||||
+
|
||||
+struct multidictionary *
|
||||
+mdict_create_hashed_expandable (enum language language)
|
||||
+{
|
||||
+ struct multidictionary *retval = XNEW (struct multidictionary);
|
||||
+
|
||||
+ /* We have no symbol list to populate, but we create an empty
|
||||
+ dictionary of the requested language to populate later. */
|
||||
+ retval->n_allocated_dictionaries = 1;
|
||||
+ retval->dictionaries = XNEW (struct dictionary *);
|
||||
+ retval->dictionaries[0] = dict_create_hashed_expandable (language);
|
||||
+
|
||||
+ return retval;
|
||||
+}
|
||||
+
|
||||
+/* See dictionary.h. */
|
||||
+
|
||||
+struct multidictionary *
|
||||
+mdict_create_linear (struct obstack *obstack,
|
||||
+ const struct pending *symbol_list)
|
||||
+{
|
||||
+ struct multidictionary *retval
|
||||
+ = XOBNEW (obstack, struct multidictionary);
|
||||
+ std::unordered_map<enum language, std::vector<symbol *>> nsyms
|
||||
+ = collate_pending_symbols_by_language (symbol_list);
|
||||
+
|
||||
+ /* Loop over all languages and create/populate dictionaries. */
|
||||
+ retval->dictionaries
|
||||
+ = XOBNEWVEC (obstack, struct dictionary *, nsyms.size ());
|
||||
+ retval->n_allocated_dictionaries = nsyms.size ();
|
||||
+
|
||||
+ int idx = 0;
|
||||
+ for (const auto &pair : nsyms)
|
||||
+ {
|
||||
+ enum language language = pair.first;
|
||||
+ std::vector<symbol *> symlist = pair.second;
|
||||
+
|
||||
+ retval->dictionaries[idx++]
|
||||
+ = dict_create_linear_1 (obstack, language, symlist);
|
||||
+ }
|
||||
+
|
||||
+ return retval;
|
||||
+}
|
||||
+
|
||||
+/* See dictionary.h. */
|
||||
+
|
||||
+struct multidictionary *
|
||||
+mdict_create_linear_expandable (enum language language)
|
||||
+{
|
||||
+ struct multidictionary *retval = XNEW (struct multidictionary);
|
||||
+
|
||||
+ /* We have no symbol list to populate, but we create an empty
|
||||
+ dictionary to populate later. */
|
||||
+ retval->n_allocated_dictionaries = 1;
|
||||
+ retval->dictionaries = XNEW (struct dictionary *);
|
||||
+ retval->dictionaries[0] = dict_create_linear_expandable (language);
|
||||
+
|
||||
+ return retval;
|
||||
+}
|
||||
+
|
||||
+/* See dictionary.h. */
|
||||
+
|
||||
+void
|
||||
+mdict_free (struct multidictionary *mdict)
|
||||
+{
|
||||
+ /* Grab the type of dictionary being used. */
|
||||
+ enum dict_type type = mdict->dictionaries[0]->vector->type;
|
||||
+
|
||||
+ /* Loop over all dictionaries and free them. */
|
||||
+ for (unsigned short idx = 0; idx < mdict->n_allocated_dictionaries; ++idx)
|
||||
+ dict_free (mdict->dictionaries[idx]);
|
||||
+
|
||||
+ /* Free the dictionary list, if needed. */
|
||||
+ switch (type)
|
||||
+ {
|
||||
+ case DICT_HASHED:
|
||||
+ case DICT_LINEAR:
|
||||
+ /* Memory was allocated on an obstack when created. */
|
||||
+ break;
|
||||
+
|
||||
+ case DICT_HASHED_EXPANDABLE:
|
||||
+ case DICT_LINEAR_EXPANDABLE:
|
||||
+ xfree (mdict->dictionaries);
|
||||
+ break;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+/* Helper function to find the dictionary associated with LANGUAGE
|
||||
+ or NULL if there is no dictionary of that language. */
|
||||
+
|
||||
+static struct dictionary *
|
||||
+find_language_dictionary (const struct multidictionary *mdict,
|
||||
+ enum language language)
|
||||
+{
|
||||
+ for (unsigned short idx = 0; idx < mdict->n_allocated_dictionaries; ++idx)
|
||||
+ {
|
||||
+ if (DICT_LANGUAGE (mdict->dictionaries[idx])->la_language == language)
|
||||
+ return mdict->dictionaries[idx];
|
||||
+ }
|
||||
+
|
||||
+ return nullptr;
|
||||
+}
|
||||
+
|
||||
+/* Create a new language dictionary for LANGUAGE and add it to the
|
||||
+ multidictionary MDICT's list of dictionaries. If MDICT is not
|
||||
+ based on expandable dictionaries, this function throws an
|
||||
+ internal error. */
|
||||
+
|
||||
+static struct dictionary *
|
||||
+create_new_language_dictionary (struct multidictionary *mdict,
|
||||
+ enum language language)
|
||||
+{
|
||||
+ struct dictionary *retval = nullptr;
|
||||
+
|
||||
+ /* We use the first dictionary entry to decide what create function
|
||||
+ to call. Not optimal but sufficient. */
|
||||
+ gdb_assert (mdict->dictionaries[0] != nullptr);
|
||||
+ switch (mdict->dictionaries[0]->vector->type)
|
||||
+ {
|
||||
+ case DICT_HASHED:
|
||||
+ case DICT_LINEAR:
|
||||
+ internal_error (__FILE__, __LINE__,
|
||||
+ _("create_new_language_dictionary: attempted to expand "
|
||||
+ "non-expandable multidictionary"));
|
||||
+
|
||||
+ case DICT_HASHED_EXPANDABLE:
|
||||
+ retval = dict_create_hashed_expandable (language);
|
||||
+ break;
|
||||
+
|
||||
+ case DICT_LINEAR_EXPANDABLE:
|
||||
+ retval = dict_create_linear_expandable (language);
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ /* Grow the dictionary vector and save the new dictionary. */
|
||||
+ mdict->dictionaries
|
||||
+ = (struct dictionary **) xrealloc (mdict->dictionaries,
|
||||
+ (++mdict->n_allocated_dictionaries
|
||||
+ * sizeof (struct dictionary *)));
|
||||
+ mdict->dictionaries[mdict->n_allocated_dictionaries - 1] = retval;
|
||||
+
|
||||
+ return retval;
|
||||
+}
|
||||
+
|
||||
+/* See dictionary.h. */
|
||||
+
|
||||
+void
|
||||
+mdict_add_symbol (struct multidictionary *mdict, struct symbol *sym)
|
||||
+{
|
||||
+ struct dictionary *dict
|
||||
+ = find_language_dictionary (mdict, SYMBOL_LANGUAGE (sym));
|
||||
+
|
||||
+ if (dict == nullptr)
|
||||
+ {
|
||||
+ /* SYM is of a new language that we haven't previously seen.
|
||||
+ Create a new dictionary for it. */
|
||||
+ dict = create_new_language_dictionary (mdict, SYMBOL_LANGUAGE (sym));
|
||||
+ }
|
||||
+
|
||||
+ dict_add_symbol (dict, sym);
|
||||
+}
|
||||
+
|
||||
+/* See dictionary.h. */
|
||||
+
|
||||
+void
|
||||
+mdict_add_pending (struct multidictionary *mdict,
|
||||
+ const struct pending *symbol_list)
|
||||
+{
|
||||
+ std::unordered_map<enum language, std::vector<symbol *>> nsyms
|
||||
+ = collate_pending_symbols_by_language (symbol_list);
|
||||
+
|
||||
+ for (const auto &pair : nsyms)
|
||||
+ {
|
||||
+ enum language language = pair.first;
|
||||
+ std::vector<symbol *> symlist = pair.second;
|
||||
+ struct dictionary *dict = find_language_dictionary (mdict, language);
|
||||
+
|
||||
+ if (dict == nullptr)
|
||||
+ {
|
||||
+ /* The language was not previously seen. Create a new dictionary
|
||||
+ for it. */
|
||||
+ dict = create_new_language_dictionary (mdict, language);
|
||||
+ }
|
||||
+
|
||||
+ dict_add_pending_1 (dict, symlist);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+/* See dictionary.h. */
|
||||
+
|
||||
+struct symbol *
|
||||
+mdict_iterator_first (const multidictionary *mdict,
|
||||
+ struct mdict_iterator *miterator)
|
||||
+{
|
||||
+ miterator->mdict = mdict;
|
||||
+ miterator->current_idx = 0;
|
||||
+
|
||||
+ for (unsigned short idx = miterator->current_idx;
|
||||
+ idx < mdict->n_allocated_dictionaries; ++idx)
|
||||
+ {
|
||||
+ struct symbol *result
|
||||
+ = dict_iterator_first (mdict->dictionaries[idx], &miterator->iterator);
|
||||
+
|
||||
+ if (result != nullptr)
|
||||
+ {
|
||||
+ miterator->current_idx = idx;
|
||||
+ return result;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return nullptr;
|
||||
+}
|
||||
+
|
||||
+/* See dictionary.h. */
|
||||
+
|
||||
+struct symbol *
|
||||
+mdict_iterator_next (struct mdict_iterator *miterator)
|
||||
+{
|
||||
+ struct symbol *result = dict_iterator_next (&miterator->iterator);
|
||||
+
|
||||
+ if (result != nullptr)
|
||||
+ return result;
|
||||
+
|
||||
+ /* The current dictionary had no matches -- move to the next
|
||||
+ dictionary, if any. */
|
||||
+ for (unsigned short idx = ++miterator->current_idx;
|
||||
+ idx < miterator->mdict->n_allocated_dictionaries; ++idx)
|
||||
+ {
|
||||
+ result
|
||||
+ = dict_iterator_first (miterator->mdict->dictionaries[idx],
|
||||
+ &miterator->iterator);
|
||||
+ if (result != nullptr)
|
||||
+ {
|
||||
+ miterator->current_idx = idx;
|
||||
+ return result;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return nullptr;
|
||||
+}
|
||||
+
|
||||
+/* See dictionary.h. */
|
||||
+
|
||||
+struct symbol *
|
||||
+mdict_iter_match_first (const struct multidictionary *mdict,
|
||||
+ const lookup_name_info &name,
|
||||
+ struct mdict_iterator *miterator)
|
||||
+{
|
||||
+ miterator->mdict = mdict;
|
||||
+ miterator->current_idx = 0;
|
||||
+
|
||||
+ for (unsigned short idx = miterator->current_idx;
|
||||
+ idx < mdict->n_allocated_dictionaries; ++idx)
|
||||
+ {
|
||||
+ struct symbol *result
|
||||
+ = dict_iter_match_first (mdict->dictionaries[idx], name,
|
||||
+ &miterator->iterator);
|
||||
+
|
||||
+ if (result != nullptr)
|
||||
+ return result;
|
||||
+ }
|
||||
+
|
||||
+ return nullptr;
|
||||
+}
|
||||
+
|
||||
+/* See dictionary.h. */
|
||||
+
|
||||
+struct symbol *
|
||||
+mdict_iter_match_next (const lookup_name_info &name,
|
||||
+ struct mdict_iterator *miterator)
|
||||
+{
|
||||
+ /* Search the current dictionary. */
|
||||
+ struct symbol *result = dict_iter_match_next (name, &miterator->iterator);
|
||||
+
|
||||
+ if (result != nullptr)
|
||||
+ return result;
|
||||
+
|
||||
+ /* The current dictionary had no matches -- move to the next
|
||||
+ dictionary, if any. */
|
||||
+ for (unsigned short idx = ++miterator->current_idx;
|
||||
+ idx < miterator->mdict->n_allocated_dictionaries; ++idx)
|
||||
+ {
|
||||
+ result
|
||||
+ = dict_iter_match_first (miterator->mdict->dictionaries[idx],
|
||||
+ name, &miterator->iterator);
|
||||
+ if (result != nullptr)
|
||||
+ {
|
||||
+ miterator->current_idx = idx;
|
||||
+ return result;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return nullptr;
|
||||
+}
|
||||
+
|
||||
+/* See dictionary.h. */
|
||||
+
|
||||
+int
|
||||
+mdict_size (const struct multidictionary *mdict)
|
||||
+{
|
||||
+ int size = 0;
|
||||
+
|
||||
+ for (unsigned short idx = 0; idx < mdict->n_allocated_dictionaries; ++idx)
|
||||
+ size += dict_size (mdict->dictionaries[idx]);
|
||||
+
|
||||
+ return size;
|
||||
+}
|
||||
+
|
||||
+/* See dictionary.h. */
|
||||
+
|
||||
+bool
|
||||
+mdict_empty (const struct multidictionary *mdict)
|
||||
+{
|
||||
+ for (unsigned short idx = 0; idx < mdict->n_allocated_dictionaries; ++idx)
|
||||
+ {
|
||||
+ if (!dict_empty (mdict->dictionaries[idx]))
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ return true;
|
||||
+}
|
||||
diff --git a/gdb/dictionary.h b/gdb/dictionary.h
|
||||
--- a/gdb/dictionary.h
|
||||
+++ b/gdb/dictionary.h
|
||||
@@ -113,6 +113,21 @@ struct dict_iterator
|
||||
struct symbol *current;
|
||||
};
|
||||
|
||||
+/* The multi-language dictionary iterator. Like dict_iterator above,
|
||||
+ these contents should be considered private. */
|
||||
+
|
||||
+struct mdict_iterator
|
||||
+{
|
||||
+ /* The multidictionary with whcih this iterator is associated. */
|
||||
+ const struct multidictionary *mdict;
|
||||
+
|
||||
+ /* The iterator used to iterate through individual dictionaries. */
|
||||
+ struct dict_iterator iterator;
|
||||
+
|
||||
+ /* The current index of the dictionary being iterated over. */
|
||||
+ unsigned short current_idx;
|
||||
+};
|
||||
+
|
||||
/* Initialize ITERATOR to point at the first symbol in DICT, and
|
||||
return that first symbol, or NULL if DICT is empty. */
|
||||
|
|
@ -1,644 +0,0 @@
|
|||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Sergio Durigan Junior <sergiodj@redhat.com>
|
||||
Date: Fri, 11 Jan 2019 11:25:11 -0500
|
||||
Subject:
|
||||
gdb-rhbz1560010-fix-assertion-symbol-language-dict-language-2of5.patch
|
||||
|
||||
;; Fix 'Assertion `SYMBOL_LANGUAGE (sym) == DICT_LANGUAGE (dict)->la_language' failed.'
|
||||
;; Keith Seitz, RHBZ#1560010.
|
||||
|
||||
gdb/23712: Use new multidictionary API
|
||||
|
||||
This patch builds on the previous by enabling the `new' multidictionary
|
||||
API. A lot of the hunks are simply textual replacements of "dict_"
|
||||
with "mdict_" and similar transformations.
|
||||
|
||||
A word of warning, even with the use of multidictionaries, the code
|
||||
still does not satisfactorily fix the reported problems with gdb/23712
|
||||
(or gdb/23010). We still have additional changes to make before that
|
||||
happens.
|
||||
|
||||
gdb/ChangeLog:
|
||||
|
||||
PR gdb/23712
|
||||
PR symtab/23010
|
||||
* dictionary.h (struct dictionary): Replace declaration with
|
||||
multidictionary.
|
||||
(dict_create_hashed, dict_create_hashed_expandable)
|
||||
(dict_create_linear, dict_create_linear_expandable)
|
||||
(dict_free, dict_add_symbol, dict_add_pending, dict_empty)
|
||||
(dict_iterator_first, dict_iterator_next, dict_iter_match_first)
|
||||
(dict_iter_match_next, dict_size): Rename to "mdict_" versions
|
||||
taking multidictionary argument.
|
||||
[ALL_DICT_SYMBOLS]: Update for multidictionary.
|
||||
* block.h (struct block) <dict>: Change to multidictionary
|
||||
and rename `multidict'.
|
||||
* block.c, buildsym.c, jit.c, mdebugread.c, objfiles.c,
|
||||
symmisc.c: Update all dictionary references to multidictionary.
|
||||
|
||||
diff --git a/gdb/block.c b/gdb/block.c
|
||||
--- a/gdb/block.c
|
||||
+++ b/gdb/block.c
|
||||
@@ -387,9 +387,9 @@ block_global_block (const struct block *block)
|
||||
zero/NULL. This is useful for creating "dummy" blocks that don't
|
||||
correspond to actual source files.
|
||||
|
||||
- Warning: it sets the block's BLOCK_DICT to NULL, which isn't a
|
||||
+ Warning: it sets the block's BLOCK_MULTIDICT to NULL, which isn't a
|
||||
valid value. If you really don't want the block to have a
|
||||
- dictionary, then you should subsequently set its BLOCK_DICT to
|
||||
+ dictionary, then you should subsequently set its BLOCK_MULTIDICT to
|
||||
dict_create_linear (obstack, NULL). */
|
||||
|
||||
struct block *
|
||||
@@ -544,10 +544,11 @@ block_iterator_step (struct block_iterator *iterator, int first)
|
||||
|
||||
block = BLOCKVECTOR_BLOCK (COMPUNIT_BLOCKVECTOR (cust),
|
||||
iterator->which);
|
||||
- sym = dict_iterator_first (BLOCK_DICT (block), &iterator->dict_iter);
|
||||
+ sym = mdict_iterator_first (BLOCK_MULTIDICT (block),
|
||||
+ &iterator->mdict_iter);
|
||||
}
|
||||
else
|
||||
- sym = dict_iterator_next (&iterator->dict_iter);
|
||||
+ sym = mdict_iterator_next (&iterator->mdict_iter);
|
||||
|
||||
if (sym != NULL)
|
||||
return sym;
|
||||
@@ -569,7 +570,7 @@ block_iterator_first (const struct block *block,
|
||||
initialize_block_iterator (block, iterator);
|
||||
|
||||
if (iterator->which == FIRST_LOCAL_BLOCK)
|
||||
- return dict_iterator_first (block->dict, &iterator->dict_iter);
|
||||
+ return mdict_iterator_first (block->multidict, &iterator->mdict_iter);
|
||||
|
||||
return block_iterator_step (iterator, 1);
|
||||
}
|
||||
@@ -580,7 +581,7 @@ struct symbol *
|
||||
block_iterator_next (struct block_iterator *iterator)
|
||||
{
|
||||
if (iterator->which == FIRST_LOCAL_BLOCK)
|
||||
- return dict_iterator_next (&iterator->dict_iter);
|
||||
+ return mdict_iterator_next (&iterator->mdict_iter);
|
||||
|
||||
return block_iterator_step (iterator, 0);
|
||||
}
|
||||
@@ -612,11 +613,11 @@ block_iter_match_step (struct block_iterator *iterator,
|
||||
|
||||
block = BLOCKVECTOR_BLOCK (COMPUNIT_BLOCKVECTOR (cust),
|
||||
iterator->which);
|
||||
- sym = dict_iter_match_first (BLOCK_DICT (block), name,
|
||||
- &iterator->dict_iter);
|
||||
+ sym = mdict_iter_match_first (BLOCK_MULTIDICT (block), name,
|
||||
+ &iterator->mdict_iter);
|
||||
}
|
||||
else
|
||||
- sym = dict_iter_match_next (name, &iterator->dict_iter);
|
||||
+ sym = mdict_iter_match_next (name, &iterator->mdict_iter);
|
||||
|
||||
if (sym != NULL)
|
||||
return sym;
|
||||
@@ -639,7 +640,8 @@ block_iter_match_first (const struct block *block,
|
||||
initialize_block_iterator (block, iterator);
|
||||
|
||||
if (iterator->which == FIRST_LOCAL_BLOCK)
|
||||
- return dict_iter_match_first (block->dict, name, &iterator->dict_iter);
|
||||
+ return mdict_iter_match_first (block->multidict, name,
|
||||
+ &iterator->mdict_iter);
|
||||
|
||||
return block_iter_match_step (iterator, name, 1);
|
||||
}
|
||||
@@ -651,7 +653,7 @@ block_iter_match_next (const lookup_name_info &name,
|
||||
struct block_iterator *iterator)
|
||||
{
|
||||
if (iterator->which == FIRST_LOCAL_BLOCK)
|
||||
- return dict_iter_match_next (name, &iterator->dict_iter);
|
||||
+ return mdict_iter_match_next (name, &iterator->mdict_iter);
|
||||
|
||||
return block_iter_match_step (iterator, name, 0);
|
||||
}
|
||||
@@ -731,7 +733,7 @@ block_lookup_symbol_primary (const struct block *block, const char *name,
|
||||
const domain_enum domain)
|
||||
{
|
||||
struct symbol *sym, *other;
|
||||
- struct dict_iterator dict_iter;
|
||||
+ struct mdict_iterator mdict_iter;
|
||||
|
||||
lookup_name_info lookup_name (name, symbol_name_match_type::FULL);
|
||||
|
||||
@@ -740,9 +742,10 @@ block_lookup_symbol_primary (const struct block *block, const char *name,
|
||||
|| BLOCK_SUPERBLOCK (BLOCK_SUPERBLOCK (block)) == NULL);
|
||||
|
||||
other = NULL;
|
||||
- for (sym = dict_iter_match_first (block->dict, lookup_name, &dict_iter);
|
||||
+ for (sym
|
||||
+ = mdict_iter_match_first (block->multidict, lookup_name, &mdict_iter);
|
||||
sym != NULL;
|
||||
- sym = dict_iter_match_next (lookup_name, &dict_iter))
|
||||
+ sym = mdict_iter_match_next (lookup_name, &mdict_iter))
|
||||
{
|
||||
if (SYMBOL_DOMAIN (sym) == domain)
|
||||
return sym;
|
||||
diff --git a/gdb/block.h b/gdb/block.h
|
||||
--- a/gdb/block.h
|
||||
+++ b/gdb/block.h
|
||||
@@ -111,7 +111,7 @@ struct block
|
||||
|
||||
/* This is used to store the symbols in the block. */
|
||||
|
||||
- struct dictionary *dict;
|
||||
+ struct multidictionary *multidict;
|
||||
|
||||
/* Contains information about namespace-related info relevant to this block:
|
||||
using directives and the current namespace scope. */
|
||||
@@ -143,7 +143,7 @@ struct global_block
|
||||
#define BLOCK_END(bl) (bl)->endaddr
|
||||
#define BLOCK_FUNCTION(bl) (bl)->function
|
||||
#define BLOCK_SUPERBLOCK(bl) (bl)->superblock
|
||||
-#define BLOCK_DICT(bl) (bl)->dict
|
||||
+#define BLOCK_MULTIDICT(bl) (bl)->multidict
|
||||
#define BLOCK_NAMESPACE(bl) (bl)->namespace_info
|
||||
|
||||
/* Accessor for ranges field within block BL. */
|
||||
@@ -298,9 +298,9 @@ struct block_iterator
|
||||
|
||||
enum block_enum which;
|
||||
|
||||
- /* The underlying dictionary iterator. */
|
||||
+ /* The underlying multidictionary iterator. */
|
||||
|
||||
- struct dict_iterator dict_iter;
|
||||
+ struct mdict_iterator mdict_iter;
|
||||
};
|
||||
|
||||
/* Initialize ITERATOR to point at the first symbol in BLOCK, and
|
||||
diff --git a/gdb/buildsym.c b/gdb/buildsym.c
|
||||
--- a/gdb/buildsym.c
|
||||
+++ b/gdb/buildsym.c
|
||||
@@ -349,23 +349,21 @@ finish_block_internal (struct symbol *symbol,
|
||||
|
||||
if (symbol)
|
||||
{
|
||||
- BLOCK_DICT (block)
|
||||
- = dict_create_linear (&objfile->objfile_obstack,
|
||||
- buildsym_compunit->language, *listhead);
|
||||
+ BLOCK_MULTIDICT (block)
|
||||
+ = mdict_create_linear (&objfile->objfile_obstack, *listhead);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (expandable)
|
||||
{
|
||||
- BLOCK_DICT (block)
|
||||
- = dict_create_hashed_expandable (buildsym_compunit->language);
|
||||
- dict_add_pending (BLOCK_DICT (block), *listhead);
|
||||
+ BLOCK_MULTIDICT (block)
|
||||
+ = mdict_create_hashed_expandable (buildsym_compunit->language);
|
||||
+ mdict_add_pending (BLOCK_MULTIDICT (block), *listhead);
|
||||
}
|
||||
else
|
||||
{
|
||||
- BLOCK_DICT (block) =
|
||||
- dict_create_hashed (&objfile->objfile_obstack,
|
||||
- buildsym_compunit->language, *listhead);
|
||||
+ BLOCK_MULTIDICT (block) =
|
||||
+ mdict_create_hashed (&objfile->objfile_obstack, *listhead);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -377,7 +375,7 @@ finish_block_internal (struct symbol *symbol,
|
||||
if (symbol)
|
||||
{
|
||||
struct type *ftype = SYMBOL_TYPE (symbol);
|
||||
- struct dict_iterator iter;
|
||||
+ struct mdict_iterator miter;
|
||||
SYMBOL_BLOCK_VALUE (symbol) = block;
|
||||
BLOCK_FUNCTION (block) = symbol;
|
||||
|
||||
@@ -391,7 +389,7 @@ finish_block_internal (struct symbol *symbol,
|
||||
|
||||
/* Here we want to directly access the dictionary, because
|
||||
we haven't fully initialized the block yet. */
|
||||
- ALL_DICT_SYMBOLS (BLOCK_DICT (block), iter, sym)
|
||||
+ ALL_DICT_SYMBOLS (BLOCK_MULTIDICT (block), miter, sym)
|
||||
{
|
||||
if (SYMBOL_IS_ARGUMENT (sym))
|
||||
nparams++;
|
||||
@@ -405,7 +403,7 @@ finish_block_internal (struct symbol *symbol,
|
||||
iparams = 0;
|
||||
/* Here we want to directly access the dictionary, because
|
||||
we haven't fully initialized the block yet. */
|
||||
- ALL_DICT_SYMBOLS (BLOCK_DICT (block), iter, sym)
|
||||
+ ALL_DICT_SYMBOLS (BLOCK_MULTIDICT (block), miter, sym)
|
||||
{
|
||||
if (iparams == nparams)
|
||||
break;
|
||||
@@ -1448,7 +1446,7 @@ end_symtab_with_blockvector (struct block *static_block,
|
||||
{
|
||||
struct block *block = BLOCKVECTOR_BLOCK (blockvector, block_i);
|
||||
struct symbol *sym;
|
||||
- struct dict_iterator iter;
|
||||
+ struct mdict_iterator miter;
|
||||
|
||||
/* Inlined functions may have symbols not in the global or
|
||||
static symbol lists. */
|
||||
@@ -1459,7 +1457,7 @@ end_symtab_with_blockvector (struct block *static_block,
|
||||
/* Note that we only want to fix up symbols from the local
|
||||
blocks, not blocks coming from included symtabs. That is why
|
||||
we use ALL_DICT_SYMBOLS here and not ALL_BLOCK_SYMBOLS. */
|
||||
- ALL_DICT_SYMBOLS (BLOCK_DICT (block), iter, sym)
|
||||
+ ALL_DICT_SYMBOLS (BLOCK_MULTIDICT (block), miter, sym)
|
||||
if (symbol_symtab (sym) == NULL)
|
||||
symbol_set_symtab (sym, symtab);
|
||||
}
|
||||
@@ -1598,7 +1596,7 @@ augment_type_symtab (void)
|
||||
to the primary symtab. */
|
||||
set_missing_symtab (file_symbols, cust);
|
||||
|
||||
- dict_add_pending (BLOCK_DICT (block), file_symbols);
|
||||
+ mdict_add_pending (BLOCK_MULTIDICT (block), file_symbols);
|
||||
}
|
||||
|
||||
if (global_symbols != NULL)
|
||||
@@ -1609,7 +1607,7 @@ augment_type_symtab (void)
|
||||
to the primary symtab. */
|
||||
set_missing_symtab (global_symbols, cust);
|
||||
|
||||
- dict_add_pending (BLOCK_DICT (block), global_symbols);
|
||||
+ mdict_add_pending (BLOCK_MULTIDICT (block), global_symbols);
|
||||
}
|
||||
|
||||
reset_symtab_globals ();
|
||||
diff --git a/gdb/dictionary.h b/gdb/dictionary.h
|
||||
--- a/gdb/dictionary.h
|
||||
+++ b/gdb/dictionary.h
|
||||
@@ -25,10 +25,10 @@
|
||||
|
||||
#include "symfile.h"
|
||||
|
||||
-/* An opaque type for dictionaries; only dictionary.c should know
|
||||
- about its innards. */
|
||||
+/* An opaque type for multi-language dictionaries; only dictionary.c should
|
||||
+ know about its innards. */
|
||||
|
||||
-struct dictionary;
|
||||
+struct multidictionary;
|
||||
|
||||
/* Other types needed for declarations. */
|
||||
|
||||
@@ -38,65 +38,64 @@ struct pending;
|
||||
struct language_defn;
|
||||
|
||||
/* The creation functions for various implementations of
|
||||
- dictionaries. */
|
||||
+ multi-language dictionaries. */
|
||||
|
||||
-/* Create a dictionary of symbols of language LANGUAGE implemented via
|
||||
+/* Create a multi-language dictionary of symbols implemented via
|
||||
a fixed-size hashtable. All memory it uses is allocated on
|
||||
OBSTACK; the environment is initialized from SYMBOL_LIST. */
|
||||
|
||||
-extern struct dictionary *dict_create_hashed (struct obstack *obstack,
|
||||
- enum language language,
|
||||
- const struct pending
|
||||
- *symbol_list);
|
||||
+extern struct multidictionary *
|
||||
+ mdict_create_hashed (struct obstack *obstack,
|
||||
+ const struct pending *symbol_list);
|
||||
|
||||
-/* Create a dictionary of symbols of language LANGUAGE, implemented
|
||||
- via a hashtable that grows as necessary. The dictionary is
|
||||
- initially empty; to add symbols to it, call dict_add_symbol().
|
||||
- Call dict_free() when you're done with it. */
|
||||
+/* Create a multi-language dictionary of symbols, implemented
|
||||
+ via a hashtable that grows as necessary. The initial dictionary of
|
||||
+ LANGUAGE is empty; to add symbols to it, call mdict_add_symbol().
|
||||
+ Call mdict_free() when you're done with it. */
|
||||
|
||||
-extern struct dictionary *
|
||||
- dict_create_hashed_expandable (enum language language);
|
||||
+extern struct multidictionary *
|
||||
+ mdict_create_hashed_expandable (enum language language);
|
||||
|
||||
-/* Create a dictionary of symbols of language LANGUAGE, implemented
|
||||
+/* Create a multi-language dictionary of symbols, implemented
|
||||
via a fixed-size array. All memory it uses is allocated on
|
||||
OBSTACK; the environment is initialized from the SYMBOL_LIST. The
|
||||
symbols are ordered in the same order that they're found in
|
||||
SYMBOL_LIST. */
|
||||
|
||||
-extern struct dictionary *dict_create_linear (struct obstack *obstack,
|
||||
- enum language language,
|
||||
- const struct pending
|
||||
- *symbol_list);
|
||||
+extern struct multidictionary *
|
||||
+ mdict_create_linear (struct obstack *obstack,
|
||||
+ const struct pending *symbol_list);
|
||||
|
||||
-/* Create a dictionary of symbols of language LANGUAGE, implemented
|
||||
- via an array that grows as necessary. The dictionary is initially
|
||||
- empty; to add symbols to it, call dict_add_symbol(). Call
|
||||
- dict_free() when you're done with it. */
|
||||
+/* Create a multi-language dictionary of symbols, implemented
|
||||
+ via an array that grows as necessary. The multidictionary initially
|
||||
+ contains a single empty dictionary of LANGUAGE; to add symbols to it,
|
||||
+ call mdict_add_symbol(). Call mdict_free() when you're done with it. */
|
||||
|
||||
-extern struct dictionary *
|
||||
- dict_create_linear_expandable (enum language language);
|
||||
+extern struct multidictionary *
|
||||
+ mdict_create_linear_expandable (enum language language);
|
||||
|
||||
-/* The functions providing the interface to dictionaries. Note that
|
||||
- the most common parts of the interface, namely symbol lookup, are
|
||||
- only provided via iterator functions. */
|
||||
+/* The functions providing the interface to multi-language dictionaries.
|
||||
+ Note that the most common parts of the interface, namely symbol lookup,
|
||||
+ are only provided via iterator functions. */
|
||||
|
||||
-/* Free the memory used by a dictionary that's not on an obstack. (If
|
||||
+/* Free the memory used by a multidictionary that's not on an obstack. (If
|
||||
any.) */
|
||||
|
||||
-extern void dict_free (struct dictionary *dict);
|
||||
+extern void mdict_free (struct multidictionary *mdict);
|
||||
|
||||
-/* Add a symbol to an expandable dictionary. */
|
||||
+/* Add a symbol to an expandable multidictionary. */
|
||||
|
||||
-extern void dict_add_symbol (struct dictionary *dict, struct symbol *sym);
|
||||
+extern void mdict_add_symbol (struct multidictionary *mdict,
|
||||
+ struct symbol *sym);
|
||||
|
||||
-/* Utility to add a list of symbols to a dictionary. */
|
||||
+/* Utility to add a list of symbols to a multidictionary. */
|
||||
|
||||
-extern void dict_add_pending (struct dictionary *dict,
|
||||
- const struct pending *symbol_list);
|
||||
+extern void mdict_add_pending (struct multidictionary *mdict,
|
||||
+ const struct pending *symbol_list);
|
||||
|
||||
-/* Is the dictionary empty? */
|
||||
+/* Is the multidictionary empty? */
|
||||
|
||||
-extern int dict_empty (struct dictionary *dict);
|
||||
+extern int mdict_empty (struct multidictionary *mdict);
|
||||
|
||||
/* A type containing data that is used when iterating over all symbols
|
||||
in a dictionary. Don't ever look at its innards; this type would
|
||||
@@ -128,44 +127,46 @@ struct mdict_iterator
|
||||
unsigned short current_idx;
|
||||
};
|
||||
|
||||
-/* Initialize ITERATOR to point at the first symbol in DICT, and
|
||||
- return that first symbol, or NULL if DICT is empty. */
|
||||
+/* Initialize ITERATOR to point at the first symbol in MDICT, and
|
||||
+ return that first symbol, or NULL if MDICT is empty. */
|
||||
|
||||
-extern struct symbol *dict_iterator_first (const struct dictionary *dict,
|
||||
- struct dict_iterator *iterator);
|
||||
+extern struct symbol *
|
||||
+ mdict_iterator_first (const struct multidictionary *mdict,
|
||||
+ struct mdict_iterator *miterator);
|
||||
|
||||
-/* Advance ITERATOR, and return the next symbol, or NULL if there are
|
||||
+/* Advance MITERATOR, and return the next symbol, or NULL if there are
|
||||
no more symbols. Don't call this if you've previously received
|
||||
- NULL from dict_iterator_first or dict_iterator_next on this
|
||||
+ NULL from mdict_iterator_first or mdict_iterator_next on this
|
||||
iteration. */
|
||||
|
||||
-extern struct symbol *dict_iterator_next (struct dict_iterator *iterator);
|
||||
+extern struct symbol *mdict_iterator_next (struct mdict_iterator *miterator);
|
||||
|
||||
-/* Initialize ITERATOR to point at the first symbol in DICT whose
|
||||
+/* Initialize MITERATOR to point at the first symbol in MDICT whose
|
||||
SYMBOL_SEARCH_NAME is NAME, as tested using COMPARE (which must use
|
||||
the same conventions as strcmp_iw and be compatible with any
|
||||
dictionary hashing function), and return that first symbol, or NULL
|
||||
if there are no such symbols. */
|
||||
|
||||
-extern struct symbol *dict_iter_match_first (const struct dictionary *dict,
|
||||
- const lookup_name_info &name,
|
||||
- struct dict_iterator *iterator);
|
||||
+extern struct symbol *
|
||||
+ mdict_iter_match_first (const struct multidictionary *mdict,
|
||||
+ const lookup_name_info &name,
|
||||
+ struct mdict_iterator *miterator);
|
||||
|
||||
-/* Advance ITERATOR to point at the next symbol in DICT whose
|
||||
+/* Advance MITERATOR to point at the next symbol in MDICT whose
|
||||
SYMBOL_SEARCH_NAME is NAME, as tested using COMPARE (see
|
||||
dict_iter_match_first), or NULL if there are no more such symbols.
|
||||
Don't call this if you've previously received NULL from
|
||||
- dict_iterator_match_first or dict_iterator_match_next on this
|
||||
- iteration. And don't call it unless ITERATOR was created by a
|
||||
- previous call to dict_iter_match_first with the same NAME and COMPARE. */
|
||||
+ mdict_iterator_match_first or mdict_iterator_match_next on this
|
||||
+ iteration. And don't call it unless MITERATOR was created by a
|
||||
+ previous call to mdict_iter_match_first with the same NAME and COMPARE. */
|
||||
|
||||
-extern struct symbol *dict_iter_match_next (const lookup_name_info &name,
|
||||
- struct dict_iterator *iterator);
|
||||
+extern struct symbol *mdict_iter_match_next (const lookup_name_info &name,
|
||||
+ struct mdict_iterator *miterator);
|
||||
|
||||
-/* Return some notion of the size of the dictionary: the number of
|
||||
+/* Return some notion of the size of the multidictionary: the number of
|
||||
symbols if we have that, the number of hash buckets otherwise. */
|
||||
|
||||
-extern int dict_size (const struct dictionary *dict);
|
||||
+extern int mdict_size (const struct multidictionary *mdict);
|
||||
|
||||
/* Macro to loop through all symbols in a dictionary DICT, in no
|
||||
particular order. ITER is a struct dict_iterator (NOTE: __not__ a
|
||||
@@ -175,8 +176,8 @@ extern int dict_size (const struct dictionary *dict);
|
||||
early by a break if you desire. */
|
||||
|
||||
#define ALL_DICT_SYMBOLS(dict, iter, sym) \
|
||||
- for ((sym) = dict_iterator_first ((dict), &(iter)); \
|
||||
+ for ((sym) = mdict_iterator_first ((dict), &(iter)); \
|
||||
(sym); \
|
||||
- (sym) = dict_iterator_next (&(iter)))
|
||||
+ (sym) = mdict_iterator_next (&(iter)))
|
||||
|
||||
#endif /* DICTIONARY_H */
|
||||
diff --git a/gdb/jit.c b/gdb/jit.c
|
||||
--- a/gdb/jit.c
|
||||
+++ b/gdb/jit.c
|
||||
@@ -651,14 +651,12 @@ finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile)
|
||||
size_t blockvector_size;
|
||||
CORE_ADDR begin, end;
|
||||
struct blockvector *bv;
|
||||
- enum language language;
|
||||
|
||||
actual_nblocks = FIRST_LOCAL_BLOCK + stab->nblocks;
|
||||
|
||||
cust = allocate_compunit_symtab (objfile, stab->file_name);
|
||||
allocate_symtab (cust, stab->file_name);
|
||||
add_compunit_symtab_to_objfile (cust);
|
||||
- language = compunit_language (cust);
|
||||
|
||||
/* JIT compilers compile in memory. */
|
||||
COMPUNIT_DIRNAME (cust) = NULL;
|
||||
@@ -702,8 +700,8 @@ finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile)
|
||||
TARGET_CHAR_BIT,
|
||||
"void");
|
||||
|
||||
- BLOCK_DICT (new_block) = dict_create_linear (&objfile->objfile_obstack,
|
||||
- language, NULL);
|
||||
+ BLOCK_MULTIDICT (new_block)
|
||||
+ = mdict_create_linear (&objfile->objfile_obstack, NULL);
|
||||
/* The address range. */
|
||||
BLOCK_START (new_block) = (CORE_ADDR) gdb_block_iter->begin;
|
||||
BLOCK_END (new_block) = (CORE_ADDR) gdb_block_iter->end;
|
||||
@@ -740,8 +738,8 @@ finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile)
|
||||
new_block = (i == GLOBAL_BLOCK
|
||||
? allocate_global_block (&objfile->objfile_obstack)
|
||||
: allocate_block (&objfile->objfile_obstack));
|
||||
- BLOCK_DICT (new_block) = dict_create_linear (&objfile->objfile_obstack,
|
||||
- language, NULL);
|
||||
+ BLOCK_MULTIDICT (new_block)
|
||||
+ = mdict_create_linear (&objfile->objfile_obstack, NULL);
|
||||
BLOCK_SUPERBLOCK (new_block) = block_iter;
|
||||
block_iter = new_block;
|
||||
|
||||
diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c
|
||||
--- a/gdb/mdebugread.c
|
||||
+++ b/gdb/mdebugread.c
|
||||
@@ -4534,7 +4534,7 @@ static void
|
||||
add_symbol (struct symbol *s, struct symtab *symtab, struct block *b)
|
||||
{
|
||||
symbol_set_symtab (s, symtab);
|
||||
- dict_add_symbol (BLOCK_DICT (b), s);
|
||||
+ mdict_add_symbol (BLOCK_MULTIDICT (b), s);
|
||||
}
|
||||
|
||||
/* Add a new block B to a symtab S. */
|
||||
@@ -4762,7 +4762,7 @@ new_bvect (int nblocks)
|
||||
}
|
||||
|
||||
/* Allocate and zero a new block of language LANGUAGE, and set its
|
||||
- BLOCK_DICT. If function is non-zero, assume the block is
|
||||
+ BLOCK_MULTIDICT. If function is non-zero, assume the block is
|
||||
associated to a function, and make sure that the symbols are stored
|
||||
linearly; otherwise, store them hashed. */
|
||||
|
||||
@@ -4775,9 +4775,9 @@ new_block (enum block_type type, enum language language)
|
||||
struct block *retval = XCNEW (struct block);
|
||||
|
||||
if (type == FUNCTION_BLOCK)
|
||||
- BLOCK_DICT (retval) = dict_create_linear_expandable (language);
|
||||
+ BLOCK_MULTIDICT (retval) = mdict_create_linear_expandable (language);
|
||||
else
|
||||
- BLOCK_DICT (retval) = dict_create_hashed_expandable (language);
|
||||
+ BLOCK_MULTIDICT (retval) = mdict_create_hashed_expandable (language);
|
||||
|
||||
return retval;
|
||||
}
|
||||
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
|
||||
--- a/gdb/objfiles.c
|
||||
+++ b/gdb/objfiles.c
|
||||
@@ -813,40 +813,40 @@ objfile_relocate1 (struct objfile *objfile,
|
||||
}
|
||||
|
||||
ALL_OBJFILE_COMPUNITS (objfile, cust)
|
||||
- {
|
||||
- const struct blockvector *bv = COMPUNIT_BLOCKVECTOR (cust);
|
||||
- int block_line_section = COMPUNIT_BLOCK_LINE_SECTION (cust);
|
||||
-
|
||||
- if (BLOCKVECTOR_MAP (bv))
|
||||
- addrmap_relocate (BLOCKVECTOR_MAP (bv),
|
||||
- ANOFFSET (delta, block_line_section));
|
||||
-
|
||||
- for (i = 0; i < BLOCKVECTOR_NBLOCKS (bv); ++i)
|
||||
- {
|
||||
- struct block *b;
|
||||
- struct symbol *sym;
|
||||
- struct dict_iterator iter;
|
||||
-
|
||||
- b = BLOCKVECTOR_BLOCK (bv, i);
|
||||
- BLOCK_START (b) += ANOFFSET (delta, block_line_section);
|
||||
- BLOCK_END (b) += ANOFFSET (delta, block_line_section);
|
||||
-
|
||||
- if (BLOCK_RANGES (b) != nullptr)
|
||||
- for (int j = 0; j < BLOCK_NRANGES (b); j++)
|
||||
+ {
|
||||
+ const struct blockvector *bv = COMPUNIT_BLOCKVECTOR (cust);
|
||||
+ int block_line_section = COMPUNIT_BLOCK_LINE_SECTION (cust);
|
||||
+
|
||||
+ if (BLOCKVECTOR_MAP (bv))
|
||||
+ addrmap_relocate (BLOCKVECTOR_MAP (bv),
|
||||
+ ANOFFSET (delta, block_line_section));
|
||||
+
|
||||
+ for (int i = 0; i < BLOCKVECTOR_NBLOCKS (bv); ++i)
|
||||
+ {
|
||||
+ struct block *b;
|
||||
+ struct symbol *sym;
|
||||
+ struct mdict_iterator miter;
|
||||
+
|
||||
+ b = BLOCKVECTOR_BLOCK (bv, i);
|
||||
+ BLOCK_START (b) += ANOFFSET (delta, block_line_section);
|
||||
+ BLOCK_END (b) += ANOFFSET (delta, block_line_section);
|
||||
+
|
||||
+ if (BLOCK_RANGES (b) != nullptr)
|
||||
+ for (int j = 0; j < BLOCK_NRANGES (b); j++)
|
||||
+ {
|
||||
+ BLOCK_RANGE_START (b, j)
|
||||
+ += ANOFFSET (delta, block_line_section);
|
||||
+ BLOCK_RANGE_END (b, j) += ANOFFSET (delta, block_line_section);
|
||||
+ }
|
||||
+
|
||||
+ /* We only want to iterate over the local symbols, not any
|
||||
+ symbols in included symtabs. */
|
||||
+ ALL_DICT_SYMBOLS (BLOCK_MULTIDICT (b), miter, sym)
|
||||
{
|
||||
- BLOCK_RANGE_START (b, j)
|
||||
- += ANOFFSET (delta, block_line_section);
|
||||
- BLOCK_RANGE_END (b, j) += ANOFFSET (delta, block_line_section);
|
||||
+ relocate_one_symbol (sym, objfile, delta);
|
||||
}
|
||||
-
|
||||
- /* We only want to iterate over the local symbols, not any
|
||||
- symbols in included symtabs. */
|
||||
- ALL_DICT_SYMBOLS (BLOCK_DICT (b), iter, sym)
|
||||
- {
|
||||
- relocate_one_symbol (sym, objfile, delta);
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
|
||||
/* Relocate isolated symbols. */
|
||||
diff --git a/gdb/symmisc.c b/gdb/symmisc.c
|
||||
--- a/gdb/symmisc.c
|
||||
+++ b/gdb/symmisc.c
|
||||
@@ -275,7 +275,7 @@ dump_symtab_1 (struct symtab *symtab, struct ui_file *outfile)
|
||||
struct objfile *objfile = SYMTAB_OBJFILE (symtab);
|
||||
struct gdbarch *gdbarch = get_objfile_arch (objfile);
|
||||
int i;
|
||||
- struct dict_iterator iter;
|
||||
+ struct mdict_iterator miter;
|
||||
int len;
|
||||
struct linetable *l;
|
||||
const struct blockvector *bv;
|
||||
@@ -331,7 +331,7 @@ dump_symtab_1 (struct symtab *symtab, struct ui_file *outfile)
|
||||
even if we're using a hashtable, but nothing else but this message
|
||||
wants it. */
|
||||
fprintf_filtered (outfile, ", %d syms/buckets in ",
|
||||
- dict_size (BLOCK_DICT (b)));
|
||||
+ mdict_size (BLOCK_MULTIDICT (b)));
|
||||
fputs_filtered (paddress (gdbarch, BLOCK_START (b)), outfile);
|
||||
fprintf_filtered (outfile, "..");
|
||||
fputs_filtered (paddress (gdbarch, BLOCK_END (b)), outfile);
|
||||
@@ -349,7 +349,7 @@ dump_symtab_1 (struct symtab *symtab, struct ui_file *outfile)
|
||||
/* Now print each symbol in this block (in no particular order, if
|
||||
we're using a hashtable). Note that we only want this
|
||||
block, not any blocks from included symtabs. */
|
||||
- ALL_DICT_SYMBOLS (BLOCK_DICT (b), iter, sym)
|
||||
+ ALL_DICT_SYMBOLS (BLOCK_MULTIDICT (b), miter, sym)
|
||||
{
|
||||
TRY
|
||||
{
|
|
@ -1,232 +0,0 @@
|
|||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Sergio Durigan Junior <sergiodj@redhat.com>
|
||||
Date: Fri, 11 Jan 2019 11:26:59 -0500
|
||||
Subject:
|
||||
gdb-rhbz1560010-fix-assertion-symbol-language-dict-language-3of5.patch
|
||||
|
||||
;; Fix 'Assertion `SYMBOL_LANGUAGE (sym) == DICT_LANGUAGE (dict)->la_language' failed.'
|
||||
;; Keith Seitz, RHBZ#1560010.
|
||||
|
||||
gdb/23712: Cleanup/Remove temporary dictionary functions
|
||||
|
||||
Now that multidictionary's are being used, there is no longer any need
|
||||
to retain the four temporary functions introduced in the beginning of
|
||||
this series.
|
||||
|
||||
This patch removes them.
|
||||
|
||||
As an additional cleanup, since the single-language dictionaries are
|
||||
no longer used outside dictionary.c, make all of those functions
|
||||
static.
|
||||
|
||||
gdb/ChangeLog:
|
||||
|
||||
PR gdb/23712
|
||||
PR symtab/23010
|
||||
* dictionary.c (pending_to_vector): Remove.
|
||||
(dict_create_hashed_1, dict_create_linear_1, dict_add_pending_1):
|
||||
Remove _1 suffix, replacing functions of the same name. Update
|
||||
all callers.
|
||||
(dict_create_hashed, dict_create_hashed_expandable)
|
||||
(dict_create_linear, dict_create_linear_expandable, dict_free)
|
||||
(dict_add_symbol, dict_add_pending, dict_size, dict_empty):
|
||||
Make functions static.
|
||||
|
||||
diff --git a/gdb/dictionary.c b/gdb/dictionary.c
|
||||
--- a/gdb/dictionary.c
|
||||
+++ b/gdb/dictionary.c
|
||||
@@ -342,31 +342,14 @@ static void insert_symbol_hashed (struct dictionary *dict,
|
||||
|
||||
static void expand_hashtable (struct dictionary *dict);
|
||||
|
||||
-/* A function to convert a linked list into a vector. */
|
||||
-
|
||||
-static std::vector<symbol *>
|
||||
-pending_to_vector (const struct pending *symbol_list)
|
||||
-{
|
||||
- std::vector<symbol *> symlist;
|
||||
-
|
||||
- for (const struct pending *list_counter = symbol_list;
|
||||
- list_counter != nullptr; list_counter = list_counter->next)
|
||||
- {
|
||||
- for (int i = list_counter->nsyms - 1; i >= 0; --i)
|
||||
- symlist.push_back (list_counter->symbol[i]);
|
||||
- }
|
||||
-
|
||||
- return symlist;
|
||||
-}
|
||||
-
|
||||
/* The creation functions. */
|
||||
|
||||
-/* A function to transition dict_create_hashed to new API. */
|
||||
+/* Create a hashed dictionary of a given language. */
|
||||
|
||||
static struct dictionary *
|
||||
-dict_create_hashed_1 (struct obstack *obstack,
|
||||
- enum language language,
|
||||
- const std::vector<symbol *> &symbol_list)
|
||||
+dict_create_hashed (struct obstack *obstack,
|
||||
+ enum language language,
|
||||
+ const std::vector<symbol *> &symbol_list)
|
||||
{
|
||||
/* Allocate the dictionary. */
|
||||
struct dictionary *retval = XOBNEW (obstack, struct dictionary);
|
||||
@@ -388,21 +371,9 @@ dict_create_hashed_1 (struct obstack *obstack,
|
||||
return retval;
|
||||
}
|
||||
|
||||
-/* See dictionary.h. */
|
||||
-
|
||||
-struct dictionary *
|
||||
-dict_create_hashed (struct obstack *obstack,
|
||||
- enum language language,
|
||||
- const struct pending *symbol_list)
|
||||
-{
|
||||
- std::vector<symbol *> symlist = pending_to_vector (symbol_list);
|
||||
-
|
||||
- return dict_create_hashed_1 (obstack, language, symlist);
|
||||
-}
|
||||
+/* Create an expandable hashed dictionary of a given language. */
|
||||
|
||||
-/* See dictionary.h. */
|
||||
-
|
||||
-extern struct dictionary *
|
||||
+static struct dictionary *
|
||||
dict_create_hashed_expandable (enum language language)
|
||||
{
|
||||
struct dictionary *retval = XNEW (struct dictionary);
|
||||
@@ -417,12 +388,12 @@ dict_create_hashed_expandable (enum language language)
|
||||
return retval;
|
||||
}
|
||||
|
||||
-/* A function to transition dict_create_linear to new API. */
|
||||
+/* Create a linear dictionary of a given language. */
|
||||
|
||||
static struct dictionary *
|
||||
-dict_create_linear_1 (struct obstack *obstack,
|
||||
- enum language language,
|
||||
- const std::vector<symbol *> &symbol_list)
|
||||
+dict_create_linear (struct obstack *obstack,
|
||||
+ enum language language,
|
||||
+ const std::vector<symbol *> &symbol_list)
|
||||
{
|
||||
struct dictionary *retval = XOBNEW (obstack, struct dictionary);
|
||||
DICT_VECTOR (retval) = &dict_linear_vector;
|
||||
@@ -442,21 +413,9 @@ dict_create_linear_1 (struct obstack *obstack,
|
||||
return retval;
|
||||
}
|
||||
|
||||
-/* See dictionary.h. */
|
||||
-
|
||||
-struct dictionary *
|
||||
-dict_create_linear (struct obstack *obstack,
|
||||
- enum language language,
|
||||
- const struct pending *symbol_list)
|
||||
-{
|
||||
- std::vector<symbol *> symlist = pending_to_vector (symbol_list);
|
||||
-
|
||||
- return dict_create_linear_1 (obstack, language, symlist);
|
||||
-}
|
||||
-
|
||||
-/* See dictionary.h. */
|
||||
+/* Create an expandable linear dictionary of a given language. */
|
||||
|
||||
-struct dictionary *
|
||||
+static struct dictionary *
|
||||
dict_create_linear_expandable (enum language language)
|
||||
{
|
||||
struct dictionary *retval = XNEW (struct dictionary);
|
||||
@@ -476,7 +435,7 @@ dict_create_linear_expandable (enum language language)
|
||||
/* Free the memory used by a dictionary that's not on an obstack. (If
|
||||
any.) */
|
||||
|
||||
-void
|
||||
+static void
|
||||
dict_free (struct dictionary *dict)
|
||||
{
|
||||
(DICT_VECTOR (dict))->free (dict);
|
||||
@@ -484,34 +443,24 @@ dict_free (struct dictionary *dict)
|
||||
|
||||
/* Add SYM to DICT. DICT had better be expandable. */
|
||||
|
||||
-void
|
||||
+static void
|
||||
dict_add_symbol (struct dictionary *dict, struct symbol *sym)
|
||||
{
|
||||
(DICT_VECTOR (dict))->add_symbol (dict, sym);
|
||||
}
|
||||
|
||||
-/* A function to transition dict_add_pending to new API. */
|
||||
+/* Utility to add a list of symbols to a dictionary.
|
||||
+ DICT must be an expandable dictionary. */
|
||||
|
||||
static void
|
||||
-dict_add_pending_1 (struct dictionary *dict,
|
||||
- const std::vector<symbol *> &symbol_list)
|
||||
+dict_add_pending (struct dictionary *dict,
|
||||
+ const std::vector<symbol *> &symbol_list)
|
||||
{
|
||||
/* Preserve ordering by reversing the list. */
|
||||
for (auto sym = symbol_list.rbegin (); sym != symbol_list.rend (); ++sym)
|
||||
dict_add_symbol (dict, *sym);
|
||||
}
|
||||
|
||||
-/* Utility to add a list of symbols to a dictionary.
|
||||
- DICT must be an expandable dictionary. */
|
||||
-
|
||||
-void
|
||||
-dict_add_pending (struct dictionary *dict, const struct pending *symbol_list)
|
||||
-{
|
||||
- std::vector<symbol *> symlist = pending_to_vector (symbol_list);
|
||||
-
|
||||
- dict_add_pending_1 (dict, symlist);
|
||||
-}
|
||||
-
|
||||
/* Initialize ITERATOR to point at the first symbol in DICT, and
|
||||
return that first symbol, or NULL if DICT is empty. */
|
||||
|
||||
@@ -548,7 +497,7 @@ dict_iter_match_next (const lookup_name_info &name,
|
||||
->iter_match_next (name, iterator);
|
||||
}
|
||||
|
||||
-int
|
||||
+static int
|
||||
dict_size (const struct dictionary *dict)
|
||||
{
|
||||
return (DICT_VECTOR (dict))->size (dict);
|
||||
@@ -560,7 +509,7 @@ dict_size (const struct dictionary *dict)
|
||||
|
||||
/* Test to see if DICT is empty. */
|
||||
|
||||
-int
|
||||
+static int
|
||||
dict_empty (struct dictionary *dict)
|
||||
{
|
||||
struct dict_iterator iter;
|
||||
@@ -1019,7 +968,7 @@ mdict_create_hashed (struct obstack *obstack,
|
||||
std::vector<symbol *> symlist = pair.second;
|
||||
|
||||
retval->dictionaries[idx++]
|
||||
- = dict_create_hashed_1 (obstack, language, symlist);
|
||||
+ = dict_create_hashed (obstack, language, symlist);
|
||||
}
|
||||
|
||||
return retval;
|
||||
@@ -1064,7 +1013,7 @@ mdict_create_linear (struct obstack *obstack,
|
||||
std::vector<symbol *> symlist = pair.second;
|
||||
|
||||
retval->dictionaries[idx++]
|
||||
- = dict_create_linear_1 (obstack, language, symlist);
|
||||
+ = dict_create_linear (obstack, language, symlist);
|
||||
}
|
||||
|
||||
return retval;
|
||||
@@ -1210,7 +1159,7 @@ mdict_add_pending (struct multidictionary *mdict,
|
||||
dict = create_new_language_dictionary (mdict, language);
|
||||
}
|
||||
|
||||
- dict_add_pending_1 (dict, symlist);
|
||||
+ dict_add_pending (dict, symlist);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,90 +0,0 @@
|
|||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Sergio Durigan Junior <sergiodj@redhat.com>
|
||||
Date: Fri, 11 Jan 2019 11:29:25 -0500
|
||||
Subject:
|
||||
gdb-rhbz1560010-fix-assertion-symbol-language-dict-language-4of5.patch
|
||||
|
||||
;; Fix 'Assertion `SYMBOL_LANGUAGE (sym) == DICT_LANGUAGE (dict)->la_language' failed.'
|
||||
;; Keith Seitz, RHBZ#1560010.
|
||||
|
||||
gdb/23712: Remove dw2_add_symbol_to_list
|
||||
|
||||
Finally, we can remove dw2_add_symbol_to_list since the wrapper function
|
||||
originally introduced to catch this multi-language scenario is no longer
|
||||
needed. With multi-language dictionaries, we can now support adding
|
||||
symbols of multiple languages, negating the need for the assertion
|
||||
entirely.
|
||||
|
||||
This patch should now fix gdb/23712 (and symtab/23010). At least it will
|
||||
if the NULL buildsym_compunit problem doesn't strike first (see gdb/23773).
|
||||
|
||||
gdb/ChangeLog:
|
||||
|
||||
PR gdb/23712
|
||||
PR symtab/23010
|
||||
* dwarf2read.c (dw2_add_symbol_to_list): Remove.
|
||||
(fixup_go_packaging, new_symbol): Use add_symbol_to_list.
|
||||
|
||||
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
|
||||
--- a/gdb/dwarf2read.c
|
||||
+++ b/gdb/dwarf2read.c
|
||||
@@ -9715,23 +9715,6 @@ compute_delayed_physnames (struct dwarf2_cu *cu)
|
||||
cu->method_list.clear ();
|
||||
}
|
||||
|
||||
-/* A wrapper for add_symbol_to_list to ensure that SYMBOL's language is
|
||||
- the same as all other symbols in LISTHEAD. If a new symbol is added
|
||||
- with a different language, this function asserts. */
|
||||
-
|
||||
-static inline void
|
||||
-dw2_add_symbol_to_list (struct symbol *symbol, struct pending **listhead)
|
||||
-{
|
||||
- /* Only assert if LISTHEAD already contains symbols of a different
|
||||
- language (dict_create_hashed/insert_symbol_hashed requires that all
|
||||
- symbols in this list are of the same language). */
|
||||
- gdb_assert ((*listhead) == NULL
|
||||
- || (SYMBOL_LANGUAGE ((*listhead)->symbol[0])
|
||||
- == SYMBOL_LANGUAGE (symbol)));
|
||||
-
|
||||
- add_symbol_to_list (symbol, listhead);
|
||||
-}
|
||||
-
|
||||
/* Go objects should be embedded in a DW_TAG_module DIE,
|
||||
and it's not clear if/how imported objects will appear.
|
||||
To keep Go support simple until that's worked out,
|
||||
@@ -9803,7 +9786,7 @@ fixup_go_packaging (struct dwarf2_cu *cu)
|
||||
SYMBOL_ACLASS_INDEX (sym) = LOC_TYPEDEF;
|
||||
SYMBOL_TYPE (sym) = type;
|
||||
|
||||
- dw2_add_symbol_to_list (sym, &global_symbols);
|
||||
+ add_symbol_to_list (sym, &global_symbols);
|
||||
|
||||
xfree (package_name);
|
||||
}
|
||||
@@ -21387,7 +21370,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
|
||||
SYMBOL_TYPE (sym) = objfile_type (objfile)->builtin_core_addr;
|
||||
SYMBOL_DOMAIN (sym) = LABEL_DOMAIN;
|
||||
SYMBOL_ACLASS_INDEX (sym) = LOC_LABEL;
|
||||
- dw2_add_symbol_to_list (sym, cu->list_in_scope);
|
||||
+ add_symbol_to_list (sym, cu->list_in_scope);
|
||||
break;
|
||||
case DW_TAG_subprogram:
|
||||
/* SYMBOL_BLOCK_VALUE (sym) will be filled in later by
|
||||
@@ -21645,7 +21628,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
|
||||
case DW_TAG_common_block:
|
||||
SYMBOL_ACLASS_INDEX (sym) = LOC_COMMON_BLOCK;
|
||||
SYMBOL_DOMAIN (sym) = COMMON_BLOCK_DOMAIN;
|
||||
- dw2_add_symbol_to_list (sym, cu->list_in_scope);
|
||||
+ add_symbol_to_list (sym, cu->list_in_scope);
|
||||
break;
|
||||
default:
|
||||
/* Not a tag we recognize. Hopefully we aren't processing
|
||||
@@ -21665,7 +21648,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
|
||||
}
|
||||
|
||||
if (list_to_add != NULL)
|
||||
- dw2_add_symbol_to_list (sym, list_to_add);
|
||||
+ add_symbol_to_list (sym, list_to_add);
|
||||
|
||||
/* For the benefit of old versions of GCC, check for anonymous
|
||||
namespaces based on the demangled name. */
|
|
@ -1,183 +0,0 @@
|
|||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Sergio Durigan Junior <sergiodj@redhat.com>
|
||||
Date: Fri, 11 Jan 2019 11:31:59 -0500
|
||||
Subject:
|
||||
gdb-rhbz1560010-fix-assertion-symbol-language-dict-language-5of5.patch
|
||||
|
||||
;; Fix 'Assertion `SYMBOL_LANGUAGE (sym) == DICT_LANGUAGE (dict)->la_language' failed.'
|
||||
;; Keith Seitz, RHBZ#1560010.
|
||||
|
||||
gdb/23712: Test case for multidictionary
|
||||
|
||||
This is a test derived from one of the reproducers in symtab/23010.
|
||||
The DIE tree used here is typical of compilations with LTO, where an
|
||||
artificial parent DIE of language C99 imports DIEs of other languages.
|
||||
|
||||
gdb/testsuite/ChangeLog:
|
||||
|
||||
PR gdb/23712
|
||||
PR symtab/23010
|
||||
* gdb.dwarf2/multidictionary.exp: New file.
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.dwarf2/multidictionary.exp b/gdb/testsuite/gdb.dwarf2/multidictionary.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.dwarf2/multidictionary.exp
|
||||
@@ -0,0 +1,157 @@
|
||||
+# 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/>.
|
||||
+
|
||||
+# A test of multi-language dictionaries, a solution to symtab/23010 et al.
|
||||
+
|
||||
+load_lib dwarf.exp
|
||||
+
|
||||
+# This test can only be run on targets which support DWARF.
|
||||
+if {![dwarf2_support]} {
|
||||
+ return 0
|
||||
+}
|
||||
+
|
||||
+standard_testfile main.c .S
|
||||
+
|
||||
+# Create the DWARF. This is derived from the reproducer in the bug
|
||||
+# mentioned above. This DIE tree is typical of compilations wtih
|
||||
+# LTO enabled.
|
||||
+
|
||||
+set asm_file [standard_output_file $srcfile2]
|
||||
+Dwarf::assemble $asm_file {
|
||||
+ declare_labels D45d9 D5079 D5080 D50a9 D50af D5ab2 D5ac2 D5ace D5acf
|
||||
+ declare_labels D2135f D2216a D22171 D226c4 D226ca D244ca \
|
||||
+ D245da D245e6
|
||||
+ declare_labels D41c21 D42025 D42045 D42038 D42045 D420b5
|
||||
+
|
||||
+ cu {} {
|
||||
+ D45d9: compile_unit {
|
||||
+ {language @DW_LANG_C_plus_plus}
|
||||
+ {name "SerialPortUtils.cpp"}
|
||||
+ } {
|
||||
+ D5079: base_type {
|
||||
+ {byte_size 1 sdata}
|
||||
+ {encoding @DW_ATE_unsigned}
|
||||
+ {name "char"}
|
||||
+ }
|
||||
+
|
||||
+ D5080: const_type {
|
||||
+ {type :$D5079}
|
||||
+ }
|
||||
+
|
||||
+ D50a9: pointer_type {
|
||||
+ {byte_size 4 sdata}
|
||||
+ {type :$D5080}
|
||||
+ }
|
||||
+
|
||||
+ D50af: const_type {
|
||||
+ {type :$D50a9}
|
||||
+ }
|
||||
+
|
||||
+ D5ab2: subprogram {
|
||||
+ {external 1 flag}
|
||||
+ {linkage_name "_Z18SerialSyncWriteStrPKc"}
|
||||
+ } {
|
||||
+ D5ac2: formal_parameter {
|
||||
+ {name "msg"}
|
||||
+ {type :$D50af}
|
||||
+ }
|
||||
+ D5ace: lexical_block {} {
|
||||
+ D5acf: DW_TAG_variable {
|
||||
+ {name "p"}
|
||||
+ {type :$D50a9}
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ cu {} {
|
||||
+ D2135f: compile_unit {
|
||||
+ {language @DW_LANG_C_plus_plus}
|
||||
+ {name "Main.cpp"}
|
||||
+ } {
|
||||
+ D2216a: base_type {
|
||||
+ {byte_size 1 sdata}
|
||||
+ {encoding @DW_ATE_unsigned_char}
|
||||
+ {name "char"}
|
||||
+ }
|
||||
+
|
||||
+ D22171: const_type {
|
||||
+ {type :$D2216a}
|
||||
+ }
|
||||
+
|
||||
+ D226c4: pointer_type {
|
||||
+ {byte_size 4 sdata}
|
||||
+ {type :$D22171}
|
||||
+ }
|
||||
+
|
||||
+ D226ca: const_type {
|
||||
+ {type :$D226c4}
|
||||
+ }
|
||||
+
|
||||
+ D245da: subprogram {
|
||||
+ {name "PrintPanicMsg"}
|
||||
+ } {
|
||||
+ D245e6: formal_parameter {
|
||||
+ {name "msg"}
|
||||
+ {type :$D226ca}
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ cu {} {
|
||||
+ D41c21: compile_unit {
|
||||
+ {language @DW_LANG_C99}
|
||||
+ {name "<artificial>"}
|
||||
+ } {
|
||||
+ D42025: subprogram {
|
||||
+ {abstract_origin %$D245da}
|
||||
+ {low_pc 0x80b60 addr}
|
||||
+ {high_pc 0x6c data4}
|
||||
+ } {
|
||||
+ D42038: formal_parameter {
|
||||
+ {abstract_origin %$D245e6}
|
||||
+ }
|
||||
+
|
||||
+ D42045: inlined_subroutine {
|
||||
+ {abstract_origin %$D5ab2}
|
||||
+ {low_pc 0x8060 addr}
|
||||
+ {high_pc 0xc data4}
|
||||
+ } {
|
||||
+ D420b5: formal_parameter {
|
||||
+ {abstract_origin %$D5ac2}
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+# Build the test executable.
|
||||
+if {[build_executable $testfile.exp $testfile [list $asm_file $srcfile] {}] \
|
||||
+ == -1} {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+# We force the DIEs above to be read in via "-readnow".
|
||||
+gdb_spawn_with_cmdline_opts "-readnow"
|
||||
+gdb_load $binfile
|
||||
+
|
||||
+# All we need to do is check whether GDB is alive. Without
|
||||
+# multidictionaries, it will either crash, assert, or throw an
|
||||
+# internal_error.
|
||||
+gdb_test "p 1" "= 1" "GDB is alive"
|
||||
+
|
|
@ -1,176 +0,0 @@
|
|||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Sergio Durigan Junior <sergiodj@redhat.com>
|
||||
Date: Fri, 30 Nov 2018 15:20:27 -0500
|
||||
Subject:
|
||||
gdb-rhbz1639242-fix-dwarf2_find_containing_comp_unit-binary-search.patch
|
||||
|
||||
;; Fix for 'py-bt is broken, results in exception'.
|
||||
;; RHBZ 1639242
|
||||
|
||||
Fix dwarf2read.c:dwarf2_find_containing_comp_unit's binary search
|
||||
|
||||
First of all, I would like to express my gratitude to Keith Seitz, Jan
|
||||
Kratochvil and Tom Tromey, who were really kind and helped a lot with
|
||||
this bug. The patch itself was authored by Jan.
|
||||
|
||||
This all began with:
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1639242
|
||||
py-bt is broken, results in exception
|
||||
|
||||
In summary, the error reported by the bug above is:
|
||||
|
||||
$ gdb -args python3
|
||||
GNU gdb (GDB) Fedora 8.1.1-3.fc28
|
||||
(...)
|
||||
Reading symbols from python3...Reading symbols from /usr/lib/debug/usr/bin/python3.6-3.6.6-1.fc28.x86_64.debug...done.
|
||||
done.
|
||||
Dwarf Error: could not find partial DIE containing offset 0x316 [in module /usr/lib/debug/usr/bin/python3.6-3.6.6-1.fc28.x86_64.debug]
|
||||
|
||||
After a long investigation, and after thinking that the problem might
|
||||
actually be on DWZ's side, we were able to determine that there's
|
||||
something wrong going on when
|
||||
dwarf2read.c:dwarf2_find_containing_comp_unit performs a binary search
|
||||
over all of the CUs belonging to an objfile in order to find the CU
|
||||
which contains a DIE at an specific offset. The current algorithm is:
|
||||
|
||||
static struct dwarf2_per_cu_data *
|
||||
dwarf2_find_containing_comp_unit (sect_offset sect_off,
|
||||
unsigned int offset_in_dwz,
|
||||
struct dwarf2_per_objfile *dwarf2_per_objfile)
|
||||
{
|
||||
struct dwarf2_per_cu_data *this_cu;
|
||||
int low, high;
|
||||
const sect_offset *cu_off;
|
||||
|
||||
low = 0;
|
||||
high = dwarf2_per_objfile->all_comp_units.size () - 1;
|
||||
while (high > low)
|
||||
{
|
||||
struct dwarf2_per_cu_data *mid_cu;
|
||||
int mid = low + (high - low) / 2;
|
||||
|
||||
mid_cu = dwarf2_per_objfile->all_comp_units[mid];
|
||||
cu_off = &mid_cu->sect_off;
|
||||
if (mid_cu->is_dwz > offset_in_dwz
|
||||
|| (mid_cu->is_dwz == offset_in_dwz && *cu_off >= sect_off))
|
||||
high = mid;
|
||||
else
|
||||
low = mid + 1;
|
||||
}
|
||||
|
||||
For the sake of this example, let's consider that "sect_off =
|
||||
0x7d".
|
||||
|
||||
There are a few important things going on here. First,
|
||||
"dwarf2_per_objfile->all_comp_units ()" will be sorted first by
|
||||
whether the CU is a DWZ CU, and then by cu->sect_off. In this
|
||||
specific bug, "offset_in_dwz" is false, which means that, for the most
|
||||
part of the loop, we're going to do "high = mid" (i.e, we'll work with
|
||||
the lower part of the vector).
|
||||
|
||||
In our particular case, when we reach the part where "mid_cu->is_dwz
|
||||
== offset_in_dwz" (i.e, both are false), we end up with "high = 2" and
|
||||
"mid = 1". I.e., there are only 2 elements in the vector who are not
|
||||
DWZ. The vector looks like this:
|
||||
|
||||
#0: cu->sect_off = 0; length = 114; is_dwz = false <-- low
|
||||
#1: cu->sect_off = 114; length = 7796; is_dwz = false <-- mid
|
||||
#2: cu->sect_off = 0; length = 28; is_dwz = true <-- high
|
||||
...
|
||||
|
||||
The CU we want is #1, which is exactly where "mid" is. Also, #1 is
|
||||
not DWZ, which is also exactly what we want. So we perform the second
|
||||
comparison:
|
||||
|
||||
(mid_cu->is_dwz == offset_in_dwz && *cu_off >= sect_off)
|
||||
^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Because "*cu_off = 114" and "sect_off = 0x7d", this evaluates to
|
||||
false, so we end up with "low = mid + 1 = 2", which actually gives us
|
||||
the wrong CU (i.e., a CU that is DWZ). Next in the code, GDB does:
|
||||
|
||||
gdb_assert (low == high);
|
||||
this_cu = dwarf2_per_objfile->all_comp_units[low];
|
||||
cu_off = &this_cu->sect_off;
|
||||
if (this_cu->is_dwz != offset_in_dwz || *cu_off > sect_off)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
{
|
||||
if (low == 0 || this_cu->is_dwz != offset_in_dwz)
|
||||
error (_("Dwarf Error: could not find partial DIE containing "
|
||||
"offset %s [in module %s]"),
|
||||
sect_offset_str (sect_off),
|
||||
bfd_get_filename (dwarf2_per_objfile->objfile->obfd));
|
||||
...
|
||||
|
||||
Triggering the error we saw in the original bug report.
|
||||
|
||||
It's important to notice that we see the error message because the
|
||||
selected CU is a DWZ one, but we're looking for a non-DWZ CU here.
|
||||
However, even when the selected CU is *not* a DWZ (and we don't see
|
||||
any error message), we still end up with the wrong CU. For example,
|
||||
suppose that the vector had:
|
||||
|
||||
#0: cu->sect_off = 0; length = 114; is_dwz = false
|
||||
#1: cu->sect_off = 114; length = 7796; is_dwz = false
|
||||
#2: cu->sect_off = 7910; length = 28; is_dwz = false
|
||||
...
|
||||
|
||||
I.e., #2's "is_dwz" is false instead of true. In this case, we still
|
||||
want #1, because that's where the DIE is located. After the loop ends
|
||||
up in #2, we have "is_dwz" as false, which is what we wanted, so we
|
||||
compare offsets. In this case, "7910 >= 0x7d", so we set "mid = high
|
||||
= 2". Next iteration, we have "mid = 0 + (2 - 0) / 2 = 1", and thus
|
||||
we examining #1. "is_dwz" is still false, but "114 >= 0x7d" also
|
||||
evaluates to false, so "low = mid + 1 = 2", which makes the loop stop.
|
||||
Therefore, we end up choosing #2 as our CU, even though #1 is the
|
||||
right one.
|
||||
|
||||
The problem here is happening because we're comparing "sect_off"
|
||||
directly against "*cu_off", while we should actually be comparing
|
||||
against "*cu_off + mid_cu->length" (i.e., the end offset):
|
||||
|
||||
...
|
||||
|| (mid_cu->is_dwz == offset_in_dwz
|
||||
&& *cu_off + mid_cu->length >= sect_off))
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
...
|
||||
|
||||
And this is what the patch does. The idea is that if GDB is searching
|
||||
for an offset that falls above the *end* of the CU being
|
||||
analyzed (i.e., "mid"), then the next iteration should try a
|
||||
higher-offset CU next. The previous algorithm was using
|
||||
the *beginning* of the CU.
|
||||
|
||||
Unfortunately, I could not devise a testcase for this problem, so I am
|
||||
proposing a fix with this huge explanation attached to it in the hope
|
||||
that it is sufficient. After talking a bit to Keith (our testcase
|
||||
guru), it seems that one would have to create an objfile with both DWZ
|
||||
and non-DWZ sections, which may prove very hard to do, I think.
|
||||
|
||||
I ran this patch on our BuildBot, and no regressions were detected.
|
||||
|
||||
gdb/ChangeLog:
|
||||
2018-11-30 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
Keith Seitz <keiths@redhat.com>
|
||||
Tom Tromey <tom@tromey.com>
|
||||
Sergio Durigan Junior <sergiodj@redhat.com>
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1613614
|
||||
* dwarf2read.c (dwarf2_find_containing_comp_unit): Add
|
||||
'mid_cu->length' to '*cu_off' when checking if 'sect_off' is
|
||||
inside the CU.
|
||||
|
||||
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
|
||||
--- a/gdb/dwarf2read.c
|
||||
+++ b/gdb/dwarf2read.c
|
||||
@@ -25039,7 +25039,8 @@ dwarf2_find_containing_comp_unit (sect_offset sect_off,
|
||||
mid_cu = dwarf2_per_objfile->all_comp_units[mid];
|
||||
cu_off = &mid_cu->sect_off;
|
||||
if (mid_cu->is_dwz > offset_in_dwz
|
||||
- || (mid_cu->is_dwz == offset_in_dwz && *cu_off >= sect_off))
|
||||
+ || (mid_cu->is_dwz == offset_in_dwz
|
||||
+ && *cu_off + mid_cu->length >= sect_off))
|
||||
high = mid;
|
||||
else
|
||||
low = mid + 1;
|
|
@ -1,145 +0,0 @@
|
|||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Tom Tromey <tom@tromey.com>
|
||||
Date: Fri, 5 Oct 2018 14:54:35 -0600
|
||||
Subject: gdb-rhbz1653410-avoid-crash-when-calling-warning-too-early.patch
|
||||
|
||||
;; Fix for 'GDB crashes when running from a deleted directory'
|
||||
;; (Tom Tromey, RHBZ#1653410)
|
||||
|
||||
Avoid crash when calling warning too early
|
||||
|
||||
I noticed that if you pass the name of an existing file (not a
|
||||
directory) as the argument to --data-directory, gdb will crash:
|
||||
|
||||
$ ./gdb -nx --data-directory ./gdb
|
||||
../../binutils-gdb/gdb/target.c:590:56: runtime error: member call on null pointer of type 'struct target_ops'
|
||||
|
||||
This was later reported as PR gdb/23838.
|
||||
|
||||
This happens because warning ends up calling
|
||||
target_supports_terminal_ours, which calls current_top_target, which
|
||||
returns nullptr this early.
|
||||
|
||||
This fixes the problem by handling this case specially in
|
||||
target_supports_terminal_ours. I also changed
|
||||
target_supports_terminal_ours to return bool.
|
||||
|
||||
gdb/ChangeLog
|
||||
2018-11-08 Tom Tromey <tom@tromey.com>
|
||||
|
||||
PR gdb/23555:
|
||||
PR gdb/23838:
|
||||
* target.h (target_supports_terminal_ours): Return bool.
|
||||
* target.c (target_supports_terminal_ours): Handle case where
|
||||
current_top_target returns nullptr. Return bool.
|
||||
|
||||
gdb/testsuite/ChangeLog
|
||||
2018-11-08 Tom Tromey <tom@tromey.com>
|
||||
|
||||
PR gdb/23555:
|
||||
PR gdb/23838:
|
||||
* gdb.base/warning.exp: New file.
|
||||
|
||||
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
|
||||
--- a/gdb/ChangeLog
|
||||
+++ b/gdb/ChangeLog
|
||||
@@ -1,3 +1,11 @@
|
||||
+2018-11-08 Tom Tromey <tom@tromey.com>
|
||||
+
|
||||
+ PR gdb/23555:
|
||||
+ PR gdb/23838:
|
||||
+ * target.h (target_supports_terminal_ours): Return bool.
|
||||
+ * target.c (target_supports_terminal_ours): Handle case where
|
||||
+ current_top_target returns nullptr. Return bool.
|
||||
+
|
||||
2018-08-16 Gary Benson <gbenson@redhat.com>
|
||||
|
||||
PR gdb/13000:
|
||||
diff --git a/gdb/target.c b/gdb/target.c
|
||||
--- a/gdb/target.c
|
||||
+++ b/gdb/target.c
|
||||
@@ -584,10 +584,16 @@ target_terminal::info (const char *arg, int from_tty)
|
||||
|
||||
/* See target.h. */
|
||||
|
||||
-int
|
||||
+bool
|
||||
target_supports_terminal_ours (void)
|
||||
{
|
||||
- return current_top_target ()->supports_terminal_ours ();
|
||||
+ /* This can be called before there is any target, so we must check
|
||||
+ for nullptr here. */
|
||||
+ target_ops *top = current_top_target ();
|
||||
+
|
||||
+ if (top == nullptr)
|
||||
+ return false;
|
||||
+ return top->supports_terminal_ours ();
|
||||
}
|
||||
|
||||
static void
|
||||
diff --git a/gdb/target.h b/gdb/target.h
|
||||
--- a/gdb/target.h
|
||||
+++ b/gdb/target.h
|
||||
@@ -1576,7 +1576,7 @@ extern int target_remove_breakpoint (struct gdbarch *gdbarch,
|
||||
/* Return true if the target stack has a non-default
|
||||
"terminal_ours" method. */
|
||||
|
||||
-extern int target_supports_terminal_ours (void);
|
||||
+extern bool target_supports_terminal_ours (void);
|
||||
|
||||
/* Kill the inferior process. Make it go away. */
|
||||
|
||||
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
|
||||
--- a/gdb/testsuite/ChangeLog
|
||||
+++ b/gdb/testsuite/ChangeLog
|
||||
@@ -1,3 +1,9 @@
|
||||
+2018-11-08 Tom Tromey <tom@tromey.com>
|
||||
+
|
||||
+ PR gdb/23555:
|
||||
+ PR gdb/23838:
|
||||
+ * gdb.base/warning.exp: New file.
|
||||
+
|
||||
2018-09-04 Gary Benson <gbenson@redhat.com>
|
||||
|
||||
* gdb.base/batch-exit-status.exp: Use gdb_test_multiple and expect
|
||||
diff --git a/gdb/testsuite/gdb.base/warning.exp b/gdb/testsuite/gdb.base/warning.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/warning.exp
|
||||
@@ -0,0 +1,36 @@
|
||||
+# Copyright 2018 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+# Test that an early warning does not cause a crash.
|
||||
+
|
||||
+if {[is_remote host]} {
|
||||
+ unsupported "warning.exp can only run on local host"
|
||||
+ return
|
||||
+}
|
||||
+
|
||||
+set tname [standard_temp_file warning]
|
||||
+set fd [open $tname w]
|
||||
+puts $fd "anything"
|
||||
+close $fd
|
||||
+
|
||||
+set save $INTERNAL_GDBFLAGS
|
||||
+set INTERNAL_GDBFLAGS "-nw -nx -data-directory $tname"
|
||||
+
|
||||
+gdb_start
|
||||
+
|
||||
+# Make sure gdb started up.
|
||||
+gdb_test "echo 23\\n" "23"
|
||||
+
|
||||
+set INTERNAL_GDBFLAGS $save
|
|
@ -1,174 +0,0 @@
|
|||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Keith Seitz <keiths@redhat.com>
|
||||
Date: Tue, 12 May 2020 15:38:27 -0400
|
||||
Subject: gdb-rhbz1659535-z15-record-replay.patch
|
||||
|
||||
;; Backport z15 record/replay
|
||||
;; Andreas Arnaz, RH BZ 1659535
|
||||
|
||||
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
|
||||
--- a/gdb/s390-tdep.c
|
||||
+++ b/gdb/s390-tdep.c
|
||||
@@ -4101,6 +4101,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 */
|
||||
@@ -4133,20 +4134,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]))
|
||||
@@ -4522,7 +4535,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);
|
||||
@@ -5452,6 +5471,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 */
|
||||
@@ -5514,6 +5540,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 */
|
||||
@@ -5542,10 +5571,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 */
|
||||
@@ -5596,6 +5625,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))
|
||||
@@ -5604,6 +5634,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))
|
||||
@@ -5612,6 +5643,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))
|
||||
@@ -5622,6 +5654,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))
|
||||
@@ -6201,7 +6235,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);
|
|
@ -1,20 +0,0 @@
|
|||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Keith Seitz <keiths@redhat.com>
|
||||
Date: Fri, 8 Mar 2019 11:39:10 -0800
|
||||
Subject: gdb-rhbz1666249-suggest-yum-instead-of-dnf.patch
|
||||
|
||||
;; Fix 'gdb suggests using "dnf debuginfo-install'
|
||||
;; Keith Seitz, RHBZ 1666249
|
||||
|
||||
diff --git a/gdb/build-id.c b/gdb/build-id.c
|
||||
--- a/gdb/build-id.c
|
||||
+++ b/gdb/build-id.c
|
||||
@@ -1013,6 +1013,8 @@ missing_rpm_list_print (void)
|
||||
printf_unfiltered (_("Missing separate debuginfos, use: %s"),
|
||||
#ifdef DNF_DEBUGINFO_INSTALL
|
||||
"dnf "
|
||||
+#else
|
||||
+ "yum "
|
||||
#endif
|
||||
"debuginfo-install");
|
||||
for (array_iter = array; array_iter < array + missing_rpm_list_entries;
|
File diff suppressed because it is too large
Load Diff
|
@ -1,93 +0,0 @@
|
|||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Keith Seitz <keiths@redhat.com>
|
||||
Date: Tue, 19 Mar 2019 11:38:37 -0700
|
||||
Subject: gdb-rhbz1669953-aarch64-sve-binutils.patch
|
||||
|
||||
;; Fix 'gdb fails to read zN registers from corefile with aarch64 SVE'
|
||||
;; Alan Hayward, RH BZ 1669953
|
||||
|
||||
Add checks for the NT_ARM_SVE section in a core file.
|
||||
|
||||
The NT_ARM_SVE section is documented here:
|
||||
https://github.com/torvalds/linux/blob/master/Documentation/arm64/sve.txt
|
||||
* A NT_ARM_SVE note will be added to each coredump for each thread of the
|
||||
dumped process. The contents will be equivalent to the data that would have
|
||||
been read if a PTRACE_GETREGSET of NT_ARM_SVE were executed for each thread
|
||||
when the coredump was generated.
|
||||
|
||||
* elf.c (elfcore_grok_aarch_sve): New function.
|
||||
(elfcore_grok_note): Check for Aarch64 SVE.
|
||||
(elfcore_write_aarch_sve): New function.
|
||||
(elfcore_write_register_note): Check for Aarch64 SVE.
|
||||
* elf-bfd.h(elfcore_grok_aarch_sve): New declaration.
|
||||
|
||||
diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
|
||||
--- a/bfd/elf-bfd.h
|
||||
+++ b/bfd/elf-bfd.h
|
||||
@@ -2601,6 +2601,8 @@ extern char *elfcore_write_aarch_hw_break
|
||||
(bfd *, char *, int *, const void *, int);
|
||||
extern char *elfcore_write_aarch_hw_watch
|
||||
(bfd *, char *, int *, const void *, int);
|
||||
+extern char *elfcore_write_aarch_sve
|
||||
+ (bfd *, char *, int *, const void *, int);
|
||||
extern char *elfcore_write_lwpstatus
|
||||
(bfd *, char *, int *, long, int, const void *);
|
||||
extern char *elfcore_write_register_note
|
||||
diff --git a/bfd/elf.c b/bfd/elf.c
|
||||
--- a/bfd/elf.c
|
||||
+++ b/bfd/elf.c
|
||||
@@ -9340,6 +9340,12 @@ elfcore_grok_aarch_hw_watch (bfd *abfd, Elf_Internal_Note *note)
|
||||
return elfcore_make_note_pseudosection (abfd, ".reg-aarch-hw-watch", note);
|
||||
}
|
||||
|
||||
+static bfd_boolean
|
||||
+elfcore_grok_aarch_sve (bfd *abfd, Elf_Internal_Note *note)
|
||||
+{
|
||||
+ return elfcore_make_note_pseudosection (abfd, ".reg-aarch-sve", note);
|
||||
+}
|
||||
+
|
||||
#if defined (HAVE_PRPSINFO_T)
|
||||
typedef prpsinfo_t elfcore_psinfo_t;
|
||||
#if defined (HAVE_PRPSINFO32_T) /* Sparc64 cross Sparc32 */
|
||||
@@ -9836,6 +9842,13 @@ elfcore_grok_note (bfd *abfd, Elf_Internal_Note *note)
|
||||
else
|
||||
return TRUE;
|
||||
|
||||
+ case NT_ARM_SVE:
|
||||
+ if (note->namesz == 6
|
||||
+ && strcmp (note->namedata, "LINUX") == 0)
|
||||
+ return elfcore_grok_aarch_sve (abfd, note);
|
||||
+ else
|
||||
+ return TRUE;
|
||||
+
|
||||
case NT_PRPSINFO:
|
||||
case NT_PSINFO:
|
||||
if (bed->elf_backend_grok_psinfo)
|
||||
@@ -11027,6 +11040,18 @@ elfcore_write_aarch_hw_watch (bfd *abfd,
|
||||
note_name, NT_ARM_HW_WATCH, aarch_hw_watch, size);
|
||||
}
|
||||
|
||||
+char *
|
||||
+elfcore_write_aarch_sve (bfd *abfd,
|
||||
+ char *buf,
|
||||
+ int *bufsiz,
|
||||
+ const void *aarch_sve,
|
||||
+ int size)
|
||||
+{
|
||||
+ char *note_name = "LINUX";
|
||||
+ return elfcore_write_note (abfd, buf, bufsiz,
|
||||
+ note_name, NT_ARM_SVE, aarch_sve, size);
|
||||
+}
|
||||
+
|
||||
char *
|
||||
elfcore_write_register_note (bfd *abfd,
|
||||
char *buf,
|
||||
@@ -11079,6 +11104,8 @@ elfcore_write_register_note (bfd *abfd,
|
||||
return elfcore_write_aarch_hw_break (abfd, buf, bufsiz, data, size);
|
||||
if (strcmp (section, ".reg-aarch-hw-watch") == 0)
|
||||
return elfcore_write_aarch_hw_watch (abfd, buf, bufsiz, data, size);
|
||||
+ if (strcmp (section, ".reg-aarch-sve") == 0)
|
||||
+ return elfcore_write_aarch_sve (abfd, buf, bufsiz, data, size);
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -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
|
||||
@@ -24355,7 +24355,21 @@ dwarf_decode_macro_bytes (struct dwarf2_per_objfile *dwarf2_per_objfile,
|
||||
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
|
||||
{
|
|
@ -1,128 +0,0 @@
|
|||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Keith Seitz <keiths@redhat.com>
|
||||
Date: Thu, 17 Oct 2019 09:44:15 -0700
|
||||
Subject: gdb-rhbz1742099-reject-sections-with-invalid-sizes.patch
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
;; Prevent buffer overflow with sections with invalid sizes.
|
||||
;; Keith Seitz, RH BZ 1740299.
|
||||
|
||||
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
|
||||
|
||||
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
|
||||
--- a/gdb/dwarf2read.c
|
||||
+++ b/gdb/dwarf2read.c
|
||||
@@ -2335,6 +2335,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;
|
|
@ -1,49 +0,0 @@
|
|||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Sergio Durigan Junior <sergiodj@redhat.com>
|
||||
Date: Tue, 7 Jan 2020 21:02:19 -0500
|
||||
Subject: gdb-rhbz1768593-s390x-arch13-01.patch
|
||||
|
||||
;; Fix 'GDB needs s390x arch13 binutils patches'
|
||||
;; RHBZ 1768593, Andreas Krebbel
|
||||
;; This patch contains only the opcodes change.
|
||||
|
||||
S/390: Support vector alignment hints
|
||||
|
||||
This patch adds the vector alignment hints to the vector load and
|
||||
store instructions as documented in the IBM z14 Principles of
|
||||
Operations manual:
|
||||
|
||||
http://publibfi.boulder.ibm.com/epubs/pdf/dz9zr011.pdf
|
||||
|
||||
opcodes/ChangeLog:
|
||||
|
||||
2018-10-23 Andreas Krebbel <krebbel@linux.ibm.com>
|
||||
|
||||
* s390-opc.txt: Add vector load/store instructions with additional
|
||||
alignment parameter.
|
||||
|
||||
gas/ChangeLog:
|
||||
|
||||
2018-10-23 Andreas Krebbel <krebbel@linux.ibm.com>
|
||||
|
||||
* config/tc-s390.c (md_gather_operands): Fix for optional operands
|
||||
following memory addresses.
|
||||
* testsuite/gas/s390/zarch-arch12.d: Add regexp checks for new
|
||||
instruction variants.
|
||||
* testsuite/gas/s390/zarch-arch12.s: Emit new instruction
|
||||
variants.
|
||||
|
||||
diff --git a/opcodes/s390-opc.txt b/opcodes/s390-opc.txt
|
||||
--- a/opcodes/s390-opc.txt
|
||||
+++ b/opcodes/s390-opc.txt
|
||||
@@ -1880,3 +1880,10 @@ b929 kma RRF_R0RR "cipher message with galois counter mode" arch12 zarch
|
||||
b93c prno RRE_RR "perform pseudorandom number operation" arch12 zarch
|
||||
b9a1 tpei RRE_RR "test pending external interruption" arch12 zarch
|
||||
b9ac irbm RRE_RR "insert reference bits multiple" arch12 zarch
|
||||
+
|
||||
+# Aligned vector store hints
|
||||
+
|
||||
+e70000000006 vl VRX_VRRDU "vector memory load" arch12 zarch optparm
|
||||
+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
|
|
@ -1,217 +0,0 @@
|
|||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Sergio Durigan Junior <sergiodj@redhat.com>
|
||||
Date: Tue, 7 Jan 2020 21:07:53 -0500
|
||||
Subject: gdb-rhbz1768593-s390x-arch13-02.patch
|
||||
|
||||
;; Fix 'GDB needs s390x arch13 binutils patches'
|
||||
;; RHBZ 1768593, Andreas Krebbel
|
||||
;; This patch contains only the opcodes and include changes.
|
||||
|
||||
S/390: Implement instruction set extensions
|
||||
|
||||
opcodes/ChangeLog:
|
||||
|
||||
2019-01-31 Andreas Krebbel <krebbel@linux.ibm.com>
|
||||
|
||||
Backport from mainline
|
||||
2019-01-31 Andreas Krebbel <krebbel@linux.ibm.com>
|
||||
|
||||
* s390-mkopc.c (main): Accept arch13 as cpu string.
|
||||
* s390-opc.c: Add new instruction formats and instruction opcode
|
||||
masks.
|
||||
* s390-opc.txt: Add new arch13 instructions.
|
||||
|
||||
include/ChangeLog:
|
||||
|
||||
2019-01-31 Andreas Krebbel <krebbel@linux.ibm.com>
|
||||
|
||||
Backport from mainline
|
||||
2019-01-31 Andreas Krebbel <krebbel@linux.ibm.com>
|
||||
|
||||
* opcode/s390.h (enum s390_opcode_cpu_val): Add
|
||||
S390_OPCODE_ARCH13.
|
||||
|
||||
gas/ChangeLog:
|
||||
|
||||
2019-01-31 Andreas Krebbel <krebbel@linux.ibm.com>
|
||||
|
||||
Backport from mainline
|
||||
2019-01-31 Andreas Krebbel <krebbel@linux.ibm.com>
|
||||
|
||||
* config/tc-s390.c (s390_parse_cpu): New entry for arch13.
|
||||
* doc/c-s390.texi: Document arch13 march option.
|
||||
* testsuite/gas/s390/s390.exp: Run the arch13 related tests.
|
||||
* testsuite/gas/s390/zarch-arch13.d: New test.
|
||||
* testsuite/gas/s390/zarch-arch13.s: New test.
|
||||
* testsuite/gas/s390/zarch-z13.d: Expect the renamed mnemonics
|
||||
also for z13.
|
||||
|
||||
diff --git a/include/opcode/s390.h b/include/opcode/s390.h
|
||||
--- a/include/opcode/s390.h
|
||||
+++ b/include/opcode/s390.h
|
||||
@@ -43,6 +43,7 @@ enum s390_opcode_cpu_val
|
||||
S390_OPCODE_ZEC12,
|
||||
S390_OPCODE_Z13,
|
||||
S390_OPCODE_ARCH12,
|
||||
+ S390_OPCODE_ARCH13,
|
||||
S390_OPCODE_MAXCPU
|
||||
};
|
||||
|
||||
diff --git a/opcodes/s390-mkopc.c b/opcodes/s390-mkopc.c
|
||||
--- a/opcodes/s390-mkopc.c
|
||||
+++ b/opcodes/s390-mkopc.c
|
||||
@@ -377,6 +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)
|
||||
+ min_cpu = S390_OPCODE_ARCH13;
|
||||
else {
|
||||
fprintf (stderr, "Couldn't parse cpu string %s\n", cpu_string);
|
||||
exit (1);
|
||||
diff --git a/opcodes/s390-opc.c b/opcodes/s390-opc.c
|
||||
--- a/opcodes/s390-opc.c
|
||||
+++ b/opcodes/s390-opc.c
|
||||
@@ -359,6 +359,7 @@ const struct s390_operand s390_operands[] =
|
||||
#define INSTR_RRF_RURR2 4, { R_24,R_16,R_28,U4_20,0,0 } /* e.g. lptea */
|
||||
#define INSTR_RRF_R0RR 4, { R_24,R_16,R_28,0,0,0 } /* e.g. idte */
|
||||
#define INSTR_RRF_R0RR2 4, { R_24,R_28,R_16,0,0,0 } /* e.g. ark */
|
||||
+#define INSTR_RRF_R0RR3 4, { R_24,R_28,R_16,0,0,0 } /* e.g. selrz */
|
||||
#define INSTR_RRF_U0FF 4, { F_24,U4_16,F_28,0,0,0 } /* e.g. fidbr */
|
||||
#define INSTR_RRF_U0FEFE 4, { FE_24,U4_16,FE_28,0,0,0 } /* e.g. fixbr */
|
||||
#define INSTR_RRF_U0RF 4, { R_24,U4_16,F_28,0,0,0 } /* e.g. cfebr */
|
||||
@@ -513,6 +514,7 @@ const struct s390_operand s390_operands[] =
|
||||
#define INSTR_VRR_VV0U0U 6, { V_8,V_12,U4_32,U4_24,0,0 } /* e.g. vistr */
|
||||
#define INSTR_VRR_0VV0U 6, { V_12,V_16,U4_24,0,0,0 } /* e.g. vcp */
|
||||
#define INSTR_VRR_RV0U 6, { R_8,V_12,U4_24,0,0,0 } /* e.g. vcvb */
|
||||
+#define INSTR_VRR_RV0UU 6, { R_8,V_12,U4_24,U4_28,0,0 } /* e.g. vcvb */
|
||||
#define INSTR_VSI_URDV 6, { V_32,D_20,B_16,U8_8,0,0 } /* e.g. vlrl */
|
||||
|
||||
#define MASK_E { 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 }
|
||||
@@ -578,6 +580,7 @@ const struct s390_operand s390_operands[] =
|
||||
#define MASK_RRF_RURR2 { 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 }
|
||||
#define MASK_RRF_R0RR { 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 }
|
||||
#define MASK_RRF_R0RR2 { 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 }
|
||||
+#define MASK_RRF_R0RR3 { 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00 }
|
||||
#define MASK_RRF_U0FF { 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00 }
|
||||
#define MASK_RRF_U0FEFE { 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00 }
|
||||
#define MASK_RRF_U0RF { 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00 }
|
||||
@@ -732,6 +735,7 @@ const struct s390_operand s390_operands[] =
|
||||
#define MASK_VRR_VV0U0U { 0xff, 0x00, 0xff, 0x0f, 0x00, 0xff }
|
||||
#define MASK_VRR_0VV0U { 0xff, 0xf0, 0x0f, 0x0f, 0xf0, 0xff }
|
||||
#define MASK_VRR_RV0U { 0xff, 0x00, 0xff, 0x0f, 0xf0, 0xff }
|
||||
+#define MASK_VRR_RV0UU { 0xff, 0x00, 0xff, 0x00, 0xf0, 0xff }
|
||||
#define MASK_VSI_URDV { 0xff, 0x00, 0x00, 0x00, 0x00, 0xff }
|
||||
|
||||
|
||||
diff --git a/opcodes/s390-opc.txt b/opcodes/s390-opc.txt
|
||||
--- a/opcodes/s390-opc.txt
|
||||
+++ b/opcodes/s390-opc.txt
|
||||
@@ -1887,3 +1887,107 @@ e70000000006 vl VRX_VRRDU "vector memory load" arch12 zarch optparm
|
||||
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
|
|
@ -1,241 +0,0 @@
|
|||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Sergio Durigan Junior <sergiodj@redhat.com>
|
||||
Date: Tue, 7 Jan 2020 21:08:22 -0500
|
||||
Subject: gdb-rhbz1768593-s390x-arch13-03.patch
|
||||
|
||||
;; Fix 'GDB needs s390x arch13 binutils patches'
|
||||
;; RHBZ 1768593, Andreas Krebbel
|
||||
|
||||
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
|
||||
--- 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 selfhr RRF_RURR "select high" arch13 zarch
|
||||
+b9c00000 selfhr*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_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
|
||||
+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
|
|
@ -1,114 +0,0 @@
|
|||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Keith Seitz <keiths@redhat.com>
|
||||
Date: Mon, 27 Jul 2020 19:38:20 -0400
|
||||
Subject: gdb-rhbz1842691-corefile-mem-access-10of15.patch
|
||||
|
||||
;; gcore command: Place all file-backed mappings in NT_FILE note
|
||||
;; Kevin Buettner, RH BZ 1842961
|
||||
|
||||
Author: Kevin Buettner <kevinb@redhat.com>
|
||||
Date: Wed Jul 1 06:34:50 2020 -0700
|
||||
|
||||
gcore command: Place all file-backed mappings in NT_FILE note
|
||||
|
||||
When making a core file with the GDB's gcore command on Linux,
|
||||
the same criteria used for determining which mappings should be
|
||||
dumped were also being used for determining which entries should
|
||||
be placed in the NT_FILE note. This is wrong; we want to place
|
||||
all file-backed mappings in this note.
|
||||
|
||||
The predicate function, dump_mapping_p, was used to determine whether
|
||||
or not to dump a mapping from within linux_find_memory_regions_full.
|
||||
This commit leaves this predicate in place, but adds a new parameter,
|
||||
should_dump_mapping_p, to linux_find_memory_regions_full. It then
|
||||
calls should_dump_mapping_p instead of dump_mapping_p. dump_mapping_p
|
||||
is passed to linux_find_memory_regions_full at one call site; at the
|
||||
other call site, dump_note_entry_p is passed instead.
|
||||
|
||||
gdb/ChangeLog:
|
||||
|
||||
* linux-tdep.c (dump_note_entry_p): New function.
|
||||
(linux_dump_mapping_p_ftype): New typedef.
|
||||
(linux_find_memory_regions_full): Add new parameter,
|
||||
should_dump_mapping_p.
|
||||
(linux_find_memory_regions): Adjust call to
|
||||
linux_find_memory_regions_full.
|
||||
(linux_make_mappings_core_file_notes): Use dump_note_entry_p in
|
||||
call to linux_find_memory_regions_full.
|
||||
|
||||
diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c
|
||||
--- a/gdb/linux-tdep.c
|
||||
+++ b/gdb/linux-tdep.c
|
||||
@@ -710,6 +710,25 @@ dump_mapping_p (filter_flags filterflags, const struct smaps_vmflags *v,
|
||||
}
|
||||
}
|
||||
|
||||
+/* As above, but return true only when we should dump the NT_FILE
|
||||
+ entry. */
|
||||
+
|
||||
+static int
|
||||
+dump_note_entry_p (filter_flags filterflags, const struct smaps_vmflags *v,
|
||||
+ int maybe_private_p, int mapping_anon_p, int mapping_file_p,
|
||||
+ const char *filename)
|
||||
+{
|
||||
+ /* vDSO and vsyscall mappings will end up in the core file. Don't
|
||||
+ put them in the NT_FILE note. */
|
||||
+ if (strcmp ("[vdso]", filename) == 0
|
||||
+ || strcmp ("[vsyscall]", filename) == 0)
|
||||
+ return 0;
|
||||
+
|
||||
+ /* Otherwise, any other file-based mapping should be placed in the
|
||||
+ note. */
|
||||
+ return filename != nullptr;
|
||||
+}
|
||||
+
|
||||
/* Implement the "info proc" command. */
|
||||
|
||||
static void
|
||||
@@ -1224,10 +1243,18 @@ typedef int linux_find_memory_region_ftype (ULONGEST vaddr, ULONGEST size,
|
||||
const char *filename,
|
||||
void *data);
|
||||
|
||||
+typedef int linux_dump_mapping_p_ftype (filter_flags filterflags,
|
||||
+ const struct smaps_vmflags *v,
|
||||
+ int maybe_private_p,
|
||||
+ int mapping_anon_p,
|
||||
+ int mapping_file_p,
|
||||
+ const char *filename);
|
||||
+
|
||||
/* List memory regions in the inferior for a corefile. */
|
||||
|
||||
static int
|
||||
linux_find_memory_regions_full (struct gdbarch *gdbarch,
|
||||
+ linux_dump_mapping_p_ftype *should_dump_mapping_p,
|
||||
linux_find_memory_region_ftype *func,
|
||||
void *obfd)
|
||||
{
|
||||
@@ -1378,7 +1405,7 @@ linux_find_memory_regions_full (struct gdbarch *gdbarch,
|
||||
}
|
||||
|
||||
if (has_anonymous)
|
||||
- should_dump_p = dump_mapping_p (filterflags, &v, priv,
|
||||
+ should_dump_p = should_dump_mapping_p (filterflags, &v, priv,
|
||||
mapping_anon_p, mapping_file_p,
|
||||
filename);
|
||||
else
|
||||
@@ -1444,6 +1471,7 @@ linux_find_memory_regions (struct gdbarch *gdbarch,
|
||||
data.obfd = obfd;
|
||||
|
||||
return linux_find_memory_regions_full (gdbarch,
|
||||
+ dump_mapping_p,
|
||||
linux_find_memory_regions_thunk,
|
||||
&data);
|
||||
}
|
||||
@@ -1606,7 +1634,9 @@ linux_make_mappings_corefile_notes (struct gdbarch *gdbarch, bfd *obfd,
|
||||
pack_long (buf, long_type, 1);
|
||||
obstack_grow (&data_obstack, buf, TYPE_LENGTH (long_type));
|
||||
|
||||
- linux_find_memory_regions_full (gdbarch, linux_make_mappings_callback,
|
||||
+ linux_find_memory_regions_full (gdbarch,
|
||||
+ dump_note_entry_p,
|
||||
+ linux_make_mappings_callback,
|
||||
&mapping_data);
|
||||
|
||||
if (mapping_data.file_count != 0)
|
|
@ -1,87 +0,0 @@
|
|||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Keith Seitz <keiths@redhat.com>
|
||||
Date: Tue, 28 Jul 2020 09:26:44 -0400
|
||||
Subject: gdb-rhbz1842691-corefile-mem-access-11of15.patch
|
||||
|
||||
;; Adjust coredump-filter.exp to account for NT_FILE note handling
|
||||
;; Kevin Buettner, RH BZ 1842961
|
||||
|
||||
Author: Kevin Buettner <kevinb@redhat.com>
|
||||
Date: Fri Jul 3 20:10:22 2020 -0700
|
||||
|
||||
Adjust coredump-filter.exp to account for NT_FILE note handling
|
||||
|
||||
This commit makes adjustments to coredump-filter.exp to account
|
||||
for the fact that NT_FILE file-backed mappings are now available
|
||||
when a core file is loaded. Thus, a test which was expected
|
||||
to PASS when a memory region was determined to be unavailable
|
||||
(due to no file-backed mappings being available) will now FAIL
|
||||
due to those mappings being available from having loaded the
|
||||
NT_FILE note.
|
||||
|
||||
I had originally marked the test as XFAIL, but Mihails Strasuns
|
||||
suggested a much better approach:
|
||||
|
||||
1) First test that it still works if file is accessible in the
|
||||
filesystem.
|
||||
2) Temporarily move / rename the file and test that disassembly
|
||||
doesn't work anymore.
|
||||
|
||||
That's what this commit implements.
|
||||
|
||||
gdb/testsuite/ChangeLog:
|
||||
|
||||
* gdb.base/coredump-filter.exp: Add second
|
||||
non-Private-Shared-Anon-File test.
|
||||
(test_disasm): Rename binfile for test which is expected
|
||||
to fail.
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/coredump-filter.exp b/gdb/testsuite/gdb.base/coredump-filter.exp
|
||||
--- a/gdb/testsuite/gdb.base/coredump-filter.exp
|
||||
+++ b/gdb/testsuite/gdb.base/coredump-filter.exp
|
||||
@@ -80,15 +80,26 @@ proc do_load_and_test_core { core var working_var working_value dump_excluded }
|
||||
# disassemble of a function (i.e., the binary's .text section). GDB
|
||||
# should fail in this case. However, it must succeed if the binary is
|
||||
# provided along with the corefile. This is what we test here.
|
||||
+#
|
||||
+# A further complication is that Linux NT_FILE notes are now read from
|
||||
+# the corefile. This note allows GDB to find the binary for file
|
||||
+# backed mappings even though the binary wasn't loaded by GDB in the
|
||||
+# conventional manner. In order to see the expected failure for this
|
||||
+# case, we rename the binary in order to perform this test.
|
||||
|
||||
proc test_disasm { core address should_fail } {
|
||||
- global testfile hex
|
||||
+ global testfile hex binfile
|
||||
|
||||
# Restart GDB without loading the binary.
|
||||
with_test_prefix "no binary" {
|
||||
gdb_exit
|
||||
gdb_start
|
||||
|
||||
+ set hide_binfile [standard_output_file "${testfile}.hide"]
|
||||
+ if { $should_fail == 1 } {
|
||||
+ remote_exec host "mv -f $binfile $hide_binfile"
|
||||
+ }
|
||||
+
|
||||
set core_loaded [gdb_core_cmd "$core" "load core"]
|
||||
if { $core_loaded == -1 } {
|
||||
fail "loading $core"
|
||||
@@ -96,6 +107,7 @@ proc test_disasm { core address should_fail } {
|
||||
}
|
||||
|
||||
if { $should_fail == 1 } {
|
||||
+ remote_exec host "mv -f $hide_binfile $binfile"
|
||||
gdb_test "x/i \$pc" "=> $hex:\tCannot access memory at address $hex" \
|
||||
"disassemble function with corefile and without a binary"
|
||||
} else {
|
||||
@@ -225,5 +237,9 @@ foreach item $all_anon_corefiles {
|
||||
}
|
||||
|
||||
with_test_prefix "loading and testing corefile for non-Private-Shared-Anon-File" {
|
||||
+ test_disasm $non_private_shared_anon_file_core $main_addr 0
|
||||
+}
|
||||
+
|
||||
+with_test_prefix "loading and testing corefile for non-Private-Shared-Anon-File with renamed binary" {
|
||||
test_disasm $non_private_shared_anon_file_core $main_addr 1
|
||||
}
|
|
@ -1,169 +0,0 @@
|
|||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Keith Seitz <keiths@redhat.com>
|
||||
Date: Tue, 28 Jul 2020 09:32:50 -0400
|
||||
Subject: gdb-rhbz1842691-corefile-mem-access-12of15.patch
|
||||
|
||||
;; Add new command "maint print core-file-backed-mappings"
|
||||
;; Kevin Buettner, RH BZ 1842961
|
||||
|
||||
Author: Kevin Buettner <kevinb@redhat.com>
|
||||
Date: Fri Jul 3 21:55:51 2020 -0700
|
||||
|
||||
Add new command "maint print core-file-backed-mappings"
|
||||
|
||||
I wrote a read_core_file_mappings method for FreeBSD and then registered
|
||||
this gdbarch method. I saw some strange behavior while testing it and
|
||||
wanted a way to make sure that mappings were being correctly loaded
|
||||
into corelow.c, so I wrote the new command which is the topic of this
|
||||
commit. I think it might be occasionally useful for debugging strange
|
||||
corefile behavior.
|
||||
|
||||
With regard to FreeBSD, my work isn't ready yet. Unlike Linux,
|
||||
FreeBSD puts all mappings into its core file note. And, unlike Linux,
|
||||
it doesn't dump load segments which occupy no space in the file. So
|
||||
my (perhaps naive) implementation of a FreeBSD read_core_file_mappings
|
||||
didn't work all that well: I saw more failures in the corefile2.exp
|
||||
tests than without it. I think it should be possible to make FreeBSD
|
||||
work as well as Linux, but it will require doing something with all of
|
||||
the mappings, not just the file based mappings that I was considering.
|
||||
|
||||
In the v4 series, Pedro asked the following:
|
||||
|
||||
I don't understand what this command provides that "info proc
|
||||
mappings" doesn't? Can you give an example of when you'd use this
|
||||
command over "info proc mappings" ?
|
||||
|
||||
On Linux, "info proc mappings" and "maint print core-file-backed-mappings"
|
||||
will produce similar, possibly identical, output. This need not be
|
||||
the case for other OSes. E.g. on FreeBSD, had I finished the
|
||||
implementation, the output from these commands would have been very
|
||||
different. The FreeBSD "info proc mappings" command would show
|
||||
additional (non-file-backed) mappings in addition to at least one
|
||||
additional field (memory permissions) for each mapping.
|
||||
|
||||
As noted earlier, I was seeing some unexpected behavior while working
|
||||
on the FreeBSD implementation and wanted to be certain that the
|
||||
mappings were being correctly loaded by corelow.c. "info proc
|
||||
mappings" prints the core file mappings, but doesn't tell us anything
|
||||
about whether they've been loaded by corelow.c This new maintenance
|
||||
command directly interrogates the data structures and prints the
|
||||
values found there.
|
||||
|
||||
gdb/ChangeLog:
|
||||
|
||||
* corelow.c (gdbcmd.h): Include.
|
||||
(core_target::info_proc_mappings): New method.
|
||||
(get_current_core_target): New function.
|
||||
(maintenance_print_core_file_backed_mappings): New function.
|
||||
(_initialize_corelow): Add core-file-backed-mappings to
|
||||
"maint print" commands.
|
||||
|
||||
diff --git a/gdb/corelow.c b/gdb/corelow.c
|
||||
--- a/gdb/corelow.c
|
||||
+++ b/gdb/corelow.c
|
||||
@@ -118,6 +118,9 @@ public:
|
||||
const char *human_name,
|
||||
bool required);
|
||||
|
||||
+ /* See definition. */
|
||||
+ void info_proc_mappings (struct gdbarch *gdbarch);
|
||||
+
|
||||
private: /* per-core data */
|
||||
|
||||
/* The core's section table. Note that these target sections are
|
||||
@@ -1292,6 +1295,86 @@ core_target::info_proc (const char *args, enum info_proc_what request)
|
||||
return true;
|
||||
}
|
||||
|
||||
+/* Get a pointer to the current core target. If not connected to a
|
||||
+ core target, return NULL. */
|
||||
+
|
||||
+static core_target *
|
||||
+get_current_core_target ()
|
||||
+{
|
||||
+ target_ops *proc_target = find_target_at (process_stratum);
|
||||
+ return dynamic_cast<core_target *> (proc_target);
|
||||
+}
|
||||
+
|
||||
+/* Display file backed mappings from core file. */
|
||||
+
|
||||
+void
|
||||
+core_target::info_proc_mappings (struct gdbarch *gdbarch)
|
||||
+{
|
||||
+ if (m_core_file_mappings.sections != m_core_file_mappings.sections_end)
|
||||
+ {
|
||||
+ printf_filtered (_("Mapped address spaces:\n\n"));
|
||||
+ if (gdbarch_addr_bit (gdbarch) == 32)
|
||||
+ {
|
||||
+ printf_filtered ("\t%10s %10s %10s %10s %s\n",
|
||||
+ "Start Addr",
|
||||
+ " End Addr",
|
||||
+ " Size", " Offset", "objfile");
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ printf_filtered (" %18s %18s %10s %10s %s\n",
|
||||
+ "Start Addr",
|
||||
+ " End Addr",
|
||||
+ " Size", " Offset", "objfile");
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ for (const struct target_section *tsp = m_core_file_mappings.sections;
|
||||
+ tsp < m_core_file_mappings.sections_end;
|
||||
+ tsp++)
|
||||
+ {
|
||||
+ ULONGEST start = tsp->addr;
|
||||
+ ULONGEST end = tsp->endaddr;
|
||||
+ ULONGEST file_ofs = tsp->the_bfd_section->filepos;
|
||||
+ const char *filename = bfd_get_filename (tsp->the_bfd_section->owner);
|
||||
+
|
||||
+ if (gdbarch_addr_bit (gdbarch) == 32)
|
||||
+ printf_filtered ("\t%10s %10s %10s %10s %s\n",
|
||||
+ paddress (gdbarch, start),
|
||||
+ paddress (gdbarch, end),
|
||||
+ hex_string (end - start),
|
||||
+ hex_string (file_ofs),
|
||||
+ filename);
|
||||
+ else
|
||||
+ printf_filtered (" %18s %18s %10s %10s %s\n",
|
||||
+ paddress (gdbarch, start),
|
||||
+ paddress (gdbarch, end),
|
||||
+ hex_string (end - start),
|
||||
+ hex_string (file_ofs),
|
||||
+ filename);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+/* Implement "maintenance print core-file-backed-mappings" command.
|
||||
+
|
||||
+ If mappings are loaded, the results should be similar to the
|
||||
+ mappings shown by "info proc mappings". This command is mainly a
|
||||
+ debugging tool for GDB developers to make sure that the expected
|
||||
+ mappings are present after loading a core file. For Linux, the
|
||||
+ output provided by this command will be very similar (if not
|
||||
+ identical) to that provided by "info proc mappings". This is not
|
||||
+ necessarily the case for other OSes which might provide
|
||||
+ more/different information in the "info proc mappings" output. */
|
||||
+
|
||||
+static void
|
||||
+maintenance_print_core_file_backed_mappings (const char *args, int from_tty)
|
||||
+{
|
||||
+ core_target *targ = get_current_core_target ();
|
||||
+ if (targ != nullptr)
|
||||
+ targ->info_proc_mappings (targ->core_gdbarch ());
|
||||
+}
|
||||
+
|
||||
+void _initialize_corelow ();
|
||||
void
|
||||
_initialize_corelow (void)
|
||||
{
|
||||
@@ -1303,4 +1386,8 @@ Set whether CORE-FILE loads the build-id associated files automatically."), _("\
|
||||
Show whether CORE-FILE loads the build-id associated files automatically."),
|
||||
NULL, NULL, NULL,
|
||||
&setlist, &showlist);
|
||||
+ add_cmd ("core-file-backed-mappings", class_maintenance,
|
||||
+ maintenance_print_core_file_backed_mappings,
|
||||
+ _("Print core file's file-backed mappings"),
|
||||
+ &maintenanceprintlist);
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Keith Seitz <keiths@redhat.com>
|
||||
Date: Tue, 28 Jul 2020 09:44:04 -0400
|
||||
Subject: gdb-rhbz1842691-corefile-mem-access-13of15.patch
|
||||
|
||||
;; Add documentation for "maint print core-file-backed-mappings"
|
||||
;; Kevin Buettner, RH BZ 1842961
|
||||
|
||||
Author: Kevin Buettner <kevinb@redhat.com>
|
||||
Date: Fri Jul 3 22:09:20 2020 -0700
|
||||
|
||||
Add documentation for "maint print core-file-backed-mappings"
|
||||
|
||||
gdb/ChangeLog:
|
||||
|
||||
* NEWS (New commands): Mention new command
|
||||
"maintenance print core-file-backed-mappings".
|
||||
|
||||
gdb/doc/ChangeLog:
|
||||
|
||||
* gdb.texinfo (Maintenance Commands): Add documentation for
|
||||
new command "maintenance print core-file-backed-mappings".
|
||||
|
||||
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
|
||||
--- a/gdb/doc/gdb.texinfo
|
||||
+++ b/gdb/doc/gdb.texinfo
|
||||
@@ -35633,6 +35633,14 @@ library. This exercises all @code{libthread_db} functionality used by
|
||||
@code{libthread_db} uses. Note that parts of the test may be skipped
|
||||
on some platforms when debugging core files.
|
||||
|
||||
+@kindex maint print core-file-backed-mappings
|
||||
+@cindex memory address space mappings
|
||||
+@item maint print core-file-backed-mappings
|
||||
+Print the file-backed mappings which were loaded from a core file note.
|
||||
+This output represents state internal to @value{GDBN} and should be
|
||||
+similar to the mappings displayed by the @code{info proc mappings}
|
||||
+command.
|
||||
+
|
||||
@kindex maint print dummy-frames
|
||||
@item maint print dummy-frames
|
||||
Prints the contents of @value{GDBN}'s internal dummy-frame stack.
|
|
@ -1,439 +0,0 @@
|
|||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Keith Seitz <keiths@redhat.com>
|
||||
Date: Tue, 28 Jul 2020 09:46:44 -0400
|
||||
Subject: gdb-rhbz1842691-corefile-mem-access-14of15.patch
|
||||
|
||||
;; New core file tests with mappings over existing program memory
|
||||
;; Kevin Buettner, RH BZ 1842961
|
||||
|
||||
Author: Kevin Buettner <kevinb@redhat.com>
|
||||
Date: Wed Jun 17 19:25:47 2020 -0700
|
||||
|
||||
New core file tests with mappings over existing program memory
|
||||
|
||||
This test case was inspired by Pedro's demonstration of a problem
|
||||
with my v2 patches. It can be found here:
|
||||
|
||||
https://sourceware.org/pipermail/gdb-patches/2020-May/168826.html
|
||||
|
||||
In a nutshell, my earlier patches could not handle the case in
|
||||
which a read-only mapping created with mmap() was created at
|
||||
an address used by other file-backed read-only memory in use by
|
||||
the process.
|
||||
|
||||
This problem has been fixed (for Linux, anyway) by the commit "Use
|
||||
NT_FILE note section for reading core target memory".
|
||||
|
||||
When I run this test without any of my recent corefile patches,
|
||||
I see these failures:
|
||||
|
||||
FAIL: gdb.base/corefile2.exp: kernel core: print/x mbuf_ro[0]@4
|
||||
FAIL: gdb.base/corefile2.exp: kernel core: print/x mbuf_ro[pagesize-4]@4
|
||||
FAIL: gdb.base/corefile2.exp: kernel core: print/x mbuf_ro[-3]@6
|
||||
FAIL: gdb.base/corefile2.exp: kernel core: print/x mbuf_rw[pagesize-3]@6
|
||||
FAIL: gdb.base/corefile2.exp: kernel core: print/x mbuf_ro[pagesize-3]@6
|
||||
FAIL: gdb.base/corefile2.exp: maint print core-file-backed-mappings
|
||||
FAIL: gdb.base/corefile2.exp: gcore core: print/x mbuf_ro[-3]@6
|
||||
|
||||
The ones involving mbuf_ro will almost certainly fail when run on
|
||||
non-Linux systems; I've used setup_xfail on those tests to prevent
|
||||
them from outright FAILing when not run on Linux. For a time, I
|
||||
had considered skipping these tests altogether when not run on
|
||||
Linux, but I changed my mind due to this failure...
|
||||
|
||||
FAIL: gdb.base/corefile2.exp: print/x mbuf_rw[pagesize-3]@6
|
||||
|
||||
I think it *should* pass without my recent corefile patches. The fact
|
||||
that it doesn't is likely due to a bug in GDB. The following
|
||||
interaction with GDB demonstrates the problem:
|
||||
|
||||
(gdb) print/x mbuf_rw[pagesize-3]@6
|
||||
$1 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0}
|
||||
(gdb) print/x mbuf_rw[pagesize]@3
|
||||
$2 = {0x6b, 0x6b, 0x6b}
|
||||
|
||||
The last three values in display of $1 should be the same as those
|
||||
shown by $2. Like this...
|
||||
|
||||
(gdb) print/x mbuf_rw[pagesize-3]@6
|
||||
$1 = {0x0, 0x0, 0x0, 0x6b, 0x6b, 0x6b}
|
||||
(gdb) print/x mbuf_rw[pagesize]@3
|
||||
$2 = {0x6b, 0x6b, 0x6b}
|
||||
|
||||
That latter output was obtained with the use of all of my current
|
||||
corefile patches. I see no failures on Linux when running this test
|
||||
with my current set of corefile patches. I tested 3 architectures:
|
||||
x86_64, s390x, and aarch64.
|
||||
|
||||
I also tested on FreeBSD 12.1-RELEASE. I see the following results
|
||||
both with and without the current set of core file patches:
|
||||
|
||||
# of expected passes 26
|
||||
# of expected failures 8
|
||||
|
||||
Of particular interest is that I did *not* see the problematic mbuf_rw
|
||||
failure noted earlier (both with and without the core file patches).
|
||||
I still don't have an explanation for why this failure occurred on
|
||||
Linux. Prior to running the tests, I had hypothesized that I'd see
|
||||
this failure on FreeBSD too, but testing shows that this is not the
|
||||
case.
|
||||
|
||||
Also of importance is that we see no FAILs with this test on FreeBSD
|
||||
which indicates that I XFAILed the correct tests.
|
||||
|
||||
This version runs the interesting tests twice, once with a kernel
|
||||
created core file and another time with a gcore created core file.
|
||||
|
||||
It also does a very minimal test of the new command "maint print
|
||||
core-file-backed-mappings".
|
||||
|
||||
gdb/testsuite/ChangeLog:
|
||||
|
||||
* gdb.base/corefile2.exp: New file.
|
||||
* gdb.base/coremaker2.exp: New file.
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/corefile2.exp b/gdb/testsuite/gdb.base/corefile2.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/corefile2.exp
|
||||
@@ -0,0 +1,185 @@
|
||||
+# Copyright 2020 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/>.
|
||||
+
|
||||
+# Tests of core file memory accesses when mmap() has been used to
|
||||
+# create a "hole" of zeroes over pre-existing memory regions. See
|
||||
+# coremaker2.c for details.
|
||||
+
|
||||
+# are we on a target board
|
||||
+if ![isnative] then {
|
||||
+ return
|
||||
+}
|
||||
+
|
||||
+# Some of these tests will only work on GNU/Linux due to the
|
||||
+# fact that Linux core files includes a section describing
|
||||
+# memory address to file mappings. We'll use set_up_xfail for the
|
||||
+# affected tests. As other targets become supported, the condition
|
||||
+# can be changed accordingly.
|
||||
+
|
||||
+set xfail 0
|
||||
+if { ![istarget *-linux*] } {
|
||||
+ set xfail 1
|
||||
+}
|
||||
+
|
||||
+standard_testfile coremaker2.c
|
||||
+
|
||||
+if {[build_executable $testfile.exp $testfile $srcfile debug] == -1} {
|
||||
+ untested "failed to compile"
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+set corefile [core_find $binfile {}]
|
||||
+if {$corefile == ""} {
|
||||
+ return 0
|
||||
+}
|
||||
+
|
||||
+gdb_start
|
||||
+gdb_reinitialize_dir $srcdir/$subdir
|
||||
+gdb_load ${binfile}
|
||||
+
|
||||
+# Attempt to load the core file.
|
||||
+
|
||||
+gdb_test_multiple "core-file $corefile" "core-file command" {
|
||||
+ -re ".* program is being debugged already.*y or n. $" {
|
||||
+ # gdb_load may connect us to a gdbserver.
|
||||
+ send_gdb "y\n"
|
||||
+ exp_continue
|
||||
+ }
|
||||
+ -re "Core was generated by .*corefile.*\r\n\#0 .*\(\).*\r\n$gdb_prompt $" {
|
||||
+ pass "core-file command"
|
||||
+ }
|
||||
+ -re "Core was generated by .*\r\n\#0 .*\(\).*\r\n$gdb_prompt $" {
|
||||
+ pass "core-file command (with bad program name)"
|
||||
+ }
|
||||
+ -re ".*registers from core file: File in wrong format.* $" {
|
||||
+ fail "core-file command (could not read registers from core file)"
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+# Perform the "interesting" tests which check the contents of certain
|
||||
+# memory regions.
|
||||
+
|
||||
+proc do_tests { } {
|
||||
+ global xfail
|
||||
+
|
||||
+ # Check contents of beginning of buf_rw and buf_ro.
|
||||
+
|
||||
+ gdb_test {print/x buf_rw[0]@4} {\{0x6b, 0x6b, 0x6b, 0x6b\}}
|
||||
+ gdb_test {print/x buf_ro[0]@4} {\{0xc5, 0xc5, 0xc5, 0xc5\}}
|
||||
+
|
||||
+ # Check for correct contents at beginning of mbuf_rw and mbuf_ro.
|
||||
+
|
||||
+ gdb_test {print/x mbuf_rw[0]@4} {\{0x0, 0x0, 0x0, 0x0\}}
|
||||
+
|
||||
+ if { $xfail } { setup_xfail "*-*-*" }
|
||||
+ gdb_test {print/x mbuf_ro[0]@4} {\{0x0, 0x0, 0x0, 0x0\}}
|
||||
+
|
||||
+ # Check contents of mbuf_rw and mbuf_ro at the end of these regions.
|
||||
+
|
||||
+ gdb_test {print/x mbuf_rw[pagesize-4]@4} {\{0x0, 0x0, 0x0, 0x0\}}
|
||||
+
|
||||
+ if { $xfail } { setup_xfail "*-*-*" }
|
||||
+ gdb_test {print/x mbuf_ro[pagesize-4]@4} {\{0x0, 0x0, 0x0, 0x0\}}
|
||||
+
|
||||
+ # Check contents of mbuf_rw and mbuf_ro, right before the hole,
|
||||
+ # overlapping into the beginning of these mmap'd regions.
|
||||
+
|
||||
+ gdb_test {print/x mbuf_rw[-3]@6} {\{0x6b, 0x6b, 0x6b, 0x0, 0x0, 0x0\}}
|
||||
+
|
||||
+ if { $xfail } { setup_xfail "*-*-*" }
|
||||
+ gdb_test {print/x mbuf_ro[-3]@6} {\{0xc5, 0xc5, 0xc5, 0x0, 0x0, 0x0\}}
|
||||
+
|
||||
+ # Likewise, at the end of the mbuf_rw and mbuf_ro, with overlap.
|
||||
+
|
||||
+ # If this test FAILs, it's probably a genuine bug unrelated to whether
|
||||
+ # the core file includes a section describing memory address to file
|
||||
+ # mappings or not. (So don't xfail it!)
|
||||
+ gdb_test {print/x mbuf_rw[pagesize-3]@6} {\{0x0, 0x0, 0x0, 0x6b, 0x6b, 0x6b\}}
|
||||
+
|
||||
+ if { $xfail } { setup_xfail "*-*-*" }
|
||||
+ gdb_test {print/x mbuf_ro[pagesize-3]@6} {\{0x0, 0x0, 0x0, 0xc5, 0xc5, 0xc5\}}
|
||||
+
|
||||
+ # Check contents of (what should be) buf_rw and buf_ro immediately after
|
||||
+ # mbuf_rw and mbuf_ro holes.
|
||||
+
|
||||
+ gdb_test {print/x mbuf_rw[pagesize]@4} {\{0x6b, 0x6b, 0x6b, 0x6b\}}
|
||||
+ gdb_test {print/x mbuf_ro[pagesize]@4} {\{0xc5, 0xc5, 0xc5, 0xc5\}}
|
||||
+
|
||||
+ # Check contents at ends of buf_rw and buf_rw.
|
||||
+
|
||||
+ gdb_test {print/x buf_rw[sizeof(buf_rw)-4]@4} {\{0x6b, 0x6b, 0x6b, 0x6b\}}
|
||||
+ gdb_test {print/x buf_ro[sizeof(buf_ro)-4]@4} {\{0xc5, 0xc5, 0xc5, 0xc5\}}
|
||||
+}
|
||||
+
|
||||
+# Run tests with kernel-produced core file.
|
||||
+
|
||||
+with_test_prefix "kernel core" {
|
||||
+ do_tests
|
||||
+}
|
||||
+
|
||||
+# Verify that "maint print core-file-backed-mappings" exists and does
|
||||
+# not crash GDB. If it produces any output at all, make sure that
|
||||
+# that output at least mentions binfile.
|
||||
+
|
||||
+set test "maint print core-file-backed-mappings"
|
||||
+gdb_test_multiple $test "" {
|
||||
+ -re ".*$binfile.*$gdb_prompt $" {
|
||||
+ pass $test
|
||||
+ }
|
||||
+ -re "^$test\[\r\n\]*$gdb_prompt $" {
|
||||
+ pass "$test (no output)"
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+# Restart and run to the abort call.
|
||||
+
|
||||
+clean_restart $binfile
|
||||
+
|
||||
+if ![runto_main] then {
|
||||
+ fail "can't run to main"
|
||||
+ return
|
||||
+}
|
||||
+
|
||||
+gdb_breakpoint [gdb_get_line_number "abort"]
|
||||
+gdb_continue_to_breakpoint "at abort"
|
||||
+
|
||||
+# Do not execute abort call; instead, invoke gcore command to make a
|
||||
+# gdb-produced core file.
|
||||
+
|
||||
+set corefile [standard_output_file gcore.test]
|
||||
+set core_supported [gdb_gcore_cmd "$corefile" "save a corefile"]
|
||||
+if {!$core_supported} {
|
||||
+ return
|
||||
+}
|
||||
+
|
||||
+# maint print-core-file-backed-mappings shouldn't produce any output
|
||||
+# when not debugging a core file.
|
||||
+
|
||||
+gdb_test_no_output "maint print core-file-backed-mappings" \
|
||||
+ "maint print core-file-backed-mapping with no core file"
|
||||
+
|
||||
+clean_restart $binfile
|
||||
+
|
||||
+set core_loaded [gdb_core_cmd "$corefile" "re-load generated corefile"]
|
||||
+if { $core_loaded == -1 } {
|
||||
+ # No use proceeding from here.
|
||||
+ return
|
||||
+}
|
||||
+
|
||||
+# Run tests using gcore-produced core file.
|
||||
+
|
||||
+with_test_prefix "gcore core" {
|
||||
+ do_tests
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.base/coremaker2.c b/gdb/testsuite/gdb.base/coremaker2.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/coremaker2.c
|
||||
@@ -0,0 +1,150 @@
|
||||
+/* Copyright 1992-2020 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/>. */
|
||||
+
|
||||
+/* This test has two large memory areas buf_rw and buf_ro.
|
||||
+
|
||||
+ buf_rw is written to by the program while buf_ro is initialized at
|
||||
+ compile / load time. Thus, when a core file is created, buf_rw's
|
||||
+ memory should reside in the core file, but buf_ro probably won't be.
|
||||
+ Instead, the contents of buf_ro are available from the executable.
|
||||
+
|
||||
+ Now, for the wrinkle: We create a one page read-only mapping over
|
||||
+ both of these areas. This will create a one page "hole" of all
|
||||
+ zeros in each area.
|
||||
+
|
||||
+ Will GDB be able to correctly read memory from each of the four
|
||||
+ (or six, if you count the regions on the other side of each hole)
|
||||
+ memory regions? */
|
||||
+
|
||||
+#include <stdio.h>
|
||||
+#include <sys/types.h>
|
||||
+#include <fcntl.h>
|
||||
+#include <sys/mman.h>
|
||||
+#include <signal.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <unistd.h>
|
||||
+#include <string.h>
|
||||
+#include <errno.h>
|
||||
+
|
||||
+/* These are globals so that we can find them easily when debugging
|
||||
+ the core file. */
|
||||
+long pagesize;
|
||||
+unsigned long long addr;
|
||||
+char *mbuf_ro;
|
||||
+char *mbuf_rw;
|
||||
+
|
||||
+/* 24 KiB buffer. */
|
||||
+char buf_rw[24 * 1024];
|
||||
+
|
||||
+/* 24 KiB worth of data. For this test case, we can't allocate a
|
||||
+ buffer and then fill it; we want GDB to have to read this data
|
||||
+ from the executable; it should NOT find it in the core file. */
|
||||
+
|
||||
+#define C5_16 \
|
||||
+ 0xc5, 0xc5, 0xc5, 0xc5, \
|
||||
+ 0xc5, 0xc5, 0xc5, 0xc5, \
|
||||
+ 0xc5, 0xc5, 0xc5, 0xc5, \
|
||||
+ 0xc5, 0xc5, 0xc5, 0xc5
|
||||
+
|
||||
+#define C5_256 \
|
||||
+ C5_16, C5_16, C5_16, C5_16, \
|
||||
+ C5_16, C5_16, C5_16, C5_16, \
|
||||
+ C5_16, C5_16, C5_16, C5_16, \
|
||||
+ C5_16, C5_16, C5_16, C5_16
|
||||
+
|
||||
+#define C5_1k \
|
||||
+ C5_256, C5_256, C5_256, C5_256
|
||||
+
|
||||
+#define C5_24k \
|
||||
+ C5_1k, C5_1k, C5_1k, C5_1k, \
|
||||
+ C5_1k, C5_1k, C5_1k, C5_1k, \
|
||||
+ C5_1k, C5_1k, C5_1k, C5_1k, \
|
||||
+ C5_1k, C5_1k, C5_1k, C5_1k, \
|
||||
+ C5_1k, C5_1k, C5_1k, C5_1k, \
|
||||
+ C5_1k, C5_1k, C5_1k, C5_1k
|
||||
+
|
||||
+const char buf_ro[] = { C5_24k };
|
||||
+
|
||||
+int
|
||||
+main (int argc, char **argv)
|
||||
+{
|
||||
+ int i, bitcount;
|
||||
+
|
||||
+#ifdef _SC_PAGESIZE
|
||||
+ pagesize = sysconf (_SC_PAGESIZE);
|
||||
+#else
|
||||
+ pagesize = 8192;
|
||||
+#endif
|
||||
+
|
||||
+ /* Verify that pagesize is a power of 2. */
|
||||
+ bitcount = 0;
|
||||
+ for (i = 0; i < 4 * sizeof (pagesize); i++)
|
||||
+ if (pagesize & (1 << i))
|
||||
+ bitcount++;
|
||||
+
|
||||
+ if (bitcount != 1)
|
||||
+ {
|
||||
+ fprintf (stderr, "pagesize is not a power of 2.\n");
|
||||
+ exit (1);
|
||||
+ }
|
||||
+
|
||||
+ /* Compute an address that should be within buf_ro. Complain if not. */
|
||||
+ addr = ((unsigned long long) buf_ro + pagesize) & ~(pagesize - 1);
|
||||
+
|
||||
+ if (addr <= (unsigned long long) buf_ro
|
||||
+ || addr >= (unsigned long long) buf_ro + sizeof (buf_ro))
|
||||
+ {
|
||||
+ fprintf (stderr, "Unable to compute a suitable address within buf_ro.\n");
|
||||
+ exit (1);
|
||||
+ }
|
||||
+
|
||||
+ mbuf_ro = mmap ((void *) addr, pagesize, PROT_READ,
|
||||
+ MAP_ANONYMOUS | MAP_PRIVATE | MAP_FIXED, -1, 0);
|
||||
+
|
||||
+ if (mbuf_ro == MAP_FAILED)
|
||||
+ {
|
||||
+ fprintf (stderr, "mmap #1 failed: %s.\n", strerror (errno));
|
||||
+ exit (1);
|
||||
+ }
|
||||
+
|
||||
+ /* Write (and fill) the R/W region. */
|
||||
+ for (i = 0; i < sizeof (buf_rw); i++)
|
||||
+ buf_rw[i] = 0x6b;
|
||||
+
|
||||
+ /* Compute an mmap address within buf_rw. Complain if it's somewhere
|
||||
+ else. */
|
||||
+ addr = ((unsigned long long) buf_rw + pagesize) & ~(pagesize - 1);
|
||||
+
|
||||
+ if (addr <= (unsigned long long) buf_rw
|
||||
+ || addr >= (unsigned long long) buf_rw + sizeof (buf_rw))
|
||||
+ {
|
||||
+ fprintf (stderr, "Unable to compute a suitable address within buf_rw.\n");
|
||||
+ exit (1);
|
||||
+ }
|
||||
+
|
||||
+ mbuf_rw = mmap ((void *) addr, pagesize, PROT_READ,
|
||||
+ MAP_ANONYMOUS | MAP_PRIVATE | MAP_FIXED, -1, 0);
|
||||
+
|
||||
+ if (mbuf_rw == MAP_FAILED)
|
||||
+ {
|
||||
+ fprintf (stderr, "mmap #2 failed: %s.\n", strerror (errno));
|
||||
+ exit (1);
|
||||
+ }
|
||||
+
|
||||
+ /* With correct ulimit, etc. this should cause a core dump. */
|
||||
+ abort ();
|
||||
+}
|
|
@ -1,30 +0,0 @@
|
|||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Keith Seitz <keiths@redhat.com>
|
||||
Date: Tue, 28 Jul 2020 09:49:56 -0400
|
||||
Subject: gdb-rhbz1842691-corefile-mem-access-15of15.patch
|
||||
|
||||
;; Add period to help text for maint print core-file-backed-mappings
|
||||
;; Kevin Buettner, RH BZ 1842961
|
||||
|
||||
Author: Kevin Buettner <kevinb@redhat.com>
|
||||
Date: Thu Jul 23 13:26:44 2020 -0700
|
||||
|
||||
Fix BZ 26294 - Add period to help text for maint print core-file-backed-mappings
|
||||
|
||||
gdb/ChangeLog:
|
||||
|
||||
PR corefiles/26294
|
||||
* corelow.c (_initialize_corelow): Add period to help text
|
||||
for "maintenance print core-file-backed-mappings".
|
||||
|
||||
diff --git a/gdb/corelow.c b/gdb/corelow.c
|
||||
--- a/gdb/corelow.c
|
||||
+++ b/gdb/corelow.c
|
||||
@@ -1388,6 +1388,6 @@ Show whether CORE-FILE loads the build-id associated files automatically."),
|
||||
&setlist, &showlist);
|
||||
add_cmd ("core-file-backed-mappings", class_maintenance,
|
||||
maintenance_print_core_file_backed_mappings,
|
||||
- _("Print core file's file-backed mappings"),
|
||||
+ _("Print core file's file-backed mappings."),
|
||||
&maintenanceprintlist);
|
||||
}
|
|
@ -1,60 +0,0 @@
|
|||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Keith Seitz <keiths@redhat.com>
|
||||
Date: Mon, 27 Jul 2020 16:34:37 -0400
|
||||
Subject: gdb-rhbz1842691-corefile-mem-access-1of15.patch
|
||||
|
||||
;; Remove hack for GDB which sets the section size to 0
|
||||
;; Kevin Buettner, RH BZ 1842691
|
||||
|
||||
Author: Kevin Buettner <kevinb@redhat.com>
|
||||
|
||||
Remove hack for GDB which sets the section size to 0
|
||||
|
||||
This commit removes a hack for GDB which was introduced in 2007.
|
||||
See:
|
||||
|
||||
https://sourceware.org/ml/binutils/2007-08/msg00044.html
|
||||
|
||||
That hack mostly allowed GDB's handling of core files to continue to
|
||||
work without any changes to GDB.
|
||||
|
||||
The problem with setting the section size to zero is that GDB won't
|
||||
know how big that section is/was. Often, this doesn't matter because
|
||||
the data in question are found in the exec file. But it can happen
|
||||
that the section describes memory that had been allocated, but never
|
||||
written to. In this instance, the contents of that memory region are
|
||||
not written to the core file. Also, since the region in question was
|
||||
dynamically allocated, it won't appear in the exec file. We don't
|
||||
want these regions to appear as inaccessible to GDB (since they *were*
|
||||
accessible when the process was live), so it's important that GDB know
|
||||
the size of the region.
|
||||
|
||||
I've made changes to GDB which correctly handles this case. When
|
||||
attempting to access memory, GDB will first consider core file data
|
||||
for which both SEC_ALLOC and SEC_HAS_CONTENTS is set. Next, if that
|
||||
fails, GDB will attempt to find the data in the exec file. Finally,
|
||||
if that also fails, GDB will attempt to access memory in the sections
|
||||
which are flagged as SEC_ALLOC, but not SEC_HAS_CONTENTS.
|
||||
|
||||
bfd/ChangeLog:
|
||||
|
||||
* elf.c (_bfd_elf_make_section_from_phdr): Remove hack for GDB.
|
||||
|
||||
diff --git a/bfd/elf.c b/bfd/elf.c
|
||||
--- a/bfd/elf.c
|
||||
+++ b/bfd/elf.c
|
||||
@@ -2975,14 +2975,6 @@ _bfd_elf_make_section_from_phdr (bfd *abfd,
|
||||
newsect->alignment_power = bfd_log2 (align);
|
||||
if (hdr->p_type == PT_LOAD)
|
||||
{
|
||||
- /* Hack for gdb. Segments that have not been modified do
|
||||
- not have their contents written to a core file, on the
|
||||
- assumption that a debugger can find the contents in the
|
||||
- executable. We flag this case by setting the fake
|
||||
- section size to zero. Note that "real" bss sections will
|
||||
- always have their contents dumped to the core file. */
|
||||
- if (bfd_get_format (abfd) == bfd_core)
|
||||
- newsect->size = 0;
|
||||
newsect->flags |= SEC_ALLOC;
|
||||
if (hdr->p_flags & PF_X)
|
||||
newsect->flags |= SEC_CODE;
|
|
@ -1,129 +0,0 @@
|
|||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Keith Seitz <keiths@redhat.com>
|
||||
Date: Mon, 27 Jul 2020 16:47:19 -0400
|
||||
Subject: gdb-rhbz1842691-corefile-mem-access-2of15.patch
|
||||
|
||||
;; Adjust corefile.exp test to show regression after bfd hack removal
|
||||
;; Kevin Buettner, RH BZ 1842691
|
||||
|
||||
Author: Kevin Buettner <kevinb@redhat.com>
|
||||
Date: Tue May 12 17:44:19 2020 -0700
|
||||
|
||||
Adjust corefile.exp test to show regression after bfd hack removal
|
||||
|
||||
In his review of my BZ 25631 patch series, Pedro was unable to
|
||||
reproduce the regression which should occur after patch #1, "Remove
|
||||
hack for GDB which sets the section size to 0", is applied.
|
||||
|
||||
Pedro was using an ld version older than 2.30. Version 2.30
|
||||
introduced the linker option -z separate-code. Here's what the man
|
||||
page has to say about it:
|
||||
|
||||
Create separate code "PT_LOAD" segment header in the object. This
|
||||
specifies a memory segment that should contain only instructions
|
||||
and must be in wholly disjoint pages from any other data.
|
||||
|
||||
In ld version 2.31, use of separate-code became the default for
|
||||
Linux/x86. So, really, 2.31 or later is required in order to see the
|
||||
regression that occurs in recent Linux distributions when only the
|
||||
bfd hack removal patch is applied.
|
||||
|
||||
For the test case in question, use of the separate-code linker option
|
||||
means that the global variable "coremaker_ro" ends up in a separate
|
||||
load segment (though potentially with other read-only data). The
|
||||
upshot of this is that when only patch #1 is applied, GDB won't be
|
||||
able to correctly access coremaker_ro. The reason for this is due
|
||||
to the fact that this section will now have a non-zero size, but
|
||||
will not have contents from the core file to find this data.
|
||||
So GDB will ask BFD for the contents and BFD will respond with
|
||||
zeroes for anything from those sections. GDB should instead be
|
||||
looking in the executable for this data. Failing that, it can
|
||||
then ask BFD for a reasonable value. This is what a later patch
|
||||
in this series does.
|
||||
|
||||
When using ld versions earlier than 2.31 (or 2.30 w/ the
|
||||
-z separate-code option explicitly provided to the linker), there is
|
||||
the possibility that coremaker_ro ends up being placed near other data
|
||||
which is recorded in the core file. That means that the correct value
|
||||
will end up in the core file, simply because it resides on a page that
|
||||
the kernel chooses to put in the core file. This is why Pedro wasn't
|
||||
able to reproduce the regression that should occur after fixing the
|
||||
BFD hack.
|
||||
|
||||
This patch places a big chunk of memory, two pages worth on x86, in
|
||||
front of "coremaker_ro" to attempt to force it onto another page
|
||||
without requiring use of that new-fangled linker switch.
|
||||
|
||||
Speaking of which, I considered changing the test to use
|
||||
-z separate-code, but this won't work because it didn't
|
||||
exist prior to version 2.30. The linker would probably complain
|
||||
of an unrecognized switch. Also, it likely won't be available in
|
||||
other linkers not based on current binutils. I.e. it probably won't
|
||||
work in FreeBSD, NetBSD, etc.
|
||||
|
||||
To make this more concrete, this is what *should* happen when
|
||||
attempting to access coremaker_ro when only patch #1 is applied:
|
||||
|
||||
Core was generated by `/mesquite2/sourceware-git/f28-coresegs/bld/gdb/testsuite/outputs/gdb.base/coref'.
|
||||
Program terminated with signal SIGABRT, Aborted.
|
||||
#0 0x00007f68205deefb in raise () from /lib64/libc.so.6
|
||||
(gdb) p coremaker_ro
|
||||
$1 = 0
|
||||
|
||||
Note that this result is wrong; 201 should have been printed instead.
|
||||
But that's the point of the rest of the patch series.
|
||||
|
||||
However, without this commit, or when using an old Linux distro with
|
||||
a pre-2.31 ld, this is what you might see instead:
|
||||
|
||||
Core was generated by `/mesquite2/sourceware-git/f28-coresegs/bld/gdb/testsuite/outputs/gdb.base/coref'.
|
||||
Program terminated with signal SIGABRT, Aborted.
|
||||
#0 0x00007f63dd658efb in raise () from /lib64/libc.so.6
|
||||
(gdb) p coremaker_ro
|
||||
$1 = 201
|
||||
|
||||
I.e. it prints the right answer, which sort of makes it seem like the
|
||||
rest of the series isn't required.
|
||||
|
||||
Now, back to the patch itself... what should be the size of the memory
|
||||
chunk placed before coremaker_ro?
|
||||
|
||||
It needs to be at least as big as the page size (PAGE_SIZE) from
|
||||
the kernel. For x86 and several other architectures this value is
|
||||
4096. I used MAPSIZE which is defined to be 8192 in coremaker.c.
|
||||
So it's twice as big as what's currently needed for most Linux
|
||||
architectures. The constant PAGE_SIZE is available from <sys/user.h>,
|
||||
but this isn't portable either. In the end, it seemed simpler to
|
||||
just pick a value and hope that it's big enough. (Running a separate
|
||||
program which finds the page size via sysconf(_SC_PAGESIZE) and then
|
||||
passes it to the compilation via a -D switch seemed like overkill
|
||||
for a case which is rendered moot by recent linker versions.)
|
||||
|
||||
Further information can be found here:
|
||||
|
||||
https://sourceware.org/pipermail/gdb-patches/2020-May/168168.html
|
||||
https://sourceware.org/pipermail/gdb-patches/2020-May/168170.html
|
||||
|
||||
Thanks to H.J. Lu for telling me about the '-z separate-code' linker
|
||||
switch.
|
||||
|
||||
gdb/testsuite/ChangeLog:
|
||||
|
||||
* gdb.base/coremaker.c (filler_ro): New global constant.
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/coremaker.c b/gdb/testsuite/gdb.base/coremaker.c
|
||||
--- a/gdb/testsuite/gdb.base/coremaker.c
|
||||
+++ b/gdb/testsuite/gdb.base/coremaker.c
|
||||
@@ -42,6 +42,12 @@ char *buf2;
|
||||
int coremaker_data = 1; /* In Data section */
|
||||
int coremaker_bss; /* In BSS section */
|
||||
|
||||
+/* Place a chunk of memory before coremaker_ro to improve the chances
|
||||
+ that coremaker_ro will end up on it's own page. See:
|
||||
+
|
||||
+ https://sourceware.org/pipermail/gdb-patches/2020-May/168168.html
|
||||
+ https://sourceware.org/pipermail/gdb-patches/2020-May/168170.html */
|
||||
+const unsigned char filler_ro[MAPSIZE] = {1, 2, 3, 4, 5, 6, 7, 8};
|
||||
const int coremaker_ro = 201; /* In Read-Only Data section */
|
||||
|
||||
/* Note that if the mapping fails for any reason, we set buf2
|
|
@ -1,174 +0,0 @@
|
|||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Keith Seitz <keiths@redhat.com>
|
||||
Date: Mon, 27 Jul 2020 16:52:18 -0400
|
||||
Subject: gdb-rhbz1842691-corefile-mem-access-3of15.patch
|
||||
|
||||
;; section_table_xfer_memory: Replace section name with callback predicate
|
||||
;; Kevin Buettner, RH BZ 1842691
|
||||
|
||||
Author: Kevin Buettner <kevinb@redhat.com>
|
||||
Date: Wed Mar 4 17:42:41 2020 -0700
|
||||
|
||||
section_table_xfer_memory: Replace section name with callback predicate
|
||||
|
||||
This patch is motivated by the need to be able to select sections
|
||||
that section_table_xfer_memory_partial should consider for memory
|
||||
transfers. I'll use this facility in the next patch in this series.
|
||||
|
||||
section_table_xfer_memory_partial() can currently be passed a section
|
||||
name which may be used to make name-based selections. This is similar
|
||||
to what I want to do, except that I want to be able to consider
|
||||
section flags instead of the name.
|
||||
|
||||
I'm replacing the section name parameter with a predicate that,
|
||||
when passed a pointer to a target_section struct, will return
|
||||
true if that section should be further considered, or false which
|
||||
indicates that it shouldn't.
|
||||
|
||||
I've converted the one existing use where a non-NULL section
|
||||
name is passed to section_table_xfer_memory_partial(). Instead
|
||||
of passing the section name, it now looks like this:
|
||||
|
||||
auto match_cb = [=] (const struct target_section *s)
|
||||
{
|
||||
return (strcmp (section_name, s->the_bfd_section->name) == 0);
|
||||
};
|
||||
|
||||
return section_table_xfer_memory_partial (readbuf, writebuf,
|
||||
memaddr, len, xfered_len,
|
||||
table->sections,
|
||||
table->sections_end,
|
||||
match_cb);
|
||||
|
||||
The other callers all passed NULL; they've been simplified somewhat
|
||||
in that they no longer need to pass NULL.
|
||||
|
||||
gdb/ChangeLog:
|
||||
|
||||
* exec.h (section_table_xfer_memory): Revise declaration,
|
||||
replacing section name parameter with an optional callback
|
||||
predicate.
|
||||
* exec.c (section_table_xfer_memory): Likewise.
|
||||
* bfd-target.c, exec.c, target.c, corelow.c: Adjust all callers
|
||||
of section_table_xfer_memory.
|
||||
|
||||
diff --git a/gdb/bfd-target.c b/gdb/bfd-target.c
|
||||
--- a/gdb/bfd-target.c
|
||||
+++ b/gdb/bfd-target.c
|
||||
@@ -75,8 +75,7 @@ target_bfd::xfer_partial (target_object object,
|
||||
return section_table_xfer_memory_partial (readbuf, writebuf,
|
||||
offset, len, xfered_len,
|
||||
m_table.sections,
|
||||
- m_table.sections_end,
|
||||
- NULL);
|
||||
+ m_table.sections_end);
|
||||
}
|
||||
default:
|
||||
return TARGET_XFER_E_IO;
|
||||
diff --git a/gdb/corelow.c b/gdb/corelow.c
|
||||
--- a/gdb/corelow.c
|
||||
+++ b/gdb/corelow.c
|
||||
@@ -820,8 +820,7 @@ core_target::xfer_partial (enum target_object object, const char *annex,
|
||||
(readbuf, writebuf,
|
||||
offset, len, xfered_len,
|
||||
m_core_section_table.sections,
|
||||
- m_core_section_table.sections_end,
|
||||
- NULL));
|
||||
+ m_core_section_table.sections_end));
|
||||
|
||||
case TARGET_OBJECT_AUXV:
|
||||
if (readbuf)
|
||||
diff --git a/gdb/exec.c b/gdb/exec.c
|
||||
--- a/gdb/exec.c
|
||||
+++ b/gdb/exec.c
|
||||
@@ -805,7 +805,8 @@ section_table_xfer_memory_partial (gdb_byte *readbuf, const gdb_byte *writebuf,
|
||||
ULONGEST *xfered_len,
|
||||
struct target_section *sections,
|
||||
struct target_section *sections_end,
|
||||
- const char *section_name)
|
||||
+ gdb::function_view<bool
|
||||
+ (const struct target_section *)> match_cb)
|
||||
{
|
||||
int res;
|
||||
struct target_section *p;
|
||||
@@ -821,7 +822,7 @@ section_table_xfer_memory_partial (gdb_byte *readbuf, const gdb_byte *writebuf,
|
||||
struct bfd_section *asect = p->the_bfd_section;
|
||||
bfd *abfd = asect->owner;
|
||||
|
||||
- if (section_name && strcmp (section_name, asect->name) != 0)
|
||||
+ if (match_cb != nullptr && !match_cb (p))
|
||||
continue; /* not the section we need. */
|
||||
if (memaddr >= p->addr)
|
||||
{
|
||||
@@ -894,8 +895,7 @@ exec_target::xfer_partial (enum target_object object,
|
||||
return section_table_xfer_memory_partial (readbuf, writebuf,
|
||||
offset, len, xfered_len,
|
||||
table->sections,
|
||||
- table->sections_end,
|
||||
- NULL);
|
||||
+ table->sections_end);
|
||||
else
|
||||
return TARGET_XFER_E_IO;
|
||||
}
|
||||
diff --git a/gdb/exec.h b/gdb/exec.h
|
||||
--- a/gdb/exec.h
|
||||
+++ b/gdb/exec.h
|
||||
@@ -58,8 +58,13 @@ extern enum target_xfer_status
|
||||
Request to transfer up to LEN 8-bit bytes of the target sections
|
||||
defined by SECTIONS and SECTIONS_END. The OFFSET specifies the
|
||||
starting address.
|
||||
- If SECTION_NAME is not NULL, only access sections with that same
|
||||
- name.
|
||||
+
|
||||
+ The MATCH_CB predicate is optional; when provided it will be called
|
||||
+ for each section under consideration. When MATCH_CB evaluates as
|
||||
+ true, the section remains under consideration; a false result
|
||||
+ removes it from consideration for performing the memory transfers
|
||||
+ noted above. See memory_xfer_partial_1() in target.c for an
|
||||
+ example.
|
||||
|
||||
Return the number of bytes actually transfered, or zero when no
|
||||
data is available for the requested range.
|
||||
@@ -76,7 +81,9 @@ extern enum target_xfer_status
|
||||
ULONGEST, ULONGEST, ULONGEST *,
|
||||
struct target_section *,
|
||||
struct target_section *,
|
||||
- const char *);
|
||||
+ gdb::function_view<bool
|
||||
+ (const struct target_section *)> match_cb
|
||||
+ = nullptr);
|
||||
|
||||
/* Read from mappable read-only sections of BFD executable files.
|
||||
Similar to exec_read_partial_read_only, but return
|
||||
diff --git a/gdb/target.c b/gdb/target.c
|
||||
--- a/gdb/target.c
|
||||
+++ b/gdb/target.c
|
||||
@@ -1098,11 +1098,17 @@ memory_xfer_partial_1 (struct target_ops *ops, enum target_object object,
|
||||
const char *section_name = section->the_bfd_section->name;
|
||||
|
||||
memaddr = overlay_mapped_address (memaddr, section);
|
||||
+
|
||||
+ auto match_cb = [=] (const struct target_section *s)
|
||||
+ {
|
||||
+ return (strcmp (section_name, s->the_bfd_section->name) == 0);
|
||||
+ };
|
||||
+
|
||||
return section_table_xfer_memory_partial (readbuf, writebuf,
|
||||
memaddr, len, xfered_len,
|
||||
table->sections,
|
||||
table->sections_end,
|
||||
- section_name);
|
||||
+ match_cb);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1122,8 +1128,7 @@ memory_xfer_partial_1 (struct target_ops *ops, enum target_object object,
|
||||
return section_table_xfer_memory_partial (readbuf, writebuf,
|
||||
memaddr, len, xfered_len,
|
||||
table->sections,
|
||||
- table->sections_end,
|
||||
- NULL);
|
||||
+ table->sections_end);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,227 +0,0 @@
|
|||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Keith Seitz <keiths@redhat.com>
|
||||
Date: Mon, 27 Jul 2020 17:11:49 -0400
|
||||
Subject: gdb-rhbz1842691-corefile-mem-access-4of15.patch
|
||||
|
||||
;; Provide access to non SEC_HAS_CONTENTS core file sections
|
||||
;; Kevin Buettner, RH BZ 1842961
|
||||
|
||||
Author: Kevin Buettner <kevinb@redhat.com>
|
||||
Date: Wed Mar 4 17:42:42 2020 -0700
|
||||
|
||||
Provide access to non SEC_HAS_CONTENTS core file sections
|
||||
|
||||
Consider the following program:
|
||||
|
||||
- - - mkmmapcore.c - - -
|
||||
|
||||
static char *buf;
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
buf = mmap (NULL, 8192, PROT_READ | PROT_WRITE,
|
||||
MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
|
||||
abort ();
|
||||
}
|
||||
- - - end mkmmapcore.c - - -
|
||||
|
||||
Compile it like this:
|
||||
|
||||
gcc -g -o mkmmapcore mkmmapcore.c
|
||||
|
||||
Now let's run it from GDB. I've already placed a breakpoint on the
|
||||
line with the abort() call and have run to that breakpoint.
|
||||
|
||||
Breakpoint 1, main (argc=1, argv=0x7fffffffd678) at mkmmapcore.c:11
|
||||
11 abort ();
|
||||
(gdb) x/x buf
|
||||
0x7ffff7fcb000: 0x00000000
|
||||
|
||||
Note that we can examine the memory allocated via the call to mmap().
|
||||
|
||||
Now let's try debugging a core file created by running this program.
|
||||
Depending on your system, in order to make a core file, you may have to
|
||||
run the following as root (or using sudo):
|
||||
|
||||
echo core > /proc/sys/kernel/core_pattern
|
||||
|
||||
It may also be necessary to do:
|
||||
|
||||
ulimit -c unlimited
|
||||
|
||||
I'm using Fedora 31. YMMV if you're using one of the BSDs or some other
|
||||
(non-Linux) system.
|
||||
|
||||
This is what things look like when we debug the core file:
|
||||
|
||||
[kev@f31-1 tmp]$ gdb -q ./mkmmapcore core.304767
|
||||
Reading symbols from ./mkmmapcore...
|
||||
[New LWP 304767]
|
||||
Core was generated by `/tmp/mkmmapcore'.
|
||||
Program terminated with signal SIGABRT, Aborted.
|
||||
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
|
||||
50 return ret;
|
||||
(gdb) x/x buf
|
||||
0x7ffff7fcb000: Cannot access memory at address 0x7ffff7fcb000
|
||||
|
||||
Note that we can no longer access the memory region allocated by mmap().
|
||||
|
||||
Back in 2007, a hack for GDB was added to _bfd_elf_make_section_from_phdr()
|
||||
in bfd/elf.c:
|
||||
|
||||
/* Hack for gdb. Segments that have not been modified do
|
||||
not have their contents written to a core file, on the
|
||||
assumption that a debugger can find the contents in the
|
||||
executable. We flag this case by setting the fake
|
||||
section size to zero. Note that "real" bss sections will
|
||||
always have their contents dumped to the core file. */
|
||||
if (bfd_get_format (abfd) == bfd_core)
|
||||
newsect->size = 0;
|
||||
|
||||
You can find the entire patch plus links to other discussion starting
|
||||
here:
|
||||
|
||||
https://sourceware.org/ml/binutils/2007-08/msg00047.html
|
||||
|
||||
This hack sets the size of certain BFD sections to 0, which
|
||||
effectively causes GDB to ignore them. I think it's likely that the
|
||||
bug described above existed even before this hack was added, but I
|
||||
have no easy way to test this now.
|
||||
|
||||
The output from objdump -h shows the result of this hack:
|
||||
|
||||
25 load13 00000000 00007ffff7fcb000 0000000000000000 00013000 2**12
|
||||
ALLOC
|
||||
|
||||
(The first field, after load13, shows the size of 0.)
|
||||
|
||||
Once the hack is removed, the output from objdump -h shows the correct
|
||||
size:
|
||||
|
||||
25 load13 00002000 00007ffff7fcb000 0000000000000000 00013000 2**12
|
||||
ALLOC
|
||||
|
||||
(This is a digression, but I think it's good that objdump will now show
|
||||
the correct size.)
|
||||
|
||||
If we remove the hack from bfd/elf.c, but do nothing to GDB, we'll
|
||||
see the following regression:
|
||||
|
||||
FAIL: gdb.base/corefile.exp: print coremaker_ro
|
||||
|
||||
The reason for this is that all sections which have the BFD flag
|
||||
SEC_ALLOC set, but for which SEC_HAS_CONTENTS is not set no longer
|
||||
have zero size. Some of these sections have data that can (and should)
|
||||
be read from the executable. (Sections for which SEC_HAS_CONTENTS
|
||||
is set should be read from the core file; sections which do not have
|
||||
this flag set need to either be read from the executable or, failing
|
||||
that, from the core file using whatever BFD decides is the best value
|
||||
to present to the user - it uses zeros.)
|
||||
|
||||
At present, due to the way that the target strata are traversed when
|
||||
attempting to access memory, the non-SEC_HAS_CONTENTS sections will be
|
||||
read as zeroes from the process_stratum (which in this case is the
|
||||
core file stratum) without first checking the file stratum, which is
|
||||
where the data might actually be found.
|
||||
|
||||
What we should be doing is this:
|
||||
|
||||
- Attempt to access core file data for SEC_HAS_CONTENTS sections.
|
||||
- Attempt to access executable file data if the above fails.
|
||||
- Attempt to access core file data for non SEC_HAS_CONTENTS sections, if
|
||||
both of the above fail.
|
||||
|
||||
This corresponds to the analysis of Daniel Jacobowitz back in 2007
|
||||
when the hack was added to BFD:
|
||||
|
||||
https://sourceware.org/legacy-ml/binutils/2007-08/msg00045.html
|
||||
|
||||
The difference, observed by Pedro in his review of my v1 patches, is
|
||||
that I'm using "the section flags as proxy for the p_filesz/p_memsz
|
||||
checks."
|
||||
|
||||
gdb/ChangeLog:
|
||||
|
||||
PR corefiles/25631
|
||||
* corelow.c (core_target:xfer_partial): Revise
|
||||
TARGET_OBJECT_MEMORY case to consider non-SEC_HAS_CONTENTS
|
||||
case after first checking the stratum beneath the core
|
||||
target.
|
||||
(has_all_memory): Return true.
|
||||
* target.c (raw_memory_xfer_partial): Revise comment
|
||||
regarding use of has_all_memory.
|
||||
|
||||
diff --git a/gdb/corelow.c b/gdb/corelow.c
|
||||
--- a/gdb/corelow.c
|
||||
+++ b/gdb/corelow.c
|
||||
@@ -816,12 +816,47 @@ core_target::xfer_partial (enum target_object object, const char *annex,
|
||||
switch (object)
|
||||
{
|
||||
case TARGET_OBJECT_MEMORY:
|
||||
- return (section_table_xfer_memory_partial
|
||||
- (readbuf, writebuf,
|
||||
- offset, len, xfered_len,
|
||||
- m_core_section_table.sections,
|
||||
- m_core_section_table.sections_end));
|
||||
+ {
|
||||
+ enum target_xfer_status xfer_status;
|
||||
+
|
||||
+ /* Try accessing memory contents from core file data,
|
||||
+ restricting consideration to those sections for which
|
||||
+ the BFD section flag SEC_HAS_CONTENTS is set. */
|
||||
+ auto has_contents_cb = [] (const struct target_section *s)
|
||||
+ {
|
||||
+ return ((s->the_bfd_section->flags & SEC_HAS_CONTENTS) != 0);
|
||||
+ };
|
||||
+ xfer_status = section_table_xfer_memory_partial
|
||||
+ (readbuf, writebuf,
|
||||
+ offset, len, xfered_len,
|
||||
+ m_core_section_table.sections,
|
||||
+ m_core_section_table.sections_end,
|
||||
+ has_contents_cb);
|
||||
+ if (xfer_status == TARGET_XFER_OK)
|
||||
+ return TARGET_XFER_OK;
|
||||
+
|
||||
+ /* Now check the stratum beneath us; this should be file_stratum. */
|
||||
+ xfer_status = this->beneath ()->xfer_partial (object, annex, readbuf,
|
||||
+ writebuf, offset, len,
|
||||
+ xfered_len);
|
||||
+ if (xfer_status == TARGET_XFER_OK)
|
||||
+ return TARGET_XFER_OK;
|
||||
|
||||
+ /* Finally, attempt to access data in core file sections with
|
||||
+ no contents. These will typically read as all zero. */
|
||||
+ auto no_contents_cb = [&] (const struct target_section *s)
|
||||
+ {
|
||||
+ return !has_contents_cb (s);
|
||||
+ };
|
||||
+ xfer_status = section_table_xfer_memory_partial
|
||||
+ (readbuf, writebuf,
|
||||
+ offset, len, xfered_len,
|
||||
+ m_core_section_table.sections,
|
||||
+ m_core_section_table.sections_end,
|
||||
+ no_contents_cb);
|
||||
+
|
||||
+ return xfer_status;
|
||||
+ }
|
||||
case TARGET_OBJECT_AUXV:
|
||||
if (readbuf)
|
||||
{
|
||||
diff --git a/gdb/target.c b/gdb/target.c
|
||||
--- a/gdb/target.c
|
||||
+++ b/gdb/target.c
|
||||
@@ -1043,8 +1043,11 @@ raw_memory_xfer_partial (struct target_ops *ops, gdb_byte *readbuf,
|
||||
if (res == TARGET_XFER_UNAVAILABLE)
|
||||
break;
|
||||
|
||||
- /* We want to continue past core files to executables, but not
|
||||
- past a running target's memory. */
|
||||
+ /* Don't continue past targets which have all the memory.
|
||||
+ At one time, this code was necessary to read data from
|
||||
+ executables / shared libraries when data for the requested
|
||||
+ addresses weren't available in the core file. But now the
|
||||
+ core target handles this case itself. */
|
||||
if (ops->has_all_memory ())
|
||||
break;
|
||||
|
|
@ -1,68 +0,0 @@
|
|||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Keith Seitz <keiths@redhat.com>
|
||||
Date: Mon, 27 Jul 2020 17:27:39 -0400
|
||||
Subject: gdb-rhbz1842691-corefile-mem-access-5of15.patch
|
||||
|
||||
;; Test ability to access unwritten-to mmap data in core file
|
||||
;; Kevin Buettner, RH BZ 1842961
|
||||
|
||||
Author: Kevin Buettner <kevinb@redhat.com>
|
||||
Date: Wed Mar 4 17:42:43 2020 -0700
|
||||
|
||||
Test ability to access unwritten-to mmap data in core file
|
||||
|
||||
gdb/testsuite/ChangeLog:
|
||||
|
||||
PR corefiles/25631
|
||||
* gdb.base/corefile.exp (accessing anonymous, unwritten-to mmap data):
|
||||
New test.
|
||||
* gdb.base/coremaker.c (buf3): New global.
|
||||
(mmapdata): Add mmap call which uses MAP_ANONYMOUS and MAP_PRIVATE
|
||||
flags.
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/corefile.exp b/gdb/testsuite/gdb.base/corefile.exp
|
||||
--- a/gdb/testsuite/gdb.base/corefile.exp
|
||||
+++ b/gdb/testsuite/gdb.base/corefile.exp
|
||||
@@ -175,6 +175,15 @@ gdb_test_multiple "x/8bd buf2" "$test" {
|
||||
}
|
||||
}
|
||||
|
||||
+# Test ability to read anonymous and, more importantly, unwritten-to
|
||||
+# mmap'd data.
|
||||
+
|
||||
+if { ![istarget *-linux*] } {
|
||||
+ setup_xfail "*-*-*"
|
||||
+}
|
||||
+gdb_test "x/wx buf3" "$hex:\[ \t\]+0x00000000" \
|
||||
+ "accessing anonymous, unwritten-to mmap data"
|
||||
+
|
||||
# test reinit_frame_cache
|
||||
|
||||
gdb_load ${binfile}
|
||||
diff --git a/gdb/testsuite/gdb.base/coremaker.c b/gdb/testsuite/gdb.base/coremaker.c
|
||||
--- a/gdb/testsuite/gdb.base/coremaker.c
|
||||
+++ b/gdb/testsuite/gdb.base/coremaker.c
|
||||
@@ -38,6 +38,7 @@
|
||||
|
||||
char *buf1;
|
||||
char *buf2;
|
||||
+char *buf3;
|
||||
|
||||
int coremaker_data = 1; /* In Data section */
|
||||
int coremaker_bss; /* In BSS section */
|
||||
@@ -104,6 +105,15 @@ mmapdata ()
|
||||
}
|
||||
/* Touch buf2 so kernel writes it out into 'core'. */
|
||||
buf2[0] = buf1[0];
|
||||
+
|
||||
+ /* Create yet another region which is allocated, but not written to. */
|
||||
+ buf3 = mmap (NULL, MAPSIZE, PROT_READ | PROT_WRITE,
|
||||
+ MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
|
||||
+ if (buf3 == (char *) -1)
|
||||
+ {
|
||||
+ perror ("mmap failed");
|
||||
+ return;
|
||||
+ }
|
||||
}
|
||||
|
||||
void
|
|
@ -1,62 +0,0 @@
|
|||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Keith Seitz <keiths@redhat.com>
|
||||
Date: Mon, 27 Jul 2020 17:32:50 -0400
|
||||
Subject: gdb-rhbz1842691-corefile-mem-access-6of15.patch
|
||||
|
||||
;; Update binary_get_section_contents to seek using section's file position
|
||||
;; Kevin Buettner, RH BZ 1842961
|
||||
|
||||
Author: Kevin Buettner <kevinb@redhat.com>
|
||||
Date: Thu Jun 11 18:58:49 2020 -0700
|
||||
|
||||
Update binary_get_section_contents to seek using section's file position
|
||||
|
||||
I have a patch for GDB which opens and reads from BFDs using the
|
||||
"binary" target. However, for it to work, we need to be able to get a
|
||||
section's contents based from the file position of that section.
|
||||
|
||||
At the moment, reading a section's contents will always read from the
|
||||
start of the file regardless of where that section is located. While
|
||||
this was fine for the original use of the "binary" target, it won't
|
||||
work for my use case. This change shouldn't impact any existing
|
||||
callers due to the fact that the single .data section is initialized
|
||||
with a filepos of 0.
|
||||
|
||||
bfd/ChangeLog:
|
||||
|
||||
* binary.c (binary_get_section_contents): Seek using offset
|
||||
from section's file position.
|
||||
|
||||
diff --git a/bfd/binary.c b/bfd/binary.c
|
||||
--- a/bfd/binary.c
|
||||
+++ b/bfd/binary.c
|
||||
@@ -19,10 +19,10 @@
|
||||
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
|
||||
MA 02110-1301, USA. */
|
||||
|
||||
-/* This is a BFD backend which may be used to write binary objects.
|
||||
- It may only be used for output, not input. The intention is that
|
||||
- this may be used as an output format for objcopy in order to
|
||||
- generate raw binary data.
|
||||
+/* This is a BFD backend which may be used to read or write binary
|
||||
+ objects. Historically, it was used as an output format for objcopy
|
||||
+ in order to generate raw binary data, but is now used for other
|
||||
+ purposes as well.
|
||||
|
||||
This is very simple. The only complication is that the real data
|
||||
will start at some address X, and in some cases we will not want to
|
||||
@@ -97,12 +97,12 @@ binary_object_p (bfd *abfd)
|
||||
|
||||
static bfd_boolean
|
||||
binary_get_section_contents (bfd *abfd,
|
||||
- asection *section ATTRIBUTE_UNUSED,
|
||||
+ asection *section,
|
||||
void * location,
|
||||
file_ptr offset,
|
||||
bfd_size_type count)
|
||||
{
|
||||
- if (bfd_seek (abfd, offset, SEEK_SET) != 0
|
||||
+ if (bfd_seek (abfd, section->filepos + offset, SEEK_SET) != 0
|
||||
|| bfd_bread (location, count, abfd) != count)
|
||||
return FALSE;
|
||||
return TRUE;
|
|
@ -1,180 +0,0 @@
|
|||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Keith Seitz <keiths@redhat.com>
|
||||
Date: Mon, 27 Jul 2020 18:01:32 -0400
|
||||
Subject: gdb-rhbz1842691-corefile-mem-access-7of15.patch
|
||||
|
||||
;; Add new gdbarch method, read_core_file_mappings
|
||||
;; Kevin Buettner, RH BZ 1842961
|
||||
|
||||
Author: Kevin Buettner <kevinb@redhat.com>
|
||||
Date: Fri Jul 3 13:32:08 2020 -0700
|
||||
|
||||
Add new gdbarch method, read_core_file_mappings
|
||||
|
||||
The new gdbarch method, read_core_file_mappings, will be used for
|
||||
reading file-backed mappings from a core file. It'll be used
|
||||
for two purposes: 1) to construct a table of file-backed mappings
|
||||
in corelow.c, and 2) for display of core file mappings.
|
||||
|
||||
For Linux, I tried a different approach in which knowledge of the note
|
||||
format was placed directly in corelow.c. This seemed okay at first;
|
||||
it was only one note format and the note format was fairly simple.
|
||||
After looking at FreeBSD's note/mapping reading code, I concluded
|
||||
that it's best to leave architecture specific details for decoding
|
||||
the note in (architecture specific) tdep files.
|
||||
|
||||
With regard to display of core file mappings, I experimented with
|
||||
placing the mappings display code in corelow.c. It has access to the
|
||||
file-backed mappings which were read in when the core file was loaded.
|
||||
And, better, still common code could be used for all architectures.
|
||||
But, again, the FreeBSD mapping code convinced me that this was not
|
||||
the best approach since it has even more mapping info than Linux.
|
||||
Display code which would work well for Linux will leave out mappings
|
||||
as well as protection info for mappings.
|
||||
|
||||
So, for these reasons, I'm introducing a new gdbarch method for
|
||||
reading core file mappings.
|
||||
|
||||
gdb/ChangeLog:
|
||||
|
||||
* arch-utils.c (default_read_core_file_mappings): New function.
|
||||
* arch-utils.c (default_read_core_file_mappings): Declare.
|
||||
* gdbarch.sh (read_core_file_mappings): New gdbarch method.
|
||||
* gdbarch.h, gdbarch.c: Regenerate.
|
||||
|
||||
diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c
|
||||
--- a/gdb/arch-utils.c
|
||||
+++ b/gdb/arch-utils.c
|
||||
@@ -997,6 +997,22 @@ default_type_align (struct gdbarch *gdbarch, struct type *type)
|
||||
return type_length_units (check_typedef (type));
|
||||
}
|
||||
|
||||
+/* See arch-utils.h. */
|
||||
+void
|
||||
+default_read_core_file_mappings (struct gdbarch *gdbarch,
|
||||
+ struct bfd *cbfd,
|
||||
+ gdb::function_view<void (ULONGEST count)>
|
||||
+ pre_loop_cb,
|
||||
+ gdb::function_view<void (int num,
|
||||
+ ULONGEST start,
|
||||
+ ULONGEST end,
|
||||
+ ULONGEST file_ofs,
|
||||
+ const char *filename,
|
||||
+ const void *other)>
|
||||
+ loop_cb)
|
||||
+{
|
||||
+}
|
||||
+
|
||||
void
|
||||
_initialize_gdbarch_utils (void)
|
||||
{
|
||||
diff --git a/gdb/arch-utils.h b/gdb/arch-utils.h
|
||||
--- a/gdb/arch-utils.h
|
||||
+++ b/gdb/arch-utils.h
|
||||
@@ -271,4 +271,16 @@ extern bool default_in_indirect_branch_thunk (gdbarch *gdbarch,
|
||||
extern ULONGEST default_type_align (struct gdbarch *gdbarch,
|
||||
struct type *type);
|
||||
|
||||
+/* Default implementation of gdbarch read_core_file_mappings method. */
|
||||
+extern void default_read_core_file_mappings (struct gdbarch *gdbarch,
|
||||
+ struct bfd *cbfd,
|
||||
+ gdb::function_view<void (ULONGEST count)>
|
||||
+ pre_loop_cb,
|
||||
+ gdb::function_view<void (int num,
|
||||
+ ULONGEST start,
|
||||
+ ULONGEST end,
|
||||
+ ULONGEST file_ofs,
|
||||
+ const char *filename,
|
||||
+ const void *other)>
|
||||
+ loop_cb);
|
||||
#endif
|
||||
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
|
||||
--- a/gdb/gdbarch.c
|
||||
+++ b/gdb/gdbarch.c
|
||||
@@ -354,6 +354,7 @@ struct gdbarch
|
||||
char ** disassembler_options;
|
||||
const disasm_options_and_args_t * valid_disassembler_options;
|
||||
gdbarch_type_align_ftype *type_align;
|
||||
+ gdbarch_read_core_file_mappings_ftype *read_core_file_mappings;
|
||||
};
|
||||
|
||||
/* Create a new ``struct gdbarch'' based on information provided by
|
||||
@@ -466,6 +467,7 @@ gdbarch_alloc (const struct gdbarch_info *info,
|
||||
gdbarch->gnu_triplet_regexp = default_gnu_triplet_regexp;
|
||||
gdbarch->addressable_memory_unit_size = default_addressable_memory_unit_size;
|
||||
gdbarch->type_align = default_type_align;
|
||||
+ gdbarch->read_core_file_mappings = default_read_core_file_mappings;
|
||||
/* gdbarch_alloc() */
|
||||
|
||||
return gdbarch;
|
||||
@@ -712,6 +714,7 @@ verify_gdbarch (struct gdbarch *gdbarch)
|
||||
/* Skip verify of disassembler_options, invalid_p == 0 */
|
||||
/* Skip verify of valid_disassembler_options, invalid_p == 0 */
|
||||
/* Skip verify of type_align, invalid_p == 0 */
|
||||
+ /* Skip verify of read_core_file_mappings, invalid_p == 0 */
|
||||
if (!log.empty ())
|
||||
internal_error (__FILE__, __LINE__,
|
||||
_("verify_gdbarch: the following are invalid ...%s"),
|
||||
@@ -1275,6 +1278,9 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
|
||||
fprintf_unfiltered (file,
|
||||
"gdbarch_dump: ravenscar_ops = %s\n",
|
||||
host_address_to_string (gdbarch->ravenscar_ops));
|
||||
+ fprintf_unfiltered (file,
|
||||
+ "gdbarch_dump: read_core_file_mappings = <%s>\n",
|
||||
+ host_address_to_string (gdbarch->read_core_file_mappings));
|
||||
fprintf_unfiltered (file,
|
||||
"gdbarch_dump: gdbarch_read_pc_p() = %d\n",
|
||||
gdbarch_read_pc_p (gdbarch));
|
||||
@@ -5117,6 +5123,23 @@ set_gdbarch_type_align (struct gdbarch *gdbarch,
|
||||
gdbarch->type_align = type_align;
|
||||
}
|
||||
|
||||
+void
|
||||
+gdbarch_read_core_file_mappings (struct gdbarch *gdbarch, struct bfd *cbfd,gdb::function_view<void (ULONGEST count)> pre_loop_cb,gdb::function_view<void (int num, ULONGEST start, ULONGEST end, ULONGEST file_ofs, const char *filename, const void *other)> loop_cb)
|
||||
+{
|
||||
+ gdb_assert (gdbarch != NULL);
|
||||
+ gdb_assert (gdbarch->read_core_file_mappings != NULL);
|
||||
+ if (gdbarch_debug >= 2)
|
||||
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_read_core_file_mappings called\n");
|
||||
+ gdbarch->read_core_file_mappings (gdbarch, cbfd, pre_loop_cb, loop_cb);
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+set_gdbarch_read_core_file_mappings (struct gdbarch *gdbarch,
|
||||
+ gdbarch_read_core_file_mappings_ftype read_core_file_mappings)
|
||||
+{
|
||||
+ gdbarch->read_core_file_mappings = read_core_file_mappings;
|
||||
+}
|
||||
+
|
||||
|
||||
/* Keep a registry of per-architecture data-pointers required by GDB
|
||||
modules. */
|
||||
diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h
|
||||
--- a/gdb/gdbarch.h
|
||||
+++ b/gdb/gdbarch.h
|
||||
@@ -1566,6 +1566,12 @@ typedef ULONGEST (gdbarch_type_align_ftype) (struct gdbarch *gdbarch, struct typ
|
||||
extern ULONGEST gdbarch_type_align (struct gdbarch *gdbarch, struct type *type);
|
||||
extern void set_gdbarch_type_align (struct gdbarch *gdbarch, gdbarch_type_align_ftype *type_align);
|
||||
|
||||
+/* Read core file mappings */
|
||||
+
|
||||
+typedef void (gdbarch_read_core_file_mappings_ftype) (struct gdbarch *gdbarch, struct bfd *cbfd,gdb::function_view<void (ULONGEST count)> pre_loop_cb,gdb::function_view<void (int num, ULONGEST start, ULONGEST end, ULONGEST file_ofs, const char *filename, const void *other)> loop_cb);
|
||||
+extern void gdbarch_read_core_file_mappings (struct gdbarch *gdbarch, struct bfd *cbfd,gdb::function_view<void (ULONGEST count)> pre_loop_cb,gdb::function_view<void (int num, ULONGEST start, ULONGEST end, ULONGEST file_ofs, const char *filename, const void *other)> loop_cb);
|
||||
+extern void set_gdbarch_read_core_file_mappings (struct gdbarch *gdbarch, gdbarch_read_core_file_mappings_ftype *read_core_file_mappings);
|
||||
+
|
||||
/* Definition for an unknown syscall, used basically in error-cases. */
|
||||
#define UNKNOWN_SYSCALL (-1)
|
||||
|
||||
diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh
|
||||
--- a/gdb/gdbarch.sh
|
||||
+++ b/gdb/gdbarch.sh
|
||||
@@ -1164,6 +1164,9 @@ v;const disasm_options_and_args_t *;valid_disassembler_options;;;0;0;;0;host_add
|
||||
# Type alignment.
|
||||
m;ULONGEST;type_align;struct type *type;type;;default_type_align;;0
|
||||
|
||||
+# Read core file mappings
|
||||
+m;void;read_core_file_mappings;struct bfd *cbfd,gdb::function_view<void (ULONGEST count)> pre_loop_cb,gdb::function_view<void (int num, ULONGEST start, ULONGEST end, ULONGEST file_ofs, const char *filename, const void *other)> loop_cb;cbfd, pre_loop_cb, loop_cb;;default_read_core_file_mappings;;0
|
||||
+
|
||||
EOF
|
||||
}
|
||||
|
|
@ -1,532 +0,0 @@
|
|||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Keith Seitz <keiths@redhat.com>
|
||||
Date: Mon, 27 Jul 2020 18:51:07 -0400
|
||||
Subject: gdb-rhbz1842691-corefile-mem-access-8of15.patch
|
||||
|
||||
;; Use NT_FILE note section for reading core target memory
|
||||
;; Kevin Buettner, RH BZ 1842961
|
||||
|
||||
Author: Kevin Buettner <kevinb@redhat.com>
|
||||
Date: Thu Jun 11 19:20:03 2020 -0700
|
||||
|
||||
Use NT_FILE note section for reading core target memory
|
||||
|
||||
In his reviews of my v1 and v2 corefile related patches, Pedro
|
||||
identified two cases which weren't handled by those patches.
|
||||
|
||||
In https://sourceware.org/pipermail/gdb-patches/2020-May/168826.html,
|
||||
Pedro showed that debugging a core file in which mmap() is used to
|
||||
create a new mapping over an existing file-backed mapping will
|
||||
produce incorrect results. I.e, for his example, GDB would
|
||||
show:
|
||||
|
||||
(gdb) disassemble main
|
||||
Dump of assembler code for function main:
|
||||
0x00000000004004e6 <+0>: push %rbp
|
||||
0x00000000004004e7 <+1>: mov %rsp,%rbp
|
||||
=> 0x00000000004004ea <+4>: callq 0x4003f0 <abort@plt>
|
||||
End of assembler dump.
|
||||
|
||||
This sort of looks like it might be correct, but is not due to the
|
||||
fact that mmap(...MAP_FIXED...) was used to create a mapping (of all
|
||||
zeros) on top of the .text section. So, the correct result should be:
|
||||
|
||||
(gdb) disassemble main
|
||||
Dump of assembler code for function main:
|
||||
0x00000000004004e6 <+0>: add %al,(%rax)
|
||||
0x00000000004004e8 <+2>: add %al,(%rax)
|
||||
=> 0x00000000004004ea <+4>: add %al,(%rax)
|
||||
0x00000000004004ec <+6>: add %al,(%rax)
|
||||
0x00000000004004ee <+8>: add %al,(%rax)
|
||||
End of assembler dump.
|
||||
|
||||
The other case that Pedro found involved an attempted examination of a
|
||||
particular section in the test case from gdb.base/corefile.exp. On
|
||||
Fedora 27 or 28, the following behavior may be observed:
|
||||
|
||||
(gdb) info proc mappings
|
||||
Mapped address spaces:
|
||||
|
||||
Start Addr End Addr Size Offset objfile
|
||||
...
|
||||
0x7ffff7839000 0x7ffff7a38000 0x1ff000 0x1b5000 /usr/lib64/libc-2.27.so
|
||||
...
|
||||
(gdb) x/4x 0x7ffff7839000
|
||||
0x7ffff7839000: Cannot access memory at address 0x7ffff7839000
|
||||
|
||||
FYI, this section appears to be unrelocated vtable data. See
|
||||
https://sourceware.org/pipermail/gdb-patches/2020-May/168331.html for
|
||||
a detailed analysis.
|
||||
|
||||
The important thing here is that GDB should be able to access this
|
||||
address since it should be backed by the shared library. I.e. it
|
||||
should do this:
|
||||
|
||||
(gdb) x/4x 0x7ffff7839000
|
||||
0x7ffff7839000: 0x0007ddf0 0x00000000 0x0007dba0 0x00000000
|
||||
|
||||
Both of these cases are fixed with this commit.
|
||||
|
||||
In a nutshell, this commit opens a "binary" target BFD for each of the
|
||||
files that are mentioned in an NT_FILE / .note.linuxcore.file note
|
||||
section. It then uses these mappings instead of the file stratum
|
||||
mappings that GDB has used in the past.
|
||||
|
||||
If this note section doesn't exist or is mangled for some reason, then
|
||||
GDB will use the file stratum as before. Should this happen, then
|
||||
we can expect both of the above problems to again be present.
|
||||
|
||||
See the code comments in the commit for other details.
|
||||
|
||||
gdb/ChangeLog:
|
||||
|
||||
* corelow.c (solist.h, unordered_map): Include.
|
||||
(class core_target): Add field m_core_file_mappings and
|
||||
method build_file_mappings.
|
||||
(core_target::core_target): Call build_file_mappings.
|
||||
(core_target::~core_target): Free memory associated with
|
||||
m_core_file_mappings.
|
||||
(core_target::build_file_mappings): New method.
|
||||
(core_target::xfer_partial): Use m_core_file_mappings
|
||||
for memory transfers.
|
||||
* linux-tdep.c (linux_read_core_file_mappings): New
|
||||
function.
|
||||
(linux_core_info_proc_mappings): Rewrite to use
|
||||
linux_read_core_file_mappings.
|
||||
(linux_init_abi): Register linux_read_core_file_mappings.
|
||||
|
||||
diff --git a/gdb/corelow.c b/gdb/corelow.c
|
||||
--- a/gdb/corelow.c
|
||||
+++ b/gdb/corelow.c
|
||||
@@ -39,6 +39,7 @@
|
||||
#include "exec.h"
|
||||
#include "readline/readline.h"
|
||||
#include "solib.h"
|
||||
+#include "solist.h"
|
||||
#include "filenames.h"
|
||||
#include "progspace.h"
|
||||
#include "objfiles.h"
|
||||
@@ -49,6 +50,8 @@
|
||||
#include "elf/common.h"
|
||||
#include "gdbcmd.h"
|
||||
#include "build-id.h"
|
||||
+#include "common/pathstuff.h"
|
||||
+#include <unordered_map>
|
||||
|
||||
#ifndef O_LARGEFILE
|
||||
#define O_LARGEFILE 0
|
||||
@@ -129,6 +132,13 @@ private: /* per-core data */
|
||||
core file currently open on core_bfd. */
|
||||
core_fns *m_core_vec = NULL;
|
||||
|
||||
+ /* File-backed address space mappings: some core files include
|
||||
+ information about memory mapped files. */
|
||||
+ target_section_table m_core_file_mappings {};
|
||||
+
|
||||
+ /* Build m_core_file_mappings. Called from the constructor. */
|
||||
+ void build_file_mappings ();
|
||||
+
|
||||
/* FIXME: kettenis/20031023: Eventually this field should
|
||||
disappear. */
|
||||
struct gdbarch *m_core_gdbarch = NULL;
|
||||
@@ -149,11 +159,120 @@ core_target::core_target ()
|
||||
&m_core_section_table.sections_end))
|
||||
error (_("\"%s\": Can't find sections: %s"),
|
||||
bfd_get_filename (core_bfd), bfd_errmsg (bfd_get_error ()));
|
||||
+
|
||||
+ build_file_mappings ();
|
||||
}
|
||||
|
||||
core_target::~core_target ()
|
||||
{
|
||||
xfree (m_core_section_table.sections);
|
||||
+ xfree (m_core_file_mappings.sections);
|
||||
+}
|
||||
+
|
||||
+/* Construct the target_section_table for file-backed mappings if
|
||||
+ they exist.
|
||||
+
|
||||
+ For each unique path in the note, we'll open a BFD with a bfd
|
||||
+ target of "binary". This is an unstructured bfd target upon which
|
||||
+ we'll impose a structure from the mappings in the architecture-specific
|
||||
+ mappings note. A BFD section is allocated and initialized for each
|
||||
+ file-backed mapping.
|
||||
+
|
||||
+ We take care to not share already open bfds with other parts of
|
||||
+ GDB; in particular, we don't want to add new sections to existing
|
||||
+ BFDs. We do, however, ensure that the BFDs that we allocate here
|
||||
+ will go away (be deallocated) when the core target is detached. */
|
||||
+
|
||||
+void
|
||||
+core_target::build_file_mappings ()
|
||||
+{
|
||||
+ std::unordered_map<std::string, struct bfd *> bfd_map;
|
||||
+
|
||||
+ /* See linux_read_core_file_mappings() in linux-tdep.c for an example
|
||||
+ read_core_file_mappings method. */
|
||||
+ gdbarch_read_core_file_mappings (m_core_gdbarch, core_bfd,
|
||||
+
|
||||
+ /* After determining the number of mappings, read_core_file_mappings
|
||||
+ will invoke this lambda which allocates target_section storage for
|
||||
+ the mappings. */
|
||||
+ [&] (ULONGEST count)
|
||||
+ {
|
||||
+ m_core_file_mappings.sections = XNEWVEC (struct target_section, count);
|
||||
+ m_core_file_mappings.sections_end = m_core_file_mappings.sections;
|
||||
+ },
|
||||
+
|
||||
+ /* read_core_file_mappings will invoke this lambda for each mapping
|
||||
+ that it finds. */
|
||||
+ [&] (int num, ULONGEST start, ULONGEST end, ULONGEST file_ofs,
|
||||
+ const char *filename, const void *other)
|
||||
+ {
|
||||
+ /* Architecture-specific read_core_mapping methods are expected to
|
||||
+ weed out non-file-backed mappings. */
|
||||
+ gdb_assert (filename != nullptr);
|
||||
+
|
||||
+ struct bfd *bfd = bfd_map[filename];
|
||||
+ if (bfd == nullptr)
|
||||
+ {
|
||||
+ /* Use exec_file_find() to do sysroot expansion. It'll
|
||||
+ also strip the potential sysroot "target:" prefix. If
|
||||
+ there is no sysroot, an equivalent (possibly more
|
||||
+ canonical) pathname will be provided. */
|
||||
+ gdb::unique_xmalloc_ptr<char> expanded_fname
|
||||
+ = exec_file_find (filename, NULL);
|
||||
+ if (expanded_fname == nullptr)
|
||||
+ {
|
||||
+ warning (_("Can't open file %s during file-backed mapping "
|
||||
+ "note processing"),
|
||||
+ expanded_fname.get ());
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ bfd = bfd_map[filename] = bfd_openr (expanded_fname.get (),
|
||||
+ "binary");
|
||||
+
|
||||
+ if (bfd == nullptr || !bfd_check_format (bfd, bfd_object))
|
||||
+ {
|
||||
+ /* If we get here, there's a good chance that it's due to
|
||||
+ an internal error. We issue a warning instead of an
|
||||
+ internal error because of the possibility that the
|
||||
+ file was removed in between checking for its
|
||||
+ existence during the expansion in exec_file_find()
|
||||
+ and the calls to bfd_openr() / bfd_check_format().
|
||||
+ Output both the path from the core file note along
|
||||
+ with its expansion to make debugging this problem
|
||||
+ easier. */
|
||||
+ warning (_("Can't open file %s which was expanded to %s "
|
||||
+ "during file-backed mapping note processing"),
|
||||
+ filename, expanded_fname.get ());
|
||||
+ if (bfd != nullptr)
|
||||
+ bfd_close (bfd);
|
||||
+ return;
|
||||
+ }
|
||||
+ /* Ensure that the bfd will be closed when core_bfd is closed.
|
||||
+ This can be checked before/after a core file detach via
|
||||
+ "maint info bfds". */
|
||||
+ gdb_bfd_record_inclusion (core_bfd, bfd);
|
||||
+ }
|
||||
+
|
||||
+ /* Make new BFD section. All sections have the same name,
|
||||
+ which is permitted by bfd_make_section_anyway(). */
|
||||
+ asection *sec = bfd_make_section_anyway (bfd, "load");
|
||||
+ if (sec == nullptr)
|
||||
+ error (_("Can't make section"));
|
||||
+ sec->filepos = file_ofs;
|
||||
+ bfd_set_section_flags (sec->owner, sec, SEC_READONLY | SEC_HAS_CONTENTS);
|
||||
+ bfd_set_section_size (sec->owner, sec, end - start);
|
||||
+ bfd_set_section_vma (sec->owner, sec, start);
|
||||
+ sec->lma = start;
|
||||
+ bfd_set_section_alignment (sec->owner, sec, 2);
|
||||
+
|
||||
+ /* Set target_section fields. */
|
||||
+ struct target_section *ts = m_core_file_mappings.sections_end++;
|
||||
+ ts->addr = start;
|
||||
+ ts->endaddr = end;
|
||||
+ ts->owner = nullptr;
|
||||
+ ts->the_bfd_section = sec;
|
||||
+ });
|
||||
}
|
||||
|
||||
/* List of all available core_fns. On gdb startup, each core file
|
||||
@@ -835,10 +954,21 @@ core_target::xfer_partial (enum target_object object, const char *annex,
|
||||
if (xfer_status == TARGET_XFER_OK)
|
||||
return TARGET_XFER_OK;
|
||||
|
||||
- /* Now check the stratum beneath us; this should be file_stratum. */
|
||||
- xfer_status = this->beneath ()->xfer_partial (object, annex, readbuf,
|
||||
- writebuf, offset, len,
|
||||
- xfered_len);
|
||||
+ /* Check file backed mappings. If they're available, use
|
||||
+ core file provided mappings (e.g. from .note.linuxcore.file
|
||||
+ or the like) as this should provide a more accurate
|
||||
+ result. If not, check the stratum beneath us, which should
|
||||
+ be the file stratum. */
|
||||
+ if (m_core_file_mappings.sections != nullptr)
|
||||
+ xfer_status = section_table_xfer_memory_partial
|
||||
+ (readbuf, writebuf,
|
||||
+ offset, len, xfered_len,
|
||||
+ m_core_file_mappings.sections,
|
||||
+ m_core_file_mappings.sections_end);
|
||||
+ else
|
||||
+ xfer_status = this->beneath ()->xfer_partial (object, annex, readbuf,
|
||||
+ writebuf, offset, len,
|
||||
+ xfered_len);
|
||||
if (xfer_status == TARGET_XFER_OK)
|
||||
return TARGET_XFER_OK;
|
||||
|
||||
diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c
|
||||
--- a/gdb/linux-tdep.c
|
||||
+++ b/gdb/linux-tdep.c
|
||||
@@ -1002,106 +1002,174 @@ linux_info_proc (struct gdbarch *gdbarch, const char *args,
|
||||
}
|
||||
}
|
||||
|
||||
-/* Implement "info proc mappings" for a corefile. */
|
||||
+/* Implementation of `gdbarch_read_core_file_mappings', as defined in
|
||||
+ gdbarch.h.
|
||||
+
|
||||
+ This function reads the NT_FILE note (which BFD turns into the
|
||||
+ section ".note.linuxcore.file"). The format of this note / section
|
||||
+ is described as follows in the Linux kernel sources in
|
||||
+ fs/binfmt_elf.c:
|
||||
+
|
||||
+ long count -- how many files are mapped
|
||||
+ long page_size -- units for file_ofs
|
||||
+ array of [COUNT] elements of
|
||||
+ long start
|
||||
+ long end
|
||||
+ long file_ofs
|
||||
+ followed by COUNT filenames in ASCII: "FILE1" NUL "FILE2" NUL...
|
||||
+
|
||||
+ CBFD is the BFD of the core file.
|
||||
+
|
||||
+ PRE_LOOP_CB is the callback function to invoke prior to starting
|
||||
+ the loop which processes individual entries. This callback will
|
||||
+ only be executed after the note has been examined in enough
|
||||
+ detail to verify that it's not malformed in some way.
|
||||
+
|
||||
+ LOOP_CB is the callback function that will be executed once
|
||||
+ for each mapping. */
|
||||
|
||||
static void
|
||||
-linux_core_info_proc_mappings (struct gdbarch *gdbarch, const char *args)
|
||||
+linux_read_core_file_mappings (struct gdbarch *gdbarch,
|
||||
+ struct bfd *cbfd,
|
||||
+ gdb::function_view<void (ULONGEST count)>
|
||||
+ pre_loop_cb,
|
||||
+ gdb::function_view<void (int num,
|
||||
+ ULONGEST start,
|
||||
+ ULONGEST end,
|
||||
+ ULONGEST file_ofs,
|
||||
+ const char *filename,
|
||||
+ const void *other)>
|
||||
+ loop_cb)
|
||||
{
|
||||
- asection *section;
|
||||
- ULONGEST count, page_size;
|
||||
- unsigned char *descdata, *filenames, *descend;
|
||||
- size_t note_size;
|
||||
- unsigned int addr_size_bits, addr_size;
|
||||
- struct gdbarch *core_gdbarch = gdbarch_from_bfd (core_bfd);
|
||||
- /* We assume this for reading 64-bit core files. */
|
||||
+ /* Ensure that ULONGEST is big enough for reading 64-bit core files. */
|
||||
gdb_static_assert (sizeof (ULONGEST) >= 8);
|
||||
|
||||
- section = bfd_get_section_by_name (core_bfd, ".note.linuxcore.file");
|
||||
- if (section == NULL)
|
||||
- {
|
||||
- warning (_("unable to find mappings in core file"));
|
||||
- return;
|
||||
- }
|
||||
+ /* It's not required that the NT_FILE note exists, so return silently
|
||||
+ if it's not found. Beyond this point though, we'll complain
|
||||
+ if problems are found. */
|
||||
+ asection *section = bfd_get_section_by_name (cbfd, ".note.linuxcore.file");
|
||||
+ if (section == nullptr)
|
||||
+ return;
|
||||
|
||||
- addr_size_bits = gdbarch_addr_bit (core_gdbarch);
|
||||
- addr_size = addr_size_bits / 8;
|
||||
- note_size = bfd_get_section_size (section);
|
||||
+ unsigned int addr_size_bits = gdbarch_addr_bit (gdbarch);
|
||||
+ unsigned int addr_size = addr_size_bits / 8;
|
||||
+ size_t note_size = bfd_section_size (section->abfd, section);
|
||||
|
||||
if (note_size < 2 * addr_size)
|
||||
- error (_("malformed core note - too short for header"));
|
||||
+ {
|
||||
+ warning (_("malformed core note - too short for header"));
|
||||
+ return;
|
||||
+ }
|
||||
|
||||
- gdb::def_vector<unsigned char> contents (note_size);
|
||||
+ gdb::def_vector<gdb_byte> contents (note_size);
|
||||
if (!bfd_get_section_contents (core_bfd, section, contents.data (),
|
||||
- 0, note_size))
|
||||
- error (_("could not get core note contents"));
|
||||
+ 0, note_size))
|
||||
+ {
|
||||
+ warning (_("could not get core note contents"));
|
||||
+ return;
|
||||
+ }
|
||||
|
||||
- descdata = contents.data ();
|
||||
- descend = descdata + note_size;
|
||||
+ gdb_byte *descdata = contents.data ();
|
||||
+ char *descend = (char *) descdata + note_size;
|
||||
|
||||
if (descdata[note_size - 1] != '\0')
|
||||
- error (_("malformed note - does not end with \\0"));
|
||||
+ {
|
||||
+ warning (_("malformed note - does not end with \\0"));
|
||||
+ return;
|
||||
+ }
|
||||
|
||||
- count = bfd_get (addr_size_bits, core_bfd, descdata);
|
||||
+ ULONGEST count = bfd_get (addr_size_bits, core_bfd, descdata);
|
||||
descdata += addr_size;
|
||||
|
||||
- page_size = bfd_get (addr_size_bits, core_bfd, descdata);
|
||||
+ ULONGEST page_size = bfd_get (addr_size_bits, core_bfd, descdata);
|
||||
descdata += addr_size;
|
||||
|
||||
if (note_size < 2 * addr_size + count * 3 * addr_size)
|
||||
- error (_("malformed note - too short for supplied file count"));
|
||||
-
|
||||
- printf_filtered (_("Mapped address spaces:\n\n"));
|
||||
- if (gdbarch_addr_bit (gdbarch) == 32)
|
||||
{
|
||||
- printf_filtered ("\t%10s %10s %10s %10s %s\n",
|
||||
- "Start Addr",
|
||||
- " End Addr",
|
||||
- " Size", " Offset", "objfile");
|
||||
- }
|
||||
- else
|
||||
- {
|
||||
- printf_filtered (" %18s %18s %10s %10s %s\n",
|
||||
- "Start Addr",
|
||||
- " End Addr",
|
||||
- " Size", " Offset", "objfile");
|
||||
+ warning (_("malformed note - too short for supplied file count"));
|
||||
+ return;
|
||||
}
|
||||
|
||||
- filenames = descdata + count * 3 * addr_size;
|
||||
- while (--count > 0)
|
||||
+ char *filenames = (char *) descdata + count * 3 * addr_size;
|
||||
+
|
||||
+ /* Make sure that the correct number of filenames exist. Complain
|
||||
+ if there aren't enough or are too many. */
|
||||
+ char *f = filenames;
|
||||
+ for (int i = 0; i < count; i++)
|
||||
{
|
||||
- ULONGEST start, end, file_ofs;
|
||||
+ if (f >= descend)
|
||||
+ {
|
||||
+ warning (_("malformed note - filename area is too small"));
|
||||
+ return;
|
||||
+ }
|
||||
+ f += strnlen (f, descend - f) + 1;
|
||||
+ }
|
||||
+ /* Complain, but don't return early if the filename area is too big. */
|
||||
+ if (f != descend)
|
||||
+ warning (_("malformed note - filename area is too big"));
|
||||
|
||||
- if (filenames == descend)
|
||||
- error (_("malformed note - filenames end too early"));
|
||||
+ pre_loop_cb (count);
|
||||
|
||||
- start = bfd_get (addr_size_bits, core_bfd, descdata);
|
||||
+ for (int i = 0; i < count; i++)
|
||||
+ {
|
||||
+ ULONGEST start = bfd_get (addr_size_bits, core_bfd, descdata);
|
||||
descdata += addr_size;
|
||||
- end = bfd_get (addr_size_bits, core_bfd, descdata);
|
||||
+ ULONGEST end = bfd_get (addr_size_bits, core_bfd, descdata);
|
||||
descdata += addr_size;
|
||||
- file_ofs = bfd_get (addr_size_bits, core_bfd, descdata);
|
||||
+ ULONGEST file_ofs
|
||||
+ = bfd_get (addr_size_bits, core_bfd, descdata) * page_size;
|
||||
descdata += addr_size;
|
||||
+ char * filename = filenames;
|
||||
+ filenames += strlen ((char *) filenames) + 1;
|
||||
|
||||
- file_ofs *= page_size;
|
||||
-
|
||||
- if (gdbarch_addr_bit (gdbarch) == 32)
|
||||
- printf_filtered ("\t%10s %10s %10s %10s %s\n",
|
||||
- paddress (gdbarch, start),
|
||||
- paddress (gdbarch, end),
|
||||
- hex_string (end - start),
|
||||
- hex_string (file_ofs),
|
||||
- filenames);
|
||||
- else
|
||||
- printf_filtered (" %18s %18s %10s %10s %s\n",
|
||||
- paddress (gdbarch, start),
|
||||
- paddress (gdbarch, end),
|
||||
- hex_string (end - start),
|
||||
- hex_string (file_ofs),
|
||||
- filenames);
|
||||
-
|
||||
- filenames += 1 + strlen ((char *) filenames);
|
||||
+ loop_cb (i, start, end, file_ofs, filename, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
+/* Implement "info proc mappings" for a corefile. */
|
||||
+
|
||||
+static void
|
||||
+linux_core_info_proc_mappings (struct gdbarch *gdbarch, const char *args)
|
||||
+{
|
||||
+ linux_read_core_file_mappings (gdbarch, core_bfd,
|
||||
+ [=] (ULONGEST count)
|
||||
+ {
|
||||
+ printf_filtered (_("Mapped address spaces:\n\n"));
|
||||
+ if (gdbarch_addr_bit (gdbarch) == 32)
|
||||
+ {
|
||||
+ printf_filtered ("\t%10s %10s %10s %10s %s\n",
|
||||
+ "Start Addr",
|
||||
+ " End Addr",
|
||||
+ " Size", " Offset", "objfile");
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ printf_filtered (" %18s %18s %10s %10s %s\n",
|
||||
+ "Start Addr",
|
||||
+ " End Addr",
|
||||
+ " Size", " Offset", "objfile");
|
||||
+ }
|
||||
+ },
|
||||
+ [=] (int num, ULONGEST start, ULONGEST end, ULONGEST file_ofs,
|
||||
+ const char *filename, const void *other)
|
||||
+ {
|
||||
+ if (gdbarch_addr_bit (gdbarch) == 32)
|
||||
+ printf_filtered ("\t%10s %10s %10s %10s %s\n",
|
||||
+ paddress (gdbarch, start),
|
||||
+ paddress (gdbarch, end),
|
||||
+ hex_string (end - start),
|
||||
+ hex_string (file_ofs),
|
||||
+ filename);
|
||||
+ else
|
||||
+ printf_filtered (" %18s %18s %10s %10s %s\n",
|
||||
+ paddress (gdbarch, start),
|
||||
+ paddress (gdbarch, end),
|
||||
+ hex_string (end - start),
|
||||
+ hex_string (file_ofs),
|
||||
+ filename);
|
||||
+ });
|
||||
+}
|
||||
+
|
||||
/* Implement "info proc" for a corefile. */
|
||||
|
||||
static void
|
||||
@@ -2501,6 +2569,7 @@ linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
|
||||
set_gdbarch_info_proc (gdbarch, linux_info_proc);
|
||||
set_gdbarch_core_info_proc (gdbarch, linux_core_info_proc);
|
||||
set_gdbarch_core_xfer_siginfo (gdbarch, linux_core_xfer_siginfo);
|
||||
+ set_gdbarch_read_core_file_mappings (gdbarch, linux_read_core_file_mappings);
|
||||
set_gdbarch_find_memory_regions (gdbarch, linux_find_memory_regions);
|
||||
set_gdbarch_make_corefile_notes (gdbarch, linux_make_corefile_notes);
|
||||
set_gdbarch_has_shared_address_space (gdbarch,
|
|
@ -1,101 +0,0 @@
|
|||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Keith Seitz <keiths@redhat.com>
|
||||
Date: Mon, 27 Jul 2020 19:21:54 -0400
|
||||
Subject: gdb-rhbz1842691-corefile-mem-access-9of15.patch
|
||||
|
||||
;; Add test for accessing read-only mmapped data in a core file
|
||||
;; Kevin Buettner, RH BZ 1842691
|
||||
|
||||
Author: Kevin Buettner <kevinb@redhat.com>
|
||||
Date: Tue Jun 16 11:39:22 2020 -0700
|
||||
|
||||
Add test for accessing read-only mmapped data in a core file
|
||||
|
||||
This test passes when run using a GDB with my corefile patches. When
|
||||
run against a GDB without my patches, I see the following failures,
|
||||
the first of which is due to the test added by this commit:
|
||||
|
||||
FAIL: gdb.base/corefile.exp: accessing read-only mmapped data in core file (
|
||||
FAIL: gdb.base/corefile.exp: accessing anonymous, unwritten-to mmap data
|
||||
|
||||
gdb/testsuite/ChangeLog:
|
||||
|
||||
* gdb.base/corefile.exp: Add test "accessing read-only mmapped
|
||||
data in core file".
|
||||
* gdb.base/coremaker.c (buf2ro): New global.
|
||||
(mmapdata): Add a read-only mmap mapping.
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/corefile.exp b/gdb/testsuite/gdb.base/corefile.exp
|
||||
--- a/gdb/testsuite/gdb.base/corefile.exp
|
||||
+++ b/gdb/testsuite/gdb.base/corefile.exp
|
||||
@@ -34,7 +34,10 @@ if {[build_executable $testfile.exp $testfile $srcfile debug] == -1} {
|
||||
return -1
|
||||
}
|
||||
|
||||
-set corefile [core_find $binfile {coremmap.data}]
|
||||
+# Do not delete coremap.data when calling core_find. This file is
|
||||
+# required for GDB to find mmap'd data in the "accessing read-only
|
||||
+# mmapped data in core file" test.
|
||||
+set corefile [core_find $binfile {}]
|
||||
if {$corefile == ""} {
|
||||
return 0
|
||||
}
|
||||
@@ -175,6 +178,19 @@ gdb_test_multiple "x/8bd buf2" "$test" {
|
||||
}
|
||||
}
|
||||
|
||||
+set test "accessing read-only mmapped data in core file"
|
||||
+gdb_test_multiple "x/8bd buf2ro" "$test" {
|
||||
+ -re ".*:.*0.*1.*2.*3.*4.*5.*6.*7.*$gdb_prompt $" {
|
||||
+ pass "$test"
|
||||
+ }
|
||||
+ -re "0x\[f\]*:.*Cannot access memory at address 0x\[f\]*.*$gdb_prompt $" {
|
||||
+ fail "$test (mapping failed at runtime)"
|
||||
+ }
|
||||
+ -re "0x.*:.*Cannot access memory at address 0x.*$gdb_prompt $" {
|
||||
+ fail "$test (mapping address not found in core file)"
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
# Test ability to read anonymous and, more importantly, unwritten-to
|
||||
# mmap'd data.
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/coremaker.c b/gdb/testsuite/gdb.base/coremaker.c
|
||||
--- a/gdb/testsuite/gdb.base/coremaker.c
|
||||
+++ b/gdb/testsuite/gdb.base/coremaker.c
|
||||
@@ -38,6 +38,7 @@
|
||||
|
||||
char *buf1;
|
||||
char *buf2;
|
||||
+char *buf2ro;
|
||||
char *buf3;
|
||||
|
||||
int coremaker_data = 1; /* In Data section */
|
||||
@@ -90,16 +91,25 @@ mmapdata ()
|
||||
return;
|
||||
}
|
||||
|
||||
+ /* Map in another copy, read-only. We won't write to this copy so it
|
||||
+ will likely not end up in the core file. */
|
||||
+ buf2ro = (char *) mmap (0, MAPSIZE, PROT_READ, MAP_PRIVATE, fd, 0);
|
||||
+ if (buf2ro == (char *) -1)
|
||||
+ {
|
||||
+ perror ("mmap failed");
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
/* Verify that the original data and the mapped data are identical.
|
||||
If not, we'd rather fail now than when trying to access the mapped
|
||||
data from the core file. */
|
||||
|
||||
for (j = 0; j < MAPSIZE; ++j)
|
||||
{
|
||||
- if (buf1[j] != buf2[j])
|
||||
+ if (buf1[j] != buf2[j] || buf1[j] != buf2ro[j])
|
||||
{
|
||||
fprintf (stderr, "mapped data is incorrect");
|
||||
- buf2 = (char *) -1;
|
||||
+ buf2 = buf2ro = (char *) -1;
|
||||
return;
|
||||
}
|
||||
}
|
|
@ -1,164 +0,0 @@
|
|||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Alan Hayward <alan.hayward@arm.com>
|
||||
Date: Tue, 28 May 2019 10:07:54 +0100
|
||||
Subject: gdb-rhbz1852580-terminal-woes.patch
|
||||
|
||||
;; Fix terminal problems when error() is called
|
||||
;; Alan Hayward (RH BZ 1852580)
|
||||
|
||||
Suppress SIGTTOU when handling errors
|
||||
|
||||
Calls to error () can cause SIGTTOU to send gdb to the background.
|
||||
|
||||
For example, on an Arm build:
|
||||
(gdb) b main
|
||||
Breakpoint 1 at 0x10774: file /build/gdb/testsuite/../../../src/binutils-gdb/gdb/testsuite/gdb.base/watchpoint.c, line 174.
|
||||
(gdb) r
|
||||
Starting program: /build/gdb/testsuite/outputs/gdb.base/watchpoint/watchpoint
|
||||
|
||||
[1]+ Stopped ../gdb ./outputs/gdb.base/watchpoint/watchpoint
|
||||
localhost$ fg
|
||||
../gdb ./outputs/gdb.base/watchpoint/watchpoint
|
||||
Cannot parse expression `.L1199 4@r4'.
|
||||
warning: Probes-based dynamic linker interface failed.
|
||||
Reverting to original interface.
|
||||
|
||||
The SIGTTOU is raised whilst inside a syscall during the call to tcdrain.
|
||||
Fix is to use scoped_ignore_sigttou to ensure SIGTTOU is blocked.
|
||||
|
||||
In addition fix include comments - job_control is not included via terminal.h
|
||||
|
||||
gdb/ChangeLog:
|
||||
|
||||
* event-top.c: Remove include comment.
|
||||
* inflow.c (class scoped_ignore_sigttou): Move from here...
|
||||
* inflow.h (class scoped_ignore_sigttou): ...to here.
|
||||
* ser-unix.c (hardwire_drain_output): Block SIGTTOU during drain.
|
||||
* top.c: Remove include comment.
|
||||
|
||||
diff --git a/gdb/event-top.c b/gdb/event-top.c
|
||||
--- a/gdb/event-top.c
|
||||
+++ b/gdb/event-top.c
|
||||
@@ -24,7 +24,7 @@
|
||||
#include "inferior.h"
|
||||
#include "infrun.h"
|
||||
#include "target.h"
|
||||
-#include "terminal.h" /* for job_control */
|
||||
+#include "terminal.h"
|
||||
#include "event-loop.h"
|
||||
#include "event-top.h"
|
||||
#include "interps.h"
|
||||
diff --git a/gdb/inflow.c b/gdb/inflow.c
|
||||
--- a/gdb/inflow.c
|
||||
+++ b/gdb/inflow.c
|
||||
@@ -103,35 +103,6 @@ static serial_ttystate initial_gdb_ttystate;
|
||||
|
||||
static struct terminal_info *get_inflow_inferior_data (struct inferior *);
|
||||
|
||||
-/* RAII class used to ignore SIGTTOU in a scope. */
|
||||
-
|
||||
-class scoped_ignore_sigttou
|
||||
-{
|
||||
-public:
|
||||
- scoped_ignore_sigttou ()
|
||||
- {
|
||||
-#ifdef SIGTTOU
|
||||
- if (job_control)
|
||||
- m_osigttou = signal (SIGTTOU, SIG_IGN);
|
||||
-#endif
|
||||
- }
|
||||
-
|
||||
- ~scoped_ignore_sigttou ()
|
||||
- {
|
||||
-#ifdef SIGTTOU
|
||||
- if (job_control)
|
||||
- signal (SIGTTOU, m_osigttou);
|
||||
-#endif
|
||||
- }
|
||||
-
|
||||
- DISABLE_COPY_AND_ASSIGN (scoped_ignore_sigttou);
|
||||
-
|
||||
-private:
|
||||
-#ifdef SIGTTOU
|
||||
- sighandler_t m_osigttou = NULL;
|
||||
-#endif
|
||||
-};
|
||||
-
|
||||
/* While the inferior is running, we want SIGINT and SIGQUIT to go to the
|
||||
inferior only. If we have job control, that takes care of it. If not,
|
||||
we save our handlers in these two variables and set SIGINT and SIGQUIT
|
||||
diff --git a/gdb/inflow.h b/gdb/inflow.h
|
||||
--- a/gdb/inflow.h
|
||||
+++ b/gdb/inflow.h
|
||||
@@ -21,5 +21,36 @@
|
||||
#define INFLOW_H
|
||||
|
||||
#include <unistd.h>
|
||||
+#include <signal.h>
|
||||
+#include "common/job-control.h"
|
||||
+
|
||||
+/* RAII class used to ignore SIGTTOU in a scope. */
|
||||
+
|
||||
+class scoped_ignore_sigttou
|
||||
+{
|
||||
+public:
|
||||
+ scoped_ignore_sigttou ()
|
||||
+ {
|
||||
+#ifdef SIGTTOU
|
||||
+ if (job_control)
|
||||
+ m_osigttou = signal (SIGTTOU, SIG_IGN);
|
||||
+#endif
|
||||
+ }
|
||||
+
|
||||
+ ~scoped_ignore_sigttou ()
|
||||
+ {
|
||||
+#ifdef SIGTTOU
|
||||
+ if (job_control)
|
||||
+ signal (SIGTTOU, m_osigttou);
|
||||
+#endif
|
||||
+ }
|
||||
+
|
||||
+ DISABLE_COPY_AND_ASSIGN (scoped_ignore_sigttou);
|
||||
+
|
||||
+private:
|
||||
+#ifdef SIGTTOU
|
||||
+ sighandler_t m_osigttou = NULL;
|
||||
+#endif
|
||||
+};
|
||||
|
||||
#endif /* inflow.h */
|
||||
diff --git a/gdb/ser-unix.c b/gdb/ser-unix.c
|
||||
--- a/gdb/ser-unix.c
|
||||
+++ b/gdb/ser-unix.c
|
||||
@@ -32,6 +32,7 @@
|
||||
#include "gdbcmd.h"
|
||||
#include "filestuff.h"
|
||||
#include <termios.h>
|
||||
+#include "inflow.h"
|
||||
|
||||
struct hardwire_ttystate
|
||||
{
|
||||
@@ -164,6 +165,9 @@ hardwire_print_tty_state (struct serial *scb,
|
||||
static int
|
||||
hardwire_drain_output (struct serial *scb)
|
||||
{
|
||||
+ /* Ignore SIGTTOU which may occur during the drain. */
|
||||
+ scoped_ignore_sigttou ignore_sigttou;
|
||||
+
|
||||
return tcdrain (scb->fd);
|
||||
}
|
||||
|
||||
diff --git a/gdb/top.c b/gdb/top.c
|
||||
--- a/gdb/top.c
|
||||
+++ b/gdb/top.c
|
||||
@@ -34,8 +34,8 @@
|
||||
#include "expression.h"
|
||||
#include "value.h"
|
||||
#include "language.h"
|
||||
-#include "terminal.h" /* For job_control. */
|
||||
-#include "job-control.h"
|
||||
+#include "terminal.h"
|
||||
+#include "common/job-control.h"
|
||||
#include "annotate.h"
|
||||
#include "completer.h"
|
||||
#include "top.h"
|
|
@ -1,49 +0,0 @@
|
|||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
|
||||
Date: Wed, 7 Jul 2021 15:44:29 -0400
|
||||
Subject: gdb-rhbz1854784-powerpc-remove-region-limit-dawr-1of7.patch
|
||||
|
||||
;; Backport "Add low_new_clone method to linux_nat_target."
|
||||
;; (Pedro Franco de Carvalho, RH BZ 1854784)
|
||||
|
||||
This patch adds a low_new_clone method to linux_nat_target, called after
|
||||
a PTRACE_EVENT_CLONE is detected, similar to how low_new_fork is called
|
||||
after PTRACE_EVENT_(V)FORK.
|
||||
|
||||
This is useful for targets that need to copy state associated with a
|
||||
thread that is inherited across clones.
|
||||
|
||||
gdb/ChangeLog:
|
||||
2020-03-30 Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
|
||||
|
||||
* linux-nat.h (low_new_clone): New method.
|
||||
* linux-nat.c (linux_handle_extended_wait): Call low_new_clone.
|
||||
|
||||
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
|
||||
--- a/gdb/linux-nat.c
|
||||
+++ b/gdb/linux-nat.c
|
||||
@@ -2020,6 +2020,10 @@ linux_handle_extended_wait (struct lwp_info *lp, int status)
|
||||
inferior. */
|
||||
linux_target->low_new_fork (lp, new_pid);
|
||||
}
|
||||
+ else if (event == PTRACE_EVENT_CLONE)
|
||||
+ {
|
||||
+ linux_target->low_new_clone (lp, new_pid);
|
||||
+ }
|
||||
|
||||
if (event == PTRACE_EVENT_FORK
|
||||
&& linux_fork_checkpointing_p (lp->ptid.pid ()))
|
||||
diff --git a/gdb/linux-nat.h b/gdb/linux-nat.h
|
||||
--- a/gdb/linux-nat.h
|
||||
+++ b/gdb/linux-nat.h
|
||||
@@ -160,6 +160,10 @@ public:
|
||||
virtual void low_new_fork (struct lwp_info *parent, pid_t child_pid)
|
||||
{}
|
||||
|
||||
+ /* The method to call, if any, when a new clone event is detected. */
|
||||
+ virtual void low_new_clone (struct lwp_info *parent, pid_t child_lwp)
|
||||
+ {}
|
||||
+
|
||||
/* The method to call, if any, when a process is no longer
|
||||
attached. */
|
||||
virtual void low_forget_process (pid_t pid)
|
|
@ -1,311 +0,0 @@
|
|||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Alan Hayward <alan.hayward@arm.com>
|
||||
Date: Wed, 7 Jul 2021 18:13:44 -0400
|
||||
Subject: gdb-rhbz1854784-powerpc-remove-region-limit-dawr-2of7.patch
|
||||
|
||||
;; Backport "Add linux_get_hwcap"
|
||||
;; (Alan Hayward, RH BZ 1854784)
|
||||
|
||||
Tidy up calls to read HWCAP (and HWCAP2) by adding common functions,
|
||||
removing the PPC and AArch64 specific versions.
|
||||
|
||||
The only function difference is in aarch64_linux_core_read_description - if
|
||||
the hwcap read fails it now return a valid description instead of nullptr.
|
||||
|
||||
gdb/ChangeLog:
|
||||
|
||||
2019-03-25 Alan Hayward <alan.hayward@arm.com>
|
||||
|
||||
* aarch64-linux-nat.c (aarch64_linux_nat_target::read_description):
|
||||
Call linux_get_hwcap.
|
||||
* aarch64-linux-tdep.c (aarch64_linux_core_read_description):
|
||||
Likewise.
|
||||
(aarch64_linux_get_hwcap): Remove function.
|
||||
* aarch64-linux-tdep.h (aarch64_linux_get_hwcap): Remove
|
||||
declaration.
|
||||
* arm-linux-nat.c (arm_linux_nat_target::read_description):Call
|
||||
linux_get_hwcap.
|
||||
* arm-linux-tdep.c (arm_linux_core_read_description): Likewise.
|
||||
* linux-tdep.c (linux_get_hwcap): Add function.
|
||||
(linux_get_hwcap2): Likewise.
|
||||
* linux-tdep.h (linux_get_hwcap): Add declaration.
|
||||
(linux_get_hwcap2): Likewise.
|
||||
* ppc-linux-nat.c (ppc_linux_get_hwcap): Remove function.
|
||||
(ppc_linux_get_hwcap2): Likewise.
|
||||
(ppc_linux_nat_target::region_ok_for_hw_watchpoint): Call
|
||||
linux_get_hwcap.
|
||||
(ppc_linux_nat_target::insert_watchpoint): Likewise.
|
||||
(ppc_linux_nat_target::watchpoint_addr_within_range): Likewise.
|
||||
(ppc_linux_nat_target::read_description): Likewise.
|
||||
* ppc-linux-tdep.c (ppc_linux_core_read_description): Likewise.
|
||||
* s390-linux-nat.c: Likewise.
|
||||
* s390-linux-tdep.c (s390_core_read_description): Likewise.
|
||||
|
||||
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
|
||||
@@ -42,6 +42,7 @@
|
||||
#include <asm/ptrace.h>
|
||||
|
||||
#include "gregset.h"
|
||||
+#include "linux-tdep.h"
|
||||
|
||||
/* Defines ps_err_e, struct ps_prochandle. */
|
||||
#include "gdb_proc_service.h"
|
||||
@@ -605,8 +606,7 @@ aarch64_linux_nat_target::read_description ()
|
||||
ret = ptrace (PTRACE_GETREGSET, tid, NT_ARM_VFP, &iovec);
|
||||
if (ret == 0)
|
||||
return tdesc_arm_with_neon;
|
||||
- else
|
||||
- return aarch64_read_description (aarch64_sve_get_vq (tid));
|
||||
+ else return aarch64_read_description (aarch64_sve_get_vq (tid));
|
||||
}
|
||||
|
||||
/* Convert a native/host siginfo object, into/from the siginfo in the
|
||||
diff --git a/gdb/aarch64-linux-tdep.c b/gdb/aarch64-linux-tdep.c
|
||||
--- a/gdb/aarch64-linux-tdep.c
|
||||
+++ b/gdb/aarch64-linux-tdep.c
|
||||
@@ -442,10 +442,7 @@ static const struct target_desc *
|
||||
aarch64_linux_core_read_description (struct gdbarch *gdbarch,
|
||||
struct target_ops *target, bfd *abfd)
|
||||
{
|
||||
- CORE_ADDR aarch64_hwcap = 0;
|
||||
-
|
||||
- if (target_auxv_search (target, AT_HWCAP, &aarch64_hwcap) != 1)
|
||||
- return NULL;
|
||||
+ CORE_ADDR hwcap = linux_get_hwcap (target);
|
||||
|
||||
return aarch64_read_description (aarch64_linux_core_read_vq (gdbarch, abfd));
|
||||
}
|
||||
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
|
||||
@@ -533,7 +533,7 @@ ps_get_thread_area (struct ps_prochandle *ph,
|
||||
const struct target_desc *
|
||||
arm_linux_nat_target::read_description ()
|
||||
{
|
||||
- CORE_ADDR arm_hwcap = 0;
|
||||
+ CORE_ADDR arm_hwcap = linux_get_hwcap (this);
|
||||
|
||||
if (have_ptrace_getregset == TRIBOOL_UNKNOWN)
|
||||
{
|
||||
@@ -551,11 +551,6 @@ arm_linux_nat_target::read_description ()
|
||||
have_ptrace_getregset = TRIBOOL_TRUE;
|
||||
}
|
||||
|
||||
- if (target_auxv_search (this, AT_HWCAP, &arm_hwcap) != 1)
|
||||
- {
|
||||
- return this->beneath ()->read_description ();
|
||||
- }
|
||||
-
|
||||
if (arm_hwcap & HWCAP_IWMMXT)
|
||||
return tdesc_arm_with_iwmmxt;
|
||||
|
||||
diff --git a/gdb/arm-linux-tdep.c b/gdb/arm-linux-tdep.c
|
||||
--- a/gdb/arm-linux-tdep.c
|
||||
+++ b/gdb/arm-linux-tdep.c
|
||||
@@ -730,10 +730,7 @@ arm_linux_core_read_description (struct gdbarch *gdbarch,
|
||||
struct target_ops *target,
|
||||
bfd *abfd)
|
||||
{
|
||||
- CORE_ADDR arm_hwcap = 0;
|
||||
-
|
||||
- if (target_auxv_search (target, AT_HWCAP, &arm_hwcap) != 1)
|
||||
- return NULL;
|
||||
+ CORE_ADDR arm_hwcap = linux_get_hwcap (target);
|
||||
|
||||
if (arm_hwcap & HWCAP_VFP)
|
||||
{
|
||||
diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c
|
||||
--- a/gdb/linux-tdep.c
|
||||
+++ b/gdb/linux-tdep.c
|
||||
@@ -2567,6 +2567,28 @@ linux_displaced_step_location (struct gdbarch *gdbarch)
|
||||
return addr;
|
||||
}
|
||||
|
||||
+/* See linux-tdep.h. */
|
||||
+
|
||||
+CORE_ADDR
|
||||
+linux_get_hwcap (struct target_ops *target)
|
||||
+{
|
||||
+ CORE_ADDR field;
|
||||
+ if (target_auxv_search (target, AT_HWCAP, &field) != 1)
|
||||
+ return 0;
|
||||
+ return field;
|
||||
+}
|
||||
+
|
||||
+/* See linux-tdep.h. */
|
||||
+
|
||||
+CORE_ADDR
|
||||
+linux_get_hwcap2 (struct target_ops *target)
|
||||
+{
|
||||
+ CORE_ADDR field;
|
||||
+ if (target_auxv_search (target, AT_HWCAP2, &field) != 1)
|
||||
+ return 0;
|
||||
+ return field;
|
||||
+}
|
||||
+
|
||||
/* Display whether the gcore command is using the
|
||||
/proc/PID/coredump_filter file. */
|
||||
|
||||
diff --git a/gdb/linux-tdep.h b/gdb/linux-tdep.h
|
||||
--- a/gdb/linux-tdep.h
|
||||
+++ b/gdb/linux-tdep.h
|
||||
@@ -61,4 +61,12 @@ extern void linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch);
|
||||
|
||||
extern int linux_is_uclinux (void);
|
||||
|
||||
+/* Fetch the AT_HWCAP entry from the auxv vector for the given TARGET. On
|
||||
+ error, 0 is returned. */
|
||||
+extern CORE_ADDR linux_get_hwcap (struct target_ops *target);
|
||||
+
|
||||
+/* Fetch the AT_HWCAP2 entry from the auxv vector for the given TARGET. On
|
||||
+ error, 0 is returned. */
|
||||
+extern CORE_ADDR linux_get_hwcap2 (struct target_ops *target);
|
||||
+
|
||||
#endif /* linux-tdep.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
|
||||
@@ -50,6 +50,7 @@
|
||||
#include "arch/ppc-linux-common.h"
|
||||
#include "arch/ppc-linux-tdesc.h"
|
||||
#include "nat/ppc-linux.h"
|
||||
+#include "linux-tdep.h"
|
||||
|
||||
/* Similarly for the hardware watchpoint support. These requests are used
|
||||
when the PowerPC HWDEBUG ptrace interface is not available. */
|
||||
@@ -1560,31 +1561,6 @@ store_ppc_registers (const struct regcache *regcache, int tid)
|
||||
function to fail most of the time, so we ignore them. */
|
||||
}
|
||||
|
||||
-/* Fetch the AT_HWCAP entry from the aux vector. */
|
||||
-static CORE_ADDR
|
||||
-ppc_linux_get_hwcap (void)
|
||||
-{
|
||||
- CORE_ADDR field;
|
||||
-
|
||||
- if (target_auxv_search (current_top_target (), AT_HWCAP, &field) != 1)
|
||||
- return 0;
|
||||
-
|
||||
- return field;
|
||||
-}
|
||||
-
|
||||
-/* Fetch the AT_HWCAP2 entry from the aux vector. */
|
||||
-
|
||||
-static CORE_ADDR
|
||||
-ppc_linux_get_hwcap2 (void)
|
||||
-{
|
||||
- CORE_ADDR field;
|
||||
-
|
||||
- if (target_auxv_search (current_top_target (), AT_HWCAP2, &field) != 1)
|
||||
- return 0;
|
||||
-
|
||||
- return field;
|
||||
-}
|
||||
-
|
||||
/* The cached DABR value, to install in new threads.
|
||||
This variable is used when the PowerPC HWDEBUG ptrace
|
||||
interface is not available. */
|
||||
@@ -1741,7 +1717,7 @@ ppc_linux_nat_target::region_ok_for_hw_watchpoint (CORE_ADDR addr, LONGEST len)
|
||||
takes two hardware watchpoints though. */
|
||||
if (len > 1
|
||||
&& hwdebug_info.features & PPC_DEBUG_FEATURE_DATA_BP_RANGE
|
||||
- && ppc_linux_get_hwcap () & PPC_FEATURE_BOOKE)
|
||||
+ && linux_get_hwcap (current_top_target ()) & PPC_FEATURE_BOOKE)
|
||||
return 2;
|
||||
/* Check if the processor provides DAWR interface. */
|
||||
if (hwdebug_info.features & PPC_DEBUG_FEATURE_DATA_BP_DAWR)
|
||||
@@ -1761,7 +1737,7 @@ ppc_linux_nat_target::region_ok_for_hw_watchpoint (CORE_ADDR addr, LONGEST len)
|
||||
ptrace interface, DAC-based processors (i.e., embedded processors) will
|
||||
use addresses aligned to 4-bytes due to the way the read/write flags are
|
||||
passed in the old ptrace interface. */
|
||||
- else if (((ppc_linux_get_hwcap () & PPC_FEATURE_BOOKE)
|
||||
+ else if (((linux_get_hwcap (current_top_target ()) & PPC_FEATURE_BOOKE)
|
||||
&& (addr + len) > (addr & ~3) + 4)
|
||||
|| (addr + len) > (addr & ~7) + 8)
|
||||
return 0;
|
||||
@@ -2303,7 +2279,7 @@ ppc_linux_nat_target::insert_watchpoint (CORE_ADDR addr, int len,
|
||||
long dabr_value;
|
||||
long read_mode, write_mode;
|
||||
|
||||
- if (ppc_linux_get_hwcap () & PPC_FEATURE_BOOKE)
|
||||
+ if (linux_get_hwcap (current_top_target ()) & PPC_FEATURE_BOOKE)
|
||||
{
|
||||
/* PowerPC 440 requires only the read/write flags to be passed
|
||||
to the kernel. */
|
||||
@@ -2506,9 +2482,9 @@ ppc_linux_nat_target::watchpoint_addr_within_range (CORE_ADDR addr,
|
||||
int mask;
|
||||
|
||||
if (have_ptrace_hwdebug_interface ()
|
||||
- && ppc_linux_get_hwcap () & PPC_FEATURE_BOOKE)
|
||||
+ && linux_get_hwcap (current_top_target ()) & PPC_FEATURE_BOOKE)
|
||||
return start <= addr && start + length >= addr;
|
||||
- else if (ppc_linux_get_hwcap () & PPC_FEATURE_BOOKE)
|
||||
+ else if (linux_get_hwcap (current_top_target ()) & PPC_FEATURE_BOOKE)
|
||||
mask = 3;
|
||||
else
|
||||
mask = 7;
|
||||
@@ -2646,8 +2622,8 @@ ppc_linux_nat_target::read_description ()
|
||||
|
||||
features.wordsize = ppc_linux_target_wordsize (tid);
|
||||
|
||||
- CORE_ADDR hwcap = ppc_linux_get_hwcap ();
|
||||
- CORE_ADDR hwcap2 = ppc_linux_get_hwcap2 ();
|
||||
+ CORE_ADDR hwcap = linux_get_hwcap (current_top_target ());
|
||||
+ CORE_ADDR hwcap2 = linux_get_hwcap2 (current_top_target ());
|
||||
|
||||
if (have_ptrace_getsetvsxregs
|
||||
&& (hwcap & PPC_FEATURE_HAS_VSX))
|
||||
diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c
|
||||
--- a/gdb/ppc-linux-tdep.c
|
||||
+++ b/gdb/ppc-linux-tdep.c
|
||||
@@ -1602,10 +1602,7 @@ ppc_linux_core_read_description (struct gdbarch *gdbarch,
|
||||
if (vsx)
|
||||
features.vsx = true;
|
||||
|
||||
- CORE_ADDR hwcap;
|
||||
-
|
||||
- if (target_auxv_search (target, AT_HWCAP, &hwcap) != 1)
|
||||
- hwcap = 0;
|
||||
+ CORE_ADDR hwcap = linux_get_hwcap (target);
|
||||
|
||||
features.isa205 = ppc_linux_has_isa205 (hwcap);
|
||||
|
||||
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
|
||||
@@ -42,6 +42,7 @@
|
||||
#include <elf.h>
|
||||
#include <algorithm>
|
||||
#include "inf-ptrace.h"
|
||||
+#include "linux-tdep.h"
|
||||
|
||||
/* Per-thread arch-specific data. */
|
||||
|
||||
@@ -1018,9 +1019,8 @@ s390_linux_nat_target::read_description ()
|
||||
that mode, report s390 architecture with 64-bit GPRs. */
|
||||
#ifdef __s390x__
|
||||
{
|
||||
- CORE_ADDR hwcap = 0;
|
||||
+ CORE_ADDR hwcap = linux_get_hwcap (current_top_target ());
|
||||
|
||||
- target_auxv_search (current_top_target (), AT_HWCAP, &hwcap);
|
||||
have_regset_tdb = (hwcap & HWCAP_S390_TE)
|
||||
&& check_regset (tid, NT_S390_TDB, s390_sizeof_tdbregset);
|
||||
|
||||
diff --git a/gdb/s390-linux-tdep.c b/gdb/s390-linux-tdep.c
|
||||
--- a/gdb/s390-linux-tdep.c
|
||||
+++ b/gdb/s390-linux-tdep.c
|
||||
@@ -332,10 +332,9 @@ s390_core_read_description (struct gdbarch *gdbarch,
|
||||
struct target_ops *target, bfd *abfd)
|
||||
{
|
||||
asection *section = bfd_get_section_by_name (abfd, ".reg");
|
||||
- CORE_ADDR hwcap = 0;
|
||||
+ CORE_ADDR hwcap = linux_get_hwcap (target);
|
||||
bool high_gprs, v1, v2, te, vx, gs;
|
||||
|
||||
- target_auxv_search (target, AT_HWCAP, &hwcap);
|
||||
if (!section)
|
||||
return NULL;
|
||||
|
|
@ -1,368 +0,0 @@
|
|||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
|
||||
Date: Wed, 7 Jul 2021 18:45:37 -0400
|
||||
Subject: gdb-rhbz1854784-powerpc-remove-region-limit-dawr-3of7.patch
|
||||
|
||||
;; Backport "[PowerPC] Move up some register access routines"
|
||||
;; (Pedro Franco de Carvalho, RH BZ 1854784)
|
||||
|
||||
Keep the routines related to register access grouped together.
|
||||
|
||||
gdb/ChangeLog:
|
||||
2020-03-30 Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
|
||||
|
||||
* ppc-linux-nat.c (ppc_linux_nat_target::store_registers)
|
||||
(ppc_linux_nat_target::auxv_parse)
|
||||
(ppc_linux_nat_target::read_description)
|
||||
(supply_gregset, fill_gregset, supply_fpregset, fill_fpregset):
|
||||
Move up.
|
||||
|
||||
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
|
||||
@@ -1561,6 +1561,170 @@ store_ppc_registers (const struct regcache *regcache, int tid)
|
||||
function to fail most of the time, so we ignore them. */
|
||||
}
|
||||
|
||||
+void
|
||||
+ppc_linux_nat_target::store_registers (struct regcache *regcache, int regno)
|
||||
+{
|
||||
+ pid_t tid = get_ptrace_pid (regcache->ptid ());
|
||||
+
|
||||
+ if (regno >= 0)
|
||||
+ store_register (regcache, tid, regno);
|
||||
+ else
|
||||
+ store_ppc_registers (regcache, tid);
|
||||
+}
|
||||
+
|
||||
+/* Functions for transferring registers between a gregset_t or fpregset_t
|
||||
+ (see sys/ucontext.h) and gdb's regcache. The word size is that used
|
||||
+ by the ptrace interface, not the current program's ABI. Eg. if a
|
||||
+ powerpc64-linux gdb is being used to debug a powerpc32-linux app, we
|
||||
+ read or write 64-bit gregsets. This is to suit the host libthread_db. */
|
||||
+
|
||||
+void
|
||||
+supply_gregset (struct regcache *regcache, const gdb_gregset_t *gregsetp)
|
||||
+{
|
||||
+ const struct regset *regset = ppc_linux_gregset (sizeof (long));
|
||||
+
|
||||
+ ppc_supply_gregset (regset, regcache, -1, gregsetp, sizeof (*gregsetp));
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+fill_gregset (const struct regcache *regcache,
|
||||
+ gdb_gregset_t *gregsetp, int regno)
|
||||
+{
|
||||
+ const struct regset *regset = ppc_linux_gregset (sizeof (long));
|
||||
+
|
||||
+ if (regno == -1)
|
||||
+ memset (gregsetp, 0, sizeof (*gregsetp));
|
||||
+ ppc_collect_gregset (regset, regcache, regno, gregsetp, sizeof (*gregsetp));
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+supply_fpregset (struct regcache *regcache, const gdb_fpregset_t * fpregsetp)
|
||||
+{
|
||||
+ const struct regset *regset = ppc_linux_fpregset ();
|
||||
+
|
||||
+ ppc_supply_fpregset (regset, regcache, -1,
|
||||
+ fpregsetp, sizeof (*fpregsetp));
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+fill_fpregset (const struct regcache *regcache,
|
||||
+ gdb_fpregset_t *fpregsetp, int regno)
|
||||
+{
|
||||
+ const struct regset *regset = ppc_linux_fpregset ();
|
||||
+
|
||||
+ ppc_collect_fpregset (regset, regcache, regno,
|
||||
+ fpregsetp, sizeof (*fpregsetp));
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+ppc_linux_nat_target::auxv_parse (gdb_byte **readptr,
|
||||
+ gdb_byte *endptr, CORE_ADDR *typep,
|
||||
+ CORE_ADDR *valp)
|
||||
+{
|
||||
+ int tid = inferior_ptid.lwp ();
|
||||
+ if (tid == 0)
|
||||
+ tid = inferior_ptid.pid ();
|
||||
+
|
||||
+ int sizeof_auxv_field = ppc_linux_target_wordsize (tid);
|
||||
+
|
||||
+ enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
|
||||
+ gdb_byte *ptr = *readptr;
|
||||
+
|
||||
+ if (endptr == ptr)
|
||||
+ return 0;
|
||||
+
|
||||
+ if (endptr - ptr < sizeof_auxv_field * 2)
|
||||
+ return -1;
|
||||
+
|
||||
+ *typep = extract_unsigned_integer (ptr, sizeof_auxv_field, byte_order);
|
||||
+ ptr += sizeof_auxv_field;
|
||||
+ *valp = extract_unsigned_integer (ptr, sizeof_auxv_field, byte_order);
|
||||
+ ptr += sizeof_auxv_field;
|
||||
+
|
||||
+ *readptr = ptr;
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
+const struct target_desc *
|
||||
+ppc_linux_nat_target::read_description ()
|
||||
+{
|
||||
+ int tid = inferior_ptid.lwp ();
|
||||
+ if (tid == 0)
|
||||
+ tid = inferior_ptid.pid ();
|
||||
+
|
||||
+ if (have_ptrace_getsetevrregs)
|
||||
+ {
|
||||
+ struct gdb_evrregset_t evrregset;
|
||||
+
|
||||
+ if (ptrace (PTRACE_GETEVRREGS, tid, 0, &evrregset) >= 0)
|
||||
+ return tdesc_powerpc_e500l;
|
||||
+
|
||||
+ /* EIO means that the PTRACE_GETEVRREGS request isn't supported.
|
||||
+ Anything else needs to be reported. */
|
||||
+ else if (errno != EIO)
|
||||
+ perror_with_name (_("Unable to fetch SPE registers"));
|
||||
+ }
|
||||
+
|
||||
+ struct ppc_linux_features features = ppc_linux_no_features;
|
||||
+
|
||||
+ features.wordsize = ppc_linux_target_wordsize (tid);
|
||||
+
|
||||
+ CORE_ADDR hwcap = linux_get_hwcap (current_top_target ());
|
||||
+ CORE_ADDR hwcap2 = linux_get_hwcap2 (current_top_target ());
|
||||
+
|
||||
+ if (have_ptrace_getsetvsxregs
|
||||
+ && (hwcap & PPC_FEATURE_HAS_VSX))
|
||||
+ {
|
||||
+ gdb_vsxregset_t vsxregset;
|
||||
+
|
||||
+ if (ptrace (PTRACE_GETVSXREGS, tid, 0, &vsxregset) >= 0)
|
||||
+ features.vsx = true;
|
||||
+
|
||||
+ /* EIO means that the PTRACE_GETVSXREGS request isn't supported.
|
||||
+ Anything else needs to be reported. */
|
||||
+ else if (errno != EIO)
|
||||
+ perror_with_name (_("Unable to fetch VSX registers"));
|
||||
+ }
|
||||
+
|
||||
+ if (have_ptrace_getvrregs
|
||||
+ && (hwcap & PPC_FEATURE_HAS_ALTIVEC))
|
||||
+ {
|
||||
+ gdb_vrregset_t vrregset;
|
||||
+
|
||||
+ if (ptrace (PTRACE_GETVRREGS, tid, 0, &vrregset) >= 0)
|
||||
+ features.altivec = true;
|
||||
+
|
||||
+ /* EIO means that the PTRACE_GETVRREGS request isn't supported.
|
||||
+ Anything else needs to be reported. */
|
||||
+ else if (errno != EIO)
|
||||
+ perror_with_name (_("Unable to fetch AltiVec registers"));
|
||||
+ }
|
||||
+
|
||||
+ features.isa205 = ppc_linux_has_isa205 (hwcap);
|
||||
+
|
||||
+ if ((hwcap2 & PPC_FEATURE2_DSCR)
|
||||
+ && check_regset (tid, NT_PPC_PPR, PPC_LINUX_SIZEOF_PPRREGSET)
|
||||
+ && check_regset (tid, NT_PPC_DSCR, PPC_LINUX_SIZEOF_DSCRREGSET))
|
||||
+ {
|
||||
+ features.ppr_dscr = true;
|
||||
+ if ((hwcap2 & PPC_FEATURE2_ARCH_2_07)
|
||||
+ && (hwcap2 & PPC_FEATURE2_TAR)
|
||||
+ && (hwcap2 & PPC_FEATURE2_EBB)
|
||||
+ && check_regset (tid, NT_PPC_TAR, PPC_LINUX_SIZEOF_TARREGSET)
|
||||
+ && check_regset (tid, NT_PPC_EBB, PPC_LINUX_SIZEOF_EBBREGSET)
|
||||
+ && check_regset (tid, NT_PPC_PMU, PPC_LINUX_SIZEOF_PMUREGSET))
|
||||
+ {
|
||||
+ features.isa207 = true;
|
||||
+ if ((hwcap2 & PPC_FEATURE2_HTM)
|
||||
+ && check_regset (tid, NT_PPC_TM_SPR,
|
||||
+ PPC_LINUX_SIZEOF_TM_SPRREGSET))
|
||||
+ features.htm = true;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return ppc_linux_match_description (features);
|
||||
+}
|
||||
+
|
||||
/* The cached DABR value, to install in new threads.
|
||||
This variable is used when the PowerPC HWDEBUG ptrace
|
||||
interface is not available. */
|
||||
@@ -2514,173 +2678,7 @@ ppc_linux_nat_target::masked_watch_num_registers (CORE_ADDR addr, CORE_ADDR mask
|
||||
return 2;
|
||||
}
|
||||
|
||||
-void
|
||||
-ppc_linux_nat_target::store_registers (struct regcache *regcache, int regno)
|
||||
-{
|
||||
- pid_t tid = get_ptrace_pid (regcache->ptid ());
|
||||
-
|
||||
- if (regno >= 0)
|
||||
- store_register (regcache, tid, regno);
|
||||
- else
|
||||
- store_ppc_registers (regcache, tid);
|
||||
-}
|
||||
-
|
||||
-/* Functions for transferring registers between a gregset_t or fpregset_t
|
||||
- (see sys/ucontext.h) and gdb's regcache. The word size is that used
|
||||
- by the ptrace interface, not the current program's ABI. Eg. if a
|
||||
- powerpc64-linux gdb is being used to debug a powerpc32-linux app, we
|
||||
- read or write 64-bit gregsets. This is to suit the host libthread_db. */
|
||||
-
|
||||
-void
|
||||
-supply_gregset (struct regcache *regcache, const gdb_gregset_t *gregsetp)
|
||||
-{
|
||||
- const struct regset *regset = ppc_linux_gregset (sizeof (long));
|
||||
-
|
||||
- ppc_supply_gregset (regset, regcache, -1, gregsetp, sizeof (*gregsetp));
|
||||
-}
|
||||
-
|
||||
-void
|
||||
-fill_gregset (const struct regcache *regcache,
|
||||
- gdb_gregset_t *gregsetp, int regno)
|
||||
-{
|
||||
- const struct regset *regset = ppc_linux_gregset (sizeof (long));
|
||||
-
|
||||
- if (regno == -1)
|
||||
- memset (gregsetp, 0, sizeof (*gregsetp));
|
||||
- ppc_collect_gregset (regset, regcache, regno, gregsetp, sizeof (*gregsetp));
|
||||
-}
|
||||
-
|
||||
-void
|
||||
-supply_fpregset (struct regcache *regcache, const gdb_fpregset_t * fpregsetp)
|
||||
-{
|
||||
- const struct regset *regset = ppc_linux_fpregset ();
|
||||
-
|
||||
- ppc_supply_fpregset (regset, regcache, -1,
|
||||
- fpregsetp, sizeof (*fpregsetp));
|
||||
-}
|
||||
-
|
||||
-void
|
||||
-fill_fpregset (const struct regcache *regcache,
|
||||
- gdb_fpregset_t *fpregsetp, int regno)
|
||||
-{
|
||||
- const struct regset *regset = ppc_linux_fpregset ();
|
||||
-
|
||||
- ppc_collect_fpregset (regset, regcache, regno,
|
||||
- fpregsetp, sizeof (*fpregsetp));
|
||||
-}
|
||||
-
|
||||
-int
|
||||
-ppc_linux_nat_target::auxv_parse (gdb_byte **readptr,
|
||||
- gdb_byte *endptr, CORE_ADDR *typep,
|
||||
- CORE_ADDR *valp)
|
||||
-{
|
||||
- int tid = inferior_ptid.lwp ();
|
||||
- if (tid == 0)
|
||||
- tid = inferior_ptid.pid ();
|
||||
-
|
||||
- int sizeof_auxv_field = ppc_linux_target_wordsize (tid);
|
||||
-
|
||||
- enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
|
||||
- gdb_byte *ptr = *readptr;
|
||||
-
|
||||
- if (endptr == ptr)
|
||||
- return 0;
|
||||
-
|
||||
- if (endptr - ptr < sizeof_auxv_field * 2)
|
||||
- return -1;
|
||||
-
|
||||
- *typep = extract_unsigned_integer (ptr, sizeof_auxv_field, byte_order);
|
||||
- ptr += sizeof_auxv_field;
|
||||
- *valp = extract_unsigned_integer (ptr, sizeof_auxv_field, byte_order);
|
||||
- ptr += sizeof_auxv_field;
|
||||
-
|
||||
- *readptr = ptr;
|
||||
- return 1;
|
||||
-}
|
||||
-
|
||||
-const struct target_desc *
|
||||
-ppc_linux_nat_target::read_description ()
|
||||
-{
|
||||
- int tid = inferior_ptid.lwp ();
|
||||
- if (tid == 0)
|
||||
- tid = inferior_ptid.pid ();
|
||||
-
|
||||
- if (have_ptrace_getsetevrregs)
|
||||
- {
|
||||
- struct gdb_evrregset_t evrregset;
|
||||
-
|
||||
- if (ptrace (PTRACE_GETEVRREGS, tid, 0, &evrregset) >= 0)
|
||||
- return tdesc_powerpc_e500l;
|
||||
-
|
||||
- /* EIO means that the PTRACE_GETEVRREGS request isn't supported.
|
||||
- Anything else needs to be reported. */
|
||||
- else if (errno != EIO)
|
||||
- perror_with_name (_("Unable to fetch SPE registers"));
|
||||
- }
|
||||
-
|
||||
- struct ppc_linux_features features = ppc_linux_no_features;
|
||||
-
|
||||
- features.wordsize = ppc_linux_target_wordsize (tid);
|
||||
-
|
||||
- CORE_ADDR hwcap = linux_get_hwcap (current_top_target ());
|
||||
- CORE_ADDR hwcap2 = linux_get_hwcap2 (current_top_target ());
|
||||
-
|
||||
- if (have_ptrace_getsetvsxregs
|
||||
- && (hwcap & PPC_FEATURE_HAS_VSX))
|
||||
- {
|
||||
- gdb_vsxregset_t vsxregset;
|
||||
-
|
||||
- if (ptrace (PTRACE_GETVSXREGS, tid, 0, &vsxregset) >= 0)
|
||||
- features.vsx = true;
|
||||
-
|
||||
- /* EIO means that the PTRACE_GETVSXREGS request isn't supported.
|
||||
- Anything else needs to be reported. */
|
||||
- else if (errno != EIO)
|
||||
- perror_with_name (_("Unable to fetch VSX registers"));
|
||||
- }
|
||||
-
|
||||
- if (have_ptrace_getvrregs
|
||||
- && (hwcap & PPC_FEATURE_HAS_ALTIVEC))
|
||||
- {
|
||||
- gdb_vrregset_t vrregset;
|
||||
-
|
||||
- if (ptrace (PTRACE_GETVRREGS, tid, 0, &vrregset) >= 0)
|
||||
- features.altivec = true;
|
||||
-
|
||||
- /* EIO means that the PTRACE_GETVRREGS request isn't supported.
|
||||
- Anything else needs to be reported. */
|
||||
- else if (errno != EIO)
|
||||
- perror_with_name (_("Unable to fetch AltiVec registers"));
|
||||
- }
|
||||
-
|
||||
- if (hwcap & PPC_FEATURE_CELL)
|
||||
- features.cell = true;
|
||||
-
|
||||
- features.isa205 = ppc_linux_has_isa205 (hwcap);
|
||||
-
|
||||
- if ((hwcap2 & PPC_FEATURE2_DSCR)
|
||||
- && check_regset (tid, NT_PPC_PPR, PPC_LINUX_SIZEOF_PPRREGSET)
|
||||
- && check_regset (tid, NT_PPC_DSCR, PPC_LINUX_SIZEOF_DSCRREGSET))
|
||||
- {
|
||||
- features.ppr_dscr = true;
|
||||
- if ((hwcap2 & PPC_FEATURE2_ARCH_2_07)
|
||||
- && (hwcap2 & PPC_FEATURE2_TAR)
|
||||
- && (hwcap2 & PPC_FEATURE2_EBB)
|
||||
- && check_regset (tid, NT_PPC_TAR, PPC_LINUX_SIZEOF_TARREGSET)
|
||||
- && check_regset (tid, NT_PPC_EBB, PPC_LINUX_SIZEOF_EBBREGSET)
|
||||
- && check_regset (tid, NT_PPC_PMU, PPC_LINUX_SIZEOF_PMUREGSET))
|
||||
- {
|
||||
- features.isa207 = true;
|
||||
- if ((hwcap2 & PPC_FEATURE2_HTM)
|
||||
- && check_regset (tid, NT_PPC_TM_SPR,
|
||||
- PPC_LINUX_SIZEOF_TM_SPRREGSET))
|
||||
- features.htm = true;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- return ppc_linux_match_description (features);
|
||||
-}
|
||||
-
|
||||
+void _initialize_ppc_linux_nat ();
|
||||
void
|
||||
_initialize_ppc_linux_nat (void)
|
||||
{
|
File diff suppressed because it is too large
Load Diff
|
@ -1,58 +0,0 @@
|
|||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
|
||||
Date: Wed, 7 Jul 2021 19:03:16 -0400
|
||||
Subject: gdb-rhbz1854784-powerpc-remove-region-limit-dawr-5of7.patch
|
||||
|
||||
;; Backport "[PowerPC] Use < 0 and >= 0 for watchpoint ptrace calls"
|
||||
;; (Pedro Franco de Carvalho, RH BZ 1854784)
|
||||
|
||||
In commit 227c0bf4b3dd0cf65dceb58e729e9da81b38b5a7, which fixed some
|
||||
watchpoint bugs, I compared the return value of some ptrace calls with ==
|
||||
-1 and != -1. Althought this should be correct, since the rest of the
|
||||
file uses < 0 and >= 0, I have modified this for consistency.
|
||||
|
||||
gdb/ChangeLog:
|
||||
|
||||
* ppc-linux-nat.c (ppc_linux_dreg_interface::detect)
|
||||
(ppc_linux_nat_target::low_prepare_to_resume): Use ptrace () < 0
|
||||
and >= to check return value instead of == -1 and != -1.
|
||||
|
||||
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
|
||||
@@ -385,7 +385,7 @@ public:
|
||||
bool no_features = false;
|
||||
|
||||
if (ptrace (PPC_PTRACE_GETHWDBGINFO, ptid.lwp (), 0, &m_hwdebug_info)
|
||||
- != -1)
|
||||
+ >= 0)
|
||||
{
|
||||
/* If there are no advertised features, we don't use the
|
||||
HWDEBUG interface and try the DEBUGREG interface instead.
|
||||
@@ -431,7 +431,7 @@ public:
|
||||
{
|
||||
unsigned long wp;
|
||||
|
||||
- if (ptrace (PTRACE_GET_DEBUGREG, ptid.lwp (), 0, &wp) != -1)
|
||||
+ if (ptrace (PTRACE_GET_DEBUGREG, ptid.lwp (), 0, &wp) >= 0)
|
||||
{
|
||||
m_interface.emplace (DEBUGREG);
|
||||
return;
|
||||
@@ -2880,7 +2880,7 @@ ppc_linux_nat_target::low_prepare_to_resume (struct lwp_info *lp)
|
||||
the debug register state when fork and clone events are
|
||||
detected. */
|
||||
if (ptrace (PPC_PTRACE_DELHWDEBUG, lp->ptid.lwp (), 0,
|
||||
- bp_it->first) == -1)
|
||||
+ bp_it->first) < 0)
|
||||
if (errno != ENOENT)
|
||||
perror_with_name (_("Error deleting hardware "
|
||||
"breakpoint or watchpoint"));
|
||||
@@ -2934,7 +2934,7 @@ ppc_linux_nat_target::low_prepare_to_resume (struct lwp_info *lp)
|
||||
long ret = ptrace (PTRACE_SET_DEBUGREG, lp->ptid.lwp (),
|
||||
0, wp);
|
||||
|
||||
- if (ret == -1)
|
||||
+ if (ret < 0)
|
||||
perror_with_name (_("Error setting hardware watchpoint"));
|
||||
}
|
||||
|
|
@ -1,86 +0,0 @@
|
|||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
|
||||
Date: Wed, 7 Jul 2021 19:05:04 -0400
|
||||
Subject: gdb-rhbz1854784-powerpc-remove-region-limit-dawr-6of7.patch
|
||||
|
||||
;; Backport "[PowerPC] Always clear watchpoint with PTRACE_SET_DEBUGREG"
|
||||
;; (Pedro Franco de Carvalho, RH BZ 1854784)
|
||||
|
||||
This patches changes low_prepare_to_resume in the ppc linux native target
|
||||
to always clear the watchpoint when the old PTRACE_SET_DEBUGREG interface
|
||||
is used, even if another watchpoint GDB requested to the target is
|
||||
written right after using the same call.
|
||||
|
||||
The reason for this is that there were some older kernel versions for
|
||||
which overwriting a watchpoint with PTRACE_SET_DEBUGREG would not
|
||||
re-activate the watchpoint if it was previouly disabled following a hit.
|
||||
This happened when the kernel was configured with CONFIG_HW_BREAKPOINT on
|
||||
and uses perf events to install watchpoints.
|
||||
|
||||
Previously, the ppc linux native target would immediately remove or
|
||||
insert watchpoints following a request from the upper layers. This was
|
||||
changed in commit 227c0bf4b3dd0cf65dceb58e729e9da81b38b5a7 to fix other
|
||||
issues, which caused watchpoint requests to be applied to the inferior
|
||||
only in low_prepare_to_resume, right before the inferior is resumed.
|
||||
|
||||
Usually, but maybe not always, after a hit, GDB will remove the
|
||||
watchpoint, resume the inferior for a single-step, possibly report the
|
||||
watchpoint hit to the user, and then re-insert the watchpoint before the
|
||||
inferior is next resumed. In this case there would be no problems, but
|
||||
since I can't guarantee that there aren't other paths in GDB that allow
|
||||
the user to set a new watchpoint after the first one hit, and after its
|
||||
deletion by GDB, but before the inferior is resumed, there is a chance
|
||||
that PTRACE_SET_DEBUGREG could be called directly without the watchpoint
|
||||
first having been cleared, which could cause a false negative with the
|
||||
older kernel versions.
|
||||
|
||||
This issue would affect kernel versions starting from this commit:
|
||||
|
||||
5aae8a53708025d4e718f0d2e7c2f766779ddc71
|
||||
|
||||
Up to the fix in this commit:
|
||||
|
||||
a53fd61ac2f411745471c1c877d5e072fbbf0e5c
|
||||
|
||||
gdb/ChangeLog:
|
||||
|
||||
PR breakpoints/26385
|
||||
* ppc-linux-nat.c (ppc_linux_nat_target::low_prepare_to_resume):
|
||||
Always clear watchpoint with PTRACE_SET_DEBUGREG.
|
||||
|
||||
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
|
||||
@@ -2922,20 +2922,23 @@ ppc_linux_nat_target::low_prepare_to_resume (struct lwp_info *lp)
|
||||
{
|
||||
gdb_assert (m_dreg_interface.debugreg_p ());
|
||||
|
||||
- /* Passing 0 to PTRACE_SET_DEBUGREG will clear the
|
||||
- watchpoint. */
|
||||
- long wp = 0;
|
||||
+ /* Passing 0 to PTRACE_SET_DEBUGREG will clear the watchpoint. We
|
||||
+ always clear the watchpoint instead of just overwriting it, in
|
||||
+ case there is a request for a new watchpoint, because on some
|
||||
+ older kernel versions and configurations simply overwriting the
|
||||
+ watchpoint after it was hit would not re-enable it. */
|
||||
+ if (ptrace (PTRACE_SET_DEBUGREG, lp->ptid.lwp (), 0, 0) < 0)
|
||||
+ perror_with_name (_("Error clearing hardware watchpoint"));
|
||||
|
||||
/* GDB requested a watchpoint to be installed. */
|
||||
if (process_it != m_process_info.end ()
|
||||
&& process_it->second.requested_wp_val.has_value ())
|
||||
- wp = *(process_it->second.requested_wp_val);
|
||||
-
|
||||
- long ret = ptrace (PTRACE_SET_DEBUGREG, lp->ptid.lwp (),
|
||||
- 0, wp);
|
||||
+ {
|
||||
+ long wp = *(process_it->second.requested_wp_val);
|
||||
|
||||
- if (ret < 0)
|
||||
- perror_with_name (_("Error setting hardware watchpoint"));
|
||||
+ if (ptrace (PTRACE_SET_DEBUGREG, lp->ptid.lwp (), 0, wp) < 0)
|
||||
+ perror_with_name (_("Error setting hardware watchpoint"));
|
||||
+ }
|
||||
}
|
||||
|
||||
lp_arch_info->debug_regs_stale = false;
|
|
@ -1,108 +0,0 @@
|
|||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Keith Seitz <keiths@redhat.com>
|
||||
Date: Fri, 23 Oct 2020 17:12:26 -0400
|
||||
Subject:
|
||||
gdb-rhbz1878810-bfd-suppress-loadable-section-outside-ELF-sections.patch
|
||||
|
||||
;; Backport "Stop the BFD library from issuing a warning message when
|
||||
;; processing allocated sections in debuginfo files that lie outside of
|
||||
;; Nick Clifton and Keith Seitz, RH BZ 1878810
|
||||
|
||||
Stop the BFD library from issuing a warning message when processing allocated sections in debuginfo files that lie outside of any loadable segment.
|
||||
|
||||
bfd/ChangeLog
|
||||
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.
|
||||
|
||||
gdb/ChangeLog
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1553086
|
||||
* elfread.c (elf_symfile_segments): Omit "Loadable section ...
|
||||
outside of ELF segments" warning for debugin
|
||||
|
||||
diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
|
||||
--- a/bfd/elf-bfd.h
|
||||
+++ b/bfd/elf-bfd.h
|
||||
@@ -2740,6 +2740,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
|
||||
@@ -5725,6 +5725,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
|
||||
@@ -5758,7 +5787,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"),
|
||||
diff --git a/gdb/elfread.c b/gdb/elfread.c
|
||||
--- a/gdb/elfread.c
|
||||
+++ b/gdb/elfread.c
|
||||
@@ -143,7 +143,12 @@ elf_symfile_segments (bfd *abfd)
|
||||
RealView) use SHT_NOBITS for uninitialized data. Since it is
|
||||
uninitialized, it doesn't need a program header. Such
|
||||
binaries are not relocatable. */
|
||||
- if (bfd_get_section_size (sect) > 0 && j == num_segments
|
||||
+
|
||||
+ /* Exclude debuginfo files from this warning, too, since those
|
||||
+ are often not strictly compliant with the standard. See, e.g.,
|
||||
+ ld/24717 for more discussion. */
|
||||
+ if (!is_debuginfo_file (abfd)
|
||||
+ && bfd_get_section_size (sect) > 0 && j == num_segments
|
||||
&& (bfd_get_section_flags (abfd, sect) & SEC_LOAD) != 0)
|
||||
warning (_("Loadable section \"%s\" outside of ELF segments"),
|
||||
bfd_section_name (abfd, sect));
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue