Compare commits

..

16 Commits
master ... f8

Author SHA1 Message Date
Fedora Release Engineering 786363cc80 dist-git conversion 2010-07-28 15:14:01 +00:00
Jan Kratochvil 44759d2053 - Backport of follow-fork-mode child fixes (BZ 435819). 2008-03-13 22:41:46 +00:00
Jan Kratochvil d9433c08c4 - build-id warnings integrated more with rpm and the lists of the warnings
got replaced usually by a single-line `debuginfo-install' advice.
- FIXME: Testsuite needs an update for the new pre-prompt messages.
2008-03-10 10:05:57 +00:00
Jan Kratochvil 9ca8266fa9 - Rename `set debug build-id' as `set build-id-verbose', former level 1
moved to level 2, default value is now 1, use `set build-id-verbose 0'
    now to disable the missing separate debug filenames messages (BZ
    432164).
2008-02-21 21:41:37 +00:00
Jan Kratochvil 016b09ad5a - build-id debug messages print now the library names unconditionally. 2008-01-24 19:46:22 +00:00
Jan Kratochvil b42fa924f5 - Improve the text UI messages for the build-id debug files locating.
- Require now the rpm libraries.
2008-01-24 16:47:06 +00:00
Jan Kratochvil d8f0854cc3 - Fix+test (backport) threading of statically linked inferiors (BZ 314131).
- It requires recent glibc to work in this case properly.
2008-01-11 16:45:57 +00:00
Jan Kratochvil 2ddeb47291 - Fix (backport) PPC biarch (ppc64->ppc) addresses above 2GB (BZ 426613).
- Fix the vendora testcase `attach-32.exp' affecting the other tests
    results.
2007-12-27 23:05:49 +00:00
Jan Kratochvil 2344090082 - Fix crash on parsing duplicite file entries debug info (BZ 426395).
- Fix (#2) readline history for input mode commands like `command' (BZ
    215816).
- Fix documentation on hardware watchpoints wrt multiple threads.
- Rename the patch file for BZ 235197 from its former name BZ 234468.
2007-12-22 14:38:42 +00:00
Jan Kratochvil 337e4aece4 - Testsuite fixes for more stable/comparable results. 2007-12-10 22:59:26 +00:00
Jan Kratochvil bf98f1521f - Fix `errno' resolving on glibc with broken DW_AT_MIPS_linkage_name.
- Imported 6.7 PPC hiding of call-volatile parameter registers.
2007-11-08 22:41:53 +00:00
Jan Kratochvil a2e23a1b95 - Fix hiding unexpected breakpoints on intentional step/next commands.
- Fix s390 compilation warning/failure due to a wrongly sized type-cast.
2007-10-19 00:14:57 +00:00
Jan Kratochvil 42bbf11750 - Set the breakpoints always to all the ctors/dtors variants (BZ 301701).
- Fix non-threaded watchpoints CTRL-C regression on `set follow child'.
- Fix hardware watchpoints after inferior forks-off some process.
2007-10-14 21:11:56 +00:00
Jan Kratochvil 31f942e84f - Fix gdbserver for threaded applications and recent glibc (BZ 328021). 2007-10-12 09:17:46 +00:00
Jan Kratochvil d60484c185 - Fix debug load for sparse assembler files (such as vDSO32 for
i386-on-x86_64).
- Fix a TUI visual corruption due to the build-id warnings (BZ 320061).
- Fixed the kernel i386-on-x86_64 VDSO loading (producing `Lowest section
    in').
2007-10-10 23:23:18 +00:00
Kevin Fenzi c9671303f2 Initialize branch F-8 for gdb 2007-10-08 18:48:43 +00:00
232 changed files with 24190 additions and 28456 deletions

5
.gitignore vendored
View File

@ -1,4 +1 @@
/binutils-gdb
/gdb-libstdc++-v3-python-8.1.1-20180626.tar.xz
/v2.0.2.tar.gz
/gdb-10.1.tar.xz
gdb-6.6.tar.bz2

View File

@ -1,104 +0,0 @@
# 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`

View File

@ -1,384 +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
# Add a wrapper script to GDB that implements pstack using the
# --readnever option.
#=push
Patch005: gdb-6.3-gstack-20050411.patch
# VSYSCALL and PIE
#=fedoratest
Patch006: gdb-6.3-test-pie-20050107.patch
# Get selftest working with sep-debug-info
#=fedoratest
Patch007: gdb-6.3-test-self-20050110.patch
# Test support of multiple destructors just like multiple constructors
#=fedoratest
Patch008: gdb-6.3-test-dtorfix-20050121.patch
# Fix to support executable moving
#=fedoratest
Patch009: gdb-6.3-test-movedir-20050125.patch
# Test sibling threads to set threaded watchpoints for x86 and x86-64
#=fedoratest
Patch010: gdb-6.3-threaded-watchpoints2-20050225.patch
# Verify printing of inherited members test
#=fedoratest
Patch012: gdb-6.3-inheritancetest-20050726.patch
# Support TLS symbols (+`errno' suggestion if no pthread is found) (BZ 185337).
#=push+jan: It should be replaced by Infinity project.
Patch013: 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.
Patch014: 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.
Patch015: gdb-6.5-BEA-testsuite.patch
# Testcase for deadlocking on last address space byte; for corrupted backtraces.
#=fedoratest
Patch016: gdb-6.5-last-address-space-byte-test.patch
# Fix readline segfault on excessively long hand-typed lines.
#=fedoratest
Patch017: gdb-6.5-readline-long-line-crash-test.patch
# Test sideeffects of skipping ppc .so libs trampolines (BZ 218379).
#=fedoratest
Patch018: gdb-6.5-bz218379-ppc-solib-trampoline-test.patch
# Fix lockup on trampoline vs. its function lookup; unreproducible (BZ 218379).
#=fedora
Patch019: gdb-6.5-bz218379-solib-trampoline-lookup-lock-fix.patch
# Find symbols properly at their original (included) file (BZ 109921).
#=fedoratest
Patch020: gdb-6.5-bz109921-DW_AT_decl_file-test.patch
# Update PPC unwinding patches to their upstream variants (BZ 140532).
#=fedoratest
Patch021: gdb-6.3-bz140532-ppc-unwinding-test.patch
# Testcase for exec() from threaded program (BZ 202689).
#=fedoratest
Patch022: gdb-6.3-bz202689-exec-from-pthread-test.patch
# Testcase for PPC Power6/DFP instructions disassembly (BZ 230000).
#=fedoratest
Patch023: gdb-6.6-bz230000-power6-disassembly-test.patch
# Allow running `/usr/bin/gcore' with provided but inaccessible tty (BZ 229517).
#=fedoratest
Patch024: gdb-6.6-bz229517-gcore-without-terminal.patch
# Avoid too long timeouts on failing cases of "annota1.exp annota3.exp".
#=fedoratest
Patch025: gdb-6.6-testsuite-timeouts.patch
# Support for stepping over PPC atomic instruction sequences (BZ 237572).
#=fedoratest
Patch026: gdb-6.6-bz237572-ppc-atomic-sequence-test.patch
# Test leftover zombie process (BZ 243845).
#=fedoratest
Patch028: gdb-6.5-bz243845-stale-testing-zombie-test.patch
# New locating of the matching binaries from the pure core file (build-id).
#=push+jan
Patch029: 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
Patch030: gdb-6.6-buildid-locate-solib-missing-ids.patch
#=push+jan
Patch031: 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.
Patch032: gdb-6.7-charsign-test.patch
# Test PPC hiding of call-volatile parameter register.
#=fedoratest
Patch033: gdb-6.7-ppc-clobbered-registers-O2-test.patch
# Testsuite fixes for more stable/comparable results.
#=fedoratest
Patch034: gdb-6.7-testsuite-stable-results.patch
# Test ia64 memory leaks of the code using libunwind.
#=fedoratest
Patch035: gdb-6.5-ia64-libunwind-leak-test.patch
# Test hiding unexpected breakpoints on intentional step commands.
#=fedoratest
Patch036: gdb-6.5-missed-trap-on-step-test.patch
# Test GCORE for shmid 0 shared memory mappings.
#=fedoratest: But it is broken anyway, sometimes the case being tested is not reproducible.
Patch038: gdb-6.3-mapping-zero-inode-test.patch
# Test a crash on `focus cmd', `focus prev' commands.
#=fedoratest
Patch039: gdb-6.3-focus-cmd-prev-test.patch
# Test various forms of threads tracking across exec() (BZ 442765).
#=fedoratest
Patch040: gdb-6.8-bz442765-threaded-exec-test.patch
# Test a crash on libraries missing the .text section.
#=fedoratest
Patch041: gdb-6.5-section-num-fixup-test.patch
# Fix resolving of variables at locations lists in prelinked libs (BZ 466901).
#=fedoratest
Patch042: gdb-6.8-bz466901-backtrace-full-prelinked.patch
# New test for step-resume breakpoint placed in multiple threads at once.
#=fedoratest
Patch043: 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@.*>
Patch044: gdb-core-open-vdso-warning.patch
# Fix stepping with OMP parallel Fortran sections (BZ 533176).
#=push+jan: It requires some better DWARF annotations.
Patch045: gdb-bz533176-fortran-omp-step.patch
# Workaround ccache making lineno non-zero for command-line definitions.
#=fedoratest: ccache is rarely used and it is even fixed now.
Patch046: gdb-ccache-workaround.patch
#=push+jan: May get obsoleted by Tom's unrelocated objfiles patch.
Patch047: gdb-archer-pie-addons.patch
#=push+jan: Breakpoints disabling matching should not be based on address.
Patch048: gdb-archer-pie-addons-keep-disabled.patch
# Testcase for "Do not make up line information" fix by Daniel Jacobowitz.
#=fedoratest
Patch049: gdb-lineno-makeup-test.patch
# Test power7 ppc disassembly.
#=fedoratest
Patch050: gdb-ppc-power7-test.patch
# Workaround non-stop moribund locations exploited by kernel utrace (BZ 590623).
#=push+jan: Currently it is still not fully safe.
Patch051: gdb-moribund-utrace-workaround.patch
# Fix follow-exec for C++ programs (bugreported by Martin Stransky).
#=fedoratest
Patch052: gdb-archer-next-over-throw-cxx-exec.patch
# Backport DWARF-4 support (BZ 601887, Tom Tromey).
#=fedoratest
Patch053: gdb-bz601887-dwarf4-rh-test.patch
#=push+jan
Patch054: gdb-6.6-buildid-locate-core-as-arg.patch
# Workaround librpm BZ 643031 due to its unexpected exit() calls (BZ 642879).
#=push+jan
Patch055: gdb-6.6-buildid-locate-rpm-librpm-workaround.patch
# [delayed-symfile] Test a backtrace regression on CFIs without DIE (BZ 614604).
#=fedoratest
Patch056: gdb-test-bt-cfi-without-die.patch
# Verify GDB Python built-in function gdb.solib_address exists (BZ # 634108).
#=fedoratest
Patch057: gdb-bz634108-solib_address.patch
# New test gdb.arch/x86_64-pid0-core.exp for kernel PID 0 cores (BZ 611435).
#=fedoratest
Patch058: gdb-test-pid0-core.patch
# [archer-tromey-delayed-symfile] New test gdb.dwarf2/dw2-aranges.exp.
#=fedoratest
Patch059: gdb-test-dw2-aranges.patch
# [archer-keiths-expr-cumulative+upstream] Import C++ testcases.
#=fedoratest
Patch060: gdb-test-expr-cumulative-archer.patch
# Fix regressions on C++ names resolving (PR 11734, PR 12273, Keith Seitz).
#=fedoratest
Patch061: gdb-physname-pr11734-test.patch
# Fix regressions on C++ names resolving (PR 11734, PR 12273, Keith Seitz).
#=fedoratest
Patch062: gdb-physname-pr12273-test.patch
# Test GDB opcodes/ disassembly of Intel Ivy Bridge instructions (BZ 696890).
#=fedoratest
Patch063: gdb-test-ivy-bridge.patch
# Hack for proper PIE run of the testsuite.
#=fedoratest
Patch064: gdb-runtest-pie-override.patch
# Print reasons for failed attach/spawn incl. SELinux deny_ptrace (BZ 786878).
#=push+jan
Patch065: gdb-attach-fail-reasons-5of5.patch
# Workaround PR libc/14166 for inferior calls of strstr.
#=fedoratest: Compatibility with RHELs (unchecked which ones).
Patch066: gdb-glibc-strstr-workaround.patch
# Include testcase for `Unable to see a variable inside a module (XLF)' (BZ 823789).
#=fedoratest
Patch067: gdb-rhel5.9-testcase-xlf-var-inside-mod.patch
# Testcase for `Setting solib-absolute-prefix breaks vDSO' (BZ 818343).
#=fedoratest
Patch068: gdb-rhbz-818343-set-solib-absolute-prefix-testcase.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
Patch069: gdb-rhbz947564-findvar-assertion-frame-failed-testcase.patch
# Fix crash of -readnow /usr/lib/debug/usr/bin/gnatbind.debug (BZ 1069211).
#=push+jan
Patch070: gdb-gnat-dwarf-crash-3of3.patch
# Fix 'memory leak in infpy_read_memory()' (RH BZ 1007614)
#=fedoratest
Patch071: 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
Patch072: gdb-6.6-buildid-locate-misleading-warning-missing-debuginfo-rhbz981154.patch
#=fedoratest
Patch073: gdb-archer-vla-tests.patch
#=fedoratest
Patch074: gdb-vla-intel-tests.patch
# Continue backtrace even if a frame filter throws an exception (Phil Muldoon).
#=push
Patch075: gdb-btrobust.patch
# Display Fortran strings in backtraces.
#=fedoratest
Patch076: gdb-fortran-frame-string.patch
# Testcase for '[SAP] Recursive dlopen causes SAP HANA installer to
# crash.' (RH BZ 1156192).
#=fedoratest
Patch077: gdb-rhbz1156192-recursive-dlopen-test.patch
# Fix jit-reader.h for multi-lib.
#=push+jan
Patch078: gdb-jit-reader-multilib.patch
# Fix '`catch syscall' doesn't work for parent after `fork' is called'
# (Philippe Waroquiers, RH BZ 1149205).
#=fedoratest
Patch079: 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
Patch080: gdb-rhbz1186476-internal-error-unqualified-name-re-set-test.patch
# Test 'info type-printers' Python error (RH BZ 1350436).
#=fedoratest
Patch081: gdb-rhbz1350436-type-printers-error.patch
# Fix '[ppc64] and [s390x] wrong prologue skip on -O2 -g code' (Jan
# Kratochvil, RH BZ 1084404).
#=fedoratest
Patch082: 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
Patch083: gdb-bz1219747-attach-kills.patch
# Force libncursesw over libncurses to match the includes (RH BZ 1270534).
#=push+jan
Patch084: gdb-fedora-libncursesw.patch
# Test clflushopt instruction decode (for RH BZ 1262471).
#=fedoratest
Patch085: gdb-opcodes-clflushopt-test.patch
# [rhel6] DTS backward Python compatibility API (BZ 1020004, Phil Muldoon).
#=fedora
Patch086: gdb-dts-rhel6-python-compat.patch
# [SCL] Skip deprecated .gdb_index warning for Red Hat built files (BZ 953585).
#=push+jan
Patch087: gdb-6.6-buildid-locate-rpm-scl.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 .
Patch088: gdb-6.8-quit-never-aborts.patch
# [aarch64] Fix hardware watchpoints (RH BZ 1261564).
#=fedoratest
Patch089: gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch
# Add messages suggesting more recent RHEL gdbserver (RH BZ 1321114).
#=fedora
Patch090: gdb-container-rh-pkg.patch
# New test for Python "Cannot locate object file for block" (for RH BZ 1325795).
#=fedoratest
Patch091: gdb-rhbz1325795-framefilters-test.patch
# [dts+el7] [x86*] Bundle linux_perf.h for libipt (RH BZ 1256513).
#=fedora
Patch092: gdb-linux_perf-bundle.patch
# Fix gdb-headless /usr/bin/ executables (BZ 1390251).
#
# Also, make /usr/bin/gdb.minimal be the default GDB used, if it's
# present. For rationale, see:
#
# https://fedoraproject.org/wiki/Changes/Minimal_GDB_in_buildroot
#=fedora
Patch093: gdb-libexec-add-index.patch
# New testcase for: Fix <tab>-completion crash (Gary Benson, RH BZ 1398387).
#=fedoratest
Patch094: gdb-rhbz1398387-tab-crash-test.patch
# Python patches of: http://sourceware.org/gdb/wiki/ProjectArcher
#=push
Patch095: gdb-archer.patch
# Revert upstream commit 469412dd9ccc4de5874fd3299b105833f36b34cd
Patch096: gdb-vla-intel-fix-print-char-array.patch
# [s390x] Backport arch12 instructions decoding (RH BZ 1553104).
# =fedoratest
Patch097: gdb-rhbz1553104-s390x-arch12-test.patch

View File

@ -1,94 +0,0 @@
%patch001 -p1
%patch002 -p1
%patch003 -p1
%patch004 -p1
%patch005 -p1
%patch006 -p1
%patch007 -p1
%patch008 -p1
%patch009 -p1
%patch010 -p1
%patch012 -p1
%patch013 -p1
%patch014 -p1
%patch015 -p1
%patch016 -p1
%patch017 -p1
%patch018 -p1
%patch019 -p1
%patch020 -p1
%patch021 -p1
%patch022 -p1
%patch023 -p1
%patch024 -p1
%patch025 -p1
%patch026 -p1
%patch028 -p1
%patch029 -p1
%patch030 -p1
%patch031 -p1
%patch032 -p1
%patch033 -p1
%patch034 -p1
%patch035 -p1
%patch036 -p1
%patch038 -p1
%patch039 -p1
%patch040 -p1
%patch041 -p1
%patch042 -p1
%patch043 -p1
%patch044 -p1
%patch045 -p1
%patch046 -p1
%patch047 -p1
%patch048 -p1
%patch049 -p1
%patch050 -p1
%patch051 -p1
%patch052 -p1
%patch053 -p1
%patch054 -p1
%patch055 -p1
%patch056 -p1
%patch057 -p1
%patch058 -p1
%patch059 -p1
%patch060 -p1
%patch061 -p1
%patch062 -p1
%patch063 -p1
%patch064 -p1
%patch065 -p1
%patch066 -p1
%patch067 -p1
%patch068 -p1
%patch069 -p1
%patch070 -p1
%patch071 -p1
%patch072 -p1
%patch073 -p1
%patch074 -p1
%patch075 -p1
%patch076 -p1
%patch077 -p1
%patch078 -p1
%patch079 -p1
%patch080 -p1
%patch081 -p1
%patch082 -p1
%patch083 -p1
%patch084 -p1
%patch085 -p1
%patch086 -p1
%patch087 -p1
%patch088 -p1
%patch089 -p1
%patch090 -p1
%patch091 -p1
%patch092 -p1
%patch093 -p1
%patch094 -p1
%patch095 -p1
%patch096 -p1
%patch097 -p1

View File

@ -1 +0,0 @@
606e3fd147ed9a00df165e46f30fe5c46dcda345

View File

@ -1,97 +0,0 @@
gdb-6.3-rh-testversion-20041202.patch
gdb-vla-intel-fortran-strides.patch
gdb-vla-intel-fortran-vla-strings.patch
gdb-vla-intel-stringbt-fix.patch
gdb-6.3-gstack-20050411.patch
gdb-6.3-test-pie-20050107.patch
gdb-6.3-test-self-20050110.patch
gdb-6.3-test-dtorfix-20050121.patch
gdb-6.3-test-movedir-20050125.patch
gdb-6.3-threaded-watchpoints2-20050225.patch
gdb-6.3-inferior-notification-20050721.patch
gdb-6.3-inheritancetest-20050726.patch
gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch
gdb-6.5-sharedlibrary-path.patch
gdb-6.5-BEA-testsuite.patch
gdb-6.5-last-address-space-byte-test.patch
gdb-6.5-readline-long-line-crash-test.patch
gdb-6.5-bz218379-ppc-solib-trampoline-test.patch
gdb-6.5-bz218379-solib-trampoline-lookup-lock-fix.patch
gdb-6.5-bz109921-DW_AT_decl_file-test.patch
gdb-6.3-bz140532-ppc-unwinding-test.patch
gdb-6.3-bz202689-exec-from-pthread-test.patch
gdb-6.6-bz230000-power6-disassembly-test.patch
gdb-6.6-bz229517-gcore-without-terminal.patch
gdb-6.6-testsuite-timeouts.patch
gdb-6.6-bz237572-ppc-atomic-sequence-test.patch
gdb-6.3-attach-see-vdso-test.patch
gdb-6.5-bz243845-stale-testing-zombie-test.patch
gdb-6.6-buildid-locate.patch
gdb-6.6-buildid-locate-solib-missing-ids.patch
gdb-6.6-buildid-locate-rpm.patch
gdb-6.7-charsign-test.patch
gdb-6.7-ppc-clobbered-registers-O2-test.patch
gdb-6.7-testsuite-stable-results.patch
gdb-6.5-ia64-libunwind-leak-test.patch
gdb-6.5-missed-trap-on-step-test.patch
gdb-6.5-gcore-buffer-limit-test.patch
gdb-6.3-mapping-zero-inode-test.patch
gdb-6.3-focus-cmd-prev-test.patch
gdb-6.8-bz442765-threaded-exec-test.patch
gdb-6.5-section-num-fixup-test.patch
gdb-6.8-bz466901-backtrace-full-prelinked.patch
gdb-simultaneous-step-resume-breakpoint-test.patch
gdb-core-open-vdso-warning.patch
gdb-bz533176-fortran-omp-step.patch
gdb-ccache-workaround.patch
gdb-archer-pie-addons.patch
gdb-archer-pie-addons-keep-disabled.patch
gdb-lineno-makeup-test.patch
gdb-ppc-power7-test.patch
gdb-moribund-utrace-workaround.patch
gdb-archer-next-over-throw-cxx-exec.patch
gdb-bz601887-dwarf4-rh-test.patch
gdb-6.6-buildid-locate-core-as-arg.patch
gdb-6.6-buildid-locate-rpm-librpm-workaround.patch
gdb-test-bt-cfi-without-die.patch
gdb-bz634108-solib_address.patch
gdb-test-pid0-core.patch
gdb-test-dw2-aranges.patch
gdb-test-expr-cumulative-archer.patch
gdb-physname-pr11734-test.patch
gdb-physname-pr12273-test.patch
gdb-test-ivy-bridge.patch
gdb-runtest-pie-override.patch
gdb-attach-fail-reasons-5of5.patch
gdb-glibc-strstr-workaround.patch
gdb-rhel5.9-testcase-xlf-var-inside-mod.patch
gdb-rhbz-818343-set-solib-absolute-prefix-testcase.patch
gdb-rhbz947564-findvar-assertion-frame-failed-testcase.patch
gdb-gnat-dwarf-crash-3of3.patch
gdb-rhbz1007614-memleak-infpy_read_memory-test.patch
gdb-6.6-buildid-locate-misleading-warning-missing-debuginfo-rhbz981154.patch
gdb-archer-vla-tests.patch
gdb-vla-intel-tests.patch
gdb-btrobust.patch
gdb-fortran-frame-string.patch
gdb-rhbz1156192-recursive-dlopen-test.patch
gdb-jit-reader-multilib.patch
gdb-rhbz1149205-catch-syscall-after-fork-test.patch
gdb-rhbz1186476-internal-error-unqualified-name-re-set-test.patch
gdb-rhbz1350436-type-printers-error.patch
gdb-rhbz1084404-ppc64-s390x-wrong-prologue-skip-O2-g-3of3.patch
gdb-bz1219747-attach-kills.patch
gdb-fedora-libncursesw.patch
gdb-opcodes-clflushopt-test.patch
gdb-dts-rhel6-python-compat.patch
gdb-6.6-buildid-locate-rpm-scl.patch
gdb-6.8-quit-never-aborts.patch
gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch
gdb-container-rh-pkg.patch
gdb-rhbz1325795-framefilters-test.patch
gdb-linux_perf-bundle.patch
gdb-libexec-add-index.patch
gdb-rhbz1398387-tab-crash-test.patch
gdb-archer.patch
gdb-vla-intel-fix-print-char-array.patch
gdb-rhbz1553104-s390x-arch12-test.patch

View File

@ -1,15 +1,5 @@
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.3-attach-see-vdso-test.patch
;; Test kernel VDSO decoding while attaching to an i386 process.
;;=fedoratest
diff --git a/gdb/testsuite/gdb.base/attach-see-vdso.c b/gdb/testsuite/gdb.base/attach-see-vdso.c
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/attach-see-vdso.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ./gdb/testsuite/gdb.base/attach-see-vdso.c 6 Jul 2007 14:14:44 -0000
@@ -0,0 +1,25 @@
+/* This testcase is part of GDB, the GNU debugger.
+
@ -36,11 +26,9 @@ new file mode 100644
+ pause ();
+ return 1;
+}
diff --git a/gdb/testsuite/gdb.base/attach-see-vdso.exp b/gdb/testsuite/gdb.base/attach-see-vdso.exp
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/attach-see-vdso.exp
@@ -0,0 +1,72 @@
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ./gdb/testsuite/gdb.base/attach-see-vdso.exp 6 Jul 2007 14:14:44 -0000
@@ -0,0 +1,79 @@
+# Copyright 2007
+
+# This program is free software; you can redistribute it and/or modify
@ -59,6 +47,13 @@ new file mode 100644
+
+# This file was created by Jan Kratochvil <jan.kratochvil@redhat.com>.
+
+if $tracelevel then {
+ strace $tracelevel
+}
+
+set prms_id 0
+set bug_id 0
+
+# This test only works on Linux
+if { ![istarget "*-*-linux-gnu*"] } {
+ return 0
@ -66,8 +61,8 @@ new file mode 100644
+
+set testfile "attach-see-vdso"
+set srcfile ${testfile}.c
+set binfile [standard_output_file ${testfile}]
+set escapedbinfile [string_to_regexp [standard_output_file ${testfile}]]
+set binfile ${objdir}/${subdir}/${testfile}
+set escapedbinfile [string_to_regexp ${objdir}/${subdir}/${testfile}]
+
+# The kernel VDSO is used for the syscalls returns only on i386 (not x86_64).
+#

View File

@ -0,0 +1,90 @@
2005-12-01 Jeff Johnston <jjohnstn@redhat.com>
* frame.c (backtrace_past_zero_pc): New static variable.
(get_prev_frame): Don't return NULL for zero pc value if
backtrace past-zero-frame option is turned on.
(_initialize_frame): Initialize new command to allow backtracing
past a zero pc value (set backtrace past-zero-pc).
testsuite/gdb.base:
2005-12-01 Jeff Johnston <jjohnstn@redhat.com>
* setshow.exp: Add testing of "set backtrace past-zero-pc" option.
Index: gdb-6.5/gdb/testsuite/gdb.base/setshow.exp
===================================================================
--- gdb-6.5.orig/gdb/testsuite/gdb.base/setshow.exp 2006-07-11 02:46:50.000000000 -0300
+++ gdb-6.5/gdb/testsuite/gdb.base/setshow.exp 2006-07-11 02:47:24.000000000 -0300
@@ -1,4 +1,4 @@
-# Copyright 1992, 1994, 1996, 1997, 1998, 2001, 2003
+# Copyright 1992, 1994, 1996, 1997, 1998, 2001, 2003, 2005
# Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
@@ -106,6 +106,16 @@ if { ![target_info exists use_gdb_stub]
delete_breakpoints
gdb_test "run" "Starting program:.*foo bar blup baz bubble.*" "passing args"
}
+#test show backtrace past-zero-pc
+gdb_test "show backtrace past-zero-pc" "Whether backtraces should continue past a zero pc value is off." "default show backtrace past-zero-pc (off)"
+#test set backtrace past-zero-pc on
+gdb_test "set backtrace past-zero-pc on" "" "set backtrace past-zero-pc on"
+#test show backtrace past-zero-pc
+gdb_test "show backtrace past-zero-pc" "Whether backtraces should continue past a zero pc value is on." "show backtrace past-zero-pc (on)"
+#test set backtrace past-zero-pc off
+gdb_test "set backtrace past-zero-pc off" "" "set backtrace past-zero-pc off"
+#test show backtrace past-zero-pc
+gdb_test "show backtrace past-zero-pc" "Whether backtraces should continue past a zero pc value is off." "show backtrace past-zero-pc (off)"
#test set check range on
gdb_test "set check range on" "" "set check range on"
#test show check range on
Index: gdb-6.5/gdb/frame.c
===================================================================
--- gdb-6.5.orig/gdb/frame.c 2006-07-11 02:46:50.000000000 -0300
+++ gdb-6.5/gdb/frame.c 2006-07-11 02:51:20.000000000 -0300
@@ -131,6 +131,16 @@ Whether backtraces should continue past
value);
}
+static int backtrace_past_zero_pc;
+static void
+show_backtrace_past_zero_pc (struct ui_file *file, int from_tty,
+ struct cmd_list_element *c, const char *value)
+{
+ fprintf_filtered (file, _("\
+Whether backtraces should continue past a zero pc value is %s.\n"),
+ value);
+}
+
static int backtrace_past_entry;
static void
show_backtrace_past_entry (struct ui_file *file, int from_tty,
@@ -1313,9 +1323,7 @@ get_prev_frame (struct frame_info *this_
}
if (this_frame->level > 0
-#if 0
- && backtrace_past_zero_pc
-#endif
+ && !backtrace_past_zero_pc
&& get_frame_type (this_frame) == NORMAL_FRAME
&& get_frame_type (get_next_frame (this_frame)) == NORMAL_FRAME
&& get_frame_pc (this_frame) == 0)
@@ -1629,6 +1637,17 @@ the rest of the stack trace."),
&set_backtrace_cmdlist,
&show_backtrace_cmdlist);
+ add_setshow_boolean_cmd ("past-zero-pc", class_obscure,
+ &backtrace_past_zero_pc, _("\
+Set whether backtraces should continue past a zero pc value."), _("\
+Show whether backtraces should continue past a zero pc value."), _("\
+Normally GDB stops backtracing when it finds a zero pc.\n\
+Set this variable if you need to see the rest of the stack trace."),
+ NULL,
+ show_backtrace_past_zero_pc,
+ &set_backtrace_cmdlist,
+ &show_backtrace_cmdlist);
+
add_setshow_integer_cmd ("limit", class_obscure,
&backtrace_limit, _("\
Set an upper bound on the number of backtrace levels."), _("\

View File

@ -0,0 +1,427 @@
2007-02-08 Joel Brobecker <brobecker@gnat.com>
Jan Kratochvil <jan.kratochvil@redhat.com>
Daniel Jacobowitz <dan@codesourcery.com>
* rs6000-tdep.c (bl_to_blrl_insn_p): New function.
(skip_prologue): Allow bl->blrl used by PIC code.
--- ./gdb/rs6000-tdep.c 9 Jan 2007 17:58:57 -0000 1.260
+++ ./gdb/rs6000-tdep.c 8 Feb 2007 14:22:53 -0000 1.261
@@ -902,6 +902,30 @@ store_param_on_stack_p (unsigned long op
return 0;
}
+/* Assuming that INSN is a "bl" instruction located at PC, return
+ nonzero if the destination of the branch is a "blrl" instruction.
+
+ This sequence is sometimes found in certain function prologues.
+ It allows the function to load the LR register with a value that
+ they can use to access PIC data using PC-relative offsets. */
+
+static int
+bl_to_blrl_insn_p (CORE_ADDR pc, int insn)
+{
+ const int opcode = 18;
+ const CORE_ADDR dest = branch_dest (opcode, insn, pc, -1);
+ int dest_insn;
+
+ if (dest == -1)
+ return 0; /* Should never happen, but just return zero to be safe. */
+
+ dest_insn = read_memory_integer (dest, 4);
+ if ((dest_insn & 0xfc00ffff) == 0x4c000021) /* blrl */
+ return 1;
+
+ return 0;
+}
+
static CORE_ADDR
skip_prologue (CORE_ADDR pc, CORE_ADDR lim_pc, struct rs6000_framedata *fdata)
{
@@ -1133,6 +1157,12 @@ skip_prologue (CORE_ADDR pc, CORE_ADDR l
to save fprs??? */
fdata->frameless = 0;
+
+ /* If the return address has already been saved, we can skip
+ calls to blrl (for PIC). */
+ if (lr_reg != -1 && bl_to_blrl_insn_p (pc, op))
+ continue;
+
/* Don't skip over the subroutine call if it is not within
the first three instructions of the prologue and either
we have no line table information or the line info tells
2007-03-27 Andreas Schwab <schwab@suse.de>
Daniel Jacobowitz <dan@codesourcery.com>
* dwarf2-frame.c (dwarf2_frame_eh_frame_regnum): Rename to...
(dwarf2_frame_adjust_regnum): ...this. Make static. Add eh_frame_p
argument. Update all callers.
(struct dwarf2_frame_ops): Replace eh_frame_regnum with adjust_regnum.
(dwarf2_frame_set_eh_frame_regnum): Rename to...
(dwarf2_frame_set_adjust_regnum): ...this. Update argument type.
* dwarf2frame.h (dwarf2_frame_set_eh_frame_regnum): Rename to...
(dwarf2_frame_set_adjust_regnum): ...this.
(dwarf2_frame_eh_frame_regnum): Delete prototype.
* rs6000-tdep.c: Include "dwarf2-frame.h".
(rs6000_adjust_frame_regnum): Define.
(rs6000_gdbarch_init): Enable use of DWARF CFI frame unwinder.
Register rs6000_adjust_frame_regnum.
* Makefile.in (rs6000-tdep.o): Update dependencies.
--- ./gdb/dwarf2-frame.c 27 Feb 2007 20:17:18 -0000 1.68
+++ ./gdb/dwarf2-frame.c 27 Mar 2007 19:02:42 -0000 1.69
@@ -107,6 +107,9 @@ struct dwarf2_fde
};
static struct dwarf2_fde *dwarf2_frame_find_fde (CORE_ADDR *pc);
+
+static int dwarf2_frame_adjust_regnum (struct gdbarch *gdbarch, int regnum,
+ int eh_frame_p);
/* Structure describing a frame state. */
@@ -314,8 +317,7 @@ execute_cfa_program (gdb_byte *insn_ptr,
else if ((insn & 0xc0) == DW_CFA_offset)
{
reg = insn & 0x3f;
- if (eh_frame_p)
- reg = dwarf2_frame_eh_frame_regnum (gdbarch, reg);
+ reg = dwarf2_frame_adjust_regnum (gdbarch, reg, eh_frame_p);
insn_ptr = read_uleb128 (insn_ptr, insn_end, &utmp);
offset = utmp * fs->data_align;
dwarf2_frame_state_alloc_regs (&fs->regs, reg + 1);
@@ -326,8 +328,7 @@ execute_cfa_program (gdb_byte *insn_ptr,
{
gdb_assert (fs->initial.reg);
reg = insn & 0x3f;
- if (eh_frame_p)
- reg = dwarf2_frame_eh_frame_regnum (gdbarch, reg);
+ reg = dwarf2_frame_adjust_regnum (gdbarch, reg, eh_frame_p);
dwarf2_frame_state_alloc_regs (&fs->regs, reg + 1);
if (reg < fs->initial.num_regs)
fs->regs.reg[reg] = fs->initial.reg[reg];
@@ -368,8 +369,7 @@ register %s (#%d) at 0x%s"),
case DW_CFA_offset_extended:
insn_ptr = read_uleb128 (insn_ptr, insn_end, &reg);
- if (eh_frame_p)
- reg = dwarf2_frame_eh_frame_regnum (gdbarch, reg);
+ reg = dwarf2_frame_adjust_regnum (gdbarch, reg, eh_frame_p);
insn_ptr = read_uleb128 (insn_ptr, insn_end, &utmp);
offset = utmp * fs->data_align;
dwarf2_frame_state_alloc_regs (&fs->regs, reg + 1);
@@ -380,35 +380,30 @@ register %s (#%d) at 0x%s"),
case DW_CFA_restore_extended:
gdb_assert (fs->initial.reg);
insn_ptr = read_uleb128 (insn_ptr, insn_end, &reg);
- if (eh_frame_p)
- reg = dwarf2_frame_eh_frame_regnum (gdbarch, reg);
+ reg = dwarf2_frame_adjust_regnum (gdbarch, reg, eh_frame_p);
dwarf2_frame_state_alloc_regs (&fs->regs, reg + 1);
fs->regs.reg[reg] = fs->initial.reg[reg];
break;
case DW_CFA_undefined:
insn_ptr = read_uleb128 (insn_ptr, insn_end, &reg);
- if (eh_frame_p)
- reg = dwarf2_frame_eh_frame_regnum (gdbarch, reg);
+ reg = dwarf2_frame_adjust_regnum (gdbarch, reg, eh_frame_p);
dwarf2_frame_state_alloc_regs (&fs->regs, reg + 1);
fs->regs.reg[reg].how = DWARF2_FRAME_REG_UNDEFINED;
break;
case DW_CFA_same_value:
insn_ptr = read_uleb128 (insn_ptr, insn_end, &reg);
- if (eh_frame_p)
- reg = dwarf2_frame_eh_frame_regnum (gdbarch, reg);
+ reg = dwarf2_frame_adjust_regnum (gdbarch, reg, eh_frame_p);
dwarf2_frame_state_alloc_regs (&fs->regs, reg + 1);
fs->regs.reg[reg].how = DWARF2_FRAME_REG_SAME_VALUE;
break;
case DW_CFA_register:
insn_ptr = read_uleb128 (insn_ptr, insn_end, &reg);
- if (eh_frame_p)
- reg = dwarf2_frame_eh_frame_regnum (gdbarch, reg);
+ reg = dwarf2_frame_adjust_regnum (gdbarch, reg, eh_frame_p);
insn_ptr = read_uleb128 (insn_ptr, insn_end, &utmp);
- if (eh_frame_p)
- utmp = dwarf2_frame_eh_frame_regnum (gdbarch, utmp);
+ utmp = dwarf2_frame_adjust_regnum (gdbarch, utmp, eh_frame_p);
dwarf2_frame_state_alloc_regs (&fs->regs, reg + 1);
fs->regs.reg[reg].how = DWARF2_FRAME_REG_SAVED_REG;
fs->regs.reg[reg].loc.reg = utmp;
@@ -456,9 +451,8 @@ bad CFI data; mismatched DW_CFA_restore_
case DW_CFA_def_cfa_register:
insn_ptr = read_uleb128 (insn_ptr, insn_end, &fs->cfa_reg);
- if (eh_frame_p)
- fs->cfa_reg = dwarf2_frame_eh_frame_regnum (gdbarch,
- fs->cfa_reg);
+ fs->cfa_reg = dwarf2_frame_adjust_regnum (gdbarch, fs->cfa_reg,
+ eh_frame_p);
fs->cfa_how = CFA_REG_OFFSET;
break;
@@ -484,8 +478,7 @@ bad CFI data; mismatched DW_CFA_restore_
case DW_CFA_expression:
insn_ptr = read_uleb128 (insn_ptr, insn_end, &reg);
- if (eh_frame_p)
- reg = dwarf2_frame_eh_frame_regnum (gdbarch, reg);
+ reg = dwarf2_frame_adjust_regnum (gdbarch, reg, eh_frame_p);
dwarf2_frame_state_alloc_regs (&fs->regs, reg + 1);
insn_ptr = read_uleb128 (insn_ptr, insn_end, &utmp);
fs->regs.reg[reg].loc.exp = insn_ptr;
@@ -496,8 +489,7 @@ bad CFI data; mismatched DW_CFA_restore_
case DW_CFA_offset_extended_sf:
insn_ptr = read_uleb128 (insn_ptr, insn_end, &reg);
- if (eh_frame_p)
- reg = dwarf2_frame_eh_frame_regnum (gdbarch, reg);
+ reg = dwarf2_frame_adjust_regnum (gdbarch, reg, eh_frame_p);
insn_ptr = read_sleb128 (insn_ptr, insn_end, &offset);
offset *= fs->data_align;
dwarf2_frame_state_alloc_regs (&fs->regs, reg + 1);
@@ -535,9 +527,8 @@ bad CFI data; mismatched DW_CFA_restore_
case DW_CFA_def_cfa_sf:
insn_ptr = read_uleb128 (insn_ptr, insn_end, &fs->cfa_reg);
- if (eh_frame_p)
- fs->cfa_reg = dwarf2_frame_eh_frame_regnum (gdbarch,
- fs->cfa_reg);
+ fs->cfa_reg = dwarf2_frame_adjust_regnum (gdbarch, fs->cfa_reg,
+ eh_frame_p);
insn_ptr = read_sleb128 (insn_ptr, insn_end, &offset);
fs->cfa_offset = offset * fs->data_align;
fs->cfa_how = CFA_REG_OFFSET;
@@ -581,6 +572,7 @@ bad CFI data; mismatched DW_CFA_restore_
case DW_CFA_GNU_negative_offset_extended:
insn_ptr = read_uleb128 (insn_ptr, insn_end, &reg);
+ reg = dwarf2_frame_adjust_regnum (gdbarch, reg, eh_frame_p);
insn_ptr = read_uleb128 (insn_ptr, insn_end, &offset);
offset *= fs->data_align;
dwarf2_frame_state_alloc_regs (&fs->regs, reg + 1);
@@ -617,8 +607,9 @@ struct dwarf2_frame_ops
trampoline. */
int (*signal_frame_p) (struct gdbarch *, struct frame_info *);
- /* Convert .eh_frame register number to DWARF register number. */
- int (*eh_frame_regnum) (struct gdbarch *, int);
+ /* Convert .eh_frame register number to DWARF register number, or
+ adjust .debug_frame register number. */
+ int (*adjust_regnum) (struct gdbarch *, int, int);
};
/* Default architecture-specific register state initialization
@@ -726,29 +717,30 @@ dwarf2_frame_signal_frame_p (struct gdba
return ops->signal_frame_p (gdbarch, next_frame);
}
-/* Set the architecture-specific mapping of .eh_frame register numbers to
- DWARF register numbers. */
+/* Set the architecture-specific adjustment of .eh_frame and .debug_frame
+ register numbers. */
void
-dwarf2_frame_set_eh_frame_regnum (struct gdbarch *gdbarch,
- int (*eh_frame_regnum) (struct gdbarch *,
- int))
+dwarf2_frame_set_adjust_regnum (struct gdbarch *gdbarch,
+ int (*adjust_regnum) (struct gdbarch *,
+ int, int))
{
struct dwarf2_frame_ops *ops = gdbarch_data (gdbarch, dwarf2_frame_data);
- ops->eh_frame_regnum = eh_frame_regnum;
+ ops->adjust_regnum = adjust_regnum;
}
-/* Translate a .eh_frame register to DWARF register. */
+/* Translate a .eh_frame register to DWARF register, or adjust a .debug_frame
+ register. */
-int
-dwarf2_frame_eh_frame_regnum (struct gdbarch *gdbarch, int regnum)
+static int
+dwarf2_frame_adjust_regnum (struct gdbarch *gdbarch, int regnum, int eh_frame_p)
{
struct dwarf2_frame_ops *ops = gdbarch_data (gdbarch, dwarf2_frame_data);
- if (ops->eh_frame_regnum == NULL)
+ if (ops->adjust_regnum == NULL)
return regnum;
- return ops->eh_frame_regnum (gdbarch, regnum);
+ return ops->adjust_regnum (gdbarch, regnum, eh_frame_p);
}
static void
@@ -1726,10 +1718,10 @@ decode_frame_entry_1 (struct comp_unit *
else
cie->return_address_register = read_unsigned_leb128 (unit->abfd, buf,
&bytes_read);
- if (eh_frame_p)
- cie->return_address_register
- = dwarf2_frame_eh_frame_regnum (current_gdbarch,
- cie->return_address_register);
+ cie->return_address_register
+ = dwarf2_frame_adjust_regnum (current_gdbarch,
+ cie->return_address_register,
+ eh_frame_p);
buf += bytes_read;
--- ./gdb/dwarf2-frame.h 9 Jan 2007 17:58:50 -0000 1.14
+++ ./gdb/dwarf2-frame.h 27 Mar 2007 19:02:42 -0000 1.15
@@ -94,18 +94,13 @@ extern void
int (*signal_frame_p) (struct gdbarch *,
struct frame_info *));
-/* Set the architecture-specific mapping of .eh_frame register numbers to
- DWARF register numbers. */
+/* Set the architecture-specific adjustment of .eh_frame and .debug_frame
+ register numbers. */
extern void
- dwarf2_frame_set_eh_frame_regnum (struct gdbarch *gdbarch,
- int (*eh_frame_regnum) (struct gdbarch *,
- int));
-
-/* Translate a .eh_frame register to DWARF register. */
-
-extern int
- dwarf2_frame_eh_frame_regnum (struct gdbarch *gdbarch, int regnum);
+ dwarf2_frame_set_adjust_regnum (struct gdbarch *gdbarch,
+ int (*adjust_regnum) (struct gdbarch *,
+ int, int));
/* Return the frame unwind methods for the function that contains PC,
or NULL if it can't be handled by DWARF CFI frame unwinder. */
--- ./gdb/rs6000-tdep.c 13 Mar 2007 17:34:22 -0000 1.266
+++ ./gdb/rs6000-tdep.c 27 Mar 2007 19:02:42 -0000 1.267
@@ -40,6 +40,7 @@
#include "sim-regno.h"
#include "gdb/sim-ppc.h"
#include "reggroups.h"
+#include "dwarf2-frame.h"
#include "libbfd.h" /* for bfd_default_set_arch_mach */
#include "coff/internal.h" /* for libcoff.h */
@@ -2294,6 +2295,69 @@ rs6000_dwarf2_reg_to_regnum (int num)
}
}
+/* Translate a .eh_frame register to DWARF register, or adjust a
+ .debug_frame register. */
+
+static int
+rs6000_adjust_frame_regnum (struct gdbarch *gdbarch, int num, int eh_frame_p)
+{
+ /* GCC releases before 3.4 use GCC internal register numbering in
+ .debug_frame (and .debug_info, et cetera). The numbering is
+ different from the standard SysV numbering for everything except
+ for GPRs and FPRs. We can not detect this problem in most cases
+ - to get accurate debug info for variables living in lr, ctr, v0,
+ et cetera, use a newer version of GCC. But we must detect
+ one important case - lr is in column 65 in .debug_frame output,
+ instead of 108.
+
+ GCC 3.4, and the "hammer" branch, have a related problem. They
+ record lr register saves in .debug_frame as 108, but still record
+ the return column as 65. We fix that up too.
+
+ We can do this because 65 is assigned to fpsr, and GCC never
+ generates debug info referring to it. To add support for
+ handwritten debug info that restores fpsr, we would need to add a
+ producer version check to this. */
+ if (!eh_frame_p)
+ {
+ if (num == 65)
+ return 108;
+ else
+ return num;
+ }
+
+ /* .eh_frame is GCC specific. For binary compatibility, it uses GCC
+ internal register numbering; translate that to the standard DWARF2
+ register numbering. */
+ if (0 <= num && num <= 63) /* r0-r31,fp0-fp31 */
+ return num;
+ else if (68 <= num && num <= 75) /* cr0-cr8 */
+ return num - 68 + 86;
+ else if (77 <= num && num <= 108) /* vr0-vr31 */
+ return num - 77 + 1124;
+ else
+ switch (num)
+ {
+ case 64: /* mq */
+ return 100;
+ case 65: /* lr */
+ return 108;
+ case 66: /* ctr */
+ return 109;
+ case 76: /* xer */
+ return 101;
+ case 109: /* vrsave */
+ return 356;
+ case 110: /* vscr */
+ return 67;
+ case 111: /* spe_acc */
+ return 99;
+ case 112: /* spefscr */
+ return 612;
+ default:
+ return num;
+ }
+}
/* Support for CONVERT_FROM_FUNC_PTR_ADDR (ARCH, ADDR, TARG).
@@ -3428,6 +3492,10 @@ rs6000_gdbarch_init (struct gdbarch_info
(gdbarch, rs6000_in_solib_return_trampoline);
set_gdbarch_skip_trampoline_code (gdbarch, rs6000_skip_trampoline_code);
+ /* Hook in the DWARF CFI frame unwinder. */
+ frame_unwind_append_sniffer (gdbarch, dwarf2_frame_sniffer);
+ dwarf2_frame_set_adjust_regnum (gdbarch, rs6000_adjust_frame_regnum);
+
/* Hook in ABI-specific overrides, if they have been registered. */
gdbarch_init_osabi (info, gdbarch);
--- ./gdb/Makefile.in.orig 2007-07-31 16:42:29.000000000 -0400
+++ ./gdb/Makefile.in 2007-08-01 13:42:51.000000000 -0400
@@ -2468,7 +2468,7 @@ rs6000-tdep.o: rs6000-tdep.c $(defs_h) $
$(reggroups_h) $(libbfd_h) $(coff_internal_h) $(libcoff_h) \
$(coff_xcoff_h) $(libxcoff_h) $(elf_bfd_h) $(solib_svr4_h) \
$(ppc_tdep_h) $(gdb_assert_h) $(dis_asm_h) $(trad_frame_h) \
- $(frame_unwind_h) $(frame_base_h) $(rs6000_tdep_h)
+ $(frame_unwind_h) $(frame_base_h) $(rs6000_tdep_h) $(dwarf2_frame_h)
rs6000-aix-tdep.o: rs6000-aix-tdep.c $(defs_h) $(osabi_h) $(rs6000_tdep_h)
s390-nat.o: s390-nat.c $(defs_h) $(tm_h) $(regcache_h) $(inferior_h) \
$(s390_tdep_h) $(observer_h) $(linux_nat_h)
s390-tdep.o: s390-tdep.c $(defs_h) $(arch_utils_h) $(frame_h) $(inferior_h) \
2007-04-10 Andreas Schwab <schwab@suse.de>
* rs6000-tdep.c (rs6000_dwarf2_reg_to_regnum): Decode 64 as CR
register.
--- ./gdb/rs6000-tdep.c 1 Apr 2007 18:24:59 -0000 1.269
+++ ./gdb/rs6000-tdep.c 10 Apr 2007 16:02:41 -0000 1.270
@@ -2274,6 +2274,8 @@ rs6000_dwarf2_reg_to_regnum (int num)
else
switch (num)
{
+ case 64:
+ return tdep->ppc_cr_regnum;
case 67:
return tdep->ppc_vrsave_regnum - 1; /* vscr */
case 99:

View File

@ -1,15 +1,6 @@
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.3-bz140532-ppc-unwinding-test.patch
;; Update PPC unwinding patches to their upstream variants (BZ 140532).
;;=fedoratest
diff --git a/gdb/testsuite/gdb.arch/powerpc-bcl-prologue-asm32.S b/gdb/testsuite/gdb.arch/powerpc-bcl-prologue-asm32.S
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.arch/powerpc-bcl-prologue-asm32.S
diff -u -ruNp gdb-6.3-unpatched/gdb/testsuite/gdb.arch/powerpc-bcl-prologue-asm32.S gdb-6.3/gdb/testsuite/gdb.arch/powerpc-bcl-prologue-asm32.S
--- gdb-6.3-unpatched/gdb/testsuite/gdb.arch/powerpc-bcl-prologue-asm32.S 1969-12-31 19:00:00.000000000 -0500
+++ gdb-6.3/gdb/testsuite/gdb.arch/powerpc-bcl-prologue-asm32.S 2007-08-02 13:23:10.000000000 -0400
@@ -0,0 +1,78 @@
+/* This testcase is part of GDB, the GNU debugger.
+
@ -89,10 +80,9 @@ new file mode 100644
+}
+
+*/
diff --git a/gdb/testsuite/gdb.arch/powerpc-bcl-prologue-asm64.S b/gdb/testsuite/gdb.arch/powerpc-bcl-prologue-asm64.S
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.arch/powerpc-bcl-prologue-asm64.S
diff -u -ruNp gdb-6.3-unpatched/gdb/testsuite/gdb.arch/powerpc-bcl-prologue-asm64.S gdb-6.3/gdb/testsuite/gdb.arch/powerpc-bcl-prologue-asm64.S
--- gdb-6.3-unpatched/gdb/testsuite/gdb.arch/powerpc-bcl-prologue-asm64.S 1969-12-31 19:00:00.000000000 -0500
+++ gdb-6.3/gdb/testsuite/gdb.arch/powerpc-bcl-prologue-asm64.S 2007-08-02 14:28:56.000000000 -0400
@@ -0,0 +1,98 @@
+/* This testcase is part of GDB, the GNU debugger.
+
@ -192,10 +182,9 @@ new file mode 100644
+}
+
+*/
diff --git a/gdb/testsuite/gdb.arch/powerpc-bcl-prologue.c b/gdb/testsuite/gdb.arch/powerpc-bcl-prologue.c
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.arch/powerpc-bcl-prologue.c
diff -u -ruNp gdb-6.3-unpatched/gdb/testsuite/gdb.arch/powerpc-bcl-prologue.c gdb-6.3/gdb/testsuite/gdb.arch/powerpc-bcl-prologue.c
--- gdb-6.3-unpatched/gdb/testsuite/gdb.arch/powerpc-bcl-prologue.c 1969-12-31 19:00:00.000000000 -0500
+++ gdb-6.3/gdb/testsuite/gdb.arch/powerpc-bcl-prologue.c 2007-08-02 13:25:10.000000000 -0400
@@ -0,0 +1,29 @@
+/* This testcase is part of GDB, the GNU debugger.
+
@ -226,11 +215,10 @@ new file mode 100644
+ func1 ();
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.arch/powerpc-bcl-prologue.exp b/gdb/testsuite/gdb.arch/powerpc-bcl-prologue.exp
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.arch/powerpc-bcl-prologue.exp
@@ -0,0 +1,72 @@
diff -u -ruNp gdb-6.3-unpatched/gdb/testsuite/gdb.arch/powerpc-bcl-prologue.exp gdb-6.3/gdb/testsuite/gdb.arch/powerpc-bcl-prologue.exp
--- gdb-6.3-unpatched/gdb/testsuite/gdb.arch/powerpc-bcl-prologue.exp 1969-12-31 19:00:00.000000000 -0500
+++ gdb-6.3/gdb/testsuite/gdb.arch/powerpc-bcl-prologue.exp 2007-08-02 14:21:29.000000000 -0400
@@ -0,0 +1,79 @@
+# Copyright 2006, 2007 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
@ -250,6 +238,13 @@ new file mode 100644
+# Test unwinding fixes of the PPC platform, specifically on the coping with BCL
+# jump of the PIE code.
+
+if $tracelevel then {
+ strace $tracelevel
+}
+
+set prms_id 0
+set bug_id 0
+
+if ![istarget "powerpc*-*-linux*"] then {
+ verbose "Skipping powerpc-linux prologue tests."
+ return
@ -268,8 +263,8 @@ new file mode 100644
+ fail "powerpc arch test"
+ return
+}
+set objfile2 [standard_output_file ${testfile}-asm.o]
+set binfile [standard_output_file ${testfile}]
+set objfile2 ${objdir}/${subdir}/${testfile}-asm.o
+set binfile ${objdir}/${subdir}/${testfile}
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile1} ${srcdir}/${subdir}/${srcfile2}" ${binfile} executable $flags] != ""} {
+ return -1
@ -303,18 +298,3 @@ new file mode 100644
+ pass $test
+ }
+}
diff --git a/gdb/testsuite/gdb.arch/powerpc-prologue.exp b/gdb/testsuite/gdb.arch/powerpc-prologue.exp
--- a/gdb/testsuite/gdb.arch/powerpc-prologue.exp
+++ b/gdb/testsuite/gdb.arch/powerpc-prologue.exp
@@ -16,8 +16,9 @@
# Test PowerPC prologue analyzer.
# Do not run on AIX (where we won't be able to build the tests without
-# some surgery) or on PowerPC64 (ditto, dot symbols).
-if {[istarget *-*-aix*] || ![istarget "powerpc-*-*"]} then {
+# some surgery). PowerPC64 target would break due to dot symbols but we build
+# there PowerPC32 inferior.
+if {[istarget *-*-aix*] || ![istarget "powerpc*-*-*"]} then {
verbose "Skipping PowerPC prologue tests."
return
}

View File

@ -0,0 +1,23 @@
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=182116
Index: gdb-6.5/gdb/linux-thread-db.c
===================================================================
--- gdb-6.5.orig/gdb/linux-thread-db.c 2006-08-24 02:55:24.000000000 -0300
+++ gdb-6.5/gdb/linux-thread-db.c 2006-08-24 02:56:16.000000000 -0300
@@ -939,6 +939,15 @@ thread_db_wait (ptid_t ptid, struct targ
|| ourstatus->kind == TARGET_WAITKIND_SIGNALLED)
return pid_to_ptid (-1);
+ if (ourstatus->kind == TARGET_WAITKIND_EXECD)
+ {
+ remove_thread_event_breakpoints ();
+ unpush_target (&thread_db_ops);
+ using_thread_db = 0;
+
+ return pid_to_ptid (GET_PID (ptid));
+ }
+
if (ourstatus->kind == TARGET_WAITKIND_STOPPED
&& (ourstatus->value.sig == TARGET_SIGNAL_TRAP
|| ourstatus->value.sig == TARGET_SIGNAL_ILL))

View File

@ -0,0 +1,21 @@
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=193763
[base]
2007-09-21 Jan Kratochvil <jan.kratochvil@redhat.com>
Updated for the longer `$allocate' marker.
Index: gdb-6.5/gdb/linespec.c
===================================================================
--- gdb-6.5.orig/gdb/linespec.c 2006-08-24 02:57:04.000000000 -0300
+++ gdb-6.5/gdb/linespec.c 2006-08-24 02:57:07.000000000 -0300
@@ -295,7 +295,7 @@ add_minsym_members (const char *class_na
This will give us a list of all the member names including
the function signature. */
completion_name = xmalloc (strlen (class_name) +
- strlen (member_name) + 9);
+ strlen (member_name) + strlen("'::$allocate(") + 1);
completion_name[0] = '\'';
strcpy (completion_name+1, class_name);
/* FIXME: make this the language class separator. */

View File

@ -1,19 +1,10 @@
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.3-bz202689-exec-from-pthread-test.patch
;; Testcase for exec() from threaded program (BZ 202689).
;;=fedoratest
2007-01-17 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.threads/threaded-exec.exp, gdb.threads/threaded-exec.c: New files.
diff --git a/gdb/testsuite/gdb.threads/threaded-exec.c b/gdb/testsuite/gdb.threads/threaded-exec.c
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.threads/threaded-exec.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ./gdb/testsuite/gdb.threads/threaded-exec.c 17 Jan 2007 23:10:22 -0000
@@ -0,0 +1,46 @@
+/* This testcase is part of GDB, the GNU debugger.
+
@ -61,10 +52,8 @@ new file mode 100644
+ execl ("/bin/true", "/bin/true", NULL);
+ abort ();
+}
diff --git a/gdb/testsuite/gdb.threads/threaded-exec.exp b/gdb/testsuite/gdb.threads/threaded-exec.exp
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.threads/threaded-exec.exp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ./gdb/testsuite/gdb.threads/threaded-exec.exp 17 Jan 2007 23:10:22 -0000
@@ -0,0 +1,41 @@
+# threaded-exec.exp -- Check reset of the tracked threads on exec*(2)
+# Copyright (C) 2007 Free Software Foundation, Inc.
@ -88,7 +77,7 @@ new file mode 100644
+
+set testfile threaded-exec
+set srcfile ${testfile}.c
+set binfile [standard_output_file ${testfile}]
+set binfile ${objdir}/${subdir}/${testfile}
+
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable []] != "" } {
+ return -1
@ -103,7 +92,7 @@ new file mode 100644
+gdb_run_cmd
+
+gdb_test_multiple {} "Program exited" {
+ -re "\r\n\\\[Inferior .* exited normally\\\]\r\n$gdb_prompt $" {
+ -re "\r\nProgram exited normally.\r\n$gdb_prompt $" {
+ pass "Program exited"
+ }
+}

View File

@ -0,0 +1,197 @@
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=231832
diff -u -rup gdb-6.6-orig/gdb/symmisc.c gdb-6.6/gdb/symmisc.c
--- gdb-6.6-orig/gdb/symmisc.c 2005-12-17 17:34:03.000000000 -0500
+++ gdb-6.6/gdb/symmisc.c 2007-03-12 09:38:26.000000000 -0400
@@ -233,7 +233,7 @@ print_objfile_statistics (void)
printf_filtered (_(" Space used by a.out string tables: %d\n"),
OBJSTAT (objfile, sz_strtab));
- printf_filtered (_(" Total memory used for objfile obstack: %d\n"),
- obstack_memory_used (&objfile->objfile_obstack));
+ printf_filtered (_(" Total memory used for objfile obstack: %ld\n"),
+ (long) obstack_memory_used (&objfile->objfile_obstack));
printf_filtered (_(" Total memory used for psymbol cache: %d\n"),
bcache_memory_used (objfile->psymbol_cache));
printf_filtered (_(" Total memory used for macro cache: %d\n"),
diff -u -rup gdb-6.6-orig/include/obstack.h gdb-6.6/include/obstack.h
--- gdb-6.6-orig/include/obstack.h 2005-05-10 06:21:08.000000000 -0400
+++ gdb-6.6/include/obstack.h 2007-03-12 09:37:50.000000000 -0400
@@ -188,31 +188,31 @@ struct obstack /* control current objec
/* Declare the external functions we use; they are in obstack.c. */
-extern void _obstack_newchunk (struct obstack *, int);
+extern void _obstack_newchunk (struct obstack *, PTR_INT_TYPE);
extern void _obstack_free (struct obstack *, void *);
-extern int _obstack_begin (struct obstack *, int, int,
+extern int _obstack_begin (struct obstack *, PTR_INT_TYPE, int,
void *(*) (long), void (*) (void *));
-extern int _obstack_begin_1 (struct obstack *, int, int,
+extern int _obstack_begin_1 (struct obstack *, PTR_INT_TYPE, int,
void *(*) (void *, long),
void (*) (void *, void *), void *);
-extern int _obstack_memory_used (struct obstack *);
+extern PTR_INT_TYPE _obstack_memory_used (struct obstack *);
/* Do the function-declarations after the structs
but before defining the macros. */
void obstack_init (struct obstack *obstack);
-void * obstack_alloc (struct obstack *obstack, int size);
+void * obstack_alloc (struct obstack *obstack, PTR_INT_TYPE size);
-void * obstack_copy (struct obstack *obstack, void *address, int size);
-void * obstack_copy0 (struct obstack *obstack, void *address, int size);
+void * obstack_copy (struct obstack *obstack, void *address, PTR_INT_TYPE size);
+void * obstack_copy0 (struct obstack *obstack, void *address, PTR_INT_TYPE size);
void obstack_free (struct obstack *obstack, void *block);
-void obstack_blank (struct obstack *obstack, int size);
+void obstack_blank (struct obstack *obstack, PTR_INT_TYPE size);
-void obstack_grow (struct obstack *obstack, void *data, int size);
-void obstack_grow0 (struct obstack *obstack, void *data, int size);
+void obstack_grow (struct obstack *obstack, void *data, PTR_INT_TYPE size);
+void obstack_grow0 (struct obstack *obstack, void *data, PTR_INT_TYPE size);
void obstack_1grow (struct obstack *obstack, int data_char);
void obstack_ptr_grow (struct obstack *obstack, void *data);
@@ -220,20 +220,20 @@ void obstack_int_grow (struct obstack *o
void * obstack_finish (struct obstack *obstack);
-int obstack_object_size (struct obstack *obstack);
+PTR_INT_TYPE obstack_object_size (struct obstack *obstack);
-int obstack_room (struct obstack *obstack);
-void obstack_make_room (struct obstack *obstack, int size);
+PTR_INT_TYPE obstack_room (struct obstack *obstack);
+void obstack_make_room (struct obstack *obstack, PTR_INT_TYPE size);
void obstack_1grow_fast (struct obstack *obstack, int data_char);
void obstack_ptr_grow_fast (struct obstack *obstack, void *data);
void obstack_int_grow_fast (struct obstack *obstack, int data);
-void obstack_blank_fast (struct obstack *obstack, int size);
+void obstack_blank_fast (struct obstack *obstack, PTR_INT_TYPE size);
void * obstack_base (struct obstack *obstack);
void * obstack_next_free (struct obstack *obstack);
int obstack_alignment_mask (struct obstack *obstack);
-int obstack_chunk_size (struct obstack *obstack);
-int obstack_memory_used (struct obstack *obstack);
+size_t obstack_chunk_size (struct obstack *obstack);
+size_t obstack_memory_used (struct obstack *obstack);
/* Error handler called when `obstack_chunk_alloc' failed to allocate
more memory. This can be set to a user defined function. The
@@ -318,7 +318,7 @@ extern int obstack_exit_failure;
# define obstack_make_room(OBSTACK,length) \
__extension__ \
({ struct obstack *__o = (OBSTACK); \
- int __len = (length); \
+ PTR_INT_TYPE __len = (length); \
if (__o->chunk_limit - __o->next_free < __len) \
_obstack_newchunk (__o, __len); \
(void) 0; })
@@ -331,7 +331,7 @@ __extension__ \
# define obstack_grow(OBSTACK,where,length) \
__extension__ \
({ struct obstack *__o = (OBSTACK); \
- int __len = (length); \
+ PTR_INT_TYPE __len = (length); \
if (__o->next_free + __len > __o->chunk_limit) \
_obstack_newchunk (__o, __len); \
_obstack_memcpy (__o->next_free, (where), __len); \
@@ -341,7 +341,7 @@ __extension__ \
# define obstack_grow0(OBSTACK,where,length) \
__extension__ \
({ struct obstack *__o = (OBSTACK); \
- int __len = (length); \
+ PTR_INT_TYPE __len = (length); \
if (__o->next_free + __len + 1 > __o->chunk_limit) \
_obstack_newchunk (__o, __len + 1); \
_obstack_memcpy (__o->next_free, (where), __len); \
@@ -392,7 +392,7 @@ __extension__ \
# define obstack_blank(OBSTACK,length) \
__extension__ \
({ struct obstack *__o = (OBSTACK); \
- int __len = (length); \
+ PTR_INT_TYPE __len = (length); \
if (__o->chunk_limit - __o->next_free < __len) \
_obstack_newchunk (__o, __len); \
obstack_blank_fast (__o, __len); \
@@ -532,7 +532,7 @@ __extension__ \
# define obstack_free(h,obj) \
( (h)->temp = (char *) (obj) - (char *) (h)->chunk, \
(((h)->temp > 0 && (h)->temp < (h)->chunk_limit - (char *) (h)->chunk)\
- ? (int) ((h)->next_free = (h)->object_base \
+ ? (PTR_INT_TYPE) ((h)->next_free = (h)->object_base \
= (h)->temp + (char *) (h)->chunk) \
: (((obstack_free) ((h), (h)->temp + (char *) (h)->chunk), 0), 0)))
diff -u -rup gdb-6.6-orig/libiberty/obstack.c gdb-6.6/libiberty/obstack.c
--- gdb-6.6-orig/libiberty/obstack.c 2005-05-10 11:33:33.000000000 -0400
+++ gdb-6.6/libiberty/obstack.c 2007-03-12 09:40:16.000000000 -0400
@@ -44,9 +44,11 @@
#if !defined (_LIBC) && defined (__GNU_LIBRARY__) && __GNU_LIBRARY__ > 1
#include <gnu-versions.h>
#if _GNU_OBSTACK_INTERFACE_VERSION == OBSTACK_INTERFACE_VERSION
+#if 0 /* 64-bit obstack is not compatible with any glibc implementation. */
#define ELIDE_CODE
#endif
#endif
+#endif
#ifndef ELIDE_CODE
@@ -139,7 +141,7 @@ struct obstack *_obstack;
free up some memory, then call this again. */
int
-_obstack_begin (struct obstack *h, int size, int alignment,
+_obstack_begin (struct obstack *h, PTR_INT_TYPE size, int alignment,
POINTER (*chunkfun) (long), void (*freefun) (void *))
{
register struct _obstack_chunk *chunk; /* points to new chunk */
@@ -183,7 +185,7 @@ _obstack_begin (struct obstack *h, int s
}
int
-_obstack_begin_1 (struct obstack *h, int size, int alignment,
+_obstack_begin_1 (struct obstack *h, PTR_INT_TYPE size, int alignment,
POINTER (*chunkfun) (POINTER, long),
void (*freefun) (POINTER, POINTER), POINTER arg)
{
@@ -235,7 +237,7 @@ _obstack_begin_1 (struct obstack *h, int
to the beginning of the new one. */
void
-_obstack_newchunk (struct obstack *h, int length)
+_obstack_newchunk (struct obstack *h, PTR_INT_TYPE length)
{
register struct _obstack_chunk *old_chunk = h->chunk;
register struct _obstack_chunk *new_chunk;
@@ -388,11 +390,11 @@ obstack_free (struct obstack *h, POINTER
abort ();
}
-int
+PTR_INT_TYPE
_obstack_memory_used (struct obstack *h)
{
register struct _obstack_chunk* lp;
- register int nbytes = 0;
+ register PTR_INT_TYPE nbytes = 0;
for (lp = h->chunk; lp != 0; lp = lp->prev)
{
@@ -421,6 +423,7 @@ print_and_abort (void)
}
#if 0
+/* These functions are now broken for 64-bit obstack! */
/* These are now turned off because the applications do not use it
and it uses bcopy via obstack_grow, which causes trouble on sysV. */

View File

@ -0,0 +1,57 @@
for gdb-6.3/gdb/ChangeLog
from Alexandre Oliva <aoliva@redhat.com>
* i386-linux-nat.c (i386_debug_register_for_thread): New struct.
(i386_linux_set_dr_for_thread): Rename from...
(i386_linux_set_debug_regs_for_thread): ... this, and
add new function to catch exceptions in the old one.
Index: gdb-6.5/gdb/i386-linux-nat.c
===================================================================
--- gdb-6.5.orig/gdb/i386-linux-nat.c 2006-07-11 05:21:58.000000000 -0300
+++ gdb-6.5/gdb/i386-linux-nat.c 2006-07-11 05:24:29.000000000 -0300
@@ -27,6 +27,7 @@
#include "observer.h"
#include "target.h"
#include "linux-nat.h"
+#include "exceptions.h"
#include "gdb_assert.h"
#include "gdb_string.h"
@@ -695,14 +696,33 @@ struct i386_debug_register_state
unsigned long control;
};
-static void
-i386_linux_set_debug_regs_for_thread (ptid_t ptid,
- struct i386_debug_register_state *dbs)
+struct i386_debug_register_for_thread
+{
+ ptid_t ptid;
+ struct i386_debug_register_state *dbs;
+};
+
+static int
+i386_linux_set_dr_for_thread (void *drp)
{
+ ptid_t ptid = ((struct i386_debug_register_for_thread *)drp)->ptid;
+ struct i386_debug_register_state *dbs
+ = ((struct i386_debug_register_for_thread *)drp)->dbs;
int i;
for (i = 0; i < (DR_LASTADDR - DR_FIRSTADDR) + 1; ++i)
i386_linux_dr_set_addr (ptid, i, dbs->addr[i]);
i386_linux_dr_set_control (ptid, dbs->control);
+ return 1;
+}
+
+static int
+i386_linux_set_debug_regs_for_thread (ptid_t ptid,
+ struct i386_debug_register_state *dbs)
+{
+ struct i386_debug_register_for_thread dr;
+ dr.ptid = ptid;
+ dr.dbs = dbs;
+ return catch_errors (i386_linux_set_dr_for_thread, &dr, "", RETURN_MASK_ALL);
}
/* Iterator function to support syncing debug registers across all threads. */

View File

@ -0,0 +1,44 @@
2004-12-16 Jeff Johnston <jjohnstn@redhat.com>
* cp-demangle.c (d_print_comp): Add support for exposing
not-in-charge constructors/destructors in the demangled
names.
--- gdb-6.3/libiberty/cp-demangle.c.fix Thu Dec 16 16:39:09 2004
+++ gdb-6.3/libiberty/cp-demangle.c Thu Dec 16 16:39:37 2004
@@ -2978,11 +2978,35 @@ d_print_comp (dpi, dc)
case DEMANGLE_COMPONENT_CTOR:
d_print_comp (dpi, dc->u.s_ctor.name);
+ switch (dc->u.s_ctor.kind)
+ {
+ case gnu_v3_complete_object_ctor:
+ /* no decoration */
+ break;
+ case gnu_v3_base_object_ctor:
+ d_append_string_constant (dpi, "$base");
+ break;
+ case gnu_v3_complete_object_allocating_ctor:
+ d_append_string_constant (dpi, "$allocate");
+ break;
+ }
return;
case DEMANGLE_COMPONENT_DTOR:
d_append_char (dpi, '~');
d_print_comp (dpi, dc->u.s_dtor.name);
+ switch (dc->u.s_dtor.kind)
+ {
+ case gnu_v3_deleting_dtor:
+ d_append_string_constant (dpi, "$delete");
+ break;
+ case gnu_v3_complete_object_dtor:
+ /* no decoration */
+ break;
+ case gnu_v3_base_object_dtor:
+ d_append_string_constant (dpi, "$base");
+ break;
+ }
return;
case DEMANGLE_COMPONENT_VTABLE:

View File

@ -0,0 +1,726 @@
2005-01-20 Jeff Johnston <jjohnstn@redhat.com>
* symtab.h (find_line_pc): Change prototype to new api
which returns a list of pc values and the number of list elements.
* symtab.c (find_line_pc): Change function to new api which
returns a list of pc values. Support recognizing a base ctor
or dtor and finding an additional pc value for the in-charge
ctor or dtor accordingly.
(find_line_common): Change api to accept a start_index argument
which determines where to start searching from in the line table.
(find_line_by_pc): New function.
* breakpoint.c (resolve_sal_pc_list): New function.
(breakpoint_sals_to_pc): Support multiple pc values for a
line in a ctor/dtor.
(gdb_breakpoint): Change call to find_line_pc to use new api.
(break_command_1): Move resolve_sals_to_pc earlier due to the
fact it now can extend the sal list.
* mi/mi-cmd-disas.c (mi_cmd_disassemble): Change call to
find_line_pc to new api.
* tui/tui-layout.c (extract_display_start_addr): Ditto.
* tui/tui-win.c (make_visible_with_new_height): Ditto.
* tui/tui-winsource.c (tui_update_source_windows_with_addr): Ditto.
2007-09-22 Jan Kratochvil <jan.kratochvil@redhat.com>
* symtab.c (find_line_pc): Support also the `$allocate' and `$delete'
variants. Support searching for the `$base' name even if the bare name
was found first.
* breakpoint.c (breakpoint_sals_to_pc): Support more than two returned
PC values.
2007-09-25 Jan Kratochvil <jan.kratochvil@redhat.com>
* breakpoint.c (breakpoint_sals_to_pc): New parameter ADDR_STRING_P.
Expand also *ADDR_STRING_P if multiple PCs were found.
(break_command_1, do_captured_breakpoint): Pass also the ADDR_STRING
variable to be updated.
2007-10-05 Jan Kratochvil <jan.kratochvil@redhat.com>
* breakpoint.c (breakpoint_sals_to_pc): Provide "%42" suffix to the
multiple-PC breakpoints' ADDR_STRINGs.
(breakpoint_re_set_one): New variables ID_S, ID, PC_LIST, NUM_PC_VALUES.
Parse the "%42" suffix of the multiple-PC breakpoints's ADDR_STRINGs.
Index: gdb-6.5/gdb/mi/mi-cmd-disas.c
===================================================================
--- gdb-6.5.orig/gdb/mi/mi-cmd-disas.c 2006-07-11 01:30:43.000000000 -0300
+++ gdb-6.5/gdb/mi/mi-cmd-disas.c 2006-07-11 02:16:07.000000000 -0300
@@ -1,5 +1,5 @@
/* MI Command Set - disassemble commands.
- Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2001, 2002, 2005 Free Software Foundation, Inc.
Contributed by Cygnus Solutions (a Red Hat company).
This file is part of GDB.
@@ -145,11 +145,18 @@ mi_cmd_disassemble (char *command, char
if (line_seen && file_seen)
{
+ CORE_ADDR *pc_list;
+ int num_pc_values;
+
s = lookup_symtab (file_string);
if (s == NULL)
error (_("mi_cmd_disassemble: Invalid filename."));
- if (!find_line_pc (s, line_num, &start))
+ if (!find_line_pc (s, line_num, &pc_list, &num_pc_values))
error (_("mi_cmd_disassemble: Invalid line number"));
+ /* FIXME: What do we do with multiple pc values for ctors/dtors
+ under mi? */
+ start = pc_list[0];
+ xfree (pc_list);
if (find_pc_partial_function (start, NULL, &low, &high) == 0)
error (_("mi_cmd_disassemble: No function contains specified address"));
}
Index: gdb-6.5/gdb/tui/tui-layout.c
===================================================================
--- gdb-6.5.orig/gdb/tui/tui-layout.c 2006-07-11 01:30:43.000000000 -0300
+++ gdb-6.5/gdb/tui/tui-layout.c 2006-07-11 02:16:07.000000000 -0300
@@ -1,6 +1,6 @@
/* TUI layout window management.
- Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software
+ Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software
Foundation, Inc.
Contributed by Hewlett-Packard Company.
@@ -511,7 +511,8 @@ extract_display_start_addr (void)
{
enum tui_layout_type cur_layout = tui_current_layout ();
CORE_ADDR addr;
- CORE_ADDR pc;
+ CORE_ADDR *pc_list;
+ int num_pc_values;
struct symtab_and_line cursal = get_current_source_symtab_and_line ();
switch (cur_layout)
@@ -520,8 +521,11 @@ extract_display_start_addr (void)
case SRC_DATA_COMMAND:
find_line_pc (cursal.symtab,
TUI_SRC_WIN->detail.source_info.start_line_or_addr.u.line_no,
- &pc);
- addr = pc;
+ &pc_list, &num_pc_values);
+ /* FIXME: What do we do with multiple pc values for ctors/dtors or
+ inlined functions? */
+ addr = pc_list[0];
+ xfree (pc_list);
break;
case DISASSEM_COMMAND:
case SRC_DISASSEM_COMMAND:
Index: gdb-6.5/gdb/tui/tui-win.c
===================================================================
--- gdb-6.5.orig/gdb/tui/tui-win.c 2006-07-11 01:30:43.000000000 -0300
+++ gdb-6.5/gdb/tui/tui-win.c 2006-07-11 02:16:12.000000000 -0300
@@ -1,6 +1,6 @@
/* TUI window generic functions.
- Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2006
+ Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
Contributed by Hewlett-Packard Company.
@@ -1342,8 +1342,16 @@ make_visible_with_new_height (struct tui
}
else
{
+ CORE_ADDR *pc_list;
+ int num_pc_values;
line.loa = LOA_ADDRESS;
- find_line_pc (s, cursal.line, &line.u.addr);
+ if (find_line_pc (s, cursal.line, &pc_list, &num_pc_values))
+ {
+ /* FIXME: What do we do with multiple pc values for
+ ctors/dtors and inlined functions? */
+ line.u.addr = pc_list[0];
+ xfree (pc_list);
+ }
}
tui_update_source_window (win_info, s, line, TRUE);
}
Index: gdb-6.5/gdb/tui/tui-winsource.c
===================================================================
--- gdb-6.5.orig/gdb/tui/tui-winsource.c 2006-07-11 01:30:43.000000000 -0300
+++ gdb-6.5/gdb/tui/tui-winsource.c 2006-07-11 01:39:20.000000000 -0300
@@ -1,6 +1,6 @@
/* TUI display source/assembly window.
- Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2006
+ Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
Contributed by Hewlett-Packard Company.
@@ -173,14 +173,21 @@ tui_update_source_windows_with_addr (COR
void
tui_update_source_windows_with_line (struct symtab *s, int line)
{
- CORE_ADDR pc;
+ CORE_ADDR pc = 0;
+ CORE_ADDR *pc_list;
+ int num_pc_values;
struct tui_line_or_address l;
switch (tui_current_layout ())
{
case DISASSEM_COMMAND:
case DISASSEM_DATA_COMMAND:
- find_line_pc (s, line, &pc);
+ /* FIXME: What do we do with multiple pc values for ctors/dtors? */
+ if (find_line_pc (s, line, &pc_list, &num_pc_values))
+ {
+ pc = pc_list[0];
+ xfree (pc_list);
+ }
tui_update_source_windows_with_addr (pc);
break;
default:
@@ -189,7 +196,12 @@ tui_update_source_windows_with_line (str
tui_show_symtab_source (s, l, FALSE);
if (tui_current_layout () == SRC_DISASSEM_COMMAND)
{
- find_line_pc (s, line, &pc);
+ /* FIXME: What do we do with multiple pc values for ctors/dtors? */
+ if (find_line_pc (s, line, &pc_list, &num_pc_values))
+ {
+ pc = pc_list[0];
+ xfree (pc_list);
+ }
tui_show_disassem (pc);
}
break;
Index: gdb-6.5/gdb/symtab.c
===================================================================
--- gdb-6.5.orig/gdb/symtab.c 2006-07-11 01:30:43.000000000 -0300
+++ gdb-6.5/gdb/symtab.c 2006-07-11 02:16:05.000000000 -0300
@@ -1,7 +1,7 @@
/* Symbol table lookup for the GNU debugger, GDB.
Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
- 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
+ 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
This file is part of GDB.
@@ -73,7 +73,9 @@ static void sources_info (char *, int);
static void output_source_filename (const char *, int *);
-static int find_line_common (struct linetable *, int, int *);
+static int find_line_common (struct linetable *, int, int, int *);
+
+static int find_line_by_pc (struct linetable *, CORE_ADDR, int *);
/* This one is used by linespec.c */
@@ -2233,6 +2235,9 @@ find_pc_line (CORE_ADDR pc, int notcurre
/* Find line number LINE in any symtab whose name is the same as
SYMTAB.
+ If INDEX is non-NULL, use the value as the starting index in the
+ linetable to start at.
+
If found, return the symtab that contains the linetable in which it was
found, set *INDEX to the index in the linetable of the best entry
found, and set *EXACT_MATCH nonzero if the value returned is an
@@ -2249,13 +2254,19 @@ find_line_symtab (struct symtab *symtab,
so far seen. */
int best_index;
+ int start_index;
struct linetable *best_linetable;
struct symtab *best_symtab;
+ if (index)
+ start_index = *index;
+ else
+ start_index = 0;
+
/* First try looking it up in the given symtab. */
best_linetable = LINETABLE (symtab);
best_symtab = symtab;
- best_index = find_line_common (best_linetable, line, &exact);
+ best_index = find_line_common (best_linetable, line, start_index, &exact);
if (best_index < 0 || !exact)
{
/* Didn't find an exact match. So we better keep looking for
@@ -2286,7 +2297,7 @@ find_line_symtab (struct symtab *symtab,
if (strcmp (symtab->filename, s->filename) != 0)
continue;
l = LINETABLE (s);
- ind = find_line_common (l, line, &exact);
+ ind = find_line_common (l, line, start_index, &exact);
if (ind >= 0)
{
if (exact)
@@ -2322,13 +2333,23 @@ done:
Returns zero for invalid line number (and sets the PC to 0).
The source file is specified with a struct symtab. */
+static CORE_ADDR empty_pc_list = (CORE_ADDR)0;
+
int
-find_line_pc (struct symtab *symtab, int line, CORE_ADDR *pc)
+find_line_pc (struct symtab *symtab, int line, CORE_ADDR **pc_array,
+ int *num_elements)
{
struct linetable *l;
- int ind;
+ int ind = 0;
+ char *name;
+ CORE_ADDR main_pc;
+ struct minimal_symbol *minsym;
+ struct minimal_symbol *minsym2;
+
+
+ *pc_array = &empty_pc_list;
+ *num_elements = 0;
- *pc = 0;
if (symtab == 0)
return 0;
@@ -2336,7 +2357,73 @@ find_line_pc (struct symtab *symtab, int
if (symtab != NULL)
{
l = LINETABLE (symtab);
- *pc = l->item[ind].pc;
+ main_pc = l->item[ind].pc;
+ *pc_array = xmalloc (sizeof (CORE_ADDR) * 3);
+ *num_elements = 0;
+ (*pc_array)[(*num_elements)++] = main_pc;
+ minsym = lookup_minimal_symbol_by_pc (main_pc);
+ if (minsym != NULL && minsym->ginfo.language == language_cplus)
+ {
+ char *src = minsym->ginfo.language_specific.cplus_specific.demangled_name;
+ char *src_point = strchr (src, '(');
+ char *s, *point;
+ /* Keep "" last as the trimming part always matches it. */
+ const char *variants[] = {"$base","$allocate","$delete",""};
+ int i;
+
+ if (src_point != NULL)
+ {
+ char *dst = xmalloc (strlen (src) + strlen ("$allocate") + 1);
+ char *dst_point = dst + (src_point - src);
+
+ memcpy (dst, src, src_point - src);
+
+ /* Trim out any variant markers there first. */
+ for (i = 0; i < ARRAY_SIZE (variants); i++)
+ {
+ size_t len = strlen (variants[i]);
+
+ if (dst_point - dst >= len
+ && memcmp (dst_point - len, variants[i], len) == 0)
+ {
+ dst_point -= len;
+ /* In fact it should not be needed here. */
+ break;
+ }
+ }
+
+ /* And now try to append all of them. */
+ for (i = 0; i < ARRAY_SIZE (variants); i++)
+ {
+ size_t len = strlen (variants[i]);
+ struct minimal_symbol *minsym2;
+
+ memcpy (dst_point, variants[i], len);
+ strcpy (dst_point + len, src_point);
+
+ minsym2 = lookup_minimal_symbol (dst, NULL, NULL);
+ if (minsym2 != NULL)
+ {
+ /* We have recognized we have a ctor or dtor and have
+ located our line in the not-in-charge version. We
+ also have located the in-charge version's minsym.
+ From this, we can find the index for the first line
+ line in the in-charge ctor/dtor and then search forward
+ for the specified line, thereby finding the 2nd match. */
+ int exact;
+ int ind = find_line_by_pc (l, minsym2->ginfo.value.address,
+ &exact);
+ if (ind >= 0)
+ {
+ ind = find_line_common (l, line, ind, &exact);
+ if (ind >= 0 && l->item[ind].pc != main_pc)
+ (*pc_array)[(*num_elements)++] = l->item[ind].pc;
+ }
+ }
+ }
+ xfree (dst);
+ }
+ }
return 1;
}
else
@@ -2354,12 +2418,22 @@ find_line_pc_range (struct symtab_and_li
CORE_ADDR *endptr)
{
CORE_ADDR startaddr;
+ CORE_ADDR *pc_list;
+ int num_pc_values;
struct symtab_and_line found_sal;
startaddr = sal.pc;
- if (startaddr == 0 && !find_line_pc (sal.symtab, sal.line, &startaddr))
+ if (startaddr == 0
+ && !find_line_pc (sal.symtab, sal.line, &pc_list, &num_pc_values))
return 0;
+ /* FIXME: have to handle ctors/dtors where line equates to multiple
+ pc ranges. */
+ if (startaddr == 0)
+ startaddr = pc_list[0];
+
+ xfree (pc_list);
+
/* This whole function is based on address. For example, if line 10 has
two parts, one from 0x100 to 0x200 and one from 0x300 to 0x400, then
"info line *0x123" should say the line goes from 0x100 to 0x200
@@ -2389,7 +2463,7 @@ find_line_pc_range (struct symtab_and_li
Set *EXACT_MATCH nonzero if the value returned is an exact match. */
static int
-find_line_common (struct linetable *l, int lineno,
+find_line_common (struct linetable *l, int lineno, int start_index,
int *exact_match)
{
int i;
@@ -2408,7 +2482,7 @@ find_line_common (struct linetable *l, i
return -1;
len = l->nitems;
- for (i = 0; i < len; i++)
+ for (i = start_index; i < len; i++)
{
struct linetable_entry *item = &(l->item[i]);
@@ -2432,6 +2506,52 @@ find_line_common (struct linetable *l, i
return best_index;
}
+/* Given a line table and a pc value, return the index into the line
+ table for the line with pc >= specified pc value.
+ Return -1 if none is found. The value is >= 0 if it is an index.
+
+ Set *EXACT_MATCH nonzero if the value returned is an exact match. */
+
+static int
+find_line_by_pc (struct linetable *l, CORE_ADDR pc,
+ int *exact_match)
+{
+ int i;
+ int len;
+
+ /* BEST is the smallest linenumber > LINENO so far seen,
+ or 0 if none has been seen so far.
+ BEST_INDEX identifies the item for it. */
+
+ if (l == 0)
+ return -1;
+
+ len = l->nitems;
+ for (i = 0; i < len; i++)
+ {
+ struct linetable_entry *item = &(l->item[i]);
+
+ /* Return the first (lowest address) entry which matches or
+ exceeds the given pc value. */
+ if (item->pc == pc)
+ {
+ *exact_match = 1;
+ return i;
+ }
+
+ if (item->pc > pc)
+ {
+ *exact_match = 0;
+ return i;
+ }
+ }
+
+ /* If we got here, we didn't get a match. */
+
+ *exact_match = 0;
+ return -1;
+}
+
int
find_pc_line_pc_range (CORE_ADDR pc, CORE_ADDR *startptr, CORE_ADDR *endptr)
{
Index: gdb-6.5/gdb/symtab.h
===================================================================
--- gdb-6.5.orig/gdb/symtab.h 2006-07-11 01:30:43.000000000 -0300
+++ gdb-6.5/gdb/symtab.h 2006-07-11 01:39:20.000000000 -0300
@@ -1,7 +1,7 @@
/* Symbol table definitions for GDB.
Copyright (C) 1986, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
- 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software
+ 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software
Foundation, Inc.
This file is part of GDB.
@@ -1256,13 +1256,16 @@ extern struct symtab_and_line find_pc_se
/* Given a symtab and line number, return the pc there. */
-extern int find_line_pc (struct symtab *, int, CORE_ADDR *);
+extern int find_line_pc (struct symtab *, int, CORE_ADDR **, int *);
extern int find_line_pc_range (struct symtab_and_line, CORE_ADDR *,
CORE_ADDR *);
extern void resolve_sal_pc (struct symtab_and_line *);
+extern void resolve_sal_pc_list (struct symtab_and_line *, CORE_ADDR **,
+ int *);
+
/* Given a string, return the line specified by it. For commands like "list"
and "breakpoint". */
Index: gdb-6.5/gdb/breakpoint.c
===================================================================
--- gdb-6.5.orig/gdb/breakpoint.c 2006-07-11 01:30:53.000000000 -0300
+++ gdb-6.5/gdb/breakpoint.c 2006-07-11 01:39:20.000000000 -0300
@@ -5268,12 +5268,70 @@ static void
static void
breakpoint_sals_to_pc (struct symtabs_and_lines *sals,
- char *address)
+ char *address, char ***addr_string_p)
{
- int i;
- for (i = 0; i < sals->nelts; i++)
- {
- resolve_sal_pc (&sals->sals[i]);
+ int i, j, incr;
+ int num_pc_values = 1;
+
+ /* If a line has multiple pc values, we want to create an sal for
+ each pc value so we will end up creating n breakpoints. */
+ for (i = 0; i < sals->nelts; i+=incr)
+ {
+ CORE_ADDR *pc_list;
+ incr = 1;
+
+ resolve_sal_pc_list (&sals->sals[i], &pc_list, &num_pc_values);
+ if (num_pc_values != 0)
+ sals->sals[i].pc = pc_list[0];
+ if (num_pc_values > 1)
+ {
+ struct symtab_and_line *new_sals =
+ xmalloc ((sals->nelts + num_pc_values - 1)
+ * sizeof (struct symtab_and_line));
+ char **new_addr_string;
+ char *addr_string_base;
+
+ /* Expand the SALS array. */
+ memcpy (new_sals, sals->sals, (i + 1)
+ * sizeof (struct symtab_and_line));
+ /* The one returned SALS entry is copied for all the PCs. */
+ for (j = 1; j < num_pc_values; ++j)
+ {
+ memcpy (&(new_sals[i + j]), &sals->sals[i],
+ sizeof (struct symtab_and_line));
+ }
+ xfree (sals->sals);
+ sals->sals = new_sals;
+ sals->nelts += num_pc_values - 1;
+ for (j = 1; j < num_pc_values; ++j)
+ {
+ sals->sals[i + j].pc = pc_list[j];
+ }
+
+ /* Expand the *ADDR_STRING_P array. */
+ new_addr_string = xmalloc ((sals->nelts + num_pc_values - 1)
+ * sizeof *new_addr_string);
+ memcpy (new_addr_string, *addr_string_p,
+ (i + 1) * sizeof *new_addr_string);
+ /* The existing *ADDR_STRING_P entry must be copied for all the
+ multiple PCs. BREAKPOINT_RE_SET will follow the new trailing "%id"
+ syntax so it will get resolved right even later. Do not use the
+ unambiguous NULL values (resolved to "0x%x" by CREATE_BREAKPOINTS)
+ as the address may change for the shared libraries. */
+ addr_string_base = (*addr_string_p)[i];
+ for (j = 0; j < num_pc_values; ++j)
+ new_addr_string[i + j] = xstrprintf ("%s%%%d", addr_string_base, j);
+ xfree (addr_string_base);
+ memcpy (&new_addr_string[i + num_pc_values], &(*addr_string_p)[i + 1],
+ (sals->nelts - (i + num_pc_values)) * sizeof *new_addr_string);
+ xfree (*addr_string_p);
+ *addr_string_p = new_addr_string;
+
+ incr = num_pc_values;
+ }
+
+ if (num_pc_values != 0)
+ xfree (pc_list);
/* It's possible for the PC to be nonzero, but still an illegal
value on some targets.
@@ -5406,6 +5436,10 @@ break_command_1 (char *arg, int flag, in
if (!pending)
{
+ /* Resolve all line numbers to PC's and verify that the addresses
+ are ok for the target. */
+ breakpoint_sals_to_pc (&sals, addr_start, &addr_string);
+
/* Make sure that all storage allocated to SALS gets freed. */
make_cleanup (xfree, sals.sals);
@@ -5436,11 +5470,6 @@ break_command_1 (char *arg, int flag, in
make_cleanup (xfree, addr_string[i]);
}
- /* Resolve all line numbers to PC's and verify that the addresses
- are ok for the target. */
- if (!pending)
- breakpoint_sals_to_pc (&sals, addr_start);
-
/* Verify that condition can be parsed, before setting any
breakpoints. Allocate a separate condition expression for each
breakpoint. */
@@ -5665,7 +5688,7 @@ do_captured_breakpoint (struct ui_out *u
error (_("Garbage %s following breakpoint address"), address_end);
/* Resolve all line numbers to PC's. */
- breakpoint_sals_to_pc (&sals, args->address);
+ breakpoint_sals_to_pc (&sals, args->address, &addr_string);
/* Verify that conditions can be parsed, before setting any
breakpoints. */
@@ -5670,14 +5699,16 @@ gdb_breakpoint (char *address, char *con
void
resolve_sal_pc (struct symtab_and_line *sal)
{
- CORE_ADDR pc;
+ CORE_ADDR *pc_list;
+ int num_pc_values;
if (sal->pc == 0 && sal->symtab != NULL)
{
- if (!find_line_pc (sal->symtab, sal->line, &pc))
+ if (!find_line_pc (sal->symtab, sal->line, &pc_list, &num_pc_values))
error (_("No line %d in file \"%s\"."),
sal->line, sal->symtab->filename);
- sal->pc = pc;
+ sal->pc = pc_list[0];
+ xfree (pc_list);
}
if (sal->section == 0 && sal->symtab != NULL)
@@ -5714,6 +5745,54 @@ resolve_sal_pc (struct symtab_and_line *
}
}
+/* Helper function for break_command_1 and disassemble_command. */
+
+void
+resolve_sal_pc_list (struct symtab_and_line *sal, CORE_ADDR **pc_list,
+ int *num_pc_values)
+{
+ *num_pc_values = 0;
+ if (sal->pc == 0 && sal->symtab != NULL)
+ {
+ if (!find_line_pc (sal->symtab, sal->line, pc_list, num_pc_values))
+ error ("No line %d in file \"%s\".",
+ sal->line, sal->symtab->filename);
+ sal->pc = (*pc_list)[0];
+ }
+
+ if (sal->section == 0 && sal->symtab != NULL)
+ {
+ struct blockvector *bv;
+ struct block *b;
+ struct symbol *sym;
+ int index;
+
+ bv = blockvector_for_pc_sect (sal->pc, 0, &index, sal->symtab);
+ if (bv != NULL)
+ {
+ b = BLOCKVECTOR_BLOCK (bv, index);
+ sym = block_function (b);
+ if (sym != NULL)
+ {
+ fixup_symbol_section (sym, sal->symtab->objfile);
+ sal->section = SYMBOL_BFD_SECTION (sym);
+ }
+ else
+ {
+ /* It really is worthwhile to have the section, so we'll just
+ have to look harder. This case can be executed if we have
+ line numbers but no functions (as can happen in assembly
+ source). */
+
+ struct minimal_symbol *msym;
+
+ msym = lookup_minimal_symbol_by_pc (sal->pc);
+ if (msym)
+ sal->section = SYMBOL_BFD_SECTION (msym);
+ }
+ }
+ }
+}
void
break_command (char *arg, int from_tty)
{
@@ -7304,6 +7305,8 @@ breakpoint_re_set_one (void *bint)
int *not_found_ptr = NULL;
struct symtabs_and_lines sals;
char *s;
+ char *id_s;
+ int id = -1;
enum enable_state save_enable;
switch (b->type)
@@ -7364,11 +7367,44 @@ breakpoint_re_set_one (void *bint)
set_language (b->language);
input_radix = b->input_radix;
s = b->addr_string;
+ for (id_s = s + strlen (s) - 1; id_s >= s; id_s--)
+ {
+ if (isdigit (*id_s))
+ continue;
+ if (*id_s == '%')
+ break;
+ id_s = NULL;
+ break;
+ }
+ if (id_s >= s)
+ {
+ s = alloca (id_s - b->addr_string + 1);
+ memcpy (s, b->addr_string, id_s - b->addr_string);
+ s[id_s - b->addr_string] = 0;
+ id = atoi (id_s + 1);
+ }
sals = decode_line_1 (&s, 1, (struct symtab *) NULL, 0, (char ***) NULL,
not_found_ptr);
for (i = 0; i < sals.nelts; i++)
{
- resolve_sal_pc (&sals.sals[i]);
+ CORE_ADDR *pc_list;
+ int num_pc_values;
+
+ resolve_sal_pc_list (&sals.sals[i], &pc_list, &num_pc_values);
+ if (num_pc_values > 0)
+ {
+ if (id != -1)
+ {
+ /* The number of PC values should not usually change. */
+ if (id >= num_pc_values)
+ {
+ delete_breakpoint (b);
+ return 0;
+ }
+ sals.sals[i].pc = pc_list[id];
+ }
+ xfree (pc_list);
+ }
/* Reparse conditions, they might contain references to the
old symtab. */

View File

@ -0,0 +1,48 @@
2005-01-21 Jeff Johnston <jjohnstn@redhat.com>
* linespec.c (collect_methods): Don't do special processing for
destructors as this will be handled in find_methods.
(find_methods): Fix ctor check to also check for dtor.
Index: gdb-6.5/gdb/linespec.c
===================================================================
--- gdb-6.5.orig/gdb/linespec.c 2006-07-07 01:04:56.000000000 -0300
+++ gdb-6.5/gdb/linespec.c 2006-07-07 02:05:35.000000000 -0300
@@ -377,12 +377,14 @@ add_matching_methods (int method_counter
/* Check for special case of looking for member that
doesn't have a mangled name provided. This will happen
- when we have in-charge and not-in-charge constructors.
+ when we have in-charge and not-in-charge ctors/dtors.
Since we don't have a mangled name to work with, if we
- look for the symbol, we can only find the class itself.
+ look for the symbol, we can at best find the class itself.
We can find the information we need in the minimal symbol
table which has the full member name information we need. */
- if (strlen (phys_name) <= strlen (class_name))
+ if (strlen (phys_name) <= strlen (class_name)
+ || (strlen (phys_name) == strlen (class_name) + 1
+ && phys_name[0] == '~'))
return add_minsym_members (class_name, phys_name, msym_arr);
/* Destructor is handled by caller, don't add it to
@@ -1709,6 +1711,11 @@ collect_methods (char *copy, struct type
{
int i1 = 0; /* Counter for the symbol array. */
+#if 0
+ /* Ignore this special method for getting destructors because
+ find_methods is more robust and can handle multiple
+ destructors which is the case when gcc generates a not-in-charge
+ vs an in-charge destructor. */
if (destructor_name_p (copy, t))
{
/* Destructors are a special case. */
@@ -1727,6 +1734,7 @@ collect_methods (char *copy, struct type
}
}
else
+#endif
i1 = find_methods (t, copy, sym_arr, msym_arr);
return i1;

View File

@ -0,0 +1,18 @@
2005-02-01 Jeff Johnston <jjohnstn@redhat.com>
* dwarf2read.c (die_type): Tolerate a type reference to location
<0> and treat as unknown type.
--- gdb-6.3/gdb/dwarf2read.c.fix Tue Feb 1 16:48:49 2005
+++ gdb-6.3/gdb/dwarf2read.c Tue Feb 1 16:50:12 2005
@@ -7120,6 +7120,10 @@ die_type (struct die_info *die, struct d
/* A missing DW_AT_type represents a void type. */
return dwarf2_fundamental_type (cu->objfile, FT_VOID, cu);
}
+ else if (DW_ADDR (type_attr) == 0)
+ /* If we have an invalid reference to 0, ignore it and treat
+ the type as unknown. */
+ return builtin_type_error;
else
type_die = follow_die_ref (die, type_attr, cu);

View File

@ -1,53 +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.3-focus-cmd-prev-test.patch
;; Test a crash on `focus cmd', `focus prev' commands.
;;=fedoratest
diff --git a/gdb/testsuite/gdb.base/focus-cmd-prev.exp b/gdb/testsuite/gdb.base/focus-cmd-prev.exp
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/focus-cmd-prev.exp
@@ -0,0 +1,40 @@
+# 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 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
+}
+
+gdb_exit
+gdb_start
+
+# Do not use gdb_test or \r\n there since:
+# commit d7e747318f4d04af033f16325f9b6d74f67079ec
+# Eliminate make_cleanup_ui_file_delete / make ui_file a class hierarchy
+
+set test "focus cmd"
+gdb_test_multiple $test $test {
+ -re "$gdb_prompt $" {
+ pass $test
+ }
+}
+
+set test "focus prev"
+gdb_test_multiple $test $test {
+ -re "$gdb_prompt $" {
+ pass $test
+ }
+}

View File

@ -0,0 +1,31 @@
2004-09-27 Andrew Cagney <cagney@gnu.org>
* frame.c (get_prev_frame): Stop backtrace when a zero PC and
successive normal frames.
Index: ./gdb/frame.c
===================================================================
RCS file: /cvs/src/src/gdb/frame.c,v
retrieving revision 1.191
diff -p -u -r1.191 frame.c
--- ./gdb/frame.c 1 Sep 2004 14:13:33 -0000 1.191
+++ ./gdb/frame.c 28 Sep 2004 02:45:58 -0000
@@ -1235,6 +1235,18 @@ get_prev_frame (struct frame_info *this_
return NULL;
}
+ if (this_frame->level > 0
+#if 0
+ && backtrace_past_zero_pc
+#endif
+ && get_frame_type (this_frame) == NORMAL_FRAME
+ && get_frame_type (get_next_frame (this_frame)) == NORMAL_FRAME
+ && get_frame_pc (this_frame) == 0)
+ {
+ frame_debug_got_null_frame (gdb_stdlog, this_frame, "zero PC");
+ return NULL;
+ }
+
return get_prev_frame_1 (this_frame);
}

View File

@ -0,0 +1,25 @@
2005-02-07 Jeff Johnston <jjohnstn@redhat.com>
* linux-nat.c (linux_nat_xfer_memory): Don't use
linux_proc_xfer_memory for ia64.
Index: gdb-6.5/gdb/linux-nat.c
===================================================================
--- gdb-6.5.orig/gdb/linux-nat.c 2006-07-07 00:57:56.000000000 -0300
+++ gdb-6.5/gdb/linux-nat.c 2006-07-07 02:24:51.000000000 -0300
@@ -3152,10 +3152,15 @@ linux_xfer_partial (struct target_ops *o
return procfs_xfer_auxv (ops, object, annex, readbuf, writebuf,
offset, len);
+#ifndef NATIVE_XFER_UNWIND_TABLE
+ /* FIXME: For ia64, we cannot currently use linux_proc_xfer_memory
+ for accessing thread storage. Revert when Bugzilla 147436
+ is fixed. */
xfer = linux_proc_xfer_partial (ops, object, annex, readbuf, writebuf,
offset, len);
if (xfer != 0)
return xfer;
+#endif
return super_xfer_partial (ops, object, annex, readbuf, writebuf,
offset, len);

View File

@ -1,35 +1,25 @@
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-gstack-20050411.patch
;; Add a wrapper script to GDB that implements pstack using the
;; --readnever option.
;;=push
2004-11-23 Andrew Cagney <cagney@redhat.com>
* Makefile.in (uninstall-gstack, install-gstack): New rules, add
to install and uninstall.
* gstack.sh, gstack.1: New files.
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -1726,7 +1726,7 @@ info install-info clean-info dvi pdf install-pdf html install-html: force
install: all
@$(MAKE) $(FLAGS_TO_PASS) install-only
diff -uN -r ../orig/gdb/Makefile.in ./gdb/Makefile.in
--- ../orig/gdb/Makefile.in 2004-11-23 13:31:03.000000000 -0500
+++ ./gdb/Makefile.in 2004-11-23 15:06:34.623389592 -0500
@@ -970,7 +970,7 @@
# time it takes for make to check that all is up to date.
# install-only is intended to address that need.
install: all install-only
-install-only: $(CONFIG_INSTALL)
+install-only: install-gstack $(CONFIG_INSTALL)
transformed_name=`t='$(program_transform_name)'; \
echo gdb | sed -e "$$t"` ; \
if test "x$$transformed_name" = x; then \
@@ -1775,7 +1775,25 @@ install-guile:
install-python:
$(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(GDB_DATADIR)/python/gdb
-uninstall: force $(CONFIG_UNINSTALL)
@@ -1002,9 +1002,26 @@
$(DESTDIR)$(man1dir) ; \
$(INSTALL_DATA) $(srcdir)/gdb.1 \
$(DESTDIR)$(man1dir)/$$transformed_name.1
+GSTACK=gstack
+.PHONY: install-gstack
+install-gstack:
@ -47,15 +37,17 @@ diff --git a/gdb/Makefile.in b/gdb/Makefile.in
+ $(DESTDIR)$(man1dir) ; \
+ : $(INSTALL_DATA) $(srcdir)/gstack.1 \
+ $(DESTDIR)$(man1dir)/$$transformed_name.1
+
-uninstall: force $(CONFIG_UNINSTALL)
+uninstall: force uninstall-gstack $(CONFIG_UNINSTALL)
transformed_name=`t='$(program_transform_name)'; \
echo gdb | sed -e $$t` ; \
if test "x$$transformed_name" = x; then \
@@ -1798,6 +1816,18 @@ uninstall: force $(CONFIG_UNINSTALL)
fi
@$(MAKE) DO=uninstall "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do
@@ -1026,6 +1043,17 @@
fi ; \
rm -f $(DESTDIR)$(bindir)/$$transformed_name$(EXEEXT) \
$(DESTDIR)$(man1dir)/$$transformed_name.1
+.PHONY: uninstall-gstack
+uninstall-gstack:
+ transformed_name=`t='$(program_transform_name)'; \
@ -67,15 +59,12 @@ diff --git a/gdb/Makefile.in b/gdb/Makefile.in
+ fi ; \
+ rm -f $(DESTDIR)$(bindir)/$$transformed_name$(EXEEXT) \
+ $(DESTDIR)$(man1dir)/$$transformed_name.1
+
# The C++ name parser can be built standalone for testing.
test-cp-name-parser.o: cp-name-parser.c
$(COMPILE) -DTEST_CPNAMES cp-name-parser.c
diff --git a/gdb/gstack.sh b/gdb/gstack.sh
new file mode 100644
--- /dev/null
+++ b/gdb/gstack.sh
@@ -0,0 +1,43 @@
# We do this by grepping through sources. If that turns out to be too slow,
# maybe we could just require every .o file to have an initialization routine
--- /dev/null 2005-04-09 23:51:05.027867440 -0400
+++ ./gdb/gstack.sh 2005-04-08 18:00:49.000000000 -0400
@@ -0,0 +1,45 @@
+#!/bin/sh
+
+if test $# -ne 1; then
@ -95,164 +84,29 @@ new file mode 100644
+backtrace="bt"
+if test -d /proc/$1/task ; then
+ # Newer kernel; has a task/ directory.
+ if test `/bin/ls /proc/$1/task | /usr/bin/wc -l` -gt 1 2>/dev/null ; then
+ if test `ls /proc/$1/task | wc -l` -gt 1 2>/dev/null ; then
+ backtrace="thread apply all bt"
+ fi
+elif test -f /proc/$1/maps ; then
+ # Older kernel; go by it loading libpthread.
+ if /bin/grep -e libpthread /proc/$1/maps > /dev/null 2>&1 ; then
+ if grep -e libpthread /proc/$1/maps > /dev/null 2>&1 ; then
+ backtrace="thread apply all bt"
+ fi
+fi
+
+GDB=${GDB:-gdb}
+
+if $GDB -nx --quiet --batch --readnever > /dev/null 2>&1; then
+ readnever=--readnever
+else
+ readnever=
+fi
+
+# Run GDB, strip out unwanted noise.
+# --readnever is no longer used since .gdb_index is now in use.
+$GDB --quiet -nx $GDBARGS /proc/$1/exe $1 <<EOF 2>&1 |
+set width 0
+set height 0
+set pagination no
+$GDB --quiet $readnever -nx /proc/$1/exe $1 <<EOF 2>&1 |
+$backtrace
+EOF
+/bin/sed -n \
+ -e 's/^\((gdb) \)*//' \
+sed -n \
+ -e 's/^(gdb) //' \
+ -e '/^#/p' \
+ -e '/^Thread/p'
diff --git a/gdb/testsuite/gdb.base/gstack.c b/gdb/testsuite/gdb.base/gstack.c
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/gstack.c
@@ -0,0 +1,43 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2005, 2007, 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/>. */
+
+#include <stdio.h>
+#include <unistd.h>
+#include <string.h>
+
+void
+func (void)
+{
+ const char msg[] = "looping\n";
+
+ /* Use the most simple notification not to get caught by attach on exiting
+ the function. */
+ write (1, msg, strlen (msg));
+
+ for (;;);
+}
+
+int
+main (void)
+{
+ alarm (60);
+ nice (100);
+
+ func ();
+
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.base/gstack.exp b/gdb/testsuite/gdb.base/gstack.exp
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/gstack.exp
@@ -0,0 +1,84 @@
+# Copyright (C) 2012 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+set testfile gstack
+set executable ${testfile}
+set binfile [standard_output_file $executable]
+if {[build_executable ${testfile} ${executable} "" {debug}] == -1} {
+ return -1
+}
+
+set test "spawn inferior"
+set command "${binfile}"
+set res [remote_spawn host $command];
+if { $res < 0 || $res == "" } {
+ perror "Spawning $command failed."
+ fail $test
+ return
+}
+
+# The spawn id of the test inferior.
+set test_spawn_id $res
+
+set use_gdb_stub 1
+set pid [exp_pid -i $res]
+gdb_expect {
+ -re "looping\r\n" {
+ pass $test
+ }
+ eof {
+ fail "$test (eof)"
+ return
+ }
+ timeout {
+ fail "$test (timeout)"
+ return
+ }
+}
+
+# Testcase uses the most simple notification not to get caught by attach on
+# exiting the function. Still we could retry the gstack command if we fail.
+
+set test "spawn gstack"
+set command "sh -c GDB=$GDB\\ GDBARGS=-data-directory\\\\\\ $BUILD_DATA_DIRECTORY\\ sh\\ ${srcdir}/../gstack.sh\\ $pid\\;echo\\ GSTACK-END"
+set res [remote_spawn host $command];
+if { $res < 0 || $res == "" } {
+ perror "Spawning $command failed."
+ fail $test
+}
+
+set gdb_spawn_id $res
+
+gdb_test_multiple "" $test {
+ -re "^#0 +(0x\[0-9a-f\]+ in )?\\.?func \\(\\) at \[^\r\n\]*\r\n#1 +0x\[0-9a-f\]+ in \\.?main \\(\\) at \[^\r\n\]*\r\nGSTACK-END\r\n\$" {
+ pass $test
+ }
+}
+
+gdb_test_multiple "" "gstack exits" {
+ eof {
+ set result [wait -i $gdb_spawn_id]
+ verbose $result
+
+ gdb_assert { [lindex $result 2] == 0 } "gstack exits with no error"
+ gdb_assert { [lindex $result 3] == 0 } "gstack's exit status is 0"
+
+ remote_close host
+ clear_gdb_spawn_id
+ }
+}
+
+# Kill the test inferior.
+kill_wait_spawned_process $test_spawn_id

View File

@ -0,0 +1,34 @@
Index: gdb-6.3/gdb/gstack.sh
===================================================================
--- gdb-6.3.orig/gdb/gstack.sh 2006-02-14 17:21:05.000000000 -0200
+++ gdb-6.3/gdb/gstack.sh 2006-04-14 03:17:12.000000000 -0300
@@ -17,17 +17,17 @@ fi
backtrace="bt"
if test -d /proc/$1/task ; then
# Newer kernel; has a task/ directory.
- if test `ls /proc/$1/task | wc -l` -gt 1 2>/dev/null ; then
+ if test `/bin/ls /proc/$1/task | /usr/bin/wc -l` -gt 1 2>/dev/null ; then
backtrace="thread apply all bt"
fi
elif test -f /proc/$1/maps ; then
# Older kernel; go by it loading libpthread.
- if grep -e libpthread /proc/$1/maps > /dev/null 2>&1 ; then
+ if /bin/grep -e libpthread /proc/$1/maps > /dev/null 2>&1 ; then
backtrace="thread apply all bt"
fi
fi
-GDB=${GDB:-gdb}
+GDB=${GDB:-/usr/bin/gdb}
if $GDB -nx --quiet --batch --readnever > /dev/null 2>&1; then
readnever=--readnever
@@ -39,7 +39,7 @@ fi
$GDB --quiet $readnever -nx /proc/$1/exe $1 <<EOF 2>&1 |
$backtrace
EOF
-sed -n \
+/bin/sed -n \
-e 's/^(gdb) //' \
-e '/^#/p' \
-e '/^Thread/p'

View File

@ -0,0 +1,33 @@
Index: gdb-6.3/gdb/linux-nat.c
===================================================================
--- gdb-6.3.orig/gdb/linux-nat.c 2006-06-15 07:27:02.000000000 -0300
+++ gdb-6.3/gdb/linux-nat.c 2006-06-15 07:27:06.000000000 -0300
@@ -157,12 +157,28 @@ static int
my_waitpid (int pid, int *status, int flags)
{
int ret;
+ int old_status = status ? *status : 0;
+
do
{
ret = waitpid (pid, status, flags);
}
while (ret == -1 && errno == EINTR);
+ if (ret == 0 && status != 0)
+ {
+ /* waitpid() running within ia32el (on multi-threaded processes
+ only?) modifies status even when it returns zero, and this
+ breaks the assumption in linux_nat_wait(), and perhaps
+ elsewhere, that it remains unchanged in this case. We
+ restore the old value before returning zero, such that the
+ assumption holds. */
+ if (*status != 0 && *status != old_status)
+ warning ("waitpid: non-zero status %x for zero return value",
+ *status);
+ *status = old_status;
+ }
+
return ret;
}

View File

@ -0,0 +1,28 @@
2005-01-25 Jeff Johnston <jjohnstn@redhat.com>
* ia64-tdep.c (getunwind_table): Call the low-level xfer
unwind table syscall to support backtracing from syscalls in
a corefile.
Index: gdb-6.5/gdb/ia64-tdep.c
===================================================================
--- gdb-6.5.orig/gdb/ia64-tdep.c 2006-04-18 16:20:06.000000000 -0300
+++ gdb-6.5/gdb/ia64-tdep.c 2006-07-07 02:18:40.000000000 -0300
@@ -2470,8 +2470,17 @@ getunwind_table (void *buf, size_t len)
we want to preserve fall back to the running kernel's table, then
we should find a way to override the corefile layer's
xfer_partial method. */
+#if 0
x = target_read_partial (&current_target, TARGET_OBJECT_UNWIND_TABLE, NULL,
buf, 0, len);
+#endif
+ /* FIXME: This is a temporary solution to backtracing syscalls in corefiles.
+ To do this properly, the AUXV section should be used. This
+ fix will work as long as the kernel used to generate the corefile
+ is equivalent to the kernel used to debug the corefile. */
+ x = ia64_linux_xfer_unwind_table (&current_target,
+ TARGET_OBJECT_UNWIND_TABLE, NULL,
+ buf, NULL, 0, len);
return (int)x;
}

View File

@ -0,0 +1,19 @@
Index: gdb-6.6/gdb/gcore.c
===================================================================
--- gdb-6.6.orig/gdb/gcore.c
+++ gdb-6.6/gdb/gcore.c
@@ -475,8 +475,13 @@ gcore_copy_callback (bfd *obfd, asection
if (size > total_size)
size = total_size;
+ /* Warn if read error occurs except if we were trying to read the
+ first page for ia64. The first page is marked readable, but it cannot
+ be read. */
if (target_read_memory (bfd_section_vma (obfd, osec) + offset,
- memhunk, size) != 0)
+ memhunk, size) != 0
+ && (strcmp (TARGET_ARCHITECTURE->arch_name, "ia64")
+ || bfd_section_vma (obfd, osec) != 0))
{
warning (_("Memory read failed for corefile section, %s bytes at 0x%s."),
paddr_d (size), paddr (bfd_section_vma (obfd, osec)));

View File

@ -0,0 +1,133 @@
2005-07-14 Jeff Johnsotn <jjohnstn@redhat.com>
* linux-nat.c (linux_nat_xfer_memory): Incorporate Fujitsu
work-around to use /proc/mem for storage, but to fall-back
to PTRACE for ia64 rse register areas.
* ia64-linux-nat.c (ia64_rse_slot_num): New static function.
(ia64_rse_skip_regs): Ditto.
(ia64_linux_check_stack_region): New function.
Index: gdb-6.5/gdb/linux-nat.c
===================================================================
--- gdb-6.5.orig/gdb/linux-nat.c 2006-07-07 02:29:12.000000000 -0300
+++ gdb-6.5/gdb/linux-nat.c 2006-07-07 03:03:55.000000000 -0300
@@ -2473,7 +2473,9 @@ linux_nat_xfer_partial (struct target_op
do_cleanups (old_chain);
return xfer;
}
-
+#ifdef NATIVE_XFER_UNWIND_TABLE
+extern int ia64_linux_check_stack_region(struct lwp_info *lwp, void *range);
+#endif
static int
linux_nat_thread_alive (ptid_t ptid)
{
@@ -3214,15 +3216,34 @@ linux_xfer_partial (struct target_ops *o
return procfs_xfer_auxv (ops, object, annex, readbuf, writebuf,
offset, len);
-#ifndef NATIVE_XFER_UNWIND_TABLE
- /* FIXME: For ia64, we cannot currently use linux_proc_xfer_memory
- for accessing thread storage. Revert when Bugzilla 147436
- is fixed. */
xfer = linux_proc_xfer_partial (ops, object, annex, readbuf, writebuf,
offset, len);
if (xfer != 0)
- return xfer;
+ {
+#ifdef NATIVE_XFER_UNWIND_TABLE
+ struct mem_region range;
+ range.lo = memaddr;
+ range.hi = memaddr + len;
+
+ /* FIXME: For ia64, we cannot currently use
+ linux_proc_xfer_partial for accessing rse register storage.
+ Revert when Bugzilla 147436 is fixed. */
+ if (iterate_over_lwps (ia64_linux_check_stack_region, &range) != NULL)
+ { /* This region contains ia64 rse registers, we have to re-read. */
+ int xxfer;
+
+ /* Re-read register stack area. */
+ xxfer = super_xfer_partial (ops, object, annex,
+ readbuf + (range.lo - memaddr),
+ writebuf + (range.lo - memaddr),
+ offset + (range.lo - memaddr),
+ range.hi - range.lo);
+ if (xxfer == 0)
+ xfer = 0;
+ }
#endif
+ return xfer;
+ }
return super_xfer_partial (ops, object, annex, readbuf, writebuf,
offset, len);
Index: gdb-6.5/gdb/ia64-linux-nat.c
===================================================================
--- gdb-6.5.orig/gdb/ia64-linux-nat.c 2006-03-24 20:08:16.000000000 -0300
+++ gdb-6.5/gdb/ia64-linux-nat.c 2006-07-07 02:52:25.000000000 -0300
@@ -687,6 +687,64 @@ ia64_linux_xfer_partial (struct target_o
void _initialize_ia64_linux_nat (void);
+/*
+ * Note: taken from ia64_tdep.c
+ *
+ */
+
+static __inline__ unsigned long
+ia64_rse_slot_num (unsigned long addr)
+{
+ return (addr >> 3) & 0x3f;
+}
+
+/* Skip over a designated number of registers in the backing
+ store, remembering every 64th position is for NAT. */
+static __inline__ unsigned long
+ia64_rse_skip_regs (unsigned long addr, long num_regs)
+{
+ long delta = ia64_rse_slot_num(addr) + num_regs;
+
+ if (num_regs < 0)
+ delta -= 0x3e;
+ return addr + ((num_regs + delta/0x3f) << 3);
+}
+
+/*
+ * Check mem_region is stack or not. If stack, /proc/<pid>/mem cannot return
+ * expected value.
+ */
+int ia64_linux_check_stack_region(struct lwp_info *ti, struct mem_region *range)
+{
+ CORE_ADDR addr;
+ int error;
+ unsigned long bsp, cfm, bspstore;
+ long sof;
+ pid_t pid = ptid_get_lwp(ti->ptid);
+ bsp = ptrace(PTRACE_PEEKUSER, pid, PT_AR_BSP ,NULL);
+ if (bsp == (unsigned long)-1) {
+ return 1;
+ }
+ /* stack is allocated by one-segment, not separated into several segments.
+ So, we only have to check whether bsp is in *range* or not. */
+ if((range->lo <= bsp) && (bsp <= range->hi)) {
+ bspstore = ptrace(PTRACE_PEEKUSER, pid, PT_AR_BSPSTORE, NULL);
+ cfm = ptrace(PTRACE_PEEKUSER, pid, PT_CFM, NULL);
+ sof = cfm & 0x3f;
+ bsp = ia64_rse_skip_regs(bsp, -sof);
+ range->lo = bspstore;
+ range->hi = bsp;
+ /* we have to check the size of dirty register stack area */
+ /*
+ fprintf_unfiltered(gdb_stdlog, "<%d> <%p> <%lx> <%p> <%p>\n",
+ pid, bsp, sof, range->lo, range->hi);
+ */
+ return 1;
+ }
+
+ return 0;
+}
+
void
_initialize_ia64_linux_nat (void)
{

View File

@ -0,0 +1,120 @@
2005-07-25 Jeff Johnstno <jjohnstn@redhat.com>
* libunwind-frame.c (libunwind_frame_prev_register): Check valuep
is not NULL before copying cursor address into it.
testsuite:
2005-07-25 Jeff Johnstno <jjohnstn@redhat.com>
* gdb.arch/ia64-sigtramp.exp: New test.
* gdb.arch/ia64-sigtramp.c: Ditto.
--- gdb-6.3/gdb/testsuite/gdb.arch/ia64-sigtramp.c.fix 2005-07-25 16:42:46.000000000 -0400
+++ gdb-6.3/gdb/testsuite/gdb.arch/ia64-sigtramp.c 2005-07-25 16:42:08.000000000 -0400
@@ -0,0 +1,23 @@
+#include <stdio.h>
+#include <signal.h>
+
+int *l;
+
+void x (int sig)
+{
+ printf ("in signal handler for signal %d\n", sig);
+}
+
+int main()
+{
+ int k;
+
+ signal (SIGSEGV, &x);
+
+ k = *l;
+
+ printf ("k is %d\n", k);
+
+ return 0;
+}
+
--- gdb-6.3/gdb/testsuite/gdb.arch/ia64-sigtramp.exp.fix 2005-07-25 16:42:50.000000000 -0400
+++ gdb-6.3/gdb/testsuite/gdb.arch/ia64-sigtramp.exp 2005-07-25 16:42:01.000000000 -0400
@@ -0,0 +1,66 @@
+# Copyright 2005 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 Jeff Johnston (jjohnstn@redhat.com)
+
+if $tracelevel then {
+ strace $tracelevel
+}
+
+#
+# test running programs
+#
+set prms_id 0
+set bug_id 0
+
+if ![istarget "ia64-*-*"] then {
+ return
+}
+
+set testfile "ia64-sigtramp"
+set srcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-w}] != "" } {
+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+}
+
+if [get_compiler_info ${binfile}] {
+ return -1
+}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+if ![runto_main] then {
+ fail "Can't run to main"
+ return 0
+}
+
+gdb_test "handle SIGSEGV" "SIGSEGV.*Yes.*Yes.*Yes.*Segmentation fault"
+gdb_test "next" "" "first next"
+gdb_test "next" "Program received signal SIGSEGV.*" "getting SIGSEGV"
+gdb_breakpoint "x"
+gdb_test "continue" "Breakpoint.*x.*" "continue to x"
+
+gdb_test "f 1" ".*signal handler called.*" "frame 1"
+gdb_test "info frame" "Stack level 1.*p63 at .*" "info sigtramp frame"
+
--- gdb-6.3/gdb/libunwind-frame.c.fix 2005-07-25 16:41:30.000000000 -0400
+++ gdb-6.3/gdb/libunwind-frame.c 2005-07-25 16:46:23.000000000 -0400
@@ -303,8 +303,9 @@ libunwind_frame_prev_register (struct fr
modification to support unwinding through a sigaltstack. */
if (uw_regnum == INT_MAX)
{
- store_unsigned_integer (valuep, sizeof (CORE_ADDR),
- (CORE_ADDR)&cache->cursor);
+ if (valuep)
+ store_unsigned_integer (valuep, sizeof (CORE_ADDR),
+ (CORE_ADDR)&cache->cursor);
return;
}

View File

@ -0,0 +1,193 @@
2005-07-11 Jeff Johnston <jjohnstn@redhat.com>
* ia64-tdep.c (pseudo_regs): Add CURSOR_ADDR_REGNUM.
(ia64_register_names): Add empty string for CURSOR_ADDR_REGNUM.
(ia64_frame_prev_register): Default a request for CURSOR_ADDR_REGNUM
to return 0.
(ia64_sigtramp_frame_prev_register): Ditto.
(ia64_gdb2uw_regnum): Map CURSOR_ADDR_REGNUM to INT_MAX so
it won't clash with any legitimate UNW register number.
(ia64_unwind_cursor): New callback.
(ia64_libunwind_descr): Add new ia64_unwind_cursor callback.
* libunwind-frame.h (struct libunwind_descr): Add new slot
for unwind cursor callback.
* libunwind-frame.c (libunwind_frame_cache): Attempt to copy
and step previous cursor if possible, otherwise, create new
cursor.
(libunwind_frame_prev_register): Support request for
getting the cursor address.
--- gdb-6.3/gdb/ia64-tdep.c.fix 2005-07-11 18:13:42.000000000 -0400
+++ gdb-6.3/gdb/ia64-tdep.c 2005-07-11 18:15:52.000000000 -0400
@@ -141,7 +141,7 @@ static int lr_regnum = IA64_VRAP_REGNUM;
they may not be accessible via the ptrace register get/set interfaces. */
enum pseudo_regs { FIRST_PSEUDO_REGNUM = NUM_IA64_RAW_REGS, VBOF_REGNUM = IA64_NAT127_REGNUM + 1, V32_REGNUM,
V127_REGNUM = V32_REGNUM + 95,
- VP0_REGNUM, VP16_REGNUM = VP0_REGNUM + 16, VP63_REGNUM = VP0_REGNUM + 63, LAST_PSEUDO_REGNUM };
+ VP0_REGNUM, VP16_REGNUM = VP0_REGNUM + 16, VP63_REGNUM = VP0_REGNUM + 63, CURSOR_ADDR_REGNUM, LAST_PSEUDO_REGNUM };
/* Array of register names; There should be ia64_num_regs strings in
the initializer. */
@@ -253,6 +253,7 @@ static char *ia64_register_names[] =
"p40", "p41", "p42", "p43", "p44", "p45", "p46", "p47",
"p48", "p49", "p50", "p51", "p52", "p53", "p54", "p55",
"p56", "p57", "p58", "p59", "p60", "p61", "p62", "p63",
+ ""
};
struct ia64_frame_cache
@@ -1855,6 +1856,12 @@ ia64_frame_prev_register (struct frame_i
read_memory (addr, valuep, register_size (current_gdbarch, regnum));
}
}
+ else if (regnum == CURSOR_ADDR_REGNUM)
+ {
+ /* The cursor is the address of the ia64 libunwind cursor.
+ Default to 0. */
+ *lvalp = lval_memory;
+ }
else
{
CORE_ADDR addr = 0;
@@ -2177,6 +2184,12 @@ ia64_sigtramp_frame_prev_register (struc
*addrp = pr_addr;
}
}
+ else if (regnum == CURSOR_ADDR_REGNUM)
+ {
+ /* The cursor is the address of the ia64 libunwind cursor.
+ Default to 0. */
+ *lvalp = lval_memory;
+ }
else
{
/* All other registers not listed above. */
@@ -2296,6 +2309,8 @@ ia64_gdb2uw_regnum (int regnum)
return UNW_IA64_AR + (regnum - IA64_AR0_REGNUM);
else if ((unsigned) (regnum - IA64_NAT0_REGNUM) < 128)
return UNW_IA64_NAT + (regnum - IA64_NAT0_REGNUM);
+ else if (regnum == CURSOR_ADDR_REGNUM)
+ return INT_MAX;
else
return -1;
}
@@ -2331,6 +2346,21 @@ ia64_uw2gdb_regnum (int uw_regnum)
return -1;
}
+/* Special callback function to allow libunwind-frame to get
+ the address of the next frame's cursor so it may be copied and
+ stepped. */
+static unw_cursor_t *
+ia64_unwind_cursor (struct frame_info *next_frame)
+{
+ unw_cursor_t *cursor_addr;
+ char buf[8];
+
+ frame_unwind_register (next_frame, CURSOR_ADDR_REGNUM, buf);
+ cursor_addr = (unw_cursor_t *)extract_unsigned_integer (buf, 8);
+
+ return cursor_addr;
+}
+
/* Gdb libunwind-frame callback function to reveal if register is a float
register or not. */
static int
@@ -3111,6 +3141,7 @@ static struct libunwind_descr ia64_libun
ia64_gdb2uw_regnum,
ia64_uw2gdb_regnum,
ia64_is_fpreg,
+ ia64_unwind_cursor,
&ia64_unw_accessors,
&ia64_unw_rse_accessors,
};
--- gdb-6.3/gdb/libunwind-frame.c.fix 2005-07-11 18:17:05.000000000 -0400
+++ gdb-6.3/gdb/libunwind-frame.c 2005-07-11 18:20:31.000000000 -0400
@@ -122,6 +122,7 @@ libunwind_frame_set_descr (struct gdbarc
arch_descr->is_fpreg = descr->is_fpreg;
arch_descr->accessors = descr->accessors;
arch_descr->special_accessors = descr->special_accessors;
+ arch_descr->unwind_cursor = descr->unwind_cursor;
}
static struct libunwind_frame_cache *
@@ -129,6 +130,7 @@ libunwind_frame_cache (struct frame_info
{
unw_accessors_t *acc;
unw_addr_space_t as;
+ unw_cursor_t *cursor_addr;
unw_word_t fp;
unw_regnum_t uw_sp_regnum;
struct libunwind_frame_cache *cache;
@@ -147,22 +149,33 @@ libunwind_frame_cache (struct frame_info
&& get_frame_type (next_frame) != SIGTRAMP_FRAME)
return NULL;
- /* Get a libunwind cursor to the previous frame. We do this by initializing
- a cursor. Libunwind treats a new cursor as the top of stack and will get
- the current register set via the libunwind register accessor. Now, we
- provide the platform-specific accessors and we set up the register accessor to use
- the frame register unwinding interfaces so that we properly get the registers for
- the current frame rather than the top. We then use the unw_step function to
- move the libunwind cursor back one frame. We can later use this cursor to find previous
- registers via the unw_get_reg interface which will invoke libunwind's special logic. */
+ /* Get a libunwind cursor to the previous frame. We do this by getting
+ the address of the next frame's cursor (if one exists). If we are at
+ the top of stack, then we will get back a zero cursor address and we
+ should initialize a new cursor.
+
+ Otherwise, we copy the cursor address contents and step back by one.
+ Libunwind will use our register accessors which are set up to
+ unwind registers from the previous frame. We will later use this cursor
+ to find previous registers via the unw_get_reg interface. By passing
+ back a cursor, we allow libunwind to handle sigaltstack which requires
+ one cursor stepped back for all frames. */
descr = libunwind_descr (get_frame_arch (next_frame));
- acc = descr->accessors;
- as = unw_create_addr_space_p (acc,
+ cursor_addr = descr->unwind_cursor (next_frame);
+
+ if (cursor_addr == 0)
+ {
+ acc = descr->accessors;
+ as = unw_create_addr_space_p (acc,
TARGET_BYTE_ORDER == BFD_ENDIAN_BIG
? __BIG_ENDIAN
: __LITTLE_ENDIAN);
- unw_init_remote_p (&cache->cursor, as, next_frame);
+ unw_init_remote_p (&cache->cursor, as, next_frame);
+ }
+ else /* make copy */
+ cache->cursor = *cursor_addr;
+
if (unw_step_p (&cache->cursor) < 0)
return NULL;
@@ -285,6 +298,16 @@ libunwind_frame_prev_register (struct fr
if (uw_regnum < 0)
return;
+ /* Check if we are unwinding the cursor address which just gives
+ back the address of the next frame's cursor. This is a special
+ modification to support unwinding through a sigaltstack. */
+ if (uw_regnum == INT_MAX)
+ {
+ store_unsigned_integer (valuep, sizeof (CORE_ADDR),
+ (CORE_ADDR)&cache->cursor);
+ return;
+ }
+
/* To get the previous register, we use the libunwind register APIs with
the cursor we have already pushed back to the previous frame. */
--- gdb-6.3/gdb/libunwind-frame.h.fix 2005-07-11 18:17:24.000000000 -0400
+++ gdb-6.3/gdb/libunwind-frame.h 2005-07-11 18:18:46.000000000 -0400
@@ -37,6 +37,7 @@ struct libunwind_descr
int (*gdb2uw) (int);
int (*uw2gdb) (int);
int (*is_fpreg) (int);
+ unw_cursor_t *(*unwind_cursor) (struct frame_info *next_frame);
void *accessors;
void *special_accessors;
};

View File

@ -0,0 +1,116 @@
2005-11-15 Jeff Johnston <jjohnstn@redhat.com>
* linux-thread-db.c (thread_db_wait): Don't bother continuing if
the wait result indicates the program terminated with a signal.
* linux-nat.c (linux_nat_wait): For SIGILL and SIGTRAP, don't
throw away the event if the user has specified nostop noprint.
gdb/testsuite:
2005-11-15 Jeff Johnston <jjohnstn@redhat.com>
* gdb.arch/ia64-sigill.c: New test.
* gdb.arch/ia64-sigill.exp: Ditto.
Index: gdb-6.6/gdb/testsuite/gdb.arch/ia64-sigill.exp
===================================================================
--- /dev/null
+++ gdb-6.6/gdb/testsuite/gdb.arch/ia64-sigill.exp
@@ -0,0 +1,59 @@
+# Copyright 2005 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 Jeff Johnston (jjohnstn@redhat.com)
+
+if $tracelevel then {
+ strace $tracelevel
+}
+
+#
+# test running programs
+#
+set prms_id 0
+set bug_id 0
+
+if ![istarget "ia64-*-*"] then {
+ return
+}
+
+set testfile "ia64-sigill"
+set srcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}
+
+# Deliberately compile with pthreads, even though test is single-threaded.
+# We want to force gdb thread code to be exercised.
+if { [gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-w}] != "" } {
+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+}
+
+if [get_compiler_info ${binfile}] {
+ return -1
+}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+# We set up SIGILL nostop, noprint, pass and then run the program.
+# We expect to just see a normal run.
+gdb_test "handle SIGILL nostop noprint" "SIGILL.*No.*No.*Yes.*" "handle sigill"
+gdb_test "run" "Starting program.*ia64-sigill.*\[New thread.*\].*hello world.*Program exited normally." "run to exit"
+
Index: gdb-6.6/gdb/testsuite/gdb.arch/ia64-sigill.c
===================================================================
--- /dev/null
+++ gdb-6.6/gdb/testsuite/gdb.arch/ia64-sigill.c
@@ -0,0 +1,8 @@
+#include <stdio.h>
+
+int main()
+{
+ printf ("hello world\n");
+ return 0;
+}
+
Index: gdb-6.6/gdb/linux-nat.c
===================================================================
--- gdb-6.6.orig/gdb/linux-nat.c
+++ gdb-6.6/gdb/linux-nat.c
@@ -2241,7 +2241,8 @@ retry:
threads can be a bit time-consuming so if we want decent
performance with heavily multi-threaded programs, especially when
they're using a high frequency timer, we'd better avoid it if we
- can. */
+ can. For possible trap signals like SIGTRAP and SIGILL, don't
+ avoid reporting. */
if (WIFSTOPPED (status))
{
@@ -2252,7 +2253,9 @@ retry:
if (!lp->step
&& signal_stop_state (signo) == 0
&& signal_print_state (signo) == 0
- && signal_pass_state (signo) == 1)
+ && signal_pass_state (signo) == 1
+ && signo != TARGET_SIGNAL_ILL
+ && signo != TARGET_SIGNAL_TRAP)
{
/* FIMXE: kettenis/2001-06-06: Should we resume all threads
here? It is not clear we should. GDB may not expect

View File

@ -0,0 +1,151 @@
2005-09-27 Jeff Johnston <jjohnstn@redhat.com>
* libunwind-frame.c (libunwind_frame_cache): Save the current
stack pointer in the cache.
(libunwind_sigtramp_frame_this_id): New function.
(libunwind_sigtramp_frame_unwind): New unwinder.
(libunwind_sigtramp_frame_sniffer): Return
libunwind_sigtramp_frame_unwind address.
* libunwind-frame.h (libunwind_sigtramp_frame_this_id): New
prototype.
* ia64-tdep.c (ia64_libunwind_sigtramp_frame_this_id): Calculate
the base address using the current stack pointer plus a fixed
offset.
Index: gdb-6.5/gdb/libunwind-frame.c
===================================================================
--- gdb-6.5.orig/gdb/libunwind-frame.c 2006-07-07 03:04:32.000000000 -0300
+++ gdb-6.5/gdb/libunwind-frame.c 2006-07-07 03:07:33.000000000 -0300
@@ -62,6 +62,7 @@ static unw_word_t (*unw_find_dyn_list_p)
struct libunwind_frame_cache
{
CORE_ADDR base;
+ CORE_ADDR sp;
CORE_ADDR func_addr;
unw_cursor_t cursor;
};
@@ -131,7 +132,7 @@ libunwind_frame_cache (struct frame_info
unw_accessors_t *acc;
unw_addr_space_t as;
unw_cursor_t *cursor_addr;
- unw_word_t fp;
+ unw_word_t fp, sp;
unw_regnum_t uw_sp_regnum;
struct libunwind_frame_cache *cache;
struct libunwind_descr *descr;
@@ -176,15 +177,28 @@ libunwind_frame_cache (struct frame_info
else /* make copy */
cache->cursor = *cursor_addr;
+ /* For the base address, we have a small problem. The majority
+ of the time, we can get the stack pointer of the previous
+ frame to use as a frame pointer. In the case where we have
+ a signal trampoline, the stack may change due to a sigaltstack
+ being set up. In that case, the normal mechanism will give us
+ an address in the regular stack which is not at the end of the
+ sigaltstack as we want. To handle this, we record the stack
+ address so the caller may calculate a more correct base address
+ to use. */
+ uw_sp_regnum = descr->gdb2uw (SP_REGNUM);
+ ret = unw_get_reg_p (&cache->cursor, uw_sp_regnum, &sp);
+ if (ret < 0)
+ error ("Can't get libunwind sp register.");
+
if (unw_step_p (&cache->cursor) < 0)
return NULL;
- /* To get base address, get sp from previous frame. */
- uw_sp_regnum = descr->gdb2uw (SP_REGNUM);
ret = unw_get_reg_p (&cache->cursor, uw_sp_regnum, &fp);
if (ret < 0)
error (_("Can't get libunwind sp register."));
+ cache->sp = (CORE_ADDR)sp;
cache->base = (CORE_ADDR)fp;
*this_cache = cache;
@@ -371,6 +385,31 @@ libunwind_search_unwind_table (void *as,
di, pi, need_unwind_info, args);
}
+void
+libunwind_sigtramp_frame_this_id (struct frame_info *next_frame,
+ void **this_cache,
+ struct frame_id *this_id)
+{
+ struct libunwind_frame_cache *cache =
+ libunwind_frame_cache (next_frame, this_cache);
+
+ /* Unlike a regular frame, we can't use the normal frame pointer
+ mechanism because a sigaltstack may have been used. Instead,
+ we return the current stack pointer for the caller to use
+ to calculate the base address. */
+ if (cache != NULL)
+ (*this_id) = frame_id_build (cache->sp, cache->func_addr);
+ else
+ (*this_id) = null_frame_id;
+}
+
+static const struct frame_unwind libunwind_sigtramp_frame_unwind =
+{
+ SIGTRAMP_FRAME,
+ libunwind_sigtramp_frame_this_id,
+ libunwind_frame_prev_register
+};
+
/* Verify if we are in a sigtramp frame and we can use libunwind to unwind. */
const struct frame_unwind *
libunwind_sigtramp_frame_sniffer (struct frame_info *next_frame)
@@ -403,7 +442,7 @@ libunwind_sigtramp_frame_sniffer (struct
/* Check to see if we are in a signal frame. */
ret = unw_is_signal_frame_p (&cursor);
if (ret > 0)
- return &libunwind_frame_unwind;
+ return &libunwind_sigtramp_frame_unwind;
return NULL;
}
Index: gdb-6.5/gdb/libunwind-frame.h
===================================================================
--- gdb-6.5.orig/gdb/libunwind-frame.h 2006-07-07 02:51:32.000000000 -0300
+++ gdb-6.5/gdb/libunwind-frame.h 2006-07-07 03:05:49.000000000 -0300
@@ -49,6 +49,9 @@ void libunwind_frame_set_descr (struct g
void libunwind_frame_this_id (struct frame_info *next_frame, void **this_cache,
struct frame_id *this_id);
+void libunwind_sigtramp_frame_this_id (struct frame_info *next_frame,
+ void **this_cache,
+ struct frame_id *this_id);
void libunwind_frame_prev_register (struct frame_info *next_frame, void **this_cache,
int regnum, int *optimizedp,
enum lval_type *lvalp, CORE_ADDR *addrp,
Index: gdb-6.5/gdb/ia64-tdep.c
===================================================================
--- gdb-6.5.orig/gdb/ia64-tdep.c 2006-07-07 02:51:32.000000000 -0300
+++ gdb-6.5/gdb/ia64-tdep.c 2006-07-07 03:05:49.000000000 -0300
@@ -3031,7 +3031,7 @@ ia64_libunwind_sigtramp_frame_this_id (s
struct frame_id id;
CORE_ADDR prev_ip;
- libunwind_frame_this_id (next_frame, this_cache, &id);
+ libunwind_sigtramp_frame_this_id (next_frame, this_cache, &id);
if (frame_id_eq (id, null_frame_id))
{
(*this_id) = null_frame_id;
@@ -3043,8 +3043,14 @@ ia64_libunwind_sigtramp_frame_this_id (s
frame_unwind_register (next_frame, IA64_BSP_REGNUM, buf);
bsp = extract_unsigned_integer (buf, 8);
- /* For a sigtramp frame, we don't make the check for previous ip being 0. */
- (*this_id) = frame_id_build_special (id.stack_addr, id.code_addr, bsp);
+ /* For a sigtramp frame, we don't make the check for previous ip being 0.
+ We also must calculate the frame pointer because libunwind will give
+ us back the current stack pointer instead of the frame pointer since
+ it cannot figure this out when in a sigaltstack. We make a basic
+ assumption of 16 (default size) + 8 bytes for sigcontext address.
+ FIXME: if libunwind were to export the frame pointer address, we
+ could eliminate the assumption and get the actual value. */
+ (*this_id) = frame_id_build_special (id.stack_addr + 24, id.code_addr, bsp);
if (gdbarch_debug >= 1)
fprintf_unfiltered (gdb_stdlog,

View File

@ -0,0 +1,149 @@
2005-07-08 Jeff Johnston <jjohnstn@redhat.com>
* ia64-tdep.c (ia64_sigtramp_frame_prev_register): Build
pseudo-registers the same as ia64_pseudo_register_read.
--- gdb-6.3/gdb/ia64-tdep.c.fix 2005-07-08 20:26:37.000000000 -0400
+++ gdb-6.3/gdb/ia64-tdep.c 2005-07-08 20:27:41.000000000 -0400
@@ -2037,7 +2037,100 @@ ia64_sigtramp_frame_prev_register (struc
pc &= ~0xf;
store_unsigned_integer (valuep, 8, pc);
}
- else if ((regnum >= IA64_GR32_REGNUM && regnum <= IA64_GR127_REGNUM) ||
+ else if (IA64_NAT0_REGNUM <= regnum && regnum <= IA64_NAT31_REGNUM)
+ {
+ /* NAT pseudo registers 0-31: get them from UNAT.
+ * "copied" from ia64_pseudo_register_read() */
+ CORE_ADDR addr = 0;
+ ULONGEST unatN_val;
+ ULONGEST unat;
+ read_memory (cache->saved_regs[IA64_UNAT_REGNUM], (char *) &unat,
+ register_size (current_gdbarch, IA64_UNAT_REGNUM));
+ unatN_val = (unat & (1LL << (regnum - IA64_NAT0_REGNUM))) != 0;
+ store_unsigned_integer (valuep, register_size (current_gdbarch, regnum),
+ unatN_val);
+ *lvalp = lval_memory;
+ *addrp = cache->saved_regs[IA64_UNAT_REGNUM];
+ }
+ else if (IA64_NAT32_REGNUM <= regnum && regnum <= IA64_NAT127_REGNUM)
+ {
+ /* NAT pseudo registers 32-127.
+ * "copied" from ia64_pseudo_register_read()
+ * FIXME: Not currently tested -- cannot get the frame to include
+ * NAT32-NAT127. */
+ ULONGEST bsp;
+ ULONGEST cfm;
+ ULONGEST natN_val = 0;
+ CORE_ADDR gr_addr = 0, nat_addr = 0;
+
+ read_memory (cache->saved_regs[IA64_BSP_REGNUM], (char *) &bsp,
+ register_size (current_gdbarch, IA64_BSP_REGNUM));
+ read_memory (cache->saved_regs[IA64_CFM_REGNUM], (char *) &cfm,
+ register_size (current_gdbarch, IA64_CFM_REGNUM));
+
+ /* The bsp points at the end of the register frame so we
+ subtract the size of frame from it to get start of register frame. */
+ bsp = rse_address_add (bsp, -(cfm & 0x7f));
+
+ if ((cfm & 0x7f) > regnum - V32_REGNUM)
+ gr_addr = rse_address_add (bsp, (regnum - V32_REGNUM));
+
+ if (gr_addr != 0)
+ {
+ /* Compute address of nat collection bits */
+ CORE_ADDR nat_collection;
+ nat_addr = gr_addr | 0x1f8;
+ int nat_bit;
+ /* If our nat collection address is bigger than bsp, we have to get
+ the nat collection from rnat. Otherwise, we fetch the nat
+ collection from the computed address. FIXME: Do not know if
+ RNAT can be not stored in the frame--being extra cautious. */
+ if (nat_addr >= bsp)
+ {
+ nat_addr = cache->saved_regs[IA64_RNAT_REGNUM];
+ if (nat_addr != 0)
+ read_memory (nat_addr, (char *) &nat_collection,
+ register_size (current_gdbarch, IA64_RNAT_REGNUM));
+ }
+ else
+ nat_collection = read_memory_integer (nat_addr, 8);
+ if (nat_addr != 0)
+ {
+ nat_bit = (gr_addr >> 3) & 0x3f;
+ natN_val = (nat_collection >> nat_bit) & 1;
+ *lvalp = lval_memory;
+ *addrp = nat_addr;
+ store_unsigned_integer (valuep,
+ register_size (current_gdbarch, regnum),
+ natN_val);
+ }
+ }
+ }
+ else if (regnum == VBOF_REGNUM)
+ {
+ /* BOF pseudo register.
+ * "copied" from ia64_pseudo_register_read()
+ *
+ * A virtual register frame start is provided for user convenience.
+ * It can be calculated as the bsp - sof (sizeof frame). */
+ ULONGEST bsp;
+ ULONGEST cfm;
+ ULONGEST bof;
+
+ read_memory (cache->saved_regs[IA64_BSP_REGNUM], (char *) &bsp,
+ register_size (current_gdbarch, IA64_BSP_REGNUM));
+ read_memory (cache->saved_regs[IA64_CFM_REGNUM], (char *) &cfm,
+ register_size (current_gdbarch, IA64_CFM_REGNUM));
+
+ /* The bsp points at the end of the register frame so we
+ subtract the size of frame from it to get beginning of frame. */
+ bof = rse_address_add (bsp, -(cfm & 0x7f));
+
+ store_unsigned_integer (valuep, register_size (current_gdbarch, regnum), bof);
+ *lvalp = lval_memory;
+ *addrp = 0; // NOTE: pseudo reg not a anywhere really...
+ }
+ else if ((regnum >= IA64_GR32_REGNUM && regnum <= IA64_GR127_REGNUM) ||
(regnum >= V32_REGNUM && regnum <= V127_REGNUM))
{
CORE_ADDR addr = 0;
@@ -2051,6 +2144,39 @@ ia64_sigtramp_frame_prev_register (struc
read_memory (addr, valuep, register_size (current_gdbarch, regnum));
}
}
+ else if (VP0_REGNUM <= regnum && regnum <= VP63_REGNUM)
+ {
+ /* VP 0-63.
+ * "copied" from ia64_pseudo_register_read()
+ *
+ * FIXME: Not currently tested--cannot get the frame to include PR. */
+ CORE_ADDR pr_addr = 0;
+
+ pr_addr = cache->saved_regs[IA64_PR_REGNUM];
+ if (pr_addr != 0)
+ {
+ ULONGEST pr;
+ ULONGEST cfm;
+ ULONGEST prN_val;
+ read_memory (pr_addr, (char *) &pr,
+ register_size (current_gdbarch, IA64_PR_REGNUM));
+ read_memory (cache->saved_regs[IA64_CFM_REGNUM], (char *) &cfm,
+ register_size (current_gdbarch, IA64_CFM_REGNUM));
+
+ /* Get the register rename base for this frame and adjust the
+ * register name to take rotation into account. */
+ if (VP16_REGNUM <= regnum && regnum <= VP63_REGNUM)
+ {
+ int rrb_pr = (cfm >> 32) & 0x3f;
+ regnum = VP16_REGNUM + ((regnum - VP16_REGNUM) + rrb_pr) % 48;
+ }
+ prN_val = (pr & (1LL << (regnum - VP0_REGNUM))) != 0;
+ store_unsigned_integer (valuep, register_size (current_gdbarch, regnum),
+ prN_val);
+ *lvalp = lval_memory;
+ *addrp = pr_addr;
+ }
+ }
else
{
/* All other registers not listed above. */

View File

@ -0,0 +1,19 @@
2005-03-30 Jeff Johnston <jjohnstn@redhat.com>
* bfd/elfcode.h: Change code to allow for idiosyncrasies of
ia64 vsyscall page.
Index: gdb-6.5/bfd/elfcode.h
===================================================================
--- gdb-6.5.orig/bfd/elfcode.h 2006-05-11 05:57:08.000000000 -0300
+++ gdb-6.5/bfd/elfcode.h 2006-07-07 02:36:03.000000000 -0300
@@ -1625,7 +1625,8 @@ NAME(_bfd_elf,bfd_from_remote_memory)
if (segment_end > (bfd_vma) contents_size)
contents_size = segment_end;
- if ((i_phdrs[i].p_offset & -i_phdrs[i].p_align) == 0)
+ if ((i_phdrs[i].p_offset & -i_phdrs[i].p_align) == 0
+ && loadbase == ehdr_vma)
loadbase = ehdr_vma - (i_phdrs[i].p_vaddr & -i_phdrs[i].p_align);
last_phdr = &i_phdrs[i];

View File

@ -1,11 +1,3 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Jeff Johnston <jjohnstn@redhat.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-6.3-inferior-notification-20050721.patch
;; Notify observers that the inferior has been created
;;=fedoratest
2005-07-21 Jeff Johnston <jjohnstn@redhat.com>
* gdb.base/attach-32.exp: New test for attaching in 32-bit
@ -17,10 +9,8 @@ Subject: gdb-6.3-inferior-notification-20050721.patch
* gdb.base/attach-32.exp: Fix forgotten $GDBFLAGS as set.
diff --git a/gdb/testsuite/gdb.base/attach-32.c b/gdb/testsuite/gdb.base/attach-32.c
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/attach-32.c
--- gdb-6.3/gdb/testsuite/gdb.base/attach-32.c.fix3 2005-07-21 14:23:50.000000000 -0400
+++ gdb-6.3/gdb/testsuite/gdb.base/attach-32.c 2005-07-21 14:05:56.000000000 -0400
@@ -0,0 +1,20 @@
+/* This program is intended to be started outside of gdb, and then
+ attached to by gdb. Thus, it simply spins in a loop. The loop
@ -42,11 +32,9 @@ new file mode 100644
+ }
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.base/attach-32.exp b/gdb/testsuite/gdb.base/attach-32.exp
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/attach-32.exp
@@ -0,0 +1,245 @@
--- gdb-6.3/gdb/testsuite/gdb.base/attach-32.exp.fix3 2005-07-21 14:23:45.000000000 -0400
+++ gdb-6.3/gdb/testsuite/gdb.base/attach-32.exp 2005-07-21 17:58:28.000000000 -0400
@@ -0,0 +1,252 @@
+# Copyright 2005 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
@ -65,6 +53,13 @@ new file mode 100644
+#
+# This test was based on attach.exp and modified for 32/64 bit Linux systems. */
+
+if $tracelevel then {
+ strace $tracelevel
+}
+
+set prms_id 0
+set bug_id 0
+
+# On HP-UX 11.0, this test is causing a process running the program
+# "attach" to be left around spinning. Until we figure out why, I am
+# commenting out the test to avoid polluting tiamat (our 11.0 nightly
@ -85,9 +80,9 @@ new file mode 100644
+set testfile "attach-32"
+set srcfile ${testfile}.c
+set srcfile2 ${testfile}b.c
+set binfile [standard_output_file ${testfile}]
+set binfile2 [standard_output_file ${testfile}b]
+set escapedbinfile [string_to_regexp [standard_output_file ${testfile}]]
+set binfile ${objdir}/${subdir}/${testfile}
+set binfile2 ${objdir}/${subdir}/${testfile}b
+set escapedbinfile [string_to_regexp ${objdir}/${subdir}/${testfile}]
+
+#execute_anywhere "rm -f ${binfile} ${binfile2}"
+remote_exec build "rm -f ${binfile} ${binfile2}"
@ -136,7 +131,7 @@ new file mode 100644
+
+ send_gdb "tbreak 19\n"
+ gdb_expect {
+ -re "reakpoint .*at.*$srcfile, line 19.*$gdb_prompt $" {
+ -re "Breakpoint .*at.*$srcfile, line 19.*$gdb_prompt $" {
+ pass "after attach-32, set tbreak postloop"
+ }
+ -re "$gdb_prompt $" {
@ -161,7 +156,7 @@ new file mode 100644
+
+ # Allow the test process to exit, to cleanup after ourselves.
+
+ gdb_test "continue" {\[Inferior .* exited normally\]} "after attach-32, exit"
+ gdb_test "continue" "Program exited normally." "after attach-32, exit"
+
+ # Make sure we don't leave a process around to confuse
+ # the next test run (and prevent the compile by keeping
@ -242,7 +237,7 @@ new file mode 100644
+ # Get rid of the process
+
+ gdb_test "p should_exit = 1"
+ gdb_test "c" {\[Inferior .* exited normally\]}
+ gdb_test "c" "Program exited normally."
+
+ # Be paranoid
+
@ -262,7 +257,7 @@ new file mode 100644
+}
+
+set GDBFLAGS_orig $GDBFLAGS
+set GDBFLAGS "-iex \"set height 0\" --pid=$testpid"
+set GDBFLAGS "--pid=$testpid"
+gdb_start
+set GDBFLAGS $GDBFLAGS_orig
+
@ -284,7 +279,7 @@ new file mode 100644
+}
+
+set GDBFLAGS_orig $GDBFLAGS
+set GDBFLAGS "-iex \"set height 0\" --pid=$testpid"
+set GDBFLAGS "--pid=$testpid"
+gdb_start
+set GDBFLAGS $GDBFLAGS_orig
+
@ -292,10 +287,8 @@ new file mode 100644
+do_call_attach_tests
+
+return 0
diff --git a/gdb/testsuite/gdb.base/attach-32b.c b/gdb/testsuite/gdb.base/attach-32b.c
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/attach-32b.c
--- gdb-6.3/gdb/testsuite/gdb.base/attach-32b.c.fix3 2005-07-21 14:23:57.000000000 -0400
+++ gdb-6.3/gdb/testsuite/gdb.base/attach-32b.c 2005-07-21 14:06:02.000000000 -0400
@@ -0,0 +1,24 @@
+/* This program is intended to be started outside of gdb, and then
+ attached to by gdb. Thus, it simply spins in a loop. The loop

View File

@ -0,0 +1,25 @@
2005-03-24 Jeff Johnston <jjohnstn@redhat.com>
* valops.c (check_field_in): Use check_typedef for base classes
to avoid problems with opaque type references.
Index: gdb-6.5/gdb/valops.c
===================================================================
--- gdb-6.5.orig/gdb/valops.c 2005-12-17 20:34:03.000000000 -0200
+++ gdb-6.5/gdb/valops.c 2006-07-07 02:35:09.000000000 -0300
@@ -2257,8 +2257,13 @@ check_field_in (struct type *type, const
}
for (i = TYPE_N_BASECLASSES (type) - 1; i >= 0; i--)
- if (check_field_in (TYPE_BASECLASS (type, i), name))
- return 1;
+ {
+ /* Check the base classes. Make sure we have the real type for
+ each base class as opposed to an opaque declaration. */
+ struct type *baseclass = check_typedef (TYPE_BASECLASS (type, i));
+ if (check_field_in (baseclass, name))
+ return 1;
+ }
return 0;
}

View File

@ -1,11 +1,3 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Jeff Johnston <jjohnstn@redhat.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-6.3-inheritancetest-20050726.patch
;; Verify printing of inherited members test
;;=fedoratest
2005-07-26 Jeff Johnston <jjohnstn@redhat.com>
* gdb.cp/b146835.exp: New testcase.
@ -13,10 +5,22 @@ Subject: gdb-6.3-inheritancetest-20050726.patch
* gdb.cp/b146835b.cc: Ditto.
* gdb.cp/b146835.h: Ditto.
diff --git a/gdb/testsuite/gdb.cp/b146835.cc b/gdb/testsuite/gdb.cp/b146835.cc
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.cp/b146835.cc
--- gdb-6.3/gdb/testsuite/gdb.cp/b146835b.cc.fix3 2005-07-26 16:47:12.000000000 -0400
+++ gdb-6.3/gdb/testsuite/gdb.cp/b146835b.cc 2005-07-26 16:53:31.000000000 -0400
@@ -0,0 +1,11 @@
+#include "b146835.h"
+
+C::C() { d = 0; x = 3; }
+
+int C::z (char *s) { return 0; }
+
+C::~C() {}
+
+void A::funcD (class E *e, class D *d) {}
+void A::funcE (E *e, D *d) {}
+void A::funcF (unsigned long x, D *d) {}
--- gdb-6.3/gdb/testsuite/gdb.cp/b146835.cc.fix3 2005-07-26 16:47:20.000000000 -0400
+++ gdb-6.3/gdb/testsuite/gdb.cp/b146835.cc 2005-07-26 16:46:50.000000000 -0400
@@ -0,0 +1,32 @@
+#include "b146835.h"
+#include <iostream>
@ -50,11 +54,9 @@ new file mode 100644
+ f.foo();
+}
+
diff --git a/gdb/testsuite/gdb.cp/b146835.exp b/gdb/testsuite/gdb.cp/b146835.exp
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.cp/b146835.exp
@@ -0,0 +1,47 @@
--- gdb-6.3/gdb/testsuite/gdb.cp/b146835.exp.fix3 2005-07-26 16:47:26.000000000 -0400
+++ gdb-6.3/gdb/testsuite/gdb.cp/b146835.exp 2005-07-26 16:46:50.000000000 -0400
@@ -0,0 +1,55 @@
+# This testcase is part of GDB, the GNU debugger.
+
+# Copyright 2005 Free Software Foundation, Inc.
@ -76,10 +78,17 @@ new file mode 100644
+# Check that GDB can properly print an inherited member variable
+# (Bugzilla 146835)
+
+if $tracelevel {
+ strace $tracelevel
+}
+
+set prms_id 0
+set bug_id 0
+
+set testfile "b146835"
+set srcfile ${testfile}.cc
+set srcfile2 ${testfile}b.cc
+set binfile [standard_output_file ${testfile}]
+set binfile ${objdir}/${subdir}/${testfile}
+if {[gdb_compile "${srcdir}/${subdir}/${srcfile} ${srcdir}/${subdir}/${srcfile2}" "${binfile}" executable {debug c++}] != "" } {
+ return -1
+}
@ -101,11 +110,10 @@ new file mode 100644
+gdb_continue_to_breakpoint "First line foo"
+
+# Verify that we can access the inherited member d
+gdb_test "p d" " = \\(D \\*\\) *0x0" "Verify inherited member d accessible"
diff --git a/gdb/testsuite/gdb.cp/b146835.h b/gdb/testsuite/gdb.cp/b146835.h
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.cp/b146835.h
+gdb_test "p d" ".*(struct D \*.).*0x0" "Verify inherited member d accessible"
+
--- gdb-6.3/gdb/testsuite/gdb.cp/b146835.h.fix3 2005-07-26 16:47:36.000000000 -0400
+++ gdb-6.3/gdb/testsuite/gdb.cp/b146835.h 2005-07-26 16:53:18.000000000 -0400
@@ -0,0 +1,36 @@
+
+class A {
@ -143,19 +151,3 @@ new file mode 100644
+ int z (char *s);
+ virtual ~C();
+};
diff --git a/gdb/testsuite/gdb.cp/b146835b.cc b/gdb/testsuite/gdb.cp/b146835b.cc
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.cp/b146835b.cc
@@ -0,0 +1,11 @@
+#include "b146835.h"
+
+C::C() { d = 0; x = 3; }
+
+int C::z (char *s) { return 0; }
+
+C::~C() {}
+
+void A::funcD (class E *e, class D *d) {}
+void A::funcE (E *e, D *d) {}
+void A::funcF (unsigned long x, D *d) {}

View File

@ -0,0 +1,346 @@
2005-12-14 Jeff Johnston <jjohnstn@redhat.com>
* symfile-mem.c (read_memory): New static read callback function.
(symfile_add_from_memory): Pass read_memory to bfd instead of
target_read_memory.
* target.c (target_xfer_memory): Add support for LONGEST len and
change all callers.
(deprecated_debug_xfer_memory, target_read_memory): Ditto.
(target_write_memory, do_xfer_memory): Ditto.
(target_xfer_memory_partial, target_read_memory_partial): Ditto.
(target_write_memory_partial): Ditto.
* infptrace.c (child_xfer_memory): Ditto.
* linux-nat.c (linux_nat_xfer_memory): Ditto.
(linux_nat_proc_xfer_memory): Ditto.
* dcache.c (dcache_xfer_memory): Ditto.
* exec.c (xfer_memory): Ditto.
* remote.c (remote_xfer_memory): Ditto.
* remote-sim.c (gdbsim_xfer_interior_memory): Ditto.
* target.h: Change prototypes for functions changed above.
* linux-nat.h: Ditto.
* remote.h: Ditto.
* dcache.h: Ditto.
Index: gdb-6.6/gdb/symfile-mem.c
===================================================================
--- gdb-6.6.orig/gdb/symfile-mem.c 2007-01-20 16:09:05.000000000 +0100
+++ gdb-6.6/gdb/symfile-mem.c 2007-01-20 16:09:17.000000000 +0100
@@ -58,6 +58,14 @@
#include "elf/common.h"
+/* Local callback routine to pass to bfd to read from target memory,
+ using a len constrained to INT_MAX. */
+static int
+read_target_memory (bfd_vma addr, bfd_byte *buf, int len)
+{
+ return target_read_memory (addr, buf, (LONGEST)len);
+}
+
/* Read inferior memory at ADDR to find the header of a loaded object file
and read its in-core symbols out of inferior memory. TEMPL is a bfd
representing the target's format. NAME is the name to use for this
@@ -78,7 +86,7 @@ symbol_file_add_from_memory (struct bfd
error (_("add-symbol-file-from-memory not supported for this target"));
nbfd = bfd_elf_bfd_from_remote_memory (templ, addr, &loadbase,
- target_read_memory);
+ read_target_memory);
if (nbfd == NULL)
error (_("Failed to read a valid object file image from memory."));
Index: gdb-6.6/gdb/target.c
===================================================================
--- gdb-6.6.orig/gdb/target.c 2007-01-20 16:09:12.000000000 +0100
+++ gdb-6.6/gdb/target.c 2007-01-20 16:09:17.000000000 +0100
@@ -56,7 +56,7 @@ static int nosymbol (char *, CORE_ADDR *
static void tcomplain (void) ATTR_NORETURN;
-static int nomemory (CORE_ADDR, char *, int, int, struct target_ops *);
+static LONGEST nomemory (CORE_ADDR, char *, int, int, struct target_ops *);
static int return_zero (void);
@@ -284,7 +284,7 @@ target_mourn_inferior (void)
observer_notify_mourn_inferior (&current_target);
}
-static int
+static LONGEST
nomemory (CORE_ADDR memaddr, char *myaddr, int len, int write,
struct target_ops *t)
{
@@ -517,7 +517,7 @@ update_current_target (void)
(void (*) (void))
noprocess);
de_fault (deprecated_xfer_memory,
- (int (*) (CORE_ADDR, gdb_byte *, int, int, struct mem_attrib *, struct target_ops *))
+ (LONGEST (*) (CORE_ADDR, gdb_byte *, LONGEST, int, struct mem_attrib *, struct target_ops *))
nomemory);
de_fault (to_files_info,
(void (*) (struct target_ops *))
@@ -1178,7 +1178,7 @@ target_xfer_partial (struct target_ops *
it makes no progress, and then return how much was transferred). */
int
-target_read_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len)
+target_read_memory (CORE_ADDR memaddr, gdb_byte *myaddr, LONGEST len)
{
if (target_read (&current_target, TARGET_OBJECT_MEMORY, NULL,
myaddr, memaddr, len) == len)
@@ -1188,7 +1188,7 @@ target_read_memory (CORE_ADDR memaddr, g
}
int
-target_write_memory (CORE_ADDR memaddr, const gdb_byte *myaddr, int len)
+target_write_memory (CORE_ADDR memaddr, const gdb_byte *myaddr, LONGEST len)
{
if (target_write (&current_target, TARGET_OBJECT_MEMORY, NULL,
myaddr, memaddr, len) == len)
@@ -2186,8 +2186,8 @@ debug_to_prepare_to_store (void)
fprintf_unfiltered (gdb_stdlog, "target_prepare_to_store ()\n");
}
-static int
-deprecated_debug_xfer_memory (CORE_ADDR memaddr, bfd_byte *myaddr, int len,
+static LONGEST
+deprecated_debug_xfer_memory (CORE_ADDR memaddr, bfd_byte *myaddr, LONGEST len,
int write, struct mem_attrib *attrib,
struct target_ops *target)
{
@@ -2197,9 +2197,9 @@ deprecated_debug_xfer_memory (CORE_ADDR
attrib, target);
fprintf_unfiltered (gdb_stdlog,
- "target_xfer_memory (0x%x, xxx, %d, %s, xxx) = %d",
+ "target_xfer_memory (0x%x, xxx, %ld, %s, xxx) = %d",
(unsigned int) memaddr, /* possable truncate long long */
- len, write ? "write" : "read", retval);
+ (long)len, write ? "write" : "read", retval);
if (retval > 0)
{
Index: gdb-6.6/gdb/target.h
===================================================================
--- gdb-6.6.orig/gdb/target.h 2007-01-20 16:09:10.000000000 +0100
+++ gdb-6.6/gdb/target.h 2007-01-20 16:09:17.000000000 +0100
@@ -347,10 +347,10 @@ struct target_ops
NOTE: cagney/2004-10-01: This has been entirely superseeded by
to_xfer_partial and inferior inheritance. */
- int (*deprecated_xfer_memory) (CORE_ADDR memaddr, gdb_byte *myaddr,
- int len, int write,
- struct mem_attrib *attrib,
- struct target_ops *target);
+ LONGEST (*deprecated_xfer_memory) (CORE_ADDR memaddr, gdb_byte *myaddr,
+ LONGEST len, int write,
+ struct mem_attrib *attrib,
+ struct target_ops *target);
void (*to_files_info) (struct target_ops *);
int (*to_insert_breakpoint) (struct bp_target_info *);
@@ -605,16 +605,17 @@ extern DCACHE *target_dcache;
extern int target_read_string (CORE_ADDR, char **, int, int *);
-extern int target_read_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len);
+extern int target_read_memory (CORE_ADDR memaddr, gdb_byte *myaddr,
+ LONGEST len);
extern int target_write_memory (CORE_ADDR memaddr, const gdb_byte *myaddr,
- int len);
+ LONGEST len);
-extern int xfer_memory (CORE_ADDR, gdb_byte *, int, int,
- struct mem_attrib *, struct target_ops *);
+extern LONGEST xfer_memory (CORE_ADDR, gdb_byte *, LONGEST, int,
+ struct mem_attrib *, struct target_ops *);
-extern int child_xfer_memory (CORE_ADDR, gdb_byte *, int, int,
- struct mem_attrib *, struct target_ops *);
+extern LONGEST child_xfer_memory (CORE_ADDR, gdb_byte *, LONGEST, int,
+ struct mem_attrib *, struct target_ops *);
/* Fetches the target's memory map. If one is found it is sorted
and returned, after some consistency checking. Otherwise, NULL
Index: gdb-6.6/gdb/infptrace.c
===================================================================
--- gdb-6.6.orig/gdb/infptrace.c 2005-12-17 23:34:01.000000000 +0100
+++ gdb-6.6/gdb/infptrace.c 2007-01-20 16:09:17.000000000 +0100
@@ -331,17 +331,17 @@ store_inferior_registers (int regnum)
deprecated_child_ops doesn't allow memory operations to cross below
us in the target stack anyway. */
-int
-child_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len, int write,
+LONGEST
+child_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, LONGEST len, int write,
struct mem_attrib *attrib, struct target_ops *target)
{
- int i;
+ LONGEST i;
/* Round starting address down to longword boundary. */
CORE_ADDR addr = memaddr & -(CORE_ADDR) sizeof (PTRACE_TYPE_RET);
/* Round ending address up; get number of longwords that makes. */
- int count = ((((memaddr + len) - addr) + sizeof (PTRACE_TYPE_RET) - 1)
- / sizeof (PTRACE_TYPE_RET));
- int alloc = count * sizeof (PTRACE_TYPE_RET);
+ LONGEST count = ((((memaddr + len) - addr) + sizeof (PTRACE_TYPE_RET) - 1)
+ / sizeof (PTRACE_TYPE_RET));
+ LONGEST alloc = count * sizeof (PTRACE_TYPE_RET);
PTRACE_TYPE_RET *buffer;
struct cleanup *old_chain = NULL;
Index: gdb-6.6/gdb/dcache.c
===================================================================
--- gdb-6.6.orig/gdb/dcache.c 2006-08-15 20:46:24.000000000 +0200
+++ gdb-6.6/gdb/dcache.c 2007-01-20 16:09:17.000000000 +0100
@@ -519,9 +519,9 @@ dcache_free (DCACHE *dcache)
This routine is indended to be called by remote_xfer_ functions. */
-int
+LONGEST
dcache_xfer_memory (DCACHE *dcache, CORE_ADDR memaddr, gdb_byte *myaddr,
- int len, int should_write)
+ LONGEST len, int should_write)
{
int i;
int (*xfunc) (DCACHE *dcache, CORE_ADDR addr, gdb_byte *ptr);
Index: gdb-6.6/gdb/dcache.h
===================================================================
--- gdb-6.6.orig/gdb/dcache.h 2005-12-17 23:33:59.000000000 +0100
+++ gdb-6.6/gdb/dcache.h 2007-01-20 16:09:17.000000000 +0100
@@ -37,7 +37,7 @@ void dcache_free (DCACHE *);
/* Simple to call from <remote>_xfer_memory */
-int dcache_xfer_memory (DCACHE *cache, CORE_ADDR mem, gdb_byte *my,
- int len, int should_write);
+LONGEST dcache_xfer_memory (DCACHE *cache, CORE_ADDR mem, gdb_byte *my,
+ LONGEST len, int should_write);
#endif /* DCACHE_H */
Index: gdb-6.6/gdb/exec.c
===================================================================
--- gdb-6.6.orig/gdb/exec.c 2006-11-10 20:20:35.000000000 +0100
+++ gdb-6.6/gdb/exec.c 2007-01-20 16:09:17.000000000 +0100
@@ -452,8 +452,8 @@ map_vmap (bfd *abfd, bfd *arch)
The same routine is used to handle both core and exec files;
we just tail-call it with more arguments to select between them. */
-int
-xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len, int write,
+LONGEST
+xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, LONGEST len, int write,
struct mem_attrib *attrib, struct target_ops *target)
{
int res;
Index: gdb-6.6/gdb/linux-nat.c
===================================================================
--- gdb-6.6.orig/gdb/linux-nat.c 2007-01-20 16:09:14.000000000 +0100
+++ gdb-6.6/gdb/linux-nat.c 2007-01-20 16:09:17.000000000 +0100
@@ -3266,7 +3266,7 @@ linux_xfer_partial (struct target_ops *o
Revert when Bugzilla 147436 is fixed. */
if (iterate_over_lwps (ia64_linux_check_stack_region, &range) != NULL)
{ /* This region contains ia64 rse registers, we have to re-read. */
- int xxfer;
+ LONGEST xxfer;
/* Re-read register stack area. */
xxfer = super_xfer_partial (ops, object, annex,
Index: gdb-6.6/gdb/remote.c
===================================================================
--- gdb-6.6.orig/gdb/remote.c 2007-01-20 16:09:12.000000000 +0100
+++ gdb-6.6/gdb/remote.c 2007-01-20 16:09:17.000000000 +0100
@@ -27,6 +27,7 @@
#include "gdb_string.h"
#include <ctype.h>
#include <fcntl.h>
+#include <limits.h>
#include "inferior.h"
#include "bfd.h"
#include "symfile.h"
@@ -4185,19 +4186,27 @@ remote_read_bytes (CORE_ADDR memaddr, gd
if SHOULD_WRITE is nonzero. Returns length of data written or
read; 0 for error. TARGET is unused. */
-static int
-remote_xfer_memory (CORE_ADDR mem_addr, gdb_byte *buffer, int mem_len,
+static LONGEST
+remote_xfer_memory (CORE_ADDR mem_addr, gdb_byte *buffer, LONGEST mem_len,
int should_write, struct mem_attrib *attrib,
struct target_ops *target)
{
int res;
+ int len;
+
+
+ /* This routine is not set up to handle > INT_MAX bytes. */
+ if (mem_len >= (LONGEST)INT_MAX)
+ return 0;
+
+ len = (int)mem_len;
if (should_write)
res = remote_write_bytes (mem_addr, buffer, mem_len);
else
res = remote_read_bytes (mem_addr, buffer, mem_len);
- return res;
+ return (LONGEST)res;
}
/* Sends a packet with content determined by the printf format string
Index: gdb-6.6/gdb/remote-sim.c
===================================================================
--- gdb-6.6.orig/gdb/remote-sim.c 2006-11-10 20:20:36.000000000 +0100
+++ gdb-6.6/gdb/remote-sim.c 2007-01-20 16:10:10.000000000 +0100
@@ -745,11 +745,14 @@ gdbsim_prepare_to_store (void)
Returns the number of bytes transferred. */
-static int
-gdbsim_xfer_inferior_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len,
+static LONGEST
+gdbsim_xfer_inferior_memory (CORE_ADDR memaddr, gdb_byte *myaddr, LONGEST len,
int write, struct mem_attrib *attrib,
struct target_ops *target)
{
+ /* Convert to len type that sim_read and sim_write can handle. */
+ int xfer_len = (int)len;
+
/* If no program is running yet, then ignore the simulator for
memory. Pass the request down to the next target, hopefully
an exec file. */
@@ -765,22 +768,22 @@ gdbsim_xfer_inferior_memory (CORE_ADDR m
printf_filtered ("gdbsim_xfer_inferior_memory: myaddr 0x");
gdb_print_host_address (myaddr, gdb_stdout);
printf_filtered (", memaddr 0x%s, len %d, write %d\n",
- paddr_nz (memaddr), len, write);
+ paddr_nz (memaddr), xfer_len, write);
if (sr_get_debug () && write)
- dump_mem (myaddr, len);
+ dump_mem (myaddr, xfer_len);
}
if (write)
{
- len = sim_write (gdbsim_desc, memaddr, myaddr, len);
+ xfer_len = sim_write (gdbsim_desc, memaddr, myaddr, xfer_len);
}
else
{
- len = sim_read (gdbsim_desc, memaddr, myaddr, len);
- if (sr_get_debug () && len > 0)
- dump_mem (myaddr, len);
+ xfer_len = sim_read (gdbsim_desc, memaddr, myaddr, xfer_len);
+ if (sr_get_debug () && xfer_len > 0)
+ dump_mem (myaddr, xfer_len);
}
- return len;
+ return (LONGEST)xfer_len;
}
static void

View File

@ -0,0 +1,646 @@
[base]
2007-09-21 Jan Kratochvil <jan.kratochvil@redhat.com>
* linespec.c (add_minsym_members): Support also the `$allocate' and
`$delete' variants.
2007-10-05 Jan Kratochvil <jan.kratochvil@redhat.com>
* linespec.c (add_minsym_members): Support also the `$allocate' and
`$delete' variants.
(decode_variable): Renamed to ...
(decode_variable_1) ... here, its parameter NOT_FOUND_PTR and its
exception throwing was moved to ...
(decode_variable_not_found): ... a new function here.
(decode_variable): New function.
Index: gdb-6.5/gdb/linespec.c
===================================================================
--- gdb-6.5.orig/gdb/linespec.c 2006-01-10 20:14:43.000000000 -0200
+++ gdb-6.5/gdb/linespec.c 2006-07-07 01:04:56.000000000 -0300
@@ -37,6 +37,7 @@
#include "objc-lang.h"
#include "linespec.h"
#include "exceptions.h"
+#include "gdb_assert.h"
/* We share this one with symtab.c, but it is not exported widely. */
@@ -75,7 +75,8 @@ static struct symtabs_and_lines find_met
struct symbol *sym_class);
static int collect_methods (char *copy, struct type *t,
- struct symbol **sym_arr);
+ struct symbol **sym_arr,
+ struct minimal_symbol **msym_arr);
static NORETURN void cplusplus_error (const char *name,
const char *fmt, ...)
@@ -83,10 +84,12 @@ static NORETURN void cplusplus_error (co
static int total_number_of_methods (struct type *type);
-static int find_methods (struct type *, char *, struct symbol **);
+static int find_methods (struct type *, char *, struct symbol **,
+ struct minimal_symbol **);
static int add_matching_methods (int method_counter, struct type *t,
- struct symbol **sym_arr);
+ struct symbol **sym_arr,
+ struct minimal_symbol **msym_arr);
static int add_constructors (int method_counter, struct type *t,
struct symbol **sym_arr);
@@ -101,6 +104,9 @@ static int is_objc_method_format (const
static struct symtabs_and_lines decode_line_2 (struct symbol *[],
int, int, char ***);
+static struct symtabs_and_lines decode_line_3 (struct minimal_symbol *[],
+ int, int, char ***);
+
static struct symtab *symtab_from_filename (char **argptr,
char *p, int is_quote_enclosed,
int *not_found_ptr);
@@ -191,12 +197,18 @@ total_number_of_methods (struct type *ty
/* Recursive helper function for decode_line_1.
Look for methods named NAME in type T.
Return number of matches.
- Put matches in SYM_ARR, which should have been allocated with
+ Put symbol matches in SYM_ARR, which should have been allocated with
a size of total_number_of_methods (T) * sizeof (struct symbol *).
+ In a special case where we are looking for constructors, we may
+ have to return minimal symbols in the array: MSYM_ARR. This occurs
+ when the compiler does not generate mangled names for the constructor's
+ debug info because there are multiple versions of the constructor
+ (in-charge vs not-in-charge).
Note that this function is g++ specific. */
static int
-find_methods (struct type *t, char *name, struct symbol **sym_arr)
+find_methods (struct type *t, char *name, struct symbol **sym_arr,
+ struct minimal_symbol **msym_arr)
{
int i1 = 0;
int ibase;
@@ -239,7 +251,8 @@ find_methods (struct type *t, char *name
if (strcmp_iw (name, method_name) == 0)
/* Find all the overloaded methods with that name. */
i1 += add_matching_methods (method_counter, t,
- sym_arr + i1);
+ sym_arr + i1,
+ msym_arr);
else if (strncmp (class_name, name, name_len) == 0
&& (class_name[name_len] == '\0'
|| class_name[name_len] == '<'))
@@ -261,21 +274,101 @@ find_methods (struct type *t, char *name
if (i1 == 0)
for (ibase = 0; ibase < TYPE_N_BASECLASSES (t); ibase++)
- i1 += find_methods (TYPE_BASECLASS (t, ibase), name, sym_arr + i1);
+ i1 += find_methods (TYPE_BASECLASS (t, ibase), name, sym_arr + i1,
+ msym_arr);
return i1;
}
+static int
+add_minsym_members (const char *class_name,
+ const char *member_name,
+ struct minimal_symbol **msym_arr)
+{
+ char *completion_name;
+ char **list;
+ int i;
+ int comp_len;
+ int counter = 0;
+
+ /* To find the member, we first cheat and use symbol completion.
+ This will give us a list of all the member names including
+ the function signature. */
+ completion_name = xmalloc (strlen (class_name) +
+ strlen (member_name) + 9);
+ completion_name[0] = '\'';
+ strcpy (completion_name+1, class_name);
+ /* FIXME: make this the language class separator. */
+ strcat (completion_name, "::");
+ strcat (completion_name, member_name);
+ strcat (completion_name, "(");
+ list = make_symbol_completion_list (completion_name,
+ completion_name+1);
+
+ /* Now that we have the list, we generate an array of their
+ corresponding minimal symbols. */
+ counter = 0;
+ while (list && list[counter] != NULL)
+ {
+ msym_arr[counter] = lookup_minimal_symbol (list[counter], NULL, NULL);
+ ++counter;
+ }
+
+ xfree (list);
+
+ /* In the case of constructors, there may be in-charge vs not-in-charge
+ constructors. Check for names with $base which indicates not-in-charge
+ constructors. */
+ comp_len = strlen (completion_name);
+ strcpy (completion_name + comp_len - 1, "$base(");
+ list = make_symbol_completion_list (completion_name,
+ completion_name+1);
+
+ /* Again we have a list. Add their minimal symbols to the array. */
+ i = 0;
+ while (list && list[i] != NULL)
+ {
+ msym_arr[counter] = lookup_minimal_symbol (list[i++], NULL, NULL);
+ ++counter;
+ }
+ xfree (list);
+
+ /* Target also the allocating/deleting variants. */
+ if (member_name[0] == '~')
+ strcpy (completion_name + comp_len - 1, "$delete(");
+ else
+ strcpy (completion_name + comp_len - 1, "$allocate(");
+ list = make_symbol_completion_list (completion_name,
+ completion_name+1);
+
+ /* Again we have a list. Add their minimal symbols to the array. */
+ i = 0;
+ while (list && list[i] != NULL)
+ {
+ msym_arr[counter] = lookup_minimal_symbol (list[i++], NULL, NULL);
+ ++counter;
+ }
+ xfree (list);
+
+ xfree (completion_name);
+
+ return counter;
+}
+
/* Add the symbols associated to methods of the class whose type is T
and whose name matches the method indexed by METHOD_COUNTER in the
array SYM_ARR. Return the number of methods added. */
static int
add_matching_methods (int method_counter, struct type *t,
- struct symbol **sym_arr)
+ struct symbol **sym_arr,
+ struct minimal_symbol **msym_arr)
{
int field_counter;
int i1 = 0;
+ int cons_index = 0;
+ char *class_name = type_name_no_tag (t);
+ char **list = NULL;
for (field_counter = TYPE_FN_FIELDLIST_LENGTH (t, method_counter) - 1;
field_counter >= 0;
@@ -299,6 +374,16 @@ add_matching_methods (int method_counter
}
else
phys_name = TYPE_FN_FIELD_PHYSNAME (f, field_counter);
+
+ /* Check for special case of looking for member that
+ doesn't have a mangled name provided. This will happen
+ when we have in-charge and not-in-charge constructors.
+ Since we don't have a mangled name to work with, if we
+ look for the symbol, we can only find the class itself.
+ We can find the information we need in the minimal symbol
+ table which has the full member name information we need. */
+ if (strlen (phys_name) <= strlen (class_name))
+ return add_minsym_members (class_name, phys_name, msym_arr);
/* Destructor is handled by caller, don't add it to
the list. */
@@ -324,6 +409,9 @@ add_matching_methods (int method_counter
}
}
+ if (list)
+ xfree (list);
+
return i1;
}
@@ -603,6 +691,146 @@ decode_line_2 (struct symbol *sym_arr[],
discard_cleanups (old_chain);
return return_values;
}
+
+/* Given a list of NELTS minimal symbols in MSYM_ARR, return a list of lines to
+ operate on (ask user if necessary).
+ If CANONICAL is non-NULL return a corresponding array of mangled names
+ as canonical line specs there. */
+
+static struct symtabs_and_lines
+decode_line_3 (struct minimal_symbol *msym_arr[],
+ int nelts, int funfirstline,
+ char ***canonical)
+{
+ struct symtabs_and_lines values, return_values;
+ char *args, *arg1;
+ int i;
+ char *prompt;
+ char *symname;
+ struct cleanup *old_chain;
+ char **canonical_arr = (char **) NULL;
+
+ values.sals = (struct symtab_and_line *)
+ alloca (nelts * sizeof (struct symtab_and_line));
+ return_values.sals = (struct symtab_and_line *)
+ xmalloc (nelts * sizeof (struct symtab_and_line));
+ old_chain = make_cleanup (xfree, return_values.sals);
+
+ if (canonical)
+ {
+ canonical_arr = (char **) xmalloc (nelts * sizeof (char *));
+ make_cleanup (xfree, canonical_arr);
+ memset (canonical_arr, 0, nelts * sizeof (char *));
+ *canonical = canonical_arr;
+ }
+
+ i = 0;
+ printf_unfiltered ("[0] cancel\n[1] all\n");
+ while (i < nelts)
+ {
+ init_sal (&return_values.sals[i]); /* Initialize to zeroes. */
+ init_sal (&values.sals[i]);
+ if (msym_arr[i])
+ {
+ struct symtabs_and_lines msal = minsym_found (funfirstline,
+ msym_arr[i]);
+ memcpy (&values.sals[i], &msal.sals[0],
+ sizeof (struct symtab_and_line));
+ if (values.sals[i].symtab)
+ printf_unfiltered ("[%d] %s at %s:%d\n",
+ (i + 2),
+ SYMBOL_PRINT_NAME (msym_arr[i]),
+ values.sals[i].symtab->filename,
+ values.sals[i].line);
+ else
+ printf_unfiltered ("[%d] %s at ?FILE:%d [No symtab? Probably broken debug info...]\n",
+ (i + 2),
+ SYMBOL_PRINT_NAME (msym_arr[i]),
+ values.sals[i].line);
+
+ }
+ else
+ printf_unfiltered ("?HERE\n");
+ i++;
+ }
+
+ prompt = getenv ("PS2");
+ if (prompt == NULL)
+ {
+ prompt = "> ";
+ }
+ args = command_line_input (prompt, 0, "overload-choice");
+
+ if (args == 0 || *args == 0)
+ error_no_arg ("one or more choice numbers");
+
+ i = 0;
+ while (*args)
+ {
+ int num;
+
+ arg1 = args;
+ while (*arg1 >= '0' && *arg1 <= '9')
+ arg1++;
+ if (*arg1 && *arg1 != ' ' && *arg1 != '\t')
+ error ("Arguments must be choice numbers.");
+
+ num = atoi (args);
+
+ if (num == 0)
+ error ("canceled");
+ else if (num == 1)
+ {
+ if (canonical_arr)
+ {
+ for (i = 0; i < nelts; i++)
+ {
+ if (canonical_arr[i] == NULL)
+ {
+ symname = DEPRECATED_SYMBOL_NAME (msym_arr[i]);
+ canonical_arr[i] = savestring (symname, strlen (symname));
+ }
+ }
+ }
+ memcpy (return_values.sals, values.sals,
+ (nelts * sizeof (struct symtab_and_line)));
+ return_values.nelts = nelts;
+ discard_cleanups (old_chain);
+ return return_values;
+ }
+
+ if (num >= nelts + 2)
+ {
+ printf_unfiltered ("No choice number %d.\n", num);
+ }
+ else
+ {
+ num -= 2;
+ if (values.sals[num].pc)
+ {
+ if (canonical_arr)
+ {
+ symname = DEPRECATED_SYMBOL_NAME (msym_arr[num]);
+ make_cleanup (xfree, symname);
+ canonical_arr[i] = savestring (symname, strlen (symname));
+ }
+ return_values.sals[i++] = values.sals[num];
+ values.sals[num].pc = 0;
+ }
+ else
+ {
+ printf_unfiltered ("duplicate request for %d ignored.\n", num);
+ }
+ }
+
+ args = arg1;
+ while (*args == ' ' || *args == '\t')
+ args++;
+ }
+ return_values.nelts = i;
+ discard_cleanups (old_chain);
+ return return_values;
+}
/* The parser of linespec itself. */
@@ -1406,36 +1634,46 @@ find_method (int funfirstline, char ***c
int i1; /* Counter for the symbol array. */
struct symbol **sym_arr = alloca (total_number_of_methods (t)
* sizeof (struct symbol *));
+ struct minimal_symbol **msym_arr = alloca (total_number_of_methods (t)
+ * sizeof (struct minimal_symbol *));
+
+ msym_arr[0] = NULL;
/* Find all methods with a matching name, and put them in
sym_arr. */
- i1 = collect_methods (copy, t, sym_arr);
+ i1 = collect_methods (copy, t, sym_arr, msym_arr);
if (i1 == 1)
{
/* There is exactly one field with that name. */
- sym = sym_arr[0];
-
- if (sym && SYMBOL_CLASS (sym) == LOC_BLOCK)
- {
- values.sals = (struct symtab_and_line *)
- xmalloc (sizeof (struct symtab_and_line));
- values.nelts = 1;
- values.sals[0] = find_function_start_sal (sym,
- funfirstline);
- }
+ if (msym_arr[0] != NULL)
+ return minsym_found (funfirstline, msym_arr[0]);
else
{
- values.sals = NULL;
- values.nelts = 0;
+ sym = sym_arr[0];
+
+ if (sym && SYMBOL_CLASS (sym) == LOC_BLOCK)
+ {
+ values.sals = (struct symtab_and_line *)
+ xmalloc (sizeof (struct symtab_and_line));
+ values.nelts = 1;
+ values.sals[0] = find_function_start_sal (sym,
+ funfirstline);
+ }
+ else
+ {
+ values.nelts = 0;
+ }
+ return values;
}
- return values;
}
if (i1 > 0)
{
/* There is more than one field with that name
(overloaded). Ask the user which one to use. */
+ if (msym_arr[0] != NULL)
+ return decode_line_3 (msym_arr, i1, funfirstline, canonical);
return decode_line_2 (sym_arr, i1, funfirstline, canonical);
}
else
@@ -1462,11 +1700,12 @@ find_method (int funfirstline, char ***c
}
/* Find all methods named COPY in the class whose type is T, and put
- them in SYM_ARR. Return the number of methods found. */
+ them in SYM_ARR or MSYM_ARR. Return the number of methods found. */
static int
collect_methods (char *copy, struct type *t,
- struct symbol **sym_arr)
+ struct symbol **sym_arr,
+ struct minimal_symbol **msym_arr)
{
int i1 = 0; /* Counter for the symbol array. */
@@ -1488,7 +1727,7 @@ collect_methods (char *copy, struct type
}
}
else
- i1 = find_methods (t, copy, sym_arr);
+ i1 = find_methods (t, copy, sym_arr, msym_arr);
return i1;
}
@@ -1976,12 +2021,13 @@ decode_dollar (char *copy, int funfirstl
and do not issue an error message. */
static struct symtabs_and_lines
-decode_variable (char *copy, int funfirstline, char ***canonical,
- struct symtab *file_symtab, int *not_found_ptr)
+decode_variable_1 (char *copy, int funfirstline, char ***canonical,
+ struct symtab *file_symtab)
{
struct symbol *sym;
/* The symtab that SYM was found in. */
struct symtab *sym_symtab;
+ struct symtabs_and_lines retval;
struct minimal_symbol *msymbol;
@@ -2001,8 +2047,25 @@ decode_variable (char *copy, int funfirs
msymbol = lookup_minimal_symbol (copy, NULL, NULL);
if (msymbol != NULL)
- return minsym_found (funfirstline, msymbol);
+ {
+ retval = minsym_found (funfirstline, msymbol);
+
+ /* Create a `filename:linkage_symbol_name' reference. */
+ if (file_symtab == 0)
+ build_canonical_line_spec (retval.sals, SYMBOL_LINKAGE_NAME (msymbol),
+ canonical);
+
+ return retval;
+ }
+ retval.nelts = 0;
+ retval.sals = NULL;
+ return retval;
+}
+
+static void
+decode_variable_not_found (char *copy, int *not_found_ptr)
+{
if (!have_full_symbols () &&
!have_partial_symbols () && !have_minimal_symbols ())
error (_("No symbol table is loaded. Use the \"file\" command."));
@@ -2010,6 +2064,132 @@ decode_variable (char *copy, int funfirs
throw_error (NOT_FOUND_ERROR, _("Function \"%s\" not defined."), copy);
}
+/* Wrapper of DECODE_VARIABLE_1 collecting the results for all the found
+ VARIANTS of the symbol COPY. */
+
+static struct symtabs_and_lines
+decode_variable (char *copy, int funfirstline, char ***canonical,
+ struct symtab *file_symtab, int *not_found_ptr)
+{
+ char *src;
+ char *src_point;
+ char *s, *point;
+ /* Keep "" last as the trimming part always matches it. */
+ const char *variants[] = {"$base","$allocate","$delete",""};
+ int i;
+ char *dst, *dst_point;
+ struct
+ {
+ struct symtabs_and_lines sals;
+ char **canonical;
+ } found[ARRAY_SIZE (variants)];
+ struct symtabs_and_lines retval_sals;
+ char **retval_canonical = NULL; /* Shut up GCC. */
+ int filled;
+ int canonicals = 0; /* Shut up GCC. */
+
+ src = copy;
+ src_point = strchr (src, '(');
+ if (src_point == NULL)
+ {
+ struct symtabs_and_lines sals;
+
+ sals = decode_variable_1 (src, funfirstline, canonical, file_symtab);
+ if (sals.nelts > 0)
+ return sals;
+ decode_variable_not_found (copy, not_found_ptr);
+ /* NOTREACHED */
+ }
+
+ dst = xmalloc (strlen (src) + strlen ("$allocate") + 1);
+ dst_point = dst + (src_point - src);
+
+ memcpy (dst, src, src_point - src);
+
+ /* Trim out any variant markers there first. */
+ for (i = 0; i < ARRAY_SIZE (variants); i++)
+ {
+ size_t len = strlen (variants[i]);
+
+ if (dst_point - dst >= len
+ && memcmp (dst_point - len, variants[i], len) == 0)
+ {
+ dst_point -= len;
+ /* In fact it should not be needed here. */
+ break;
+ }
+ }
+
+ filled = 0;
+ /* And now try to append all of them. */
+ for (i = 0; i < ARRAY_SIZE (variants); i++)
+ {
+ size_t len = strlen (variants[i]);
+ struct minimal_symbol *minsym2;
+
+ memcpy (dst_point, variants[i], len);
+ strcpy (dst_point + len, src_point);
+
+ found[i].canonical = NULL;
+ found[i].sals = decode_variable_1 (dst, funfirstline,
+ (canonical == NULL ? NULL
+ : &found[i].canonical),
+ file_symtab);
+ filled += found[i].sals.nelts;
+ }
+ xfree (dst);
+ if (filled == 0)
+ {
+ decode_variable_not_found (copy, not_found_ptr);
+ /* NOTREACHED */
+ }
+
+ retval_sals.nelts = filled;
+ retval_sals.sals = xmalloc (filled * sizeof *retval_sals.sals);
+ if (canonical != NULL)
+ {
+ retval_canonical = xmalloc (filled * sizeof *retval_canonical);
+ canonicals = 0;
+ }
+ filled = 0;
+ for (i = 0; i < ARRAY_SIZE (variants); i++)
+ {
+ memcpy (&retval_sals.sals[filled], found[i].sals.sals,
+ found[i].sals.nelts * sizeof *retval_sals.sals);
+ xfree (found[i].sals.sals);
+ if (canonical != NULL)
+ {
+ if (found[i].canonical == NULL)
+ memset (&retval_canonical[filled], 0,
+ found[i].sals.nelts * sizeof *retval_canonical);
+ else
+ {
+ int j;
+
+ memcpy (&retval_canonical[filled], found[i].canonical,
+ found[i].sals.nelts * sizeof *retval_canonical);
+ for (j = 0; j < found[i].sals.nelts; j++)
+ if (found[i].canonical[j] != NULL)
+ canonicals++;
+ xfree (found[i].canonical);
+ }
+ }
+ filled += found[i].sals.nelts;
+ }
+ gdb_assert (filled == retval_sals.nelts);
+
+ if (canonical != NULL)
+ {
+ if (canonicals != 0)
+ *canonical = retval_canonical;
+ else
+ {
+ *canonical = NULL;
+ xfree (retval_canonical);
+ }
+ }
+ return retval_sals;
+}
diff -u -rup gdb-6.6-orig/gdb/Makefile.in gdb-6.6/gdb/Makefile.in
--- gdb-6.6-orig/gdb/Makefile.in 2007-10-05 15:22:37.000000000 +0200
+++ gdb-6.6/gdb/Makefile.in 2007-10-05 16:29:10.000000000 +0200
@@ -2266,7 +2266,7 @@ libunwind-frame.o: libunwind-frame.c $(d
linespec.o: linespec.c $(defs_h) $(symtab_h) $(frame_h) $(command_h) \
$(symfile_h) $(objfiles_h) $(source_h) $(demangle_h) $(value_h) \
$(completer_h) $(cp_abi_h) $(parser_defs_h) $(block_h) \
- $(objc_lang_h) $(linespec_h) $(exceptions_h)
+ $(objc_lang_h) $(linespec_h) $(exceptions_h) $(gdb_assert_h)
linux-fork.o: linux-fork.c $(defs_h) $(inferior_h) $(regcache_h) $(gdbcmd_h) \
$(infcall_h) $(gdb_assert_h) $(gdb_string_h) $(linux_fork_h) \
$(linux_nat_h)

View File

@ -0,0 +1,38 @@
2004-12-16 Jeff Johnston <jjohnstn@redhat.com>
* linux-thread-db.c (clear_lwpip_callback): Removed.
(thread_db_resume): Do not iterate and call
clear_lwp_callback.
--- gdb-6.3/gdb/linux-thread-db.c.fix Thu Dec 16 16:32:13 2004
+++ gdb-6.3/gdb/linux-thread-db.c Thu Dec 16 16:32:30 2004
@@ -822,19 +822,6 @@ thread_db_detach (char *args, int from_t
target_beneath->to_detach (args, from_tty);
}
-static int
-clear_lwpid_callback (struct thread_info *thread, void *dummy)
-{
- /* If we know that our thread implementation is 1-to-1, we could save
- a certain amount of information; it's not clear how much, so we
- are always conservative. */
-
- thread->private->th_valid = 0;
- thread->private->ti_valid = 0;
-
- return 0;
-}
-
static void
thread_db_resume (ptid_t ptid, int step, enum target_signal signo)
{
@@ -845,9 +832,6 @@ thread_db_resume (ptid_t ptid, int step,
else if (is_thread (ptid))
ptid = lwp_from_thread (ptid);
- /* Clear cached data which may not be valid after the resume. */
- iterate_over_threads (clear_lwpid_callback, NULL);
-
target_beneath->to_resume (ptid, step, signo);
do_cleanups (old_chain);

View File

@ -1,247 +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.3-mapping-zero-inode-test.patch
;; Test GCORE for shmid 0 shared memory mappings.
;;=fedoratest: But it is broken anyway, sometimes the case being tested is not reproducible.
diff --git a/gdb/testsuite/gdb.base/gcore-shmid0.c b/gdb/testsuite/gdb.base/gcore-shmid0.c
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/gcore-shmid0.c
@@ -0,0 +1,128 @@
+/* Copyright 2007, 2009 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 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. */
+
+/*
+ * Test GDB's handling of gcore for mapping with a name but zero inode.
+ */
+
+#include <sys/ipc.h>
+#include <sys/shm.h>
+#include <stdio.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <assert.h>
+#include <time.h>
+
+/* The same test running in a parallel testsuite may steal us the zero SID,
+ even if we never get any EEXIST. Just try a while. */
+
+#define TIMEOUT_SEC 10
+
+static volatile int v;
+
+static void
+initialized (void)
+{
+ v++;
+}
+
+static void
+unresolved (void)
+{
+ v++;
+}
+
+int
+main (void)
+{
+ int sid;
+ unsigned int *addr = (void *) -1L;
+ int attempt, round = 0;
+ time_t ts_start, ts;
+
+ if (time (&ts_start) == (time_t) -1)
+ {
+ printf ("time (): %m\n");
+ exit (1);
+ }
+
+ /* The generated SID will cycle with an increment of 32768, attempt until it
+ * wraps to 0. */
+
+ for (attempt = 0; addr == (void *) -1L; attempt++)
+ {
+ /* kernel-2.6.25-8.fc9.x86_64 just never returns the value 0 by
+ shmget(2). shmget returns SID range 0..1<<31 in steps of 32768,
+ 0x1000 should be enough but wrap the range it to be sure. */
+
+ if (attempt > 0x21000)
+ {
+ if (time (&ts) == (time_t) -1)
+ {
+ printf ("time (): %m\n");
+ exit (1);
+ }
+
+ if (ts >= ts_start && ts < ts_start + TIMEOUT_SEC)
+ {
+ attempt = 0;
+ round++;
+ continue;
+ }
+
+ printf ("Problem is not reproducible on this kernel (attempt %d, "
+ "round %d)\n", attempt, round);
+ unresolved ();
+ exit (1);
+ }
+
+ sid = shmget ((key_t) rand (), 0x1000, IPC_CREAT | IPC_EXCL | 0777);
+ if (sid == -1)
+ {
+ if (errno == EEXIST)
+ continue;
+
+ printf ("shmget (%d, 0x1000, IPC_CREAT): errno %d\n", 0, errno);
+ exit (1);
+ }
+
+ /* Use SID only if it is 0, retry it otherwise. */
+
+ if (sid == 0)
+ {
+ addr = shmat (sid, NULL, SHM_RND);
+ if (addr == (void *) -1L)
+ {
+ printf ("shmat (%d, NULL, SHM_RND): errno %d\n", sid,
+ errno);
+ exit (1);
+ }
+ }
+ if (shmctl (sid, IPC_RMID, NULL) != 0)
+ {
+ printf ("shmctl (%d, IPC_RMID, NULL): errno %d\n", sid, errno);
+ exit (1);
+ }
+ }
+
+ initialized ();
+
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.base/gcore-shmid0.exp b/gdb/testsuite/gdb.base/gcore-shmid0.exp
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/gcore-shmid0.exp
@@ -0,0 +1,101 @@
+# Copyright 2007, 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 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.
+
+# Test GDB's handling of gcore for mapping with a name but zero inode.
+
+if { [prepare_for_testing gcore-shmid0.exp gcore-shmid0] } {
+ return -1
+}
+
+# Does this gdb support gcore?
+set test "help gcore"
+gdb_test_multiple $test $test {
+ -re "Undefined command: .gcore.*$gdb_prompt $" {
+ # gcore command not supported -- nothing to test here.
+ unsupported "gdb does not support gcore on this target"
+ return -1;
+ }
+ -re "Save a core file .*$gdb_prompt $" {
+ pass $test
+ }
+}
+
+if { ! [ runto_main ] } then {
+ untested gcore-shmid0.exp
+ return -1
+}
+
+gdb_breakpoint "initialized"
+gdb_breakpoint "unresolved"
+
+set oldtimeout $timeout
+set timeout [expr $oldtimeout + 120]
+
+set test "Continue to initialized."
+gdb_test_multiple "continue" $test {
+ -re "Breakpoint .*, initialized .* at .*\r\n$gdb_prompt $" {
+ pass $test
+ }
+ -re "Breakpoint .*, unresolved .* at .*\r\n$gdb_prompt $" {
+ set timeout $oldtimeout
+ unsupported $test
+ return -1
+ }
+}
+set timeout $oldtimeout
+
+set escapedfilename [string_to_regexp [standard_output_file gcore-shmid0.test]]
+
+set test "save a corefile"
+gdb_test_multiple "gcore [standard_output_file gcore-shmid0.test]" $test {
+ -re "Saved corefile ${escapedfilename}\[\r\n\]+$gdb_prompt $" {
+ pass $test
+ }
+ -re "Can't create a corefile\[\r\n\]+$gdb_prompt $" {
+ unsupported $test
+ }
+}
+
+# Be sure to remove the handle first.
+# But it would get removed even on a kill by GDB as the handle is already
+# deleted, just it is still attached.
+gdb_continue_to_end "finish"
+
+set test "core-file command"
+gdb_test_multiple "core-file [standard_output_file gcore-shmid0.test]" $test {
+ -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 .*\r\n\#0 .*\\\(\\\).*\r\n$gdb_prompt $" {
+ # The filename does not fit there anyway so do not check it.
+ pass $test
+ }
+ -re ".*registers from core file: File in wrong format.* $" {
+ fail "core-file command (could not read registers from core file)"
+ }
+}
+
+set test "backtrace"
+gdb_test_multiple "bt" $test {
+ -re "#0 *initialized \\\(\\\) at .*#1 .* main \\\(.*$gdb_prompt $" {
+ pass $test
+ }
+ -re "#0 *initialized \\\(\\\) at .*Cannot access memory at address .*$gdb_prompt $" {
+ fail $test
+ }
+}

View File

@ -0,0 +1,220 @@
[base]
2007-10-13 Jan Kratochvil <jan.kratochvil@redhat.com>
* linux-nat.c (iterate_over_lwps): Fixed missing LWP initialization for
current INFERIOR_PTID.
2007-10-13 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.base/follow-child.exp, gdb.base/follow-child.c: New files.
Index: gdb-6.6/gdb/doc/observer.texi
===================================================================
--- gdb-6.6.orig/gdb/doc/observer.texi
+++ gdb-6.6/gdb/doc/observer.texi
@@ -119,6 +119,10 @@ when @value{GDBN} calls this observer, t
haven't been loaded yet.
@end deftypefun
+@deftypefun void mourn_inferior (struct target_ops *@var{target})
+@value{GDBN} has just detached from an inferior.
+@end deftypefun
+
@deftypefun void solib_unloaded (struct so_list *@var{solib})
The shared library specified by @var{solib} has been unloaded.
@end deftypefun
Index: gdb-6.6/gdb/linux-nat.c
===================================================================
--- gdb-6.6.orig/gdb/linux-nat.c
+++ gdb-6.6/gdb/linux-nat.c
@@ -803,11 +803,26 @@ iterate_over_lwps (int (*callback) (stru
{
struct lwp_info *lp, *lpnext;
- for (lp = lwp_list; lp; lp = lpnext)
+ if (lwp_list != NULL)
{
- lpnext = lp->next;
+ for (lp = lwp_list; lp; lp = lpnext)
+ {
+ lpnext = lp->next;
+ if ((*callback) (lp, data))
+ return lp;
+ }
+ }
+ else
+ {
+ /* We are calling iterate_over_lwps for a non-threaded program.
+ Initialize the lwp list to the inferior's ptid. */
+ gdb_assert (!is_lwp (inferior_ptid));
+
+ inferior_ptid = BUILD_LWP (GET_PID (inferior_ptid),
+ GET_PID (inferior_ptid));
+ lp = add_lwp (inferior_ptid);
if ((*callback) (lp, data))
- return lp;
+ return lp;
}
return NULL;
@@ -3262,6 +3274,18 @@ linux_nat_add_target (struct target_ops
thread_db_init (t);
}
+/* Observer function for a mourn inferior event. This is needed
+ because if iterate_over_lwps is called for a non-threaded program
+ to handle watchpoints, the lwp list gets initialized but there is
+ no corresponding clean-up when the inferior is detached. In
+ a threaded program, the observer is simply redundant as the
+ same clean-up gets done in linux_nat_mourn_inferior. */
+static void
+linux_nat_mourn_inferior_observer (struct target_ops *objfile)
+{
+ init_lwp_list ();
+}
+
void
_initialize_linux_nat (void)
{
@@ -3276,6 +3300,8 @@ Specify any of the following keywords fo
status -- list a different bunch of random process info.\n\
all -- list all available /proc info."));
+ observer_attach_mourn_inferior (linux_nat_mourn_inferior_observer);
+
/* Save the original signal mask. */
sigprocmask (SIG_SETMASK, NULL, &normal_mask);
Index: gdb-6.6/gdb/target.c
===================================================================
--- gdb-6.6.orig/gdb/target.c
+++ gdb-6.6/gdb/target.c
@@ -40,6 +40,7 @@
#include "gdb_assert.h"
#include "gdbcore.h"
#include "exceptions.h"
+#include "observer.h"
static void target_info (char *, int);
@@ -276,6 +277,13 @@ target_load (char *arg, int from_tty)
(*current_target.to_load) (arg, from_tty);
}
+void
+target_mourn_inferior (void)
+{
+ (*current_target.to_mourn_inferior) ();
+ observer_notify_mourn_inferior (&current_target);
+}
+
static int
nomemory (CORE_ADDR memaddr, char *myaddr, int len, int write,
struct target_ops *t)
Index: gdb-6.6/gdb/target.h
===================================================================
--- gdb-6.6.orig/gdb/target.h
+++ gdb-6.6/gdb/target.h
@@ -891,8 +891,7 @@ int target_follow_fork (int follow_child
/* The inferior process has died. Do what is right. */
-#define target_mourn_inferior() \
- (*current_target.to_mourn_inferior) ()
+extern void target_mourn_inferior (void);
/* Does target have enough data to do a run or attach command? */
diff -u -u -X /home/jkratoch/.diffi.list -rup gdb-6.6-orig/gdb/testsuite/gdb.base/follow-child.c gdb-6.6/gdb/testsuite/gdb.base/follow-child.c
--- gdb-6.6-orig/gdb/testsuite/gdb.base/follow-child.c 2007-10-13 19:24:58.000000000 +0200
+++ gdb-6.6/gdb/testsuite/gdb.base/follow-child.c 2007-10-13 19:11:08.000000000 +0200
@@ -0,0 +1,29 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2007 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+ Please email any bugs, comments, and/or additions to this file to:
+ bug-gdb@prep.ai.mit.edu */
+
+#include <unistd.h>
+
+int main()
+{
+ fork ();
+ sleep (60);
+ return 0;
+}
diff -u -u -X /home/jkratoch/.diffi.list -rup gdb-6.6-orig/gdb/testsuite/gdb.base/follow-child.exp gdb-6.6/gdb/testsuite/gdb.base/follow-child.exp
--- gdb-6.6-orig/gdb/testsuite/gdb.base/follow-child.exp 2007-10-13 19:24:58.000000000 +0200
+++ gdb-6.6/gdb/testsuite/gdb.base/follow-child.exp 2007-10-13 19:24:21.000000000 +0200
@@ -0,0 +1,55 @@
+# Copyright 2007 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+if $tracelevel then {
+ strace $tracelevel
+}
+
+set prms_id 0
+set bug_id 0
+
+set testfile follow-child
+set srcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
+ untested "Couldn't compile test program"
+ return -1
+}
+
+# Get things started.
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+# For C programs, "start" should stop in main().
+
+gdb_test "set follow-fork-mode child" ""
+set test "started"
+# GDB_RUN_CMD already checks for `Starting program:'.
+gdb_run_cmd
+sleep 5
+send_gdb "\003"
+set test "break"
+gdb_test_multiple "" $test {
+ -re "Program received signal SIGINT.*$gdb_prompt $" {
+ pass $test
+ }
+ -re "\\\[New process \[0-9\]+\\\]" {
+ fail $test
+ }
+}

1255
gdb-6.3-pie-20050110.patch Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,28 @@
2004-11-24 Andrew Cagney <cagney@gnu.org>
* printcmd.c (build_address_symbolic): Find a section for the
address.
--- ./gdb/printcmd.c.1 2004-11-24 17:54:27.316295608 -0500
+++ ./gdb/printcmd.c 2004-11-24 17:59:20.069790312 -0500
@@ -615,6 +615,20 @@
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)
+ {
+ struct obj_section *obj_section = find_pc_section (addr);
+ if (obj_section == NULL)
+ section = NULL;
+ else
+ section = obj_section->the_bfd_section;
+ }
/* First try to find the address in the symbol table, then
in the minsyms. Take the closest one. */

View File

@ -0,0 +1,99 @@
2004-10-26 Andrew Cagney <cagney@gnu.org>
* blockframe.c (find_pc_function): Use find_pc_section to find the
pc's section.
* block.c, symfile.c: Ditto.
*** ./gdb/blockframe.c.1 2004-10-26 21:21:46.517866240 -0400
--- ./gdb/blockframe.c 2004-10-26 21:24:16.345089040 -0400
***************
*** 288,294 ****
struct symbol *
find_pc_function (CORE_ADDR pc)
{
! return find_pc_sect_function (pc, find_pc_mapped_section (pc));
}
/* These variables are used to cache the most recent result
--- 288,311 ----
struct symbol *
find_pc_function (CORE_ADDR pc)
{
! struct bfd_section *section;
! struct symbol *symbol;
! /* 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 (pc);
! if (section == NULL)
! {
! struct obj_section *obj_section = find_pc_section (pc);
! if (obj_section == NULL)
! section = NULL;
! else
! section = obj_section->the_bfd_section;
! }
! symbol = find_pc_sect_function (pc, section);
! return symbol;
}
/* These variables are used to cache the most recent result
--- ./gdb/symtab.c.1 2004-10-26 22:47:13.650423616 -0400
+++ ./gdb/symtab.c 2004-10-26 22:50:10.239577984 -0400
@@ -2176,7 +2176,20 @@
{
asection *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 (pc);
+ if (section == NULL)
+ {
+ struct obj_section *obj_section = find_pc_section (pc);
+ if (obj_section == NULL)
+ section = NULL;
+ else
+ section = obj_section->the_bfd_section;
+ }
if (pc_in_unmapped_range (pc, section))
pc = overlay_mapped_address (pc, section);
return find_pc_sect_line (pc, section, notcurrent);
--- ./gdb/block.c.1 2004-10-27 00:22:56.881319808 -0400
+++ ./gdb/block.c 2004-10-27 00:24:17.364084568 -0400
@@ -25,6 +25,7 @@
#include "symfile.h"
#include "gdb_obstack.h"
#include "cp-support.h"
+#include "objfiles.h"
/* This is used by struct block to store namespace-related info for
C++ files, namely using declarations and the current namespace in
@@ -153,7 +154,22 @@
struct block *
block_for_pc (CORE_ADDR pc)
{
- return block_for_pc_sect (pc, find_pc_mapped_section (pc));
+ struct bfd_section *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 (pc);
+ if (section == NULL)
+ {
+ struct obj_section *obj_section = find_pc_section (pc);
+ if (obj_section == NULL)
+ section = NULL;
+ else
+ section = obj_section->the_bfd_section;
+ }
+ return block_for_pc_sect (pc, section);
}
/* Now come some functions designed to deal with C++ namespace issues.

View File

@ -0,0 +1,112 @@
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".
Index: gdb-6.5/gdb/rs6000-tdep.c
===================================================================
--- gdb-6.5.orig/gdb/rs6000-tdep.c 2006-07-11 02:57:24.000000000 -0300
+++ gdb-6.5/gdb/rs6000-tdep.c 2006-07-11 12:32:05.000000000 -0300
@@ -76,6 +76,7 @@
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 */
@@ -905,7 +906,6 @@ store_param_on_stack_p (unsigned long op
static CORE_ADDR
skip_prologue (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];
@@ -923,6 +923,7 @@ skip_prologue (CORE_ADDR pc, CORE_ADDR l
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 (current_gdbarch);
struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
@@ -943,6 +944,7 @@ skip_prologue (CORE_ADDR pc, CORE_ADDR l
lim_pc = refine_prologue_limit (pc, lim_pc);
memset (fdata, 0, sizeof (struct rs6000_framedata));
+ fdata->func_start = pc;
fdata->saved_gpr = -1;
fdata->saved_fpr = -1;
fdata->saved_vr = -1;
@@ -971,6 +973,55 @@ skip_prologue (CORE_ADDR pc, CORE_ADDR l
break;
op = extract_signed_integer (buf, 4);
+ /* 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
@@ -1138,9 +1189,9 @@ skip_prologue (CORE_ADDR pc, CORE_ADDR l
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) || (prologue_sal.line != this_sal.line))

View File

@ -0,0 +1,66 @@
2004-10-22 Andrew Cagney <cagney@gnu.org>
* solib-svr4.c (enable_break): Convert a symbol descriptor into
the corresponding function entry point.
(solib_break_names): Delete "._dl_debug_state", no longer needed.
*** ./gdb/solib-svr4.c.dist Fri Oct 22 11:50:31 2004
--- ./gdb/solib-svr4.c Fri Oct 22 11:53:19 2004
***************
*** 86,102 ****
"_dl_debug_state",
"rtld_db_dlactivity",
"_rtld_debug_state",
-
- /* On the 64-bit PowerPC, the linker symbol with the same name as
- the C function points to a function descriptor, not to the entry
- point. The linker symbol whose name is the C function name
- prefixed with a '.' points to the function's entry point. So
- when we look through this table, we ignore symbols that point
- into the data section (thus skipping the descriptor's symbol),
- and eventually try this one, giving us the real entry point
- address. */
- "._dl_debug_state",
-
NULL
};
--- 86,91 ----
***************
*** 1284,1301 ****
/* Now try to set a breakpoint in the dynamic linker. */
for (bkpt_namep = solib_break_names; *bkpt_namep != NULL; bkpt_namep++)
{
! /* On ABI's that use function descriptors, there are usually
! two linker symbols associated with each C function: one
! pointing at the actual entry point of the machine code,
! and one pointing at the function's descriptor. The
! latter symbol has the same name as the C function.
!
! What we're looking for here is the machine code entry
! point, so we are only interested in symbols in code
! sections. */
! sym_addr = bfd_lookup_symbol (tmp_bfd, *bkpt_namep, SEC_CODE);
if (sym_addr != 0)
! break;
}
/* We're done with both the temporary bfd and target. Remember,
--- 1273,1289 ----
/* Now try to set a breakpoint in the dynamic linker. */
for (bkpt_namep = solib_break_names; *bkpt_namep != NULL; bkpt_namep++)
{
! sym_addr = bfd_lookup_symbol (tmp_bfd, *bkpt_namep, 0);
if (sym_addr != 0)
! {
! /* The symbol might be a descriptor, convert to into the
! corresponding code address. */
! sym_addr = gdbarch_convert_from_func_ptr_addr (current_gdbarch,
! sym_addr,
! tmp_bfd_target);
! if (sym_addr != 0)
! break;
! }
}
/* We're done with both the temporary bfd and target. Remember,

View File

@ -0,0 +1,86 @@
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.
--- gdb-6.3/gdb/doc/gdb.texinfo.fix 2005-09-07 13:32:23.000000000 -0400
+++ gdb-6.3/gdb/doc/gdb.texinfo 2005-09-07 13:33:21.000000000 -0400
@@ -952,6 +952,12 @@ Read each symbol file's entire symbol ta
the default, which is to read it incrementally as it is needed.
This makes startup slower, but makes future operations faster.
+@item --readnever
+@cindex @code{--readnever}
+Do not read each symbol file's symbolic debug information. This makes
+startup faster but at the expense of not being able to perform
+symbolic debugging.
+
@end table
You typically combine the @code{-mapped} and @code{-readnow} options in
--- gdb-6.3/gdb/main.c.fix 2005-09-07 13:31:43.000000000 -0400
+++ gdb-6.3/gdb/main.c 2005-09-07 13:33:21.000000000 -0400
@@ -250,6 +250,7 @@ captured_main (void *data)
{"xdb", no_argument, &xdb_commands, 1},
{"dbx", no_argument, &dbx_commands, 1},
{"readnow", no_argument, &readnow_symbol_files, 1},
+ {"readnever", no_argument, &readnever_symbol_files, 1},
{"r", no_argument, &readnow_symbol_files, 1},
{"quiet", no_argument, &quiet, 1},
{"q", no_argument, &quiet, 1},
@@ -861,6 +862,7 @@ Options:\n\n\
fputs_unfiltered (_(" file.\n\
--quiet Do not print version number on startup.\n\
--readnow Fully read symbol files on first access.\n\
+ --readnever Do not read symbol files.\n\
"), stream);
fputs_unfiltered (_("\
--se=FILE Use FILE as symbol file and executable file.\n\
--- gdb-6.3/gdb/symfile.c.fix 2005-09-07 13:31:48.000000000 -0400
+++ gdb-6.3/gdb/symfile.c 2005-09-07 13:33:21.000000000 -0400
@@ -75,6 +75,7 @@ static void clear_symtab_users_cleanup (
/* Global variables owned by this file */
int readnow_symbol_files; /* Read full symbols immediately */
+int readnever_symbol_files; /* Never read full symbols. */
/* External variables and functions referenced. */
--- gdb-6.3/gdb/dwarf2read.c.fix 2005-09-07 13:31:58.000000000 -0400
+++ gdb-6.3/gdb/dwarf2read.c 2005-09-07 13:34:03.000000000 -0400
@@ -45,6 +45,7 @@
#include "dwarf2loc.h"
#include "cp-support.h"
#include "hashtab.h"
+#include "top.h"
#include "command.h"
#include "gdbcmd.h"
@@ -1100,7 +1101,8 @@ dwarf2_has_info (struct objfile *objfile
dwarf_loc_section = 0;
bfd_map_over_sections (objfile->obfd, dwarf2_locate_sections, NULL);
- return (dwarf_info_section != NULL && dwarf_abbrev_section != NULL);
+ return (!readnever_symbol_files
+ && dwarf_info_section != NULL && dwarf_abbrev_section != NULL);
}
/* This function is mapped across the sections and remembers the
--- gdb-6.3/gdb/top.h.fix 2005-09-07 13:32:08.000000000 -0400
+++ gdb-6.3/gdb/top.h 2005-09-07 13:33:21.000000000 -0400
@@ -57,6 +57,7 @@ extern void set_prompt (char *);
/* From random places. */
extern int readnow_symbol_files;
+extern int readnever_symbol_files;
/* Perform _initialize initialization */
extern void gdb_init (char *);

View File

@ -0,0 +1,29 @@
2004-11-30 Jeff Johnston <jjohnstn@redhat.com>
* breakpoint.c (remove_breakpoints): Continue removing breakpoints
even if an error occurs. Remove a failure code for the last failure
only.
--- gdb+dejagnu-20040607/gdb/breakpoint.c.fix2 Tue Nov 30 18:01:33 2004
+++ gdb+dejagnu-20040607/gdb/breakpoint.c Tue Nov 30 18:06:01 2004
@@ -1297,6 +1297,7 @@ remove_breakpoints (void)
{
struct bp_location *b;
int val;
+ int return_val = 0;
ALL_BP_LOCATIONS (b)
{
@@ -1304,10 +1305,10 @@ remove_breakpoints (void)
{
val = remove_breakpoint (b, mark_uninserted);
if (val != 0)
- return val;
+ return_val = val;
}
}
- return 0;
+ return return_val;
}
int

View File

@ -0,0 +1,28 @@
--- /dev/null 2004-12-02 09:02:32.308608576 -0500
+++ ./gdb/doc/ChangeLog.RedHat 2004-12-02 10:25:01.938353424 -0500
@@ -0,0 +1,11 @@
+2004-12-02 Andrew Cagney <cagney@redhat.com>
+
+ * New file.
+
+
+Local Variables:
+mode: change-log
+left-margin: 8
+fill-column: 74
+version-control: never
+End:
--- /dev/null 2004-12-02 09:02:32.308608576 -0500
+++ ./gdb/ChangeLog.RedHat 2004-12-02 10:45:45.430313912 -0500
@@ -0,0 +1,11 @@
+2004-12-02 Andrew Cagney <cagney@redhat.com>
+
+ * New file.
+
+
+Local Variables:
+mode: change-log
+left-margin: 8
+fill-column: 74
+version-control: never
+End:

View File

@ -0,0 +1,22 @@
2003-07-11 Elena Zannoni <ezannoni@redhat.com>
* lib/gdb.exp (setup_kfail, kfail): Redefine procedures.
--- ./gdb/testsuite/lib/gdb.exp.1 2004-11-24 15:59:46.131394720 -0500
+++ ./gdb/testsuite/lib/gdb.exp 2004-11-24 16:01:06.304206600 -0500
@@ -63,6 +63,15 @@
### Only procedures should come after this point.
+if {![llength [info procs kfail]]} {
+ proc setup_kfail { args } {
+ #setup_xfail args
+ }
+ proc kfail { bugid message } {
+ fail $message
+ }
+}
+
#
# gdb_version -- extract and print the version number of GDB
#

View File

@ -0,0 +1,76 @@
2003-11-17 Elena Zannoni <ezannoni@redhat.com>
From Jeff Johnston <jjohnstn@redhat.com>
* gdb.arch/ia64-libunwind.exp: New file.
* gdb.arch/ia64-libunwind.c: New file.
--- /dev/null Thu Apr 11 10:25:15 2002
+++ gdb+dejagnu-20040223/gdb/testsuite/gdb.arch/ia64-libunwind.exp Mon Nov 17 15:57:04 2003
@@ -0,0 +1,55 @@
+# Copyright 2003 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 Jeff Johnston (jjohnstn@redhat.com)
+
+if $tracelevel then {
+ strace $tracelevel
+}
+
+#
+# test running programs
+#
+set prms_id 0
+set bug_id 0
+
+if ![istarget "ia64-*-*"] then {
+ return
+}
+
+set testfile "ia64-libunwind"
+set srcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-w}] != "" } {
+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+}
+
+if [get_compiler_info ${binfile}] {
+ return -1
+}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+send_gdb "set debug arch 1\n"
+send_gdb "break main\n"
+gdb_test "run" ".*acquire_unwind_info.*"
+
--- /dev/null Thu Apr 11 10:25:15 2002
+++ gdb+dejagnu-20040223/gdb/testsuite/gdb.arch/ia64-libunwind.c Mon Nov 17 15:58:27 2003
@@ -0,0 +1,9 @@
+#include <stdio.h>
+
+int main()
+{
+ printf ("hello world\n");
+
+ return 0;
+}
+

View File

@ -0,0 +1,14 @@
2004-08-03 Jeff Johnston <jjohnstn@redhat.com>
* gdb.arch/ia64-libunwind.exp: Fix test string to match
current code base.
--- gdb+dejagnu-20040607/gdb/testsuite/gdb.arch/ia64-libunwind.exp.fix Tue Aug 3 18:29:22 2004
+++ gdb+dejagnu-20040607/gdb/testsuite/gdb.arch/ia64-libunwind.exp Tue Aug 3 18:41:01 2004
@@ -51,5 +51,5 @@ gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
send_gdb "set debug arch 1\n"
send_gdb "break main\n"
-gdb_test "run" ".*acquire_unwind_info.*"
+gdb_test "run" ".*ia64_find_proc_info_x.*"

View File

@ -1,38 +1,17 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Elena Zannoni <ezannoni@redhat.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-6.3-rh-testversion-20041202.patch
;; Match the Fedora's version info.
;;=fedora
2003-02-24 Elena Zannoni <ezannoni@redhat.com>
* gdb.gdb/selftest.exp: Add matching on specific Red Hat only version
string.
diff --git a/gdb/testsuite/gdb.gdb/selftest.exp b/gdb/testsuite/gdb.gdb/selftest.exp
--- a/gdb/testsuite/gdb.gdb/selftest.exp
+++ b/gdb/testsuite/gdb.gdb/selftest.exp
@@ -53,6 +53,9 @@ proc test_with_self { } {
--- ./gdb/testsuite/gdb.gdb/selftest.exp.1 Fri Jul 11 09:44:09 2003
+++ ./gdb/testsuite/gdb.gdb/selftest.exp Fri Jul 11 09:44:16 2003
@@ -314,7 +314,10 @@ proc test_with_self { executable } {
-re ".\[0-9\]+ = +.+ +0x.*\[0-9.\]+.*$gdb_prompt $" {
pass "printed version with cast"
}
+ -re ".\[0-9\]+ = .(Fedora|Red Hat Enterprise Linux) \[\\(\\)0-9.a-z\\-\]+.*$gdb_prompt $" {
+ pass "printed version Fedora or Red Hat Enterprise Linux only"
+ -re ".\[0-9\]+ = .Red Hat Linux \[\\(\\)0-9.a-z\\-\]+.*$gdb_prompt $" {
+ pass "printed version Red Had Linux only"
+ }
-re ".*$gdb_prompt $" { fail "printed version" }
timeout { fail "(timeout) printed version" }
}
# start the "xgdb" process
diff --git a/gdb/top.c b/gdb/top.c
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -2163,7 +2163,7 @@ init_gdb_version_vars (void)
struct internalvar *major_version_var = create_internalvar ("_gdb_major");
struct internalvar *minor_version_var = create_internalvar ("_gdb_minor");
int vmajor = 0, vminor = 0, vrevision = 0;
- sscanf (version, "%d.%d.%d", &vmajor, &vminor, &vrevision);
+ sscanf (version, "Fedora %d.%d.%d", &vmajor, &vminor, &vrevision);
set_internalvar_integer (major_version_var, vmajor);
set_internalvar_integer (minor_version_var, vminor + (vrevision > 0));
}

View File

@ -0,0 +1,207 @@
2005-06-09 Jeff Johnston <jjohnstn@redhat.com>
* gdb.base/gdbinit.exp: New testcase.
* gdb.base/gdbinit.sample: Sample .gdbinit for gdbinit.exp.
2005-06-08 Daniel Jacobowitz <dan@codesourcery.com>
Jeff Johnston <jjohnstn@redhat.com>
* Makefile.in (cli-cmds.o): Update.
* configure.in: Add check for getuid.
* configure: Regenerated.
* config.in: Ditto.
* main.c (captured_main): Pass -1 to source_command when loading
gdbinit files.
* cli/cli-cmds.c: Include "gdb_stat.h" and <fcntl.h>.
(source_command): Update documentation. Check permissions if
FROM_TTY is -1.
Index: gdb-6.6/gdb/cli/cli-cmds.c
===================================================================
--- gdb-6.6.orig/gdb/cli/cli-cmds.c
+++ gdb-6.6/gdb/cli/cli-cmds.c
@@ -38,6 +38,7 @@
#include "objfiles.h"
#include "source.h"
#include "disasm.h"
+#include "gdb_stat.h"
#include "ui-out.h"
@@ -461,12 +462,31 @@ source_script (char *file, int from_tty)
if (fd == -1)
{
- if (from_tty)
+ if (from_tty > 0)
perror_with_name (file);
else
return;
}
+#ifdef HAVE_GETUID
+ if (from_tty == -1)
+ {
+ struct stat statbuf;
+ if (fstat (fd, &statbuf) < 0)
+ {
+ perror_with_name (file);
+ close (fd);
+ return;
+ }
+ if (statbuf.st_uid != getuid () || (statbuf.st_mode & S_IWOTH))
+ {
+ warning (_("not using untrusted file \"%s\""), file);
+ close (fd);
+ return;
+ }
+ }
+#endif
+
stream = fdopen (fd, FOPEN_RT);
script_from_file (stream, file);
Index: gdb-6.6/gdb/testsuite/gdb.base/gdbinit.exp
===================================================================
--- /dev/null
+++ gdb-6.6/gdb/testsuite/gdb.base/gdbinit.exp
@@ -0,0 +1,98 @@
+# Copyright 2005
+# 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 Jeff Johnston <jjohnstn@redhat.com>.
+
+if $tracelevel then {
+ strace $tracelevel
+}
+
+set prms_id 0
+set bug_id 0
+
+# are we on a target board
+if [is_remote target] {
+ return
+}
+
+
+global verbose
+global GDB
+global GDBFLAGS
+global gdb_prompt
+global timeout
+global gdb_spawn_id;
+
+gdb_stop_suppressing_tests;
+
+verbose "Spawning $GDB -nw"
+
+if [info exists gdb_spawn_id] {
+ return 0;
+}
+
+if ![is_remote host] {
+ if { [which $GDB] == 0 } then {
+ perror "$GDB does not exist."
+ exit 1
+ }
+}
+
+set env(HOME) [pwd]
+remote_exec build "rm .gdbinit"
+remote_exec build "cp ${srcdir}/${subdir}/gdbinit.sample .gdbinit"
+remote_exec build "chmod 646 .gdbinit"
+
+set res [remote_spawn host "$GDB -nw [host_info gdb_opts]"];
+if { $res < 0 || $res == "" } {
+ perror "Spawning $GDB failed."
+ return 1;
+}
+gdb_expect 360 {
+ -re "warning: not using untrusted file.*\.gdbinit.*\[\r\n\]$gdb_prompt $" {
+ pass "untrusted .gdbinit caught."
+ }
+ -re "$gdb_prompt $" {
+ fail "untrusted .gdbinit caught."
+ }
+ timeout {
+ fail "(timeout) untrusted .gdbinit caught."
+ }
+}
+
+remote_exec build "chmod 644 .gdbinit"
+set res [remote_spawn host "$GDB -nw [host_info gdb_opts]"];
+if { $res < 0 || $res == "" } {
+ perror "Spawning $GDB failed."
+ return 1;
+}
+gdb_expect 360 {
+ -re "warning: not using untrusted file.*\.gdbinit.*\[\r\n\]$gdb_prompt $" {
+ fail "trusted .gdbinit allowed."
+ }
+ -re "in gdbinit.*$gdb_prompt $" {
+ pass "trusted .gdbinit allowed."
+ }
+ timeout {
+ fail "(timeout) trusted .gdbinit allowed."
+ }
+}
+
+remote_exec build "rm .gdbinit"
Index: gdb-6.6/gdb/testsuite/gdb.base/gdbinit.sample
===================================================================
--- /dev/null
+++ gdb-6.6/gdb/testsuite/gdb.base/gdbinit.sample
@@ -0,0 +1 @@
+echo "\nin gdbinit"
Index: gdb-6.6/gdb/main.c
===================================================================
--- gdb-6.6.orig/gdb/main.c
+++ gdb-6.6/gdb/main.c
@@ -644,7 +644,7 @@ extern int gdbtk_test (char *);
if (!inhibit_gdbinit)
{
- catch_command_errors (source_script, homeinit, 0, RETURN_MASK_ALL);
+ catch_command_errors (source_script, homeinit, -1, RETURN_MASK_ALL);
}
/* Do stats; no need to do them elsewhere since we'll only
@@ -722,7 +722,7 @@ extern int gdbtk_test (char *);
|| memcmp ((char *) &homebuf, (char *) &cwdbuf, sizeof (struct stat)))
if (!inhibit_gdbinit)
{
- catch_command_errors (source_script, gdbinit, 0, RETURN_MASK_ALL);
+ catch_command_errors (source_script, gdbinit, -1, RETURN_MASK_ALL);
}
for (i = 0; i < ncmd; i++)
Index: gdb-6.6/gdb/Makefile.in
===================================================================
--- gdb-6.6.orig/gdb/Makefile.in
+++ gdb-6.6/gdb/Makefile.in
@@ -2927,7 +2927,7 @@ cli-cmds.o: $(srcdir)/cli/cli-cmds.c $(d
$(expression_h) $(frame_h) $(value_h) $(language_h) $(filenames_h) \
$(objfiles_h) $(source_h) $(disasm_h) $(ui_out_h) $(top_h) \
$(cli_decode_h) $(cli_script_h) $(cli_setshow_h) $(cli_cmds_h) \
- $(tui_h)
+ $(tui_h) $(gdb_stat_h)
$(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/cli/cli-cmds.c
cli-decode.o: $(srcdir)/cli/cli-decode.c $(defs_h) $(symtab_h) \
$(gdb_regex_h) $(gdb_string_h) $(completer_h) $(ui_out_h) \

View File

@ -0,0 +1,85 @@
2005-04-02 Andrew Cagney <cagney@gnu.org>
* symfile.c (separate_debug_file_exists): When the CRCs mismatch
print a warning.
(find_separate_debug_file): Pass in the objfile's name.
--- ../gdb-6.3/./gdb/symfile.c 2005-04-02 16:02:22.000000000 -0500
+++ ./gdb/symfile.c 2005-04-02 13:05:10.000000000 -0500
@@ -1043,7 +1043,8 @@
}
static int
-separate_debug_file_exists (const char *name, unsigned long crc)
+separate_debug_file_exists (const char *name, unsigned long crc,
+ const char *parent_name)
{
unsigned long file_crc = 0;
int fd;
@@ -1052,6 +1053,12 @@
fd = open (name, O_RDONLY | O_BINARY);
if (fd < 0)
+ /* Fail silently, this preserves existing behavior. The
+ assumption here is that the file wasn't found because there's
+ no file to find (we shouldn't be printing warnings about
+ missing debug info files when the user hasn't installed them).
+ The alternative is to complain here - that better belongs in a
+ warning. */
return 0;
while ((count = read (fd, buffer, sizeof (buffer))) > 0)
@@ -1059,7 +1066,16 @@
close (fd);
- return crc == file_crc;
+ if (crc != file_crc)
+ {
+ warning (_("the debug information found in \"%s\""
+ " does not match \"%s\" (CRC mismatch).\n"),
+ name, parent_name);
+ return 0;
+ }
+
+ /* No worries! */
+ return 1;
}
static char *debug_file_directory = NULL;
@@ -1083,6 +1099,8 @@
basename = get_debug_link_info (objfile, &crc32);
if (basename == NULL)
+ /* There's no separate debug info, hence there's no way we could
+ load it => no warning. */
return NULL;
dir = xstrdup (objfile->name);
@@ -1110,7 +1128,7 @@
strcpy (debugfile, dir);
strcat (debugfile, basename);
- if (separate_debug_file_exists (debugfile, crc32))
+ if (separate_debug_file_exists (debugfile, crc32, objfile->name))
{
xfree (basename);
xfree (dir);
@@ -1123,7 +1141,7 @@
strcat (debugfile, "/");
strcat (debugfile, basename);
- if (separate_debug_file_exists (debugfile, crc32))
+ if (separate_debug_file_exists (debugfile, crc32, objfile->name))
{
xfree (basename);
xfree (dir);
@@ -1136,7 +1154,7 @@
strcat (debugfile, dir);
strcat (debugfile, basename);
- if (separate_debug_file_exists (debugfile, crc32))
+ if (separate_debug_file_exists (debugfile, crc32, objfile->name))
{
xfree (basename);
xfree (dir);

View File

@ -0,0 +1,58 @@
2004-06-21 Andrew Cagney <cagney@gnu.org>
* i386-tdep.c (i386_gdbarch_init): Move the the dwarf2-frame
sniffer registration to after the signal trampoline frame sniffer.
* amd64-tdep.c (amd64_init_abi): Include "dwarf2-frame.h".
Register the dwarf2-frame sniffer, but after the signal trampoline
sniffer.
Index: ./gdb/amd64-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/amd64-tdep.c,v
retrieving revision 1.15
diff -p -u -r1.15 amd64-tdep.c
--- ./gdb/amd64-tdep.c 7 Jun 2004 02:02:45 -0000 1.15
+++ ./gdb/amd64-tdep.c 21 Jun 2004 20:16:34 -0000
@@ -34,7 +34,7 @@
#include "regcache.h"
#include "regset.h"
#include "symfile.h"
-
+#include "dwarf2-frame.h"
#include "gdb_assert.h"
#include "amd64-tdep.h"
@@ -1171,6 +1171,8 @@ amd64_init_abi (struct gdbarch_info info
set_gdbarch_in_solib_call_trampoline (gdbarch, in_plt_section);
frame_unwind_append_sniffer (gdbarch, amd64_sigtramp_frame_sniffer);
+ /* Hook in the DWARF CFI frame unwinder after sigtramp. */
+ frame_unwind_append_sniffer (gdbarch, dwarf2_frame_sniffer);
frame_unwind_append_sniffer (gdbarch, amd64_frame_sniffer);
frame_base_set_default (gdbarch, &amd64_frame_base);
Index: ./gdb/i386-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/i386-tdep.c,v
retrieving revision 1.197
diff -p -u -r1.197 i386-tdep.c
--- ./gdb/i386-tdep.c 18 Jun 2004 16:06:24 -0000 1.197
+++ ./gdb/i386-tdep.c 21 Jun 2004 20:16:34 -0000
@@ -2131,15 +2131,14 @@ i386_gdbarch_init (struct gdbarch_info i
/* Helper for function argument information. */
set_gdbarch_fetch_pointer_argument (gdbarch, i386_fetch_pointer_argument);
- /* Hook in the DWARF CFI frame unwinder. */
- frame_unwind_append_sniffer (gdbarch, dwarf2_frame_sniffer);
-
frame_base_set_default (gdbarch, &i386_frame_base);
/* Hook in ABI-specific overrides, if they have been registered. */
gdbarch_init_osabi (info, gdbarch);
frame_unwind_append_sniffer (gdbarch, i386_sigtramp_frame_sniffer);
+ /* Hook in the DWARF CFI frame unwinder after sigtramp. */
+ frame_unwind_append_sniffer (gdbarch, dwarf2_frame_sniffer);
frame_unwind_append_sniffer (gdbarch, i386_frame_sniffer);
/* If we have a register mapping, enable the generic core file

View File

@ -0,0 +1,178 @@
2005-02-11 Jeff Johnston <jjohnstn@redhat.com>
* testsuite/gdb.threads/step-thread-exit.c: New testcase.
* testsuite/gdb.threads/step-thread-exit.exp: Ditto.
Index: gdb-6.5/gdb/testsuite/gdb.threads/step-thread-exit.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-6.5/gdb/testsuite/gdb.threads/step-thread-exit.c 2006-07-12 03:18:47.000000000 -0300
@@ -0,0 +1,50 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2005 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. */
+
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+void *thread_function (void *ptr)
+{
+ int *x = (int *)ptr;
+ printf("In thread_function, *x is %d\n", *x);
+} /* thread_function_end */
+
+volatile int repeat = 0;
+
+main()
+{
+ int ret;
+ pthread_t th;
+ int i = 3;
+
+ ret = pthread_create (&th, NULL, thread_function, &i);
+ do
+ {
+ repeat = 0;
+ sleep (3); /* sleep */
+ }
+ while (repeat);
+ pthread_join (th, NULL);
+ return 0;
+}
+
+
Index: gdb-6.5/gdb/testsuite/gdb.threads/step-thread-exit.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-6.5/gdb/testsuite/gdb.threads/step-thread-exit.exp 2006-07-12 03:22:30.000000000 -0300
@@ -0,0 +1,113 @@
+# This testcase is part of GDB, the GNU debugger.
+
+# Copyright 2005 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.
+
+# Check that GDB can step over a thread exit.
+
+if $tracelevel {
+ strace $tracelevel
+}
+
+set prms_id 0
+set bug_id 0
+
+set testfile "step-thread-exit"
+set srcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug "incdir=${objdir}"]] != "" } {
+ return -1
+}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+# Reset the debug file directory so we can't debug within the C library
+gdb_test "set debug-file-directory ." "" ""
+
+#
+# Run to `main' where we begin our tests.
+#
+
+if ![runto_main] then {
+ gdb_suppress_tests
+}
+
+set sleep_line [expr [gdb_get_line_number "sleep"]]
+set end_line [expr [gdb_get_line_number "thread_function_end"]]
+
+gdb_breakpoint "$end_line"
+gdb_test "continue" "Break.*thread_function.*" "continue to thread_function 1"
+
+# Keep nexting until we cause the thread to exit. We expect the main
+# thread to be stopped and a message printed to tell us we have stepped
+# over the thread exit.
+set test "step over thread exit 1"
+gdb_test_multiple "next" "$test" {
+ -re "\}.*$gdb_prompt $" {
+ send_gdb "next\n"
+ exp_continue
+ }
+ -re "Stepped over thread exit.*Program received signal SIGSTOP.*$gdb_prompt $" {
+ pass "$test"
+ }
+ -re "start_thread.*$gdb_prompt $" {
+ send_gdb "next\n"
+ exp_continue
+ }
+}
+
+gdb_test "bt" ".*sleep.*main.*$sleep_line.*" "backtrace after step 1"
+
+runto_main
+gdb_breakpoint "$sleep_line"
+gdb_breakpoint "$end_line"
+set test "continue to thread_function 2"
+gdb_test_multiple "continue" "$test" {
+ -re "Break.*thread_function.*$gdb_prompt $" {
+ pass $test
+ }
+ -re "Break.*$sleep_line.*$gdb_prompt $" {
+ gdb_test "set repeat=1" "" ""
+ send_gdb "continue\n"
+ exp_continue
+ }
+}
+
+# Keep nexting until we cause the thread to exit. In this case, we
+# expect the breakpoint in the main thread to have already triggered
+# and so we should stop there with a message that we stepped over
+# the thread exit.
+set test "step over thread exit 2"
+gdb_test_multiple "next" "$test" {
+ -re "\}.*$gdb_prompt $" {
+ send_gdb "next\n"
+ exp_continue
+ }
+ -re "Stepped over thread exit.*Break.*$sleep_line.*$gdb_prompt $" {
+ pass "$test (breakpoint hit)"
+ }
+ -re "Stepped over thread exit.*$gdb_prompt $" {
+ pass "$test (breakpoint not hit)"
+ }
+ -re "start_thread.*$gdb_prompt $" {
+ send_gdb "next\n"
+ exp_continue
+ }
+}
+

View File

@ -0,0 +1,24 @@
2005-02-14 Jeff Johnston <jjohnstn@redhat.com>
* top.c (gdb_readline_wrapper): Ensure terminal is gdb's before calling
readline.
Index: gdb-6.5/gdb/top.c
===================================================================
--- gdb-6.5.orig/gdb/top.c 2006-03-29 19:53:33.000000000 -0300
+++ gdb-6.5/gdb/top.c 2006-07-07 02:29:42.000000000 -0300
@@ -728,6 +728,14 @@ gdb_readline_wrapper (char *prompt)
after_char_processing_hook = NULL;
}
+ /* Before calling readline, ensure we have the terminal. If we don't
+ have the terminal and call readline, we risk the possibility of
+ gdb being thrown into the background. This problem occurs when
+ we attach to a background process on the same terminal the background
+ process was started from and then perform some action which requires
+ a page break prompt. */
+ terminal_ours ();
+
return readline (prompt);
}

View File

@ -1,15 +1,29 @@
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.3-test-dtorfix-20050121.patch
Index: gdb/testsuite/ChangeLog
2005-01-21 Jeff Johnston <jjohnstn@redhat.com>
;; Test support of multiple destructors just like multiple constructors
;;=fedoratest
* gdb.cp/constructortest.exp: New test.
* gdb.cp/constructortest.cc: Ditto.
* gdb.cp/templates.exp: Change break of dtor to be fully quoted.
diff --git a/gdb/testsuite/gdb.cp/constructortest.cc b/gdb/testsuite/gdb.cp/constructortest.cc
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.cp/constructortest.cc
2007-09-22 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.cp/constructortest.exp, gdb.cp/constructortest.cc: Test also the
`$delete' destructor variant.
2007-09-25 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.cp/constructortest.exp: Delete the FIXME workaround of restarting
the whole GDB.
2007-10-05 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.cp/constructortest.exp: Test BREAKPOINT_RE_SET for multiple PCs
by PIE.
* gdb.cp/constructortest.exp: Handle the change of settings breakpoints
always at all the ctor/dtor variants.
--- gdb-6.3/gdb/testsuite/gdb.cp/constructortest.cc.fix Fri Jan 21 17:06:56 2005
+++ gdb-6.3/gdb/testsuite/gdb.cp/constructortest.cc Fri Jan 21 17:05:18 2005
@@ -0,0 +1,99 @@
+/* This testcase is part of GDB, the GNU debugger.
+
@ -110,11 +124,9 @@ new file mode 100644
+{
+ y = 2; /* First line D */
+}
diff --git a/gdb/testsuite/gdb.cp/constructortest.exp b/gdb/testsuite/gdb.cp/constructortest.exp
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.cp/constructortest.exp
@@ -0,0 +1,130 @@
--- gdb-6.3/gdb/testsuite/gdb.cp/constructortest.exp.fix Fri Jan 21 17:07:02 2005
+++ gdb-6.3/gdb/testsuite/gdb.cp/constructortest.exp Fri Jan 21 17:05:29 2005
@@ -0,0 +1,148 @@
+# This testcase is part of GDB, the GNU debugger.
+
+# Copyright 2005, 2007 Free Software Foundation, Inc.
@ -135,9 +147,16 @@ new file mode 100644
+
+# Check that GDB can break at multiple forms of constructors.
+
+if $tracelevel {
+ strace $tracelevel
+}
+
+set prms_id 0
+set bug_id 0
+
+set testfile "constructortest"
+set srcfile ${testfile}.cc
+set binfile [standard_output_file ${testfile}]
+set binfile ${objdir}/${subdir}/${testfile}
+# PIE is required for testing proper BREAKPOINT_RE_SET of the multiple-PC
+# breakpoints.
+if {[gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++ "additional_flags=-fpie -pie"}] != "" } {
@ -157,9 +176,14 @@ new file mode 100644
+ gdb_suppress_tests
+}
+
+# Break on the various forms of the A::A constructor.
+# " (2 locations)" is displayed depending on G++ version.
+gdb_test "break A\:\:A" "Breakpoint 2 at .*" "breaking on A::A"
+# Break on the various forms of the A::A constructor
+gdb_test_multiple "break A\:\:A" "breaking on A::A" {
+ -re "0. cancel.*\[\r\n\]*.1. all.*\[\r\n\]*.2. A::A\\(\\) at .*\[\r\n\]*.3. A::A\\\$base\\(\\) at .*\[\r\n\]*> $" {
+ gdb_test "1" \
+ ".*Multiple breakpoints were set.*" \
+ "break on multiple constructors"
+ }
+}
+
+# Verify that we break for the A constructor two times
+# Once for new A and once for new B
@ -170,6 +194,7 @@ new file mode 100644
+
+# Now do the same for destructors
+gdb_test "break 'A::~A()'" ""
+gdb_test "break 'A::~A\$base()'" ""
+
+# Verify that we break for the A destructor two times
+# Once for delete a and once for delete b
@ -185,8 +210,7 @@ new file mode 100644
+gdb_test "break 'A::A()'" "" "break in constructor A 2"
+gdb_continue_to_breakpoint "First line A"
+set second_line [gdb_get_line_number "Second line A"]
+# " (2 locations)" is displayed depending on G++ version.
+gdb_test "break $second_line" "Breakpoint .*, line $second_line\\..*" "break by line in constructor"
+gdb_test "break $second_line" ".*$second_line.*$second_line.*Multiple breakpoints were set.*" "break by line in constructor"
+gdb_continue_to_breakpoint "Second line A"
+gdb_test "bt" "#0.*A.*#1.*main.*" "Verify in in-charge A::A second line"
+gdb_continue_to_breakpoint "Second line A"
@ -197,8 +221,7 @@ new file mode 100644
+gdb_test "break 'A::~A()'" "" "break in constructor ~A 2"
+gdb_continue_to_breakpoint "First line ~A"
+set second_line_dtor [gdb_get_line_number "Second line ~A"]
+# " (2 locations)" is displayed depending on G++ version.
+gdb_test "break $second_line_dtor" "Breakpoint .*, line $second_line_dtor\\..*" "break by line in destructor"
+gdb_test "break $second_line_dtor" ".*$second_line_dtor.*$second_line_dtor.*Multiple breakpoints were set.*" "break by line in destructor"
+gdb_continue_to_breakpoint "Second line ~A"
+gdb_test "bt" "#0.*A.*#1.*main.*" "Verify in in-charge A::~A second line"
+# FIXME: Analyse this case better.
@ -213,11 +236,18 @@ new file mode 100644
+gdb_load ${binfile}
+runto_main
+
+set first_line_dtor [gdb_get_line_number "First line ~C"]
+set define_line_dtor [gdb_get_line_number "Destructor C"]
+# Break on the various forms of the C::~C destructor
+# " ([23] locations)" is displayed depending on G++ version.
+gdb_test "break C\:\:~C" "Breakpoint .*: C::~C\\. \\(2 locations\\)" "breaking on C::~C"
+set test "breaking on C::~C"
+gdb_test_multiple "break C\:\:~C" $test {
+ -re "0. cancel.*\[\r\n\]*.1. all.*\[\r\n\]*.2. C::~C\\(\\) at .*\[\r\n\]*.3. C::~C\\\$base\\(\\) at .*\[\r\n\]*4. C::~C\\\$delete\\(\\) at .*\[\r\n\]*> $" {
+ gdb_test "1" \
+ ".*Multiple breakpoints were set.*" \
+ "break on multiple constructors"
+ }
+ -re "0. cancel.*\[\r\n\]*.1. all.*\[\r\n\]*> $" {
+ fail $test
+ }
+}
+gdb_continue_to_breakpoint "First line ~C"
+
+# Verify that we can break by line number in a destructor and find
@ -226,8 +256,8 @@ new file mode 100644
+gdb_load ${binfile}
+delete_breakpoints
+
+# " (3 locations)" is displayed depending on G++ version.
+gdb_test "break $first_line_dtor" "Breakpoint .*, line $first_line_dtor\\..*" "break by line in destructor"
+set first_line_dtor [gdb_get_line_number "First line ~C"]
+gdb_test "break $first_line_dtor" ".*$first_line_dtor.*$first_line_dtor.*Multiple breakpoints were set.*" "break by line in destructor"
+
+# Run to `main' where we begin our tests.
+# Set the breakpoints first to test PIE multiple-PC BREAKPOINT_RE_SET.
@ -245,3 +275,20 @@ new file mode 100644
+}
+
+gdb_continue_to_breakpoint "First line ~C"
--- gdb-6.3/gdb/testsuite/gdb.cp/templates.exp.fix Fri Jan 21 17:07:10 2005
+++ gdb-6.3/gdb/testsuite/gdb.cp/templates.exp Fri Jan 21 17:09:09 2005
@@ -1,4 +1,4 @@
-# Copyright 1992, 1994, 1995, 1996, 1997, 1999, 2000, 2002, 2003, 2004
+# Copyright 1992, 1994, 1995, 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005
# Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
@@ -142,7 +142,7 @@ proc test_template_breakpoints {} {
# See CLLbs14792
if {$hp_aCC_compiler} {setup_xfail hppa*-*-* CLLbs14792}
- gdb_test_multiple "break T5<int>::~T5" "destructor_breakpoint" {
+ gdb_test_multiple "break 'T5<int>::~T5()'" "destructor_breakpoint" {
-re "Breakpoint.*at.* file .*${testfile}.cc, line.*$gdb_prompt $"
{
pass "destructor breakpoint"

View File

@ -1,23 +1,12 @@
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-movedir-20050125.patch
;; Fix to support executable moving
;;=fedoratest
2005-01-25 Elena Zannoni <ezannoni@redhat.com>
* gdb.base/move-dir.exp: New test.
* gdb.base/move-dir.c: Ditto.
* gdb.base/move-dir.h: Ditto.
diff --git a/gdb/testsuite/gdb.base/move-dir.c b/gdb/testsuite/gdb.base/move-dir.c
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/move-dir.c
@@ -0,0 +1,10 @@
+#include <stdio.h>
--- gdb-6.3/gdb/testsuite/gdb.base/move-dir.c.fix Tue Jan 25 19:13:14 2005
+++ gdb-6.3/gdb/testsuite/gdb.base/move-dir.c Tue Jan 25 19:12:40 2005
@@ -0,0 +1,9 @@
+#include <stdlib.h>
+#include "move-dir.h"
+
@ -27,11 +16,9 @@ new file mode 100644
+ other();
+}
+
diff --git a/gdb/testsuite/gdb.base/move-dir.exp b/gdb/testsuite/gdb.base/move-dir.exp
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/move-dir.exp
@@ -0,0 +1,57 @@
--- gdb-6.3/gdb/testsuite/gdb.base/move-dir.exp.fix Tue Jan 25 19:13:21 2005
+++ gdb-6.3/gdb/testsuite/gdb.base/move-dir.exp Tue Jan 25 19:12:40 2005
@@ -0,0 +1,67 @@
+# Copyright 2005
+# Free Software Foundation, Inc.
+
@ -49,20 +36,30 @@ new file mode 100644
+# 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
+
+if $tracelevel then {
+ strace $tracelevel
+}
+
+set prms_id 0
+set bug_id 0
+
+set testfile "move-dir"
+set srcfile ${testfile}.c
+set incfile ${testfile}.h
+set binfile [standard_output_file ${testfile}]
+set binfile ${objdir}/${subdir}/${testfile}
+
+set testdir [standard_output_file incdir]
+set testdir "${objdir}/${subdir}/incdir"
+
+remote_exec build "mkdir $testdir"
+remote_exec build "cp ${srcdir}/${subdir}/${srcfile} [standard_output_file ${srcfile}]"
+remote_exec build "cp ${srcdir}/${subdir}/${incfile} [standard_output_file ${incfile}]"
+remote_exec build "cp ${srcdir}/${subdir}/${srcfile} ${objdir}/${subdir}"
+remote_exec build "cp ${srcdir}/${subdir}/${incfile} ${testdir}"
+
+set additional_flags "additional_flags=-I${subdir}/incdir"
+
+if { [gdb_compile [standard_output_file ${srcfile}] "${binfile}" executable [list debug $additional_flags]] != "" } {
+if { [gdb_compile "${objdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug $additional_flags]] != "" } {
+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+}
+
@ -89,10 +86,8 @@ new file mode 100644
+
+set timeout $oldtimeout
+return 0
diff --git a/gdb/testsuite/gdb.base/move-dir.h b/gdb/testsuite/gdb.base/move-dir.h
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/move-dir.h
--- gdb-6.3/gdb/testsuite/gdb.base/move-dir.h.fix Tue Jan 25 19:17:50 2005
+++ gdb-6.3/gdb/testsuite/gdb.base/move-dir.h Tue Jan 25 19:19:20 2005
@@ -0,0 +1,7 @@
+#include <stdlib.h>
+

File diff suppressed because it is too large Load Diff

View File

@ -1,11 +1,3 @@
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
@ -14,29 +6,88 @@ Subject: gdb-6.3-test-self-20050110.patch
* 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
@@ -152,18 +152,18 @@ proc do_self_tests {function body} {
}
--- gdb-6.3/gdb/testsuite/gdb.gdb/complaints.exp.fix Mon Jan 10 19:21:20 2005
+++ gdb-6.3/gdb/testsuite/gdb.gdb/complaints.exp Mon Jan 10 19:24:38 2005
@@ -304,13 +304,13 @@ proc find_gdb { arg } {
set GDB_FULLPATH [find_gdb $GDB]
# Remove any old copy lying around.
- remote_file host delete $xgdb
+ #remote_file host delete $xgdb
# Remove any old copy lying around.
-remote_file host delete x$tool
+#remote_file host delete x$tool
gdb_start
- set file [remote_download host $GDB_FULLPATH $xgdb]
+ #set file [remote_download host $GDB_FULLPATH $xgdb]
gdb_start
- set result [selftest_setup $file $function]
+ set result [selftest_setup $GDB_FULLPATH $function]
if {$result == 0} then {
set result [uplevel $body]
}
-set file [remote_download host $GDB_FULLPATH x$tool]
+#set file [remote_download host $GDB_FULLPATH x$tool]
gdb_exit
- catch "remote_file host delete $file"
+ #catch "remote_file host delete $file"
-set setup_result [setup_test $file ]
+set setup_result [setup_test $GDB_FULLPATH ]
if {$setup_result <0} then {
return -1
}
@@ -321,4 +321,4 @@ test_short_complaints
test_empty_complaints
if {$result < 0} then {
warning "Couldn't test self"
gdb_exit;
-catch "remote_file host delete $file";
+#catch "remote_file host delete $file";
--- gdb-6.3/gdb/testsuite/gdb.gdb/observer.exp.fix Mon Jan 10 19:21:27 2005
+++ gdb-6.3/gdb/testsuite/gdb.gdb/observer.exp Mon Jan 10 19:24:38 2005
@@ -259,13 +259,13 @@ proc find_gdb { arg } {
set GDB_FULLPATH [find_gdb $GDB]
# Remove any old copy lying around.
-remote_file host delete x$tool
+#remote_file host delete x$tool
gdb_start
-set file [remote_download host $GDB_FULLPATH x$tool]
-set result [test_observer_normal_stop $file];
+#set file [remote_download host $GDB_FULLPATH x$tool]
+set result [test_observer_normal_stop $GDB_FULLPATH];
gdb_exit;
-catch "remote_file host delete $file";
+#catch "remote_file host delete $file";
if {$result <0} then {
warning "Couldn't test self"
--- gdb-6.3/gdb/testsuite/gdb.gdb/selftest.exp.fix Mon Jan 10 19:21:33 2005
+++ gdb-6.3/gdb/testsuite/gdb.gdb/selftest.exp Mon Jan 10 19:24:38 2005
@@ -512,13 +512,13 @@ proc find_gdb { arg } {
set GDB_FULLPATH [find_gdb $GDB]
# Remove any old copy lying around.
-remote_file host delete x$tool
+#remote_file host delete x$tool
gdb_start
-set file [remote_download host $GDB_FULLPATH x$tool]
-set result [test_with_self $file];
+#set file [remote_download host $GDB_FULLPATH x$tool]
+set result [test_with_self $GDB_FULLPATH];
gdb_exit;
-catch "remote_file host delete $file";
+#catch "remote_file host delete $file";
if {$result <0} then {
warning "Couldn't test self"
--- gdb-6.3/gdb/testsuite/gdb.gdb/xfullpath.exp.fix Mon Jan 10 19:21:40 2005
+++ gdb-6.3/gdb/testsuite/gdb.gdb/xfullpath.exp Mon Jan 10 19:24:38 2005
@@ -181,13 +181,13 @@ proc find_gdb { arg } {
set GDB_FULLPATH [find_gdb $GDB]
# Remove any old copy lying around.
-remote_file host delete x$tool
+#remote_file host delete x$tool
gdb_start
-set file [remote_download host $GDB_FULLPATH x$tool]
-set result [test_with_self $file];
+#set file [remote_download host $GDB_FULLPATH x$tool]
+set result [test_with_self $GDB_FULLPATH];
gdb_exit;
-catch "remote_file host delete $file";
+#catch "remote_file host delete $file";
if {$result <0} then {
warning "Couldn't test self"

View File

@ -0,0 +1,55 @@
Index: gdb-6.6/gdb/testsuite/gdb.base/sepdebug.exp
===================================================================
--- gdb-6.6.orig/gdb/testsuite/gdb.base/sepdebug.exp 2006-10-17 22:17:45.000000000 +0200
+++ gdb-6.6/gdb/testsuite/gdb.base/sepdebug.exp 2007-01-20 18:39:26.000000000 +0100
@@ -953,3 +953,40 @@ if [istarget "*-*-vxworks*"] {
send_gdb "set args main\n"
gdb_expect -re ".*$gdb_prompt $" {}
}
+
+
+# Compile up a second, different, object file. Copy its debug info
+# over the top of the new debug info. Note that somewhere in the
+# above the "set debug-file-directory" variable is set to
+# ${objdir}/${subdir} so need to move things there.
+
+set existing_binfile $binfile
+set testfile "sepdebug2"
+set srcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}
+set corrupt_debug_file [separate_debug_filename $binfile]
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-w}] != "" } {
+ return -1
+}
+if [gdb_gnu_strip_debug $binfile] {
+ # check that you have a recent version of strip and objcopy installed
+ unsupported "cannot produce separate debug info files"
+ return -1
+}
+remote_exec build "cp $corrupt_debug_file ${existing_binfile}.debug"
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+set test "A corrupt debug file gets a warning"
+gdb_test_multiple "file $existing_binfile" "$test" {
+ -re "warning:.*mismatch.*" {
+ pass "$test"
+ }
+ -re ".y or n. " {
+ send_gdb "y\n"
+ exp_continue
+ }
+}
Index: gdb-6.6/gdb/testsuite/gdb.base/sepdebug2.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-6.6/gdb/testsuite/gdb.base/sepdebug2.c 2007-01-20 18:41:35.000000000 +0100
@@ -0,0 +1,5 @@
+int
+main (int argc, char *argv[], char *envp[])
+{
+ return 0;
+}

File diff suppressed because it is too large Load Diff

View File

@ -1,11 +1,3 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Jeff Johnston <jjohnstn@redhat.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-6.3-threaded-watchpoints2-20050225.patch
;; Test sibling threads to set threaded watchpoints for x86 and x86-64
;;=fedoratest
2005-02-28 Jeff Johnston <jjohnstn@redhat.com>
* config/i386/nm-linux.h: Change dr register routines to
@ -40,20 +32,171 @@ Subject: gdb-6.3-threaded-watchpoints2-20050225.patch
(amd64_linux_hw_breakpoint, amd64_linux_remove_hw_breakpoint): Ditto.
(amd64_linux_new_thread): Ditto.
(_initialize_amd64_linux_nat): Register linux new thread observer.
* testsuite/gdb.threads/watchthreads-threaded.c: New test case.
* testsuite/gdb.threads/watchthreads-threaded.exp: Ditto.
* testsuite/gdb.threads/watchthreads2.c: New test case.
* testsuite/gdb.threads/watchthreads2.exp: Ditto.
[ With recent upstream GDB (6.8) reduced only to the testcase. ]
[ It was called watchthreads2.{exp,c} before but it conflicted with FSF GDB new
testcase of the same name. ]
FIXME: The testcase does not expects multiple watchpoints hits per one stop.
diff --git a/gdb/testsuite/gdb.threads/watchthreads-threaded.c b/gdb/testsuite/gdb.threads/watchthreads-threaded.c
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.threads/watchthreads-threaded.c
Index: gdb-6.5/gdb/config/i386/nm-linux64.h
===================================================================
--- gdb-6.5.orig/gdb/config/i386/nm-linux64.h 2006-07-12 01:54:10.000000000 -0300
+++ gdb-6.5/gdb/config/i386/nm-linux64.h 2006-07-12 01:54:29.000000000 -0300
@@ -35,22 +35,59 @@
/* Provide access to the i386 hardware debugging registers. */
-extern void amd64_linux_dr_set_control (unsigned long control);
+extern void amd64_linux_dr_set_control (ptid_t ptid, unsigned long control);
#define I386_DR_LOW_SET_CONTROL(control) \
- amd64_linux_dr_set_control (control)
+ amd64_linux_dr_set_control (inferior_ptid, control)
-extern void amd64_linux_dr_set_addr (int regnum, CORE_ADDR addr);
+extern void amd64_linux_dr_set_addr (ptid_t ptid, int regnum, CORE_ADDR addr);
#define I386_DR_LOW_SET_ADDR(regnum, addr) \
- amd64_linux_dr_set_addr (regnum, addr)
+ amd64_linux_dr_set_addr (inferior_ptid, regnum, addr)
-extern void amd64_linux_dr_reset_addr (int regnum);
+extern void amd64_linux_dr_reset_addr (ptid_t ptid, int regnum);
#define I386_DR_LOW_RESET_ADDR(regnum) \
- amd64_linux_dr_reset_addr (regnum)
+ amd64_linux_dr_reset_addr (inferior_ptid, regnum)
-extern unsigned long amd64_linux_dr_get_status (void);
+extern unsigned long amd64_linux_dr_get_status (ptid_t ptid);
#define I386_DR_LOW_GET_STATUS() \
- amd64_linux_dr_get_status ()
+ amd64_linux_dr_get_status (inferior_ptid)
+/* Watchpoints and hardware breakpoints. */
+
+/* Insert a watchpoint to watch a memory region which starts at
+ * * address ADDR and whose length is LEN bytes. Watch memory accesses
+ * * of the type TYPE. Return 0 on success, -1 on failure. */
+extern int amd64_linux_insert_watchpoint (CORE_ADDR addr, int len, int type);
+
+/* Remove a watchpoint that watched the memory region which starts at
+ * * address ADDR, whose length is LEN bytes, and for accesses of the
+ * * type TYPE. Return 0 on success, -1 on failure. */
+extern int amd64_linux_remove_watchpoint (CORE_ADDR addr, int len, int type);
+
+/* Insert a hardware-assisted breakpoint at address ADDR. SHADOW is
+ * * unused. Return 0 on success, EBUSY on failure. */
+extern int amd64_linux_insert_hw_breakpoint (struct bp_target_info *bp_tgt);
+
+/* Remove a hardware-assisted breakpoint at address ADDR. SHADOW is
+ * * unused. Return 0 on success, -1 on failure. */
+extern int amd64_linux_remove_hw_breakpoint (struct bp_target_info *bp_tgt);
+
+/* Override basic amd64 macros for watchpoint and hardware breakpoint
+ * insertion/removal to support threads. */
+#undef target_insert_watchpoint
+#define target_insert_watchpoint(addr, len, type) \
+ amd64_linux_insert_watchpoint (addr, len, type)
+
+#undef target_remove_watchpoint
+#define target_remove_watchpoint(addr, len, type) \
+ amd64_linux_remove_watchpoint (addr, len, type)
+
+#undef target_insert_hw_breakpoint
+#define target_insert_hw_breakpoint(bp_tgt) \
+ amd64_linux_insert_hw_breakpoint (bp_tgt)
+
+#undef target_remove_hw_breakpoint
+#define target_remove_hw_breakpoint(bp_tgt) \
+ amd64_linux_remove_hw_breakpoint (bp_tgt)
/* Override copies of {fetch,store}_inferior_registers in `infptrace.c'. */
#define FETCH_INFERIOR_REGISTERS
Index: gdb-6.5/gdb/config/i386/nm-linux.h
===================================================================
--- gdb-6.5.orig/gdb/config/i386/nm-linux.h 2006-07-12 01:54:10.000000000 -0300
+++ gdb-6.5/gdb/config/i386/nm-linux.h 2006-07-12 01:54:29.000000000 -0300
@@ -46,23 +46,61 @@ extern CORE_ADDR register_u_addr (CORE_A
/* Provide access to the i386 hardware debugging registers. */
-extern void i386_linux_dr_set_control (unsigned long control);
+extern void i386_linux_dr_set_control (ptid_t ptid, unsigned long control);
#define I386_DR_LOW_SET_CONTROL(control) \
- i386_linux_dr_set_control (control)
+ i386_linux_dr_set_control (inferior_ptid, control)
-extern void i386_linux_dr_set_addr (int regnum, CORE_ADDR addr);
+extern void i386_linux_dr_set_addr (ptid_t ptid, int regnum, CORE_ADDR addr);
#define I386_DR_LOW_SET_ADDR(regnum, addr) \
- i386_linux_dr_set_addr (regnum, addr)
+ i386_linux_dr_set_addr (inferior_ptid, regnum, addr)
-extern void i386_linux_dr_reset_addr (int regnum);
+extern void i386_linux_dr_reset_addr (ptid_t ptid, int regnum);
#define I386_DR_LOW_RESET_ADDR(regnum) \
- i386_linux_dr_reset_addr (regnum)
+ i386_linux_dr_reset_addr (inferior_ptid, regnum)
-extern unsigned long i386_linux_dr_get_status (void);
+extern unsigned long i386_linux_dr_get_status (ptid_t ptid);
#define I386_DR_LOW_GET_STATUS() \
- i386_linux_dr_get_status ()
+ i386_linux_dr_get_status (inferior_ptid)
+/* Watchpoints and hardware breakpoints. */
+
+/* Insert a watchpoint to watch a memory region which starts at
+ * address ADDR and whose length is LEN bytes. Watch memory accesses
+ * of the type TYPE. Return 0 on success, -1 on failure. */
+extern int i386_linux_insert_watchpoint (CORE_ADDR addr, int len, int type);
+
+/* Remove a watchpoint that watched the memory region which starts at
+ * address ADDR, whose length is LEN bytes, and for accesses of the
+ * type TYPE. Return 0 on success, -1 on failure. */
+extern int i386_linux_remove_watchpoint (CORE_ADDR addr, int len, int type);
+
+/* Insert a hardware-assisted breakpoint at address ADDR. SHADOW is
+ * unused. Return 0 on success, EBUSY on failure. */
+extern int i386_linux_insert_hw_breakpoint (struct bp_target_info *bp_tgt);
+
+/* Remove a hardware-assisted breakpoint at address ADDR. SHADOW is
+ * unused. Return 0 on success, -1 on failure. */
+extern int i386_linux_remove_hw_breakpoint (struct bp_target_info *bp_tgt);
+
+/* Override basic i386 macros for watchpoint and hardware breakpoint
+ insertion/removal to support threads. */
+#undef target_insert_watchpoint
+#define target_insert_watchpoint(addr, len, type) \
+ i386_linux_insert_watchpoint (addr, len, type)
+
+#undef target_remove_watchpoint
+#define target_remove_watchpoint(addr, len, type) \
+ i386_linux_remove_watchpoint (addr, len, type)
+
+#undef target_insert_hw_breakpoint
+#define target_insert_hw_breakpoint(bp_tgt) \
+ i386_linux_insert_hw_breakpoint (bp_tgt)
+
+#undef target_remove_hw_breakpoint
+#define target_remove_hw_breakpoint(bp_tgt) \
+ i386_linux_remove_hw_breakpoint (bp_tgt)
+
/* Override copies of {fetch,store}_inferior_registers in `infptrace.c'. */
#define FETCH_INFERIOR_REGISTERS
Index: gdb-6.5/gdb/i386-nat.c
===================================================================
--- gdb-6.5.orig/gdb/i386-nat.c 2006-07-12 01:54:10.000000000 -0300
+++ gdb-6.5/gdb/i386-nat.c 2006-07-12 01:54:29.000000000 -0300
@@ -21,6 +21,7 @@
#include "defs.h"
#include "breakpoint.h"
+#include "inferior.h"
#include "command.h"
#include "gdbcmd.h"
Index: gdb-6.5/gdb/testsuite/gdb.threads/watchthreads2.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-6.5/gdb/testsuite/gdb.threads/watchthreads2.c 2006-07-12 01:54:29.000000000 -0300
@@ -0,0 +1,66 @@
+/* This testcase is part of GDB, the GNU debugger.
+
@ -121,11 +264,11 @@ new file mode 100644
+ pthread_exit(NULL);
+}
+
diff --git a/gdb/testsuite/gdb.threads/watchthreads-threaded.exp b/gdb/testsuite/gdb.threads/watchthreads-threaded.exp
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.threads/watchthreads-threaded.exp
@@ -0,0 +1,126 @@
Index: gdb-6.5/gdb/testsuite/gdb.threads/watchthreads2.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-6.5/gdb/testsuite/gdb.threads/watchthreads2.exp 2006-07-12 01:54:29.000000000 -0300
@@ -0,0 +1,133 @@
+# This testcase is part of GDB, the GNU debugger.
+
+# Copyright 2005 Free Software Foundation, Inc.
@ -146,15 +289,22 @@ new file mode 100644
+
+# Check that GDB can support multiple watchpoints across threads.
+
+if $tracelevel {
+ strace $tracelevel
+}
+
+set prms_id 0
+set bug_id 0
+
+# This test verifies that a watchpoint is detected in the proper thread
+# so the test is only meaningful on a system with hardware watchpoints.
+if [target_info exists gdb,no_hardware_watchpoints] {
+ return 0;
+}
+
+set testfile "watchthreads-threaded"
+set testfile "watchthreads2"
+set srcfile ${testfile}.c
+set binfile [standard_output_file ${testfile}]
+set binfile ${objdir}/${subdir}/${testfile}
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug "incdir=${objdir}"]] != "" } {
+ return -1
+}
@ -209,13 +359,13 @@ new file mode 100644
+for {set i 0} {$i < 30} {incr i} {
+ set test_flag 0
+ gdb_test_multiple "continue" "threaded watch loop" {
+ -re "Hardware watchpoint 3: args\\\[2\\\].*Old value = 0.*New value = 1.*main \\\(\\\) at .*watchthreads-threaded.c:$init_line.*$gdb_prompt $"
+ -re "Hardware watchpoint 3: args\\\[2\\\].*Old value = 0.*New value = 1.*main \\\(\\\) at .*watchthreads2.c:$init_line.*$gdb_prompt $"
+ { set args_2 1; set test_flag 1 }
+ -re "Hardware watchpoint 4: args\\\[3\\\].*Old value = 0.*New value = 1.*main \\\(\\\) at .*watchthreads-threaded.c:$init_line.*$gdb_prompt $"
+ -re "Hardware watchpoint 4: args\\\[3\\\].*Old value = 0.*New value = 1.*main \\\(\\\) at .*watchthreads2.c:$init_line.*$gdb_prompt $"
+ { set args_3 1; set test_flag 1 }
+ -re "Hardware watchpoint 3: args\\\[2\\\].*Old value = $args_2.*New value = [expr $args_2+1].*in thread_function \\\(arg=0x2\\\) at .*watchthreads-threaded.c:$inc_line.*$gdb_prompt $"
+ -re "Hardware watchpoint 3: args\\\[2\\\].*Old value = $args_2.*New value = [expr $args_2+1].*in thread_function \\\(arg=0x2\\\) at .*watchthreads2.c:$inc_line.*$gdb_prompt $"
+ { set args_2 [expr $args_2+1]; set test_flag 1 }
+ -re "Hardware watchpoint 4: args\\\[3\\\].*Old value = $args_3.*New value = [expr $args_3+1].*in thread_function \\\(arg=0x3\\\) at .*watchthreads-threaded.c:$inc_line.*$gdb_prompt $"
+ -re "Hardware watchpoint 4: args\\\[3\\\].*Old value = $args_3.*New value = [expr $args_3+1].*in thread_function \\\(arg=0x3\\\) at .*watchthreads2.c:$inc_line.*$gdb_prompt $"
+ { set args_3 [expr $args_3+1]; set test_flag 1 }
+ }
+ # If we fail above, don't bother continuing loop
@ -252,3 +402,458 @@ new file mode 100644
+} else {
+ fail $message
+}
Index: gdb-6.5/gdb/i386-linux-nat.c
===================================================================
--- gdb-6.5.orig/gdb/i386-linux-nat.c 2006-07-12 01:54:28.000000000 -0300
+++ gdb-6.5/gdb/i386-linux-nat.c 2006-07-12 01:57:19.000000000 -0300
@@ -24,6 +24,7 @@
#include "inferior.h"
#include "gdbcore.h"
#include "regcache.h"
+#include "observer.h"
#include "target.h"
#include "linux-nat.h"
@@ -614,14 +615,14 @@ i386_linux_store_inferior_registers (int
/* Support for debug registers. */
static unsigned long
-i386_linux_dr_get (int regnum)
+i386_linux_dr_get (ptid_t ptid, int regnum)
{
int tid;
unsigned long value;
- tid = TIDGET (inferior_ptid);
+ tid = TIDGET (ptid);
if (tid == 0)
- tid = PIDGET (inferior_ptid);
+ tid = PIDGET (ptid);
/* FIXME: kettenis/2001-03-27: Calling perror_with_name if the
ptrace call fails breaks debugging remote targets. The correct
@@ -642,13 +643,13 @@ i386_linux_dr_get (int regnum)
}
static void
-i386_linux_dr_set (int regnum, unsigned long value)
+i386_linux_dr_set (ptid_t ptid, int regnum, unsigned long value)
{
int tid;
- tid = TIDGET (inferior_ptid);
+ tid = TIDGET (ptid);
if (tid == 0)
- tid = PIDGET (inferior_ptid);
+ tid = PIDGET (ptid);
errno = 0;
ptrace (PTRACE_POKEUSER, tid,
@@ -658,34 +659,158 @@ i386_linux_dr_set (int regnum, unsigned
}
void
-i386_linux_dr_set_control (unsigned long control)
+i386_linux_dr_set_control (ptid_t ptid, unsigned long control)
{
- i386_linux_dr_set (DR_CONTROL, control);
+ i386_linux_dr_set (ptid, DR_CONTROL, control);
}
void
-i386_linux_dr_set_addr (int regnum, CORE_ADDR addr)
+i386_linux_dr_set_addr (ptid_t ptid, int regnum, CORE_ADDR addr)
{
gdb_assert (regnum >= 0 && regnum <= DR_LASTADDR - DR_FIRSTADDR);
- i386_linux_dr_set (DR_FIRSTADDR + regnum, addr);
+ i386_linux_dr_set (ptid, DR_FIRSTADDR + regnum, addr);
}
void
-i386_linux_dr_reset_addr (int regnum)
+i386_linux_dr_reset_addr (ptid_t ptid, int regnum)
{
gdb_assert (regnum >= 0 && regnum <= DR_LASTADDR - DR_FIRSTADDR);
- i386_linux_dr_set (DR_FIRSTADDR + regnum, 0L);
+ i386_linux_dr_set (ptid, DR_FIRSTADDR + regnum, 0L);
}
unsigned long
-i386_linux_dr_get_status (void)
+i386_linux_dr_get_status (ptid_t ptid)
{
- return i386_linux_dr_get (DR_STATUS);
+ return i386_linux_dr_get (ptid, DR_STATUS);
}
+/* Structure used to sync debug registers for all threads. */
+struct i386_debug_register_state
+{
+ int tid;
+ CORE_ADDR addr[DR_LASTADDR - DR_FIRSTADDR + 1];
+ unsigned long control;
+};
+
+static void
+i386_linux_set_debug_regs_for_thread (ptid_t ptid,
+ struct i386_debug_register_state *dbs)
+{
+ int i;
+ for (i = 0; i < (DR_LASTADDR - DR_FIRSTADDR) + 1; ++i)
+ i386_linux_dr_set_addr (ptid, i, dbs->addr[i]);
+ i386_linux_dr_set_control (ptid, dbs->control);
+}
+
+/* Iterator function to support syncing debug registers across all threads. */
+static int
+i386_linux_sync_debug_registers_callback (struct lwp_info *lwp, void *data)
+{
+ struct i386_debug_register_state *args = data;
+ int i, tid;
+
+ tid = TIDGET (lwp->ptid);
+ if (tid == 0)
+ tid = PIDGET (lwp->ptid);
+
+ if (tid != args->tid)
+ i386_linux_set_debug_regs_for_thread (lwp->ptid, args);
+ return 0;
+}
+
+/* Sync the debug registers for all known threads to the current
+ thread that has just performed an operation. This is required
+ because the debug registers are thread-specific. We want
+ watchpoints and hardware breakpoints to be treated globally
+ across all threads. */
+static int
+i386_linux_sync_debug_registers_across_threads (void)
+{
+ int i, tid;
+ struct i386_debug_register_state args;
+
+ tid = TIDGET (inferior_ptid);
+ if (tid == 0)
+ tid = PIDGET (inferior_ptid);
+
+ args.tid = tid;
+ for (i = 0; i < (DR_LASTADDR - DR_FIRSTADDR) + 1; ++i)
+ args.addr[i] = i386_linux_dr_get (inferior_ptid, DR_FIRSTADDR + i);
+ args.control = i386_linux_dr_get (inferior_ptid, DR_CONTROL);
+
+ iterate_over_lwps (&i386_linux_sync_debug_registers_callback, &args);
+
+ return 0;
+}
+
+/* Insert a watchpoint to watch a memory region which starts at
+ address ADDR and whose length is LEN bytes. Watch memory accesses
+ of the type TYPE. Return 0 on success, -1 on failure. */
+int
+i386_linux_insert_watchpoint (CORE_ADDR addr, int len, int type)
+{
+ int rc;
+ rc = i386_insert_watchpoint (addr, len, type);
+ if (!rc)
+ i386_linux_sync_debug_registers_across_threads ();
+ return rc;
+}
+
+/* Remove a watchpoint that watched the memory region which starts at
+ address ADDR, whose length is LEN bytes, and for accesses of the
+ type TYPE. Return 0 on success, -1 on failure. */
+int
+i386_linux_remove_watchpoint (CORE_ADDR addr, int len, int type)
+{
+ int rc;
+ rc = i386_remove_watchpoint (addr, len, type);
+ if (!rc)
+ i386_linux_sync_debug_registers_across_threads ();
+ return rc;
+}
+
+/* Insert a hardware-assisted breakpoint at address ADDR. SHADOW is
+ unused. Return 0 on success, EBUSY on failure. */
+int
+i386_linux_insert_hw_breakpoint (struct bp_target_info *bp_tgt)
+{
+ int rc;
+ rc = i386_insert_hw_breakpoint (bp_tgt);
+ if (!rc)
+ i386_linux_sync_debug_registers_across_threads ();
+ return rc;
+}
+
+/* Remove a hardware-assisted breakpoint at address ADDR. SHADOW is
+ unused. Return 0 on success, -1 on failure. */
+int
+i386_linux_remove_hw_breakpoint (struct bp_target_info *bp_tgt)
+{
+ int rc;
+ rc = i386_remove_hw_breakpoint (bp_tgt);
+ if (!rc)
+ i386_linux_sync_debug_registers_across_threads ();
+ return rc;
+}
+
+/* Observer function for a new thread attach. We need to insert
+ existing watchpoints and hardware breakpoints on the new thread. */
+static void
+i386_linux_new_thread (ptid_t ptid)
+{
+ int i;
+ struct i386_debug_register_state dbs;
+
+ for (i = 0; i < (DR_LASTADDR - DR_FIRSTADDR) + 1; ++i)
+ dbs.addr[i] = i386_linux_dr_get (inferior_ptid, DR_FIRSTADDR + i);
+ dbs.control = i386_linux_dr_get (inferior_ptid, DR_CONTROL);
+
+ i386_linux_set_debug_regs_for_thread (ptid, &dbs);
+}
+
/* Called by libthread_db. Returns a pointer to the thread local
storage (or its descriptor). */
@@ -843,4 +968,6 @@ _initialize_i386_linux_nat (void)
/* Register the target. */
linux_nat_add_target (t);
+
+ observer_attach_linux_new_thread (i386_linux_new_thread);
}
Index: gdb-6.5/gdb/amd64-linux-nat.c
===================================================================
--- gdb-6.5.orig/gdb/amd64-linux-nat.c 2006-07-12 01:54:28.000000000 -0300
+++ gdb-6.5/gdb/amd64-linux-nat.c 2006-07-12 01:54:29.000000000 -0300
@@ -25,6 +25,7 @@
#include "inferior.h"
#include "gdbcore.h"
#include "regcache.h"
+#include "observer.h"
#include "linux-nat.h"
#include "gdb_assert.h"
@@ -229,14 +230,14 @@ amd64_linux_store_inferior_registers (in
static unsigned long
-amd64_linux_dr_get (int regnum)
+amd64_linux_dr_get (ptid_t ptid, int regnum)
{
int tid;
unsigned long value;
- tid = TIDGET (inferior_ptid);
+ tid = TIDGET (ptid);
if (tid == 0)
- tid = PIDGET (inferior_ptid);
+ tid = PIDGET (ptid);
/* FIXME: kettenis/2001-03-27: Calling perror_with_name if the
ptrace call fails breaks debugging remote targets. The correct
@@ -257,13 +258,13 @@ amd64_linux_dr_get (int regnum)
}
static void
-amd64_linux_dr_set (int regnum, unsigned long value)
+amd64_linux_dr_set (ptid_t ptid, int regnum, unsigned long value)
{
int tid;
- tid = TIDGET (inferior_ptid);
+ tid = TIDGET (ptid);
if (tid == 0)
- tid = PIDGET (inferior_ptid);
+ tid = PIDGET (ptid);
errno = 0;
ptrace (PT_WRITE_U, tid, offsetof (struct user, u_debugreg[regnum]), value);
@@ -272,34 +273,158 @@ amd64_linux_dr_set (int regnum, unsigned
}
void
-amd64_linux_dr_set_control (unsigned long control)
+amd64_linux_dr_set_control (ptid_t ptid, unsigned long control)
{
- amd64_linux_dr_set (DR_CONTROL, control);
+ amd64_linux_dr_set (ptid, DR_CONTROL, control);
}
void
-amd64_linux_dr_set_addr (int regnum, CORE_ADDR addr)
+amd64_linux_dr_set_addr (ptid_t ptid, int regnum, CORE_ADDR addr)
{
gdb_assert (regnum >= 0 && regnum <= DR_LASTADDR - DR_FIRSTADDR);
- amd64_linux_dr_set (DR_FIRSTADDR + regnum, addr);
+ amd64_linux_dr_set (ptid, DR_FIRSTADDR + regnum, addr);
}
void
-amd64_linux_dr_reset_addr (int regnum)
+amd64_linux_dr_reset_addr (ptid_t ptid, int regnum)
{
gdb_assert (regnum >= 0 && regnum <= DR_LASTADDR - DR_FIRSTADDR);
- amd64_linux_dr_set (DR_FIRSTADDR + regnum, 0L);
+ amd64_linux_dr_set (ptid, DR_FIRSTADDR + regnum, 0L);
}
unsigned long
-amd64_linux_dr_get_status (void)
+amd64_linux_dr_get_status (ptid_t ptid)
{
- return amd64_linux_dr_get (DR_STATUS);
+ return amd64_linux_dr_get (ptid, DR_STATUS);
}
+/* Structure used to sync debug registers for all threads. */
+struct amd64_debug_register_state
+{
+ int tid;
+ CORE_ADDR addr[DR_LASTADDR - DR_FIRSTADDR + 1];
+ unsigned long control;
+};
+
+static void
+amd64_linux_set_debug_regs_for_thread (ptid_t ptid,
+ struct amd64_debug_register_state *dbs)
+{
+ int i;
+ for (i = 0; i < (DR_LASTADDR - DR_FIRSTADDR) + 1; ++i)
+ amd64_linux_dr_set_addr (ptid, i, dbs->addr[i]);
+ amd64_linux_dr_set_control (ptid, dbs->control);
+}
+
+/* Iterator function to support syncing debug registers across all threads. */
+static int
+amd64_linux_sync_debug_registers_callback (struct lwp_info *lwp, void *data)
+{
+ struct amd64_debug_register_state *args = data;
+ int i, tid;
+
+ tid = TIDGET (lwp->ptid);
+ if (tid == 0)
+ tid = PIDGET (lwp->ptid);
+
+ if (tid != args->tid)
+ amd64_linux_set_debug_regs_for_thread (lwp->ptid, args);
+ return 0;
+}
+
+/* Sync the debug registers for all known threads to the current
+ thread that has just performed an operation. This is required
+ because the debug registers are thread-specific. We want
+ watchpoints and hardware breakpoints to be treated globally
+ across all threads. */
+static int
+amd64_linux_sync_debug_registers_across_threads (void)
+{
+ int i, tid;
+ struct amd64_debug_register_state args;
+
+ tid = TIDGET (inferior_ptid);
+ if (tid == 0)
+ tid = PIDGET (inferior_ptid);
+
+ args.tid = tid;
+ for (i = 0; i < (DR_LASTADDR - DR_FIRSTADDR) + 1; ++i)
+ args.addr[i] = amd64_linux_dr_get (inferior_ptid, DR_FIRSTADDR + i);
+ args.control = amd64_linux_dr_get (inferior_ptid, DR_CONTROL);
+
+ iterate_over_lwps (&amd64_linux_sync_debug_registers_callback, &args);
+
+ return 0;
+}
+
+/* Insert a watchpoint to watch a memory region which starts at
+ address ADDR and whose length is LEN bytes. Watch memory accesses
+ of the type TYPE. Return 0 on success, -1 on failure. */
+int
+amd64_linux_insert_watchpoint (CORE_ADDR addr, int len, int type)
+{
+ int rc;
+ rc = i386_insert_watchpoint (addr, len, type);
+ if (!rc)
+ amd64_linux_sync_debug_registers_across_threads ();
+ return rc;
+}
+
+/* Remove a watchpoint that watched the memory region which starts at
+ address ADDR, whose length is LEN bytes, and for accesses of the
+ type TYPE. Return 0 on success, -1 on failure. */
+int
+amd64_linux_remove_watchpoint (CORE_ADDR addr, int len, int type)
+{
+ int rc;
+ rc = i386_remove_watchpoint (addr, len, type);
+ if (!rc)
+ amd64_linux_sync_debug_registers_across_threads ();
+ return rc;
+}
+
+/* Insert a hardware-assisted breakpoint at address ADDR. SHADOW is
+ unused. Return 0 on success, EBUSY on failure. */
+int
+amd64_linux_insert_hw_breakpoint (struct bp_target_info *bp_tgt)
+{
+ int rc;
+ rc = i386_insert_hw_breakpoint (bp_tgt);
+ if (!rc)
+ amd64_linux_sync_debug_registers_across_threads ();
+ return rc;
+}
+
+/* Remove a hardware-assisted breakpoint at address ADDR. SHADOW is
+ unused. Return 0 on success, -1 on failure. */
+int
+amd64_linux_remove_hw_breakpoint (struct bp_target_info *bp_tgt)
+{
+ int rc;
+ rc = i386_remove_hw_breakpoint (bp_tgt);
+ if (!rc)
+ amd64_linux_sync_debug_registers_across_threads ();
+ return rc;
+}
+
+/* Observer function for a new thread attach. We need to insert
+ existing watchpoints and hardware breakpoints on the new thread. */
+static void
+amd64_linux_new_thread (ptid_t ptid)
+{
+ int i;
+ struct amd64_debug_register_state dbs;
+
+ for (i = 0; i < (DR_LASTADDR - DR_FIRSTADDR) + 1; ++i)
+ dbs.addr[i] = amd64_linux_dr_get (inferior_ptid, DR_FIRSTADDR + i);
+ dbs.control = amd64_linux_dr_get (inferior_ptid, DR_CONTROL);
+
+ amd64_linux_set_debug_regs_for_thread (ptid, &dbs);
+}
+
/* This function is called by libthread_db as part of its handling of
a request for a thread's local storage address. */
@@ -399,4 +524,6 @@ _initialize_amd64_linux_nat (void)
/* Register the target. */
linux_nat_add_target (t);
+
+ observer_attach_linux_new_thread (amd64_linux_new_thread);
}
Index: gdb-6.5/gdb/testsuite/gdb.threads/watchthreads.c
===================================================================
--- gdb-6.5.orig/gdb/testsuite/gdb.threads/watchthreads.c 2006-07-12 01:55:19.000000000 -0300
+++ gdb-6.5/gdb/testsuite/gdb.threads/watchthreads.c 2006-07-12 01:56:51.000000000 -0300
@@ -58,7 +58,7 @@ void *thread_function(void *arg) {
/* Don't run forever. Run just short of it :) */
while (*myp > 0)
{
- (*myp) ++; /* Loop increment. */
+ (*myp) ++; usleep (1); /* Loop increment. */
}
pthread_exit(NULL);

View File

@ -0,0 +1,27 @@
2004-12-13 Jeff Johnston <jjohnstn@redhat.com>
* dwarf2read.c (read_type_die): Ensure that structures, unions,
enumerations, and base types create symbols.
--- gdb-6.3/gdb/dwarf2read.c.fix2 Mon Dec 13 19:44:08 2004
+++ gdb-6.3/gdb/dwarf2read.c Mon Dec 13 20:00:42 2004
@@ -7178,9 +7178,11 @@ read_type_die (struct die_info *die, str
case DW_TAG_structure_type:
case DW_TAG_union_type:
read_structure_type (die, cu);
+ process_structure_scope (die, cu);
break;
case DW_TAG_enumeration_type:
read_enumeration_type (die, cu);
+ process_enumeration_scope (die, cu);
break;
case DW_TAG_subprogram:
case DW_TAG_subroutine_type:
@@ -7215,6 +7217,7 @@ read_type_die (struct die_info *die, str
break;
case DW_TAG_base_type:
read_base_type (die, cu);
+ new_symbol (die, die->type, cu);
break;
default:
complaint (&symfile_complaints, "unexepected tag in read_type_die: '%s'",

View File

@ -0,0 +1,693 @@
Index: gdb-6.6/gdb/mi/mi-cmd-env.c
===================================================================
--- gdb-6.6.orig/gdb/mi/mi-cmd-env.c
+++ gdb-6.6/gdb/mi/mi-cmd-env.c
@@ -126,7 +126,7 @@ mi_cmd_env_path (char *command, char **a
static struct mi_opt opts[] =
{
{"r", RESET_OPT, 0},
- 0
+ {0}
};
dont_repeat ();
@@ -198,7 +198,7 @@ mi_cmd_env_dir (char *command, char **ar
static struct mi_opt opts[] =
{
{"r", RESET_OPT, 0},
- 0
+ {0}
};
dont_repeat ();
Index: gdb-6.6/gdb/mi/mi-getopt.c
===================================================================
--- gdb-6.6.orig/gdb/mi/mi-getopt.c
+++ gdb-6.6/gdb/mi/mi-getopt.c
@@ -82,7 +82,7 @@ mi_valid_noargs (const char *prefix, int
char *optarg;
static struct mi_opt opts[] =
{
- 0
+ {0}
};
if (mi_getopt (prefix, argc, argv, opts, &optind, &optarg) == -1)
Index: gdb-6.6/gdb/mi/mi-cmd-break.c
===================================================================
--- gdb-6.6.orig/gdb/mi/mi-cmd-break.c
+++ gdb-6.6/gdb/mi/mi-cmd-break.c
@@ -90,7 +90,7 @@ mi_cmd_break_insert (char *command, char
{"c", CONDITION_OPT, 1},
{"i", IGNORE_COUNT_OPT, 1},
{"p", THREAD_OPT, 1},
- 0
+ {0}
};
/* Parse arguments. It could be -r or -h or -t, <location> or ``--''
@@ -196,7 +196,7 @@ mi_cmd_break_watch (char *command, char
{
{"r", READ_OPT, 0},
{"a", ACCESS_OPT, 0},
- 0
+ {0}
};
/* Parse arguments. */
Index: gdb-6.6/gdb/mi/mi-cmd-disas.c
===================================================================
--- gdb-6.6.orig/gdb/mi/mi-cmd-disas.c
+++ gdb-6.6/gdb/mi/mi-cmd-disas.c
@@ -84,7 +84,7 @@ mi_cmd_disassemble (char *command, char
{"n", NUM_OPT, 1},
{"s", START_OPT, 1},
{"e", END_OPT, 1},
- 0
+ {0}
};
/* Get the options with their arguments. Keep track of what we
Index: gdb-6.6/gdb/mi/mi-main.c
===================================================================
--- gdb-6.6.orig/gdb/mi/mi-main.c
+++ gdb-6.6/gdb/mi/mi-main.c
@@ -773,7 +773,7 @@ mi_cmd_data_read_memory (char *command,
static struct mi_opt opts[] =
{
{"o", OFFSET_OPT, 1},
- 0
+ {0}
};
while (1)
@@ -973,7 +973,7 @@ mi_cmd_data_write_memory (char *command,
static struct mi_opt opts[] =
{
{"o", OFFSET_OPT, 1},
- 0
+ {0}
};
while (1)
Index: gdb-6.6/gdb/p-valprint.c
===================================================================
--- gdb-6.6.orig/gdb/p-valprint.c
+++ gdb-6.6/gdb/p-valprint.c
@@ -753,7 +753,7 @@ pascal_object_print_value_fields (struct
int dont_print_statmem)
{
int i, len, n_baseclasses;
- struct obstack tmp_obstack;
+ struct obstack tmp_obstack = {0};
char *last_dont_print = obstack_next_free (&dont_print_statmem_obstack);
CHECK_TYPEDEF (type);
@@ -922,7 +922,7 @@ pascal_object_print_value (struct type *
enum val_prettyprint pretty,
struct type **dont_print_vb)
{
- struct obstack tmp_obstack;
+ struct obstack tmp_obstack = {0};
struct type **last_dont_print
= (struct type **) obstack_next_free (&dont_print_vb_obstack);
int i, n_baseclasses = TYPE_N_BASECLASSES (type);
Index: gdb-6.6/gdb/cp-valprint.c
===================================================================
--- gdb-6.6.orig/gdb/cp-valprint.c
+++ gdb-6.6/gdb/cp-valprint.c
@@ -265,7 +265,7 @@ cp_print_value_fields (struct type *type
struct type **dont_print_vb,int dont_print_statmem)
{
int i, len, n_baseclasses;
- struct obstack tmp_obstack;
+ struct obstack tmp_obstack = {0};
char *last_dont_print = obstack_next_free (&dont_print_statmem_obstack);
int fields_seen = 0;
@@ -524,7 +524,7 @@ cp_print_value (struct type *type, struc
struct ui_file *stream, int format, int recurse,
enum val_prettyprint pretty, struct type **dont_print_vb)
{
- struct obstack tmp_obstack;
+ struct obstack tmp_obstack = {0};
struct type **last_dont_print
= (struct type **) obstack_next_free (&dont_print_vb_obstack);
int i, n_baseclasses = TYPE_N_BASECLASSES (type);
Index: gdb-6.6/gdb/tui/tui-layout.c
===================================================================
--- gdb-6.6.orig/gdb/tui/tui-layout.c
+++ gdb-6.6/gdb/tui/tui-layout.c
@@ -755,7 +755,7 @@ show_source_disasm_command (void)
if (TUI_DISASM_WIN == NULL)
{
make_disasm_window (&TUI_DISASM_WIN, asm_height, src_height - 1);
- init_and_make_win ((void **) & locator,
+ init_and_make_win ((void **)(char *) & locator,
LOCATOR_WIN,
2 /* 1 */ ,
tui_term_width (),
@@ -848,7 +848,7 @@ show_data (enum tui_layout_type new_layo
make_source_window (&tui_win_list[win_type], src_height, data_height - 1);
else
make_disasm_window (&tui_win_list[win_type], src_height, data_height - 1);
- init_and_make_win ((void **) & locator,
+ init_and_make_win ((void **)(char *) & locator,
LOCATOR_WIN,
2 /* 1 */ ,
tui_term_width (),
@@ -963,7 +963,7 @@ make_source_or_disasm_window (struct tui
execution_info = tui_source_exec_info_win_ptr ();
else
execution_info = tui_disassem_exec_info_win_ptr ();
- init_and_make_win ((void **) & execution_info,
+ init_and_make_win ((void **)(char *) & execution_info,
EXEC_INFO_WIN,
height,
3,
@@ -1013,7 +1013,7 @@ show_source_or_disasm_and_command (enum
make_source_window (win_info_ptr, src_height - 1, 0);
else
make_disasm_window (win_info_ptr, src_height - 1, 0);
- init_and_make_win ((void **) & locator,
+ init_and_make_win ((void **)(char *) & locator,
LOCATOR_WIN,
2 /* 1 */ ,
tui_term_width (),
Index: gdb-6.6/gdb/testsuite/gdb.base/move-dir.h
===================================================================
--- gdb-6.6.orig/gdb/testsuite/gdb.base/move-dir.h
+++ gdb-6.6/gdb/testsuite/gdb.base/move-dir.h
@@ -1,4 +1,4 @@
-#include <stdlib.h>
+#include <stdio.h>
void other() {
const char* ostring = "other";
Index: gdb-6.6/gdb/testsuite/gdb.base/sigrepeat.c
===================================================================
--- gdb-6.6.orig/gdb/testsuite/gdb.base/sigrepeat.c
+++ gdb-6.6/gdb/testsuite/gdb.base/sigrepeat.c
@@ -22,6 +22,7 @@
#include <stdlib.h>
#include <string.h>
#include <signal.h>
+#include <stdlib.h>
#include <sys/time.h>
static volatile int done[2];
Index: gdb-6.6/gdb/s390-tdep.c
===================================================================
--- gdb-6.6.orig/gdb/s390-tdep.c
+++ gdb-6.6/gdb/s390-tdep.c
@@ -2277,6 +2277,9 @@ s390_return_value (struct gdbarch *gdbar
case RETURN_VALUE_STRUCT_CONVENTION:
error (_("Cannot set function return value."));
break;
+
+ default:
+ break;
}
}
else if (out)
@@ -2309,6 +2312,9 @@ s390_return_value (struct gdbarch *gdbar
case RETURN_VALUE_STRUCT_CONVENTION:
error (_("Function return value unknown."));
break;
+
+ default:
+ break;
}
}
Index: gdb-6.6/gdb/remote.c
===================================================================
--- gdb-6.6.orig/gdb/remote.c
+++ gdb-6.6/gdb/remote.c
@@ -2843,10 +2843,10 @@ cleanup_sigint_signal_handler (void *dum
{
signal (SIGINT, handle_sigint);
if (sigint_remote_twice_token)
- delete_async_signal_handler ((struct async_signal_handler **)
+ delete_async_signal_handler ((struct async_signal_handler **) (char *)
&sigint_remote_twice_token);
if (sigint_remote_token)
- delete_async_signal_handler ((struct async_signal_handler **)
+ delete_async_signal_handler ((struct async_signal_handler **) (char *)
&sigint_remote_token);
}
Index: gdb-6.6/gdb/f-exp.y
===================================================================
--- gdb-6.6.orig/gdb/f-exp.y
+++ gdb-6.6/gdb/f-exp.y
@@ -567,6 +567,8 @@ ptype : typebase
case tp_function:
follow_type = lookup_function_type (follow_type);
break;
+ default:
+ break;
}
$$ = follow_type;
}
Index: gdb-6.6/gdb/remote-fileio.c
===================================================================
--- gdb-6.6.orig/gdb/remote-fileio.c
+++ gdb-6.6/gdb/remote-fileio.c
@@ -1332,19 +1332,19 @@ static struct {
char *name;
void (*func)(char *);
} remote_fio_func_map[] = {
- "open", remote_fileio_func_open,
- "close", remote_fileio_func_close,
- "read", remote_fileio_func_read,
- "write", remote_fileio_func_write,
- "lseek", remote_fileio_func_lseek,
- "rename", remote_fileio_func_rename,
- "unlink", remote_fileio_func_unlink,
- "stat", remote_fileio_func_stat,
- "fstat", remote_fileio_func_fstat,
- "gettimeofday", remote_fileio_func_gettimeofday,
- "isatty", remote_fileio_func_isatty,
- "system", remote_fileio_func_system,
- NULL, NULL
+ {"open", remote_fileio_func_open},
+ {"close", remote_fileio_func_close},
+ {"read", remote_fileio_func_read},
+ {"write", remote_fileio_func_write},
+ {"lseek", remote_fileio_func_lseek},
+ {"rename", remote_fileio_func_rename},
+ {"unlink", remote_fileio_func_unlink},
+ {"stat", remote_fileio_func_stat},
+ {"fstat", remote_fileio_func_fstat},
+ {"gettimeofday", remote_fileio_func_gettimeofday},
+ {"isatty", remote_fileio_func_isatty},
+ {"system", remote_fileio_func_system},
+ {NULL, NULL}
};
static int
Index: gdb-6.6/gdb/source.c
===================================================================
--- gdb-6.6.orig/gdb/source.c
+++ gdb-6.6/gdb/source.c
@@ -172,7 +172,7 @@ get_current_source_symtab_and_line (void
void
set_default_source_symtab_and_line (void)
{
- struct symtab_and_line cursal;
+ struct symtab_and_line cursal = {0};
if (!have_full_symbols () && !have_partial_symbols ())
error (_("No symbol table is loaded. Use the \"file\" command."));
@@ -1428,7 +1428,7 @@ static void
line_info (char *arg, int from_tty)
{
struct symtabs_and_lines sals;
- struct symtab_and_line sal;
+ struct symtab_and_line sal = {0};
CORE_ADDR start_pc, end_pc;
int i;
Index: gdb-6.6/gdb/symfile.c
===================================================================
--- gdb-6.6.orig/gdb/symfile.c
+++ gdb-6.6/gdb/symfile.c
@@ -2933,6 +2933,8 @@ add_psymbol_with_dem_name_to_list (char
deprecated_bcache (buf, dem_namelength + 1, objfile->psymbol_cache);
break;
/* FIXME What should be done for the default case? Ignoring for now. */
+ default:
+ break;
}
/* val and coreaddr are mutually exclusive, one of them *will* be zero */
Index: gdb-6.6/gdb/linespec.c
===================================================================
--- gdb-6.6.orig/gdb/linespec.c
+++ gdb-6.6/gdb/linespec.c
@@ -1631,7 +1631,7 @@ static struct symtabs_and_lines
find_method (int funfirstline, char ***canonical, char *saved_arg,
char *copy, struct type *t, struct symbol *sym_class)
{
- struct symtabs_and_lines values;
+ struct symtabs_and_lines values = {0};
struct symbol *sym = 0;
int i1; /* Counter for the symbol array. */
struct symbol **sym_arr = alloca (total_number_of_methods (t)
Index: gdb-6.6/gdb/macroscope.c
===================================================================
--- gdb-6.6.orig/gdb/macroscope.c
+++ gdb-6.6/gdb/macroscope.c
@@ -33,7 +33,7 @@
struct macro_scope *
sal_macro_scope (struct symtab_and_line sal)
{
- struct macro_source_file *main, *inclusion;
+ struct macro_source_file *main_sf, *inclusion;
struct macro_scope *ms;
if (! sal.symtab
@@ -42,8 +42,8 @@ sal_macro_scope (struct symtab_and_line
ms = (struct macro_scope *) xmalloc (sizeof (*ms));
- main = macro_main (sal.symtab->macro_table);
- inclusion = macro_lookup_inclusion (main, sal.symtab->filename);
+ main_sf = macro_main (sal.symtab->macro_table);
+ inclusion = macro_lookup_inclusion (main_sf, sal.symtab->filename);
if (inclusion)
{
@@ -66,7 +66,7 @@ sal_macro_scope (struct symtab_and_line
For the time being, though, we'll just treat these as
occurring at the end of the main source file. */
- ms->file = main;
+ ms->file = main_sf;
ms->line = -1;
complaint (&symfile_complaints,
@@ -83,7 +83,6 @@ struct macro_scope *
default_macro_scope (void)
{
struct symtab_and_line sal;
- struct macro_source_file *main;
struct macro_scope *ms;
/* If there's a selected frame, use its PC. */
Index: gdb-6.6/gdb/target.c
===================================================================
--- gdb-6.6.orig/gdb/target.c
+++ gdb-6.6/gdb/target.c
@@ -1045,6 +1045,9 @@ memory_xfer_partial (struct target_ops *
if (writebuf != NULL)
error (_("Writing to flash memory forbidden in this context"));
break;
+
+ default:
+ break;
}
if (region->attrib.cache)
Index: gdb-6.6/gdb/gdb-events.c
===================================================================
--- gdb-6.6.orig/gdb/gdb-events.c
+++ gdb-6.6/gdb/gdb-events.c
@@ -321,6 +321,8 @@ gdb_events_deliver (struct gdb_events *v
case architecture_changed:
vector->architecture_changed ();
break;
+ default:
+ break;
}
delivering_events = event->next;
xfree (event);
Index: gdb-6.6/gdb/dwarf2read.c
===================================================================
--- gdb-6.6.orig/gdb/dwarf2read.c
+++ gdb-6.6/gdb/dwarf2read.c
@@ -9307,6 +9307,7 @@ dwarf_decode_macros (struct line_header
for (;;)
{
enum dwarf_macinfo_record_type macinfo_type;
+ int tmp;
/* Do we at least have room for a macinfo type byte? */
if (mac_ptr >= mac_end)
@@ -9318,13 +9319,16 @@ dwarf_decode_macros (struct line_header
macinfo_type = read_1_byte (abfd, mac_ptr);
mac_ptr++;
+ /* Check for a zero macinfo type which indicates the end of the macro
+ information. We do this as the compiler may warn us if we
+ try and look for 0 in the switch below because 0 is not
+ an enumerated value. */
+ tmp = (int)macinfo_type;
+ if (tmp == 0)
+ return;
+
switch (macinfo_type)
{
- /* A zero macinfo type indicates the end of the macro
- information. */
- case 0:
- return;
-
case DW_MACINFO_define:
case DW_MACINFO_undef:
{
Index: gdb-6.6/gdb/stabsread.c
===================================================================
--- gdb-6.6.orig/gdb/stabsread.c
+++ gdb-6.6/gdb/stabsread.c
@@ -1794,7 +1794,8 @@ again:
struct type *domain = read_type (pp, objfile);
struct type *return_type;
struct field *args;
- int nargs, varargs;
+ int nargs = 0;
+ int varargs = 0;
if (**pp != ',')
/* Invalid member type data format. */
Index: gdb-6.6/gdb/dwarf2expr.c
===================================================================
--- gdb-6.6.orig/gdb/dwarf2expr.c
+++ gdb-6.6/gdb/dwarf2expr.c
@@ -559,6 +559,8 @@ execute_stack_op (struct dwarf_expr_cont
op_ptr = read_uleb128 (op_ptr, op_end, &reg);
result += reg;
break;
+ default:
+ break;
}
break;
Index: gdb-6.6/gdb/varobj.c
===================================================================
--- gdb-6.6.orig/gdb/varobj.c
+++ gdb-6.6/gdb/varobj.c
@@ -325,10 +325,9 @@ struct language_specific
/* Array of known source language routines. */
static struct language_specific
- languages[vlang_end][sizeof (struct language_specific)] = {
+ languages[vlang_end] = {
/* Unknown (try treating as C */
- {
- vlang_unknown,
+ {vlang_unknown,
c_number_of_children,
c_name_of_variable,
c_name_of_child,
@@ -339,8 +338,7 @@ static struct language_specific
c_value_of_variable}
,
/* C */
- {
- vlang_c,
+ {vlang_c,
c_number_of_children,
c_name_of_variable,
c_name_of_child,
@@ -351,8 +349,7 @@ static struct language_specific
c_value_of_variable}
,
/* C++ */
- {
- vlang_cplus,
+ {vlang_cplus,
cplus_number_of_children,
cplus_name_of_variable,
cplus_name_of_child,
@@ -363,8 +360,7 @@ static struct language_specific
cplus_value_of_variable}
,
/* Java */
- {
- vlang_java,
+ {vlang_java,
java_number_of_children,
java_name_of_variable,
java_name_of_child,
@@ -519,7 +515,7 @@ varobj_create (char *objname,
/* Set language info */
lang = variable_language (var);
- var->root->lang = languages[lang];
+ var->root->lang = &languages[lang];
/* Set ourselves as our root */
var->root->rootvar = var;
Index: gdb-6.6/gdb/doublest.c
===================================================================
--- gdb-6.6.orig/gdb/doublest.c
+++ gdb-6.6/gdb/doublest.c
@@ -94,15 +94,10 @@ get_field (const bfd_byte *data, enum fl
{
result |= (unsigned long)*(data + cur_byte) << cur_bitshift;
cur_bitshift += FLOATFORMAT_CHAR_BIT;
- switch (order)
- {
- case floatformat_little:
- ++cur_byte;
- break;
- case floatformat_big:
- --cur_byte;
- break;
- }
+ if (order == floatformat_little)
+ ++cur_byte;
+ else
+ --cur_byte;
}
if (len < sizeof(result) * FLOATFORMAT_CHAR_BIT)
/* Mask out bits which are not part of the field */
diff -u -rup gdb-6.6-orig/gdb/cli/cli-cmds.c gdb-6.6/gdb/cli/cli-cmds.c
--- gdb-6.6-orig/gdb/cli/cli-cmds.c 2007-04-08 20:49:09.000000000 +0200
+++ gdb-6.6/gdb/cli/cli-cmds.c 2007-04-08 20:54:49.000000000 +0200
@@ -323,7 +323,8 @@ pwd_command (char *args, int from_tty)
{
if (args)
error (_("The \"pwd\" command does not take an argument: %s"), args);
- getcwd (gdb_dirbuf, sizeof (gdb_dirbuf));
+ /* Unused result. */
+ 1 && getcwd (gdb_dirbuf, sizeof (gdb_dirbuf));
if (strcmp (gdb_dirbuf, current_directory) != 0)
printf_unfiltered (_("Working directory %s\n (canonically %s).\n"),
diff -u -rup gdb-6.6-orig/gdb/inflow.c gdb-6.6/gdb/inflow.c
--- gdb-6.6-orig/gdb/inflow.c 2006-02-10 23:01:43.000000000 +0100
+++ gdb-6.6/gdb/inflow.c 2007-04-08 20:56:48.000000000 +0200
@@ -549,17 +549,20 @@ new_tty (void)
if (tty != 0)
{
close (0);
- dup (tty);
+ /* Unused result. */
+ 1 && dup (tty);
}
if (tty != 1)
{
close (1);
- dup (tty);
+ /* Unused result. */
+ 1 && dup (tty);
}
if (tty != 2)
{
close (2);
- dup (tty);
+ /* Unused result. */
+ 1 && dup (tty);
}
if (tty > 2)
close (tty);
diff -u -rup gdb-6.6-orig/gdb/linux-nat.c gdb-6.6/gdb/linux-nat.c
--- gdb-6.6-orig/gdb/linux-nat.c 2007-04-08 20:49:11.000000000 +0200
+++ gdb-6.6/gdb/linux-nat.c 2007-04-08 20:54:08.000000000 +0200
@@ -2972,7 +2972,8 @@ linux_nat_info_proc_cmd (char *args, int
sprintf (fname1, "/proc/%lld/cmdline", pid);
if ((procfile = fopen (fname1, "r")) > 0)
{
- fgets (buffer, sizeof (buffer), procfile);
+ /* Unused result. */
+ 1 && fgets (buffer, sizeof (buffer), procfile);
printf_filtered ("cmdline = '%s'\n", buffer);
fclose (procfile);
}
diff -u -rup gdb-6.6-orig/gdb/main.c gdb-6.6/gdb/main.c
--- gdb-6.6-orig/gdb/main.c 2007-04-08 20:49:09.000000000 +0200
+++ gdb-6.6/gdb/main.c 2007-04-08 20:55:30.000000000 +0200
@@ -195,7 +195,8 @@ captured_main (void *data)
line[0] = '\0'; /* Terminate saved (now empty) cmd line */
instream = stdin;
- getcwd (gdb_dirbuf, sizeof (gdb_dirbuf));
+ /* Unused result. */
+ 1 && getcwd (gdb_dirbuf, sizeof (gdb_dirbuf));
current_directory = gdb_dirbuf;
gdb_stdout = stdio_fileopen (stdout);
diff -u -rup gdb-6.6-orig/gdb/mi/mi-cmd-env.c gdb-6.6/gdb/mi/mi-cmd-env.c
--- gdb-6.6-orig/gdb/mi/mi-cmd-env.c 2007-04-08 20:49:09.000000000 +0200
+++ gdb-6.6/gdb/mi/mi-cmd-env.c 2007-04-08 20:55:11.000000000 +0200
@@ -80,7 +80,8 @@ mi_cmd_env_pwd (char *command, char **ar
/* Otherwise the mi level is 2 or higher. */
- getcwd (gdb_dirbuf, sizeof (gdb_dirbuf));
+ /* Unused result. */
+ 1 && getcwd (gdb_dirbuf, sizeof (gdb_dirbuf));
ui_out_field_string (uiout, "cwd", gdb_dirbuf);
return MI_CMD_DONE;
diff -u -rup gdb-6.6-orig/gdb/top.c gdb-6.6/gdb/top.c
--- gdb-6.6-orig/gdb/top.c 2007-04-08 20:49:10.000000000 +0200
+++ gdb-6.6/gdb/top.c 2007-04-08 20:55:46.000000000 +0200
@@ -1643,7 +1643,8 @@ gdb_init (char *argv0)
/* Run the init function of each source file */
- getcwd (gdb_dirbuf, sizeof (gdb_dirbuf));
+ /* Unused result. */
+ 1 && getcwd (gdb_dirbuf, sizeof (gdb_dirbuf));
current_directory = gdb_dirbuf;
#ifdef __MSDOS__
diff -u -rup gdb-6.6-orig/gdb/ui-file.c gdb-6.6/gdb/ui-file.c
--- gdb-6.6-orig/gdb/ui-file.c 2005-12-17 23:34:03.000000000 +0100
+++ gdb-6.6/gdb/ui-file.c 2007-04-08 20:56:21.000000000 +0200
@@ -482,7 +482,8 @@ stdio_file_write (struct ui_file *file,
if (stdio->magic != &stdio_file_magic)
internal_error (__FILE__, __LINE__,
_("stdio_file_write: bad magic number"));
- fwrite (buf, length_buf, 1, stdio->file);
+ /* Unused result. */
+ 1 && fwrite (buf, length_buf, 1, stdio->file);
}
static void
diff -u -rup gdb-6.6-orig/gdb/utils.c gdb-6.6/gdb/utils.c
--- gdb-6.6-orig/gdb/utils.c 2007-04-08 20:49:09.000000000 +0200
+++ gdb-6.6/gdb/utils.c 2007-04-08 20:56:01.000000000 +0200
@@ -718,7 +718,8 @@ internal_vproblem (struct internal_probl
abort (); /* NOTE: GDB has only three calls to abort(). */
default:
dejavu = 3;
- write (STDERR_FILENO, msg, sizeof (msg));
+ /* Unused result. */
+ 1 && write (STDERR_FILENO, msg, sizeof (msg));
exit (1);
}
}
--- ./gdb/gdbserver/gdbreplay.c 29 Mar 2007 01:06:47 -0000 1.14
+++ ./gdb/gdbserver/gdbreplay.c 8 Aug 2007 20:32:12 -0000
@@ -358,7 +358,12 @@ expect (FILE *fp)
{
break;
}
- read (remote_desc, &fromgdb, 1);
+ if (read (remote_desc, &fromgdb, 1) != 1)
+ {
+ /* Error gets reported below. */
+ fromlog = 0;
+ break;
+ }
}
while (fromlog == fromgdb);
if (fromlog != EOL)
@@ -385,7 +390,11 @@ play (FILE *fp)
while ((fromlog = logchar (fp)) != EOL)
{
ch = fromlog;
- write (remote_desc, &ch, 1);
+ if (write (remote_desc, &ch, 1) != 1)
+ {
+ sync_error (fp, "Sync error during write of gdb packet", ch, 0);
+ break;
+ }
}
}

View File

@ -0,0 +1,21 @@
2005-09-22 Bastien Nocera <bnocera@redhat.com>
* symtab.c (find_line_pc_range): Don't free up pc_list
unconditionally as it may not be allocated.
--- gdb-6.3/gdb/symtab.c.fix 2005-09-22 16:24:06.000000000 -0400
+++ gdb-6.3/gdb/symtab.c 2005-09-22 16:26:17.000000000 -0400
@@ -2427,9 +2427,10 @@ find_line_pc_range (struct symtab_and_li
/* FIXME: have to handle ctors/dtors where line equates to multiple
pc ranges. */
if (startaddr == 0)
- startaddr = pc_list[0];
-
- xfree (pc_list);
+ {
+ startaddr = pc_list[0];
+ xfree (pc_list);
+ }
/* This whole function is based on address. For example, if line 10 has
two parts, one from 0x100 to 0x200 and one from 0x300 to 0x400, then

View File

@ -1,15 +1,9 @@
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-BEA-testsuite.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.
diff --git a/gdb/testsuite/gdb.threads/threadcrash.c b/gdb/testsuite/gdb.threads/threadcrash.c
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.threads/threadcrash.c
Index: ./gdb/testsuite/gdb.threads/threadcrash.c
===================================================================
RCS file: gdb/testsuite/gdb.threads/threadcrash.c
diff -N gdb/testsuite/gdb.threads/threadcrash.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ./gdb/testsuite/gdb.threads/threadcrash.c 31 Oct 2006 17:54:38 -0000
@@ -0,0 +1,301 @@
+/*
+ * The point of this program is to crash in a multi-threaded app.
@ -312,10 +306,12 @@ new file mode 100644
+
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.threads/threadcrash.exp b/gdb/testsuite/gdb.threads/threadcrash.exp
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.threads/threadcrash.exp
Index: ./gdb/testsuite/gdb.threads/threadcrash.exp
===================================================================
RCS file: gdb/testsuite/gdb.threads/threadcrash.exp
diff -N gdb/testsuite/gdb.threads/threadcrash.exp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ./gdb/testsuite/gdb.threads/threadcrash.exp 31 Oct 2006 17:54:38 -0000
@@ -0,0 +1,37 @@
+# threadcrash.exp - The point of this program is to crash in a multi-threaded app.
+
@ -323,7 +319,7 @@ new file mode 100644
+set testfile threadcrash
+set srcfile ${testfile}.c
+set shellfile ${srcdir}/${subdir}/${testfile}.sh
+set binfile [standard_output_file ${testfile}]
+set binfile ${objdir}/${subdir}/${testfile}
+
+set GDB_abs ${GDB}
+if [regexp "^\[^/\]" ${GDB_abs}] {
@ -341,7 +337,7 @@ new file mode 100644
+}
+
+# ${shellfile} argument must not contain any directories.
+set fd [open "|bash ${shellfile} ${binfile} $GDB $INTERNAL_GDBFLAGS $GDBFLAGS [host_info gdb_opts]" r]
+set fd [open "|bash ${shellfile} ${binfile} $GDB -nw $GDBFLAGS" r]
+while { [gets $fd line] >= 0 } {
+ if [regexp " PASS: (.*)$" $line trash message] {
+ pass $message
@ -354,10 +350,12 @@ new file mode 100644
+}
+
+return 0
diff --git a/gdb/testsuite/gdb.threads/threadcrash.sh b/gdb/testsuite/gdb.threads/threadcrash.sh
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.threads/threadcrash.sh
Index: ./gdb/testsuite/gdb.threads/threadcrash.sh
===================================================================
RCS file: gdb/testsuite/gdb.threads/threadcrash.sh
diff -N gdb/testsuite/gdb.threads/threadcrash.sh
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ./gdb/testsuite/gdb.threads/threadcrash.sh 31 Oct 2006 17:54:38 -0000
@@ -0,0 +1,324 @@
+#! /bin/bash
+
@ -482,7 +480,7 @@ new file mode 100644
+ local FAILURES=0
+
+ mustNotHave '??' || ((FAILURES++))
+ mustHaveCorrectAmount 11 threadcrash.c: || ((FAILURES++))
+ mustHaveCorrectAmount 12 threadcrash.c: || ((FAILURES++))
+
+ mustHaveSevenThreads || ((FAILURES++))
+ mustHaveSequence sleep "makeSyscall (ignored=" || ((FAILURES++))
@ -683,10 +681,12 @@ new file mode 100644
+rm -rf $WORKDIR
+
+exit $FAILURES
diff --git a/gdb/testsuite/gdb.threads/threadcrash.sh-orig b/gdb/testsuite/gdb.threads/threadcrash.sh-orig
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.threads/threadcrash.sh-orig
Index: ./gdb/testsuite/gdb.threads/threadcrash.sh-orig
===================================================================
RCS file: gdb/testsuite/gdb.threads/threadcrash.sh-orig
diff -N gdb/testsuite/gdb.threads/threadcrash.sh-orig
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ./gdb/testsuite/gdb.threads/threadcrash.sh-orig 31 Oct 2006 17:54:38 -0000
@@ -0,0 +1,248 @@
+#! /bin/bash
+

View File

@ -0,0 +1,437 @@
2007-01-21 Jan Kratochvil <jan.kratochvil@redhat.com>
Daniel Jacobowitz <dan@codesourcery.com>
* buildsym.c (end_symtab): Use preallocated symtab if available.
Fill in SYMBOL_SYMTAB.
* buildsym.h (struct subfile): Add symtab member.
* dwarf2read.c (struct dwarf2_cu): Add line_header.
(struct file_entry): Add symtab.
(free_cu_line_header): New function.
(read_file_scope): Use it. Save line_header in the cu. Process
lines before DIEs.
(add_file_name): Initialize new symtab member.
(dwarf_decode_lines): Create symtabs for included files.
(new_symbol): Set SYMBOL_SYMTAB.
* symtab.c (lookup_symbol): Use SYMBOL_SYMTAB.
(search_symbols): Likewise.
* symtab.h (struct symbol): Add symtab member.
(SYMBOL_SYMTAB): Define.
2007-01-21 Jan Kratochvil <jan.kratochvil@redhat.com>
Daniel Jacobowitz <dan@codesourcery.com>
* gdb.base/included.c, gdb.base/included.exp,
gdb.base/included.h: New files.
===================================================================
RCS file: /cvs/src/src/gdb/buildsym.c,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -r1.45 -r1.46
--- src/gdb/buildsym.c 2007/01/09 17:58:50 1.45
+++ src/gdb/buildsym.c 2007/01/21 16:49:40 1.46
@@ -959,7 +959,10 @@
}
/* Now, allocate a symbol table. */
- symtab = allocate_symtab (subfile->name, objfile);
+ if (subfile->symtab == NULL)
+ symtab = allocate_symtab (subfile->name, objfile);
+ else
+ symtab = subfile->symtab;
/* Fill in its components. */
symtab->blockvector = blockvector;
@@ -1048,6 +1051,26 @@
symtab->primary = 1;
}
+ /* Default any symbols without a specified symtab to the primary
+ symtab. */
+ if (blockvector)
+ {
+ int block_i;
+
+ for (block_i = 0; block_i < BLOCKVECTOR_NBLOCKS (blockvector); block_i++)
+ {
+ struct block *block = BLOCKVECTOR_BLOCK (blockvector, block_i);
+ struct symbol *sym;
+ struct dict_iterator iter;
+
+ for (sym = dict_iterator_first (BLOCK_DICT (block), &iter);
+ sym != NULL;
+ sym = dict_iterator_next (&iter))
+ if (SYMBOL_SYMTAB (sym) == NULL)
+ SYMBOL_SYMTAB (sym) = symtab;
+ }
+ }
+
last_source_file = NULL;
current_subfile = NULL;
pending_macros = NULL;
===================================================================
RCS file: /cvs/src/src/gdb/buildsym.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- src/gdb/buildsym.h 2007/01/09 17:58:50 1.15
+++ src/gdb/buildsym.h 2007/01/21 16:49:40 1.16
@@ -70,6 +70,7 @@
enum language language;
char *producer;
char *debugformat;
+ struct symtab *symtab;
};
EXTERN struct subfile *subfiles;
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2read.c,v
retrieving revision 1.211
retrieving revision 1.212
diff -u -r1.211 -r1.212
--- src/gdb/dwarf2read.c 2007/01/09 17:58:50 1.211
+++ src/gdb/dwarf2read.c 2007/01/21 16:49:40 1.212
@@ -341,6 +341,9 @@
partial symbol tables do not have dependencies. */
htab_t dependencies;
+ /* Header data from the line table, during full symbol processing. */
+ struct line_header *line_header;
+
/* Mark used when releasing cached dies. */
unsigned int mark : 1;
@@ -432,6 +435,7 @@
unsigned int mod_time;
unsigned int length;
int included_p; /* Non-zero if referenced by the Line Number Program. */
+ struct symtab *symtab; /* The associated symbol table, if any. */
} *file_names;
/* The start and end of the statement program following this
@@ -2754,6 +2758,15 @@
}
static void
+free_cu_line_header (void *arg)
+{
+ struct dwarf2_cu *cu = arg;
+
+ free_line_header (cu->line_header);
+ cu->line_header = NULL;
+}
+
+static void
read_file_scope (struct die_info *die, struct dwarf2_cu *cu)
{
struct objfile *objfile = cu->objfile;
@@ -2823,18 +2836,9 @@
initialize_cu_func_list (cu);
- /* Process all dies in compilation unit. */
- if (die->child != NULL)
- {
- child_die = die->child;
- while (child_die && child_die->tag)
- {
- process_die (child_die, cu);
- child_die = sibling_die (child_die);
- }
- }
-
- /* Decode line number information if present. */
+ /* Decode line number information if present. We do this before
+ processing child DIEs, so that the line header table is available
+ for DW_AT_decl_file. */
attr = dwarf2_attr (die, DW_AT_stmt_list, cu);
if (attr)
{
@@ -2842,12 +2846,23 @@
line_header = dwarf_decode_line_header (line_offset, abfd, cu);
if (line_header)
{
- make_cleanup ((make_cleanup_ftype *) free_line_header,
- (void *) line_header);
+ cu->line_header = line_header;
+ make_cleanup (free_cu_line_header, cu);
dwarf_decode_lines (line_header, comp_dir, abfd, cu, NULL);
}
}
+ /* Process all dies in compilation unit. */
+ if (die->child != NULL)
+ {
+ child_die = die->child;
+ while (child_die && child_die->tag)
+ {
+ process_die (child_die, cu);
+ child_die = sibling_die (child_die);
+ }
+ }
+
/* Decode macro information, if present. Dwarf 2 macro information
refers to information in the line number info statement program
header, so we can only read it if we've read the header
@@ -6457,6 +6472,7 @@
fe->mod_time = mod_time;
fe->length = length;
fe->included_p = 0;
+ fe->symtab = NULL;
}
@@ -6644,7 +6660,7 @@
CORE_ADDR baseaddr;
struct objfile *objfile = cu->objfile;
const int decode_for_pst_p = (pst != NULL);
- struct subfile *last_subfile = NULL;
+ struct subfile *last_subfile = NULL, *first_subfile = current_subfile;
baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
@@ -6869,6 +6885,35 @@
dwarf2_create_include_psymtab (include_name, pst, objfile);
}
}
+ else
+ {
+ /* Make sure a symtab is created for every file, even files
+ which contain only variables (i.e. no code with associated
+ line numbers). */
+
+ int i;
+ struct file_entry *fe;
+
+ for (i = 0; i < lh->num_file_names; i++)
+ {
+ char *dir = NULL;
+ fe = &lh->file_names[i];
+ if (fe->dir_index)
+ dir = lh->include_dirs[fe->dir_index - 1];
+ dwarf2_start_subfile (fe->name, dir, comp_dir);
+
+ /* Skip the main file; we don't need it, and it must be
+ allocated last, so that it will show up before the
+ non-primary symtabs in the objfile's symtab list. */
+ if (current_subfile == first_subfile)
+ continue;
+
+ if (current_subfile->symtab == NULL)
+ current_subfile->symtab = allocate_symtab (current_subfile->name,
+ cu->objfile);
+ fe->symtab = current_subfile->symtab;
+ }
+ }
}
/* Start a subfile for DWARF. FILENAME is the name of the file and
@@ -7024,6 +7069,23 @@
{
SYMBOL_LINE (sym) = DW_UNSND (attr);
}
+
+ attr = dwarf2_attr (die, DW_AT_decl_file, cu);
+ if (attr)
+ {
+ int file_index = DW_UNSND (attr);
+ if (cu->line_header == NULL
+ || file_index > cu->line_header->num_file_names)
+ complaint (&symfile_complaints,
+ _("file index out of range"));
+ else
+ {
+ struct file_entry *fe;
+ fe = &cu->line_header->file_names[file_index - 1];
+ SYMBOL_SYMTAB (sym) = fe->symtab;
+ }
+ }
+
switch (die->tag)
{
case DW_TAG_label:
===================================================================
RCS file: /cvs/src/src/gdb/symtab.c,v
retrieving revision 1.152
retrieving revision 1.153
diff -u -r1.152 -r1.153
--- src/gdb/symtab.c 2007/01/09 22:43:08 1.152
+++ src/gdb/symtab.c 2007/01/21 16:49:40 1.153
@@ -1133,6 +1133,10 @@
if (needtofreename)
xfree (demangled_name);
+ /* Override the returned symtab with the symbol's specific one. */
+ if (returnval != NULL && symtab != NULL)
+ *symtab = SYMBOL_SYMTAB (returnval);
+
return returnval;
}
@@ -3008,7 +3012,11 @@
QUIT;
/* If it would match (logic taken from loop below)
- load the file and go on to the next one */
+ load the file and go on to the next one. We check the
+ filename here, but that's a bit bogus: we don't know
+ what file it really comes from until we have full
+ symtabs. The symbol might be in a header file included by
+ this psymtab. This only affects Insight. */
if (file_matches (ps->filename, files, nfiles)
&& ((regexp == NULL
|| re_exec (SYMBOL_NATURAL_NAME (*psym)) != 0)
@@ -3087,8 +3095,10 @@
b = BLOCKVECTOR_BLOCK (bv, i);
ALL_BLOCK_SYMBOLS (b, iter, sym)
{
+ struct symtab *real_symtab = SYMBOL_SYMTAB (sym);
QUIT;
- if (file_matches (s->filename, files, nfiles)
+
+ if (file_matches (real_symtab->filename, files, nfiles)
&& ((regexp == NULL
|| re_exec (SYMBOL_NATURAL_NAME (sym)) != 0)
&& ((kind == VARIABLES_DOMAIN && SYMBOL_CLASS (sym) != LOC_TYPEDEF
@@ -3101,7 +3111,7 @@
/* match */
psr = (struct symbol_search *) xmalloc (sizeof (struct symbol_search));
psr->block = i;
- psr->symtab = s;
+ psr->symtab = real_symtab;
psr->symbol = sym;
psr->msymbol = NULL;
psr->next = NULL;
===================================================================
RCS file: /cvs/src/src/gdb/symtab.h,v
retrieving revision 1.100
retrieving revision 1.101
diff -u -r1.100 -r1.101
--- src/gdb/symtab.h 2007/01/09 17:58:59 1.100
+++ src/gdb/symtab.h 2007/01/21 16:49:40 1.101
@@ -609,6 +609,10 @@
struct type *type;
+ /* The symbol table containing this symbol. This is the file
+ associated with LINE. */
+ struct symtab *symtab;
+
/* Domain code. */
ENUM_BITFIELD(domain_enum_tag) domain : 6;
@@ -664,6 +668,7 @@
#define SYMBOL_CLASS(symbol) (symbol)->aclass
#define SYMBOL_TYPE(symbol) (symbol)->type
#define SYMBOL_LINE(symbol) (symbol)->line
+#define SYMBOL_SYMTAB(symbol) (symbol)->symtab
#define SYMBOL_BASEREG(symbol) (symbol)->aux_value.basereg
#define SYMBOL_OBJFILE(symbol) (symbol)->aux_value.objfile
#define SYMBOL_OPS(symbol) (symbol)->ops
/cvs/src/src/gdb/testsuite/gdb.base/included.c,v --> standard output
revision 1.1
--- src/gdb/testsuite/gdb.base/included.c
+++ src/gdb/testsuite/gdb.base/included.c 2007-12-21 21:10:02.262608000 +0000
@@ -0,0 +1,26 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2007 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ USA. */
+
+#include "included.h"
+
+int
+main()
+{
+ return 0;
+}
/cvs/src/src/gdb/testsuite/gdb.base/included.exp,v --> standard output
revision 1.1
--- src/gdb/testsuite/gdb.base/included.exp
+++ src/gdb/testsuite/gdb.base/included.exp 2007-12-21 21:10:02.521938000 +0000
@@ -0,0 +1,46 @@
+# Copyright 2007 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+set testfile "included"
+set srcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
+ untested included.exp
+ return -1
+}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+gdb_test "set listsize 1" ""
+
+gdb_test "list main" ".*"
+get_debug_format
+set non_dwarf [expr ! [test_debug_format "DWARF 2"]]
+
+# We should be able to find the source file containing the definition,
+# even though it was an included header.
+if { $non_dwarf } { setup_xfail *-*-* }
+gdb_test "list integer" "int integer;"
+
+gdb_test "ptype integer" "type = int"
+
+# We should report that integer comes from the header file.
+if { $non_dwarf } { setup_xfail *-*-* }
+gdb_test "info variables integer" "\r\nFile \[^\r\n\]*/${subdir}/${testfile}.h:\r\nint integer;"
/cvs/src/src/gdb/testsuite/gdb.base/included.h,v --> standard output
revision 1.1
--- src/gdb/testsuite/gdb.base/included.h
+++ src/gdb/testsuite/gdb.base/included.h 2007-12-21 21:10:02.732382000 +0000
@@ -0,0 +1,20 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2007 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ USA. */
+
+int integer;

View File

@ -1,33 +1,15 @@
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-bz109921-DW_AT_decl_file-test.patch
;; Find symbols properly at their original (included) file (BZ 109921).
;;=fedoratest
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=109921
It is duplicite to its upstream variant:
http://sourceware.org/ml/gdb-cvs/2007-01/msg00157.html
http://sourceware.org/ml/gdb-patches/2007-01/msg00434.html
2007-01-21 Jan Kratochvil <jan.kratochvil@redhat.com>
Daniel Jacobowitz <dan@codesourcery.com>
* gdb.base/included.c, gdb.base/included.exp,
gdb.base/included.h: New files.
------------------------------------------------------------------------------
It is duplicite to its upstream variant at:
gdb-6.5-bz109921-DW_AT_decl_file-fix.patch
2007-01-09 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.dwarf2/dw2-included.exp, gdb.dwarf2/dw2-included.c,
gdb.dwarf2/dw2-included.h: New files.
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-included.c b/gdb/testsuite/gdb.dwarf2/dw2-included.c
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/dw2-included.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ./gdb/testsuite/gdb.dwarf2/dw2-included.c 2 Jan 2007 00:20:27 -0000
@@ -0,0 +1,26 @@
+/* This testcase is part of GDB, the GNU debugger.
+
@ -55,10 +37,8 @@ new file mode 100644
+{
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-included.exp b/gdb/testsuite/gdb.dwarf2/dw2-included.exp
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/dw2-included.exp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ./gdb/testsuite/gdb.dwarf2/dw2-included.exp 2 Jan 2007 00:20:27 -0000
@@ -0,0 +1,47 @@
+# Copyright 2006 Free Software Foundation, Inc.
+
@ -91,7 +71,7 @@ new file mode 100644
+
+set testfile "dw2-included"
+set srcfile ${testfile}.c
+set binfile [standard_output_file ${testfile}]
+set binfile ${objdir}/${subdir}/${testfile}
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
+ return -1
@ -106,11 +86,9 @@ new file mode 100644
+gdb_test "list integer" "int integer;\r"
+gdb_test "ptype integer" "type = int\r"
+# Path varies depending on the build location.
+gdb_test "info variables integer" "\r\nFile \[^\r\n\]*/gdb.dwarf2/dw2-included.h:\r\n${decimal}:.*int integer;\r"
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-included.h b/gdb/testsuite/gdb.dwarf2/dw2-included.h
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/dw2-included.h
+gdb_test "info variables integer" "\r\nFile \[^\r\n\]*/gdb.dwarf2/dw2-included.h:\r\nint integer;\r"
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ./gdb/testsuite/gdb.dwarf2/dw2-included.h 2 Jan 2007 00:20:27 -0000
@@ -0,0 +1,20 @@
+/* This testcase is part of GDB, the GNU debugger.
+

View File

@ -0,0 +1,30 @@
2006-12-30 Andrew Cagney <cagney@redhat.com>
Jan Kratochvil <jan.kratochvil@redhat.com>
* dwarf2-frame.c (execute_cfa_program): New support of
`DW_CFA_GNU_negative_offset_extended'.
Index: ./gdb/dwarf2-frame.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2-frame.c,v
retrieving revision 1.64
diff -u -p -r1.64 dwarf2-frame.c
--- ./gdb/dwarf2-frame.c 28 Nov 2006 17:28:29 -0000 1.64
+++ ./gdb/dwarf2-frame.c 30 Dec 2006 18:24:58 -0000
@@ -555,6 +555,15 @@ bad CFI data; mismatched DW_CFA_restore_
insn_ptr = read_uleb128 (insn_ptr, insn_end, &utmp);
break;
+ case DW_CFA_GNU_negative_offset_extended:
+ insn_ptr = read_uleb128 (insn_ptr, insn_end, &reg);
+ insn_ptr = read_uleb128 (insn_ptr, insn_end, &offset);
+ offset *= fs->data_align;
+ dwarf2_frame_state_alloc_regs (&fs->regs, reg + 1);
+ fs->regs.reg[reg].how = DWARF2_FRAME_REG_SAVED_OFFSET;
+ fs->regs.reg[reg].loc.offset = -offset;
+ break;
+
default:
internal_error (__FILE__, __LINE__, _("Unknown CFI encountered."));
}

View File

@ -0,0 +1,509 @@
2006-12-30 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.arch/i386-gnu-cfi.exp, gdb.arch/i386-gnu-cfi.c,
gdb.arch/i386-gnu-cfi-asm.S: New files.
Index: ./gdb/testsuite/gdb.arch/i386-gnu-cfi-asm.S
===================================================================
RCS file: ./gdb/testsuite/gdb.arch/i386-gnu-cfi-asm.S
diff -N ./gdb/testsuite/gdb.arch/i386-gnu-cfi-asm.S
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ./gdb/testsuite/gdb.arch/i386-gnu-cfi-asm.S 30 Dec 2006 18:25:02 -0000
@@ -0,0 +1,357 @@
+/* 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@gnu.org
+ *
+ * This file is part of the gdb testsuite.
+ *
+ * It was generated using
+ * "gcc -g -O9 -S -o gate.s gate.c -fasynchronous-unwind-tables",
+ * using the following source file:
+ *
+ *
+ * void *gate (void *(*gate) (void *data), void *data)
+ * {
+ * return 1 + (*gate) (data);
+ * }
+ *
+ * Changes are marked as `CHANGE' below.
+ */
+
+ .file "gate.c"
+ .section .debug_abbrev,"",@progbits
+.Ldebug_abbrev0:
+ .section .debug_info,"",@progbits
+.Ldebug_info0:
+ .section .debug_line,"",@progbits
+.Ldebug_line0:
+ .text
+.Ltext0:
+ .p2align 4,,15
+.globl gate
+ .type gate, @function
+gate:
+.LFB2:
+ .file 1 "gate.c"
+ .loc 1 2 0
+.LVL0:
+ pushl %ebp
+.LCFI0:
+ movl %esp, %ebp
+.LCFI1:
+ subl $8, %esp
+.LCFI2:
+ .loc 1 3 0
+ movl 12(%ebp), %eax
+ movl %eax, (%esp)
+ call *8(%ebp)
+ .loc 1 4 0
+ leave
+ .loc 1 3 0
+ addl $1, %eax
+ .loc 1 4 0
+ ret
+.LFE2:
+ .size gate, .-gate
+ .section .debug_frame,"",@progbits
+.Lframe0:
+ .long .LECIE0-.LSCIE0
+.LSCIE0:
+ .long 0xffffffff
+ .byte 0x1
+ .string ""
+ .uleb128 0x1
+ .sleb128 -4
+ .byte 0x8
+ .byte 0xc
+ .uleb128 0x4
+ .uleb128 0x4
+ .byte 0x88
+ .uleb128 0x1
+ .align 4
+.LECIE0:
+.LSFDE0:
+ .long .LEFDE0-.LASFDE0
+.LASFDE0:
+ .long .Lframe0
+ .long .LFB2
+ .long .LFE2-.LFB2
+ .byte 0x4
+ .long .LCFI0-.LFB2
+ .byte 0xe
+ .uleb128 0x8
+ .byte 0x85
+ .uleb128 0x2
+
+ /* CHANGE */
+ .byte 0x2f
+ .uleb128 0x1
+ .uleb128 0x0
+ /* CHANGE */
+
+ .byte 0x4
+ .long .LCFI1-.LCFI0
+ .byte 0xd
+ .uleb128 0x5
+ .align 4
+.LEFDE0:
+ .section .eh_frame,"a",@progbits
+.Lframe1:
+ .long .LECIE1-.LSCIE1
+.LSCIE1:
+ .long 0x0
+ .byte 0x1
+ .string ""
+ .uleb128 0x1
+ .sleb128 -4
+ .byte 0x8
+ .byte 0xc
+ .uleb128 0x4
+ .uleb128 0x4
+ .byte 0x88
+ .uleb128 0x1
+ .align 4
+.LECIE1:
+.LSFDE1:
+ .long .LEFDE1-.LASFDE1
+.LASFDE1:
+ .long .LASFDE1-.Lframe1
+ .long .LFB2
+ .long .LFE2-.LFB2
+ .byte 0x4
+ .long .LCFI0-.LFB2
+ .byte 0xe
+ .uleb128 0x8
+ .byte 0x85
+ .uleb128 0x2
+
+ /* CHANGE */
+ .byte 0x2f
+ .uleb128 0x1
+ .uleb128 0x0
+ /* CHANGE */
+
+ .byte 0x4
+ .long .LCFI1-.LCFI0
+ .byte 0xd
+ .uleb128 0x5
+ .align 4
+.LEFDE1:
+ .text
+.Letext0:
+ .section .debug_loc,"",@progbits
+.Ldebug_loc0:
+.LLST0:
+ .long .LFB2-.Ltext0
+ .long .LCFI0-.Ltext0
+ .value 0x2
+ .byte 0x74
+ .sleb128 4
+ .long .LCFI0-.Ltext0
+ .long .LCFI1-.Ltext0
+ .value 0x2
+ .byte 0x74
+ .sleb128 8
+ .long .LCFI1-.Ltext0
+ .long .LFE2-.Ltext0
+ .value 0x2
+ .byte 0x75
+ .sleb128 8
+ .long 0x0
+ .long 0x0
+ .section .debug_info
+ .long 0x74
+ .value 0x2
+ .long .Ldebug_abbrev0
+ .byte 0x4
+ .uleb128 0x1
+ .long .Ldebug_line0
+ .long .Letext0
+ .long .Ltext0
+ .long .LASF2
+ .byte 0x1
+ .long .LASF3
+ .long .LASF4
+ .uleb128 0x2
+ .long 0x5f
+ .byte 0x1
+ .long .LASF0
+ .byte 0x1
+ .byte 0x2
+ .byte 0x1
+ .long 0x5f
+ .long .LFB2
+ .long .LFE2
+ .long .LLST0
+ .uleb128 0x3
+ .long .LASF0
+ .byte 0x1
+ .byte 0x1
+ .long 0x71
+ .byte 0x2
+ .byte 0x91
+ .sleb128 0
+ .uleb128 0x3
+ .long .LASF1
+ .byte 0x1
+ .byte 0x1
+ .long 0x5f
+ .byte 0x2
+ .byte 0x91
+ .sleb128 4
+ .byte 0x0
+ .uleb128 0x4
+ .byte 0x4
+ .uleb128 0x5
+ .long 0x71
+ .byte 0x1
+ .long 0x5f
+ .uleb128 0x6
+ .long 0x5f
+ .byte 0x0
+ .uleb128 0x7
+ .byte 0x4
+ .long 0x61
+ .byte 0x0
+ .section .debug_abbrev
+ .uleb128 0x1
+ .uleb128 0x11
+ .byte 0x1
+ .uleb128 0x10
+ .uleb128 0x6
+ .uleb128 0x12
+ .uleb128 0x1
+ .uleb128 0x11
+ .uleb128 0x1
+ .uleb128 0x25
+ .uleb128 0xe
+ .uleb128 0x13
+ .uleb128 0xb
+ .uleb128 0x3
+ .uleb128 0xe
+ .uleb128 0x1b
+ .uleb128 0xe
+ .byte 0x0
+ .byte 0x0
+ .uleb128 0x2
+ .uleb128 0x2e
+ .byte 0x1
+ .uleb128 0x1
+ .uleb128 0x13
+ .uleb128 0x3f
+ .uleb128 0xc
+ .uleb128 0x3
+ .uleb128 0xe
+ .uleb128 0x3a
+ .uleb128 0xb
+ .uleb128 0x3b
+ .uleb128 0xb
+ .uleb128 0x27
+ .uleb128 0xc
+ .uleb128 0x49
+ .uleb128 0x13
+ .uleb128 0x11
+ .uleb128 0x1
+ .uleb128 0x12
+ .uleb128 0x1
+ .uleb128 0x40
+ .uleb128 0x6
+ .byte 0x0
+ .byte 0x0
+ .uleb128 0x3
+ .uleb128 0x5
+ .byte 0x0
+ .uleb128 0x3
+ .uleb128 0xe
+ .uleb128 0x3a
+ .uleb128 0xb
+ .uleb128 0x3b
+ .uleb128 0xb
+ .uleb128 0x49
+ .uleb128 0x13
+ .uleb128 0x2
+ .uleb128 0xa
+ .byte 0x0
+ .byte 0x0
+ .uleb128 0x4
+ .uleb128 0xf
+ .byte 0x0
+ .uleb128 0xb
+ .uleb128 0xb
+ .byte 0x0
+ .byte 0x0
+ .uleb128 0x5
+ .uleb128 0x15
+ .byte 0x1
+ .uleb128 0x1
+ .uleb128 0x13
+ .uleb128 0x27
+ .uleb128 0xc
+ .uleb128 0x49
+ .uleb128 0x13
+ .byte 0x0
+ .byte 0x0
+ .uleb128 0x6
+ .uleb128 0x5
+ .byte 0x0
+ .uleb128 0x49
+ .uleb128 0x13
+ .byte 0x0
+ .byte 0x0
+ .uleb128 0x7
+ .uleb128 0xf
+ .byte 0x0
+ .uleb128 0xb
+ .uleb128 0xb
+ .uleb128 0x49
+ .uleb128 0x13
+ .byte 0x0
+ .byte 0x0
+ .byte 0x0
+ .section .debug_pubnames,"",@progbits
+ .long 0x17
+ .value 0x2
+ .long .Ldebug_info0
+ .long 0x78
+ .long 0x25
+ .string "gate"
+ .long 0x0
+ .section .debug_aranges,"",@progbits
+ .long 0x1c
+ .value 0x2
+ .long .Ldebug_info0
+ .byte 0x4
+ .byte 0x0
+ .value 0x0
+ .value 0x0
+ .long .Ltext0
+ .long .Letext0-.Ltext0
+ .long 0x0
+ .long 0x0
+ .section .debug_str,"MS",@progbits,1
+.LASF1:
+ .string "data"
+.LASF0:
+ .string "gate"
+.LASF3:
+ .string "gate.c"
+.LASF4:
+ .string "/home/jkratoch/redhat/bz165025"
+.LASF2:
+ .string "GNU C 4.1.1 20061213 (Red Hat 4.1.1-46)"
+ .ident "GCC: (GNU) 4.1.1 20061213 (Red Hat 4.1.1-46)"
+ .section .note.GNU-stack,"",@progbits
Index: ./gdb/testsuite/gdb.arch/i386-gnu-cfi.c
===================================================================
RCS file: ./gdb/testsuite/gdb.arch/i386-gnu-cfi.c
diff -N ./gdb/testsuite/gdb.arch/i386-gnu-cfi.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ./gdb/testsuite/gdb.arch/i386-gnu-cfi.c 30 Dec 2006 18:25:02 -0000
@@ -0,0 +1,31 @@
+/* Unwinding of DW_CFA_GNU_negative_offset_extended test program.
+
+ Copyright 2006, 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 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. */
+
+#include <stdlib.h>
+
+/* i386-gnu-cfi-asm.S: */
+extern void *gate (void *(*gate) (void *data), void *data);
+
+int main (void)
+{
+ gate ((void *(*) (void *data)) abort, NULL);
+ return 0;
+}
Index: ./gdb/testsuite/gdb.arch/i386-gnu-cfi.exp
===================================================================
RCS file: ./gdb/testsuite/gdb.arch/i386-gnu-cfi.exp
diff -N ./gdb/testsuite/gdb.arch/i386-gnu-cfi.exp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ./gdb/testsuite/gdb.arch/i386-gnu-cfi.exp 30 Dec 2006 18:25:02 -0000
@@ -0,0 +1,94 @@
+# 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@gnu.org
+
+# This file is part of the gdb testsuite.
+
+# Unwinding of DW_CFA_GNU_negative_offset_extended test program.
+
+if $tracelevel {
+ strace $tracelevel
+}
+
+# Test i386 unwinder.
+
+set prms_id 0
+set bug_id 0
+
+if ![istarget "i?86-*-*"] then {
+ verbose "Skipping i386 unwinder tests."
+ return
+}
+
+set testfile "i386-gnu-cfi"
+set srcfilec ${testfile}.c
+set srcfileasm ${testfile}-asm.S
+set binfile ${objdir}/${subdir}/${testfile}
+
+# some targets have leading underscores on assembly symbols.
+# TODO: detect this automatically
+set additional_flags ""
+if [istarget "i?86-*-cygwin*"] then {
+ set additional_flags "additional_flags=-DSYMBOL_PREFIX=\"_\""
+}
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfilec} ${srcdir}/${subdir}/${srcfileasm}" "${binfile}" executable [list debug $additional_flags]] != "" } {
+ untested i386-gnu-cfi.exp
+ return -1
+}
+
+# Get things started.
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+# We should stop in abort(3).
+
+gdb_test "run" \
+ "Program received signal SIGABRT,.*" \
+ "run"
+
+# Backtrace would crash before.
+
+gdb_test "bt" \
+ "main \\(\\) at .*${testfile}.c.*" \
+ "backtrace"
+
+# Check we see the inserted `DW_CFA_GNU_negative_offset_extended' CFI.
+# We see there the original CFI-stored filename `gate.c'.
+
+gdb_test "up 3" \
+ "gate \\(\[^()\]*\\) at .*gate.c.*" \
+ "shift up to the modified frame"
+
+send_gdb "info frame\n";
+gdb_expect {
+ -re "Stack level 3, frame at (0x\[0-9a-f\]+):.*Saved registers:.* ecx at (0x\[0-9a-f\]+),.*" {
+ pass "Value of the CFI inserted register"
+ if { [string compare $expect_out(1,string) $expect_out(2,string)] } then {
+ fail "Value of the CFI inserted register"
+ } else {
+ pass "Value of the CFI inserted register"
+ }
+ }
+ default {
+ fail "Existence of the CFI inserted register"
+ }
+}

View File

@ -0,0 +1,100 @@
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=181390
2006-09-28 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb/utils.c (paddress): Disable cutting of the printed addresses
to the target's address bit size; user wants to see everything.
* gdb/value.c (value_as_address_core): Original `value_as_address'.
(value_as_address): New `value_as_address' wrapper - cut memory address
to the target's address bit size, bugreport by John Reiser.
Index: gdb-6.5/gdb/utils.c
===================================================================
RCS file: /cvs/src/src/gdb/utils.c,v
retrieving revision 1.169
diff -u -p -r1.169 utils.c
--- gdb-6.5.orig/gdb/utils.c 21 Sep 2006 13:50:51 -0000 1.169
+++ gdb-6.5/gdb/utils.c 28 Sep 2006 17:06:03 -0000
@@ -2596,6 +2596,14 @@ paddr_nz (CORE_ADDR addr)
const char *
paddress (CORE_ADDR addr)
{
+ /* Do not cut the address as the user should see all the information
+ available. Otherwise 64-bit gdb debugging 32-bit inferior would
+ report for `x/x 0xffffffffffffce70' error
+ `Cannot access memory at 0xffffce70' while the error occured just
+ because of the higher order bits 0xffffffff00000000 there.
+ This specific error no longer occurs as the address is now cut
+ during execution by `value_as_address'. */
+#if 0
/* Truncate address to the size of a target address, avoiding shifts
larger or equal than the width of a CORE_ADDR. The local
variable ADDR_BIT stops the compiler reporting a shift overflow
@@ -2609,6 +2617,8 @@ paddress (CORE_ADDR addr)
if (addr_bit < (sizeof (CORE_ADDR) * HOST_CHAR_BIT))
addr &= ((CORE_ADDR) 1 << addr_bit) - 1;
+#endif
+
return hex_string (addr);
}
Index: gdb-6.5/gdb/value.c
===================================================================
RCS file: /cvs/src/src/gdb/value.c,v
retrieving revision 1.36
diff -u -p -r1.36 value.c
--- gdb-6.5.orig/gdb/value.c 31 Mar 2006 10:36:18 -0000 1.36
+++ gdb-6.5/gdb/value.c 28 Sep 2006 17:06:03 -0000
@@ -950,11 +950,10 @@ value_as_double (struct value *val)
error (_("Invalid floating value found in program."));
return foo;
}
-/* Extract a value as a C pointer. Does not deallocate the value.
- Note that val's type may not actually be a pointer; value_as_long
- handles all the cases. */
-CORE_ADDR
-value_as_address (struct value *val)
+
+/* See `value_as_address' below - core of value to C pointer extraction. */
+static CORE_ADDR
+value_as_address_core (struct value *val)
{
/* Assume a CORE_ADDR can fit in a LONGEST (for now). Not sure
whether we want this to be true eventually. */
@@ -1054,6 +1053,33 @@ value_as_address (struct value *val)
return unpack_long (value_type (val), value_contents (val));
#endif
}
+
+/* Extract a value as a C pointer. Does not deallocate the value.
+ Note that val's type may not actually be a pointer; value_as_long
+ handles all the cases. */
+CORE_ADDR
+value_as_address (struct value *val)
+{
+ CORE_ADDR addr;
+
+ addr = value_as_address_core (val);
+
+ /* Truncate address to the size of a target address, avoiding shifts
+ larger or equal than the width of a CORE_ADDR. The local
+ variable ADDR_BIT stops the compiler reporting a shift overflow
+ when it won't occur. */
+ /* NOTE: This assumes that the significant address information is
+ kept in the least significant bits of ADDR - the upper bits were
+ either zero or sign extended. Should ADDRESS_TO_POINTER() or
+ some ADDRESS_TO_PRINTABLE() be used to do the conversion? */
+
+ int addr_bit = TARGET_ADDR_BIT;
+
+ if (addr_bit < (sizeof (CORE_ADDR) * HOST_CHAR_BIT))
+ addr &= ((CORE_ADDR) 1 << addr_bit) - 1;
+
+ return addr;
+}
/* Unpack raw data (copied from debugee, target byte order) at VALADDR
as a long, or as a double, assuming the raw data is described

View File

@ -1,16 +1,5 @@
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-bz185337-resolve-tls-without-debuginfo-v2.patch
;; Support TLS symbols (+`errno' suggestion if no pthread is found) (BZ 185337).
;;=push+jan: It should be replaced by Infinity project.
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=185337
2008-02-24 Jan Kratochvil <jan.kratochvil@redhat.com>
Port to GDB-6.8pre.
currently for trivial nonthreaded helloworld with no debug info up to -ggdb2 you
will get:
@ -27,10 +16,7 @@ will get:
Attached suggestion patch how to deal with the most common "errno" symbol
for the most common under-ggdb3 compiled programs.
Original patch hooked into target_translate_tls_address. But its inferior
call invalidates `struct frame *' in the callers - RH BZ 690908.
https://bugzilla.redhat.com/show_bug.cgi?id=1166549
2007-11-03 Jan Kratochvil <jan.kratochvil@redhat.com>
@ -41,24 +27,177 @@ glibc-debuginfo-2.7-2.x86_64: /usr/lib/debug/lib64/libc.so.6.debug:
<81a2> DW_AT_name : (indirect string, offset: 0x280e): __errno_location
<81a8> DW_AT_MIPS_linkage_name: (indirect string, offset: 0x2808): *__GI___errno_location
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -1210,6 +1210,10 @@ print_command_1 (const char *args, int voidprint)
--- ./gdb/dwarf2read.c 25 Oct 2007 20:54:27 -0000 1.236
+++ ./gdb/dwarf2read.c 3 Nov 2007 21:03:43 -0000
@@ -5550,8 +5550,8 @@ read_partial_die (struct partial_die_inf
{
case DW_AT_name:
if (exp != nullptr && *exp)
{
+ /* '*((int *(*) (void)) __errno_location) ()' is incompatible with
+ function descriptors. */
+ if (target_has_execution && strcmp (exp, "errno") == 0)
+ exp = "*(*(int *(*)(void)) __errno_location) ()";
expression_up expr = parse_expression (exp);
val = evaluate_expression (expr.get ());
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-errno.c b/gdb/testsuite/gdb.dwarf2/dw2-errno.c
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/dw2-errno.c
- /* Prefer DW_AT_MIPS_linkage_name over DW_AT_name. */
- if (part_die->name == NULL)
+ /* Prefer DW_AT_MIPS_linkage_name over DW_AT_name for non-C. */
+ if (cu->language == language_c || part_die->name == NULL)
part_die->name = DW_STRING (&attr);
break;
case DW_AT_comp_dir:
@@ -5559,7 +5559,9 @@ read_partial_die (struct partial_die_inf
part_die->dirname = DW_STRING (&attr);
break;
case DW_AT_MIPS_linkage_name:
- part_die->name = DW_STRING (&attr);
+ /* Prefer DW_AT_MIPS_linkage_name over DW_AT_name for non-C. */
+ if (cu->language != language_c || part_die->name == NULL)
+ part_die->name = DW_STRING (&attr);
break;
case DW_AT_low_pc:
has_low_pc_attr = 1;
@@ -7871,9 +7873,13 @@ dwarf2_linkage_name (struct die_info *di
{
struct attribute *attr;
- attr = dwarf2_attr (die, DW_AT_MIPS_linkage_name, cu);
- if (attr && DW_STRING (attr))
- return DW_STRING (attr);
+ /* Prefer DW_AT_MIPS_linkage_name over DW_AT_name for non-C. */
+ if (cu->language != language_c)
+ {
+ attr = dwarf2_attr (die, DW_AT_MIPS_linkage_name, cu);
+ if (attr && DW_STRING (attr))
+ return DW_STRING (attr);
+ }
attr = dwarf2_attr (die, DW_AT_name, cu);
if (attr && DW_STRING (attr))
return DW_STRING (attr);
diff -u -X /home/jkratoch/.diffi.list -rup gdb-6.6-orig/gdb/gdbtypes.c gdb-6.6/gdb/gdbtypes.c
--- gdb-6.6-orig/gdb/gdbtypes.c 2006-08-22 21:45:12.000000000 +0200
+++ gdb-6.6/gdb/gdbtypes.c 2007-11-08 22:23:37.000000000 +0100
@@ -49,6 +49,7 @@ struct type *builtin_type_char;
struct type *builtin_type_true_char;
struct type *builtin_type_short;
struct type *builtin_type_int;
+struct type *builtin_type_int_ptr;
struct type *builtin_type_long;
struct type *builtin_type_long_long;
struct type *builtin_type_signed_char;
@@ -3330,6 +3331,7 @@ build_gdbtypes (void)
init_type (TYPE_CODE_INT, TARGET_INT_BIT / TARGET_CHAR_BIT,
0,
"int", (struct objfile *) NULL);
+ builtin_type_int_ptr = make_pointer_type (builtin_type_int, NULL);
builtin_type_unsigned_int =
init_type (TYPE_CODE_INT, TARGET_INT_BIT / TARGET_CHAR_BIT,
TYPE_FLAG_UNSIGNED,
diff -u -X /home/jkratoch/.diffi.list -rup gdb-6.6-orig/gdb/gdbtypes.h gdb-6.6/gdb/gdbtypes.h
--- gdb-6.6-orig/gdb/gdbtypes.h 2007-11-08 22:07:59.000000000 +0100
+++ gdb-6.6/gdb/gdbtypes.h 2007-11-08 22:24:49.000000000 +0100
@@ -1024,6 +1024,7 @@ extern struct type *builtin_type_void;
extern struct type *builtin_type_char;
extern struct type *builtin_type_short;
extern struct type *builtin_type_int;
+extern struct type *builtin_type_int_ptr;
extern struct type *builtin_type_long;
extern struct type *builtin_type_signed_char;
extern struct type *builtin_type_unsigned_char;
diff -u -X /home/jkratoch/.diffi.list -rup gdb-6.6-orig/gdb/parse.c gdb-6.6/gdb/parse.c
--- gdb-6.6-orig/gdb/parse.c 2006-11-22 01:05:37.000000000 +0100
+++ gdb-6.6/gdb/parse.c 2007-11-08 22:22:42.000000000 +0100
@@ -386,6 +386,7 @@ write_exp_bitstring (struct stoken str)
the initial rationale is gone. */
static struct type *msym_text_symbol_type;
+static struct type *msym_text_symbol_errno_location_type;
static struct type *msym_data_symbol_type;
static struct type *msym_unknown_symbol_type;
static struct type *msym_tls_symbol_type;
@@ -431,7 +432,11 @@ write_exp_msymbol (struct minimal_symbol
case mst_text:
case mst_file_text:
case mst_solib_trampoline:
- write_exp_elt_type (msym_text_symbol_type);
+ if (msym_text_symbol_errno_location_type != NULL
+ && strcmp (SYMBOL_LINKAGE_NAME (msymbol), "__errno_location") == 0)
+ write_exp_elt_type (msym_text_symbol_errno_location_type);
+ else
+ write_exp_elt_type (msym_text_symbol_type);
break;
case mst_data:
@@ -1367,6 +1372,10 @@ build_parse (void)
msym_text_symbol_type =
init_type (TYPE_CODE_FUNC, 1, 0, "<text variable, no debug info>", NULL);
TYPE_TARGET_TYPE (msym_text_symbol_type) = builtin_type_int;
+ msym_text_symbol_errno_location_type =
+ init_type (TYPE_CODE_FUNC,
+ 1, 0, "<text variable for __errno_location, no debug info>", NULL);
+ TYPE_TARGET_TYPE (msym_text_symbol_errno_location_type ) = builtin_type_int_ptr;
msym_data_symbol_type =
init_type (TYPE_CODE_INT, TARGET_INT_BIT / HOST_CHAR_BIT, 0,
"<data variable, no debug info>", NULL);
diff -u -X /home/jkratoch/.diffi.list -rup gdb-6.6-orig/gdb/target.c gdb-6.6/gdb/target.c
--- gdb-6.6-orig/gdb/target.c 2007-11-08 22:07:59.000000000 +0100
+++ gdb-6.6/gdb/target.c 2007-11-08 22:35:34.000000000 +0100
@@ -817,6 +817,25 @@ pop_target (void)
internal_error (__FILE__, __LINE__, _("failed internal consistency check"));
}
+static int
+resolve_errno (void *arg)
+{
+ CORE_ADDR *arg_addr = arg;
+ struct expression *expr;
+ struct cleanup *old_chain = 0;
+ struct value *val;
+
+ expr = parse_expression ("__errno_location()");
+ old_chain = make_cleanup (free_current_contents, &expr);
+ val = evaluate_expression (expr);
+ *arg_addr = value_as_address (val);
+ release_value (val);
+ value_free (val);
+ do_cleanups (old_chain);
+
+ return 1;
+}
+
/* Using the objfile specified in BATON, find the address for the
current thread's thread-local storage with offset OFFSET. */
CORE_ADDR
@@ -904,7 +923,28 @@ target_translate_tls_address (struct obj
/* It wouldn't be wrong here to try a gdbarch method, too; finding
TLS is an ABI-specific thing. But we don't do that yet. */
else
- error (_("Cannot find thread-local variables on this target"));
+ {
+ struct minimal_symbol *msymbol;
+
+ msymbol = lookup_minimal_symbol ("errno", NULL, NULL);
+ if (msymbol != NULL
+ && SYMBOL_VALUE_ADDRESS (msymbol) == offset
+ && (SYMBOL_BFD_SECTION (msymbol)->owner == objfile->obfd
+ || (objfile->separate_debug_objfile != NULL
+ && SYMBOL_BFD_SECTION (msymbol)->owner
+ == objfile->separate_debug_objfile->obfd)
+ || (objfile->separate_debug_objfile_backlink != NULL
+ && SYMBOL_BFD_SECTION (msymbol)->owner
+ == objfile->separate_debug_objfile_backlink->obfd)))
+ {
+ if (!catch_errors (resolve_errno, (void *) &addr, "",
+ RETURN_MASK_ALL))
+ error (_("TLS symbol `errno' not resolved for non-TLS program."
+ " You should compile the program with `gcc -pthread'."));
+ }
+ else
+ error (_("Cannot find thread-local variables on this target"));
+ }
return addr;
}
diff -u -X /home/jkratoch/.diffi.list -rup gdb-6.7.1/gdb/testsuite/gdb.dwarf2/dw2-errno.c gdb-6.7.1-patched/gdb/testsuite/gdb.dwarf2/dw2-errno.c
--- gdb-6.7.1/gdb/testsuite/gdb.dwarf2/dw2-errno.c 2007-11-04 01:43:41.000000000 +0100
+++ gdb-6.7.1-patched/gdb/testsuite/gdb.dwarf2/dw2-errno.c 2007-11-03 23:29:02.000000000 +0100
@@ -0,0 +1,28 @@
+/* This testcase is part of GDB, the GNU debugger.
+
@ -88,11 +227,10 @@ new file mode 100644
+
+ return 0; /* breakpoint */
+}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-errno.exp b/gdb/testsuite/gdb.dwarf2/dw2-errno.exp
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/dw2-errno.exp
@@ -0,0 +1,60 @@
diff -u -X /home/jkratoch/.diffi.list -rup gdb-6.7.1/gdb/testsuite/gdb.dwarf2/dw2-errno.exp gdb-6.7.1-patched/gdb/testsuite/gdb.dwarf2/dw2-errno.exp
--- gdb-6.7.1/gdb/testsuite/gdb.dwarf2/dw2-errno.exp 2007-11-04 01:43:39.000000000 +0100
+++ gdb-6.7.1-patched/gdb/testsuite/gdb.dwarf2/dw2-errno.exp 2007-11-04 01:41:46.000000000 +0100
@@ -0,0 +1,67 @@
+# Copyright 2007 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
@ -108,9 +246,16 @@ new file mode 100644
+# 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 $tracelevel then {
+ strace $tracelevel
+}
+
+set prms_id 0
+set bug_id 0
+
+set testfile dw2-errno
+set srcfile ${testfile}.c
+set binfile [standard_output_file ${testfile}]
+set binfile ${objdir}/${subdir}/${testfile}
+
+proc prep {} {
+ global srcdir subdir binfile
@ -153,112 +298,3 @@ new file mode 100644
+
+# TODO: Test the error on resolving ERRNO with only libc loaded.
+# Just how to find the current libc filename?
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-errno2.c b/gdb/testsuite/gdb.dwarf2/dw2-errno2.c
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/dw2-errno2.c
@@ -0,0 +1,28 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2005, 2007 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 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 */
+
+#include <errno.h>
+
+int main()
+{
+ errno = 42;
+
+ return 0; /* breakpoint */
+}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-errno2.exp b/gdb/testsuite/gdb.dwarf2/dw2-errno2.exp
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/dw2-errno2.exp
@@ -0,0 +1,71 @@
+# Copyright 2007 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 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 dw2-errno2
+set srcfile ${testfile}.c
+set binfile [standard_output_file ${testfile}]
+
+proc prep { message {do_xfail 0} } { with_test_prefix $message {
+ global srcdir subdir binfile variant
+ gdb_exit
+ gdb_start
+ gdb_reinitialize_dir $srcdir/$subdir
+ gdb_load ${binfile}${variant}
+
+ runto_main
+
+ gdb_breakpoint [gdb_get_line_number "breakpoint"]
+ gdb_continue_to_breakpoint "breakpoint"
+
+ gdb_test "gcore ${binfile}${variant}.core" "\r\nSaved corefile .*" "gcore $variant"
+
+ gdb_test "print errno" ".* = 42"
+
+ gdb_test "kill" ".*" "kill" {Kill the program being debugged\? \(y or n\) } "y"
+ gdb_test "core-file ${binfile}${variant}.core" "\r\nCore was generated by .*" "core-file"
+ if $do_xfail {
+ setup_xfail "*-*-*"
+ }
+ gdb_test "print (int) errno" ".* = 42" "print errno for core"
+}}
+
+set variant g2thrN
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}${variant}" executable "additional_flags=-g2"] != "" } {
+ untested "Couldn't compile test program"
+ return -1
+}
+prep "macros=N threads=N" 1
+
+set variant g3thrN
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}${variant}" executable "additional_flags=-g3"] != "" } {
+ untested "Couldn't compile test program"
+ return -1
+}
+prep "macros=Y threads=N" 1
+
+set variant g2thrY
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}${variant}" executable "additional_flags=-g2"] != "" } {
+ return -1
+}
+prep "macros=N threads=Y"
+
+set variant g3thrY
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}${variant}" executable "additional_flags=-g3"] != "" } {
+ return -1
+}
+prep "macros=Y threads=Y" 1
+
+# TODO: Test the error on resolving ERRNO with only libc loaded.
+# Just how to find the current libc filename?

View File

@ -0,0 +1,43 @@
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=190810
2006-09-26 Jan Kratochvil <jan.kratochvil@redhat.com>
* remote.c (remote_wait): Suggestion on crash due to nonmatching target.
(remote_async_wait): Likewise.
Index: gdb-6.6/gdb/remote.c
===================================================================
--- gdb-6.6.orig/gdb/remote.c 2007-01-20 06:43:04.000000000 +0100
+++ gdb-6.6/gdb/remote.c 2007-01-20 06:55:50.000000000 +0100
@@ -3111,8 +3111,13 @@ Packet: '%s'\n"),
reg->regnum, regs);
}
+ /* It may also occur on amd64 which defaults to 32-bit i386
+ target. gdbserver(1) is not aware of the `set architecture'
+ name itself as it is not using libbfd. */
if (*p++ != ';')
- error (_("Remote register badly formatted: %s\nhere: %s"),
+ error (_("Remote register badly formatted: %s\nhere: %s"
+ "\nTry to load the executable by `file' first,"
+ "\nyou may also check `set/show architecture'."),
buf, p);
}
}
@@ -3307,8 +3312,13 @@ Packet: '%s'\n"),
regcache_raw_supply (current_regcache, reg->regnum, regs);
}
+ /* It may also occur on amd64 which defaults to 32-bit i386
+ target. gdbserver(1) is not aware of the `set architecture'
+ name itself as it is not using libbfd. */
if (*p++ != ';')
- error (_("Remote register badly formatted: %s\nhere: %s"),
+ error (_("Remote register badly formatted: %s\nhere: %s"
+ "\nTry to load the executable by `file' first,"
+ "\nyou may also check `set/show architecture'."),
buf, p);
}
}

View File

@ -0,0 +1,146 @@
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=196439
2006-08-26 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.dwarf2/dw2-stripped.exp: New file, Handle corrupted
or missing location list information.
* gdb.dwarf2/dw2-stripped.c: New file, Handle corrupted
or missing location list information.
Index: gdb-6.5/gdb/testsuite/gdb.dwarf2/dw2-stripped.c
===================================================================
RCS file: gdb-6.5/gdb/testsuite/gdb.dwarf2/dw2-stripped.c
diff -N gdb-6.5/gdb/testsuite/gdb.dwarf2/dw2-stripped.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gdb-6.5/gdb/testsuite/gdb.dwarf2/dw2-stripped.c 26 Aug 2006 11:47:26 -0000
@@ -0,0 +1,42 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2004 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. */
+
+
+/* The function `func1' traced into must have debug info on offset > 0;
+ (DW_UNSND (attr)). This is the reason of `func0' existence. */
+
+void
+func0(int a, int b)
+{
+}
+
+/* `func1' being traced into must have some arguments to dump. */
+
+void
+func1(int a, int b)
+{
+ func0 (a,b);
+}
+
+int
+main(void)
+{
+ func1 (1, 2);
+ return 0;
+}
Index: gdb-6.5/gdb/testsuite/gdb.dwarf2/dw2-stripped.exp
===================================================================
RCS file: gdb-6.5/gdb/testsuite/gdb.dwarf2/dw2-stripped.exp
diff -N gdb-6.5/gdb/testsuite/gdb.dwarf2/dw2-stripped.exp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gdb-6.5/gdb/testsuite/gdb.dwarf2/dw2-stripped.exp 26 Aug 2006 11:47:27 -0000
@@ -0,0 +1,79 @@
+# 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.
+
+# Minimal DWARF-2 unit test
+
+# This test can only be run on targets which support DWARF-2.
+# For now pick a sampling of likely targets.
+if {![istarget *-*-linux*]
+ && ![istarget *-*-gnu*]
+ && ![istarget *-*-elf*]
+ && ![istarget *-*-openbsd*]
+ && ![istarget arm-*-eabi*]
+ && ![istarget powerpc-*-eabi*]} {
+ return 0
+}
+
+set testfile "dw2-stripped"
+set srcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}.x
+
+remote_exec build "rm -f ${binfile}"
+
+# get the value of gcc_compiled
+if [get_compiler_info ${binfile}] {
+ return -1
+}
+
+# This test can only be run on gcc as we use additional_flags=FIXME
+if {$gcc_compiled == 0} {
+ return 0
+}
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-ggdb3}] != "" } {
+ return -1
+}
+
+remote_exec build "objcopy -R .debug_loc ${binfile}"
+set strip_output [remote_exec build "objdump -h ${binfile}"]
+
+set test "stripping test file preservation"
+if [ regexp ".debug_info " $strip_output] {
+ pass "$test (.debug_info preserved)"
+} else {
+ fail "$test (.debug_info got also stripped)"
+}
+
+set test "stripping test file functionality"
+if [ regexp ".debug_loc " $strip_output] {
+ fail "$test (.debug_loc still present)"
+} else {
+ pass "$test (.debug_loc stripped)"
+}
+
+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 .*" \
+ "start"
+gdb_test "step" \
+ "func.* \\(.*\\) at .*" \
+ "step"

View File

@ -0,0 +1,30 @@
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=200048
diff -ru gdb-6.5-orig/gdb/tui/tui-layout.c gdb-6.5-pr200048/gdb/tui/tui-layout.c
--- gdb-6.5-orig/gdb/tui/tui-layout.c 2006-08-07 21:33:42.000000000 +0200
+++ gdb-6.5-pr200048/gdb/tui/tui-layout.c 2006-08-13 02:26:39.000000000 +0200
@@ -519,13 +519,17 @@
{
case SRC_COMMAND:
case SRC_DATA_COMMAND:
- find_line_pc (cursal.symtab,
+ if (find_line_pc (cursal.symtab,
TUI_SRC_WIN->detail.source_info.start_line_or_addr.u.line_no,
- &pc_list, &num_pc_values);
- /* FIXME: What do we do with multiple pc values for ctors/dtors or
- inlined functions? */
- addr = pc_list[0];
- xfree (pc_list);
+ &pc_list, &num_pc_values))
+ {
+ /* FIXME: What do we do with multiple pc values for ctors/dtors or
+ inlined functions? */
+ addr = pc_list[0];
+ xfree (pc_list);
+ }
+ else
+ addr = 0;
break;
case DISASSEM_COMMAND:
case SRC_DISASSEM_COMMAND:

View File

@ -0,0 +1,17 @@
Index: gdb-6.5/gdb/symfile.c
===================================================================
--- gdb-6.5.orig/gdb/symfile.c 2006-08-24 02:56:02.000000000 -0300
+++ gdb-6.5/gdb/symfile.c 2006-08-24 02:56:36.000000000 -0300
@@ -3739,6 +3739,12 @@ symfile_dummy_outputs (bfd *abfd, asecti
bfd_byte *
symfile_relocate_debug_section (bfd *abfd, asection *sectp, bfd_byte *buf)
{
+ /* 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 debugging sections with relocation
information. */
if ((sectp->flags & SEC_RELOC) == 0)

View File

@ -0,0 +1,54 @@
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=205551
2006-09-10 Jan Kratochvil <jan.kratochvil@redhat.com>
* printcmd.c (printf_command): Handle forgotten "%p".
2006-09-10 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.base/display.exp: New test of `printf' "%p" formatting.
diff -u -r sources-clean/gdb/printcmd.c sources-custom/gdb/printcmd.c
--- sources-clean/gdb/printcmd.c 2006-07-29 20:29:26.000000000 +0200
+++ sources-custom/gdb/printcmd.c 2006-09-12 16:18:55.000000000 +0200
@@ -43,6 +43,9 @@
#include "gdb_assert.h"
#include "block.h"
#include "disasm.h"
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#endif
#ifdef TUI
#include "tui/tui.h" /* For tui_active et.al. */
@@ -2065,6 +2068,16 @@
#else
error (_("long long not supported in printf"));
#endif
+ case ptr_arg:
+#ifdef HAVE_UINTPTR_T
+ {
+ void *val = (void *) (uintptr_t) value_as_address (val_args[i]);
+ printf_filtered (current_substring, val);
+ break;
+ }
+#else
+ error (_("pointer not supported in printf"));
+#endif
case int_arg:
{
int val = value_as_long (val_args[i]);
diff -u -r sources-clean/gdb/testsuite/gdb.base/display.exp sources-custom/gdb/testsuite/gdb.base/display.exp
--- sources-clean/gdb/testsuite/gdb.base/display.exp 2006-08-13 02:53:36.000000000 +0200
+++ sources-custom/gdb/testsuite/gdb.base/display.exp 2006-09-12 16:17:24.000000000 +0200
@@ -179,6 +179,8 @@
gdb_test "printf \"\"" ".*" "re-set term"
gdb_test "printf \"\\w\"" ".*Unrecognized escape character.*"
gdb_test "printf \"%d\" j" ".*Invalid argument syntax.*"
+# 0 or hex vs. dec printing may be platform dependent:
+gdb_test "printf \"<%p>\\n\", (void *)7" ".*7>.*"
# play with "print", too
#

View File

@ -0,0 +1,93 @@
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=215816
2007-01-03 Jan Kratochvil <jan.kratochvil@redhat.com>
Daniel Jacobowitz <dan@codesourcery.com>
* gdb.base/readline.exp: Set $TERM. Test arrow keys in
secondary prompts.
2007-07-01 Nick Roberts <nickrob@snap.net.nz>
Daniel Jacobowitz <dan@codesourcery.com>
* gdb.base/annota3.exp: Test for if construct.
--- ./gdb/testsuite/gdb.base/readline.exp 8 Jun 2003 13:14:05 -0000 1.2
+++ ./gdb/testsuite/gdb.base/readline.exp 3 Jan 2007 21:22:47 -0000
@@ -1,4 +1,4 @@
-# Copyright 2002 Free Software Foundation, Inc.
+# Copyright 2002, 2003, 2007 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -159,6 +159,14 @@ if [info exists env(INPUTRC)] {
}
set env(INPUTRC) "/dev/null"
+# The arrow key test relies on the standard VT100 bindings, so make
+# sure that an appropriate terminal is selected. The same bug
+# doesn't show up if we use ^P / ^N instead.
+if [info exists env(TERM)] {
+ set old_term $env(TERM)
+}
+set env(TERM) "vt100"
+
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
@@ -178,6 +186,18 @@ operate_and_get_next "operate-and-get-ne
"p 5" "" \
"end" ".* = 5"
+# Verify that arrow keys work in secondary prompts. The control
+# sequence is a hard-coded VT100 up arrow.
+gdb_test "print 42" "\\\$\[0-9\]* = 42"
+set msg "arrow keys with secondary prompt"
+gdb_test_multiple "if 1 > 0\n\033\[A\033\[A\nend" $msg {
+ -re ".*\\\$\[0-9\]* = 42\r\n$gdb_prompt $" {
+ pass $msg
+ }
+ -re ".*Undefined command:.*$gdb_prompt $" {
+ fail $msg
+ }
+}
# Now repeat the first test with a history file that fills the entire
# history list.
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/annota3.exp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- src/gdb/testsuite/gdb.base/annota3.exp 2007/01/09 17:59:09 1.12
+++ src/gdb/testsuite/gdb.base/annota3.exp 2007/07/01 22:37:52 1.13
@@ -99,7 +99,29 @@
"set annotate 3"
}
-
+#
+# if construct:
+#
+send_gdb "if 1\n"
+gdb_expect {
+ -re "^if 1\r\n\r\n\032\032post-prompt\r\n\r\n\032\032pre-commands\r\n >\r\n\032\032commands\r\n$" {
+ pass "start if construct"
+ }
+ -re ".*\032\032commands\r\n" {
+ fail "start if construct"
+ }
+ timeout { fail "start if construct (timeout)" }
+}
+send_gdb "end\n"
+gdb_expect {
+ -re "^end\r\n\r\n\032\032post-commands\r\n$gdb_prompt$" {
+ pass "end if construct"
+ }
+ -re ".*$gdb_prompt$" {
+ fail "end if construct"
+ }
+ timeout { fail "end if construct (timeout)" }
+}
#
# info break:
#

View File

@ -0,0 +1,220 @@
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=215816
2007-01-03 Jan Kratochvil <jan.kratochvil@redhat.com>
Daniel Jacobowitz <dan@codesourcery.com>
* Makefile.in (top.o): Update.
* top.c (gdb_readline_wrapper_done, gdb_readline_wrapper_result)
(saved_after_char_processing_hook, gdb_readline_wrapper_line)
(struct gdb_readline_wrapper_cleanup, gdb_readline_wrapper_cleanup):
New.
(gdb_readline_wrapper): Rewrite to use asynchronous readline.
2007-07-01 Daniel Jacobowitz <dan@codesourcery.com>
* top.c (gdb_readline_wrapper_line): Call rl_callback_handler_remove.
(struct gdb_readline_wrapper_cleanup): Remove prompt_orig.
(gdb_readline_wrapper_cleanup): Do not reset the prompt.
(gdb_readline_wrapper): Do not save the prompt. Pass our prompt
to display_gdb_prompt.
--- ./gdb/Makefile.in 3 Jan 2007 18:05:43 -0000 1.864
+++ ./gdb/Makefile.in 3 Jan 2007 21:22:46 -0000
@@ -2782,7 +2782,7 @@ top.o: top.c $(defs_h) $(gdbcmd_h) $(cal
$(annotate_h) $(completer_h) $(top_h) $(version_h) $(serial_h) \
$(doublest_h) $(gdb_assert_h) $(readline_h) $(readline_history_h) \
$(event_top_h) $(gdb_string_h) $(gdb_stat_h) $(ui_out_h) \
- $(cli_out_h) $(main_h)
+ $(cli_out_h) $(main_h) $(event_loop_h)
tracepoint.o: tracepoint.c $(defs_h) $(symtab_h) $(frame_h) $(gdbtypes_h) \
$(expression_h) $(gdbcmd_h) $(value_h) $(target_h) $(language_h) \
$(gdb_string_h) $(inferior_h) $(tracepoint_h) $(remote_h) \
--- ./gdb/top.c 1 Jan 2007 05:57:49 -0000 1.116
+++ ./gdb/top.c 3 Jan 2007 21:22:47 -0000
@@ -47,6 +47,7 @@
#include "doublest.h"
#include "gdb_assert.h"
#include "main.h"
+#include "event-loop.h"
/* readline include files */
#include "readline/readline.h"
@@ -710,24 +710,84 @@
}
/* This is like readline(), but it has some gdb-specific behavior.
- gdb can use readline in both the synchronous and async modes during
+ gdb may want readline in both the synchronous and async modes during
a single gdb invocation. At the ordinary top-level prompt we might
be using the async readline. That means we can't use
rl_pre_input_hook, since it doesn't work properly in async mode.
However, for a secondary prompt (" >", such as occurs during a
- `define'), gdb just calls readline() directly, running it in
- synchronous mode. So for operate-and-get-next to work in this
- situation, we have to switch the hooks around. That is what
- gdb_readline_wrapper is for. */
+ `define'), gdb wants a synchronous response.
+
+ We used to call readline() directly, running it in synchronous
+ mode. But mixing modes this way is not supported, and as of
+ readline 5.x it no longer works; the arrow keys come unbound during
+ the synchronous call. So we make a nested call into the event
+ loop. That's what gdb_readline_wrapper is for. */
+
+/* A flag set as soon as gdb_readline_wrapper_line is called; we can't
+ rely on gdb_readline_wrapper_result, which might still be NULL if
+ the user types Control-D for EOF. */
+static int gdb_readline_wrapper_done;
+
+/* The result of the current call to gdb_readline_wrapper, once a newline
+ is seen. */
+static char *gdb_readline_wrapper_result;
+
+/* Any intercepted hook. Operate-and-get-next sets this, expecting it
+ to be called after the newline is processed (which will redisplay
+ the prompt). But in gdb_readline_wrapper we will not get a new
+ prompt until the next call, or until we return to the event loop.
+ So we disable this hook around the newline and restore it before we
+ return. */
+static void (*saved_after_char_processing_hook) (void);
+
+/* This function is called when readline has seen a complete line of
+ text. */
+
+static void
+gdb_readline_wrapper_line (char *line)
+{
+ gdb_assert (!gdb_readline_wrapper_done);
+ gdb_readline_wrapper_result = line;
+ gdb_readline_wrapper_done = 1;
+
+ /* Prevent operate-and-get-next from acting too early. */
+ saved_after_char_processing_hook = after_char_processing_hook;
+ after_char_processing_hook = NULL;
+}
+
+struct gdb_readline_wrapper_cleanup
+ {
+ void (*handler_orig) (char *);
+ char *prompt_orig;
+ int already_prompted_orig;
+ };
+
+static void
+gdb_readline_wrapper_cleanup (void *arg)
+{
+ struct gdb_readline_wrapper_cleanup *cleanup = arg;
+
+ gdb_assert (rl_already_prompted == 1);
+ rl_already_prompted = cleanup->already_prompted_orig;
+ PROMPT (0) = cleanup->prompt_orig;
+
+ gdb_assert (input_handler == gdb_readline_wrapper_line);
+ input_handler = cleanup->handler_orig;
+ gdb_readline_wrapper_result = NULL;
+ gdb_readline_wrapper_done = 0;
+
+ after_char_processing_hook = saved_after_char_processing_hook;
+ saved_after_char_processing_hook = NULL;
+
+ xfree (cleanup);
+}
+
char *
gdb_readline_wrapper (char *prompt)
{
- /* Set the hook that works in this case. */
- if (after_char_processing_hook)
- {
- rl_pre_input_hook = (Function *) after_char_processing_hook;
- after_char_processing_hook = NULL;
- }
+ struct cleanup *back_to;
+ struct gdb_readline_wrapper_cleanup *cleanup;
+ char *retval;
/* Before calling readline, ensure we have the terminal. If we don't
have the terminal and call readline, we risk the possibility of
@@ -737,7 +797,32 @@
a page break prompt. */
terminal_ours ();
- return readline (prompt);
+ cleanup = xmalloc (sizeof (*cleanup));
+ cleanup->handler_orig = input_handler;
+ input_handler = gdb_readline_wrapper_line;
+
+ cleanup->prompt_orig = get_prompt ();
+ PROMPT (0) = prompt;
+ cleanup->already_prompted_orig = rl_already_prompted;
+
+ back_to = make_cleanup (gdb_readline_wrapper_cleanup, cleanup);
+
+ /* Display our prompt and prevent double prompt display. */
+ display_gdb_prompt (NULL);
+ rl_already_prompted = 1;
+
+ if (after_char_processing_hook)
+ (*after_char_processing_hook) ();
+ gdb_assert (after_char_processing_hook == NULL);
+
+ /* gdb_do_one_event argument is unused. */
+ while (gdb_do_one_event (NULL) >= 0)
+ if (gdb_readline_wrapper_done)
+ break;
+
+ retval = gdb_readline_wrapper_result;
+ do_cleanups (back_to);
+ return retval;
}
===================================================================
RCS file: /cvs/src/src/gdb/top.c,v
retrieving revision 1.120
retrieving revision 1.121
diff -u -r1.120 -r1.121
--- src/gdb/top.c 2007/03/29 18:55:01 1.120
+++ src/gdb/top.c 2007/07/01 22:37:52 1.121
@@ -751,12 +751,16 @@
/* Prevent operate-and-get-next from acting too early. */
saved_after_char_processing_hook = after_char_processing_hook;
after_char_processing_hook = NULL;
+
+ /* Prevent parts of the prompt from being redisplayed if annotations
+ are enabled, and readline's state getting out of sync. */
+ if (async_command_editing_p)
+ rl_callback_handler_remove ();
}
struct gdb_readline_wrapper_cleanup
{
void (*handler_orig) (char *);
- char *prompt_orig;
int already_prompted_orig;
};
@@ -766,7 +770,6 @@
struct gdb_readline_wrapper_cleanup *cleanup = arg;
rl_already_prompted = cleanup->already_prompted_orig;
- PROMPT (0) = cleanup->prompt_orig;
gdb_assert (input_handler == gdb_readline_wrapper_line);
input_handler = cleanup->handler_orig;
@@ -790,14 +793,12 @@
cleanup->handler_orig = input_handler;
input_handler = gdb_readline_wrapper_line;
- cleanup->prompt_orig = get_prompt ();
- PROMPT (0) = prompt;
cleanup->already_prompted_orig = rl_already_prompted;
back_to = make_cleanup (gdb_readline_wrapper_cleanup, cleanup);
/* Display our prompt and prevent double prompt display. */
- display_gdb_prompt (NULL);
+ display_gdb_prompt (prompt);
rl_already_prompted = 1;
if (after_char_processing_hook)

View File

@ -0,0 +1,260 @@
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=216711
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.
--- ./gdb/amd64-linux-tdep.c 19 Aug 2006 15:15:18 -0000 1.12
+++ ./gdb/amd64-linux-tdep.c 17 Dec 2006 17:59:05 -0000
@@ -235,6 +235,80 @@ amd64_linux_register_reggroup_p (struct
/* 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 *next_frame)
+{
+ CORE_ADDR pc = frame_pc_unwind (next_frame);
+ unsigned char buf[LINUX_CLONE_LEN];
+
+ if (!safe_frame_unwind_memory (next_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 *next_frame)
+{
+ CORE_ADDR pc = frame_pc_unwind (next_frame);
+ 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 (next_frame) != 0);
+
+ return 0;
+}
+
static void
amd64_linux_write_pc (CORE_ADDR pc, ptid_t ptid)
{
@@ -273,6 +342,8 @@ amd64_linux_init_abi (struct gdbarch_inf
tdep->sc_reg_offset = amd64_linux_sc_reg_offset;
tdep->sc_num_regs = ARRAY_SIZE (amd64_linux_sc_reg_offset);
+ tdep->outermost_frame_p = amd64_linux_outermost_frame;
+
/* GNU/Linux uses SVR4-style shared libraries. */
set_solib_svr4_fetch_link_map_offsets
(gdbarch, svr4_lp64_fetch_link_map_offsets);
--- ./gdb/amd64-tdep.c 19 Aug 2006 15:15:18 -0000 1.32
+++ ./gdb/amd64-tdep.c 17 Dec 2006 17:59:05 -0000
@@ -879,11 +879,16 @@ amd64_frame_this_id (struct frame_info *
{
struct amd64_frame_cache *cache =
amd64_frame_cache (next_frame, this_cache);
+ struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
/* This marks the outermost frame. */
if (cache->base == 0)
return;
+ /* Detect OS dependent outermost frames; such as `clone'. */
+ if (tdep->outermost_frame_p && tdep->outermost_frame_p (next_frame))
+ return;
+
(*this_id) = frame_id_build (cache->base + 16, cache->pc);
}
--- ./gdb/i386-tdep.c 8 Aug 2006 21:36:46 -0000 1.225
+++ ./gdb/i386-tdep.c 17 Dec 2006 17:59:10 -0000
@@ -2313,6 +2313,9 @@ i386_gdbarch_init (struct gdbarch_info i
tdep->sc_pc_offset = -1;
tdep->sc_sp_offset = -1;
+ /* Unwinding stops on i386 automatically. */
+ tdep->outermost_frame_p = NULL;
+
/* The format used for `long double' on almost all i386 targets is
the i387 extended floating-point format. In fact, of all targets
in the GCC 2.95 tree, only OSF/1 does it different, and insists
--- ./gdb/i386-tdep.h 21 Jan 2006 20:59:50 -0000 1.46
+++ ./gdb/i386-tdep.h 17 Dec 2006 17:59:10 -0000
@@ -104,6 +104,9 @@ struct gdbarch_tdep
is deprecated, please use `sc_reg_offset' instead. */
int sc_pc_offset;
int sc_sp_offset;
+
+ /* Detect OS dependent outermost frames; such as `clone'. */
+ int (*outermost_frame_p) (struct frame_info *next_frame);
};
/* Floating-point registers. */
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ./gdb/testsuite/gdb.threads/bt-clone-stop.c 17 Dec 2006 17:59:19 -0000
@@ -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();
+}
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ./gdb/testsuite/gdb.threads/bt-clone-stop.exp 17 Dec 2006 17:59:19 -0000
@@ -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 ${objdir}/${subdir}/${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" \
+ "Program received signal SIGABRT.*" \
+ "run"
+
+# Former gdb unwind (the first function is `clone'):
+# #5 0x0000003421ecd62d in ?? () from /lib64/libc.so.6
+# #6 0x0000000000000000 in ?? ()
+# (gdb)
+# Tested `amd64_linux_outermost_frame' functionality should omit the line `#6'.
+#
+# Two `-re' cases below must be in this order (1st is a subset of the 2nd one).
+# Unhandled case below should not happen and it is fortunately handled by
+# `amd64_linux_outermost_frame' as FAIL (and result `0x0 entry output invalid').
+gdb_test_multiple "bt" "0x0 entry output invalid" {
+ -re "in threader \\(.*\n#\[0-9\]* *0x0* in .*$gdb_prompt $" {
+ fail "0x0 entry found"
+ }
+ -re "in threader \\(.*$gdb_prompt $" {
+ pass "0x0 entry not found"
+ }
+}

View File

@ -0,0 +1,19 @@
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=218379
Index: gdb-6.6/gdb/minsyms.c
===================================================================
--- gdb-6.6.orig/gdb/minsyms.c 2007-01-20 13:53:48.000000000 +0100
+++ gdb-6.6/gdb/minsyms.c 2007-01-20 13:58:47.000000000 +0100
@@ -490,6 +490,11 @@ lookup_minimal_symbol_by_pc_section (COR
don't fill the bfd_section member, so don't
throw away symbols on those platforms. */
&& SYMBOL_BFD_SECTION (&msymbol[hi]) != NULL
+ /* Don't ignore symbols for solib trampolines.
+ Limit its sideeffects - only for non-0 sized trampolines.
+ Red Hat Bug 200533 with its regression Bug 218379. */
+ && (MSYMBOL_TYPE (&msymbol[hi]) != mst_solib_trampoline
+ || MSYMBOL_SIZE (&msymbol[hi]))
&& (!matching_bfd_sections
(SYMBOL_BFD_SECTION (&msymbol[hi]), section)))
{

View File

@ -1,50 +1,8 @@
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
--- /dev/null 2006-12-17 14:18:21.881669220 -0500
+++ gdb-6.5/gdb/testsuite/gdb.base/step-over-trampoline.exp 2006-12-17 16:52:51.000000000 -0500
@@ -0,0 +1,54 @@
+# Copyright 2006 Free Software Foundation, Inc.
+
@ -68,7 +26,7 @@ new file mode 100644
+
+set testfile step-over-trampoline
+set srcfile ${testfile}.c
+set binfile [standard_output_file ${testfile}]
+set binfile ${objdir}/${subdir}/${testfile}
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
+ untested "Couldn't compile test program"
+ return -1
@ -100,3 +58,34 @@ new file mode 100644
+ fail "stepped into trampoline"
+ }
+}
--- /dev/null 2006-12-17 14:18:21.881669220 -0500
+++ gdb-6.5/gdb/testsuite/gdb.base/step-over-trampoline.c 2006-12-17 16:18:12.000000000 -0500
@@ -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;
+}

View File

@ -1,27 +1,20 @@
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-solib-trampoline-lookup-lock-fix.patch
;; Fix lockup on trampoline vs. its function lookup; unreproducible (BZ 218379).
;;=fedora
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=218379
diff --git a/gdb/symtab.c b/gdb/symtab.c
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -3169,6 +3169,13 @@ find_pc_sect_line (CORE_ADDR pc, struct obj_section *section, int notcurrent)
msymbol->linkage_name ()); */
;
diff -u -rup -x testsuite gdb-6.5-orig/gdb/symtab.c gdb-6.5/gdb/symtab.c
--- gdb-6.5-orig/gdb/symtab.c 2006-12-17 11:59:52.000000000 +0100
+++ gdb-6.5/gdb/symtab.c 2006-12-17 11:56:03.000000000 +0100
@@ -2139,6 +2139,13 @@ find_pc_sect_line (CORE_ADDR pc, struct
/* See above comment about why warning is commented out */
/* warning ("In stub for %s; unable to find real function/line info", SYMBOL_LINKAGE_NAME (msymbol)) */ ;
/* fall through */
+ /* `msymbol' trampoline may be located before its .text symbol
+ but this text symbol may be the address we were looking for.
+ Avoid `find_pc_sect_line'<->`find_pc_line' infinite loop.
+ Red Hat Bug 218379. */
+ else if (BMSYMBOL_VALUE_ADDRESS (mfunsym) == pc)
+ warning ("In stub for %s (0x%s); interlocked, please submit the binary to http://bugzilla.redhat.com", msymbol.minsym->linkage_name (), paddress (target_gdbarch (), pc));
+ else if (SYMBOL_VALUE (mfunsym) == pc)
+ warning ("In stub for %s (0x%s); interlocked, please submit the binary to http://bugzilla.redhat.com", SYMBOL_LINKAGE_NAME (msymbol), paddr (pc));
+ /* fall through */
else
{
/* Detect an obvious case of infinite recursion. If this
return find_pc_line (SYMBOL_VALUE (mfunsym), 0);
}

View File

@ -0,0 +1,124 @@
2007-04-20 Luis Machado <luisgpm@br.ibm.com>
* rs6000-tdep.c (rs6000_gdbarch_init): Set the long double format for
powerpc64.
* configure.host : Set the host long double format for powerpc64 to be
a 128-bit type defined in libiberty/floatformat.c.
* ppc-linux-tdep.c (ppc_linux_init_abi): Remove code that sets long double
size to 8 bytes. This breaks expression evaluation by overriding the
default.
* floatformat.c : Introduce default floatformat structs to describe the
128-bit long double found on the powerpc64. Description does not fully
describe this format which is actually a pair of 64-bit doubles. However
we are relying on floatformat_to_doublest() recognizing that this is
also the default host floatformat.
* floatformat.h : Default floatformat structs for powerpc64 128-bit
long doubles.
Index: ./gdb/configure.host
===================================================================
--- ./gdb/configure.host.orig 2007-04-21 23:51:06.000000000 -0300
+++ ./gdb/configure.host 2007-04-21 23:51:09.000000000 -0300
@@ -179,6 +179,11 @@
gdb_host_double_format="&floatformat_ieee_double_big"
gdb_host_long_double_format="&floatformat_m68881_ext"
;;
+powerpc64-*-*)
+ gdb_host_float_format=0
+ gdb_host_double_format=0
+ gdb_host_long_double_format="&floatformat_ppc64_long_double_big"
+ ;;
*)
gdb_host_float_format=0
gdb_host_double_format=0
Index: ./gdb/rs6000-tdep.c
===================================================================
--- ./gdb/rs6000-tdep.c.orig 2007-04-21 23:51:06.000000000 -0300
+++ ./gdb/rs6000-tdep.c 2007-04-21 23:51:09.000000000 -0300
@@ -3442,7 +3442,19 @@
set_gdbarch_float_bit (gdbarch, 4 * TARGET_CHAR_BIT);
set_gdbarch_double_bit (gdbarch, 8 * TARGET_CHAR_BIT);
if (sysv_abi)
- set_gdbarch_long_double_bit (gdbarch, 16 * TARGET_CHAR_BIT);
+ {
+ int byte_order = gdbarch_byte_order (gdbarch);
+
+ if (byte_order == BFD_ENDIAN_BIG)
+ set_gdbarch_long_double_format (gdbarch, &floatformat_ppc64_long_double_big);
+ else if (byte_order == BFD_ENDIAN_LITTLE)
+ set_gdbarch_long_double_format (gdbarch, &floatformat_ppc64_long_double_little);
+ else
+ internal_error (__FILE__, __LINE__,
+ _("rs6000_gdbarch_init: "
+ "bad byte order"));
+ set_gdbarch_long_double_bit (gdbarch, 16 * TARGET_CHAR_BIT);
+ }
else
set_gdbarch_long_double_bit (gdbarch, 8 * TARGET_CHAR_BIT);
set_gdbarch_char_signed (gdbarch, 0);
Index: ./include/floatformat.h
===================================================================
--- ./include/floatformat.h.orig 2007-04-21 23:51:06.000000000 -0300
+++ ./include/floatformat.h 2007-04-21 23:51:09.000000000 -0300
@@ -118,6 +118,9 @@
extern const struct floatformat floatformat_ia64_spill_little;
extern const struct floatformat floatformat_ia64_quad_big;
extern const struct floatformat floatformat_ia64_quad_little;
+/* ppc64 long double implemented as 2 doubles */
+extern const struct floatformat floatformat_ppc64_long_double_big;
+extern const struct floatformat floatformat_ppc64_long_double_little;
/* Convert from FMT to a double.
FROM is the address of the extended float.
Index: ./libiberty/floatformat.c
===================================================================
--- ./libiberty/floatformat.c.orig 2007-04-21 23:51:06.000000000 -0300
+++ ./libiberty/floatformat.c 2007-04-21 23:51:09.000000000 -0300
@@ -106,6 +106,25 @@
floatformat_always_valid
};
+/* floatformats for ppc64 long double, big and little endian. */
+/* The layout is a pair of doubles. Don't use this description to pass */
+/* information to get_field(). The bit size is the important thing. */
+const struct floatformat floatformat_ppc64_long_double_big =
+{
+ floatformat_big, 128, 0, 1, 11, 1023, 2047, 12, 52,
+ floatformat_intbit_no,
+ "floatformat_ppc64_long_double_big",
+ floatformat_always_valid
+};
+
+const struct floatformat floatformat_ppc64_long_double_little =
+{
+ floatformat_little, 128, 0, 1, 11, 1023, 2047, 12, 52,
+ floatformat_intbit_no,
+ "floatformat_ppc64_long_double_little",
+ floatformat_always_valid
+};
+
/* floatformat for IEEE double, little endian byte order, with big endian word
ordering, as on the ARM. */
Index: ./gdb/ppc-linux-tdep.c
===================================================================
--- ./gdb/ppc-linux-tdep.c.orig 2007-04-21 19:48:50.000000000 -0300
+++ ./gdb/ppc-linux-tdep.c 2007-04-22 00:29:50.000000000 -0300
@@ -1059,7 +1059,8 @@
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
- /* NOTE: jimb/2004-03-26: The System V ABI PowerPC Processor
+#if 0
+ /* NOTE: jimb/2004-03-26: The System V ABI PowerPC Processor
Supplement says that long doubles are sixteen bytes long.
However, as one of the known warts of its ABI, PPC GNU/Linux uses
eight-byte long doubles. GCC only recently got 128-bit long
@@ -1068,6 +1069,7 @@
double' on PPC GNU/Linux are non-conformant. */
/* NOTE: cagney/2005-01-25: True for both 32- and 64-bit. */
set_gdbarch_long_double_bit (gdbarch, 8 * TARGET_CHAR_BIT);
+#endif
if (tdep->wordsize == 4)
{

View File

@ -1,88 +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-bz243845-stale-testing-zombie-test.patch
;; Test leftover zombie process (BZ 243845).
;;=fedoratest
diff --git a/gdb/testsuite/gdb.base/tracefork-zombie.exp b/gdb/testsuite/gdb.base/tracefork-zombie.exp
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/tracefork-zombie.exp
@@ -0,0 +1,75 @@
+# Copyright 2007 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+# are we on a target board
+if [is_remote target] then {
+ return 0
+}
+
+# Start the program running and then wait for a bit, to be sure
+# that it can be attached to.
+
+gdb_exit
+gdb_start
+gdb_load sleep
+
+set gdb_pid [exp_pid -i [board_info host fileid]]
+set test "identified the child GDB"
+if {$gdb_pid != "" && $gdb_pid > 0} {
+ pass $test
+ verbose -log "Child GDB PID $gdb_pid"
+} else {
+ fail $test
+}
+
+set testpid [eval exec sleep 10 &]
+exec sleep 2
+
+set test "attach"
+gdb_test_multiple "attach $testpid" "$test" {
+ -re "Attaching to program.*`?.*'?, process $testpid..*$gdb_prompt $" {
+ pass "$test"
+ }
+ -re "Attaching to program.*`?.*\.exe'?, process $testpid.*\[Switching to thread $testpid\..*\].*$gdb_prompt $" {
+ # Response expected on Cygwin
+ pass "$test"
+ }
+}
+
+# Some time to let GDB spawn its testing child.
+exec sleep 2
+
+set found none
+foreach procpid [glob -directory /proc -type d {[0-9]*}] {
+ if {[catch {open $procpid/status} statusfi]} {
+ continue
+ }
+ set status [read $statusfi]
+ close $statusfi
+ if {1
+ && [regexp -line {^Name:\tgdb$} $status]
+ && [regexp -line {^PPid:\t1$} $status]
+ && [regexp -line "^TracerPid:\t$gdb_pid$" $status]} {
+ set found $procpid
+ verbose -log "Found linux_test_for_tracefork zombie PID $procpid"
+ }
+}
+set test "linux_test_for_tracefork leaves no zombie"
+if {$found eq {none}} {
+ pass $test
+} else {
+ fail $test
+}

View File

@ -0,0 +1,89 @@
for gdb/ChangeLog:
2006-08-22 Will Drewry <wad@google.com>
Tavis Ormandy <taviso@google.com>
* dwarf2read.c (decode_locdesc): Enforce location description stack
boundaries.
* dwarfread.c (locval): Likewise.
Index: gdb-6.5/gdb/dwarf2read.c
===================================================================
--- gdb-6.5.orig/gdb/dwarf2read.c 2006-09-04 02:02:23.000000000 -0300
+++ gdb-6.5/gdb/dwarf2read.c 2006-09-04 02:02:23.000000000 -0300
@@ -8667,8 +8667,7 @@ dwarf2_fundamental_type (struct objfile
callers will only want a very basic result and this can become a
complaint.
- Note that stack[0] is unused except as a default error return.
- Note that stack overflow is not yet handled. */
+ Note that stack[0] is unused except as a default error return. */
static CORE_ADDR
decode_locdesc (struct dwarf_block *blk, struct dwarf2_cu *cu)
@@ -8685,7 +8684,7 @@ decode_locdesc (struct dwarf_block *blk,
i = 0;
stacki = 0;
- stack[stacki] = 0;
+ stack[++stacki] = 0;
while (i < size)
{
@@ -8864,6 +8863,16 @@ decode_locdesc (struct dwarf_block *blk,
dwarf_stack_op_name (op));
return (stack[stacki]);
}
+ /* Enforce maximum stack depth of size-1 to avoid ++stacki writing
+ outside of the allocated space. Also enforce minimum > 0.
+ -- wad@google.com 14 Aug 2006 */
+ if (stacki >= sizeof (stack) / sizeof (*stack) - 1)
+ internal_error (__FILE__, __LINE__,
+ _("location description stack too deep: %d"),
+ stacki);
+ if (stacki <= 0)
+ internal_error (__FILE__, __LINE__,
+ _("location description stack too shallow"));
}
return (stack[stacki]);
}
Index: gdb-6.5/gdb/dwarfread.c
===================================================================
--- gdb-6.5.orig/gdb/dwarfread.c 2005-12-17 20:33:59.000000000 -0200
+++ gdb-6.5/gdb/dwarfread.c 2006-09-04 02:02:23.000000000 -0300
@@ -2138,9 +2138,7 @@ decode_line_numbers (char *linetable)
NOTES
- Note that stack[0] is unused except as a default error return.
- Note that stack overflow is not yet handled.
- */
+ Note that stack[0] is unused except as a default error return. */
static int
locval (struct dieinfo *dip)
@@ -2160,7 +2158,7 @@ locval (struct dieinfo *dip)
loc += nbytes;
end = loc + locsize;
stacki = 0;
- stack[stacki] = 0;
+ stack[++stacki] = 0;
dip->isreg = 0;
dip->offreg = 0;
dip->optimized_out = 1;
@@ -2224,6 +2222,16 @@ locval (struct dieinfo *dip)
stacki--;
break;
}
+ /* Enforce maximum stack depth of size-1 to avoid ++stacki writing
+ outside of the allocated space. Also enforce minimum > 0.
+ -- wad@google.com 14 Aug 2006 */
+ if (stacki >= sizeof (stack) / sizeof (*stack) - 1)
+ internal_error (__FILE__, __LINE__,
+ _("location description stack too deep: %d"),
+ stacki);
+ if (stacki <= 0)
+ internal_error (__FILE__, __LINE__,
+ _("location description stack too shallow"));
}
return (stack[stacki]);
}

View File

@ -1,149 +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-gcore-buffer-limit-test.patch
;; Test gcore memory and time requirements for large inferiors.
;;=fedoratest
diff --git a/gdb/testsuite/gdb.base/gcore-excessive-memory.c b/gdb/testsuite/gdb.base/gcore-excessive-memory.c
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/gcore-excessive-memory.c
@@ -0,0 +1,37 @@
+/* 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 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 <unistd.h>
+#include <stdlib.h>
+
+#define MEGS 64
+
+int main()
+{
+ void *mem;
+
+ mem = malloc (MEGS * 1024ULL * 1024ULL);
+
+ for (;;)
+ sleep (1);
+
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.base/gcore-excessive-memory.exp b/gdb/testsuite/gdb.base/gcore-excessive-memory.exp
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/gcore-excessive-memory.exp
@@ -0,0 +1,94 @@
+# 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 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+set testfile gcore-excessive-memory
+set srcfile ${testfile}.c
+set shfile [standard_output_file ${testfile}-gdb.sh]
+set corefile [standard_output_file ${testfile}.core]
+set binfile [standard_output_file ${testfile}]
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
+ untested "Couldn't compile test program"
+ return -1
+}
+
+set f [open "|getconf PAGESIZE" "r"]
+gets $f pagesize
+close $f
+
+set pid_of_bin [eval exec $binfile &]
+sleep 2
+
+# Get things started.
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+set pid_of_gdb [exp_pid -i [board_info host fileid]]
+
+gdb_test "attach $pid_of_bin" "Attaching to .*" "attach"
+gdb_test "up 99" "in main .*" "verify we can get to main"
+
+proc memory_v_pages_get {} {
+ global pid_of_gdb pagesize
+ set fd [open "/proc/$pid_of_gdb/statm"]
+ gets $fd line
+ close $fd
+ # number of pages of virtual memory
+ scan $line "%d" drs
+ return $drs
+}
+
+set pages_found [memory_v_pages_get]
+
+# It must be definitely less than `MEGS' of `gcore-excessive-memory.c'.
+set mb_gcore_reserve 4
+verbose -log "pages_found = $pages_found, mb_gcore_reserve = $mb_gcore_reserve"
+set kb_found [expr $pages_found * $pagesize / 1024]
+set kb_permit [expr $kb_found + 1 * 1024 + $mb_gcore_reserve * 1024]
+verbose -log "kb_found = $kb_found, kb_permit = $kb_permit"
+
+# Create the ulimit wrapper.
+set f [open $shfile "w"]
+puts $f "#! /bin/sh"
+puts $f "ulimit -v $kb_permit"
+puts $f "exec $GDB \"\$@\""
+close $f
+remote_exec host "chmod +x $shfile"
+
+gdb_exit
+set GDBold $GDB
+set GDB "$shfile"
+gdb_start
+set GDB $GDBold
+
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+set pid_of_gdb [exp_pid -i [board_info host fileid]]
+
+gdb_test "attach $pid_of_bin" "Attaching to .*" "attach"
+gdb_test "up 99" "in main .*" "verify we can get to main"
+
+verbose -log "kb_found before gcore = [expr [memory_v_pages_get] * $pagesize / 1024]"
+
+gdb_test "gcore $corefile" "Saved corefile \[^\n\r\]*" "Save the core file"
+
+verbose -log "kb_found after gcore = [expr [memory_v_pages_get] * $pagesize / 1024]"
+
+# Cleanup.
+exec kill -9 $pid_of_bin

View File

@ -0,0 +1,747 @@
2006-10-01 Jan Kratochvil <jan.kratochvil@redhat.com>
Fujitsu
* amd64-linux-nat.c: Support new linux_elfcore_write_prpsinfo,
linux_elfcore_write_prstatus, linux_elfcore_write_prfpreg.
(i386_linux_gregset32_reg_offset): New mapping for i386 on amd64.
* gcore.c (gcore_create_callback): Comment vdso Linux kernel bug.
* configure.ac: Check for <sys/user32.h>, <sys/procfs32.h>.
* configure, config.in: Regenerated.
* gdb_user32.h, gdb_procfs32.h: Define 32-bit core files even for
64-bit gdb, provide fallbacks for <sys/user32.h> and <sys/procfs32.h>.
* linux-nat.c: Virtualize `elfcore_*' by (*`linux_elfcore_*').
(linux_nat_do_thread_registers): Likewise.
(linux_nat_make_corefile_notes): Likewise.
* linux-nat.h: Likewise.
* Makefile.in: Dependencies updated.
Index: gdb-6.6/gdb/Makefile.in
===================================================================
--- gdb-6.6.orig/gdb/Makefile.in 2007-01-20 06:43:02.000000000 +0100
+++ gdb-6.6/gdb/Makefile.in 2007-01-20 06:57:16.000000000 +0100
@@ -705,6 +705,7 @@ gdb_expat_h = gdb_expat.h
gdb_locale_h = gdb_locale.h
gdb_obstack_h = gdb_obstack.h $(obstack_h)
gdb_proc_service_h = gdb_proc_service.h $(gregset_h)
+gdb_procfs32_h = gdb_procfs32.h $(gdb_user32_h)
gdb_ptrace_h = gdb_ptrace.h
gdb_regex_h = gdb_regex.h $(xregex_h)
gdb_select_h = gdb_select.h
@@ -714,6 +715,7 @@ gdb_string_h = gdb_string.h
gdb_thread_db_h = gdb_thread_db.h
gdbthread_h = gdbthread.h $(breakpoint_h) $(frame_h)
gdbtypes_h = gdbtypes.h $(hashtab_h)
+gdb_user32_h = gdb_user32.h $(gdb_stdint_h)
gdb_vfork_h = gdb_vfork.h
gdb_wait_h = gdb_wait.h
glibc_tdep_h = glibc-tdep.h
@@ -1779,7 +1781,8 @@ amd64fbsd-tdep.o: amd64fbsd-tdep.c $(def
amd64-linux-nat.o: amd64-linux-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) \
$(regcache_h) $(linux_nat_h) $(gdb_assert_h) $(gdb_string_h) \
$(gdb_proc_service_h) $(gregset_h) $(amd64_tdep_h) \
- $(i386_linux_tdep_h) $(amd64_nat_h) $(target_h) $(amd64_linux_tdep_h)
+ $(i386_linux_tdep_h) $(amd64_nat_h) $(target_h) $(amd64_linux_tdep_h) \
+ $(i387_tdep_h) $(elf_bfd_h) $(gdb_procfs32_h)
amd64-linux-tdep.o: amd64-linux-tdep.c $(defs_h) $(frame_h) $(gdbcore_h) \
$(regcache_h) $(osabi_h) $(symtab_h) $(gdb_string_h) $(amd64_tdep_h) \
$(solib_svr4_h) $(gdbtypes_h) $(reggroups_h) $(amd64_linux_tdep_h)
Index: gdb-6.6/gdb/amd64-linux-nat.c
===================================================================
--- gdb-6.6.orig/gdb/amd64-linux-nat.c 2007-01-20 06:43:00.000000000 +0100
+++ gdb-6.6/gdb/amd64-linux-nat.c 2007-01-20 06:56:21.000000000 +0100
@@ -53,6 +53,9 @@
#include "amd64-tdep.h"
#include "i386-linux-tdep.h"
#include "amd64-nat.h"
+#include "i387-tdep.h"
+#include "bfd/elf-bfd.h"
+#include "gdb_procfs32.h"
/* Mapping between the general-purpose registers in GNU/Linux x86-64
`struct user' format and GDB's register cache layout. */
@@ -87,6 +90,35 @@ static int amd64_linux_gregset64_reg_off
GNU/Linux i386 registers are all 32-bit, but since we're
little-endian we get away with that. */
+/* This info is not reusable from "i386-linux-nat.c" as gdb itself runs in
+ 64-bit mode and so ptrace(2) has 64-bit structure layout.
+ Just the corefile being generated has 32-bit layout so we need to do
+ a conversion specific to the i386-on-amd64 compatibility mode. */
+static int i386_linux_gregset32_reg_offset[] =
+{
+ 6 * 4, /* %eax */
+ 1 * 4, /* %ecx */
+ 2 * 4, /* %edx */
+ 0 * 4, /* %ebx */
+ 15 * 4, /* %esp */
+ 5 * 4, /* %ebp */
+ 3 * 4, /* %esi */
+ 4 * 4, /* %edi */
+ 12 * 4, /* %eip */
+ 14 * 4, /* %eflags */
+ 13 * 4, /* %cs */
+ 16 * 4, /* %ss */
+ 7 * 4, /* %ds */
+ 8 * 4, /* %es */
+ 9 * 4, /* %fs */
+ 10 * 4, /* %gs */
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1,
+ 11 * 4 /* "orig_eax" */
+};
+
/* From <sys/reg.h> on GNU/Linux i386. */
static int amd64_linux_gregset32_reg_offset[] =
{
@@ -105,6 +137,94 @@ static int amd64_linux_gregset32_reg_off
};
+/* This functions make ELF32 32-bit elfcore note sections
+ on amd64 environment. */
+
+static char *
+amd64_linux_elfcore_write_prpsinfo (bfd *abfd, char *buf, int *bufsiz,
+ const char *fname, const char *psargs)
+{
+ if (gdbarch_ptr_bit(current_gdbarch) == 32)
+ {
+ int note_type;
+ char *note_name = "CORE";
+ struct elf_prpsinfo32 data;
+ note_type = NT_PRPSINFO;
+
+ memset (&data, 0, sizeof (data));
+ strncpy (data.pr_fname, fname, sizeof (data.pr_fname));
+ strncpy (data.pr_psargs, psargs, sizeof (data.pr_psargs));
+ return elfcore_write_note (abfd, buf, bufsiz,
+ note_name, note_type, &data, sizeof (data));
+ }
+ else
+ return elfcore_write_prpsinfo (abfd, buf, bufsiz, fname, psargs);
+}
+
+static void
+amd64_linux_set_registers (const gdb_byte *gregs, gdb_byte *buf)
+{
+ int i;
+ /* Copy the i386 registers in the amd64 layout into i386 layout. */
+ for (i = 0; i < I386_NUM_GREGS; i++)
+ memcpy(buf + i386_linux_gregset32_reg_offset[i],
+ gregs + amd64_linux_gregset32_reg_offset[i], 4);
+ for (i = I386_CS_REGNUM; i <= I386_GS_REGNUM; i++)
+ memcpy(buf + i386_linux_gregset32_reg_offset[i],
+ gregs + amd64_linux_gregset32_reg_offset[i], 4);
+}
+
+static char *
+amd64_linux_elfcore_write_prstatus (bfd *abfd, char *buf, int *bufsiz,
+ long pid, int cursig, const void *gregs)
+{
+ if (gdbarch_ptr_bit(current_gdbarch) == 32)
+ {
+ char *note_name = "CORE";
+ struct elf_prstatus32 prstat;
+ memset (&prstat, 0, sizeof (prstat));
+ prstat.pr_pid = pid;
+ prstat.pr_cursig = cursig;
+ amd64_linux_set_registers (gregs, (gdb_byte *) &prstat.pr_reg);
+ return elfcore_write_note (abfd, buf, bufsiz, note_name,
+ NT_PRSTATUS, &prstat, sizeof (prstat));
+ }
+ else
+ return elfcore_write_prstatus (abfd, buf, bufsiz, pid, cursig, gregs);
+}
+
+static char *
+amd64_elfcore_write_prxfpreg32 (bfd *abfd, char *buf, int *bufsiz)
+{
+ char *note_name = "LINUX";
+ elf_fpxregset32_t fpxregs32;
+
+ i387_fill_fxsave (&fpxregs32, -1);
+ return elfcore_write_note(abfd, buf, bufsiz,
+ note_name, NT_PRXFPREG, &fpxregs32,
+ sizeof(fpxregs32));
+}
+
+static char *
+amd64_linux_elfcore_write_prfpreg (bfd *abfd, char *buf,
+ int *bufsiz, const void *fpregs, int size)
+{
+ if (gdbarch_ptr_bit(current_gdbarch) == 32)
+ {
+ char *note_name = "CORE";
+ elf_fpregset32_t fpregs32;
+
+ i387_fill_fsave (&fpregs32, -1);
+ buf = elfcore_write_note(abfd, buf, bufsiz, note_name,
+ NT_FPREGSET, &fpregs32, sizeof(fpregs32));
+
+ return amd64_elfcore_write_prxfpreg32 (abfd, buf, bufsiz);
+ }
+ else
+ return elfcore_write_prfpreg (abfd, buf, bufsiz, fpregs, size);
+}
+
+
/* Transfering the general-purpose registers between GDB, inferiors
and core files. */
@@ -529,6 +649,11 @@ _initialize_amd64_linux_nat (void)
t->to_fetch_registers = amd64_linux_fetch_inferior_registers;
t->to_store_registers = amd64_linux_store_inferior_registers;
+ /* This functions make elfcore note sections. */
+ linux_elfcore_write_prpsinfo = amd64_linux_elfcore_write_prpsinfo;
+ linux_elfcore_write_prstatus = amd64_linux_elfcore_write_prstatus;
+ linux_elfcore_write_prfpreg = amd64_linux_elfcore_write_prfpreg;
+
/* Register the target. */
linux_nat_add_target (t);
Index: gdb-6.6/gdb/config.in
===================================================================
--- gdb-6.6.orig/gdb/config.in 2006-08-08 22:32:15.000000000 +0200
+++ gdb-6.6/gdb/config.in 2007-01-20 06:56:21.000000000 +0100
@@ -373,6 +373,9 @@
/* Define to 1 if you have the <sys/poll.h> header file. */
#undef HAVE_SYS_POLL_H
+/* Define to 1 if you have the <sys/procfs32.h> header file. */
+#undef HAVE_SYS_PROCFS32_H
+
/* Define to 1 if you have the <sys/procfs.h> header file. */
#undef HAVE_SYS_PROCFS_H
@@ -397,6 +400,9 @@
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
+/* Define to 1 if you have the <sys/user32.h> header file. */
+#undef HAVE_SYS_USER32_H
+
/* Define to 1 if you have the <sys/user.h> header file. */
#undef HAVE_SYS_USER_H
Index: gdb-6.6/gdb/configure
===================================================================
--- gdb-6.6.orig/gdb/configure 2007-01-20 06:43:00.000000000 +0100
+++ gdb-6.6/gdb/configure 2007-01-20 06:56:21.000000000 +0100
@@ -9966,6 +9966,157 @@ done
+for ac_header in sys/user32.h sys/procfs32.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+ (
+ cat <<\_ASBOX
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists. ##
+## ------------------------------------------ ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+
for ac_header in sys/wait.h wait.h
do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
Index: gdb-6.6/gdb/configure.ac
===================================================================
--- gdb-6.6.orig/gdb/configure.ac 2007-01-20 06:43:01.000000000 +0100
+++ gdb-6.6/gdb/configure.ac 2007-01-20 06:56:21.000000000 +0100
@@ -371,6 +371,7 @@ AC_CHECK_HEADERS(sys/user.h, [], [],
# include <sys/param.h>
#endif
])
+AC_CHECK_HEADERS(sys/user32.h sys/procfs32.h)
AC_CHECK_HEADERS(sys/wait.h wait.h)
AC_CHECK_HEADERS(termios.h termio.h sgtty.h)
AC_CHECK_HEADERS(unistd.h)
Index: gdb-6.6/gdb/gcore.c
===================================================================
--- gdb-6.6.orig/gdb/gcore.c 2007-01-20 06:43:02.000000000 +0100
+++ gdb-6.6/gdb/gcore.c 2007-01-20 06:56:21.000000000 +0100
@@ -320,6 +320,11 @@ gcore_create_callback (CORE_ADDR vaddr,
asection *osec;
flagword flags = SEC_ALLOC | SEC_HAS_CONTENTS | SEC_LOAD;
+ /* Some Linux kernel versions around 2.6.17 have for i386 inferiors running
+ in compatibility mode on amd64 kernel their VSYSCALL page (at 0xffffe000)
+ protected as RWX==000 by default and gdb fails to read the library header
+ upon loading the core. This is a Linux kernel bug being fixed. */
+
/* If the memory segment has no permissions set, ignore it, otherwise
when we later try to access it for read/write, we'll get an error
or jam the kernel. */
Index: gdb-6.6/gdb/gdb_procfs32.h
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-6.6/gdb/gdb_procfs32.h 2007-01-20 06:56:21.000000000 +0100
@@ -0,0 +1,128 @@
+#ifdef HAVE_SYS_PROCFS32_H
+#include <sys/procfs32.h>
+#else
+
+/* Copyright (C) 2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_PROCFS32_H
+#define _SYS_PROCFS32_H 1
+
+/* This is somewhat modelled after the file of the same name on SVR4
+ systems. It provides a definition of the core file format for ELF
+ used on Linux. It doesn't have anything to do with the /proc file
+ system, even though Linux has one.
+
+ Anyway, the whole purpose of this file is for GDB and GDB only.
+ Don't read too much into it. Don't use it for anything other than
+ GDB unless you know what you are doing. */
+
+#include <features.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include "gdb_user32.h"
+
+/* We define here only the symbols differing from their 64-bit variant. */
+#include <sys/procfs.h>
+
+__BEGIN_DECLS
+
+/* Type for a general-purpose register. */
+typedef unsigned int elf_greg32_t;
+
+/* And the whole bunch of them. We could have used `struct
+ user_regs_struct' directly in the typedef, but tradition says that
+ the register set is an array, which does have some peculiar
+ semantics, so leave it that way. */
+#define ELF_NGREG32 (sizeof (struct user_regs32_struct) / sizeof(elf_greg32_t))
+typedef elf_greg32_t elf_gregset32_t[ELF_NGREG32];
+
+/* Register set for the floating-point registers. */
+typedef struct user_fpregs32_struct elf_fpregset32_t;
+
+/* Register set for the extended floating-point registers. Includes
+ the Pentium III SSE registers in addition to the classic
+ floating-point stuff. */
+typedef struct user_fpxregs32_struct elf_fpxregset32_t;
+
+
+/* Definitions to generate Intel SVR4-like core files. These mostly
+ have the same names as the SVR4 types with "elf_" tacked on the
+ front to prevent clashes with Linux definitions, and the typedef
+ forms have been avoided. This is mostly like the SVR4 structure,
+ but more Linuxy, with things that Linux does not support and which
+ GDB doesn't really use excluded. */
+
+struct prstatus32_timeval
+ {
+ int tv_sec;
+ int tv_usec;
+ };
+
+struct elf_prstatus32
+ {
+ struct elf_siginfo pr_info; /* Info associated with signal. */
+ short int pr_cursig; /* Current signal. */
+ unsigned int pr_sigpend; /* Set of pending signals. */
+ unsigned int pr_sighold; /* Set of held signals. */
+ __pid_t pr_pid;
+ __pid_t pr_ppid;
+ __pid_t pr_pgrp;
+ __pid_t pr_sid;
+ struct prstatus32_timeval pr_utime; /* User time. */
+ struct prstatus32_timeval pr_stime; /* System time. */
+ struct prstatus32_timeval pr_cutime; /* Cumulative user time. */
+ struct prstatus32_timeval pr_cstime; /* Cumulative system time. */
+ elf_gregset32_t pr_reg; /* GP registers. */
+ int pr_fpvalid; /* True if math copro being used. */
+ };
+
+
+struct elf_prpsinfo32
+ {
+ char pr_state; /* Numeric process state. */
+ char pr_sname; /* Char for pr_state. */
+ char pr_zomb; /* Zombie. */
+ char pr_nice; /* Nice val. */
+ unsigned int pr_flag; /* Flags. */
+ unsigned short int pr_uid;
+ unsigned short int pr_gid;
+ int pr_pid, pr_ppid, pr_pgrp, pr_sid;
+ /* Lots missing */
+ char pr_fname[16]; /* Filename of executable. */
+ char pr_psargs[ELF_PRARGSZ]; /* Initial part of arg list. */
+ };
+
+
+/* The rest of this file provides the types for emulation of the
+ Solaris <proc_service.h> interfaces that should be implemented by
+ users of libthread_db. */
+
+/* Register sets. Linux has different names. */
+typedef elf_gregset_t prgregset32_t;
+typedef elf_fpregset_t prfpregset32_t;
+
+/* Process status and info. In the end we do provide typedefs for them. */
+typedef struct elf_prstatus32 prstatus32_t;
+typedef struct elf_prpsinfo32 prpsinfo32_t;
+
+__END_DECLS
+
+#endif /* _SYS_PROCFS32_H */
+
+#endif /* HAVE_SYS_PROCFS32_H */
Index: gdb-6.6/gdb/gdb_user32.h
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-6.6/gdb/gdb_user32.h 2007-01-20 06:56:21.000000000 +0100
@@ -0,0 +1,108 @@
+#ifdef HAVE_SYS_USER32_H
+#include <sys/user32.h>
+#else
+
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+typedef int32_t gdb_int32_t;
+typedef uint32_t gdb_uint32_t;
+#else
+typedef signed int gdb_uint32_t;
+typedef unsigned int gdb_uint32_t;
+#endif
+
+/* Copyright (C) 2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_USER32_H
+#define _SYS_USER32_H 1
+
+/* These are the 32-bit x86 structures. */
+
+struct user_fpregs32_struct
+{
+ int32_t cwd;
+ int32_t swd;
+ int32_t twd;
+ int32_t fip;
+ int32_t fcs;
+ int32_t foo;
+ int32_t fos;
+ int32_t st_space [20];
+};
+
+struct user_fpxregs32_struct
+{
+ unsigned short int cwd;
+ unsigned short int swd;
+ unsigned short int twd;
+ unsigned short int fop;
+ int32_t fip;
+ int32_t fcs;
+ int32_t foo;
+ int32_t fos;
+ int32_t mxcsr;
+ int32_t reserved;
+ int32_t st_space[32]; /* 8*16 bytes for each FP-reg = 128 bytes */
+ int32_t xmm_space[32]; /* 8*16 bytes for each XMM-reg = 128 bytes */
+ int32_t padding[56];
+};
+
+struct user_regs32_struct
+{
+ int32_t ebx;
+ int32_t ecx;
+ int32_t edx;
+ int32_t esi;
+ int32_t edi;
+ int32_t ebp;
+ int32_t eax;
+ int32_t xds;
+ int32_t xes;
+ int32_t xfs;
+ int32_t xgs;
+ int32_t orig_eax;
+ int32_t eip;
+ int32_t xcs;
+ int32_t eflags;
+ int32_t esp;
+ int32_t xss;
+};
+
+struct user32
+{
+ struct user_regs32_struct regs;
+ int u_fpvalid;
+ struct user_fpregs32_struct i387;
+ uint32_t u_tsize;
+ uint32_t u_dsize;
+ uint32_t u_ssize;
+ uint32_t start_code;
+ uint32_t start_stack;
+ int32_t signal;
+ int reserved;
+ struct user_regs32_struct* u_ar0;
+ struct user_fpregs32_struct* u_fpstate;
+ uint32_t magic;
+ char u_comm [32];
+ int u_debugreg [8];
+};
+
+#endif /* _SYS_USER32_H */
+
+#endif /* HAVE_SYS_USER32_H */
Index: gdb-6.6/gdb/linux-nat.c
===================================================================
--- gdb-6.6.orig/gdb/linux-nat.c 2007-01-20 06:43:04.000000000 +0100
+++ gdb-6.6/gdb/linux-nat.c 2007-01-20 06:56:21.000000000 +0100
@@ -100,6 +100,15 @@ static LONGEST (*super_xfer_partial) (st
const gdb_byte *,
ULONGEST, LONGEST);
+/* This functions make elfcore note sections.
+ They may get overriden by code adjusting data for multi-target builds. */
+char *(*linux_elfcore_write_prpsinfo)
+ (bfd *, char *, int *, const char *, const char *) = elfcore_write_prpsinfo;
+char *(*linux_elfcore_write_prstatus)
+ (bfd *, char *, int *, long, int, const void *) = elfcore_write_prstatus;
+char *(*linux_elfcore_write_prfpreg)
+ (bfd *, char *, int *, const void *, int) = elfcore_write_prfpreg;
+
static int debug_linux_nat;
static void
show_debug_linux_nat (struct ui_file *file, int from_tty,
@@ -2715,11 +2724,11 @@ linux_nat_do_thread_registers (bfd *obfd
else
fill_gregset (&gregs, -1);
- note_data = (char *) elfcore_write_prstatus (obfd,
- note_data,
- note_size,
- lwp,
- stop_signal, &gregs);
+ note_data = (char *) linux_elfcore_write_prstatus (obfd,
+ note_data,
+ note_size,
+ lwp,
+ stop_signal, &gregs);
if (core_regset_p
&& (regset = gdbarch_regset_from_core_section (gdbarch, ".reg2",
@@ -2730,10 +2739,10 @@ linux_nat_do_thread_registers (bfd *obfd
else
fill_fpregset (&fpregs, -1);
- note_data = (char *) elfcore_write_prfpreg (obfd,
- note_data,
- note_size,
- &fpregs, sizeof (fpregs));
+ note_data = (char *) linux_elfcore_write_prfpreg (obfd,
+ note_data,
+ note_size,
+ &fpregs, sizeof (fpregs));
#ifdef FILL_FPXREGSET
if (core_regset_p
@@ -2828,9 +2837,9 @@ linux_nat_make_corefile_notes (bfd *obfd
strncat (psargs, get_inferior_args (),
sizeof (psargs) - strlen (psargs));
}
- note_data = (char *) elfcore_write_prpsinfo (obfd,
- note_data,
- note_size, fname, psargs);
+ note_data = (char *) linux_elfcore_write_prpsinfo (obfd, note_data,
+ note_size, fname,
+ psargs);
}
/* Dump information for threads. */
Index: gdb-6.6/gdb/linux-nat.h
===================================================================
--- gdb-6.6.orig/gdb/linux-nat.h 2007-01-20 06:42:58.000000000 +0100
+++ gdb-6.6/gdb/linux-nat.h 2007-01-20 06:56:21.000000000 +0100
@@ -108,3 +108,12 @@ void linux_nat_add_target (struct target
/* Update linux-nat internal state when changing from one fork
to another. */
void linux_nat_switch_fork (ptid_t new_ptid);
+
+/* This functions make elfcore note sections.
+ They may get overriden by code adjusting data for multi-target builds. */
+extern char *(*linux_elfcore_write_prpsinfo)
+ (bfd *, char *, int *, const char *, const char *);
+extern char *(*linux_elfcore_write_prstatus)
+ (bfd *, char *, int *, long, int, const void *);
+extern char *(*linux_elfcore_write_prfpreg)
+ (bfd *, char *, int *, const void *, int);

View File

@ -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-6.5-ia64-libunwind-leak-test.patch
;; Test ia64 memory leaks of the code using libunwind.
;;=fedoratest
diff --git a/gdb/testsuite/gdb.base/unwind-leak.c b/gdb/testsuite/gdb.base/unwind-leak.c
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/unwind-leak.c
@@ -0,0 +1,29 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2007 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+ Please email any bugs, comments, and/or additions to this file to:
+ bug-gdb@prep.ai.mit.edu */
+
+#include <unistd.h>
+
+int main()
+{
+ for (;;)
+ alarm (0);
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.base/unwind-leak.exp b/gdb/testsuite/gdb.base/unwind-leak.exp
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/unwind-leak.exp
@@ -0,0 +1,83 @@
+# Copyright 2007 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+set testfile unwind-leak
+set srcfile ${testfile}.c
+set shfile [standard_output_file ${testfile}-gdb.sh]
+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}
+
+set pid [exp_pid -i [board_info host fileid]]
+
+# For C programs, "start" should stop in main().
+
+gdb_test "start" \
+ "main \\(\\) at .*$srcfile.*" \
+ "start"
+
+set loc [gdb_get_line_number "alarm"]
+gdb_breakpoint $loc
+
+proc memory_get {} {
+ global pid
+ set fd [open "/proc/$pid/statm"]
+ gets $fd line
+ close $fd
+ # number of pages of data/stack
+ scan $line "%*d%*d%*d%*d%*d%d" drs
+ return $drs
+}
+
+set cycles 100
+# For 100 cycles it was 1308: from = 363 KB, to = 1671 KB
+set permit_kb 100
+verbose -log "cycles = $cycles, permit_kb = $permit_kb"
+
+set fail 0
+set test "breakpoint stop/continue cycles"
+for {set i $cycles} {$i > 0} {set i [expr {$i - 1}]} {
+ gdb_test_multiple "continue" $test {
+ -re "Breakpoint 2, main .*alarm .*.*${gdb_prompt} $" {
+ }
+ -re "Segmentation fault" {
+ fail $test
+ set i 0
+ set fail 1
+ }
+ }
+ if ![info exists from] {
+ set from [memory_get]
+ }
+}
+set to [memory_get]
+if {!$fail} {
+ verbose -log "from = $from KB, to = $to KB"
+ if {$from > 0 && $to > 10 && $to < $from + $permit_kb} {
+ pass $test
+ } else {
+ fail $test
+ }
+}

View File

@ -1,15 +1,9 @@
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-last-address-space-byte-test.patch
;; Testcase for deadlocking on last address space byte; for corrupted backtraces.
;;=fedoratest
diff --git a/gdb/testsuite/gdb.base/largecore-last-address-lock.exp b/gdb/testsuite/gdb.base/largecore-last-address-lock.exp
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/largecore-last-address-lock.exp
Index: ./gdb/testsuite/gdb.base/largecore-last-address-lock.exp
===================================================================
RCS file: ./gdb/testsuite/gdb.base/largecore-last-address-lock.exp
diff -N ./gdb/testsuite/gdb.base/largecore-last-address-lock.exp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ./gdb/testsuite/gdb.base/largecore-last-address-lock.exp 15 Nov 2006 21:43:24 -0000
@@ -0,0 +1,49 @@
+# Copyright 2006 Free Software Foundation, Inc.
+

View File

@ -1,18 +1,13 @@
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,104 @@
Index: ./gdb/testsuite/gdb.base/readline-overflow.exp
===================================================================
RCS file: ./gdb/testsuite/gdb.base/readline-overflow.exp
diff -N ./gdb/testsuite/gdb.base/readline-overflow.exp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ./gdb/testsuite/gdb.base/readline-overflow.exp 13 Nov 2006 23:42:50 -0000
@@ -0,0 +1,125 @@
+# Copyright 2006 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
@ -44,76 +39,98 @@ new file mode 100644
+ 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"
+
+save_vars { env(INPUTRC) env(GDBHISTFILE) env(HISTSIZE) TERM timeout } {
+ # The arrow key test relies on the standard VT100 bindings, so
+ # make sure that an appropriate terminal is selected. The same
+ # bug doesn't show up if we use ^P / ^N instead.
+ setenv TERM vt100
+set oldtimeout1 $timeout
+set timeout 600
+
+ # 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.
+ set env(INPUTRC) "/dev/null"
+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"
+
+ set timeout 600
+
+ set env(GDBHISTFILE) "${srcdir}/${subdir}/gdb_history"
+ set env(HISTSIZE) "10"
+
+ gdb_exit
+ gdb_start
+ gdb_reinitialize_dir $srcdir/$subdir
+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 {
+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
+ }
+ incr i
+ if {$i <= $total} {
+ send_gdb "X"
+ exp_continue
+ }
+ }
+ -re "\[ \b\r\n\]" {
+ exp_continue
+ exp_continue
+ }
+ eof {
+ fail "gdb sending total $total characters"
+ note "Failed after sending $i characters, reason: EOF"
+ gdb_clear_suppressed
+ 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
+ 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
+ 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"
+}
+gdb_test "\r" \
+ "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
+
+return 0

View File

@ -0,0 +1,165 @@
Fix Valgrind paste of >= 256 * (screen width) characters (as 130001).
Invalid write of size 4
at 0x8203BD9: rl_redisplay (display.c:812)
by 0x81F5130: _rl_internal_char_cleanup (readline.c:427)
by 0x81F52B3: readline_internal_char (readline.c:508)
by 0x8209817: rl_callback_read_char (callback.c:184)
by 0x8135312: rl_callback_read_char_wrapper (event-top.c:179)
by 0x8135B7B: stdin_event_handler (event-top.c:432)
by 0x81349F2: handle_file_event (event-loop.c:730)
by 0x81342AB: process_event (event-loop.c:343)
by 0x81342F4: gdb_do_one_event (event-loop.c:380)
by 0x81313AC: catch_errors (exceptions.c:515)
by 0x80CE8CA: tui_command_loop (tui-interp.c:151)
by 0x81318B9: current_interp_command_loop (interps.c:278)
Address 0x43DCEB8 is 0 bytes after a block of size 1,024 alloc'd
at 0x4005400: malloc (vg_replace_malloc.c:149)
by 0x8087084: xmalloc (utils.c:959)
by 0x8202CA7: init_line_structures (display.c:440)
by 0x8202D14: rl_redisplay (display.c:471)
by 0x81F4F53: readline_internal_setup (readline.c:363)
by 0x820958C: _rl_callback_newline (callback.c:89)
by 0x82095BB: rl_callback_handler_install (callback.c:101)
by 0x80CE896: tui_command_loop (tui-interp.c:138)
by 0x81318B9: current_interp_command_loop (interps.c:278)
by 0x807E69A: captured_command_loop (main.c:101)
by 0x81313AC: catch_errors (exceptions.c:515)
by 0x807F55A: captured_main (main.c:826)
2006-11-08 Jan Kratochvil <jan.kratochvil@redhat.com>
* readline/display.c (line_state, line_state_array, line_state_visible,
line_state_invisible): Encapsulate _rl_wrapped_line, inv_lbreaks,
inv_lbsize, vis_lbreaks, vis_lbsize, visible_line, invisible_line.
(init_line_structures): Initialize both _rl_wrapped_line ones now.
(rl_redisplay): Fix _rl_wrapped_line handling by using its own size.
Swap whole `line_state_visible' / `line_state_invisible' structures.
(update_line): Update for new `_rl_wrapped_line'.
Index: ./readline/display.c
===================================================================
--- ./readline/display.c 5 May 2006 18:26:12 -0000 1.11
+++ ./readline/display.c 8 Nov 2006 18:23:33 -0000
@@ -73,15 +73,31 @@ static void delete_chars PARAMS((int));
static void insert_some_chars PARAMS((char *, int, int));
static void cr PARAMS((void));
+struct line_state
+ {
+ char *line;
+ int *lbreaks;
+ int lbreaks_size;
+#if defined (HANDLE_MULTIBYTE)
+ int *wrapped_line;
+ int wrapped_line_size;
+#endif
+ };
+static struct line_state line_state_array[2];
+static struct line_state *line_state_visible = &line_state_array[0];
+static struct line_state *line_state_invisible = &line_state_array[1];
+
#if defined (HANDLE_MULTIBYTE)
static int _rl_col_width PARAMS((const char *, int, int));
-static int *_rl_wrapped_line;
#else
# define _rl_col_width(l, s, e) (((e) <= (s)) ? 0 : (e) - (s))
#endif
-static int *inv_lbreaks, *vis_lbreaks;
-static int inv_lbsize, vis_lbsize;
+/* FIXME: Backward compatible naming. */
+#define inv_lbreaks (line_state_invisible->lbreaks)
+#define inv_lbsize (line_state_invisible->lbreaks_size)
+#define vis_lbreaks (line_state_visible->lbreaks)
+#define vis_lbsize (line_state_visible->lbreaks_size)
/* Heuristic used to decide whether it is faster to move from CUR to NEW
by backing up or outputting a carriage return and moving forward. */
@@ -150,8 +166,9 @@ static int last_lmargin;
/* The line display buffers. One is the line currently displayed on
the screen. The other is the line about to be displayed. */
-static char *visible_line = (char *)NULL;
-static char *invisible_line = (char *)NULL;
+/* FIXME: Backward compatible naming. */
+#define visible_line (line_state_visible->line)
+#define invisible_line (line_state_invisible->line)
/* A buffer for `modeline' messages. */
static char msg_buf[128];
@@ -437,7 +454,10 @@ init_line_structures (minsize)
inv_lbreaks = (int *)xmalloc (inv_lbsize * sizeof (int));
vis_lbreaks = (int *)xmalloc (vis_lbsize * sizeof (int));
#if defined (HANDLE_MULTIBYTE)
- _rl_wrapped_line = (int *)xmalloc (vis_lbsize * sizeof (int));
+ line_state_visible->wrapped_line_size = vis_lbsize;
+ line_state_visible->wrapped_line = (int *)xmalloc (line_state_visible->wrapped_line_size * sizeof (int));
+ line_state_invisible->wrapped_line_size = inv_lbsize;
+ line_state_invisible->wrapped_line = (int *)xmalloc (line_state_invisible->wrapped_line_size * sizeof (int));
#endif
inv_lbreaks[0] = vis_lbreaks[0] = 0;
}
@@ -572,10 +592,15 @@ rl_redisplay ()
{ \
inv_lbsize *= 2; \
inv_lbreaks = (int *)xrealloc (inv_lbreaks, inv_lbsize * sizeof (int)); \
- _rl_wrapped_line = (int *)xrealloc (_rl_wrapped_line, inv_lbsize * sizeof (int)); \
} \
inv_lbreaks[++newlines] = out; \
- _rl_wrapped_line[newlines] = _rl_wrapped_multicolumn; \
+ if (newlines >= (line_state_invisible->wrapped_line_size - 1)) \
+ { \
+ line_state_invisible->wrapped_line_size *= 2; \
+ line_state_invisible->wrapped_line = (int *)xrealloc (line_state_invisible->wrapped_line, \
+ line_state_invisible->wrapped_line_size * sizeof (int)); \
+ } \
+ line_state_invisible->wrapped_line[newlines] = _rl_wrapped_multicolumn; \
lpos = 0; \
} \
} while (0)
@@ -605,7 +630,7 @@ rl_redisplay ()
#endif
#if defined (HANDLE_MULTIBYTE)
- memset (_rl_wrapped_line, 0, vis_lbsize);
+ memset (line_state_invisible->wrapped_line, 0, line_state_invisible->wrapped_line_size * sizeof (int));
num = 0;
#endif
@@ -1118,17 +1143,10 @@ rl_redisplay ()
/* Swap visible and non-visible lines. */
{
- char *vtemp = visible_line;
- int *itemp = vis_lbreaks, ntemp = vis_lbsize;
-
- visible_line = invisible_line;
- invisible_line = vtemp;
-
- vis_lbreaks = inv_lbreaks;
- inv_lbreaks = itemp;
-
- vis_lbsize = inv_lbsize;
- inv_lbsize = ntemp;
+ struct line_state *line_state_temp = line_state_visible;
+
+ line_state_visible = line_state_invisible;
+ line_state_invisible = line_state_temp;
rl_display_fixed = 0;
/* If we are displaying on a single line, and last_lmargin is > 0, we
@@ -1194,8 +1212,9 @@ update_line (old, new, current_line, oma
/* This fixes only double-column characters, but if the wrapped
character comsumes more than three columns, spaces will be
inserted in the string buffer. */
- if (_rl_wrapped_line[current_line] > 0)
- _rl_clear_to_eol (_rl_wrapped_line[current_line]);
+ if (current_line < line_state_visible->wrapped_line_size
+ && line_state_visible->wrapped_line[current_line] > 0)
+ _rl_clear_to_eol (line_state_visible->wrapped_line[current_line]);
memset (&ps, 0, sizeof (mbstate_t));
ret = mbrtowc (&wc, new, MB_CUR_MAX, &ps);

143
gdb-6.5-relativedebug.patch Normal file
View File

@ -0,0 +1,143 @@
2006-10-29 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb/symtab.c (matching_bfd_sections): Fix VMA matching for objects
loaded at a different address than stored on the disk.
2006-10-29 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.base/relativedebug.c, gdb.base/relativedebug.exp: New file,
resolving of PC in libc pause(3) (with possibly different on-disk VMA).
Index: ./gdb/symtab.c
===================================================================
--- ./gdb/symtab.c 17 Oct 2006 20:17:44 -0000 1.148
+++ ./gdb/symtab.c 29 Oct 2006 22:29:21 -0000
@@ -739,8 +739,11 @@ matching_bfd_sections (asection *first,
if (bfd_get_section_size (first) != bfd_get_section_size (second))
return 0;
+ /* In-memory addresses may start at a different offset, relativize them. */
if (bfd_get_section_vma (first->owner, first)
- != bfd_get_section_vma (second->owner, second))
+ - bfd_get_start_address (first->owner)
+ != bfd_get_section_vma (second->owner, second)
+ - bfd_get_start_address (second->owner))
return 0;
if (bfd_get_section_name (first->owner, first) == NULL
Index: ./gdb/testsuite/gdb.base/relativedebug.c
===================================================================
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ./gdb/testsuite/gdb.base/relativedebug.c 29 Oct 2006 22:29:21 -0000
@@ -0,0 +1,37 @@
+/* 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. */
+
+#include <unistd.h>
+#include <stdlib.h>
+#include <signal.h>
+
+
+static void handler (int signo)
+{
+ abort ();
+}
+
+int main (void)
+{
+ signal (SIGALRM, handler);
+ alarm (1);
+ pause ();
+ pause ();
+ return 0;
+}
Index: ./gdb/testsuite/gdb.base/relativedebug.exp
===================================================================
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ./gdb/testsuite/gdb.base/relativedebug.exp 29 Oct 2006 22:29:21 -0000
@@ -0,0 +1,68 @@
+# 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 relativedebug
+set srcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
+ untested "Couldn't compile test program"
+ return -1
+}
+
+# Get things started.
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+# pause () -> SIGALRM -> handler () -> abort ()
+
+gdb_test "run" \
+ ".*Program received signal SIGABRT, Aborted..*" \
+ "run"
+
+# incorrect (#6):
+# (gdb) bt
+# #0 0x00325402 in __kernel_vsyscall ()
+# #1 0x00718f20 in *__GI_raise (sig=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
+# #2 0x0071a801 in *__GI_abort () at abort.c:88
+# #3 0x0804841f in handler (signo=14) at ./gdb.base/relativedebug.c:27
+# #4 <signal handler called>
+# #5 0x00325402 in __kernel_vsyscall ()
+# #6 0x0077ebc6 in ?? () from /lib/i686/nosegneg/libc.so.6
+# #7 0x08048455 in main () at ./gdb.base/relativedebug.c:34
+# (gdb)
+
+# correct (#6):
+# (gdb) bt
+# #0 0x00b33402 in __kernel_vsyscall ()
+# #1 0x00718f20 in *__GI_raise (sig=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
+# #2 0x0071a801 in *__GI_abort () at abort.c:88
+# #3 0x0804841f in handler (signo=14) at ./gdb.base/relativedebug.c:27
+# #4 <signal handler called>
+# #5 0x00b33402 in __kernel_vsyscall ()
+# #6 0x0077ebc6 in __pause_nocancel () from /lib/i686/nosegneg/libc.so.6
+# #7 0x08048455 in main () at ./gdb.base/relativedebug.c:34
+# (gdb)
+
+gdb_test "bt" \
+ ".*\[^a-zA-Z\]pause\[^a-zA-Z\].*" \
+ "pause(3) seen there"

View File

@ -1,122 +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-section-num-fixup-test.patch
;; Test a crash on libraries missing the .text section.
;;=fedoratest
diff --git a/gdb/testsuite/gdb.base/datalib-lib.c b/gdb/testsuite/gdb.base/datalib-lib.c
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/datalib-lib.c
@@ -0,0 +1,22 @@
+/* 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 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 */
+
+int var;
diff --git a/gdb/testsuite/gdb.base/datalib-main.c b/gdb/testsuite/gdb.base/datalib-main.c
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/datalib-main.c
@@ -0,0 +1,26 @@
+/* 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 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 */
+
+int
+main (void)
+{
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.base/datalib.exp b/gdb/testsuite/gdb.base/datalib.exp
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/datalib.exp
@@ -0,0 +1,51 @@
+# 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 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+set testfile datalib
+set srcfilemain ${testfile}-main.c
+set srcfilelib ${testfile}-lib.c
+set libfile [standard_output_file ${testfile}-lib.so]
+set binfile [standard_output_file ${testfile}-main]
+if { [gdb_compile "${srcdir}/${subdir}/${srcfilelib}" "${libfile}" executable [list debug {additional_flags=-shared -nostdlib}]] != "" } {
+ untested "Couldn't compile test program"
+ return -1
+}
+if { [gdb_compile "${srcdir}/${subdir}/${srcfilemain}" "${binfile} ${libfile}" 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}
+
+# We must use a separate library as the main executable is compiled to the
+# address 0 by default and it would get fixed up already at the end of
+# INIT_OBJFILE_SECT_INDICES. We also cannot PRELINK it as PRELINK is missing
+# on ia64. The library must be NOSTDLIB as otherwise some stub code would
+# create the `.text' section there. Also DEBUG option is useful as some of
+# the crashes occur in dwarf2read.c.
+
+# FAIL case:
+# ../../gdb/ia64-tdep.c:2838: internal-error: sect_index_text not initialized
+# A problem internal to GDB has been detected,
+
+gdb_test "start" \
+ "main \\(\\) at .*${srcfilemain}.*" \
+ "start"

View File

@ -1,38 +1,164 @@
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-sharedlibrary-path.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.
If you provided some relative path to the shared library, such as with
export LD_LIBRARY_PATH=.
then gdb would fail to match the shared library name during the TLS lookup.
Dropped the workaround/fix for gdb-6.8.50.20081128 - is it still needed?
The testsuite needs `gdb-6.3-bz146810-solib_absolute_prefix_is_empty.patch'.
The testsuite needs `gdb-6.5-tls-of-separate-debuginfo.patch'.
2006-09-01 Jan Kratochvil <jan.kratochvil@redhat.com>
* solib-svr4.c (svr4_fetch_objfile_link_map): Match even absolute
requested pathnames to the internal loaded relative pathnames.
2007-10-16 Jan Kratochvil <jan.kratochvil@redhat.com>
Port to GDB-6.7.
2008-02-27 Jan Kratochvil <jan.kratochvil@redhat.com>
Port to gdb-6.7.50.20080227.
diff --git a/gdb/testsuite/gdb.threads/tls-sepdebug-main.c b/gdb/testsuite/gdb.threads/tls-sepdebug-main.c
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.threads/tls-sepdebug-main.c
Index: gdb-6.5/gdb/solib-svr4.c
===================================================================
RCS file: /cvs/src/src/gdb/solib-svr4.c,v
retrieving revision 1.58
diff -u -p -r1.58 gdb-6.5/gdb/solib-svr4.c
--- gdb-6.5.orig/gdb/solib-svr4.c 18 May 2006 20:38:56 -0000 1.58
+++ gdb-6.5/gdb/solib-svr4.c 1 Sep 2006 18:47:10 -0000
@@ -774,62 +774,81 @@ CORE_ADDR
svr4_fetch_objfile_link_map (struct objfile *objfile)
{
CORE_ADDR lm;
+ int resolve;
if ((debug_base = locate_base ()) == 0)
return 0; /* failed somehow... */
- /* Position ourselves on the first link map. */
- lm = solib_svr4_r_map ();
- while (lm)
+ for (resolve = 0; resolve <= 1; resolve++)
{
- /* Get info on the layout of the r_debug and link_map structures. */
- struct link_map_offsets *lmo = svr4_fetch_link_map_offsets ();
- int errcode;
- char *buffer;
- struct lm_info objfile_lm_info;
- struct cleanup *old_chain;
- CORE_ADDR name_address;
- gdb_byte *l_name_buf = xmalloc (lmo->l_name_size);
- old_chain = make_cleanup (xfree, l_name_buf);
-
- /* Set up the buffer to contain the portion of the link_map
- structure that gdb cares about. Note that this is not the
- whole link_map structure. */
- objfile_lm_info.lm = xzalloc (lmo->link_map_size);
- make_cleanup (xfree, objfile_lm_info.lm);
-
- /* Read the link map into our internal structure. */
- read_memory (lm, objfile_lm_info.lm, lmo->link_map_size);
-
- /* Read address of name from target memory to GDB. */
- read_memory (lm + lmo->l_name_offset, l_name_buf, lmo->l_name_size);
-
- /* Extract this object's name. Assume that the address is
- unsigned. */
- name_address = extract_unsigned_integer (l_name_buf, lmo->l_name_size);
- target_read_string (name_address, &buffer,
- SO_NAME_MAX_PATH_SIZE - 1, &errcode);
- make_cleanup (xfree, buffer);
- if (errcode != 0)
- warning (_("Can't read pathname for load map: %s."),
- safe_strerror (errcode));
- else
- {
- /* Is this the linkmap for the file we want? */
- /* If the file is not a shared library and has no name,
- we are sure it is the main executable, so we return that. */
- if ((buffer && strcmp (buffer, objfile->name) == 0)
- || (!(objfile->flags & OBJF_SHARED) && (strcmp (buffer, "") == 0)))
- {
- do_cleanups (old_chain);
- return lm;
- }
- }
- /* Not the file we wanted, continue checking. Assume that the
- address is unsigned. */
- lm = extract_unsigned_integer (objfile_lm_info.lm + lmo->l_next_offset,
- lmo->l_next_size);
- do_cleanups (old_chain);
+ /* Position ourselves on the first link map. */
+ lm = solib_svr4_r_map ();
+ while (lm)
+ {
+ /* Get info on the layout of the r_debug and link_map structures. */
+ struct link_map_offsets *lmo = svr4_fetch_link_map_offsets ();
+ int errcode;
+ char *buffer;
+ struct lm_info objfile_lm_info;
+ struct cleanup *old_chain;
+ CORE_ADDR name_address;
+ gdb_byte *l_name_buf = xmalloc (lmo->l_name_size);
+ old_chain = make_cleanup (xfree, l_name_buf);
+
+ /* Set up the buffer to contain the portion of the link_map
+ structure that gdb cares about. Note that this is not the
+ whole link_map structure. */
+ objfile_lm_info.lm = xzalloc (lmo->link_map_size);
+ make_cleanup (xfree, objfile_lm_info.lm);
+
+ /* Read the link map into our internal structure. */
+ read_memory (lm, objfile_lm_info.lm, lmo->link_map_size);
+
+ /* Read address of name from target memory to GDB. */
+ read_memory (lm + lmo->l_name_offset, l_name_buf, lmo->l_name_size);
+
+ /* Extract this object's name. Assume that the address is
+ unsigned. */
+ name_address = extract_unsigned_integer (l_name_buf, lmo->l_name_size);
+ target_read_string (name_address, &buffer,
+ SO_NAME_MAX_PATH_SIZE - 1, &errcode);
+ make_cleanup (xfree, buffer);
+ if (errcode != 0)
+ warning (_("Can't read pathname for load map: %s."),
+ safe_strerror (errcode));
+ else
+ {
+ /* solib_svr4_r_map() may contain relative pathnames while
+ `objfile->name' is absolute. */
+ if (resolve && buffer && buffer[0] != '/')
+ {
+ char *absolute;
+ int fd;
+
+ fd = solib_open (buffer, &absolute);
+ if (fd != -1)
+ {
+ make_cleanup (xfree, absolute);
+ buffer = absolute;
+ close (fd);
+ }
+ }
+ /* Is this the linkmap for the file we want? */
+ /* If the file is not a shared library and has no name,
+ we are sure it is the main executable, so we return that. */
+ if ((buffer && strcmp (buffer, objfile->name) == 0)
+ || (!(objfile->flags & OBJF_SHARED) && (strcmp (buffer, "") == 0)))
+ {
+ do_cleanups (old_chain);
+ return lm;
+ }
+ }
+ /* Not the file we wanted, continue checking. Assume that the
+ address is unsigned. */
+ lm = extract_unsigned_integer (objfile_lm_info.lm + lmo->l_next_offset,
+ lmo->l_next_size);
+ do_cleanups (old_chain);
+ }
}
return 0;
}
Index: gdb-6.5/gdb/testsuite/gdb.threads/tls-sepdebug-main.c
===================================================================
RCS file: gdb-6.5/gdb/testsuite/gdb.threads/tls-sepdebug-main.c
diff -N gdb-6.5/gdb/testsuite/gdb.threads/tls-sepdebug-main.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gdb-6.5/gdb/testsuite/gdb.threads/tls-sepdebug-main.c 1 Sep 2006 18:47:14 -0000
@@ -0,0 +1,25 @@
+/* This testcase is part of GDB, the GNU debugger.
+
@ -59,10 +185,12 @@ new file mode 100644
+{
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.threads/tls-sepdebug-shared.c b/gdb/testsuite/gdb.threads/tls-sepdebug-shared.c
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.threads/tls-sepdebug-shared.c
Index: gdb-6.5/gdb/testsuite/gdb.threads/tls-sepdebug-shared.c
===================================================================
RCS file: gdb-6.5/gdb/testsuite/gdb.threads/tls-sepdebug-shared.c
diff -N gdb-6.5/gdb/testsuite/gdb.threads/tls-sepdebug-shared.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gdb-6.5/gdb/testsuite/gdb.threads/tls-sepdebug-shared.c 1 Sep 2006 18:47:14 -0000
@@ -0,0 +1,22 @@
+/* This testcase is part of GDB, the GNU debugger.
+
@ -86,11 +214,13 @@ new file mode 100644
+ bug-gdb@prep.ai.mit.edu */
+
+__thread int var = 42;
diff --git a/gdb/testsuite/gdb.threads/tls-sepdebug.exp b/gdb/testsuite/gdb.threads/tls-sepdebug.exp
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.threads/tls-sepdebug.exp
@@ -0,0 +1,87 @@
Index: gdb-6.5/gdb/testsuite/gdb.threads/tls-sepdebug.exp
===================================================================
RCS file: gdb-6.5/gdb/testsuite/gdb.threads/tls-sepdebug.exp
diff -N gdb-6.5/gdb/testsuite/gdb.threads/tls-sepdebug.exp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gdb-6.5/gdb/testsuite/gdb.threads/tls-sepdebug.exp 1 Sep 2006 18:47:14 -0000
@@ -0,0 +1,81 @@
+# Copyright 2006 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
@ -115,17 +245,14 @@ new file mode 100644
+set srcmainfile ${testfile}-main.c
+set srcsharedfile ${testfile}-shared.c
+
+set binmainfile [standard_output_file ${testfile}-main]
+set binsharedbase ${testfile}-shared.so
+set binsharedfile [standard_output_file ${binsharedbase}]
+set binshareddebugfile [standard_output_file ${binsharedbase}.debug]
+# DO NOT use ${objdir} obsolute reference here as we test relative directories
+# below and the absolute pathnames must not get encoded to the binaries.
+
+# Use explicit -soname as otherwise the full path to the library would get
+# encoded into ${binmainfile} making LD_LIBRARY_PATH tests useless.
+set binmainfile ${testfile}-main
+set binsharedfile ${testfile}-shared.so
+set binshareddebugfile ${testfile}-shared.so.debug
+
+# FIXME: gcc dependency (-Wl,-soname).
+
+if { [gdb_compile_shlib "${srcdir}/${subdir}/${srcsharedfile}" "${binsharedfile}" [list debug additional_flags=-Wl,-soname=${binsharedbase}]] != "" } {
+if { [gdb_compile_shlib "${srcdir}/${subdir}/${srcsharedfile}" "${binsharedfile}" {debug}] != "" } {
+ untested "Couldn't compile test library"
+ return -1
+}
@ -139,9 +266,7 @@ new file mode 100644
+ remote_exec build "objcopy --add-gnu-debuglink=${binshareddebugfile} ${binsharedfile}"
+}
+
+# Do not use `shlib=' as it will automatically add also -rpath for gcc.
+
+if { [gdb_compile_pthreads "${srcdir}/${subdir}/${srcmainfile} ${binsharedfile}" "${binmainfile}" executable {debug}] != "" } {
+if { [gdb_compile_pthreads "${srcdir}/${subdir}/${srcmainfile}" "${binmainfile}" executable [list debug shlib=${binsharedfile}]] != "" } {
+ untested "Couldn't compile test program"
+ return -1
+}
@ -152,8 +277,7 @@ new file mode 100644
+# \$PWD is easy - it is the absolute way
+# ${subdir} would fail on "print var"
+
+set absdir [file dirname [standard_output_file ${binsharedbase}]]
+foreach ld_library_path [list $absdir [relative_filename [pwd] $absdir]] name { absolute relative } {
+foreach ld_library_path { \$PWD ${subdir} } name { absolute relative } {
+
+ gdb_exit
+ gdb_start

View File

@ -0,0 +1,189 @@
2006-10-30 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb/minsyms.c (lookup_minimal_symbol_by_pc_section): Handle
overlapping non-zero sized functions (for glibc `__nanosleep').
2006-10-30 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.arch/i386-size-overlap.c, gdb.arch/i386-size-overlap.exp: New
file, provide nested (overlapping) functions for the PC resolving.
Index: ./gdb/minsyms.c
===================================================================
--- ./gdb/minsyms.c 17 Oct 2006 20:17:44 -0000 1.47
+++ ./gdb/minsyms.c 30 Oct 2006 12:41:26 -0000
@@ -511,6 +511,29 @@ lookup_minimal_symbol_by_pc_section (COR
continue;
}
+ /* We are behind the current symbol's size.
+ Try the previous symbol - if it is non-zero sized one it
+ may overlap the current one and reach our PC.
+ It occurs for GNU/Linux glibc `__nanosleep' overlapping
+ later `__nanosleep_nocancel' with PC at 0077ec66:
+ Num: Value Size Type Bind Vis Ndx Name
+ 7247: 0077ec20 124 FUNC WEAK DEFAULT 11 __nanosleep
+ 4651: 0077ec2a 32 FUNC LOCAL DEFAULT 11 __nanosleep_nocancel
+ Test `gdb.arch/i386-size' + `gdb.arch/i386-unwind'.
+ Limit it only for the overlapping cases as we could harm
+ the zero-sized symbols detection logic around.
+ */
+ if (hi > 0
+ && MSYMBOL_SIZE (&msymbol[hi]) != 0
+ && pc >= (SYMBOL_VALUE_ADDRESS (&msymbol[hi])
+ + MSYMBOL_SIZE (&msymbol[hi]))
+ && pc < (SYMBOL_VALUE_ADDRESS (&msymbol[hi - 1])
+ + MSYMBOL_SIZE (&msymbol[hi - 1])))
+ {
+ hi--;
+ continue;
+ }
+
/* Otherwise, this symbol must be as good as we're going
to get. */
break;
Index: ./gdb/testsuite/gdb.arch/i386-size-overlap.c
===================================================================
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ./gdb/testsuite/gdb.arch/i386-size-overlap.c 30 Oct 2006 12:41:35 -0000
@@ -0,0 +1,53 @@
+/* Overlapping symbol sizes test program.
+
+ Copyright 2006 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 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. */
+
+#ifdef SYMBOL_PREFIX
+#define SYMBOL(str) SYMBOL_PREFIX #str
+#else
+#define SYMBOL(str) #str
+#endif
+
+void
+trap (void)
+{
+ asm ("int $0x03");
+}
+
+/* Jump from a function with its symbol size set, to a function
+ named by a local label. GDB should report the `main' function
+ even for the rest, after the global `inner' ends. */
+
+asm(".text\n"
+ " .align 8\n"
+ " .globl " SYMBOL (main) "\n"
+ SYMBOL (main) ":\n"
+ " pushl %ebp\n"
+ " mov %esp, %ebp\n"
+ " call .Lfunc\n"
+ " ret\n"
+ SYMBOL (inner) ":\n"
+ " ret\n"
+ " .size " SYMBOL (inner) ", .-" SYMBOL (inner) "\n"
+ ".Lfunc:\n"
+ " pushl %ebp\n"
+ " mov %esp, %ebp\n"
+ " call " SYMBOL (trap) "\n"
+ " .size " SYMBOL (main) ", .-" SYMBOL (main) "\n");
Index: gdb/testsuite/gdb.arch/i386-size-overlap.exp
===================================================================
RCS file: gdb/testsuite/gdb.arch/i386-size-overlap.exp
diff -N ./gdb/testsuite/gdb.arch/i386-size-overlap.exp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ./gdb/testsuite/gdb.arch/i386-size-overlap.exp 30 Oct 2006 12:41:35 -0000
@@ -0,0 +1,79 @@
+# 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@gnu.org
+
+# This file is part of the gdb testsuite.
+
+if $tracelevel {
+ strace $tracelevel
+}
+
+# Test that GDB can handle overlapping sizes of symbols.
+
+if ![istarget "i?86-*-*"] then {
+ verbose "Skipping i386 unwinder tests."
+ return
+}
+
+set testfile "i386-size-overlap"
+set srcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}
+
+# some targets have leading underscores on assembly symbols.
+# TODO: detect this automatically
+set additional_flags ""
+if [istarget "i?86-*-cygwin*"] then {
+ set additional_flags "additional_flags=-DSYMBOL_PREFIX=\"_\""
+}
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
+ executable [list debug $additional_flags]] != "" } {
+ untested "i386-size"
+ return -1
+}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+# We use gdb_run_cmd so this stands a chance to work for remote
+# targets too.
+gdb_run_cmd
+
+gdb_expect {
+ -re "Program received signal SIGTRAP.*$gdb_prompt $" {
+ pass "run past main"
+ }
+ -re ".*$gdb_prompt $" {
+ fail "run past main"
+ }
+ timeout {
+ fail "run past main (timeout)"
+ }
+}
+
+set message "backtrace shows the outer function"
+gdb_test_multiple "backtrace 10" $message {
+ -re "#1\[ \t]*$hex in inner.*$gdb_prompt $" {
+ fail $message
+ }
+ -re "#1\[ \t]*$hex in main.*$gdb_prompt $" {
+ pass $message
+ }
+}

Some files were not shown because too many files have changed in this diff Show More