import gdb-8.2-6.el8
This commit is contained in:
commit
d230d9434c
3
.gdb.metadata
Normal file
3
.gdb.metadata
Normal file
@ -0,0 +1,3 @@
|
||||
ee66294d87a109f88a459d0da5d0bb2da5135f45 SOURCES/gdb-8.2.tar.xz
|
||||
1ad1d2c6f0141b37bbe32b8add91b5691ecc6412 SOURCES/gdb-libstdc++-v3-python-8.1.1-20180626.tar.xz
|
||||
a08830edc095f4ea8ae516a154942105379c5f67 SOURCES/v2.0.tar.gz
|
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
SOURCES/gdb-8.2.tar.xz
|
||||
SOURCES/gdb-libstdc++-v3-python-8.1.1-20180626.tar.xz
|
||||
SOURCES/v2.0.tar.gz
|
649
SOURCES/_gdb.spec.Patch.include
Normal file
649
SOURCES/_gdb.spec.Patch.include
Normal file
@ -0,0 +1,649 @@
|
||||
# Match the Fedora's version info.
|
||||
#=fedora
|
||||
Patch001: gdb-6.3-rh-testversion-20041202.patch
|
||||
|
||||
# VLA (Fortran dynamic arrays) from Intel + archer-jankratochvil-vla tests.
|
||||
#=push
|
||||
Patch002: gdb-vla-intel-fortran-strides.patch
|
||||
|
||||
#=push
|
||||
Patch003: gdb-vla-intel-fortran-vla-strings.patch
|
||||
|
||||
#=push+jan
|
||||
Patch004: gdb-vla-intel-stringbt-fix.patch
|
||||
|
||||
# Better parse 64-bit PPC system call prologues.
|
||||
#=push: Write new testcase.
|
||||
Patch005: gdb-6.3-ppc64syscall-20040622.patch
|
||||
|
||||
# Include the pc's section when doing a symbol lookup so that the
|
||||
# correct symbol is found.
|
||||
#=push: Write new testcase.
|
||||
Patch006: gdb-6.3-ppc64displaysymbol-20041124.patch
|
||||
|
||||
# Add a wrapper script to GDB that implements pstack using the
|
||||
# --readnever option.
|
||||
#=push
|
||||
Patch007: gdb-6.3-gstack-20050411.patch
|
||||
|
||||
# VSYSCALL and PIE
|
||||
#=fedoratest
|
||||
Patch008: gdb-6.3-test-pie-20050107.patch
|
||||
|
||||
# Get selftest working with sep-debug-info
|
||||
#=fedoratest
|
||||
Patch009: gdb-6.3-test-self-20050110.patch
|
||||
|
||||
# Test support of multiple destructors just like multiple constructors
|
||||
#=fedoratest
|
||||
Patch010: gdb-6.3-test-dtorfix-20050121.patch
|
||||
|
||||
# Fix to support executable moving
|
||||
#=fedoratest
|
||||
Patch011: gdb-6.3-test-movedir-20050125.patch
|
||||
|
||||
# Test sibling threads to set threaded watchpoints for x86 and x86-64
|
||||
#=fedoratest
|
||||
Patch012: gdb-6.3-threaded-watchpoints2-20050225.patch
|
||||
|
||||
# Notify observers that the inferior has been created
|
||||
#=fedoratest
|
||||
Patch013: gdb-6.3-inferior-notification-20050721.patch
|
||||
|
||||
# Verify printing of inherited members test
|
||||
#=fedoratest
|
||||
Patch014: gdb-6.3-inheritancetest-20050726.patch
|
||||
|
||||
# Add readnever option
|
||||
#=push
|
||||
Patch015: gdb-6.3-readnever-20050907.patch
|
||||
|
||||
# Fix debuginfo addresses resolving for --emit-relocs Linux kernels (BZ 203661).
|
||||
#=push+jan: There was some mail thread about it, this patch may be a hack.
|
||||
Patch016: gdb-6.5-bz203661-emit-relocs.patch
|
||||
|
||||
# Support TLS symbols (+`errno' suggestion if no pthread is found) (BZ 185337).
|
||||
#=push+jan: It should be replaced by Infinity project.
|
||||
Patch017: gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch
|
||||
|
||||
# Fix TLS symbols resolving for shared libraries with a relative pathname.
|
||||
# The testsuite needs `gdb-6.5-tls-of-separate-debuginfo.patch'.
|
||||
#=fedoratest: One should recheck if it is really fixed upstream.
|
||||
Patch018: gdb-6.5-sharedlibrary-path.patch
|
||||
|
||||
# Improved testsuite results by the testsuite provided by the courtesy of BEA.
|
||||
#=fedoratest: For upstream it should be rewritten as a dejagnu test, the test of no "??" was useful.
|
||||
Patch019: gdb-6.5-BEA-testsuite.patch
|
||||
|
||||
# Testcase for deadlocking on last address space byte; for corrupted backtraces.
|
||||
#=fedoratest
|
||||
Patch020: gdb-6.5-last-address-space-byte-test.patch
|
||||
|
||||
# Fix readline segfault on excessively long hand-typed lines.
|
||||
#=fedoratest
|
||||
Patch021: gdb-6.5-readline-long-line-crash-test.patch
|
||||
|
||||
# Fix bogus 0x0 unwind of the thread's topmost function clone(3) (BZ 216711).
|
||||
#=fedora
|
||||
Patch022: gdb-6.5-bz216711-clone-is-outermost.patch
|
||||
|
||||
# Test sideeffects of skipping ppc .so libs trampolines (BZ 218379).
|
||||
#=fedoratest
|
||||
Patch023: gdb-6.5-bz218379-ppc-solib-trampoline-test.patch
|
||||
|
||||
# Fix lockup on trampoline vs. its function lookup; unreproducible (BZ 218379).
|
||||
#=fedora
|
||||
Patch024: gdb-6.5-bz218379-solib-trampoline-lookup-lock-fix.patch
|
||||
|
||||
# Find symbols properly at their original (included) file (BZ 109921).
|
||||
#=fedoratest
|
||||
Patch025: gdb-6.5-bz109921-DW_AT_decl_file-test.patch
|
||||
|
||||
# Update PPC unwinding patches to their upstream variants (BZ 140532).
|
||||
#=fedoratest
|
||||
Patch026: gdb-6.3-bz140532-ppc-unwinding-test.patch
|
||||
|
||||
# Testcase for exec() from threaded program (BZ 202689).
|
||||
#=fedoratest
|
||||
Patch027: gdb-6.3-bz202689-exec-from-pthread-test.patch
|
||||
|
||||
# Testcase for PPC Power6/DFP instructions disassembly (BZ 230000).
|
||||
#=fedoratest
|
||||
Patch028: gdb-6.6-bz230000-power6-disassembly-test.patch
|
||||
|
||||
# Allow running `/usr/bin/gcore' with provided but inaccessible tty (BZ 229517).
|
||||
#=fedoratest
|
||||
Patch029: gdb-6.6-bz229517-gcore-without-terminal.patch
|
||||
|
||||
# Avoid too long timeouts on failing cases of "annota1.exp annota3.exp".
|
||||
#=fedoratest
|
||||
Patch030: gdb-6.6-testsuite-timeouts.patch
|
||||
|
||||
# Support for stepping over PPC atomic instruction sequences (BZ 237572).
|
||||
#=fedoratest
|
||||
Patch031: gdb-6.6-bz237572-ppc-atomic-sequence-test.patch
|
||||
|
||||
# Make upstream `set scheduler-locking step' as default.
|
||||
#=push+jan: How much is scheduler-locking relevant after non-stop?
|
||||
Patch032: gdb-6.6-scheduler_locking-step-is-default.patch
|
||||
|
||||
# Test kernel VDSO decoding while attaching to an i386 process.
|
||||
#=fedoratest
|
||||
Patch033: gdb-6.3-attach-see-vdso-test.patch
|
||||
|
||||
# Test leftover zombie process (BZ 243845).
|
||||
#=fedoratest
|
||||
Patch034: gdb-6.5-bz243845-stale-testing-zombie-test.patch
|
||||
|
||||
# New locating of the matching binaries from the pure core file (build-id).
|
||||
#=push+jan
|
||||
Patch035: gdb-6.6-buildid-locate.patch
|
||||
|
||||
# Fix loading of core files without build-ids but with build-ids in executables.
|
||||
# Load strictly build-id-checked core files only if no executable is specified
|
||||
# (Jan Kratochvil, RH BZ 1339862).
|
||||
#=push+jan
|
||||
Patch036: gdb-6.6-buildid-locate-solib-missing-ids.patch
|
||||
|
||||
#=push+jan
|
||||
Patch037: gdb-6.6-buildid-locate-rpm.patch
|
||||
|
||||
# Fix displaying of numeric char arrays as strings (BZ 224128).
|
||||
#=fedoratest: But it is failing anyway, one should check the behavior more.
|
||||
Patch038: gdb-6.7-charsign-test.patch
|
||||
|
||||
# Test PPC hiding of call-volatile parameter register.
|
||||
#=fedoratest
|
||||
Patch039: gdb-6.7-ppc-clobbered-registers-O2-test.patch
|
||||
|
||||
# Testsuite fixes for more stable/comparable results.
|
||||
#=fedoratest
|
||||
Patch040: gdb-6.7-testsuite-stable-results.patch
|
||||
|
||||
# Test ia64 memory leaks of the code using libunwind.
|
||||
#=fedoratest
|
||||
Patch041: gdb-6.5-ia64-libunwind-leak-test.patch
|
||||
|
||||
# Test hiding unexpected breakpoints on intentional step commands.
|
||||
#=fedoratest
|
||||
Patch042: gdb-6.5-missed-trap-on-step-test.patch
|
||||
|
||||
# Test gcore memory and time requirements for large inferiors.
|
||||
#=fedoratest
|
||||
Patch043: gdb-6.5-gcore-buffer-limit-test.patch
|
||||
|
||||
# Test GCORE for shmid 0 shared memory mappings.
|
||||
#=fedoratest: But it is broken anyway, sometimes the case being tested is not reproducible.
|
||||
Patch044: gdb-6.3-mapping-zero-inode-test.patch
|
||||
|
||||
# Test a crash on `focus cmd', `focus prev' commands.
|
||||
#=fedoratest
|
||||
Patch045: gdb-6.3-focus-cmd-prev-test.patch
|
||||
|
||||
# Test various forms of threads tracking across exec() (BZ 442765).
|
||||
#=fedoratest
|
||||
Patch046: gdb-6.8-bz442765-threaded-exec-test.patch
|
||||
|
||||
# Silence memcpy check which returns false positive (sparc64)
|
||||
#=push: But it is just a GCC workaround, look up the existing GCC PR for it.
|
||||
Patch047: gdb-6.8-sparc64-silence-memcpy-check.patch
|
||||
|
||||
# Test a crash on libraries missing the .text section.
|
||||
#=fedoratest
|
||||
Patch048: gdb-6.5-section-num-fixup-test.patch
|
||||
|
||||
# Fix register assignments with no GDB stack frames (BZ 436037).
|
||||
#=push+jan: This fix is incorrect.
|
||||
Patch049: gdb-6.8-bz436037-reg-no-longer-active.patch
|
||||
|
||||
# Test the watchpoints conditionals works.
|
||||
#=fedoratest
|
||||
Patch050: gdb-6.8-watchpoint-conditionals-test.patch
|
||||
|
||||
# Fix resolving of variables at locations lists in prelinked libs (BZ 466901).
|
||||
#=fedoratest
|
||||
Patch051: gdb-6.8-bz466901-backtrace-full-prelinked.patch
|
||||
|
||||
# New test for step-resume breakpoint placed in multiple threads at once.
|
||||
#=fedoratest
|
||||
Patch052: gdb-simultaneous-step-resume-breakpoint-test.patch
|
||||
|
||||
# Fix GNU/Linux core open: Can't read pathname for load map: Input/output error.
|
||||
# Fix regression of undisplayed missing shared libraries caused by a fix for.
|
||||
#=fedoratest: It should be in glibc: libc-alpha: <20091004161706.GA27450@.*>
|
||||
Patch053: gdb-core-open-vdso-warning.patch
|
||||
|
||||
# Fix syscall restarts for amd64->i386 biarch.
|
||||
#=push+jan
|
||||
Patch054: gdb-x86_64-i386-syscall-restart.patch
|
||||
|
||||
# Fix stepping with OMP parallel Fortran sections (BZ 533176).
|
||||
#=push+jan: It requires some better DWARF annotations.
|
||||
Patch055: gdb-bz533176-fortran-omp-step.patch
|
||||
|
||||
# Fix regression by python on ia64 due to stale current frame.
|
||||
#=push+jan
|
||||
Patch056: gdb-follow-child-stale-parent.patch
|
||||
|
||||
# Workaround ccache making lineno non-zero for command-line definitions.
|
||||
#=fedoratest: ccache is rarely used and it is even fixed now.
|
||||
Patch057: gdb-ccache-workaround.patch
|
||||
|
||||
#=push+jan: May get obsoleted by Tom's unrelocated objfiles patch.
|
||||
Patch058: gdb-archer-pie-addons.patch
|
||||
|
||||
#=push+jan: Breakpoints disabling matching should not be based on address.
|
||||
Patch059: gdb-archer-pie-addons-keep-disabled.patch
|
||||
|
||||
# Testcase for "Do not make up line information" fix by Daniel Jacobowitz.
|
||||
#=fedoratest
|
||||
Patch060: gdb-lineno-makeup-test.patch
|
||||
|
||||
# Test power7 ppc disassembly.
|
||||
#=fedoratest
|
||||
Patch061: gdb-ppc-power7-test.patch
|
||||
|
||||
# Fix i386+x86_64 rwatch+awatch before run, regression against 6.8 (BZ 541866).
|
||||
# Fix i386 rwatch+awatch before run (BZ 688788, on top of BZ 541866).
|
||||
#=push+jan: It should be fixed properly instead.
|
||||
Patch062: gdb-bz541866-rwatch-before-run.patch
|
||||
|
||||
# Workaround non-stop moribund locations exploited by kernel utrace (BZ 590623).
|
||||
#=push+jan: Currently it is still not fully safe.
|
||||
Patch063: gdb-moribund-utrace-workaround.patch
|
||||
|
||||
# Fix follow-exec for C++ programs (bugreported by Martin Stransky).
|
||||
#=fedoratest
|
||||
Patch064: gdb-archer-next-over-throw-cxx-exec.patch
|
||||
|
||||
# Backport DWARF-4 support (BZ 601887, Tom Tromey).
|
||||
#=fedoratest
|
||||
Patch065: gdb-bz601887-dwarf4-rh-test.patch
|
||||
|
||||
#=push+jan
|
||||
Patch066: gdb-6.6-buildid-locate-core-as-arg.patch
|
||||
|
||||
# Workaround librpm BZ 643031 due to its unexpected exit() calls (BZ 642879).
|
||||
#=push+jan
|
||||
Patch067: gdb-6.6-buildid-locate-rpm-librpm-workaround.patch
|
||||
|
||||
# [delayed-symfile] Test a backtrace regression on CFIs without DIE (BZ 614604).
|
||||
#=fedoratest
|
||||
Patch068: gdb-test-bt-cfi-without-die.patch
|
||||
|
||||
# Out of memory is just an error, not fatal (uninitialized VLS vars, BZ 568248).
|
||||
#=push+jan: Inferior objects should be read in parts, then this patch gets obsoleted.
|
||||
Patch069: gdb-bz568248-oom-is-error.patch
|
||||
|
||||
# Verify GDB Python built-in function gdb.solib_address exists (BZ # 634108).
|
||||
#=fedoratest
|
||||
Patch070: gdb-bz634108-solib_address.patch
|
||||
|
||||
# New test gdb.arch/x86_64-pid0-core.exp for kernel PID 0 cores (BZ 611435).
|
||||
#=fedoratest
|
||||
Patch071: gdb-test-pid0-core.patch
|
||||
|
||||
# [archer-tromey-delayed-symfile] New test gdb.dwarf2/dw2-aranges.exp.
|
||||
#=fedoratest
|
||||
Patch072: gdb-test-dw2-aranges.patch
|
||||
|
||||
# [archer-keiths-expr-cumulative+upstream] Import C++ testcases.
|
||||
#=fedoratest
|
||||
Patch073: gdb-test-expr-cumulative-archer.patch
|
||||
|
||||
# Fix regressions on C++ names resolving (PR 11734, PR 12273, Keith Seitz).
|
||||
#=fedoratest
|
||||
Patch074: gdb-physname-pr11734-test.patch
|
||||
|
||||
# Fix regressions on C++ names resolving (PR 11734, PR 12273, Keith Seitz).
|
||||
#=fedoratest
|
||||
Patch075: gdb-physname-pr12273-test.patch
|
||||
|
||||
# Toolchain on sparc is slightly broken and debuginfo files are generated
|
||||
# with non 64bit aligned tables/offsets.
|
||||
# See for example readelf -S ../Xvnc.debug.
|
||||
#
|
||||
# As a consenquence calculation of sectp->filepos as used in
|
||||
# dwarf2_read_section (gdb/dwarf2read.c:1525) will return a non aligned buffer
|
||||
# that cannot be used directly as done with MMAP.
|
||||
# Usage will result in a BusError.
|
||||
#
|
||||
# While we figure out what's wrong in the toolchain and do a full archive
|
||||
# rebuild to fix it, we need to be able to use gdb :)
|
||||
#=push
|
||||
Patch076: gdb-7.2.50-sparc-add-workaround-to-broken-debug-files.patch
|
||||
|
||||
# Test GDB opcodes/ disassembly of Intel Ivy Bridge instructions (BZ 696890).
|
||||
#=fedoratest
|
||||
Patch077: gdb-test-ivy-bridge.patch
|
||||
|
||||
# Hack for proper PIE run of the testsuite.
|
||||
#=fedoratest
|
||||
Patch078: gdb-runtest-pie-override.patch
|
||||
|
||||
# Print reasons for failed attach/spawn incl. SELinux deny_ptrace (BZ 786878).
|
||||
#=push+jan
|
||||
Patch079: gdb-attach-fail-reasons-5of5.patch
|
||||
|
||||
# Workaround PR libc/14166 for inferior calls of strstr.
|
||||
#=fedora: Compatibility with RHELs (unchecked which ones).
|
||||
Patch080: gdb-glibc-strstr-workaround.patch
|
||||
|
||||
# Include testcase for `Unable to see a variable inside a module (XLF)' (BZ 823789).
|
||||
#=fedoratest
|
||||
Patch081: gdb-rhel5.9-testcase-xlf-var-inside-mod.patch
|
||||
|
||||
# Testcase for `Setting solib-absolute-prefix breaks vDSO' (BZ 818343).
|
||||
#=fedoratest
|
||||
Patch082: gdb-rhbz-818343-set-solib-absolute-prefix-testcase.patch
|
||||
|
||||
# Fix `GDB cannot access struct member whose offset is larger than 256MB'
|
||||
# (RH BZ 795424).
|
||||
#=push
|
||||
Patch083: gdb-rhbz795424-bitpos-20of25.patch
|
||||
|
||||
# Fix `GDB cannot access struct member whose offset is larger than 256MB'
|
||||
# (RH BZ 795424).
|
||||
#=push
|
||||
Patch084: gdb-rhbz795424-bitpos-21of25.patch
|
||||
|
||||
# Fix `GDB cannot access struct member whose offset is larger than 256MB'
|
||||
# (RH BZ 795424).
|
||||
#=push
|
||||
Patch085: gdb-rhbz795424-bitpos-22of25.patch
|
||||
|
||||
# Fix `GDB cannot access struct member whose offset is larger than 256MB'
|
||||
# (RH BZ 795424).
|
||||
#=push
|
||||
Patch086: gdb-rhbz795424-bitpos-23of25.patch
|
||||
|
||||
# Fix `GDB cannot access struct member whose offset is larger than 256MB'
|
||||
# (RH BZ 795424).
|
||||
#=push
|
||||
Patch087: gdb-rhbz795424-bitpos-25of25.patch
|
||||
|
||||
# Fix `GDB cannot access struct member whose offset is larger than 256MB'
|
||||
# (RH BZ 795424).
|
||||
#=push
|
||||
Patch088: gdb-rhbz795424-bitpos-25of25-test.patch
|
||||
|
||||
# Fix `GDB cannot access struct member whose offset is larger than 256MB'
|
||||
# (RH BZ 795424).
|
||||
#=push
|
||||
Patch089: gdb-rhbz795424-bitpos-lazyvalue.patch
|
||||
|
||||
# Import regression test for `gdb/findvar.c:417: internal-error:
|
||||
# read_var_value: Assertion `frame' failed.' (RH BZ 947564) from RHEL 6.5.
|
||||
#=fedoratest
|
||||
Patch090: gdb-rhbz947564-findvar-assertion-frame-failed-testcase.patch
|
||||
|
||||
# Fix crash of -readnow /usr/lib/debug/usr/bin/gnatbind.debug (BZ 1069211).
|
||||
#=push+jan
|
||||
Patch091: gdb-gnat-dwarf-crash-3of3.patch
|
||||
|
||||
# Fix 'memory leak in infpy_read_memory()' (RH BZ 1007614)
|
||||
#=fedoratest
|
||||
Patch092: gdb-rhbz1007614-memleak-infpy_read_memory-test.patch
|
||||
|
||||
# Fix 'gdb gives highly misleading error when debuginfo pkg is present,
|
||||
# but not corresponding binary pkg' (RH BZ 981154).
|
||||
#=push+jan
|
||||
Patch093: gdb-6.6-buildid-locate-misleading-warning-missing-debuginfo-rhbz981154.patch
|
||||
|
||||
#=fedoratest
|
||||
Patch094: gdb-archer-vla-tests.patch
|
||||
|
||||
#=fedoratest
|
||||
Patch095: gdb-vla-intel-tests.patch
|
||||
|
||||
# Continue backtrace even if a frame filter throws an exception (Phil Muldoon).
|
||||
#=push
|
||||
Patch096: gdb-btrobust.patch
|
||||
|
||||
# Display Fortran strings in backtraces.
|
||||
#=fedoratest
|
||||
Patch097: gdb-fortran-frame-string.patch
|
||||
|
||||
# Fix Python GIL with gdb.execute("continue") (Phil Muldoon, BZ 1116957).
|
||||
#=push
|
||||
Patch098: gdb-python-gil.patch
|
||||
|
||||
# Testcase for '[SAP] Recursive dlopen causes SAP HANA installer to
|
||||
# crash.' (RH BZ 1156192).
|
||||
#=fedoratest
|
||||
Patch099: gdb-rhbz1156192-recursive-dlopen-test.patch
|
||||
|
||||
# Fix jit-reader.h for multi-lib.
|
||||
#=push+jan
|
||||
Patch100: gdb-jit-reader-multilib.patch
|
||||
|
||||
# Fix '`catch syscall' doesn't work for parent after `fork' is called'
|
||||
# (Philippe Waroquiers, RH BZ 1149205).
|
||||
#=fedoratest
|
||||
Patch101: gdb-rhbz1149205-catch-syscall-after-fork-test.patch
|
||||
|
||||
# Fix 'backport GDB 7.4 fix to RHEL 6.6 GDB' [Original Sourceware bug
|
||||
# description: 'C++ (and objc): Internal error on unqualified name
|
||||
# re-set', PR 11657] (RH BZ 1186476).
|
||||
#=fedoratest
|
||||
Patch102: gdb-rhbz1186476-internal-error-unqualified-name-re-set-test.patch
|
||||
|
||||
# Test 'info type-printers' Python error (RH BZ 1350436).
|
||||
#=fedoratest
|
||||
Patch103: gdb-rhbz1350436-type-printers-error.patch
|
||||
|
||||
# Fix '[ppc64] and [s390x] wrong prologue skip on -O2 -g code' (Jan
|
||||
# Kratochvil, RH BZ 1084404).
|
||||
#=fedoratest
|
||||
Patch104: gdb-rhbz1084404-ppc64-s390x-wrong-prologue-skip-O2-g-3of3.patch
|
||||
|
||||
# Never kill PID on: gdb exec PID (Jan Kratochvil, RH BZ 1219747).
|
||||
#=push+jan
|
||||
Patch105: gdb-bz1219747-attach-kills.patch
|
||||
|
||||
# Force libncursesw over libncurses to match the includes (RH BZ 1270534).
|
||||
#=push+jan
|
||||
Patch106: gdb-fedora-libncursesw.patch
|
||||
|
||||
# Test clflushopt instruction decode (for RH BZ 1262471).
|
||||
#=fedoratest
|
||||
Patch107: gdb-opcodes-clflushopt-test.patch
|
||||
|
||||
# [rhel6] DTS backward Python compatibility API (BZ 1020004, Phil Muldoon).
|
||||
#=fedora
|
||||
Patch108: gdb-dts-rhel6-python-compat.patch
|
||||
|
||||
# [SCL] Skip deprecated .gdb_index warning for Red Hat built files (BZ 953585).
|
||||
#=push+jan
|
||||
Patch109: gdb-6.6-buildid-locate-rpm-scl.patch
|
||||
|
||||
# Work around readline-6.2 incompatibility not asking for --more-- (BZ 701131).
|
||||
#=fedora
|
||||
Patch110: gdb-readline62-ask-more-rh.patch
|
||||
|
||||
# Make the GDB quit processing non-abortable to cleanup everything properly.
|
||||
#=fedora: It was useful only after gdb-6.8-attach-signalled-detach-stopped.patch .
|
||||
Patch111: gdb-6.8-quit-never-aborts.patch
|
||||
|
||||
# [aarch64] Fix hardware watchpoints (RH BZ 1261564).
|
||||
#=fedoratest
|
||||
Patch112: gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch
|
||||
|
||||
# Add messages suggesting more recent RHEL gdbserver (RH BZ 1321114).
|
||||
#=fedora
|
||||
Patch113: gdb-container-rh-pkg.patch
|
||||
|
||||
# New test for Python "Cannot locate object file for block" (for RH BZ 1325795).
|
||||
#=fedoratest
|
||||
Patch114: gdb-rhbz1325795-framefilters-test.patch
|
||||
|
||||
# [dts+el7] [x86*] Bundle linux_perf.h for libipt (RH BZ 1256513).
|
||||
#=fedora
|
||||
Patch115: gdb-linux_perf-bundle.patch
|
||||
|
||||
# Fix gdb-headless /usr/bin/ executables (BZ 1390251).
|
||||
#=fedora
|
||||
Patch116: gdb-libexec-add-index.patch
|
||||
|
||||
# New testcase for: Fix <tab>-completion crash (Gary Benson, RH BZ 1398387).
|
||||
#=fedoratest
|
||||
Patch117: gdb-rhbz1398387-tab-crash-test.patch
|
||||
|
||||
# [testsuite] Fix false selftest.exp FAIL from system readline-6.3+ (Patrick Palka).
|
||||
#=fedoratest
|
||||
Patch118: gdb-testsuite-readline63-sigint.patch
|
||||
|
||||
# Python patches of: http://sourceware.org/gdb/wiki/ProjectArcher
|
||||
#=push
|
||||
Patch119: gdb-archer.patch
|
||||
|
||||
# Revert upstream commit 469412dd9ccc4de5874fd3299b105833f36b34cd
|
||||
Patch120: gdb-vla-intel-fix-print-char-array.patch
|
||||
|
||||
# [s390x] Backport arch12 instructions decoding (RH BZ 1553104).
|
||||
# =fedoratest
|
||||
Patch121: gdb-rhbz1553104-s390x-arch12-test.patch
|
||||
|
||||
# Implement IPv6 support for GDB/gdbserver (RH BZ 881849, Sergio Durigan Junior).
|
||||
Patch122: gdb-rhbz881849-ipv6-1of3.patch
|
||||
|
||||
|
||||
Patch123: gdb-rhbz881849-ipv6-2of3.patch
|
||||
|
||||
|
||||
Patch124: gdb-rhbz881849-ipv6-3of3.patch
|
||||
|
||||
# Add GDB support to access/display POWER8 registers (IBM, RH BZ 1187581).
|
||||
Patch125: gdb-rhbz1187581-power8-regs-1of7.patch
|
||||
|
||||
# Add GDB support to access/display POWER8 registers (IBM, RH BZ 1187581).
|
||||
Patch126: gdb-rhbz1187581-power8-regs-2of7.patch
|
||||
|
||||
# Add GDB support to access/display POWER8 registers (IBM, RH BZ 1187581).
|
||||
Patch127: gdb-rhbz1187581-power8-regs-3of7.patch
|
||||
|
||||
# Add GDB support to access/display POWER8 registers (IBM, RH BZ 1187581).
|
||||
Patch128: gdb-rhbz1187581-power8-regs-4of7.patch
|
||||
|
||||
# Add GDB support to access/display POWER8 registers (IBM, RH BZ 1187581).
|
||||
Patch129: gdb-rhbz1187581-power8-regs-5of7.patch
|
||||
|
||||
# Add GDB support to access/display POWER8 registers (IBM, RH BZ 1187581).
|
||||
Patch130: gdb-rhbz1187581-power8-regs-6of7.patch
|
||||
|
||||
# Add GDB support to access/display POWER8 registers (IBM, RH BZ 1187581).
|
||||
Patch131: gdb-rhbz1187581-power8-regs-7of7.patch
|
||||
|
||||
# Fix for 'gdb in batch mode always exit with status 0' (Gary Benson)
|
||||
# RHBZ #1491128
|
||||
Patch132: gdb-rhbz1491128-batch-mode-exit-status-1of2.patch
|
||||
|
||||
# Fix for 'gdb in batch mode always exit with status 0' (Gary Benson)
|
||||
# RHBZ #1491128
|
||||
Patch133: gdb-rhbz1491128-batch-mode-exit-status-2of2.patch
|
||||
|
||||
# Use pulongest in aarch64-linux-tdep.c.
|
||||
# This patch was forgotten during the 8.2 release process, and is
|
||||
# needed to unbreak GDB when compiling on 32-bit arches.
|
||||
Patch134: gdb-use-pulongest-aarch64-linux-tdep.patch
|
||||
|
||||
# Fix for 'GDB crashes when running from a deleted directory'
|
||||
# (Tom Tromey, RHBZ#1653410)
|
||||
Patch135: gdb-rhbz1653410-avoid-crash-when-calling-warning-too-early.patch
|
||||
|
||||
# Fix for 'py-bt is broken, results in exception'.
|
||||
# RHBZ 1639242
|
||||
Patch136: gdb-rhbz1639242-fix-dwarf2_find_containing_comp_unit-binary-search.patch
|
||||
|
||||
# Fix 'Assertion `SYMBOL_LANGUAGE (sym) == DICT_LANGUAGE (dict)->la_language' failed.'
|
||||
# Keith Seitz, RHBZ#1560010.
|
||||
Patch137: gdb-rhbz1560010-fix-assertion-symbol-language-dict-language-1of5.patch
|
||||
|
||||
# Fix 'Assertion `SYMBOL_LANGUAGE (sym) == DICT_LANGUAGE (dict)->la_language' failed.'
|
||||
# Keith Seitz, RHBZ#1560010.
|
||||
Patch138: gdb-rhbz1560010-fix-assertion-symbol-language-dict-language-2of5.patch
|
||||
|
||||
# Fix 'Assertion `SYMBOL_LANGUAGE (sym) == DICT_LANGUAGE (dict)->la_language' failed.'
|
||||
# Keith Seitz, RHBZ#1560010.
|
||||
Patch139: gdb-rhbz1560010-fix-assertion-symbol-language-dict-language-3of5.patch
|
||||
|
||||
# Fix 'Assertion `SYMBOL_LANGUAGE (sym) == DICT_LANGUAGE (dict)->la_language' failed.'
|
||||
# Keith Seitz, RHBZ#1560010.
|
||||
Patch140: gdb-rhbz1560010-fix-assertion-symbol-language-dict-language-4of5.patch
|
||||
|
||||
# Fix 'Assertion `SYMBOL_LANGUAGE (sym) == DICT_LANGUAGE (dict)->la_language' failed.'
|
||||
# Keith Seitz, RHBZ#1560010.
|
||||
Patch141: gdb-rhbz1560010-fix-assertion-symbol-language-dict-language-5of5.patch
|
||||
|
||||
# Fix 'gdb suggests using "dnf debuginfo-install'
|
||||
# Keith Seitz, RHBZ 1666249
|
||||
Patch142: gdb-rhbz1666249-suggest-yum-instead-of-dnf.patch
|
||||
|
||||
# Fix 'libiberty: Memory leak in demangle_template function resulting in a denial of service"
|
||||
# Simon Marchi, RH BZ 1668635
|
||||
Patch143: gdb-rhbz1668635-libiberty-demangle_template-memleak.patch
|
||||
|
||||
# Fix 'gdb fails to read zN registers from corefile with aarch64 SVE'
|
||||
# Alan Hayward, RH BZ 1669953
|
||||
Patch144: gdb-rhbz1669953-aarch64-sve-binutils.patch
|
||||
|
||||
# Fix remote.c build failure
|
||||
# Szabolcs Nagy, RH BZ 1187581
|
||||
Patch145: gdb-rhbz1187581-power8-regs-not-in-8.2-01of15.patch
|
||||
|
||||
# Add grok/write functions for new ppc core note sections
|
||||
# Edjunior Barbosa Machado, RH BZ 1187581
|
||||
Patch146: gdb-rhbz1187581-power8-regs-not-in-8.2-02of15.patch
|
||||
|
||||
# Zero-initialize linux note sections
|
||||
# Pedro Franco de Carvalho, RH BZ 1187581
|
||||
Patch147: gdb-rhbz1187581-power8-regs-not-in-8.2-03of15.patch
|
||||
|
||||
# [PowerPC] Don't zero-initialize vector register buffers
|
||||
# Pedro Franco de Carvalho, RH BZ 1187581
|
||||
Patch148: gdb-rhbz1187581-power8-regs-not-in-8.2-04of15.patch
|
||||
|
||||
# Add decfloat registers to float reggroup
|
||||
# Pedro Franco de Carvalho, RH BZ 1187581
|
||||
Patch149: gdb-rhbz1187581-power8-regs-not-in-8.2-05of15.patch
|
||||
|
||||
# [PowerPC] Remove rs6000_pseudo_register_reggroup_p
|
||||
# Pedro Franco de Carvalho, RH BZ 1187581
|
||||
Patch150: gdb-rhbz1187581-power8-regs-not-in-8.2-06of15.patch
|
||||
|
||||
# [PowerPC] Fix two if statements in gdb/ppc-linux-nat.c
|
||||
# Pedro Franco de Carvalho, RH BZ 1187581
|
||||
Patch151: gdb-rhbz1187581-power8-regs-not-in-8.2-07of15.patch
|
||||
|
||||
# [PowerPC] Fix indentation in arch/ppc-linux-common.c
|
||||
# Pedro Franco de Carvalho, RH BZ 1187581
|
||||
Patch152: gdb-rhbz1187581-power8-regs-not-in-8.2-08of15.patch
|
||||
|
||||
# [PowerPC] Refactor have_ initializers in rs6000-tdep.c
|
||||
# Pedro Franco de Carvalho, RH BZ 1187581
|
||||
Patch153: gdb-rhbz1187581-power8-regs-not-in-8.2-09of15.patch
|
||||
|
||||
# [PowerPC] Add support for PPR and DSCR
|
||||
# Edjunior Barbosa Machado and Pedro Franco de Carvalho, RH BZ 1187581
|
||||
Patch154: gdb-rhbz1187581-power8-regs-not-in-8.2-10of15.patch
|
||||
|
||||
# [PowerPC] Add support for TAR
|
||||
# Edjunior Barbosa Machado and Pedro Franco de Carvalho, RH BZ 1187581
|
||||
Patch155: gdb-rhbz1187581-power8-regs-not-in-8.2-11of15.patch
|
||||
|
||||
# [PowerPC] Add support for EBB and PMU registers
|
||||
# Edjunior Barbosa Machado and Pedro Franco de Carvalho, RH BZ 1187581m
|
||||
Patch156: gdb-rhbz1187581-power8-regs-not-in-8.2-12of15.patch
|
||||
|
||||
# [PowerPC] Reject tdescs with VSX and no FPU or Altivec
|
||||
# Pedro Franco de Carvalho, RH BZ 1187581
|
||||
Patch157: gdb-rhbz1187581-power8-regs-not-in-8.2-13of15.patch
|
||||
|
||||
# [PowerPC] Add support for HTM registers
|
||||
# Edjunior Barbosa Machado and Pedro Franco de Carvalho, RH BZ 1187581
|
||||
Patch158: gdb-rhbz1187581-power8-regs-not-in-8.2-14of15.patch
|
||||
|
||||
# [PowerPC] Document requirements for VSX feature
|
||||
# Pedro Franco de Carvalho, RH BZ 1187581
|
||||
Patch159: gdb-rhbz1187581-power8-regs-not-in-8.2-15of15.patch
|
||||
|
159
SOURCES/_gdb.spec.patch.include
Normal file
159
SOURCES/_gdb.spec.patch.include
Normal file
@ -0,0 +1,159 @@
|
||||
%patch001 -p1
|
||||
%patch002 -p1
|
||||
%patch003 -p1
|
||||
%patch004 -p1
|
||||
%patch005 -p1
|
||||
%patch006 -p1
|
||||
%patch007 -p1
|
||||
%patch008 -p1
|
||||
%patch009 -p1
|
||||
%patch010 -p1
|
||||
%patch011 -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
|
||||
%patch027 -p1
|
||||
%patch028 -p1
|
||||
%patch029 -p1
|
||||
%patch030 -p1
|
||||
%patch031 -p1
|
||||
%patch032 -p1
|
||||
%patch033 -p1
|
||||
%patch034 -p1
|
||||
%patch035 -p1
|
||||
%patch036 -p1
|
||||
%patch037 -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
|
||||
%patch098 -p1
|
||||
%patch099 -p1
|
||||
%patch100 -p1
|
||||
%patch101 -p1
|
||||
%patch102 -p1
|
||||
%patch103 -p1
|
||||
%patch104 -p1
|
||||
%patch105 -p1
|
||||
%patch106 -p1
|
||||
%patch107 -p1
|
||||
%patch108 -p1
|
||||
%patch109 -p1
|
||||
%patch110 -p1
|
||||
%patch111 -p1
|
||||
%patch112 -p1
|
||||
%patch113 -p1
|
||||
%patch114 -p1
|
||||
%patch115 -p1
|
||||
%patch116 -p1
|
||||
%patch117 -p1
|
||||
%patch118 -p1
|
||||
%patch119 -p1
|
||||
%patch120 -p1
|
||||
%patch121 -p1
|
||||
%patch122 -p1
|
||||
%patch123 -p1
|
||||
%patch124 -p1
|
||||
%patch125 -p1
|
||||
%patch126 -p1
|
||||
%patch127 -p1
|
||||
%patch128 -p1
|
||||
%patch129 -p1
|
||||
%patch130 -p1
|
||||
%patch131 -p1
|
||||
%patch132 -p1
|
||||
%patch133 -p1
|
||||
%patch134 -p1
|
||||
%patch135 -p1
|
||||
%patch136 -p1
|
||||
%patch137 -p1
|
||||
%patch138 -p1
|
||||
%patch139 -p1
|
||||
%patch140 -p1
|
||||
%patch141 -p1
|
||||
%patch142 -p1
|
||||
%patch143 -p1
|
||||
%patch144 -p1
|
||||
%patch145 -p1
|
||||
%patch146 -p1
|
||||
%patch147 -p1
|
||||
%patch148 -p1
|
||||
%patch149 -p1
|
||||
%patch150 -p1
|
||||
%patch151 -p1
|
||||
%patch152 -p1
|
||||
%patch153 -p1
|
||||
%patch154 -p1
|
||||
%patch155 -p1
|
||||
%patch156 -p1
|
||||
%patch157 -p1
|
||||
%patch158 -p1
|
||||
%patch159 -p1
|
115
SOURCES/gdb-6.3-attach-see-vdso-test.patch
Normal file
115
SOURCES/gdb-6.3-attach-see-vdso-test.patch
Normal file
@ -0,0 +1,115 @@
|
||||
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
|
||||
@@ -0,0 +1,25 @@
|
||||
+/* 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 <unistd.h>
|
||||
+
|
||||
+int main ()
|
||||
+{
|
||||
+ 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 @@
|
||||
+# Copyright 2007
|
||||
+
|
||||
+# 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.
|
||||
+
|
||||
+# This file was created by Jan Kratochvil <jan.kratochvil@redhat.com>.
|
||||
+
|
||||
+# This test only works on Linux
|
||||
+if { ![istarget "*-*-linux-gnu*"] } {
|
||||
+ return 0
|
||||
+}
|
||||
+
|
||||
+set testfile "attach-see-vdso"
|
||||
+set srcfile ${testfile}.c
|
||||
+set binfile [standard_output_file ${testfile}]
|
||||
+set escapedbinfile [string_to_regexp [standard_output_file ${testfile}]]
|
||||
+
|
||||
+# The kernel VDSO is used for the syscalls returns only on i386 (not x86_64).
|
||||
+#
|
||||
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-m32}] != "" } {
|
||||
+ gdb_suppress_entire_file "Testcase nonthraded compile failed, so all tests in this file will automatically fail."
|
||||
+}
|
||||
+
|
||||
+if [get_compiler_info ${binfile}] {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+# Start the program running and then wait for a bit, to be sure
|
||||
+# that it can be attached to.
|
||||
+
|
||||
+set testpid [eval exec $binfile &]
|
||||
+
|
||||
+# Avoid some race:
|
||||
+sleep 2
|
||||
+
|
||||
+# Start with clean gdb
|
||||
+gdb_exit
|
||||
+gdb_start
|
||||
+gdb_reinitialize_dir $srcdir/$subdir
|
||||
+# Never call: gdb_load ${binfile}
|
||||
+# as the former problem would not reproduce otherwise.
|
||||
+
|
||||
+set test "attach"
|
||||
+gdb_test_multiple "attach $testpid" "$test" {
|
||||
+ -re "Attaching to process $testpid\r?\n.*$gdb_prompt $" {
|
||||
+ pass "$test"
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+gdb_test "bt" "#0 *0x\[0-9a-f\]* in \[^?\].*" "backtrace decodes VDSO"
|
||||
+
|
||||
+# Exit and detach the process.
|
||||
+
|
||||
+gdb_exit
|
||||
+
|
||||
+# Make sure we don't leave a process around to confuse
|
||||
+# the next test run (and prevent the compile by keeping
|
||||
+# the text file busy), in case the "set should_exit" didn't
|
||||
+# work.
|
||||
+
|
||||
+remote_exec build "kill -9 ${testpid}"
|
320
SOURCES/gdb-6.3-bz140532-ppc-unwinding-test.patch
Normal file
320
SOURCES/gdb-6.3-bz140532-ppc-unwinding-test.patch
Normal file
@ -0,0 +1,320 @@
|
||||
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
|
||||
@@ -0,0 +1,78 @@
|
||||
+/* 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. */
|
||||
+
|
||||
+ .section ".text"
|
||||
+ .align 2
|
||||
+ .globl func0
|
||||
+ .type func0, @function
|
||||
+func0:
|
||||
+ stwu 1,-16(1)
|
||||
+ mflr 0
|
||||
+ stw 31,12(1)
|
||||
+ stw 0,20(1)
|
||||
+ mr 31,1
|
||||
+ bl abort
|
||||
+ .size func0, .-func0
|
||||
+ .align 2
|
||||
+ .globl func1
|
||||
+ .type func1, @function
|
||||
+func1:
|
||||
+ stwu 1,-16(1)
|
||||
+ mflr 0
|
||||
+/* 20 = BO = branch always
|
||||
+ 31 = BI = CR bit (ignored) */
|
||||
+ bcl 20,31,.Lpie
|
||||
+.Lpie: stw 31,12(1)
|
||||
+ stw 0,20(1)
|
||||
+ mr 31,1
|
||||
+ bl func0
|
||||
+ mr 0,3
|
||||
+ lis 9,var@ha
|
||||
+ lwz 9,var@l(9)
|
||||
+ add 0,0,9
|
||||
+ mr 3,0
|
||||
+ lwz 11,0(1)
|
||||
+ lwz 0,4(11)
|
||||
+ mtlr 0
|
||||
+ lwz 31,-4(11)
|
||||
+ mr 1,11
|
||||
+ blr
|
||||
+ .size func1, .-func1
|
||||
+ .section .note.GNU-stack,"",@progbits
|
||||
+ .ident "GCC: (GNU) 3.4.6 20060404 (Red Hat 3.4.6-8)"
|
||||
+
|
||||
+/* Original source file:
|
||||
+
|
||||
+#include <stdlib.h>
|
||||
+
|
||||
+extern volatile int var;
|
||||
+
|
||||
+int func0 (void) __attribute__((__noinline__));
|
||||
+int func0 (void)
|
||||
+{
|
||||
+ abort ();
|
||||
+ return var;
|
||||
+}
|
||||
+
|
||||
+int func1 (void) __attribute__((__noinline__));
|
||||
+int func1 (void)
|
||||
+{
|
||||
+ return func0 () + var;
|
||||
+}
|
||||
+
|
||||
+*/
|
||||
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
|
||||
@@ -0,0 +1,98 @@
|
||||
+/* 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. */
|
||||
+
|
||||
+ .section ".toc","aw"
|
||||
+ .section ".text"
|
||||
+ .align 2
|
||||
+ .globl func0
|
||||
+ .section ".opd","aw"
|
||||
+ .align 3
|
||||
+func0:
|
||||
+ .quad .L.func0,.TOC.@tocbase
|
||||
+ .previous
|
||||
+ .type func0, @function
|
||||
+.L.func0:
|
||||
+ mflr 0
|
||||
+ std 31,-8(1)
|
||||
+ std 0,16(1)
|
||||
+ stdu 1,-128(1)
|
||||
+ mr 31,1
|
||||
+ bl abort
|
||||
+ nop
|
||||
+ .long 0
|
||||
+ .byte 0,0,0,1,128,1,0,1
|
||||
+ .size func0,.-.L.func0
|
||||
+ .section ".toc","aw"
|
||||
+.LC1:
|
||||
+ .tc var[TC],var
|
||||
+ .section ".text"
|
||||
+ .align 2
|
||||
+ .globl func1
|
||||
+ .section ".opd","aw"
|
||||
+ .align 3
|
||||
+func1:
|
||||
+ .quad .L.func1,.TOC.@tocbase
|
||||
+ .previous
|
||||
+ .type func1, @function
|
||||
+.L.func1:
|
||||
+ mflr 0
|
||||
+/* 20 = BO = branch always
|
||||
+ 31 = BI = CR bit (ignored) */
|
||||
+ bcl 20,31,.Lpie
|
||||
+.Lpie: std 31,-8(1)
|
||||
+ std 0,16(1)
|
||||
+ stdu 1,-128(1)
|
||||
+ mr 31,1
|
||||
+ bl func0
|
||||
+ mr 11,3
|
||||
+ ld 9,.LC1@toc(2)
|
||||
+ lwz 0,0(9)
|
||||
+ add 0,11,0
|
||||
+ extsw 0,0
|
||||
+ mr 3,0
|
||||
+ ld 1,0(1)
|
||||
+ ld 0,16(1)
|
||||
+ mtlr 0
|
||||
+ ld 31,-8(1)
|
||||
+ blr
|
||||
+ .long 0
|
||||
+ .byte 0,0,0,1,128,1,0,1
|
||||
+ .size func1,.-.L.func1
|
||||
+ .section .note.GNU-stack,"",@progbits
|
||||
+ .ident "GCC: (GNU) 3.4.6 20060404 (Red Hat 3.4.6-8)"
|
||||
+
|
||||
+/* Original source file:
|
||||
+
|
||||
+#include <stdlib.h>
|
||||
+
|
||||
+extern volatile int var;
|
||||
+
|
||||
+int func0 (void) __attribute__((__noinline__));
|
||||
+int func0 (void)
|
||||
+{
|
||||
+ abort ();
|
||||
+ return var;
|
||||
+}
|
||||
+
|
||||
+int func1 (void) __attribute__((__noinline__));
|
||||
+int func1 (void)
|
||||
+{
|
||||
+ return func0 () + var;
|
||||
+}
|
||||
+
|
||||
+*/
|
||||
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
|
||||
@@ -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. */
|
||||
+
|
||||
+/* Force `-fpie' double jump bl->blrl. */
|
||||
+/* No longer used. */
|
||||
+volatile int var;
|
||||
+
|
||||
+extern int func1 (void);
|
||||
+
|
||||
+int main (void)
|
||||
+{
|
||||
+ 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 @@
|
||||
+# Copyright 2006, 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.
|
||||
+
|
||||
+# Test unwinding fixes of the PPC platform, specifically on the coping with BCL
|
||||
+# jump of the PIE code.
|
||||
+
|
||||
+if ![istarget "powerpc*-*-linux*"] then {
|
||||
+ verbose "Skipping powerpc-linux prologue tests."
|
||||
+ return
|
||||
+}
|
||||
+
|
||||
+set testfile "powerpc-bcl-prologue"
|
||||
+set srcfile1 ${testfile}.c
|
||||
+set flags "debug"
|
||||
+if [istarget "powerpc-*"] then {
|
||||
+ set srcfile2 ${testfile}-asm32.S
|
||||
+ set flags "$flags additional_flags=-m32"
|
||||
+} elseif [istarget "powerpc64-*"] then {
|
||||
+ set srcfile2 ${testfile}-asm64.S
|
||||
+ set flags "$flags additional_flags=-m64"
|
||||
+} else {
|
||||
+ fail "powerpc arch test"
|
||||
+ return
|
||||
+}
|
||||
+set objfile2 [standard_output_file ${testfile}-asm.o]
|
||||
+set binfile [standard_output_file ${testfile}]
|
||||
+
|
||||
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile1} ${srcdir}/${subdir}/${srcfile2}" ${binfile} executable $flags] != ""} {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+gdb_exit
|
||||
+gdb_start
|
||||
+gdb_reinitialize_dir $srcdir/$subdir
|
||||
+gdb_load ${binfile}
|
||||
+
|
||||
+# We should stop in abort(3).
|
||||
+
|
||||
+gdb_run_cmd
|
||||
+
|
||||
+gdb_test_multiple {} "continue to abort()" {
|
||||
+ -re ".*Program received signal SIGABRT,.*$gdb_prompt $" {
|
||||
+ pass "continue to abort()"
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+# Check backtrace:
|
||||
+# #3 0x0804835f in func0 ()
|
||||
+# #4 0x0804836a in func1 ()
|
||||
+# #5 0x0804838c in main ()
|
||||
+# (gdb)
|
||||
+# `\\.?' prefixes are needed for ppc64 without `debug' (another bug).
|
||||
+
|
||||
+set test "matching unwind"
|
||||
+gdb_test_multiple "backtrace" $test {
|
||||
+ -re "\r\n#\[0-9\]\[^\r\n\]* in \\.?func0 \\(\[^\r\n\]*\r\n#\[0-9\]\[^\r\n\]* in \\.?func1 \\(\[^\r\n\]*\r\n#\[0-9\]\[^\r\n\]* in \\.?main \\(\[^\r\n\]*\r\n$gdb_prompt $" {
|
||||
+ 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
|
||||
}
|
109
SOURCES/gdb-6.3-bz202689-exec-from-pthread-test.patch
Normal file
109
SOURCES/gdb-6.3-bz202689-exec-from-pthread-test.patch
Normal file
@ -0,0 +1,109 @@
|
||||
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
|
||||
@@ -0,0 +1,46 @@
|
||||
+/* 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 <stddef.h>
|
||||
+#include <pthread.h>
|
||||
+#include <assert.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <unistd.h>
|
||||
+
|
||||
+
|
||||
+static void *
|
||||
+threader (void *arg)
|
||||
+{
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+main (void)
|
||||
+{
|
||||
+ pthread_t t1;
|
||||
+ int i;
|
||||
+
|
||||
+ i = pthread_create (&t1, NULL, threader, (void *) NULL);
|
||||
+ assert (i == 0);
|
||||
+ i = pthread_join (t1, NULL);
|
||||
+ assert (i == 0);
|
||||
+
|
||||
+ 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
|
||||
@@ -0,0 +1,41 @@
|
||||
+# threaded-exec.exp -- Check reset of the tracked threads on exec*(2)
|
||||
+# Copyright (C) 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
|
||||
+
|
||||
+set testfile threaded-exec
|
||||
+set srcfile ${testfile}.c
|
||||
+set binfile [standard_output_file ${testfile}]
|
||||
+
|
||||
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable []] != "" } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+gdb_exit
|
||||
+gdb_start
|
||||
+gdb_reinitialize_dir $srcdir/$subdir
|
||||
+
|
||||
+gdb_load ${binfile}
|
||||
+
|
||||
+gdb_run_cmd
|
||||
+
|
||||
+gdb_test_multiple {} "Program exited" {
|
||||
+ -re "\r\n\\\[Inferior .* exited normally\\\]\r\n$gdb_prompt $" {
|
||||
+ pass "Program exited"
|
||||
+ }
|
||||
+}
|
53
SOURCES/gdb-6.3-focus-cmd-prev-test.patch
Normal file
53
SOURCES/gdb-6.3-focus-cmd-prev-test.patch
Normal file
@ -0,0 +1,53 @@
|
||||
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
|
||||
+ }
|
||||
+}
|
240
SOURCES/gdb-6.3-gstack-20050411.patch
Normal file
240
SOURCES/gdb-6.3-gstack-20050411.patch
Normal file
@ -0,0 +1,240 @@
|
||||
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
|
||||
@@ -1735,7 +1735,7 @@ info install-info clean-info dvi pdf install-pdf html install-html: force
|
||||
install: all
|
||||
@$(MAKE) $(FLAGS_TO_PASS) 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 \
|
||||
@@ -1784,7 +1784,25 @@ install-guile:
|
||||
install-python:
|
||||
$(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(GDB_DATADIR)/python/gdb
|
||||
|
||||
-uninstall: force $(CONFIG_UNINSTALL)
|
||||
+GSTACK=gstack
|
||||
+.PHONY: install-gstack
|
||||
+install-gstack:
|
||||
+ transformed_name=`t='$(program_transform_name)'; \
|
||||
+ echo $(GSTACK) | sed -e "$$t"` ; \
|
||||
+ if test "x$$transformed_name" = x; then \
|
||||
+ transformed_name=$(GSTACK) ; \
|
||||
+ else \
|
||||
+ true ; \
|
||||
+ fi ; \
|
||||
+ $(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(bindir) ; \
|
||||
+ $(INSTALL_PROGRAM) $(srcdir)/$(GSTACK).sh \
|
||||
+ $(DESTDIR)$(bindir)/$$transformed_name$(EXEEXT) ; \
|
||||
+ : $(SHELL) $(srcdir)/../mkinstalldirs \
|
||||
+ $(DESTDIR)$(man1dir) ; \
|
||||
+ : $(INSTALL_DATA) $(srcdir)/gstack.1 \
|
||||
+ $(DESTDIR)$(man1dir)/$$transformed_name.1
|
||||
+
|
||||
+uninstall: force uninstall-gstack $(CONFIG_UNINSTALL)
|
||||
transformed_name=`t='$(program_transform_name)'; \
|
||||
echo gdb | sed -e $$t` ; \
|
||||
if test "x$$transformed_name" = x; then \
|
||||
@@ -1807,6 +1825,18 @@ uninstall: force $(CONFIG_UNINSTALL)
|
||||
fi
|
||||
@$(MAKE) DO=uninstall "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do
|
||||
|
||||
+.PHONY: uninstall-gstack
|
||||
+uninstall-gstack:
|
||||
+ transformed_name=`t='$(program_transform_name)'; \
|
||||
+ echo $(GSTACK) | sed -e $$t` ; \
|
||||
+ if test "x$$transformed_name" = x; then \
|
||||
+ transformed_name=$(GSTACK) ; \
|
||||
+ else \
|
||||
+ true ; \
|
||||
+ 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 @@
|
||||
+#!/bin/sh
|
||||
+
|
||||
+if test $# -ne 1; then
|
||||
+ echo "Usage: `basename $0 .sh` <process-id>" 1>&2
|
||||
+ exit 1
|
||||
+fi
|
||||
+
|
||||
+if test ! -r /proc/$1; then
|
||||
+ echo "Process $1 not found." 1>&2
|
||||
+ exit 1
|
||||
+fi
|
||||
+
|
||||
+# GDB doesn't allow "thread apply all bt" when the process isn't
|
||||
+# threaded; need to peek at the process to determine if that or the
|
||||
+# simpler "bt" should be used.
|
||||
+
|
||||
+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
|
||||
+ 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
|
||||
+ backtrace="thread apply all bt"
|
||||
+ fi
|
||||
+fi
|
||||
+
|
||||
+GDB=${GDB:-gdb}
|
||||
+
|
||||
+# 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
|
||||
+$backtrace
|
||||
+EOF
|
||||
+/bin/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,66 @@
|
||||
+# 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
|
||||
+}
|
||||
+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
|
||||
+ }
|
||||
+}
|
||||
+gdb_exit
|
||||
+
|
||||
+# 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 pid [exp_pid -i $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_exit
|
||||
+
|
||||
+remote_exec host "kill -9 $pid"
|
323
SOURCES/gdb-6.3-inferior-notification-20050721.patch
Normal file
323
SOURCES/gdb-6.3-inferior-notification-20050721.patch
Normal file
@ -0,0 +1,323 @@
|
||||
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
|
||||
mode on 64-bit systems.
|
||||
* gdb.base/attach-32.c: Ditto.
|
||||
* gdb.base/attach-32b.c: Ditto.
|
||||
|
||||
2007-12-26 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* 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
|
||||
@@ -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
|
||||
+ is exited when & if the variable 'should_exit' is non-zero. (It
|
||||
+ is initialized to zero in this program, so the loop will never
|
||||
+ exit unless/until gdb sets the variable to non-zero.)
|
||||
+ */
|
||||
+#include <stdio.h>
|
||||
+
|
||||
+int should_exit = 0;
|
||||
+
|
||||
+int main ()
|
||||
+{
|
||||
+ int local_i = 0;
|
||||
+
|
||||
+ while (! should_exit)
|
||||
+ {
|
||||
+ local_i++;
|
||||
+ }
|
||||
+ 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 @@
|
||||
+# 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.
|
||||
+#
|
||||
+# This test was based on attach.exp and modified for 32/64 bit Linux systems. */
|
||||
+
|
||||
+# 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
|
||||
+# test machine) with these processes. RT
|
||||
+#
|
||||
+# Setting the magic bit in the target app should work. I added a
|
||||
+# "kill", and also a test for the R3 register warning. JB
|
||||
+if { ![istarget "x86_64*-*linux*"]
|
||||
+ && ![istarget "powerpc64*-*linux*"]} {
|
||||
+ return 0
|
||||
+}
|
||||
+
|
||||
+# are we on a target board
|
||||
+if [is_remote target] then {
|
||||
+ return 0
|
||||
+}
|
||||
+
|
||||
+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}]]
|
||||
+
|
||||
+#execute_anywhere "rm -f ${binfile} ${binfile2}"
|
||||
+remote_exec build "rm -f ${binfile} ${binfile2}"
|
||||
+# For debugging this test
|
||||
+#
|
||||
+#log_user 1
|
||||
+
|
||||
+# build the first test case
|
||||
+#
|
||||
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug "additional_flags=-m32"]] != "" } {
|
||||
+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
|
||||
+}
|
||||
+
|
||||
+# Build the in-system-call test
|
||||
+
|
||||
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile2}" "${binfile2}" executable [list debug "additional_flags=-m32"]] != "" } {
|
||||
+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
|
||||
+}
|
||||
+
|
||||
+if [get_compiler_info ${binfile}] {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+proc do_attach_tests {} {
|
||||
+ global gdb_prompt
|
||||
+ global binfile
|
||||
+ global escapedbinfile
|
||||
+ global srcfile
|
||||
+ global testfile
|
||||
+ global objdir
|
||||
+ global subdir
|
||||
+ global timeout
|
||||
+ global testpid
|
||||
+
|
||||
+ # Verify that we can "see" the variable "should_exit" in the
|
||||
+ # program, and that it is zero.
|
||||
+
|
||||
+ gdb_test "print should_exit" " = 0" "after attach-32, print should_exit"
|
||||
+
|
||||
+ # Verify that we can modify the variable "should_exit" in the
|
||||
+ # program.
|
||||
+
|
||||
+ gdb_test "set should_exit=1" "" "after attach-32, set should_exit"
|
||||
+
|
||||
+ # Verify that the modification really happened.
|
||||
+
|
||||
+ send_gdb "tbreak 19\n"
|
||||
+ gdb_expect {
|
||||
+ -re "reakpoint .*at.*$srcfile, line 19.*$gdb_prompt $" {
|
||||
+ pass "after attach-32, set tbreak postloop"
|
||||
+ }
|
||||
+ -re "$gdb_prompt $" {
|
||||
+ fail "after attach-32, set tbreak postloop"
|
||||
+ }
|
||||
+ timeout {
|
||||
+ fail "(timeout) after attach-32, set tbreak postloop"
|
||||
+ }
|
||||
+ }
|
||||
+ send_gdb "continue\n"
|
||||
+ gdb_expect {
|
||||
+ -re "main.*at.*$srcfile:19.*$gdb_prompt $" {
|
||||
+ pass "after attach-32, reach tbreak postloop"
|
||||
+ }
|
||||
+ -re "$gdb_prompt $" {
|
||||
+ fail "after attach-32, reach tbreak postloop"
|
||||
+ }
|
||||
+ timeout {
|
||||
+ fail "(timeout) after attach-32, reach tbreak postloop"
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ # Allow the test process to exit, to cleanup after ourselves.
|
||||
+
|
||||
+ gdb_test "continue" {\[Inferior .* 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
|
||||
+ # the text file busy), in case the "set should_exit" didn't
|
||||
+ # work.
|
||||
+
|
||||
+ remote_exec build "kill -9 ${testpid}"
|
||||
+
|
||||
+ # Start the program running and then wait for a bit, to be sure
|
||||
+ # that it can be attached to.
|
||||
+
|
||||
+ set testpid [eval exec $binfile &]
|
||||
+ exec sleep 2
|
||||
+ if { [istarget "*-*-cygwin*"] } {
|
||||
+ # testpid is the Cygwin PID, GDB uses the Windows PID, which might be
|
||||
+ # different due to the way fork/exec works.
|
||||
+ set testpid [ exec ps -e | gawk "{ if (\$1 == $testpid) print \$4; }" ]
|
||||
+ }
|
||||
+
|
||||
+ # Verify that we can attach to the process, and find its a.out
|
||||
+ # when we're cd'd to some directory that doesn't contain the
|
||||
+ # a.out. (We use the source path set by the "dir" command.)
|
||||
+
|
||||
+ gdb_test "dir ${objdir}/${subdir}" "Source directories searched: .*" \
|
||||
+ "set source path"
|
||||
+
|
||||
+ gdb_test "cd /tmp" "Working directory /tmp." \
|
||||
+ "cd away from process working directory"
|
||||
+
|
||||
+ # Explicitly flush out any knowledge of the previous attachment.
|
||||
+
|
||||
+ set test "before attach-32-3, flush symbols"
|
||||
+ gdb_test_multiple "symbol" "$test" {
|
||||
+ -re "Discard symbol table from.*y or n. $" {
|
||||
+ gdb_test "y" "No symbol file now." \
|
||||
+ "$test"
|
||||
+ }
|
||||
+ -re "No symbol file now.*$gdb_prompt $" {
|
||||
+ pass "$test"
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ gdb_test "exec" "No executable file now." \
|
||||
+ "before attach-32-3, flush exec"
|
||||
+
|
||||
+ gdb_test "attach $testpid" \
|
||||
+ "Attaching to process $testpid.*Reading symbols from $escapedbinfile.*main.*at .*" \
|
||||
+ "attach-32 when process' a.out not in cwd"
|
||||
+
|
||||
+ set test "after attach-32-3, exit"
|
||||
+ gdb_test_multiple "kill" "$test" {
|
||||
+ -re "Kill the program being debugged.*y or n. $" {
|
||||
+ gdb_test "y" "" "$test"
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ # Another "don't leave a process around"
|
||||
+ remote_exec build "kill -9 ${testpid}"
|
||||
+}
|
||||
+
|
||||
+proc do_call_attach_tests {} {
|
||||
+ global gdb_prompt
|
||||
+ global binfile2
|
||||
+ global testpid
|
||||
+
|
||||
+ # See if other registers are problems
|
||||
+
|
||||
+ set test "info other register"
|
||||
+ gdb_test_multiple "i r r3" "$test" {
|
||||
+ -re "warning: reading register.*$gdb_prompt $" {
|
||||
+ fail "$test"
|
||||
+ }
|
||||
+ -re "r3.*$gdb_prompt $" {
|
||||
+ pass "$test"
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ # Get rid of the process
|
||||
+
|
||||
+ gdb_test "p should_exit = 1"
|
||||
+ gdb_test "c" {\[Inferior .* exited normally\]}
|
||||
+
|
||||
+ # Be paranoid
|
||||
+
|
||||
+ remote_exec build "kill -9 ${testpid}"
|
||||
+}
|
||||
+
|
||||
+
|
||||
+# Start with a fresh gdb
|
||||
+
|
||||
+gdb_exit
|
||||
+set testpid [eval exec $binfile &]
|
||||
+exec sleep 3
|
||||
+if { [istarget "*-*-cygwin*"] } {
|
||||
+ # testpid is the Cygwin PID, GDB uses the Windows PID, which might be
|
||||
+ # different due to the way fork/exec works.
|
||||
+ set testpid [ exec ps -e | gawk "{ if (\$1 == $testpid) print \$4; }" ]
|
||||
+}
|
||||
+
|
||||
+set GDBFLAGS_orig $GDBFLAGS
|
||||
+set GDBFLAGS "--pid=$testpid"
|
||||
+gdb_start
|
||||
+set GDBFLAGS $GDBFLAGS_orig
|
||||
+
|
||||
+gdb_reinitialize_dir $srcdir/$subdir
|
||||
+
|
||||
+# This is a test of gdb's ability to attach to a running process.
|
||||
+
|
||||
+do_attach_tests
|
||||
+
|
||||
+# Test attaching when the target is inside a system call
|
||||
+
|
||||
+gdb_exit
|
||||
+set testpid [eval exec $binfile2 &]
|
||||
+exec sleep 3
|
||||
+if { [istarget "*-*-cygwin*"] } {
|
||||
+ # testpid is the Cygwin PID, GDB uses the Windows PID, which might be
|
||||
+ # different due to the way fork/exec works.
|
||||
+ set testpid [ exec ps -e | gawk "{ if (\$1 == $testpid) print \$4; }" ]
|
||||
+}
|
||||
+
|
||||
+set GDBFLAGS_orig $GDBFLAGS
|
||||
+set GDBFLAGS "--pid=$testpid"
|
||||
+gdb_start
|
||||
+set GDBFLAGS $GDBFLAGS_orig
|
||||
+
|
||||
+gdb_reinitialize_dir $srcdir/$subdir
|
||||
+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
|
||||
@@ -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
|
||||
+ is exited when & if the variable 'should_exit' is non-zero. (It
|
||||
+ is initialized to zero in this program, so the loop will never
|
||||
+ exit unless/until gdb sets the variable to non-zero.)
|
||||
+ */
|
||||
+#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <unistd.h>
|
||||
+
|
||||
+int should_exit = 0;
|
||||
+
|
||||
+int main ()
|
||||
+{
|
||||
+ int local_i = 0;
|
||||
+
|
||||
+ sleep( 10 ); /* System call causes register fetch to fail */
|
||||
+ /* This is a known HPUX "feature" */
|
||||
+ while (! should_exit)
|
||||
+ {
|
||||
+ local_i++;
|
||||
+ }
|
||||
+ return (0);
|
||||
+}
|
161
SOURCES/gdb-6.3-inheritancetest-20050726.patch
Normal file
161
SOURCES/gdb-6.3-inheritancetest-20050726.patch
Normal file
@ -0,0 +1,161 @@
|
||||
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.
|
||||
* gdb.cp/b146835.cc: Ditto.
|
||||
* 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
|
||||
@@ -0,0 +1,32 @@
|
||||
+#include "b146835.h"
|
||||
+#include <iostream>
|
||||
+
|
||||
+class F : public C {
|
||||
+
|
||||
+protected:
|
||||
+
|
||||
+ virtual void funcA (unsigned long a, B *b);
|
||||
+ virtual void funcB (E *e);
|
||||
+ virtual void funcC (unsigned long x, bool y);
|
||||
+
|
||||
+ char *s1, *s2;
|
||||
+ bool b1;
|
||||
+ int k;
|
||||
+
|
||||
+public:
|
||||
+ void foo() {
|
||||
+ std::cout << "foo" << std::endl;
|
||||
+ }
|
||||
+};
|
||||
+
|
||||
+
|
||||
+void F::funcA (unsigned long a, B *b) {}
|
||||
+void F::funcB (E *e) {}
|
||||
+void F::funcC (unsigned long x, bool y) {}
|
||||
+
|
||||
+int main()
|
||||
+{
|
||||
+ F f;
|
||||
+ 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 @@
|
||||
+# 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 properly print an inherited member variable
|
||||
+# (Bugzilla 146835)
|
||||
+
|
||||
+set testfile "b146835"
|
||||
+set srcfile ${testfile}.cc
|
||||
+set srcfile2 ${testfile}b.cc
|
||||
+set binfile [standard_output_file ${testfile}]
|
||||
+if {[gdb_compile "${srcdir}/${subdir}/${srcfile} ${srcdir}/${subdir}/${srcfile2}" "${binfile}" executable {debug c++}] != "" } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+gdb_exit
|
||||
+gdb_start
|
||||
+gdb_reinitialize_dir $srcdir/$subdir
|
||||
+gdb_load ${binfile}
|
||||
+
|
||||
+#
|
||||
+# Run to `main' where we begin our tests.
|
||||
+#
|
||||
+
|
||||
+if ![runto_main] then {
|
||||
+ gdb_suppress_tests
|
||||
+}
|
||||
+
|
||||
+gdb_test "break 'F::foo()'" ""
|
||||
+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
|
||||
@@ -0,0 +1,36 @@
|
||||
+
|
||||
+class A {
|
||||
+
|
||||
+protected:
|
||||
+
|
||||
+ virtual void funcA (unsigned long a, class B *b) = 0;
|
||||
+ virtual void funcB (class E *e) = 0;
|
||||
+ virtual void funcC (unsigned long x, bool y) = 0;
|
||||
+
|
||||
+ void funcD (class E *e, class D* d);
|
||||
+ virtual void funcE (E *e, D *d);
|
||||
+ virtual void funcF (unsigned long x, D *d);
|
||||
+};
|
||||
+
|
||||
+
|
||||
+class C : public A {
|
||||
+
|
||||
+protected:
|
||||
+
|
||||
+ int x;
|
||||
+ class K *k;
|
||||
+ class H *h;
|
||||
+
|
||||
+ D *d;
|
||||
+
|
||||
+ class W *w;
|
||||
+ class N *n;
|
||||
+ class L *l;
|
||||
+ unsigned long *r;
|
||||
+
|
||||
+public:
|
||||
+
|
||||
+ C();
|
||||
+ 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) {}
|
247
SOURCES/gdb-6.3-mapping-zero-inode-test.patch
Normal file
247
SOURCES/gdb-6.3-mapping-zero-inode-test.patch
Normal file
@ -0,0 +1,247 @@
|
||||
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
|
||||
+ }
|
||||
+}
|
32
SOURCES/gdb-6.3-ppc64displaysymbol-20041124.patch
Normal file
32
SOURCES/gdb-6.3-ppc64displaysymbol-20041124.patch
Normal file
@ -0,0 +1,32 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Andrew Cagney <cagney@gnu.org>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-6.3-ppc64displaysymbol-20041124.patch
|
||||
|
||||
;; Include the pc's section when doing a symbol lookup so that the
|
||||
;; correct symbol is found.
|
||||
;;=push: Write new testcase.
|
||||
|
||||
2004-11-24 Andrew Cagney <cagney@gnu.org>
|
||||
|
||||
* printcmd.c (build_address_symbolic): Find a section for the
|
||||
address.
|
||||
|
||||
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
|
||||
--- a/gdb/printcmd.c
|
||||
+++ b/gdb/printcmd.c
|
||||
@@ -587,6 +587,14 @@ build_address_symbolic (struct gdbarch *gdbarch,
|
||||
addr = overlay_mapped_address (addr, section);
|
||||
}
|
||||
}
|
||||
+ /* To ensure that the symbol returned belongs to the correct setion
|
||||
+ (and that the last [random] symbol from the previous section
|
||||
+ isn't returned) try to find the section containing PC. First try
|
||||
+ the overlay code (which by default returns NULL); and second try
|
||||
+ the normal section code (which almost always succeeds). */
|
||||
+ section = find_pc_overlay (addr);
|
||||
+ if (section == NULL)
|
||||
+ section = find_pc_section (addr);
|
||||
|
||||
/* First try to find the address in the symbol table, then
|
||||
in the minsyms. Take the closest one. */
|
118
SOURCES/gdb-6.3-ppc64syscall-20040622.patch
Normal file
118
SOURCES/gdb-6.3-ppc64syscall-20040622.patch
Normal file
@ -0,0 +1,118 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Andrew Cagney <cagney@gnu.org>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-6.3-ppc64syscall-20040622.patch
|
||||
|
||||
;; Better parse 64-bit PPC system call prologues.
|
||||
;;=push: Write new testcase.
|
||||
|
||||
2004-06-22 Andrew Cagney <cagney@gnu.org>
|
||||
|
||||
* rs6000-tdep.c (struct rs6000_framedata): Add field "func_start".
|
||||
(skip_prologue): Delete local variable "orig_pc", use
|
||||
"func_start". Add local variable "num_skip_linux_syscall_insn",
|
||||
use to skip over first half of a GNU/Linux syscall and update
|
||||
"func_start".
|
||||
|
||||
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
|
||||
--- a/gdb/rs6000-tdep.c
|
||||
+++ b/gdb/rs6000-tdep.c
|
||||
@@ -134,6 +134,7 @@ static const char *powerpc_vector_abi_string = "auto";
|
||||
|
||||
struct rs6000_framedata
|
||||
{
|
||||
+ CORE_ADDR func_start; /* True function start. */
|
||||
int offset; /* total size of frame --- the distance
|
||||
by which we decrement sp to allocate
|
||||
the frame */
|
||||
@@ -1426,7 +1427,6 @@ static CORE_ADDR
|
||||
skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR lim_pc,
|
||||
struct rs6000_framedata *fdata)
|
||||
{
|
||||
- CORE_ADDR orig_pc = pc;
|
||||
CORE_ADDR last_prologue_pc = pc;
|
||||
CORE_ADDR li_found_pc = 0;
|
||||
gdb_byte buf[4];
|
||||
@@ -1445,12 +1445,14 @@ skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR lim_pc,
|
||||
int minimal_toc_loaded = 0;
|
||||
int prev_insn_was_prologue_insn = 1;
|
||||
int num_skip_non_prologue_insns = 0;
|
||||
+ int num_skip_ppc64_gnu_linux_syscall_insn = 0;
|
||||
int r0_contains_arg = 0;
|
||||
const struct bfd_arch_info *arch_info = gdbarch_bfd_arch_info (gdbarch);
|
||||
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
|
||||
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
|
||||
|
||||
memset (fdata, 0, sizeof (struct rs6000_framedata));
|
||||
+ fdata->func_start = pc;
|
||||
fdata->saved_gpr = -1;
|
||||
fdata->saved_fpr = -1;
|
||||
fdata->saved_vr = -1;
|
||||
@@ -1484,6 +1486,55 @@ skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR lim_pc,
|
||||
break;
|
||||
op = extract_unsigned_integer (buf, 4, byte_order);
|
||||
|
||||
+ /* A PPC64 GNU/Linux system call function is split into two
|
||||
+ sub-functions: a non-threaded fast-path (__NAME_nocancel)
|
||||
+ which does not use a frame; and a threaded slow-path
|
||||
+ (Lpseudo_cancel) that does create a frame. Ref:
|
||||
+ nptl/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h
|
||||
+
|
||||
+ *INDENT-OFF*
|
||||
+ NAME:
|
||||
+ SINGLE_THREAD_P
|
||||
+ bne- .Lpseudo_cancel
|
||||
+ __NAME_nocancel:
|
||||
+ li r0,162
|
||||
+ sc
|
||||
+ bnslr+
|
||||
+ b 0x7fe014ef64 <.__syscall_error>
|
||||
+ Lpseudo_cancel:
|
||||
+ stdu r1,-128(r1)
|
||||
+ ...
|
||||
+ *INDENT-ON*
|
||||
+
|
||||
+ Unfortunatly, because the latter case uses a local label (not
|
||||
+ in the symbol table) a PC in "Lpseudo_cancel" appears to be
|
||||
+ in "__NAME_nocancel". The following code recognizes this,
|
||||
+ adjusting FUNC_START to point to where "Lpseudo_cancel"
|
||||
+ should be, and parsing the prologue sequence as if
|
||||
+ "Lpseudo_cancel" was the entry point. */
|
||||
+
|
||||
+ if (((op & 0xffff0000) == 0x38000000 /* li r0,N */
|
||||
+ && pc == fdata->func_start + 0
|
||||
+ && num_skip_ppc64_gnu_linux_syscall_insn == 0)
|
||||
+ || (op == 0x44000002 /* sc */
|
||||
+ && pc == fdata->func_start + 4
|
||||
+ && num_skip_ppc64_gnu_linux_syscall_insn == 1)
|
||||
+ || (op == 0x4ca30020 /* bnslr+ */
|
||||
+ && pc == fdata->func_start + 8
|
||||
+ && num_skip_ppc64_gnu_linux_syscall_insn == 2))
|
||||
+ {
|
||||
+ num_skip_ppc64_gnu_linux_syscall_insn++;
|
||||
+ continue;
|
||||
+ }
|
||||
+ else if ((op & 0xfc000003) == 0x48000000 /* b __syscall_error */
|
||||
+ && pc == fdata->func_start + 12
|
||||
+ && num_skip_ppc64_gnu_linux_syscall_insn == 3)
|
||||
+ {
|
||||
+ num_skip_ppc64_gnu_linux_syscall_insn = -1;
|
||||
+ fdata->func_start = pc;
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
if ((op & 0xfc1fffff) == 0x7c0802a6)
|
||||
{ /* mflr Rx */
|
||||
/* Since shared library / PIC code, which needs to get its
|
||||
@@ -1673,9 +1724,9 @@ skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR lim_pc,
|
||||
we have no line table information or the line info tells
|
||||
us that the subroutine call is not part of the line
|
||||
associated with the prologue. */
|
||||
- if ((pc - orig_pc) > 8)
|
||||
+ if ((pc - fdata->func_start) > 8)
|
||||
{
|
||||
- struct symtab_and_line prologue_sal = find_pc_line (orig_pc, 0);
|
||||
+ struct symtab_and_line prologue_sal = find_pc_line (fdata->func_start, 0);
|
||||
struct symtab_and_line this_sal = find_pc_line (pc, 0);
|
||||
|
||||
if ((prologue_sal.line == 0)
|
35
SOURCES/gdb-6.3-readnever-20050907.patch
Normal file
35
SOURCES/gdb-6.3-readnever-20050907.patch
Normal file
@ -0,0 +1,35 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Andrew Cagney <cagney@gnu.org>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-6.3-readnever-20050907.patch
|
||||
|
||||
;; Add readnever option
|
||||
;;=push
|
||||
|
||||
2004-11-18 Andrew Cagney <cagney@gnu.org>
|
||||
|
||||
* dwarf2read.c: Include "top.c".
|
||||
(dwarf2_has_info): Check for readnever_symbol_files.
|
||||
* symfile.c (readnever_symbol_files): Define.
|
||||
* top.h (readnever_symbol_files): Declare.
|
||||
* main.c (captured_main): Add --readnever option.
|
||||
(print_gdb_help): Ditto.
|
||||
|
||||
2004-11-18 Andrew Cagney <cagney@gnu.org>
|
||||
|
||||
* gdb.texinfo (File Options): Document --readnever.
|
||||
|
||||
Pushed upstream: https://sourceware.org/ml/gdb-cvs/2017-12/msg00007.html
|
||||
|
||||
diff --git a/gdb/gcore.in b/gdb/gcore.in
|
||||
--- a/gdb/gcore.in
|
||||
+++ b/gdb/gcore.in
|
||||
@@ -97,7 +97,7 @@ for pid in "$@"
|
||||
do
|
||||
# `</dev/null' to avoid touching interactive terminal if it is
|
||||
# available but not accessible as GDB would get stopped on SIGTTIN.
|
||||
- "$binary_path/@GDB_TRANSFORM_NAME@" </dev/null --nx --batch \
|
||||
+ "$binary_path/@GDB_TRANSFORM_NAME@" </dev/null --nx --batch --readnever \
|
||||
-ex "set pagination off" -ex "set height 0" -ex "set width 0" \
|
||||
"${dump_all_cmds[@]}" \
|
||||
-ex "attach $pid" -ex "gcore $name.$pid" -ex detach -ex quit
|
26
SOURCES/gdb-6.3-rh-testversion-20041202.patch
Normal file
26
SOURCES/gdb-6.3-rh-testversion-20041202.patch
Normal file
@ -0,0 +1,26 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Elena Zannoni <ezannoni@redhat.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-6.3-rh-testversion-20041202.patch
|
||||
|
||||
;; Match the Fedora's version info.
|
||||
;;=fedora
|
||||
|
||||
2003-02-24 Elena Zannoni <ezannoni@redhat.com>
|
||||
|
||||
* gdb.gdb/selftest.exp: Add matching on specific Red Hat only version
|
||||
string.
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.gdb/selftest.exp b/gdb/testsuite/gdb.gdb/selftest.exp
|
||||
--- a/gdb/testsuite/gdb.gdb/selftest.exp
|
||||
+++ b/gdb/testsuite/gdb.gdb/selftest.exp
|
||||
@@ -53,6 +53,9 @@ proc test_with_self { } {
|
||||
-re ".\[0-9\]+ = +.+ +0x.*\[0-9.\]+.*$gdb_prompt $" {
|
||||
pass "printed version with cast"
|
||||
}
|
||||
+ -re ".\[0-9\]+ = .(Fedora|Red Hat Enterprise Linux) \[\\(\\)0-9.a-z\\-\]+.*$gdb_prompt $" {
|
||||
+ pass "printed version Fedora or Red Hat Enterprise Linux only"
|
||||
+ }
|
||||
}
|
||||
|
||||
# start the "xgdb" process
|
247
SOURCES/gdb-6.3-test-dtorfix-20050121.patch
Normal file
247
SOURCES/gdb-6.3-test-dtorfix-20050121.patch
Normal file
@ -0,0 +1,247 @@
|
||||
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
|
||||
|
||||
;; Test support of multiple destructors just like multiple constructors
|
||||
;;=fedoratest
|
||||
|
||||
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
|
||||
@@ -0,0 +1,99 @@
|
||||
+/* 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. */
|
||||
+
|
||||
+class A
|
||||
+{
|
||||
+ public:
|
||||
+ A();
|
||||
+ ~A();
|
||||
+ int k;
|
||||
+ private:
|
||||
+ int x;
|
||||
+};
|
||||
+
|
||||
+class B: public A
|
||||
+{
|
||||
+ public:
|
||||
+ B();
|
||||
+ private:
|
||||
+ int y;
|
||||
+};
|
||||
+
|
||||
+/* C and D are for the $delete destructor. */
|
||||
+
|
||||
+class C
|
||||
+{
|
||||
+ public:
|
||||
+ C();
|
||||
+ virtual ~C();
|
||||
+ private:
|
||||
+ int x;
|
||||
+};
|
||||
+
|
||||
+class D: public C
|
||||
+{
|
||||
+ public:
|
||||
+ D();
|
||||
+ private:
|
||||
+ int y;
|
||||
+};
|
||||
+
|
||||
+int main(int argc, char *argv[])
|
||||
+{
|
||||
+ A* a = new A;
|
||||
+ B* b = new B;
|
||||
+ D* d = new D;
|
||||
+ delete a;
|
||||
+ delete b;
|
||||
+ delete d;
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+A::A() /* Constructor A */
|
||||
+{
|
||||
+ x = 1; /* First line A */
|
||||
+ k = 4; /* Second line A */
|
||||
+}
|
||||
+
|
||||
+A::~A() /* Destructor A */
|
||||
+{
|
||||
+ x = 3; /* First line ~A */
|
||||
+ k = 6; /* Second line ~A */
|
||||
+}
|
||||
+
|
||||
+B::B()
|
||||
+{
|
||||
+ y = 2; /* First line B */
|
||||
+ k = 5;
|
||||
+}
|
||||
+
|
||||
+C::C() /* Constructor C */
|
||||
+{
|
||||
+ x = 1; /* First line C */
|
||||
+}
|
||||
+
|
||||
+C::~C() /* Destructor C */
|
||||
+{
|
||||
+ x = 3; /* First line ~C */
|
||||
+}
|
||||
+
|
||||
+D::D()
|
||||
+{
|
||||
+ 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 @@
|
||||
+# 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 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 break at multiple forms of constructors.
|
||||
+
|
||||
+set testfile "constructortest"
|
||||
+set srcfile ${testfile}.cc
|
||||
+set binfile [standard_output_file ${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"}] != "" } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+gdb_exit
|
||||
+gdb_start
|
||||
+gdb_reinitialize_dir $srcdir/$subdir
|
||||
+gdb_load ${binfile}
|
||||
+
|
||||
+#
|
||||
+# Run to `main' where we begin our tests.
|
||||
+#
|
||||
+
|
||||
+if ![runto_main] then {
|
||||
+ 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"
|
||||
+
|
||||
+# Verify that we break for the A constructor two times
|
||||
+# Once for new A and once for new B
|
||||
+gdb_continue_to_breakpoint "First line A"
|
||||
+gdb_test "bt" "#0.*A.*#1.*main.*" "Verify in in-charge A::A"
|
||||
+gdb_continue_to_breakpoint "First line A"
|
||||
+gdb_test "bt" "#0.*A.*#1.*B.*#2.*main.*" "Verify in not-in-charge A::A"
|
||||
+
|
||||
+# Now do the same for destructors
|
||||
+gdb_test "break 'A::~A()'" ""
|
||||
+
|
||||
+# Verify that we break for the A destructor two times
|
||||
+# Once for delete a and once for delete b
|
||||
+gdb_continue_to_breakpoint "First line ~A"
|
||||
+gdb_test "bt" "#0.*~A.*#1.*main.*" "Verify in in-charge A::~A"
|
||||
+gdb_continue_to_breakpoint "First line ~A"
|
||||
+gdb_test "bt" "#0.*~A.*#1.*~B.*#2.*main.*" "Verify in not-in-charge A::~A"
|
||||
+
|
||||
+
|
||||
+# Verify that we can break by line number in a constructor and find
|
||||
+# both occurrences
|
||||
+runto_main
|
||||
+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_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"
|
||||
+gdb_test "bt" "#0.*A.*#1.*B.*#2.*main.*" "Verify in not-in-charge A::A second line"
|
||||
+
|
||||
+# Verify that we can break by line number in a destructor and find
|
||||
+# both occurrences
|
||||
+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_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.
|
||||
+gdb_continue_to_breakpoint "Second line ~A"
|
||||
+gdb_test "bt" "#0.*A.*#1.*main.*" "Verify in A::~A second line #2"
|
||||
+gdb_continue_to_breakpoint "Second line ~A"
|
||||
+gdb_test "bt" "#0.*A.*#1.*B.*#2.*main.*" "Verify in not-in-charge A::~A second line"
|
||||
+
|
||||
+
|
||||
+# Test now the $delete destructors.
|
||||
+
|
||||
+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"
|
||||
+gdb_continue_to_breakpoint "First line ~C"
|
||||
+
|
||||
+# Verify that we can break by line number in a destructor and find
|
||||
+# the $delete occurence
|
||||
+
|
||||
+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"
|
||||
+
|
||||
+# Run to `main' where we begin our tests.
|
||||
+# Set the breakpoints first to test PIE multiple-PC BREAKPOINT_RE_SET.
|
||||
+# RUNTO_MAIN or RUNTO MAIN are not usable here as it runs DELETE_BREAKPOINTS.
|
||||
+
|
||||
+if ![gdb_breakpoint main] {
|
||||
+ gdb_suppress_tests
|
||||
+}
|
||||
+gdb_run_cmd
|
||||
+set test "running to main"
|
||||
+gdb_test_multiple "" $test {
|
||||
+ -re "Breakpoint \[0-9\]*, main .*$gdb_prompt $" {
|
||||
+ pass $test
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+gdb_continue_to_breakpoint "First line ~C"
|
103
SOURCES/gdb-6.3-test-movedir-20050125.patch
Normal file
103
SOURCES/gdb-6.3-test-movedir-20050125.patch
Normal file
@ -0,0 +1,103 @@
|
||||
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>
|
||||
+#include <stdlib.h>
|
||||
+#include "move-dir.h"
|
||||
+
|
||||
+int main() {
|
||||
+ const char* hw = "hello world.";
|
||||
+ printf ("%s\n", hw);;
|
||||
+ 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 @@
|
||||
+# 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.
|
||||
+
|
||||
+set testfile "move-dir"
|
||||
+set srcfile ${testfile}.c
|
||||
+set incfile ${testfile}.h
|
||||
+set binfile [standard_output_file ${testfile}]
|
||||
+
|
||||
+set testdir [standard_output_file 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}]"
|
||||
+
|
||||
+set additional_flags "additional_flags=-I${subdir}/incdir"
|
||||
+
|
||||
+if { [gdb_compile [standard_output_file ${srcfile}] "${binfile}" executable [list debug $additional_flags]] != "" } {
|
||||
+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
|
||||
+}
|
||||
+
|
||||
+# Create and source the file that provides information about the compiler
|
||||
+# used to compile the test case.
|
||||
+
|
||||
+if [get_compiler_info ${binfile}] {
|
||||
+ return -1;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+set oldtimeout $timeout
|
||||
+set timeout [expr "$timeout + 60"]
|
||||
+
|
||||
+# Start with a fresh gdb.
|
||||
+
|
||||
+gdb_exit
|
||||
+gdb_start
|
||||
+gdb_test "cd ../.." "" ""
|
||||
+gdb_load ${binfile}
|
||||
+gdb_test "list main" ".*hw.*other.*" "found main"
|
||||
+gdb_test "list other" ".*ostring.*" "found include file"
|
||||
+
|
||||
+
|
||||
+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
|
||||
@@ -0,0 +1,7 @@
|
||||
+#include <stdlib.h>
|
||||
+
|
||||
+void other() {
|
||||
+ const char* ostring = "other";
|
||||
+ printf ("%s\n", ostring);;
|
||||
+}
|
||||
+
|
2027
SOURCES/gdb-6.3-test-pie-20050107.patch
Normal file
2027
SOURCES/gdb-6.3-test-pie-20050107.patch
Normal file
File diff suppressed because it is too large
Load Diff
42
SOURCES/gdb-6.3-test-self-20050110.patch
Normal file
42
SOURCES/gdb-6.3-test-self-20050110.patch
Normal file
@ -0,0 +1,42 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Elena Zannoni <ezannoni@redhat.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-6.3-test-self-20050110.patch
|
||||
|
||||
;; Get selftest working with sep-debug-info
|
||||
;;=fedoratest
|
||||
|
||||
2004-02-23 Elena Zannoni <ezannoni@redhat.com>
|
||||
|
||||
* gdb.gdb/selftest.exp: Make sure that the debug directory is
|
||||
set up properly.
|
||||
* gdb.gdb/complaints.exp: Ditto.
|
||||
* gdb.gdb/xfullpath.exp: Ditto.
|
||||
* gdb.gdb/observer.exp: Ditto.
|
||||
|
||||
diff --git a/gdb/testsuite/lib/selftest-support.exp b/gdb/testsuite/lib/selftest-support.exp
|
||||
--- a/gdb/testsuite/lib/selftest-support.exp
|
||||
+++ b/gdb/testsuite/lib/selftest-support.exp
|
||||
@@ -151,18 +151,18 @@ proc do_self_tests {function body} {
|
||||
}
|
||||
|
||||
# Remove any old copy lying around.
|
||||
- remote_file host delete $xgdb
|
||||
+ #remote_file host delete $xgdb
|
||||
|
||||
gdb_start
|
||||
- set file [remote_download host $GDB_FULLPATH $xgdb]
|
||||
+ #set file [remote_download host $GDB_FULLPATH $xgdb]
|
||||
|
||||
- set result [selftest_setup $file $function]
|
||||
+ set result [selftest_setup $GDB_FULLPATH $function]
|
||||
if {$result == 0} then {
|
||||
set result [uplevel $body]
|
||||
}
|
||||
|
||||
gdb_exit
|
||||
- catch "remote_file host delete $file"
|
||||
+ #catch "remote_file host delete $file"
|
||||
|
||||
if {$result < 0} then {
|
||||
warning "Couldn't test self"
|
254
SOURCES/gdb-6.3-threaded-watchpoints2-20050225.patch
Normal file
254
SOURCES/gdb-6.3-threaded-watchpoints2-20050225.patch
Normal file
@ -0,0 +1,254 @@
|
||||
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
|
||||
accept a ptid_t first argument. Change all calling macros
|
||||
to default the inferior_ptid for the first argument.
|
||||
(i386_linux_insert_watchpoint): New prototype.
|
||||
(i386_linux_remove_watchpoint, i386_linux_insert_hw_breakpoint): Ditto.
|
||||
(i386_linux_remove_hw_breakpoint): Ditto.
|
||||
(target_insert_watchpoint, target_remove_watchpoint): Undef and
|
||||
override.
|
||||
(target_insert_hw_breakpoint, target_remove_hw_breakpoint): Ditto.
|
||||
* config/i386/nm-linux64.h: Ditto except add amd64 versions of
|
||||
the watchpoint/hw-breakpoint insert/remove routines.
|
||||
* i386-nat.c: Include "inferior.h" to define inferior_ptid.
|
||||
* i386-linux-nat.c: Change all dr get/set routines to accept
|
||||
ptid_t as first argument and to use this argument to determine
|
||||
the tid for PTRACE.
|
||||
(i386_linux_set_debug_regs_for_thread): New function.
|
||||
(i386_linux_sync_debug_registers_callback): Ditto.
|
||||
(i386_linux_sync_debug_registers_across_threads): Ditto.
|
||||
(i386_linux_insert_watchpoint, i386_linux_remove_watchpoint): Ditto.
|
||||
(i386_linux_hw_breakpoint, i386_linux_remove_hw_breakpoint): Ditto.
|
||||
(i386_linux_new_thread): Ditto.
|
||||
(_initialize_i386_linux_nat): Ditto.
|
||||
* amd64-linux-nat.c: Change all dr get/set routines to accept
|
||||
ptid_t as first argument and to use this argument to determine
|
||||
the tid for PTRACE.
|
||||
(amd64_linux_set_debug_regs_for_thread): New function.
|
||||
(amd64_linux_sync_debug_registers_callback): Ditto.
|
||||
(amd64_linux_sync_debug_registers_across_threads): Ditto.
|
||||
(amd64_linux_insert_watchpoint, amd64_linux_remove_watchpoint): Ditto.
|
||||
(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.
|
||||
|
||||
[ 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
|
||||
@@ -0,0 +1,66 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2002, 2003, 2004, 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.
|
||||
+
|
||||
+ This file is copied from schedlock.c. */
|
||||
+
|
||||
+#include <stdio.h>
|
||||
+#include <unistd.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <pthread.h>
|
||||
+
|
||||
+void *thread_function(void *arg); /* Pointer to function executed by each thread */
|
||||
+
|
||||
+#define NUM 5
|
||||
+
|
||||
+unsigned int args[NUM+1];
|
||||
+
|
||||
+int main() {
|
||||
+ int res;
|
||||
+ pthread_t threads[NUM];
|
||||
+ void *thread_result;
|
||||
+ long i;
|
||||
+
|
||||
+ for (i = 0; i < NUM; i++)
|
||||
+ {
|
||||
+ args[i] = 1; /* Init value. */
|
||||
+ res = pthread_create(&threads[i],
|
||||
+ NULL,
|
||||
+ thread_function,
|
||||
+ (void *) i);
|
||||
+ }
|
||||
+
|
||||
+ args[i] = 1;
|
||||
+ thread_function ((void *) i);
|
||||
+
|
||||
+ exit(EXIT_SUCCESS);
|
||||
+}
|
||||
+
|
||||
+void *thread_function(void *arg) {
|
||||
+ int my_number = (long) arg;
|
||||
+ int *myp = (int *) &args[my_number];
|
||||
+
|
||||
+ /* Don't run forever. Run just short of it :) */
|
||||
+ while (*myp > 0)
|
||||
+ {
|
||||
+ (*myp) ++; usleep (1); /* Loop increment. */
|
||||
+ }
|
||||
+
|
||||
+ 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 @@
|
||||
+# 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 support multiple watchpoints across threads.
|
||||
+
|
||||
+# 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 srcfile ${testfile}.c
|
||||
+set binfile [standard_output_file ${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}
|
||||
+
|
||||
+gdb_test "set can-use-hw-watchpoints 1" "" ""
|
||||
+
|
||||
+#
|
||||
+# Run to `main' where we begin our tests.
|
||||
+#
|
||||
+
|
||||
+if ![runto_main] then {
|
||||
+ gdb_suppress_tests
|
||||
+}
|
||||
+
|
||||
+set args_2 0
|
||||
+set args_3 0
|
||||
+
|
||||
+gdb_breakpoint "thread_function"
|
||||
+gdb_continue_to_breakpoint "thread_function"
|
||||
+gdb_test "disable 2" ""
|
||||
+
|
||||
+gdb_test_multiple "p args\[2\]" "get initial args2" {
|
||||
+ -re "\\\$\[0-9\]* = (.*)$gdb_prompt $" {
|
||||
+ set init_args_2 $expect_out(1,string)
|
||||
+ pass "get initial args2"
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+gdb_test_multiple "p args\[3\]" "get initial args3" {
|
||||
+ -re "\\\$\[0-9\]* = (.*)$gdb_prompt $" {
|
||||
+ set init_args_3 $expect_out(1,string)
|
||||
+ pass "get initial args3"
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+set args_2 $init_args_2
|
||||
+set args_3 $init_args_3
|
||||
+
|
||||
+# Watch values that will be modified by distinct threads.
|
||||
+gdb_test "watch args\[2\]" "Hardware watchpoint 3: args\\\[2\\\]"
|
||||
+gdb_test "watch args\[3\]" "Hardware watchpoint 4: args\\\[3\\\]"
|
||||
+
|
||||
+set init_line [expr [gdb_get_line_number "Init value"]+1]
|
||||
+set inc_line [gdb_get_line_number "Loop increment"]
|
||||
+
|
||||
+# Loop and continue to allow both watchpoints to be triggered.
|
||||
+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 $"
|
||||
+ { 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 $"
|
||||
+ { 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 $"
|
||||
+ { 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 $"
|
||||
+ { set args_3 [expr $args_3+1]; set test_flag 1 }
|
||||
+ }
|
||||
+ # If we fail above, don't bother continuing loop
|
||||
+ if { $test_flag == 0 } {
|
||||
+ set i 30;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+# Print success message if loop succeeded.
|
||||
+if { $test_flag == 1 } {
|
||||
+ pass "threaded watch loop"
|
||||
+}
|
||||
+
|
||||
+# Verify that we hit first watchpoint in child thread.
|
||||
+set message "watchpoint on args\[2\] hit in thread"
|
||||
+if { $args_2 > 1 } {
|
||||
+ pass $message
|
||||
+} else {
|
||||
+ fail $message
|
||||
+}
|
||||
+
|
||||
+# Verify that we hit second watchpoint in child thread.
|
||||
+set message "watchpoint on args\[3\] hit in thread"
|
||||
+if { $args_3 > 1 } {
|
||||
+ pass $message
|
||||
+} else {
|
||||
+ fail $message
|
||||
+}
|
||||
+
|
||||
+# Verify that all watchpoint hits are accounted for.
|
||||
+set message "combination of threaded watchpoints = 30 + initial values"
|
||||
+if { [expr $args_2+$args_3] == [expr [expr 30+$init_args_2]+$init_args_3] } {
|
||||
+ pass $message
|
||||
+} else {
|
||||
+ fail $message
|
||||
+}
|
938
SOURCES/gdb-6.5-BEA-testsuite.patch
Normal file
938
SOURCES/gdb-6.5-BEA-testsuite.patch
Normal file
@ -0,0 +1,938 @@
|
||||
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
|
||||
@@ -0,0 +1,301 @@
|
||||
+/*
|
||||
+ * The point of this program is to crash in a multi-threaded app.
|
||||
+ * There are seven threads, doing the following things:
|
||||
+ * * Spinning
|
||||
+ * * Spinning inside a signal handler
|
||||
+ * * Spinning inside a signal handler executing on the altstack
|
||||
+ * * In a syscall
|
||||
+ * * In a syscall inside a signal handler
|
||||
+ * * In a syscall inside a signal handler executing on the altstack
|
||||
+ * * Finally, the main thread crashes in main, with no frills.
|
||||
+ *
|
||||
+ * These are the things threads in JRockit tend to be doing. If gdb
|
||||
+ * can handle those things, both in core files and during live
|
||||
+ * debugging, that will help (at least) JRockit development.
|
||||
+ *
|
||||
+ * Let the program create a core file, then load the core file into
|
||||
+ * gdb. Inside gdb, you should be able to do something like this:
|
||||
+ *
|
||||
+ * (gdb) t a a bt
|
||||
+ *
|
||||
+ * Thread 7 (process 4352):
|
||||
+ * #0 0x001ba7dc in __nanosleep_nocancel () from /lib/tls/libc.so.6
|
||||
+ * #1 0x001ba5ff in sleep () from /lib/tls/libc.so.6
|
||||
+ * #2 0x080488a2 in makeSyscall (ignored=0x0) at threadcrash.c:118
|
||||
+ * #3 0x006aadec in start_thread () from /lib/tls/libpthread.so.0
|
||||
+ * #4 0x001ed19a in clone () from /lib/tls/libc.so.6
|
||||
+ *
|
||||
+ * Thread 6 (process 4353):
|
||||
+ * #0 0x001ba7dc in __nanosleep_nocancel () from /lib/tls/libc.so.6
|
||||
+ * #1 0x001ba5ff in sleep () from /lib/tls/libc.so.6
|
||||
+ * #2 0x0804898f in syscallingSighandler (signo=10, info=0xb6be76f0, context=0xb6be7770)
|
||||
+ * at threadcrash.c:168
|
||||
+ * #3 <signal handler called>
|
||||
+ * #4 0x006adf5e in pthread_kill () from /lib/tls/libpthread.so.0
|
||||
+ * #5 0x08048a51 in makeSyscallFromSighandler (ignored=0x0) at threadcrash.c:204
|
||||
+ * #6 0x006aadec in start_thread () from /lib/tls/libpthread.so.0
|
||||
+ * #7 0x001ed19a in clone () from /lib/tls/libc.so.6
|
||||
+ *
|
||||
+ * Thread 5 (process 4354):
|
||||
+ * #0 0x001ba7dc in __nanosleep_nocancel () from /lib/tls/libc.so.6
|
||||
+ * #1 0x001ba5ff in sleep () from /lib/tls/libc.so.6
|
||||
+ * #2 0x08048936 in syscallingAltSighandler (signo=3, info=0x959cd70, context=0x959cdf0)
|
||||
+ * at threadcrash.c:144
|
||||
+ * #3 <signal handler called>
|
||||
+ * #4 0x006adf5e in pthread_kill () from /lib/tls/libpthread.so.0
|
||||
+ * #5 0x080489e2 in makeSyscallFromAltSighandler (ignored=0x0) at threadcrash.c:190
|
||||
+ * #6 0x006aadec in start_thread () from /lib/tls/libpthread.so.0
|
||||
+ * #7 0x001ed19a in clone () from /lib/tls/libc.so.6
|
||||
+ *
|
||||
+ * Thread 4 (process 4355):
|
||||
+ * #0 spin (ignored=0x0) at threadcrash.c:242
|
||||
+ * #1 0x006aadec in start_thread () from /lib/tls/libpthread.so.0
|
||||
+ * #2 0x001ed19a in clone () from /lib/tls/libc.so.6
|
||||
+ *
|
||||
+ * Thread 3 (process 4356):
|
||||
+ * #0 spinningSighandler (signo=12, info=0xb4de46f0, context=0xb4de4770) at threadcrash.c:180
|
||||
+ * #1 <signal handler called>
|
||||
+ * #2 0x006adf5e in pthread_kill () from /lib/tls/libpthread.so.0
|
||||
+ * #3 0x08048b2f in spinFromSighandler (ignored=0x0) at threadcrash.c:232
|
||||
+ * #4 0x006aadec in start_thread () from /lib/tls/libpthread.so.0
|
||||
+ * #5 0x001ed19a in clone () from /lib/tls/libc.so.6
|
||||
+ *
|
||||
+ * Thread 2 (process 4357):
|
||||
+ * #0 spinningAltSighandler (signo=14, info=0x959ee50, context=0x959eed0) at threadcrash.c:156
|
||||
+ * #1 <signal handler called>
|
||||
+ * #2 0x006adf5e in pthread_kill () from /lib/tls/libpthread.so.0
|
||||
+ * #3 0x08048ac0 in spinFromAltSighandler (ignored=0x0) at threadcrash.c:218
|
||||
+ * #4 0x006aadec in start_thread () from /lib/tls/libpthread.so.0
|
||||
+ * #5 0x001ed19a in clone () from /lib/tls/libc.so.6
|
||||
+ *
|
||||
+ * Thread 1 (process 4351):
|
||||
+ * #0 0x08048cf3 in main (argc=1, argv=0xbfff9d74) at threadcrash.c:273
|
||||
+ * (gdb)
|
||||
+ */
|
||||
+
|
||||
+#include <pthread.h>
|
||||
+#include <signal.h>
|
||||
+#include <assert.h>
|
||||
+#include <unistd.h>
|
||||
+#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <string.h>
|
||||
+
|
||||
+#define SIGSYSCALL_ALT SIGQUIT
|
||||
+#define SIGSYSCALL SIGUSR1
|
||||
+#define SIGSPIN_ALT SIGALRM
|
||||
+#define SIGSPIN SIGUSR2
|
||||
+
|
||||
+typedef void (*sigaction_t)(int, siginfo_t *, void *);
|
||||
+
|
||||
+static void installHandler(int signo, sigaction_t handler, int onAltstack) {
|
||||
+ struct sigaction action;
|
||||
+ sigset_t sigset;
|
||||
+ int result;
|
||||
+ stack_t altstack;
|
||||
+ stack_t oldaltstack;
|
||||
+
|
||||
+ memset(&action, 0, sizeof(action));
|
||||
+ memset(&altstack, 0, sizeof(altstack));
|
||||
+ memset(&oldaltstack, 0, sizeof(oldaltstack));
|
||||
+
|
||||
+ if (onAltstack) {
|
||||
+ altstack.ss_sp = malloc(SIGSTKSZ);
|
||||
+ assert(altstack.ss_sp != NULL);
|
||||
+ altstack.ss_size = SIGSTKSZ;
|
||||
+ altstack.ss_flags = 0;
|
||||
+ result = sigaltstack(&altstack, &oldaltstack);
|
||||
+ assert(result == 0);
|
||||
+ assert(oldaltstack.ss_flags == SS_DISABLE);
|
||||
+ }
|
||||
+
|
||||
+ sigemptyset(&sigset);
|
||||
+
|
||||
+ action.sa_handler = NULL;
|
||||
+ action.sa_sigaction = handler;
|
||||
+ action.sa_mask = sigset;
|
||||
+ action.sa_flags = SA_SIGINFO;
|
||||
+ if (onAltstack) {
|
||||
+ action.sa_flags |= SA_ONSTACK;
|
||||
+ }
|
||||
+
|
||||
+ result = sigaction(signo, &action, NULL);
|
||||
+ assert(result == 0);
|
||||
+}
|
||||
+
|
||||
+static void installNormalHandler(int signo, sigaction_t handler) {
|
||||
+ installHandler(signo, handler, 0);
|
||||
+}
|
||||
+
|
||||
+static void installAlthandler(int signo, sigaction_t handler) {
|
||||
+ installHandler(signo, handler, 1);
|
||||
+}
|
||||
+
|
||||
+static void *makeSyscall(void *ignored) {
|
||||
+ (void)ignored;
|
||||
+
|
||||
+ sleep(42);
|
||||
+
|
||||
+ fprintf(stderr, "%s: returning\n", __FUNCTION__);
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
+/* Return true if we're currently executing on the altstack */
|
||||
+static int onAltstack(void) {
|
||||
+ stack_t stack;
|
||||
+ int result;
|
||||
+
|
||||
+ result = sigaltstack(NULL, &stack);
|
||||
+ assert(result == 0);
|
||||
+
|
||||
+ return stack.ss_flags & SS_ONSTACK;
|
||||
+}
|
||||
+
|
||||
+static void syscallingAltSighandler(int signo, siginfo_t *info, void *context) {
|
||||
+ (void)signo;
|
||||
+ (void)info;
|
||||
+ (void)context;
|
||||
+
|
||||
+ if (!onAltstack()) {
|
||||
+ printf("%s() not running on altstack!\n", __FUNCTION__);
|
||||
+ }
|
||||
+
|
||||
+ sleep(42);
|
||||
+}
|
||||
+
|
||||
+static void spinningAltSighandler(int signo, siginfo_t *info, void *context) {
|
||||
+ (void)signo;
|
||||
+ (void)info;
|
||||
+ (void)context;
|
||||
+
|
||||
+ if (!onAltstack()) {
|
||||
+ printf("%s() not running on altstack!\n", __FUNCTION__);
|
||||
+ }
|
||||
+
|
||||
+ while (1);
|
||||
+}
|
||||
+
|
||||
+static void syscallingSighandler(int signo, siginfo_t *info, void *context) {
|
||||
+ (void)signo;
|
||||
+ (void)info;
|
||||
+ (void)context;
|
||||
+
|
||||
+ if (onAltstack()) {
|
||||
+ printf("%s() running on altstack!\n", __FUNCTION__);
|
||||
+ }
|
||||
+
|
||||
+ sleep(42);
|
||||
+}
|
||||
+
|
||||
+static void spinningSighandler(int signo, siginfo_t *info, void *context) {
|
||||
+ (void)signo;
|
||||
+ (void)info;
|
||||
+ (void)context;
|
||||
+
|
||||
+ if (onAltstack()) {
|
||||
+ printf("%s() running on altstack!\n", __FUNCTION__);
|
||||
+ }
|
||||
+
|
||||
+ while (1);
|
||||
+}
|
||||
+
|
||||
+static void *makeSyscallFromAltSighandler(void *ignored) {
|
||||
+ (void)ignored;
|
||||
+
|
||||
+ int result;
|
||||
+
|
||||
+ installAlthandler(SIGSYSCALL_ALT, syscallingAltSighandler);
|
||||
+
|
||||
+ result = pthread_kill(pthread_self(), SIGSYSCALL_ALT);
|
||||
+ assert(result == 0);
|
||||
+
|
||||
+ fprintf(stderr, "%s: returning\n", __FUNCTION__);
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
+static void *makeSyscallFromSighandler(void *ignored) {
|
||||
+ (void)ignored;
|
||||
+
|
||||
+ int result;
|
||||
+
|
||||
+ installNormalHandler(SIGSYSCALL, syscallingSighandler);
|
||||
+
|
||||
+ result = pthread_kill(pthread_self(), SIGSYSCALL);
|
||||
+ assert(result == 0);
|
||||
+
|
||||
+ fprintf(stderr, "%s: returning\n", __FUNCTION__);
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
+static void *spinFromAltSighandler(void *ignored) {
|
||||
+ (void)ignored;
|
||||
+
|
||||
+ int result;
|
||||
+
|
||||
+ installAlthandler(SIGSPIN_ALT, spinningAltSighandler);
|
||||
+
|
||||
+ result = pthread_kill(pthread_self(), SIGSPIN_ALT);
|
||||
+ assert(result == 0);
|
||||
+
|
||||
+ fprintf(stderr, "%s: returning\n", __FUNCTION__);
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
+static void *spinFromSighandler(void *ignored) {
|
||||
+ (void)ignored;
|
||||
+
|
||||
+ int result;
|
||||
+
|
||||
+ installNormalHandler(SIGSPIN, spinningSighandler);
|
||||
+
|
||||
+ result = pthread_kill(pthread_self(), SIGSPIN);
|
||||
+ assert(result == 0);
|
||||
+
|
||||
+ fprintf(stderr, "%s: returning\n", __FUNCTION__);
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
+static void *spin(void *ignored) {
|
||||
+ (void)ignored;
|
||||
+
|
||||
+ while (1);
|
||||
+
|
||||
+ fprintf(stderr, "%s: returning\n", __FUNCTION__);
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
+int main(int argc, char *argv[]) {
|
||||
+ int result;
|
||||
+ pthread_t thread;
|
||||
+ volatile int bad;
|
||||
+
|
||||
+ result = pthread_create(&thread, NULL, makeSyscall, NULL);
|
||||
+ assert(result == 0);
|
||||
+ result = pthread_create(&thread, NULL, makeSyscallFromSighandler, NULL);
|
||||
+ assert(result == 0);
|
||||
+ result = pthread_create(&thread, NULL, makeSyscallFromAltSighandler, NULL);
|
||||
+ assert(result == 0);
|
||||
+ result = pthread_create(&thread, NULL, spin, NULL);
|
||||
+ assert(result == 0);
|
||||
+ result = pthread_create(&thread, NULL, spinFromSighandler, NULL);
|
||||
+ assert(result == 0);
|
||||
+ result = pthread_create(&thread, NULL, spinFromAltSighandler, NULL);
|
||||
+ assert(result == 0);
|
||||
+
|
||||
+ // Give threads some time to get going
|
||||
+ sleep(3);
|
||||
+
|
||||
+ // Crash
|
||||
+ bad = *(int*)7;
|
||||
+
|
||||
+ /* Workaround: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29628
|
||||
+ Simulate use to ensure `DW_AT_location' for them:
|
||||
+ readelf -a --debug threadcrash|grep -A5 -w argc
|
||||
+ --> DW_AT_location : 2 byte block: 71 0 (DW_OP_breg1: 0)
|
||||
+ This case verified on: gcc-4.1.1-30.i386
|
||||
+ Keep it late to ensure persistency in the registers. */
|
||||
+ bad = (int) argc;
|
||||
+ bad = (unsigned long) argv;
|
||||
+
|
||||
+ 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
|
||||
@@ -0,0 +1,37 @@
|
||||
+# threadcrash.exp - The point of this program is to crash in a multi-threaded app.
|
||||
+
|
||||
+
|
||||
+set testfile threadcrash
|
||||
+set srcfile ${testfile}.c
|
||||
+set shellfile ${srcdir}/${subdir}/${testfile}.sh
|
||||
+set binfile [standard_output_file ${testfile}]
|
||||
+
|
||||
+set GDB_abs ${GDB}
|
||||
+if [regexp "^\[^/\]" ${GDB_abs}] {
|
||||
+ set GDB_abs $env(PWD)/${GDB_abs}
|
||||
+}
|
||||
+
|
||||
+if [istarget "*-*-linux"] then {
|
||||
+ set target_cflags "-D_MIT_POSIX_THREADS"
|
||||
+} else {
|
||||
+ set target_cflags ""
|
||||
+}
|
||||
+
|
||||
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+# ${shellfile} argument must not contain any directories.
|
||||
+set fd [open "|bash ${shellfile} ${binfile} $GDB $INTERNAL_GDBFLAGS $GDBFLAGS [host_info gdb_opts]" r]
|
||||
+while { [gets $fd line] >= 0 } {
|
||||
+ if [regexp " PASS: (.*)$" $line trash message] {
|
||||
+ pass $message
|
||||
+ } elseif [regexp " FAIL: (.*)$" $line trash message] {
|
||||
+ fail $message
|
||||
+ }
|
||||
+}
|
||||
+catch {
|
||||
+ close $fd
|
||||
+}
|
||||
+
|
||||
+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
|
||||
@@ -0,0 +1,324 @@
|
||||
+#! /bin/bash
|
||||
+
|
||||
+# NOTE: threadcrash.c *must* be built with debugging symbols
|
||||
+#
|
||||
+# The point of this shell script is to crash treadcrash.c, load the
|
||||
+# resulting core file into gdb and verify that gdb can extract enough
|
||||
+# information from the core file.
|
||||
+#
|
||||
+# The return code from this script is the number of failed tests.
|
||||
+
|
||||
+LOG=gdbresult.log
|
||||
+
|
||||
+if [ $# = 0 ] ; then
|
||||
+ echo >&2 Syntax: $0 \<name of threadcrash binary\> [\<gdb binary\> \<args...\>]
|
||||
+ exit 1
|
||||
+fi
|
||||
+RUNME="$1"
|
||||
+shift
|
||||
+GDB="${*:-gdb}"
|
||||
+
|
||||
+
|
||||
+pf_prefix=""
|
||||
+function pf_prefix() {
|
||||
+ pf_prefix="$*"
|
||||
+}
|
||||
+
|
||||
+set_test=""
|
||||
+function set_test() {
|
||||
+ if [ -n "$set_test" ] ; then
|
||||
+ echo >&2 "DEJAGNU-BASH ERROR: set_test already set"
|
||||
+ exit 1
|
||||
+ fi
|
||||
+ set_test="$*"
|
||||
+ if [ -n "$pf_prefix" ] ; then
|
||||
+ set_test="$pf_prefix: $set_test"
|
||||
+ fi
|
||||
+}
|
||||
+
|
||||
+# INTERNAL
|
||||
+function record_test {
|
||||
+ if [ -z "$set_test" ] ; then
|
||||
+ echo >&2 "DEJAGNU-BASH ERROR: set_test not set"
|
||||
+ exit 1
|
||||
+ fi
|
||||
+ # Provide the leading whitespace delimiter:
|
||||
+ echo " $1: $set_test"
|
||||
+ set_test=""
|
||||
+}
|
||||
+
|
||||
+function pass() {
|
||||
+ record_test PASS
|
||||
+}
|
||||
+function fail() {
|
||||
+ record_test FAIL
|
||||
+}
|
||||
+
|
||||
+
|
||||
+# Verify that the gdb output doesn't contain $1.
|
||||
+function mustNotHave() {
|
||||
+ local BADWORD=$1
|
||||
+ set_test gdb output contains "$BADWORD"
|
||||
+ if grep -q "$BADWORD" $LOG ; then
|
||||
+ fail
|
||||
+ return 1
|
||||
+ fi
|
||||
+ pass
|
||||
+ return 0
|
||||
+}
|
||||
+
|
||||
+# Verify that the gdb output contains exactly $1 $2s.
|
||||
+function mustHaveCorrectAmount() {
|
||||
+ local WANTEDNUMBER=$1
|
||||
+ local GOODWORD=$2
|
||||
+ local ACTUALNUMBER=$(grep "$GOODWORD" $LOG | wc -l)
|
||||
+ set_test gdb output contained $ACTUALNUMBER \""$GOODWORD"\", not $WANTEDNUMBER as expected
|
||||
+ if [ $ACTUALNUMBER != $WANTEDNUMBER ] ; then
|
||||
+ fail
|
||||
+ return 1
|
||||
+ fi
|
||||
+ pass
|
||||
+ return 0
|
||||
+}
|
||||
+
|
||||
+# Verify that the gdb output contains seven threads
|
||||
+function mustHaveSevenThreads() {
|
||||
+ NTHREADS=$(egrep "^Thread [1-7] \(" $LOG | wc -l)
|
||||
+ set_test gdb output contains $NTHREADS threads, not 7 as expected
|
||||
+ if [ $NTHREADS != 7 ] ; then
|
||||
+ fail
|
||||
+ return 1
|
||||
+ fi
|
||||
+ pass
|
||||
+ return 0
|
||||
+}
|
||||
+
|
||||
+# Verify that the gdb output has all parameters on consecutive lines
|
||||
+function mustHaveSequence() {
|
||||
+ SEQUENCE="$*"
|
||||
+ NPARTS=$#
|
||||
+ grep "$1" -A$((NPARTS - 1)) $LOG > matches.log
|
||||
+
|
||||
+ while [ $# -gt 1 ] ; do
|
||||
+ shift
|
||||
+ ((NPARTS--))
|
||||
+ grep "$1" -A$((NPARTS - 1)) matches.log > temp.log
|
||||
+ mv temp.log matches.log
|
||||
+ done
|
||||
+ LASTPART=$1
|
||||
+
|
||||
+ set_test gdb output does not contain the sequence: $SEQUENCE
|
||||
+ if ! grep -q "$LASTPART" matches.log ; then
|
||||
+ fail
|
||||
+ return 1
|
||||
+ fi
|
||||
+ pass
|
||||
+ return 0
|
||||
+}
|
||||
+
|
||||
+# Verify that $LOG contains all information we want
|
||||
+function verifyLog() {
|
||||
+ local FAILURES=0
|
||||
+
|
||||
+ mustNotHave '??' || ((FAILURES++))
|
||||
+ mustHaveCorrectAmount 11 threadcrash.c: || ((FAILURES++))
|
||||
+
|
||||
+ mustHaveSevenThreads || ((FAILURES++))
|
||||
+ mustHaveSequence sleep "makeSyscall (ignored=" || ((FAILURES++))
|
||||
+
|
||||
+ mustHaveSequence sleep "syscallingSighandler (signo=" "signal handler called" 0x || ((FAILURES++))
|
||||
+ mustHaveSequence pthread_kill "makeSyscallFromSighandler (ignored=" || ((FAILURES++))
|
||||
+
|
||||
+ mustHaveSequence sleep "syscallingAltSighandler (signo=" "signal handler called" 0x || ((FAILURES++))
|
||||
+ mustHaveSequence pthread_kill "makeSyscallFromAltSighandler (ignored=" || ((FAILURES++))
|
||||
+
|
||||
+ mustHaveSequence Thread "spin (ignored=" || ((FAILURES++))
|
||||
+
|
||||
+ mustHaveSequence "spinningSighandler (signo=" "signal handler called" 0x || ((FAILURES++))
|
||||
+ mustHaveSequence pthread_kill "spinFromSighandler (ignored=" || ((FAILURES++))
|
||||
+
|
||||
+ mustHaveSequence "spinningAltSighandler (signo=" "signal handler called" 0x || ((FAILURES++))
|
||||
+ mustHaveSequence pthread_kill "spinFromAltSighandler (ignored=" || ((FAILURES++))
|
||||
+
|
||||
+ mustHaveSequence Thread "main (argc=1, argv=" || ((FAILURES++))
|
||||
+
|
||||
+ return $FAILURES
|
||||
+}
|
||||
+
|
||||
+# Put result of debugging a core file in $LOG
|
||||
+function getLogFromCore() {
|
||||
+ # Make sure we get a core file
|
||||
+ set_test Make sure we get a core file
|
||||
+ if ! ulimit -c unlimited ; then
|
||||
+ fail
|
||||
+ exit 1
|
||||
+ fi
|
||||
+ pass
|
||||
+
|
||||
+ # Run the crasher
|
||||
+ ./$(basename "$RUNME")
|
||||
+ EXITCODE=$?
|
||||
+
|
||||
+ # Verify that we actually crashed
|
||||
+ set_test $RUNME should have been killed by a signal, got non-signal exit code $EXITCODE
|
||||
+ if [ $EXITCODE -lt 128 ] ; then
|
||||
+ fail
|
||||
+ exit 1
|
||||
+ fi
|
||||
+ pass
|
||||
+
|
||||
+ # Verify that we got a core file
|
||||
+ set_test $RUNME did not create a core file
|
||||
+ if [ ! -r core* ] ; then
|
||||
+ fail
|
||||
+ exit 1
|
||||
+ fi
|
||||
+ pass
|
||||
+
|
||||
+ # Run gdb
|
||||
+ cat > gdbscript.gdb <<EOF
|
||||
+set width 0
|
||||
+t a a bt 100
|
||||
+quit
|
||||
+EOF
|
||||
+ cat gdbscript.gdb /dev/zero | $GDB -nx "./$(basename "$RUNME")" core* > $LOG
|
||||
+ EXITCODE=$?
|
||||
+
|
||||
+ set_test gdb exited with error code
|
||||
+ if [ $EXITCODE != 0 ] ; then
|
||||
+ ((FAILURES++))
|
||||
+ echo >&2 gdb exited with error code $EXITCODE
|
||||
+ fail
|
||||
+ fi
|
||||
+ pass
|
||||
+}
|
||||
+
|
||||
+# Put result of debugging a gcore file in $LOG
|
||||
+function getLogFromGcore() {
|
||||
+ # Create the core file
|
||||
+ rm -f core*
|
||||
+ cat > gdbscript.gdb <<EOF
|
||||
+handle SIGQUIT pass noprint nostop
|
||||
+handle SIGUSR1 pass noprint nostop
|
||||
+handle SIGUSR2 pass noprint nostop
|
||||
+handle SIGALRM pass noprint nostop
|
||||
+run
|
||||
+gcore
|
||||
+quit
|
||||
+EOF
|
||||
+ cat gdbscript.gdb /dev/zero | $GDB -nx "./$(basename "$RUNME")" > /dev/null
|
||||
+ EXITCODE=$?
|
||||
+
|
||||
+ set_test gdb exited with error code when creating gcore file
|
||||
+ if [ $EXITCODE != 0 ] ; then
|
||||
+ ((FAILURES++))
|
||||
+ echo >&2 gdb exited with error code $EXITCODE when creating gcore file
|
||||
+ fail
|
||||
+ fi
|
||||
+ pass
|
||||
+
|
||||
+ # Verify that we got a core file from gcore
|
||||
+ set_test gdb gcore did not create a core file
|
||||
+ if [ ! -r core* ] ; then
|
||||
+ fail
|
||||
+ exit 1
|
||||
+ fi
|
||||
+ pass
|
||||
+
|
||||
+ # Run gdb on the gcore file
|
||||
+ cat > gdbscript.gdb <<EOF
|
||||
+set width 0
|
||||
+t a a bt 100
|
||||
+quit
|
||||
+EOF
|
||||
+ cat gdbscript.gdb /dev/zero | $GDB -nx "./$(basename "$RUNME")" core* > $LOG
|
||||
+ EXITCODE=$?
|
||||
+
|
||||
+ set_test gdb exited with error code when examining gcore file
|
||||
+ if [ $EXITCODE != 0 ] ; then
|
||||
+ ((FAILURES++))
|
||||
+ echo >&2 gdb exited with error code $EXITCODE when examining gcore file
|
||||
+ fail
|
||||
+ fi
|
||||
+ pass
|
||||
+}
|
||||
+
|
||||
+# Put result of debugging a core file in $LOG
|
||||
+function getLogFromLiveProcess() {
|
||||
+ # Run gdb
|
||||
+ cat > gdbscript.gdb <<EOF
|
||||
+handle SIGQUIT pass noprint nostop
|
||||
+handle SIGUSR1 pass noprint nostop
|
||||
+handle SIGUSR2 pass noprint nostop
|
||||
+handle SIGALRM pass noprint nostop
|
||||
+set width 0
|
||||
+run
|
||||
+t a a bt 100
|
||||
+quit
|
||||
+EOF
|
||||
+ cat gdbscript.gdb /dev/zero | $GDB -nx "./$(basename "$RUNME")" > $LOG
|
||||
+ EXITCODE=$?
|
||||
+
|
||||
+ set_test gdb exited with error code
|
||||
+ if [ $EXITCODE != 0 ] ; then
|
||||
+ ((FAILURES++))
|
||||
+ echo >&2 gdb exited with error code $EXITCODE
|
||||
+ fail
|
||||
+ fi
|
||||
+ pass
|
||||
+}
|
||||
+
|
||||
+####### Main program follows #####################
|
||||
+
|
||||
+# Make sure we don't clobber anybody else's (core) file(s)
|
||||
+WORKDIR=/tmp/$PPID
|
||||
+mkdir -p $WORKDIR
|
||||
+cp "$RUNME" $WORKDIR
|
||||
+cd $WORKDIR
|
||||
+
|
||||
+# Count problems
|
||||
+FAILURES=0
|
||||
+
|
||||
+echo === Testing gdb vs core file...
|
||||
+pf_prefix core file
|
||||
+getLogFromCore
|
||||
+verifyLog
|
||||
+((FAILURES+=$?))
|
||||
+pf_prefix
|
||||
+echo === Core file tests done.
|
||||
+
|
||||
+echo
|
||||
+
|
||||
+echo === Testing gdb vs gcore file...
|
||||
+pf_prefix gcore file
|
||||
+getLogFromGcore
|
||||
+verifyLog
|
||||
+((FAILURES+=$?))
|
||||
+pf_prefix
|
||||
+echo === Gcore file tests done.
|
||||
+
|
||||
+echo
|
||||
+
|
||||
+echo === Testing gdb vs live process...
|
||||
+pf_prefix live process
|
||||
+getLogFromLiveProcess
|
||||
+verifyLog
|
||||
+((FAILURES+=$?))
|
||||
+pf_prefix
|
||||
+echo === Live process tests done.
|
||||
+
|
||||
+# Executive summary
|
||||
+echo
|
||||
+if [ $FAILURES == 0 ] ; then
|
||||
+ echo All tests passed!
|
||||
+else
|
||||
+ echo $FAILURES tests failed!
|
||||
+ echo
|
||||
+ echo Make sure the threadcrash binary contains debugging information \(build with \"gcc -g\"\).
|
||||
+fi
|
||||
+
|
||||
+# Clean up
|
||||
+cd /
|
||||
+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
|
||||
@@ -0,0 +1,248 @@
|
||||
+#! /bin/bash
|
||||
+
|
||||
+# NOTE: threadcrash.c *must* be built with debugging symbols
|
||||
+#
|
||||
+# The point of this shell script is to crash treadcrash.c, load the
|
||||
+# resulting core file into gdb and verify that gdb can extract enough
|
||||
+# information from the core file.
|
||||
+#
|
||||
+# The return code from this script is the number of failed tests.
|
||||
+
|
||||
+LOG=gdbresult.log
|
||||
+
|
||||
+if [ $# != 1 ] ; then
|
||||
+ echo > /dev/stderr Syntax: $0 \<name of threadcrash binary\>
|
||||
+ exit 1
|
||||
+fi
|
||||
+RUNME="$1"
|
||||
+
|
||||
+# Verify that the gdb output doesn't contain $1.
|
||||
+function mustNotHave() {
|
||||
+ local BADWORD=$1
|
||||
+ if grep -q "$BADWORD" $LOG ; then
|
||||
+ echo >> /dev/stderr WARNING: gdb output contains "$BADWORD"
|
||||
+ return 1
|
||||
+ fi
|
||||
+ return 0
|
||||
+}
|
||||
+
|
||||
+# Verify that the gdb output contains exactly $1 $2s.
|
||||
+function mustHaveCorrectAmount() {
|
||||
+ local WANTEDNUMBER=$1
|
||||
+ local GOODWORD=$2
|
||||
+ local ACTUALNUMBER=$(grep "$GOODWORD" $LOG | wc -l)
|
||||
+ if [ $ACTUALNUMBER != $WANTEDNUMBER ] ; then
|
||||
+ echo >> /dev/stderr WARNING: gdb output contained $ACTUALNUMBER \""$GOODWORD"\", not $WANTEDNUMBER as expected
|
||||
+ return 1
|
||||
+ fi
|
||||
+ return 0
|
||||
+}
|
||||
+
|
||||
+# Verify that the gdb output contains seven threads
|
||||
+function mustHaveSevenThreads() {
|
||||
+ NTHREADS=$(egrep "^Thread [1-7] \(" $LOG | wc -l)
|
||||
+ if [ $NTHREADS != 7 ] ; then
|
||||
+ echo >> /dev/stderr WARNING: gdb output contains $NTHREADS threads, not 7 as expected
|
||||
+ return 1
|
||||
+ fi
|
||||
+ return 0
|
||||
+}
|
||||
+
|
||||
+# Verify that the gdb output has all parameters on consecutive lines
|
||||
+function mustHaveSequence() {
|
||||
+ SEQUENCE="$*"
|
||||
+ NPARTS=$#
|
||||
+ grep "$1" -A$((NPARTS - 1)) $LOG > matches.log
|
||||
+
|
||||
+ while [ $# -gt 1 ] ; do
|
||||
+ shift
|
||||
+ ((NPARTS--))
|
||||
+ grep "$1" -A$((NPARTS - 1)) matches.log > temp.log
|
||||
+ mv temp.log matches.log
|
||||
+ done
|
||||
+ LASTPART=$1
|
||||
+
|
||||
+ if ! grep -q "$LASTPART" matches.log ; then
|
||||
+ echo >> /dev/stderr WARNING: gdb output does not contain the sequence: $SEQUENCE
|
||||
+ return 1
|
||||
+ fi
|
||||
+ return 0
|
||||
+}
|
||||
+
|
||||
+# Verify that $LOG contains all information we want
|
||||
+function verifyLog() {
|
||||
+ local FAILURES=0
|
||||
+
|
||||
+ mustNotHave '??' || ((FAILURES++))
|
||||
+ mustHaveCorrectAmount 12 threadcrash.c: || ((FAILURES++))
|
||||
+
|
||||
+ mustHaveSevenThreads || ((FAILURES++))
|
||||
+ mustHaveSequence sleep "makeSyscall (ignored=" || ((FAILURES++))
|
||||
+
|
||||
+ mustHaveSequence sleep "syscallingSighandler (signo=" "signal handler called" 0x || ((FAILURES++))
|
||||
+ mustHaveSequence pthread_kill "makeSyscallFromSighandler (ignored=" || ((FAILURES++))
|
||||
+
|
||||
+ mustHaveSequence sleep "syscallingAltSighandler (signo=" "signal handler called" 0x || ((FAILURES++))
|
||||
+ mustHaveSequence pthread_kill "makeSyscallFromAltSighandler (ignored=" || ((FAILURES++))
|
||||
+
|
||||
+ mustHaveSequence Thread "spin (ignored=" || ((FAILURES++))
|
||||
+
|
||||
+ mustHaveSequence "spinningSighandler (signo=" "signal handler called" 0x || ((FAILURES++))
|
||||
+ mustHaveSequence pthread_kill "spinFromSighandler (ignored=" || ((FAILURES++))
|
||||
+
|
||||
+ mustHaveSequence "spinningAltSighandler (signo=" "signal handler called" 0x || ((FAILURES++))
|
||||
+ mustHaveSequence pthread_kill "spinFromAltSighandler (ignored=" || ((FAILURES++))
|
||||
+
|
||||
+ mustHaveSequence Thread "main (argc=1, argv=" || ((FAILURES++))
|
||||
+
|
||||
+ return $FAILURES
|
||||
+}
|
||||
+
|
||||
+# Put result of debugging a core file in $LOG
|
||||
+function getLogFromCore() {
|
||||
+ # Make sure we get a core file
|
||||
+ ulimit -c unlimited || exit 1
|
||||
+
|
||||
+ # Run the crasher
|
||||
+ ./$(basename "$RUNME")
|
||||
+ EXITCODE=$?
|
||||
+
|
||||
+ # Verify that we actually crashed
|
||||
+ if [ $EXITCODE -lt 128 ] ; then
|
||||
+ echo >> /dev/stderr ERROR: $RUNME should have been killed by a signal, got non-signal exit code $EXITCODE
|
||||
+ exit 1
|
||||
+ fi
|
||||
+
|
||||
+ # Verify that we got a core file
|
||||
+ if [ ! -r core* ] ; then
|
||||
+ echo >> /dev/stderr ERROR: $RUNME did not create a core file
|
||||
+ exit 1
|
||||
+ fi
|
||||
+
|
||||
+ # Run gdb
|
||||
+ cat > gdbscript.gdb <<EOF
|
||||
+set width 0
|
||||
+t a a bt 100
|
||||
+quit
|
||||
+EOF
|
||||
+ cat gdbscript.gdb /dev/zero | gdb -nx "./$(basename "$RUNME")" core* > $LOG
|
||||
+ EXITCODE=$?
|
||||
+
|
||||
+ if [ $EXITCODE != 0 ] ; then
|
||||
+ ((FAILURES++))
|
||||
+ echo >> /dev/stderr WARNING: gdb exited with error code $EXITCODE
|
||||
+ fi
|
||||
+}
|
||||
+
|
||||
+# Put result of debugging a gcore file in $LOG
|
||||
+function getLogFromGcore() {
|
||||
+ # Create the core file
|
||||
+ rm -f core*
|
||||
+ cat > gdbscript.gdb <<EOF
|
||||
+handle SIGQUIT pass noprint nostop
|
||||
+handle SIGUSR1 pass noprint nostop
|
||||
+handle SIGUSR2 pass noprint nostop
|
||||
+handle SIGALRM pass noprint nostop
|
||||
+run
|
||||
+gcore
|
||||
+quit
|
||||
+EOF
|
||||
+ cat gdbscript.gdb /dev/zero | gdb -nx "./$(basename "$RUNME")" > /dev/null
|
||||
+ EXITCODE=$?
|
||||
+
|
||||
+ if [ $EXITCODE != 0 ] ; then
|
||||
+ ((FAILURES++))
|
||||
+ echo >> /dev/stderr WARNING: gdb exited with error code $EXITCODE when creating gcore file
|
||||
+ fi
|
||||
+
|
||||
+ # Verify that we got a core file from gcore
|
||||
+ if [ ! -r core* ] ; then
|
||||
+ echo >> /dev/stderr ERROR: gdb gcore did not create a core file
|
||||
+ exit 1
|
||||
+ fi
|
||||
+
|
||||
+ # Run gdb on the gcore file
|
||||
+ cat > gdbscript.gdb <<EOF
|
||||
+set width 0
|
||||
+t a a bt 100
|
||||
+quit
|
||||
+EOF
|
||||
+ cat gdbscript.gdb /dev/zero | gdb -nx "./$(basename "$RUNME")" core* > $LOG
|
||||
+ EXITCODE=$?
|
||||
+
|
||||
+ if [ $EXITCODE != 0 ] ; then
|
||||
+ ((FAILURES++))
|
||||
+ echo >> /dev/stderr WARNING: gdb exited with error code $EXITCODE when examining gcore file
|
||||
+ fi
|
||||
+}
|
||||
+
|
||||
+# Put result of debugging a core file in $LOG
|
||||
+function getLogFromLiveProcess() {
|
||||
+ # Run gdb
|
||||
+ cat > gdbscript.gdb <<EOF
|
||||
+handle SIGQUIT pass noprint nostop
|
||||
+handle SIGUSR1 pass noprint nostop
|
||||
+handle SIGUSR2 pass noprint nostop
|
||||
+handle SIGALRM pass noprint nostop
|
||||
+set width 0
|
||||
+run
|
||||
+t a a bt 100
|
||||
+quit
|
||||
+EOF
|
||||
+ cat gdbscript.gdb /dev/zero | gdb -nx "./$(basename "$RUNME")" > $LOG
|
||||
+ EXITCODE=$?
|
||||
+
|
||||
+ if [ $EXITCODE != 0 ] ; then
|
||||
+ ((FAILURES++))
|
||||
+ echo >> /dev/stderr WARNING: gdb exited with error code $EXITCODE
|
||||
+ fi
|
||||
+}
|
||||
+
|
||||
+####### Main program follows #####################
|
||||
+
|
||||
+# Make sure we don't clobber anybody else's (core) file(s)
|
||||
+WORKDIR=/tmp/$PPID
|
||||
+mkdir -p $WORKDIR
|
||||
+cp "$RUNME" $WORKDIR
|
||||
+cd $WORKDIR
|
||||
+
|
||||
+# Count problems
|
||||
+FAILURES=0
|
||||
+
|
||||
+echo === Testing gdb vs core file...
|
||||
+getLogFromCore
|
||||
+verifyLog
|
||||
+((FAILURES+=$?))
|
||||
+echo === Core file tests done.
|
||||
+
|
||||
+echo
|
||||
+
|
||||
+echo === Testing gdb vs gcore file...
|
||||
+getLogFromGcore
|
||||
+verifyLog
|
||||
+((FAILURES+=$?))
|
||||
+echo === Gcore file tests done.
|
||||
+
|
||||
+echo
|
||||
+
|
||||
+echo === Testing gdb vs live process...
|
||||
+getLogFromLiveProcess
|
||||
+verifyLog
|
||||
+((FAILURES+=$?))
|
||||
+echo === Live process tests done.
|
||||
+
|
||||
+# Executive summary
|
||||
+echo
|
||||
+if [ $FAILURES == 0 ] ; then
|
||||
+ echo All tests passed!
|
||||
+else
|
||||
+ echo $FAILURES tests failed!
|
||||
+ echo
|
||||
+ echo Make sure the threadcrash binary contains debugging information \(build with \"gcc -g\"\).
|
||||
+fi
|
||||
+
|
||||
+# Clean up
|
||||
+cd /
|
||||
+rm -rf $WORKDIR
|
||||
+
|
||||
+exit $FAILURES
|
134
SOURCES/gdb-6.5-bz109921-DW_AT_decl_file-test.patch
Normal file
134
SOURCES/gdb-6.5-bz109921-DW_AT_decl_file-test.patch
Normal file
@ -0,0 +1,134 @@
|
||||
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.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
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
|
||||
@@ -0,0 +1,26 @@
|
||||
+/* 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 "dw2-included.h"
|
||||
+
|
||||
+int
|
||||
+main()
|
||||
+{
|
||||
+ 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
|
||||
@@ -0,0 +1,47 @@
|
||||
+# 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-included"
|
||||
+set srcfile ${testfile}.c
|
||||
+set binfile [standard_output_file ${testfile}]
|
||||
+
|
||||
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+gdb_exit
|
||||
+gdb_start
|
||||
+gdb_reinitialize_dir $srcdir/$subdir
|
||||
+gdb_load ${binfile}
|
||||
+
|
||||
+gdb_test "set listsize 1" ""
|
||||
+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
|
||||
@@ -0,0 +1,20 @@
|
||||
+/* 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. */
|
||||
+
|
||||
+int integer;
|
264
SOURCES/gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch
Normal file
264
SOURCES/gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch
Normal file
@ -0,0 +1,264 @@
|
||||
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:
|
||||
(gdb) p errno
|
||||
[some error]
|
||||
|
||||
* with -ggdb2 and less "errno" in fact does not exist anywhere as it was
|
||||
compiled to "(*__errno_location ())" and the macro definition is not present.
|
||||
Unfortunately gdb will find the TLS symbol and it will try to access it but
|
||||
as the program has been compiled without -lpthread the TLS base register
|
||||
(%gs on i386) is not setup and it will result in:
|
||||
Cannot access memory at address 0x8
|
||||
|
||||
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>
|
||||
|
||||
* ./gdb/dwarf2read.c (read_partial_die, dwarf2_linkage_name): Prefer
|
||||
DW_AT_MIPS_linkage_name over DW_AT_name now only for non-C.
|
||||
|
||||
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
|
||||
@@ -1190,6 +1190,10 @@ print_command_1 (const char *exp, int voidprint)
|
||||
|
||||
if (exp && *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
|
||||
@@ -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-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 @@
|
||||
+# 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-errno
|
||||
+set srcfile ${testfile}.c
|
||||
+set binfile [standard_output_file ${testfile}]
|
||||
+
|
||||
+proc prep {} {
|
||||
+ global srcdir subdir binfile
|
||||
+ gdb_exit
|
||||
+ gdb_start
|
||||
+ gdb_reinitialize_dir $srcdir/$subdir
|
||||
+ gdb_load ${binfile}
|
||||
+
|
||||
+ runto_main
|
||||
+
|
||||
+ gdb_breakpoint [gdb_get_line_number "breakpoint"]
|
||||
+ gdb_continue_to_breakpoint "breakpoint"
|
||||
+}
|
||||
+
|
||||
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable "additional_flags=-g2"] != "" } {
|
||||
+ untested "Couldn't compile test program"
|
||||
+ return -1
|
||||
+}
|
||||
+prep
|
||||
+gdb_test "print errno" ".* = 42" "errno with macros=N threads=N"
|
||||
+
|
||||
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable "additional_flags=-g3"] != "" } {
|
||||
+ untested "Couldn't compile test program"
|
||||
+ return -1
|
||||
+}
|
||||
+prep
|
||||
+gdb_test "print errno" ".* = 42" "errno with macros=Y threads=N"
|
||||
+
|
||||
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable "additional_flags=-g2"] != "" } {
|
||||
+ return -1
|
||||
+}
|
||||
+prep
|
||||
+gdb_test "print errno" ".* = 42" "errno with macros=N threads=Y"
|
||||
+
|
||||
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable "additional_flags=-g3"] != "" } {
|
||||
+ return -1
|
||||
+}
|
||||
+prep
|
||||
+gdb_test "print errno" ".* = 42" "errno with macros=Y threads=Y"
|
||||
+
|
||||
+# 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?
|
24
SOURCES/gdb-6.5-bz203661-emit-relocs.patch
Normal file
24
SOURCES/gdb-6.5-bz203661-emit-relocs.patch
Normal file
@ -0,0 +1,24 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Fedora GDB patches <invalid@email.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-6.5-bz203661-emit-relocs.patch
|
||||
|
||||
;; Fix debuginfo addresses resolving for --emit-relocs Linux kernels (BZ 203661).
|
||||
;;=push+jan: There was some mail thread about it, this patch may be a hack.
|
||||
|
||||
diff --git a/gdb/symfile.c b/gdb/symfile.c
|
||||
--- a/gdb/symfile.c
|
||||
+++ b/gdb/symfile.c
|
||||
@@ -3584,6 +3584,12 @@ default_symfile_relocate (struct objfile *objfile, asection *sectp,
|
||||
DWO file. */
|
||||
bfd *abfd = sectp->owner;
|
||||
|
||||
+ /* Executable files have all the relocations already resolved.
|
||||
+ Handle files linked with --emit-relocs.
|
||||
+ http://sources.redhat.com/ml/gdb/2006-08/msg00137.html */
|
||||
+ if ((abfd->flags & EXEC_P) != 0)
|
||||
+ return NULL;
|
||||
+
|
||||
/* We're only interested in sections with relocation
|
||||
information. */
|
||||
if ((sectp->flags & SEC_RELOC) == 0)
|
304
SOURCES/gdb-6.5-bz216711-clone-is-outermost.patch
Normal file
304
SOURCES/gdb-6.5-bz216711-clone-is-outermost.patch
Normal file
@ -0,0 +1,304 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-6.5-bz216711-clone-is-outermost.patch
|
||||
|
||||
;; Fix bogus 0x0 unwind of the thread's topmost function clone(3) (BZ 216711).
|
||||
;;=fedora
|
||||
|
||||
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=216711
|
||||
|
||||
FIXME: This workaround should be dropped and
|
||||
glibc/sysdeps/unix/sysv/linux/x86_64/clone.S should get CFI for the child
|
||||
instead.
|
||||
|
||||
2006-12-17 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* gdb/amd64-linux-tdep.c (linux_clone_code): New variable.
|
||||
(LINUX_CLONE_LEN): New definition.
|
||||
(amd64_linux_clone_running, amd64_linux_outermost_frame): New function.
|
||||
(amd64_linux_init_abi): Initialize `outermost_frame_p'.
|
||||
* gdb/i386-tdep.c (i386_gdbarch_init): Likewise.
|
||||
* gdb/i386-tdep.h (gdbarch_tdep): Add `outermost_frame_p' member.
|
||||
* gdb/amd64-tdep.c (amd64_frame_this_id): Call `outermost_frame_p'.
|
||||
|
||||
2006-12-17 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* gdb.threads/bt-clone-stop.exp, gdb.threads/bt-clone-stop.c:
|
||||
New file.
|
||||
|
||||
2007-10-16 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
Port to GDB-6.7.
|
||||
|
||||
diff --git a/gdb/amd64-linux-tdep.c b/gdb/amd64-linux-tdep.c
|
||||
--- a/gdb/amd64-linux-tdep.c
|
||||
+++ b/gdb/amd64-linux-tdep.c
|
||||
@@ -291,6 +291,80 @@ amd64_linux_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
|
||||
|
||||
/* Set the program counter for process PTID to PC. */
|
||||
|
||||
+/* Detect the outermost frame; during unwind of
|
||||
+ #5 0x000000305cec68c3 in clone () from /lib64/tls/libc.so.6
|
||||
+ avoid the additional bogus frame
|
||||
+ #6 0x0000000000000000 in ??
|
||||
+ We compare if the `linux_clone_code' block is _before_ unwound PC. */
|
||||
+
|
||||
+static const unsigned char linux_clone_code[] =
|
||||
+{
|
||||
+/* libc/sysdeps/unix/sysv/linux/x86_64/clone.S */
|
||||
+/* #ifdef RESET_PID */
|
||||
+/* ... */
|
||||
+/* mov $SYS_ify(getpid), %eax */
|
||||
+/* 0xb8, 0x27, 0x00, 0x00, 0x00 */
|
||||
+/* OR */
|
||||
+/* mov $SYS_ify(getpid), %rax */
|
||||
+/* 0x48, 0xc7, 0xc0, 0x27, 0x00, 0x00, 0x00 */
|
||||
+/* so just: */
|
||||
+ 0x27, 0x00, 0x00, 0x00,
|
||||
+/* syscall */
|
||||
+ 0x0f, 0x05,
|
||||
+/* movl %eax, %fs:PID */
|
||||
+ 0x64, 0x89, 0x04, 0x25, 0x94, 0x00, 0x00, 0x00,
|
||||
+/* movl %eax, %fs:TID */
|
||||
+ 0x64, 0x89, 0x04, 0x25, 0x90, 0x00, 0x00, 0x00,
|
||||
+/* #endif */
|
||||
+/* |* Set up arguments for the function call. *| */
|
||||
+/* popq %rax |* Function to call. *| */
|
||||
+ 0x58,
|
||||
+/* popq %rdi |* Argument. *| */
|
||||
+ 0x5f,
|
||||
+/* call *%rax$ */
|
||||
+ 0xff, 0xd0
|
||||
+};
|
||||
+
|
||||
+#define LINUX_CLONE_LEN (sizeof linux_clone_code)
|
||||
+
|
||||
+static int
|
||||
+amd64_linux_clone_running (struct frame_info *this_frame)
|
||||
+{
|
||||
+ CORE_ADDR pc = get_frame_pc (this_frame);
|
||||
+ unsigned char buf[LINUX_CLONE_LEN];
|
||||
+
|
||||
+ if (!safe_frame_unwind_memory (this_frame, pc - LINUX_CLONE_LEN, buf,
|
||||
+ LINUX_CLONE_LEN))
|
||||
+ return 0;
|
||||
+
|
||||
+ if (memcmp (buf, linux_clone_code, LINUX_CLONE_LEN) != 0)
|
||||
+ return 0;
|
||||
+
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+amd64_linux_outermost_frame (struct frame_info *this_frame)
|
||||
+{
|
||||
+ CORE_ADDR pc = get_frame_pc (this_frame);
|
||||
+ const char *name;
|
||||
+
|
||||
+ find_pc_partial_function (pc, &name, NULL, NULL);
|
||||
+
|
||||
+ /* If we have NAME, we can optimize the search.
|
||||
+ `clone' NAME still needs to have the code checked as its name may be
|
||||
+ present in the user code.
|
||||
+ `__clone' NAME should not be present in the user code but in the initial
|
||||
+ parts of the `__clone' implementation the unwind still makes sense.
|
||||
+ More detailed unwinding decision would be too much sensitive to possible
|
||||
+ subtle changes in specific glibc revisions. */
|
||||
+ if (name == NULL || strcmp (name, "clone") == 0
|
||||
+ || strcmp ("__clone", name) == 0)
|
||||
+ return (amd64_linux_clone_running (this_frame) != 0);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
static void
|
||||
amd64_linux_write_pc (struct regcache *regcache, CORE_ADDR pc)
|
||||
{
|
||||
@@ -1808,6 +1882,8 @@ amd64_linux_init_abi_common(struct gdbarch_info info, struct gdbarch *gdbarch)
|
||||
|
||||
tdep->xsave_xcr0_offset = I386_LINUX_XSAVE_XCR0_OFFSET;
|
||||
|
||||
+ tdep->outermost_frame_p = amd64_linux_outermost_frame;
|
||||
+
|
||||
/* Add the %orig_rax register used for syscall restarting. */
|
||||
set_gdbarch_write_pc (gdbarch, amd64_linux_write_pc);
|
||||
|
||||
diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c
|
||||
--- a/gdb/amd64-tdep.c
|
||||
+++ b/gdb/amd64-tdep.c
|
||||
@@ -2595,6 +2595,7 @@ amd64_frame_unwind_stop_reason (struct frame_info *this_frame,
|
||||
{
|
||||
struct amd64_frame_cache *cache =
|
||||
amd64_frame_cache (this_frame, this_cache);
|
||||
+ struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (this_frame));
|
||||
|
||||
if (!cache->base_p)
|
||||
return UNWIND_UNAVAILABLE;
|
||||
@@ -2603,6 +2604,10 @@ amd64_frame_unwind_stop_reason (struct frame_info *this_frame,
|
||||
if (cache->base == 0)
|
||||
return UNWIND_OUTERMOST;
|
||||
|
||||
+ /* Detect OS dependent outermost frames; such as `clone'. */
|
||||
+ if (tdep->outermost_frame_p && tdep->outermost_frame_p (this_frame))
|
||||
+ return UNWIND_OUTERMOST;
|
||||
+
|
||||
return UNWIND_NO_REASON;
|
||||
}
|
||||
|
||||
@@ -2737,6 +2742,7 @@ amd64_sigtramp_frame_this_id (struct frame_info *this_frame,
|
||||
{
|
||||
struct amd64_frame_cache *cache =
|
||||
amd64_sigtramp_frame_cache (this_frame, this_cache);
|
||||
+ struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (this_frame));
|
||||
|
||||
if (!cache->base_p)
|
||||
(*this_id) = frame_id_build_unavailable_stack (get_frame_pc (this_frame));
|
||||
@@ -2745,6 +2751,11 @@ amd64_sigtramp_frame_this_id (struct frame_info *this_frame,
|
||||
/* This marks the outermost frame. */
|
||||
return;
|
||||
}
|
||||
+ else if (tdep->outermost_frame_p && tdep->outermost_frame_p (this_frame))
|
||||
+ {
|
||||
+ /* Detect OS dependent outermost frames; such as `clone'. */
|
||||
+ return;
|
||||
+ }
|
||||
else
|
||||
(*this_id) = frame_id_build (cache->base + 16, get_frame_pc (this_frame));
|
||||
}
|
||||
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
|
||||
--- a/gdb/i386-tdep.c
|
||||
+++ b/gdb/i386-tdep.c
|
||||
@@ -8406,6 +8406,9 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
|
||||
|
||||
tdep->xsave_xcr0_offset = -1;
|
||||
|
||||
+ /* Unwinding stops on i386 automatically. */
|
||||
+ tdep->outermost_frame_p = NULL;
|
||||
+
|
||||
tdep->record_regmap = i386_record_regmap;
|
||||
|
||||
set_gdbarch_type_align (gdbarch, i386_type_align);
|
||||
diff --git a/gdb/i386-tdep.h b/gdb/i386-tdep.h
|
||||
--- a/gdb/i386-tdep.h
|
||||
+++ b/gdb/i386-tdep.h
|
||||
@@ -251,6 +251,9 @@ struct gdbarch_tdep
|
||||
|
||||
/* Regsets. */
|
||||
const struct regset *fpregset;
|
||||
+
|
||||
+ /* Detect OS dependent outermost frames; such as `clone'. */
|
||||
+ int (*outermost_frame_p) (struct frame_info *this_frame);
|
||||
};
|
||||
|
||||
/* Floating-point registers. */
|
||||
diff --git a/gdb/testsuite/gdb.threads/bt-clone-stop.c b/gdb/testsuite/gdb.threads/bt-clone-stop.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.threads/bt-clone-stop.c
|
||||
@@ -0,0 +1,39 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2006 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 2 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program; if not, write to the Free Software
|
||||
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
+ MA 02110-1301, USA. */
|
||||
+
|
||||
+
|
||||
+#include <pthread.h>
|
||||
+#include <unistd.h>
|
||||
+#include <assert.h>
|
||||
+
|
||||
+
|
||||
+void *threader (void *arg)
|
||||
+{
|
||||
+ assert (0);
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
+int main (void)
|
||||
+{
|
||||
+ pthread_t t1;
|
||||
+
|
||||
+ pthread_create (&t1, NULL, threader, (void *) NULL);
|
||||
+ for (;;)
|
||||
+ pause();
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.threads/bt-clone-stop.exp b/gdb/testsuite/gdb.threads/bt-clone-stop.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.threads/bt-clone-stop.exp
|
||||
@@ -0,0 +1,61 @@
|
||||
+# Copyright 2006 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 2 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program; if not, write to the Free Software
|
||||
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
+
|
||||
+# Backtraced `clone' must not have `PC == 0' as its previous frame.
|
||||
+
|
||||
+if $tracelevel then {
|
||||
+ strace $tracelevel
|
||||
+}
|
||||
+
|
||||
+set testfile bt-clone-stop
|
||||
+set srcfile ${testfile}.c
|
||||
+set binfile [standard_output_file ${testfile}]
|
||||
+if { [gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
|
||||
+ untested "Couldn't compile test program"
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+# Get things started.
|
||||
+
|
||||
+gdb_exit
|
||||
+gdb_start
|
||||
+gdb_reinitialize_dir $srcdir/$subdir
|
||||
+gdb_load ${binfile}
|
||||
+
|
||||
+# threader: threader.c:8: threader: Assertion `0' failed.
|
||||
+# Program received signal SIGABRT, Aborted.
|
||||
+
|
||||
+gdb_test "run" \
|
||||
+ {Thread 2 "bt-clone-stop" received signal SIGABRT.*} \
|
||||
+ "run"
|
||||
+
|
||||
+# Former gdb unwind (the first function is `clone'):
|
||||
+# #5 0x0000003421ecd62d in ?? () from /lib64/libc.so.6
|
||||
+# #6 0x0000000000000000 in ?? ()
|
||||
+# (gdb)
|
||||
+# Tested `amd64_linux_outermost_frame' functionality should omit the line `#6'.
|
||||
+#
|
||||
+# Two `-re' cases below must be in this order (1st is a subset of the 2nd one).
|
||||
+# Unhandled case below should not happen and it is fortunately handled by
|
||||
+# `amd64_linux_outermost_frame' as FAIL (and result `0x0 entry output invalid').
|
||||
+gdb_test_multiple "bt" "0x0 entry output invalid" {
|
||||
+ -re "in threader \\(.*\n#\[0-9\]* *0x0* in .*$gdb_prompt $" {
|
||||
+ fail "0x0 entry found"
|
||||
+ }
|
||||
+ -re "in threader \\(.*$gdb_prompt $" {
|
||||
+ pass "0x0 entry not found"
|
||||
+ }
|
||||
+}
|
102
SOURCES/gdb-6.5-bz218379-ppc-solib-trampoline-test.patch
Normal file
102
SOURCES/gdb-6.5-bz218379-ppc-solib-trampoline-test.patch
Normal file
@ -0,0 +1,102 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Fedora GDB patches <invalid@email.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-6.5-bz218379-ppc-solib-trampoline-test.patch
|
||||
|
||||
;; Test sideeffects of skipping ppc .so libs trampolines (BZ 218379).
|
||||
;;=fedoratest
|
||||
|
||||
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=218379
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/step-over-trampoline.c b/gdb/testsuite/gdb.base/step-over-trampoline.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/step-over-trampoline.c
|
||||
@@ -0,0 +1,28 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2006 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 2 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program; if not, write to the Free Software
|
||||
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
+
|
||||
+ Please email any bugs, comments, and/or additions to this file to:
|
||||
+ bug-gdb@prep.ai.mit.edu */
|
||||
+
|
||||
+#include <stdio.h>
|
||||
+
|
||||
+int main (void)
|
||||
+{
|
||||
+ puts ("hello world");
|
||||
+ return 0;
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.base/step-over-trampoline.exp b/gdb/testsuite/gdb.base/step-over-trampoline.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/step-over-trampoline.exp
|
||||
@@ -0,0 +1,54 @@
|
||||
+# Copyright 2006 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 2 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program; if not, write to the Free Software
|
||||
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
+
|
||||
+if $tracelevel then {
|
||||
+ strace $tracelevel
|
||||
+}
|
||||
+
|
||||
+set testfile step-over-trampoline
|
||||
+set srcfile ${testfile}.c
|
||||
+set binfile [standard_output_file ${testfile}]
|
||||
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
|
||||
+ untested "Couldn't compile test program"
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+# Get things started.
|
||||
+
|
||||
+gdb_exit
|
||||
+gdb_start
|
||||
+gdb_reinitialize_dir $srcdir/$subdir
|
||||
+gdb_load ${binfile}
|
||||
+
|
||||
+# For C programs, "start" should stop in main().
|
||||
+
|
||||
+gdb_test "start" \
|
||||
+ "main \\(\\) at .*$srcfile.*" \
|
||||
+ "start"
|
||||
+
|
||||
+# main () at hello2.c:5
|
||||
+# 5 puts("hello world\n");
|
||||
+# (gdb) next
|
||||
+# 0x100007e0 in call___do_global_ctors_aux ()
|
||||
+
|
||||
+gdb_test_multiple "next" "invalid `next' output" {
|
||||
+ -re "\nhello world.*return 0;.*" {
|
||||
+ pass "stepped over"
|
||||
+ }
|
||||
+ -re " in call___do_global_ctors_aux \\(\\).*" {
|
||||
+ fail "stepped into trampoline"
|
||||
+ }
|
||||
+}
|
@ -0,0 +1,27 @@
|
||||
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
|
||||
@@ -3165,6 +3165,13 @@ find_pc_sect_line (CORE_ADDR pc, struct obj_section *section, int notcurrent)
|
||||
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_LINKAGE_NAME (msymbol.minsym), paddress (target_gdbarch (), pc));
|
||||
+ /* fall through */
|
||||
else
|
||||
return find_pc_line (BMSYMBOL_VALUE_ADDRESS (mfunsym), 0);
|
||||
}
|
88
SOURCES/gdb-6.5-bz243845-stale-testing-zombie-test.patch
Normal file
88
SOURCES/gdb-6.5-bz243845-stale-testing-zombie-test.patch
Normal file
@ -0,0 +1,88 @@
|
||||
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
|
||||
+}
|
149
SOURCES/gdb-6.5-gcore-buffer-limit-test.patch
Normal file
149
SOURCES/gdb-6.5-gcore-buffer-limit-test.patch
Normal file
@ -0,0 +1,149 @@
|
||||
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
|
130
SOURCES/gdb-6.5-ia64-libunwind-leak-test.patch
Normal file
130
SOURCES/gdb-6.5-ia64-libunwind-leak-test.patch
Normal file
@ -0,0 +1,130 @@
|
||||
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
|
||||
+ }
|
||||
+}
|
62
SOURCES/gdb-6.5-last-address-space-byte-test.patch
Normal file
62
SOURCES/gdb-6.5-last-address-space-byte-test.patch
Normal file
@ -0,0 +1,62 @@
|
||||
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
|
||||
@@ -0,0 +1,49 @@
|
||||
+# 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
|
||||
+}
|
||||
+
|
||||
+# Get things started.
|
||||
+
|
||||
+gdb_exit
|
||||
+gdb_start
|
||||
+
|
||||
+# i386 (32-bit) only: gdb with Red Hat largecore patch did lock up:
|
||||
+# https://enterprise.redhat.com/issue-tracker/?module=issues&action=view&tid=103263
|
||||
+# https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=210614
|
||||
+
|
||||
+# i386: Bug exists when the `target_xfer_memory' condition
|
||||
+# `(memaddr + len < region->hi)' operates on 64-bit operands on
|
||||
+# largecore-patched with 32-bit addresses and so it can get `false' with
|
||||
+# arbitrary `len'.
|
||||
+
|
||||
+# x86_64: The bug is not present as the operands and calculations have the same
|
||||
+# bit size. Would would still need to pass there the highest address
|
||||
+# (`memaddr == 0xffffffffffffffff') but we would need to pass `len == 0'
|
||||
+# to make the condition `(memaddr + len < region->hi)' false.
|
||||
+# `len == 0' would get caught eariler.
|
||||
+
|
||||
+# Error in the success case is immediate.
|
||||
+set timeoutold ${timeout}
|
||||
+set timeout 10
|
||||
+
|
||||
+gdb_test "x/xb 0xffffffff" \
|
||||
+ "Cannot access memory at address 0xffffffff" \
|
||||
+ "Read the last address space byte"
|
||||
+
|
||||
+set timeout ${timeoutold}
|
95
SOURCES/gdb-6.5-missed-trap-on-step-test.patch
Normal file
95
SOURCES/gdb-6.5-missed-trap-on-step-test.patch
Normal file
@ -0,0 +1,95 @@
|
||||
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-missed-trap-on-step-test.patch
|
||||
|
||||
;; Test hiding unexpected breakpoints on intentional step commands.
|
||||
;;=fedoratest
|
||||
|
||||
Fix has been committed to:
|
||||
gdb-6.6-scheduler_locking-step-sw-watchpoints2.patch
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/watchpoint-during-step.c b/gdb/testsuite/gdb.base/watchpoint-during-step.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/watchpoint-during-step.c
|
||||
@@ -0,0 +1,30 @@
|
||||
+/* 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 */
|
||||
+
|
||||
+static int var;
|
||||
+
|
||||
+int main()
|
||||
+{
|
||||
+ var = 1;
|
||||
+ var = 2;
|
||||
+ var = 3;
|
||||
+ return 0;
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.base/watchpoint-during-step.exp b/gdb/testsuite/gdb.base/watchpoint-during-step.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/watchpoint-during-step.exp
|
||||
@@ -0,0 +1,44 @@
|
||||
+# 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 watchpoint-during-step
|
||||
+set srcfile ${testfile}.c
|
||||
+set binfile [standard_output_file ${testfile}]
|
||||
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
|
||||
+ untested "Couldn't compile test program"
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+# Get things started.
|
||||
+
|
||||
+gdb_exit
|
||||
+gdb_start
|
||||
+gdb_reinitialize_dir $srcdir/$subdir
|
||||
+gdb_load ${binfile}
|
||||
+
|
||||
+runto_main
|
||||
+
|
||||
+gdb_breakpoint [gdb_get_line_number "var = 2"]
|
||||
+gdb_continue_to_breakpoint "Find the first var set"
|
||||
+
|
||||
+gdb_test "step" ".*var = 3;" "Step to the next var set"
|
||||
+
|
||||
+gdb_test "watch var" "atchpoint .*: var" "Set the watchpoint"
|
||||
+
|
||||
+# Here is the target point. Be careful to not have breakpoint set on the line
|
||||
+# we step from as in this case it is a valid upstream KFAIL gdb/38
|
||||
+
|
||||
+gdb_test "step" ".*Old value = 2.*New value = 3.*" "Catch the watchpoint"
|
141
SOURCES/gdb-6.5-readline-long-line-crash-test.patch
Normal file
141
SOURCES/gdb-6.5-readline-long-line-crash-test.patch
Normal file
@ -0,0 +1,141 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Fedora GDB patches <invalid@email.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-6.5-readline-long-line-crash-test.patch
|
||||
|
||||
;; Fix readline segfault on excessively long hand-typed lines.
|
||||
;;=fedoratest
|
||||
|
||||
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=214196
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/readline-overflow.exp b/gdb/testsuite/gdb.base/readline-overflow.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/readline-overflow.exp
|
||||
@@ -0,0 +1,126 @@
|
||||
+# Copyright 2006 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 2 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program; if not, write to the Free Software
|
||||
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
+
|
||||
+# Please email any bugs, comments, and/or additions to this file to:
|
||||
+# bug-gdb@prep.ai.mit.edu
|
||||
+
|
||||
+# This file was written by Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
+
|
||||
+# This file is part of the gdb testsuite.
|
||||
+
|
||||
+#
|
||||
+# Tests for readline buffer overflow.
|
||||
+#
|
||||
+
|
||||
+if $tracelevel {
|
||||
+ strace $tracelevel
|
||||
+}
|
||||
+
|
||||
+# Don't let a .inputrc file or an existing setting of INPUTRC mess up
|
||||
+# the test results. Even if /dev/null doesn't exist on the particular
|
||||
+# platform, the readline library will use the default setting just by
|
||||
+# failing to open the file. OTOH, opening /dev/null successfully will
|
||||
+# also result in the default settings being used since nothing will be
|
||||
+# read from this file.
|
||||
+global env
|
||||
+if [info exists env(INPUTRC)] {
|
||||
+ set old_inputrc $env(INPUTRC)
|
||||
+}
|
||||
+set env(INPUTRC) "/dev/null"
|
||||
+
|
||||
+set oldtimeout1 $timeout
|
||||
+set timeout 600
|
||||
+
|
||||
+if [info exists env(GDBHISTFILE)] {
|
||||
+ set old_gdbhistfile $env(GDBHISTFILE)
|
||||
+}
|
||||
+if [info exists env(HISTSIZE)] {
|
||||
+ set old_histsize $env(HISTSIZE)
|
||||
+}
|
||||
+set env(GDBHISTFILE) "${srcdir}/${subdir}/gdb_history"
|
||||
+set env(HISTSIZE) "10"
|
||||
+
|
||||
+gdb_exit
|
||||
+gdb_start
|
||||
+gdb_reinitialize_dir $srcdir/$subdir
|
||||
+
|
||||
+
|
||||
+set width 11
|
||||
+gdb_test "set width $width" \
|
||||
+ "" \
|
||||
+ "Setting width to $width."
|
||||
+#gdb_test "set height 1" \
|
||||
+# "" \
|
||||
+# "Setting height to 1."
|
||||
+send_gdb "run X"
|
||||
+set i 0
|
||||
+# It crashes using `set width 7' on `set total 3560'.
|
||||
+# Sometimes it corrupts screen on `set width 7'.
|
||||
+# Bugreport used `set total 130001':
|
||||
+# https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=214196
|
||||
+# Check also `timeout' above.
|
||||
+set total 4200
|
||||
+gdb_expect {
|
||||
+ -re X {
|
||||
+ incr i
|
||||
+ if {$i <= $total} {
|
||||
+ send_gdb "X"
|
||||
+ exp_continue
|
||||
+ }
|
||||
+ }
|
||||
+ -re "\[ \b\r\n\]" {
|
||||
+ exp_continue
|
||||
+ }
|
||||
+ eof {
|
||||
+ fail "gdb sending total $total characters"
|
||||
+ note "Failed after sending $i characters, reason: EOF"
|
||||
+ gdb_clear_suppressed
|
||||
+ }
|
||||
+ timeout {
|
||||
+ fail "gdb sending total $total characters"
|
||||
+ note "Failed after sending $i characters (timeout $timeout), reason: TIMEOUT"
|
||||
+ gdb_clear_suppressed
|
||||
+ }
|
||||
+ default {
|
||||
+ fail "gdb sending total $total characters"
|
||||
+ note "Failed after sending $i characters, reason: 0=\[$expect_out(0,string)\] buffer=\[$expect_out(buffer)\]"
|
||||
+ gdb_clear_suppressed
|
||||
+ }
|
||||
+}
|
||||
+send_gdb "\r"
|
||||
+gdb_test "" \
|
||||
+ "No executable file specified..*" \
|
||||
+ "All the characters transferred"
|
||||
+
|
||||
+
|
||||
+# Restore globals modified in this test...
|
||||
+if [info exists old_inputrc] {
|
||||
+ set env(INPUTRC) $old_inputrc
|
||||
+} else {
|
||||
+ unset env(INPUTRC)
|
||||
+}
|
||||
+if [info exists old_gdbhistfile] {
|
||||
+ set env(GDBHISTFILE) $old_gdbhistfile
|
||||
+} else {
|
||||
+ unset env(GDBHISTFILE)
|
||||
+}
|
||||
+if [info exists old_histsize] {
|
||||
+ set env(HISTSIZE) $old_histsize
|
||||
+} else {
|
||||
+ unset env(HISTSIZE)
|
||||
+}
|
||||
+set timeout $oldtimeout1
|
||||
+
|
122
SOURCES/gdb-6.5-section-num-fixup-test.patch
Normal file
122
SOURCES/gdb-6.5-section-num-fixup-test.patch
Normal file
@ -0,0 +1,122 @@
|
||||
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"
|
180
SOURCES/gdb-6.5-sharedlibrary-path.patch
Normal file
180
SOURCES/gdb-6.5-sharedlibrary-path.patch
Normal file
@ -0,0 +1,180 @@
|
||||
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
|
||||
@@ -0,0 +1,25 @@
|
||||
+/* 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 */
|
||||
+
|
||||
+int main()
|
||||
+{
|
||||
+ 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
|
||||
@@ -0,0 +1,22 @@
|
||||
+/* 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 */
|
||||
+
|
||||
+__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 @@
|
||||
+# 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 tls-sepdebug
|
||||
+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]
|
||||
+
|
||||
+# Use explicit -soname as otherwise the full path to the library would get
|
||||
+# encoded into ${binmainfile} making LD_LIBRARY_PATH tests useless.
|
||||
+
|
||||
+# FIXME: gcc dependency (-Wl,-soname).
|
||||
+
|
||||
+if { [gdb_compile_shlib "${srcdir}/${subdir}/${srcsharedfile}" "${binsharedfile}" [list debug additional_flags=-Wl,-soname=${binsharedbase}]] != "" } {
|
||||
+ untested "Couldn't compile test library"
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+# eu-strip(1) works fine but it is a part of `elfutils', not `binutils'.
|
||||
+if 0 then {
|
||||
+ remote_exec build "eu-strip -f ${binshareddebugfile} ${binsharedfile}"
|
||||
+} else {
|
||||
+ remote_exec build "objcopy --only-keep-debug ${binsharedfile} ${binshareddebugfile}"
|
||||
+ remote_exec build "objcopy --strip-debug ${binsharedfile}"
|
||||
+ 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}] != "" } {
|
||||
+ untested "Couldn't compile test program"
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+# Get things started.
|
||||
+
|
||||
+# Test also the proper resolving of relative library names to absolute ones.
|
||||
+# \$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 } {
|
||||
+
|
||||
+ gdb_exit
|
||||
+ gdb_start
|
||||
+ ###gdb_reinitialize_dir $srcdir/$subdir
|
||||
+
|
||||
+ gdb_test "set env LD_LIBRARY_PATH=$ld_library_path" \
|
||||
+ "" \
|
||||
+ "set env LD_LIBRARY_PATH is $name"
|
||||
+
|
||||
+ gdb_load ${binmainfile}
|
||||
+
|
||||
+ # For C programs, "start" should stop in main().
|
||||
+
|
||||
+ gdb_test "start" \
|
||||
+ "main \\(\\) at .*${srcmainfile}.*" \
|
||||
+ "start"
|
||||
+
|
||||
+ # Check for: Cannot find shared library `/usr/lib/debug/lib/libc-2.4.90.so.debug' in dynamic linker's load module list
|
||||
+ # as happens with TLS variables and `separate_debug_objfile_backlink'.
|
||||
+
|
||||
+ gdb_test "print var" \
|
||||
+ "\\\$1 = \[0-9\].*" \
|
||||
+ "print TLS variable from a shared library with $name-directory separate debug info file"
|
||||
+}
|
197
SOURCES/gdb-6.6-buildid-locate-core-as-arg.patch
Normal file
197
SOURCES/gdb-6.6-buildid-locate-core-as-arg.patch
Normal file
@ -0,0 +1,197 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Fedora GDB patches <invalid@email.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-6.6-buildid-locate-core-as-arg.patch
|
||||
|
||||
;;=push+jan
|
||||
|
||||
http://sourceware.org/ml/gdb-patches/2010-01/msg00558.html
|
||||
|
||||
[ Fixed up since the mail. ]
|
||||
|
||||
On Thu, 21 Jan 2010 18:17:15 +0100, Doug Evans wrote:
|
||||
> Not an exhaustive list, but if we go down the path of converting "gdb
|
||||
> corefile" to "gdb -c corefile", then we also need to think about "file
|
||||
> corefile" being converted to "core corefile" [or "target core
|
||||
> corefile", "core" is apparently deprecated in favor of "target core"]
|
||||
> and "target exec corefile" -> "target core corefile". Presumably
|
||||
> "file corefile" (and "target exec corefile") would discard the
|
||||
> currently selected executable. But maybe not. Will that be confusing
|
||||
> for users? I don't know.
|
||||
|
||||
While thinking about it overriding some GDB _commands_ was not my intention.
|
||||
|
||||
There is a general assumption if I have a shell COMMAND and some FILE I can do
|
||||
$ COMMAND FILE
|
||||
and COMMAND will appropriately load the FILE.
|
||||
|
||||
FSF GDB currently needs to specify also the executable file for core files
|
||||
which already inhibits this intuitive expectation. OTOH with the build-id
|
||||
locating patch which could allow such intuitive start notneeding the
|
||||
executable file. Still it currently did not work due to the required "-c":
|
||||
$ COMMAND -c COREFILE
|
||||
|
||||
Entering "file", "core-file" or "attach" commands is already explicit enough
|
||||
so that it IMO should do what the command name says without any
|
||||
autodetections. The second command line argument
|
||||
(captured_main->pid_or_core_arg) is also autodetected (for PID or CORE) but
|
||||
neither "attach" accepts a core file nor "core-file" accepts a PID.
|
||||
|
||||
The patch makes sense only with the build-id patchset so this is not submit
|
||||
for FSF GDB inclusion yet. I am fine with your patch (+/- Hui Zhu's pending
|
||||
bfd_check_format_matches) as the patch below is its natural extension.
|
||||
|
||||
Sorry for the delay,
|
||||
Jan
|
||||
|
||||
2010-01-25 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* exceptions.h (enum errors <IS_CORE_ERROR>): New.
|
||||
* exec.c: Include exceptions.h.
|
||||
(exec_file_attach <bfd_core>): Call throw_error (IS_CORE_ERROR, ...).
|
||||
* main.c (exec_or_core_file_attach): New.
|
||||
(captured_main <optind < argc>): Set also corearg.
|
||||
(captured_main <strcmp (execarg, symarg) == 0>): New variable func.
|
||||
Call exec_or_core_file_attach if COREARG matches EXECARG. Call
|
||||
symbol_file_add_main only if CORE_BFD remained NULL.
|
||||
|
||||
Http://sourceware.org/ml/gdb-patches/2010-01/msg00517.html
|
||||
2010-01-20 Doug Evans <dje@google.com>
|
||||
|
||||
* exec.c (exec_file_attach): Print a more useful error message if the
|
||||
user did "gdb core".
|
||||
|
||||
diff --git a/gdb/common/common-exceptions.h b/gdb/common/common-exceptions.h
|
||||
--- a/gdb/common/common-exceptions.h
|
||||
+++ b/gdb/common/common-exceptions.h
|
||||
@@ -104,6 +104,9 @@ enum errors {
|
||||
"_ERROR" is appended to the name. */
|
||||
MAX_COMPLETIONS_REACHED_ERROR,
|
||||
|
||||
+ /* Attempt to load a core file as executable. */
|
||||
+ IS_CORE_ERROR,
|
||||
+
|
||||
/* Add more errors here. */
|
||||
NR_ERRORS
|
||||
};
|
||||
diff --git a/gdb/exec.c b/gdb/exec.c
|
||||
--- a/gdb/exec.c
|
||||
+++ b/gdb/exec.c
|
||||
@@ -36,6 +36,7 @@
|
||||
#include "gdb_bfd.h"
|
||||
#include "gcore.h"
|
||||
#include "source.h"
|
||||
+#include "exceptions.h"
|
||||
|
||||
#include <fcntl.h>
|
||||
#include "readline/readline.h"
|
||||
@@ -357,12 +358,27 @@ exec_file_attach (const char *filename, int from_tty)
|
||||
|
||||
if (!bfd_check_format_matches (exec_bfd, bfd_object, &matching))
|
||||
{
|
||||
+ int is_core;
|
||||
+
|
||||
+ /* If the user accidentally did "gdb core", print a useful
|
||||
+ error message. Check it only after bfd_object has been checked as
|
||||
+ a valid executable may get recognized for example also as
|
||||
+ "trad-core". */
|
||||
+ is_core = bfd_check_format (exec_bfd, bfd_core);
|
||||
+
|
||||
/* Make sure to close exec_bfd, or else "run" might try to use
|
||||
it. */
|
||||
exec_close ();
|
||||
- error (_("\"%s\": not in executable format: %s"),
|
||||
- scratch_pathname,
|
||||
- gdb_bfd_errmsg (bfd_get_error (), matching));
|
||||
+
|
||||
+ if (is_core != 0)
|
||||
+ throw_error (IS_CORE_ERROR,
|
||||
+ _("\"%s\" is a core file.\n"
|
||||
+ "Please specify an executable to debug."),
|
||||
+ scratch_pathname);
|
||||
+ else
|
||||
+ error (_("\"%s\": not in executable format: %s"),
|
||||
+ scratch_pathname,
|
||||
+ gdb_bfd_errmsg (bfd_get_error (), matching));
|
||||
}
|
||||
|
||||
if (build_section_table (exec_bfd, §ions, §ions_end))
|
||||
diff --git a/gdb/main.c b/gdb/main.c
|
||||
--- a/gdb/main.c
|
||||
+++ b/gdb/main.c
|
||||
@@ -447,6 +447,37 @@ struct cmdarg
|
||||
char *string;
|
||||
};
|
||||
|
||||
+/* Call exec_file_attach. If it detected FILENAME is a core file call
|
||||
+ core_file_command. Print the original exec_file_attach error only if
|
||||
+ core_file_command failed to find a matching executable. */
|
||||
+
|
||||
+static void
|
||||
+exec_or_core_file_attach (const char *filename, int from_tty)
|
||||
+{
|
||||
+ volatile struct gdb_exception e;
|
||||
+
|
||||
+ gdb_assert (exec_bfd == NULL);
|
||||
+
|
||||
+ TRY
|
||||
+ {
|
||||
+ exec_file_attach (filename, from_tty);
|
||||
+ }
|
||||
+ CATCH (e, RETURN_MASK_ALL)
|
||||
+ {
|
||||
+ if (e.error == IS_CORE_ERROR)
|
||||
+ {
|
||||
+ core_file_command ((char *) filename, from_tty);
|
||||
+
|
||||
+ /* Iff the core file found its executable suppress the error message
|
||||
+ from exec_file_attach. */
|
||||
+ if (exec_bfd != NULL)
|
||||
+ return;
|
||||
+ }
|
||||
+ throw_exception (e);
|
||||
+ }
|
||||
+ END_CATCH
|
||||
+}
|
||||
+
|
||||
static void
|
||||
captured_main_1 (struct captured_main_args *context)
|
||||
{
|
||||
@@ -883,6 +914,8 @@ captured_main_1 (struct captured_main_args *context)
|
||||
{
|
||||
symarg = argv[optind];
|
||||
execarg = argv[optind];
|
||||
+ if (optind + 1 == argc && corearg == NULL)
|
||||
+ corearg = argv[optind];
|
||||
optind++;
|
||||
}
|
||||
|
||||
@@ -1033,11 +1066,25 @@ captured_main_1 (struct captured_main_args *context)
|
||||
&& symarg != NULL
|
||||
&& strcmp (execarg, symarg) == 0)
|
||||
{
|
||||
+ catch_command_errors_const_ftype *func;
|
||||
+
|
||||
+ /* Call exec_or_core_file_attach only if the file was specified as
|
||||
+ a command line argument (and not an a command line option). */
|
||||
+ if (corearg != NULL && strcmp (corearg, execarg) == 0)
|
||||
+ {
|
||||
+ func = exec_or_core_file_attach;
|
||||
+ corearg = NULL;
|
||||
+ }
|
||||
+ else
|
||||
+ func = exec_file_attach;
|
||||
+
|
||||
/* The exec file and the symbol-file are the same. If we can't
|
||||
open it, better only print one error message.
|
||||
- catch_command_errors returns non-zero on success! */
|
||||
- if (catch_command_errors (exec_file_attach, execarg,
|
||||
- !batch_flag))
|
||||
+ catch_command_errors returns non-zero on success!
|
||||
+ Do not load EXECARG as a symbol file if it has been already processed
|
||||
+ as a core file. */
|
||||
+ if (catch_command_errors (func, execarg, !batch_flag)
|
||||
+ && core_bfd == NULL)
|
||||
catch_command_errors (symbol_file_add_main_adapter, symarg,
|
||||
!batch_flag);
|
||||
}
|
@ -0,0 +1,144 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Fedora GDB patches <invalid@email.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject:
|
||||
gdb-6.6-buildid-locate-misleading-warning-missing-debuginfo-rhbz981154.patch
|
||||
|
||||
;; Fix 'gdb gives highly misleading error when debuginfo pkg is present,
|
||||
;; but not corresponding binary pkg' (RH BZ 981154).
|
||||
;;=push+jan
|
||||
|
||||
Comments by Sergio Durigan Junior <sergiodj@redhat.com>:
|
||||
|
||||
This is the fix for RH BZ #981154
|
||||
|
||||
It is mainly a testcase addition, but a minor fix in the gdb/build-id.c
|
||||
file was also needed.
|
||||
|
||||
gdb/build-id.c was added by:
|
||||
|
||||
commit dc294be54c96414035eed7d53dafdea0a6f31a72
|
||||
Author: Tom Tromey <tromey@redhat.com>
|
||||
Date: Tue Oct 8 19:56:15 2013 +0000
|
||||
|
||||
and had a little thinko there. The variable 'filename' needs to be set to
|
||||
NULL after it is free'd, otherwise the code below thinks that it is still
|
||||
valid and doesn't print the necessary warning ("Try: yum install ...").
|
||||
|
||||
diff --git a/gdb/build-id.c b/gdb/build-id.c
|
||||
--- a/gdb/build-id.c
|
||||
+++ b/gdb/build-id.c
|
||||
@@ -581,7 +581,10 @@ build_id_to_debug_bfd (size_t build_id_len, const bfd_byte *build_id,
|
||||
do_cleanups (inner);
|
||||
|
||||
if (abfd == NULL)
|
||||
- continue;
|
||||
+ {
|
||||
+ filename = NULL;
|
||||
+ continue;
|
||||
+ }
|
||||
|
||||
if (build_id_verify (abfd.get(), build_id_len, build_id))
|
||||
break;
|
||||
diff --git a/gdb/testsuite/gdb.base/rhbz981154-misleading-yum-install-warning.exp b/gdb/testsuite/gdb.base/rhbz981154-misleading-yum-install-warning.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/rhbz981154-misleading-yum-install-warning.exp
|
||||
@@ -0,0 +1,97 @@
|
||||
+# Copyright (C) 2014 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+standard_testfile "normal.c"
|
||||
+
|
||||
+if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile}] } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+# Get the build-id of the file
|
||||
+set build_id_debug_file [build_id_debug_filename_get $binfile]
|
||||
+regsub -all ".debug$" $build_id_debug_file "" build_id_without_debug
|
||||
+
|
||||
+# Run to main
|
||||
+if { ![runto_main] } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+# We first need to generate a corefile
|
||||
+set escapedfilename [string_to_regexp [standard_output_file gcore.test]]
|
||||
+set core_supported 0
|
||||
+gdb_test_multiple "gcore [standard_output_file gcore.test]" \
|
||||
+ "save a corefile" \
|
||||
+{
|
||||
+ -re "Saved corefile ${escapedfilename}\[\r\n\]+$gdb_prompt $" {
|
||||
+ pass "save a corefile"
|
||||
+ global core_supported
|
||||
+ set core_supported 1
|
||||
+ }
|
||||
+ -re "Can't create a corefile\[\r\n\]+$gdb_prompt $" {
|
||||
+ unsupported "save a corefile"
|
||||
+ global core_supported
|
||||
+ set core_supported 0
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+if {!$core_supported} {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+# Move the binfile to a temporary name
|
||||
+remote_exec build "mv $binfile ${binfile}.old"
|
||||
+
|
||||
+# Reinitialize GDB and see if we get a yum/dnf warning
|
||||
+gdb_exit
|
||||
+gdb_start
|
||||
+gdb_reinitialize_dir $srcdir/$subdir
|
||||
+
|
||||
+with_test_prefix "first run:" {
|
||||
+ gdb_test "set build-id-verbose 1" "" \
|
||||
+ "set build-id-verbose"
|
||||
+
|
||||
+ gdb_test "set debug-file-directory [file dirname [standard_output_file gcore.test]]" "" \
|
||||
+ "set debug-file-directory"
|
||||
+
|
||||
+ gdb_test "core-file [standard_output_file gcore.test]" \
|
||||
+ "Missing separate debuginfo for the main executable file\r\nTry: (yum|dnf) --enablerepo='\\*debug\\*' install [standard_output_file $build_id_without_debug]\r\n.*" \
|
||||
+ "test first yum/dnf warning"
|
||||
+}
|
||||
+
|
||||
+# Now we define and create our .build-id
|
||||
+file mkdir [file dirname [standard_output_file ${build_id_without_debug}]]
|
||||
+# Cannot use "file link" (from TCL) because it requires the target file to
|
||||
+# exist.
|
||||
+remote_exec build "ln -s $binfile [standard_output_file ${build_id_without_debug}]"
|
||||
+
|
||||
+# Reinitialize GDB to get the second yum/dnf warning
|
||||
+gdb_exit
|
||||
+gdb_start
|
||||
+gdb_reinitialize_dir $srcdir/$subdir
|
||||
+
|
||||
+with_test_prefix "second run:" {
|
||||
+ gdb_test "set build-id-verbose 1" "" \
|
||||
+ "set build-id-verbose"
|
||||
+
|
||||
+ gdb_test "set debug-file-directory [file dirname [standard_output_file gcore.test]]" "" \
|
||||
+ "set debug-file-directory"
|
||||
+
|
||||
+ gdb_test "core-file [standard_output_file gcore.test]" \
|
||||
+ "Missing separate debuginfo for the main executable file\r\nTry: (yum|dnf) --enablerepo='\\*debug\\*' install $binfile\r\n.*" \
|
||||
+ "test second yum/dnf warning"
|
||||
+}
|
||||
+
|
||||
+# Leaving the link there will cause breakage in the next run.
|
||||
+remote_exec build "rm -f [standard_output_file ${build_id_without_debug}]"
|
42
SOURCES/gdb-6.6-buildid-locate-rpm-librpm-workaround.patch
Normal file
42
SOURCES/gdb-6.6-buildid-locate-rpm-librpm-workaround.patch
Normal file
@ -0,0 +1,42 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Fedora GDB patches <invalid@email.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-6.6-buildid-locate-rpm-librpm-workaround.patch
|
||||
|
||||
;; Workaround librpm BZ 643031 due to its unexpected exit() calls (BZ 642879).
|
||||
;;=push+jan
|
||||
|
||||
diff --git a/gdb/build-id.c b/gdb/build-id.c
|
||||
--- a/gdb/build-id.c
|
||||
+++ b/gdb/build-id.c
|
||||
@@ -652,6 +652,19 @@ build_id_to_filename (const struct bfd_build_id *build_id, char **link_return)
|
||||
#include <dlfcn.h>
|
||||
#endif
|
||||
|
||||
+/* Workarodun https://bugzilla.redhat.com/show_bug.cgi?id=643031
|
||||
+ librpm must not exit() an application on SIGINT
|
||||
+
|
||||
+ Enable or disable a signal handler. SIGNUM: signal to enable (or disable
|
||||
+ if negative). HANDLER: sa_sigaction handler (or NULL to use
|
||||
+ rpmsqHandler()). Returns: no. of refs, -1 on error. */
|
||||
+extern int rpmsqEnable (int signum, /* rpmsqAction_t handler */ void *handler);
|
||||
+int
|
||||
+rpmsqEnable (int signum, /* rpmsqAction_t handler */ void *handler)
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
/* This MISSING_RPM_HASH tracker is used to collect all the missing rpm files
|
||||
and avoid their duplicities during a single inferior run. */
|
||||
|
||||
diff --git a/gdb/proc-service.list b/gdb/proc-service.list
|
||||
--- a/gdb/proc-service.list
|
||||
+++ b/gdb/proc-service.list
|
||||
@@ -37,4 +37,7 @@
|
||||
ps_pstop;
|
||||
ps_ptread;
|
||||
ps_ptwrite;
|
||||
+
|
||||
+ /* gdb-6.6-buildid-locate-rpm.patch */
|
||||
+ rpmsqEnable;
|
||||
};
|
129
SOURCES/gdb-6.6-buildid-locate-rpm-scl.patch
Normal file
129
SOURCES/gdb-6.6-buildid-locate-rpm-scl.patch
Normal file
@ -0,0 +1,129 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Fedora GDB patches <invalid@email.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-6.6-buildid-locate-rpm-scl.patch
|
||||
|
||||
;; [SCL] Skip deprecated .gdb_index warning for Red Hat built files (BZ 953585).
|
||||
;;=push+jan
|
||||
|
||||
warning: Skipping deprecated .gdb_index section
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=953585
|
||||
|
||||
diff --git a/gdb/build-id.c b/gdb/build-id.c
|
||||
--- a/gdb/build-id.c
|
||||
+++ b/gdb/build-id.c
|
||||
@@ -689,7 +689,11 @@ static int missing_rpm_list_entries;
|
||||
/* Returns the count of newly added rpms. */
|
||||
|
||||
static int
|
||||
+#ifndef GDB_INDEX_VERIFY_VENDOR
|
||||
missing_rpm_enlist (const char *filename)
|
||||
+#else
|
||||
+missing_rpm_enlist_1 (const char *filename, int verify_vendor)
|
||||
+#endif
|
||||
{
|
||||
static int rpm_init_done = 0;
|
||||
rpmts ts;
|
||||
@@ -796,7 +800,11 @@ missing_rpm_enlist (const char *filename)
|
||||
mi = rpmtsInitIterator_p (ts, RPMTAG_BASENAMES, filename, 0);
|
||||
if (mi != NULL)
|
||||
{
|
||||
+#ifndef GDB_INDEX_VERIFY_VENDOR
|
||||
for (;;)
|
||||
+#else
|
||||
+ if (!verify_vendor) for (;;)
|
||||
+#endif
|
||||
{
|
||||
Header h;
|
||||
char *debuginfo, **slot, *s, *s2;
|
||||
@@ -914,6 +922,37 @@ missing_rpm_enlist (const char *filename)
|
||||
xfree (debuginfo);
|
||||
count++;
|
||||
}
|
||||
+#ifdef GDB_INDEX_VERIFY_VENDOR
|
||||
+ else /* verify_vendor */
|
||||
+ {
|
||||
+ int vendor_pass = 0, vendor_fail = 0;
|
||||
+
|
||||
+ for (;;)
|
||||
+ {
|
||||
+ Header h;
|
||||
+ errmsg_t err;
|
||||
+ char *vendor;
|
||||
+
|
||||
+ h = rpmdbNextIterator_p (mi);
|
||||
+ if (h == NULL)
|
||||
+ break;
|
||||
+
|
||||
+ vendor = headerFormat_p (h, "%{vendor}", &err);
|
||||
+ if (!vendor)
|
||||
+ {
|
||||
+ warning (_("Error querying the rpm file `%s': %s"), filename,
|
||||
+ err);
|
||||
+ continue;
|
||||
+ }
|
||||
+ if (strcmp (vendor, "Red Hat, Inc.") == 0)
|
||||
+ vendor_pass = 1;
|
||||
+ else
|
||||
+ vendor_fail = 1;
|
||||
+ xfree (vendor);
|
||||
+ }
|
||||
+ count = vendor_pass != 0 && vendor_fail == 0;
|
||||
+ }
|
||||
+#endif
|
||||
|
||||
rpmdbFreeIterator_p (mi);
|
||||
}
|
||||
@@ -924,6 +963,21 @@ missing_rpm_enlist (const char *filename)
|
||||
}
|
||||
|
||||
static int
|
||||
+#ifdef GDB_INDEX_VERIFY_VENDOR
|
||||
+missing_rpm_enlist (const char *filename)
|
||||
+{
|
||||
+ return missing_rpm_enlist_1 (filename, 0);
|
||||
+}
|
||||
+
|
||||
+extern int rpm_verify_vendor (const char *filename);
|
||||
+int
|
||||
+rpm_verify_vendor (const char *filename)
|
||||
+{
|
||||
+ return missing_rpm_enlist_1 (filename, 1);
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+#endif
|
||||
missing_rpm_list_compar (const char *const *ap, const char *const *bp)
|
||||
{
|
||||
return strcoll (*ap, *bp);
|
||||
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
|
||||
--- a/gdb/dwarf2read.c
|
||||
+++ b/gdb/dwarf2read.c
|
||||
@@ -3469,6 +3469,16 @@ read_gdb_index_from_section (struct objfile *objfile,
|
||||
"set use-deprecated-index-sections on". */
|
||||
if (version < 6 && !deprecated_ok)
|
||||
{
|
||||
+#ifdef GDB_INDEX_VERIFY_VENDOR
|
||||
+ extern int rpm_verify_vendor (const char *filename);
|
||||
+
|
||||
+ /* Red Hat Developer Toolset exception. */
|
||||
+ if (rpm_verify_vendor (filename))
|
||||
+ {}
|
||||
+ else
|
||||
+ {
|
||||
+
|
||||
+#endif
|
||||
static int warning_printed = 0;
|
||||
if (!warning_printed)
|
||||
{
|
||||
@@ -3480,6 +3490,10 @@ to use the section anyway."),
|
||||
warning_printed = 1;
|
||||
}
|
||||
return 0;
|
||||
+#ifdef GDB_INDEX_VERIFY_VENDOR
|
||||
+
|
||||
+ }
|
||||
+#endif
|
||||
}
|
||||
/* Version 7 indices generated by gold refer to the CU for a symbol instead
|
||||
of the TU (for symbols coming from TUs),
|
1514
SOURCES/gdb-6.6-buildid-locate-rpm.patch
Normal file
1514
SOURCES/gdb-6.6-buildid-locate-rpm.patch
Normal file
File diff suppressed because it is too large
Load Diff
237
SOURCES/gdb-6.6-buildid-locate-solib-missing-ids.patch
Normal file
237
SOURCES/gdb-6.6-buildid-locate-solib-missing-ids.patch
Normal file
@ -0,0 +1,237 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Fedora GDB patches <invalid@email.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-6.6-buildid-locate-solib-missing-ids.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
|
||||
|
||||
gdb returns an incorrect back trace when applying a debuginfo
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1339862
|
||||
|
||||
diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
|
||||
--- a/gdb/solib-svr4.c
|
||||
+++ b/gdb/solib-svr4.c
|
||||
@@ -1358,14 +1358,27 @@ svr4_read_so_list (CORE_ADDR lm, CORE_ADDR prev_lm,
|
||||
}
|
||||
|
||||
{
|
||||
- struct bfd_build_id *build_id;
|
||||
+ struct bfd_build_id *build_id = NULL;
|
||||
|
||||
strncpy (newobj->so_original_name, buffer.get (), SO_NAME_MAX_PATH_SIZE - 1);
|
||||
newobj->so_original_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0';
|
||||
/* May get overwritten below. */
|
||||
strcpy (newobj->so_name, newobj->so_original_name);
|
||||
|
||||
- build_id = build_id_addr_get (((lm_info_svr4 *) newobj->lm_info)->l_ld);
|
||||
+ /* In the case the main executable was found according to its build-id
|
||||
+ (from a core file) prevent loading a different build of a library
|
||||
+ with accidentally the same SO_NAME.
|
||||
+
|
||||
+ It suppresses bogus backtraces (and prints "??" there instead) if
|
||||
+ the on-disk files no longer match the running program version.
|
||||
+
|
||||
+ If the main executable was not loaded according to its build-id do
|
||||
+ not do any build-id checking of the libraries. There may be missing
|
||||
+ build-ids dumped in the core file and we would map all the libraries
|
||||
+ to the only existing file loaded that time - the executable. */
|
||||
+ if (symfile_objfile != NULL
|
||||
+ && (symfile_objfile->flags & OBJF_BUILD_ID_CORE_LOADED) != 0)
|
||||
+ build_id = build_id_addr_get (li->l_ld);
|
||||
if (build_id != NULL)
|
||||
{
|
||||
char *name, *build_id_filename;
|
||||
@@ -1380,23 +1393,7 @@ svr4_read_so_list (CORE_ADDR lm, CORE_ADDR prev_lm,
|
||||
xfree (name);
|
||||
}
|
||||
else
|
||||
- {
|
||||
- debug_print_missing (newobj->so_name, build_id_filename);
|
||||
-
|
||||
- /* In the case the main executable was found according to
|
||||
- its build-id (from a core file) prevent loading
|
||||
- a different build of a library with accidentally the
|
||||
- same SO_NAME.
|
||||
-
|
||||
- It suppresses bogus backtraces (and prints "??" there
|
||||
- instead) if the on-disk files no longer match the
|
||||
- running program version. */
|
||||
-
|
||||
- if (symfile_objfile != NULL
|
||||
- && (symfile_objfile->flags
|
||||
- & OBJF_BUILD_ID_CORE_LOADED) != 0)
|
||||
- newobj->so_name[0] = 0;
|
||||
- }
|
||||
+ debug_print_missing (newobj->so_name, build_id_filename);
|
||||
|
||||
xfree (build_id_filename);
|
||||
xfree (build_id);
|
||||
diff --git a/gdb/testsuite/gdb.base/gcore-buildid-exec-but-not-solib-lib.c b/gdb/testsuite/gdb.base/gcore-buildid-exec-but-not-solib-lib.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/gcore-buildid-exec-but-not-solib-lib.c
|
||||
@@ -0,0 +1,21 @@
|
||||
+/* Copyright 2010 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This file is part of GDB.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+void
|
||||
+lib (void)
|
||||
+{
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.base/gcore-buildid-exec-but-not-solib-main.c b/gdb/testsuite/gdb.base/gcore-buildid-exec-but-not-solib-main.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/gcore-buildid-exec-but-not-solib-main.c
|
||||
@@ -0,0 +1,25 @@
|
||||
+/* Copyright 2010 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This file is part of GDB.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+extern void lib (void);
|
||||
+
|
||||
+int
|
||||
+main (void)
|
||||
+{
|
||||
+ lib ();
|
||||
+ return 0;
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.base/gcore-buildid-exec-but-not-solib.exp b/gdb/testsuite/gdb.base/gcore-buildid-exec-but-not-solib.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/gcore-buildid-exec-but-not-solib.exp
|
||||
@@ -0,0 +1,105 @@
|
||||
+# Copyright 2016 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+if {[skip_shlib_tests]} {
|
||||
+ return 0
|
||||
+}
|
||||
+
|
||||
+set testfile "gcore-buildid-exec-but-not-solib"
|
||||
+set srcmainfile ${testfile}-main.c
|
||||
+set srclibfile ${testfile}-lib.c
|
||||
+set libfile [standard_output_file ${testfile}-lib.so]
|
||||
+set objfile [standard_output_file ${testfile}-main.o]
|
||||
+set executable ${testfile}-main
|
||||
+set binfile [standard_output_file ${executable}]
|
||||
+set gcorefile [standard_output_file ${executable}.gcore]
|
||||
+set outdir [file dirname $binfile]
|
||||
+
|
||||
+if { [gdb_compile_shlib ${srcdir}/${subdir}/${srclibfile} ${libfile} "debug additional_flags=-Wl,--build-id"] != ""
|
||||
+ || [gdb_compile ${srcdir}/${subdir}/${srcmainfile} ${objfile} object {debug}] != "" } {
|
||||
+ unsupported "-Wl,--build-id compilation failed"
|
||||
+ return -1
|
||||
+}
|
||||
+set opts [list debug shlib=${libfile} "additional_flags=-Wl,--build-id"]
|
||||
+if { [gdb_compile ${objfile} ${binfile} executable $opts] != "" } {
|
||||
+ unsupported "-Wl,--build-id compilation failed"
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+clean_restart $executable
|
||||
+gdb_load_shlib $libfile
|
||||
+
|
||||
+# Does this gdb support gcore?
|
||||
+set test "help gcore"
|
||||
+gdb_test_multiple $test $test {
|
||||
+ -re "Undefined command: .gcore.*\r\n$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 .*\r\n$gdb_prompt $" {
|
||||
+ pass $test
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+if { ![runto lib] } then {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+set escapedfilename [string_to_regexp ${gcorefile}]
|
||||
+
|
||||
+set test "save a corefile"
|
||||
+gdb_test_multiple "gcore ${gcorefile}" $test {
|
||||
+ -re "Saved corefile ${escapedfilename}\r\n$gdb_prompt $" {
|
||||
+ pass $test
|
||||
+ }
|
||||
+ -re "Can't create a corefile\r\n$gdb_prompt $" {
|
||||
+ unsupported $test
|
||||
+ return -1
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+# Now restart gdb and load the corefile.
|
||||
+
|
||||
+clean_restart $executable
|
||||
+gdb_load_shlib $libfile
|
||||
+
|
||||
+set buildid [build_id_debug_filename_get $libfile]
|
||||
+
|
||||
+regsub {\.debug$} $buildid {} buildid
|
||||
+
|
||||
+set debugdir [standard_output_file ${testfile}-debugdir]
|
||||
+file delete -force -- $debugdir
|
||||
+
|
||||
+file mkdir $debugdir/[file dirname $libfile]
|
||||
+file copy $libfile $debugdir/${libfile}
|
||||
+
|
||||
+file mkdir $debugdir/[file dirname $buildid]
|
||||
+file copy $libfile $debugdir/${buildid}
|
||||
+
|
||||
+remote_exec build "ln -s /lib ${debugdir}/"
|
||||
+remote_exec build "ln -s /lib64 ${debugdir}/"
|
||||
+# /usr is not needed, all the libs are in /lib64: libm.so.6 libc.so.6 ld-linux-x86-64.so.2
|
||||
+
|
||||
+gdb_test "set solib-absolute-prefix $debugdir"
|
||||
+
|
||||
+gdb_test_no_output "set debug-file-directory $debugdir" "set debug-file-directory"
|
||||
+
|
||||
+gdb_test "core ${gcorefile}" "Core was generated by .*" "re-load generated corefile"
|
||||
+
|
||||
+gdb_test "frame" "#0 \[^\r\n\]* lib .*" "library got loaded"
|
||||
+
|
||||
+gdb_test "bt"
|
||||
+gdb_test "info shared"
|
1249
SOURCES/gdb-6.6-buildid-locate.patch
Normal file
1249
SOURCES/gdb-6.6-buildid-locate.patch
Normal file
File diff suppressed because it is too large
Load Diff
188
SOURCES/gdb-6.6-bz229517-gcore-without-terminal.patch
Normal file
188
SOURCES/gdb-6.6-bz229517-gcore-without-terminal.patch
Normal file
@ -0,0 +1,188 @@
|
||||
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.6-bz229517-gcore-without-terminal.patch
|
||||
|
||||
;; Allow running `/usr/bin/gcore' with provided but inaccessible tty (BZ 229517).
|
||||
;;=fedoratest
|
||||
|
||||
2007-04-22 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* gdb_gcore.sh: Redirect GDB from `</dev/null'.
|
||||
|
||||
2007-04-22 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* gdb.base/gcorebg.exp, gdb.base/gcorebg.c: New files.
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/gcorebg.c b/gdb/testsuite/gdb.base/gcorebg.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/gcorebg.c
|
||||
@@ -0,0 +1,49 @@
|
||||
+#include <stdio.h>
|
||||
+#include <sys/types.h>
|
||||
+#include <unistd.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <signal.h>
|
||||
+#include <string.h>
|
||||
+#include <assert.h>
|
||||
+
|
||||
+int main (int argc, char **argv)
|
||||
+{
|
||||
+ pid_t pid = 0;
|
||||
+ pid_t ppid;
|
||||
+ char buf[1024*2 + 500];
|
||||
+ int gotint;
|
||||
+
|
||||
+ if (argc != 4)
|
||||
+ {
|
||||
+ fprintf (stderr, "Syntax: %s {standard|detached} <gcore command> <core output file>\n",
|
||||
+ argv[0]);
|
||||
+ exit (1);
|
||||
+ }
|
||||
+
|
||||
+ pid = fork ();
|
||||
+
|
||||
+ switch (pid)
|
||||
+ {
|
||||
+ case 0:
|
||||
+ if (strcmp (argv[1], "detached") == 0)
|
||||
+ setpgrp ();
|
||||
+ ppid = getppid ();
|
||||
+ gotint = snprintf (buf, sizeof (buf), "sh %s -o %s %d", argv[2], argv[3], (int) ppid);
|
||||
+ assert (gotint < sizeof (buf));
|
||||
+ system (buf);
|
||||
+ fprintf (stderr, "Killing parent PID %d\n", ppid);
|
||||
+ kill (ppid, SIGTERM);
|
||||
+ break;
|
||||
+
|
||||
+ case -1:
|
||||
+ perror ("fork err\n");
|
||||
+ exit (1);
|
||||
+ break;
|
||||
+
|
||||
+ default:
|
||||
+ fprintf (stderr,"Sleeping as PID %d\n", getpid ());
|
||||
+ sleep (60);
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.base/gcorebg.exp b/gdb/testsuite/gdb.base/gcorebg.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/gcorebg.exp
|
||||
@@ -0,0 +1,113 @@
|
||||
+# 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
|
||||
+
|
||||
+# This file was written by Jan Kratochvil <jan.kratochvil@redhat.com>.
|
||||
+# This is a test for `gdb_gcore.sh' functionality.
|
||||
+# It also tests a regression with `gdb_gcore.sh' being run without its
|
||||
+# accessible terminal.
|
||||
+
|
||||
+if ![info exists GCORE] {
|
||||
+ set GCORE "[standard_output_file ../../../../gcore]"
|
||||
+}
|
||||
+verbose "using GCORE = $GCORE" 2
|
||||
+
|
||||
+set testfile "gcorebg"
|
||||
+set srcfile ${testfile}.c
|
||||
+set binfile [standard_output_file ${testfile}]
|
||||
+set corefile [standard_output_file ${testfile}.test]
|
||||
+
|
||||
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
|
||||
+ untested gcorebg.exp
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+# Cleanup.
|
||||
+
|
||||
+proc core_clean {} {
|
||||
+ global corefile
|
||||
+
|
||||
+ foreach file [glob -nocomplain [join [list $corefile *] ""]] {
|
||||
+ verbose "Delete file $file" 1
|
||||
+ remote_file target delete $file
|
||||
+ }
|
||||
+}
|
||||
+core_clean
|
||||
+remote_file target delete "./gdb"
|
||||
+
|
||||
+# Generate the core file.
|
||||
+
|
||||
+# Provide `./gdb' for `gdb_gcore.sh' running it as a bare `gdb' command.
|
||||
+# Setup also `$PATH' appropriately.
|
||||
+# If GDB was not found let `gdb_gcore.sh' to find the system GDB by `$PATH'.
|
||||
+if {$GDB != "gdb"} {
|
||||
+ file link ./gdb $GDB
|
||||
+}
|
||||
+global env
|
||||
+set oldpath $env(PATH)
|
||||
+set env(PATH) [join [list . $env(PATH)] ":"]
|
||||
+verbose "PATH = $env(PATH)" 2
|
||||
+
|
||||
+# Test file body.
|
||||
+# $detached == "standard" || $detached == "detached"
|
||||
+
|
||||
+proc test_body { detached } {
|
||||
+ global binfile
|
||||
+ global GCORE
|
||||
+ global corefile
|
||||
+
|
||||
+ set res [remote_spawn target "$binfile $detached $GCORE $corefile"]
|
||||
+ if { $res < 0 || $res == "" } {
|
||||
+ fail "Spawning $detached gcore"
|
||||
+ return 1
|
||||
+ }
|
||||
+ pass "Spawning $detached gcore"
|
||||
+ remote_expect target 20 {
|
||||
+ timeout {
|
||||
+ fail "Spawned $detached gcore finished (timeout)"
|
||||
+ remote_exec target "kill -9 -[exp_pid -i $res]"
|
||||
+ return 1
|
||||
+ }
|
||||
+ "Saved corefile .*\r\nKilling parent PID " {
|
||||
+ pass "Spawned $detached gcore finished"
|
||||
+ remote_wait target 20
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if {1 == [llength [glob -nocomplain [join [list $corefile *] ""]]]} {
|
||||
+ pass "Core file generated by $detached gcore"
|
||||
+ } else {
|
||||
+ fail "Core file generated by $detached gcore"
|
||||
+ }
|
||||
+ core_clean
|
||||
+}
|
||||
+
|
||||
+# First a general `gdb_gcore.sh' spawn with its controlling terminal available.
|
||||
+
|
||||
+test_body standard
|
||||
+
|
||||
+# And now `gdb_gcore.sh' spawn without its controlling terminal available.
|
||||
+# It is spawned through `gcorebg.c' using setpgrp ().
|
||||
+
|
||||
+test_body detached
|
||||
+
|
||||
+
|
||||
+# Cleanup.
|
||||
+
|
||||
+set env(PATH) $oldpath
|
||||
+remote_file target delete "./gdb"
|
94
SOURCES/gdb-6.6-bz230000-power6-disassembly-test.patch
Normal file
94
SOURCES/gdb-6.6-bz230000-power6-disassembly-test.patch
Normal file
@ -0,0 +1,94 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Fedora GDB patches <invalid@email.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-6.6-bz230000-power6-disassembly-test.patch
|
||||
|
||||
;; Testcase for PPC Power6/DFP instructions disassembly (BZ 230000).
|
||||
;;=fedoratest
|
||||
|
||||
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=230000
|
||||
|
||||
The original testcase
|
||||
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=230000#c1
|
||||
requires too recent GCC.
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.arch/powerpc-power6.exp b/gdb/testsuite/gdb.arch/powerpc-power6.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.arch/powerpc-power6.exp
|
||||
@@ -0,0 +1,54 @@
|
||||
+# 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.
|
||||
+
|
||||
+# Test PowerPC Power6 instructions disassembly.
|
||||
+
|
||||
+if {![istarget "powerpc*-*-*"]} then {
|
||||
+ verbose "Skipping PowerPC Power6 instructions disassembly."
|
||||
+ return
|
||||
+}
|
||||
+
|
||||
+set testfile "powerpc-power6"
|
||||
+set srcfile ${testfile}.s
|
||||
+set objfile [standard_output_file ${testfile}.o]
|
||||
+
|
||||
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${objfile}" object {debug}] != "" } {
|
||||
+ untested "PowerPC prologue tests"
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+
|
||||
+gdb_exit
|
||||
+gdb_start
|
||||
+gdb_reinitialize_dir $srcdir/$subdir
|
||||
+gdb_load ${objfile}
|
||||
+
|
||||
+# Disassemble the function.
|
||||
+
|
||||
+gdb_test "disass func" ":\tblr\r\n.*" "Basic disassembly"
|
||||
+
|
||||
+gdb_test "disass func" ":\tdcbzl *r8,r9\r\n.*" "Power5 disassembly dcbzl"
|
||||
+gdb_test "disass func" ":\tfrsqrtes *f10,f11\r\n.*" "Power5 disassembly frsqrtes"
|
||||
+gdb_test "disass func" ":\tdadd *f1,f2,f1\r\n.*" "Power6 disassembly dadd"
|
||||
+gdb_test "disass func" ":\tdaddq *f0,f2,f0\r\n.*" "Power6 disassembly daddq"
|
||||
+gdb_test "disass func" ":\tdsub *f1,f2,f1\r\n.*" "Power6 disassembly dsub"
|
||||
+gdb_test "disass func" ":\tdsubq *f0,f2,f0\r\n.*" "Power6 disassembly dsubq"
|
||||
+gdb_test "disass func" ":\tdmul *f1,f2,f1\r\n.*" "Power6 disassembly dmul"
|
||||
+gdb_test "disass func" ":\tdmulq *f0,f2,f0\r\n.*" "Power6 disassembly dmulq"
|
||||
+gdb_test "disass func" ":\tddiv *f1,f2,f1\r\n.*" "Power6 disassembly ddiv"
|
||||
+gdb_test "disass func" ":\tddivq *f0,f2,f0\r\n.*" "Power6 disassembly ddivq"
|
||||
+gdb_test "disass func" ":\tdcmpu *cr1,f2,f1\r\n.*" "Power6 disassembly dcmpu"
|
||||
+gdb_test "disass func" ":\tdcmpuq *cr1,f2,f0\r\n.*" "Power6 disassembly dcmpuq"
|
||||
diff --git a/gdb/testsuite/gdb.arch/powerpc-power6.s b/gdb/testsuite/gdb.arch/powerpc-power6.s
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.arch/powerpc-power6.s
|
||||
@@ -0,0 +1,16 @@
|
||||
+ .text
|
||||
+ .globl func
|
||||
+func:
|
||||
+ blr
|
||||
+ .long 0x7c284fec /* dcbzl r8,r9 */
|
||||
+ .long 0xed405834 /* frsqrtes f10,f11 */
|
||||
+ .long 0xec220804 /* dadd f1,f2,f1 */
|
||||
+ .long 0xfc020004 /* daddq f0,f2,f0 */
|
||||
+ .long 0xec220c04 /* dsub f1,f2,f1 */
|
||||
+ .long 0xfc020404 /* dsubq f0,f2,f0 */
|
||||
+ .long 0xec220844 /* dmul f1,f2,f1 */
|
||||
+ .long 0xfc020044 /* dmulq f0,f2,f0 */
|
||||
+ .long 0xec220c44 /* ddiv f1,f2,f1 */
|
||||
+ .long 0xfc020444 /* ddivq f0,f2,f0 */
|
||||
+ .long 0xec820d04 /* dcmpu cr1,f2,f1 */
|
||||
+ .long 0xfc820504 /* dcmpuq cr1,f2,f0 */
|
278
SOURCES/gdb-6.6-bz237572-ppc-atomic-sequence-test.patch
Normal file
278
SOURCES/gdb-6.6-bz237572-ppc-atomic-sequence-test.patch
Normal file
@ -0,0 +1,278 @@
|
||||
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.6-bz237572-ppc-atomic-sequence-test.patch
|
||||
|
||||
;; Support for stepping over PPC atomic instruction sequences (BZ 237572).
|
||||
;;=fedoratest
|
||||
|
||||
2007-06-25 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* gdb.threads/atomic-seq-threaded.c,
|
||||
gdb.threads/atomic-seq-threaded.exp: New files.
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.threads/atomic-seq-threaded.c b/gdb/testsuite/gdb.threads/atomic-seq-threaded.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.threads/atomic-seq-threaded.c
|
||||
@@ -0,0 +1,171 @@
|
||||
+/* 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., 51 Franklin Street, Fifth Floor, Boston,
|
||||
+ MA 02110-1301, USA. */
|
||||
+
|
||||
+/* Test stepping over RISC atomic sequences.
|
||||
+ This variant testcases the code for stepping another thread while skipping
|
||||
+ over the atomic sequence in the former thread
|
||||
+ (STEPPING_PAST_SINGLESTEP_BREAKPOINT).
|
||||
+ Code comes from gcc/testsuite/gcc.dg/sync-2.c */
|
||||
+
|
||||
+/* { dg-options "-march=i486" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
|
||||
+/* { dg-options "-mcpu=v9" { target sparc*-*-* } } */
|
||||
+
|
||||
+/* Test functionality of the intrinsics for 'short' and 'char'. */
|
||||
+
|
||||
+#include <stdlib.h>
|
||||
+#include <string.h>
|
||||
+#include <pthread.h>
|
||||
+#include <assert.h>
|
||||
+#include <unistd.h>
|
||||
+
|
||||
+#define LOOPS 2
|
||||
+
|
||||
+static int unused;
|
||||
+
|
||||
+static char AI[18];
|
||||
+static char init_qi[18] = { 3,5,7,9,0,0,0,0,-1,0,0,0,0,0,-1,0,0,0 };
|
||||
+static char test_qi[18] = { 3,5,7,9,1,4,22,-12,7,8,9,7,1,-12,7,8,9,7 };
|
||||
+
|
||||
+static void
|
||||
+do_qi (void)
|
||||
+{
|
||||
+ if (__sync_fetch_and_add(AI+4, 1) != 0)
|
||||
+ abort ();
|
||||
+ if (__sync_fetch_and_add(AI+5, 4) != 0)
|
||||
+ abort ();
|
||||
+ if (__sync_fetch_and_add(AI+6, 22) != 0)
|
||||
+ abort ();
|
||||
+ if (__sync_fetch_and_sub(AI+7, 12) != 0)
|
||||
+ abort ();
|
||||
+ if (__sync_fetch_and_and(AI+8, 7) != (char)-1)
|
||||
+ abort ();
|
||||
+ if (__sync_fetch_and_or(AI+9, 8) != 0)
|
||||
+ abort ();
|
||||
+ if (__sync_fetch_and_xor(AI+10, 9) != 0)
|
||||
+ abort ();
|
||||
+ if (__sync_fetch_and_nand(AI+11, 7) != 0)
|
||||
+ abort ();
|
||||
+
|
||||
+ if (__sync_add_and_fetch(AI+12, 1) != 1)
|
||||
+ abort ();
|
||||
+ if (__sync_sub_and_fetch(AI+13, 12) != (char)-12)
|
||||
+ abort ();
|
||||
+ if (__sync_and_and_fetch(AI+14, 7) != 7)
|
||||
+ abort ();
|
||||
+ if (__sync_or_and_fetch(AI+15, 8) != 8)
|
||||
+ abort ();
|
||||
+ if (__sync_xor_and_fetch(AI+16, 9) != 9)
|
||||
+ abort ();
|
||||
+ if (__sync_nand_and_fetch(AI+17, 7) != 7)
|
||||
+ abort ();
|
||||
+}
|
||||
+
|
||||
+static short AL[18];
|
||||
+static short init_hi[18] = { 3,5,7,9,0,0,0,0,-1,0,0,0,0,0,-1,0,0,0 };
|
||||
+static short test_hi[18] = { 3,5,7,9,1,4,22,-12,7,8,9,7,1,-12,7,8,9,7 };
|
||||
+
|
||||
+static void
|
||||
+do_hi (void)
|
||||
+{
|
||||
+ if (__sync_fetch_and_add(AL+4, 1) != 0)
|
||||
+ abort ();
|
||||
+ if (__sync_fetch_and_add(AL+5, 4) != 0)
|
||||
+ abort ();
|
||||
+ if (__sync_fetch_and_add(AL+6, 22) != 0)
|
||||
+ abort ();
|
||||
+ if (__sync_fetch_and_sub(AL+7, 12) != 0)
|
||||
+ abort ();
|
||||
+ if (__sync_fetch_and_and(AL+8, 7) != -1)
|
||||
+ abort ();
|
||||
+ if (__sync_fetch_and_or(AL+9, 8) != 0)
|
||||
+ abort ();
|
||||
+ if (__sync_fetch_and_xor(AL+10, 9) != 0)
|
||||
+ abort ();
|
||||
+ if (__sync_fetch_and_nand(AL+11, 7) != 0)
|
||||
+ abort ();
|
||||
+
|
||||
+ if (__sync_add_and_fetch(AL+12, 1) != 1)
|
||||
+ abort ();
|
||||
+ if (__sync_sub_and_fetch(AL+13, 12) != -12)
|
||||
+ abort ();
|
||||
+ if (__sync_and_and_fetch(AL+14, 7) != 7)
|
||||
+ abort ();
|
||||
+ if (__sync_or_and_fetch(AL+15, 8) != 8)
|
||||
+ abort ();
|
||||
+ if (__sync_xor_and_fetch(AL+16, 9) != 9)
|
||||
+ abort ();
|
||||
+ if (__sync_nand_and_fetch(AL+17, 7) != 7)
|
||||
+ abort ();
|
||||
+}
|
||||
+
|
||||
+static void *
|
||||
+start1 (void *arg)
|
||||
+{
|
||||
+ unsigned loop;
|
||||
+ sleep(1);
|
||||
+
|
||||
+ for (loop = 0; loop < LOOPS; loop++)
|
||||
+ {
|
||||
+ memcpy(AI, init_qi, sizeof(init_qi));
|
||||
+
|
||||
+ do_qi ();
|
||||
+
|
||||
+ if (memcmp (AI, test_qi, sizeof(test_qi)))
|
||||
+ abort ();
|
||||
+ }
|
||||
+
|
||||
+ return arg; /* _delete1_ */
|
||||
+}
|
||||
+
|
||||
+static void *
|
||||
+start2 (void *arg)
|
||||
+{
|
||||
+ unsigned loop;
|
||||
+
|
||||
+ for (loop = 0; loop < LOOPS; loop++)
|
||||
+ {
|
||||
+ memcpy(AL, init_hi, sizeof(init_hi));
|
||||
+
|
||||
+ do_hi ();
|
||||
+
|
||||
+ if (memcmp (AL, test_hi, sizeof(test_hi)))
|
||||
+ abort ();
|
||||
+ }
|
||||
+
|
||||
+ return arg; /* _delete2_ */
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+main (int argc, char **argv)
|
||||
+{
|
||||
+ pthread_t thread;
|
||||
+ int i;
|
||||
+
|
||||
+ i = pthread_create (&thread, NULL, start1, NULL); /* _create_ */
|
||||
+ assert (i == 0); /* _create_after_ */
|
||||
+
|
||||
+ sleep (1);
|
||||
+
|
||||
+ start2 (NULL);
|
||||
+
|
||||
+ i = pthread_join (thread, NULL); /* _delete_ */
|
||||
+ assert (i == 0);
|
||||
+
|
||||
+ return 0; /* _exit_ */
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.threads/atomic-seq-threaded.exp b/gdb/testsuite/gdb.threads/atomic-seq-threaded.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.threads/atomic-seq-threaded.exp
|
||||
@@ -0,0 +1,84 @@
|
||||
+# atomic-seq-threaded.exp -- Test case for stepping over RISC atomic code seqs.
|
||||
+# This variant testcases the code for stepping another thread while skipping
|
||||
+# over the atomic sequence in the former thread
|
||||
+# (STEPPING_PAST_SINGLESTEP_BREAKPOINT).
|
||||
+# Copyright (C) 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
|
||||
+
|
||||
+set testfile atomic-seq-threaded
|
||||
+set srcfile ${testfile}.c
|
||||
+set binfile [standard_output_file ${testfile}]
|
||||
+
|
||||
+foreach opts {{} {compiler=gcc4} {FAIL}} {
|
||||
+ if {$opts eq "FAIL"} {
|
||||
+ return -1
|
||||
+ }
|
||||
+ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug $opts]] eq "" } {
|
||||
+ break
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+gdb_exit
|
||||
+gdb_start
|
||||
+gdb_reinitialize_dir $srcdir/$subdir
|
||||
+
|
||||
+gdb_load ${binfile}
|
||||
+if ![runto_main] then {
|
||||
+ fail "Can't run to main"
|
||||
+ return 0
|
||||
+}
|
||||
+
|
||||
+# pthread_create () will not pass even on x86_64 with software watchpoint.
|
||||
+# Pass after pthread_create () without any watchpoint active.
|
||||
+set line [gdb_get_line_number "_create_after_"]
|
||||
+gdb_test "tbreak $line" \
|
||||
+ "reakpoint (\[0-9\]+) at .*$srcfile, line $line\..*" \
|
||||
+ "set breakpoint after pthread_create ()"
|
||||
+gdb_test "c" \
|
||||
+ ".*/\\* _create_after_ \\*/.*" \
|
||||
+ "run till after pthread_create ()"
|
||||
+
|
||||
+# Without a watchpoint being software no single-stepping would be used.
|
||||
+set test "Start (software) watchpoint"
|
||||
+gdb_test_multiple "watch unused" $test {
|
||||
+ -re "Watchpoint \[0-9\]+: unused.*$gdb_prompt $" {
|
||||
+ pass $test
|
||||
+ }
|
||||
+ -re "Hardware watchpoint \[0-9\]+: unused.*$gdb_prompt $" {
|
||||
+ # We do not test the goal but still the whole testcase should pass.
|
||||
+ unsupported $test
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+# More thorough testing of the scheduling logic.
|
||||
+gdb_test "set scheduler-locking step" ""
|
||||
+
|
||||
+# Critical code path is stepped through at this point.
|
||||
+set line [gdb_get_line_number "_exit_"]
|
||||
+gdb_test "tbreak $line" \
|
||||
+ "reakpoint \[0-9\]+ at .*$srcfile, line $line\..*" \
|
||||
+ "set breakpoint at _exit_"
|
||||
+gdb_test "c" \
|
||||
+ ".*/\\* _exit_ \\*/.*" \
|
||||
+ "run till _exit_"
|
||||
+
|
||||
+# Just a nonproblematic program exit.
|
||||
+gdb_test "c" \
|
||||
+ ".*Program exited normally\\..*" \
|
||||
+ "run till program exit"
|
78
SOURCES/gdb-6.6-scheduler_locking-step-is-default.patch
Normal file
78
SOURCES/gdb-6.6-scheduler_locking-step-is-default.patch
Normal file
@ -0,0 +1,78 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Fedora GDB patches <invalid@email.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-6.6-scheduler_locking-step-is-default.patch
|
||||
|
||||
;; Make upstream `set scheduler-locking step' as default.
|
||||
;;=push+jan: How much is scheduler-locking relevant after non-stop?
|
||||
|
||||
diff --git a/gdb/infrun.c b/gdb/infrun.c
|
||||
--- a/gdb/infrun.c
|
||||
+++ b/gdb/infrun.c
|
||||
@@ -2193,7 +2193,7 @@ static const char *const scheduler_enums[] = {
|
||||
schedlock_replay,
|
||||
NULL
|
||||
};
|
||||
-static const char *scheduler_mode = schedlock_replay;
|
||||
+static const char *scheduler_mode = schedlock_step;
|
||||
static void
|
||||
show_scheduler_mode (struct ui_file *file, int from_tty,
|
||||
struct cmd_list_element *c, const char *value)
|
||||
diff --git a/gdb/testsuite/gdb.mi/mi-cli.exp b/gdb/testsuite/gdb.mi/mi-cli.exp
|
||||
--- a/gdb/testsuite/gdb.mi/mi-cli.exp
|
||||
+++ b/gdb/testsuite/gdb.mi/mi-cli.exp
|
||||
@@ -199,7 +199,7 @@ mi_expect_stop "breakpoint-hit" "main" "" ".*basics.c" \
|
||||
# Test that the token is output even for CLI commands
|
||||
# Also test that *stopped includes frame information.
|
||||
mi_gdb_test "34 next" \
|
||||
- ".*34\\\^running.*\\*running,thread-id=\"all\"" \
|
||||
+ ".*34\\\^running.*\\*running,thread-id=\"1\"" \
|
||||
"34 next: run"
|
||||
|
||||
# Test that the new current source line is output to the console
|
||||
diff --git a/gdb/testsuite/gdb.mi/mi-console.exp b/gdb/testsuite/gdb.mi/mi-console.exp
|
||||
--- a/gdb/testsuite/gdb.mi/mi-console.exp
|
||||
+++ b/gdb/testsuite/gdb.mi/mi-console.exp
|
||||
@@ -60,6 +60,9 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
|
||||
|
||||
mi_run_to_main
|
||||
|
||||
+# thread-id=\"all\" vs. thread-id=\"1\" below:
|
||||
+mi_gdb_test "210-gdb-set scheduler-locking off" "210\\^done" "set scheduler-locking off"
|
||||
+
|
||||
# The output we get from the target depends on how it is hosted. If
|
||||
# we are semihosted (e.g., the sim or a remote target that supports
|
||||
# the File I/O remote protocol extension), we see the target I/O
|
||||
diff --git a/gdb/testsuite/gdb.mi/mi-logging.exp b/gdb/testsuite/gdb.mi/mi-logging.exp
|
||||
--- a/gdb/testsuite/gdb.mi/mi-logging.exp
|
||||
+++ b/gdb/testsuite/gdb.mi/mi-logging.exp
|
||||
@@ -53,7 +53,7 @@ close $chan
|
||||
|
||||
set mi_log_prompt "\[(\]gdb\[)\] \[\r\n\]+"
|
||||
|
||||
-if [regexp "\\^done\[\r\n\]+$mi_log_prompt\\^running\[\r\n\]+\\*running,thread-id=\"all\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt\\^running\[\r\n\]+\\*running,thread-id=\"all\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt" $logcontent] {
|
||||
+if [regexp "\\^done\[\r\n\]+$mi_log_prompt\\^running\[\r\n\]+\\*running,thread-id=\"1\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt\\^running\[\r\n\]+\\*running,thread-id=\"1\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt" $logcontent] {
|
||||
pass "log file contents"
|
||||
} else {
|
||||
fail "log file contents"
|
||||
@@ -76,7 +76,7 @@ set chan [open $milogfile]
|
||||
set logcontent [read $chan]
|
||||
close $chan
|
||||
|
||||
-if [regexp "1001\\^done\[\r\n\]+$mi_log_prompt.*1002\\^running\[\r\n\]+\\*running,thread-id=\"all\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt.*1003\\^running\[\r\n\]+\\*running,thread-id=\"all\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt" $logcontent] {
|
||||
+if [regexp "1001\\^done\[\r\n\]+$mi_log_prompt.*1002\\^running\[\r\n\]+\\*running,thread-id=\"1\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt.*1003\\^running\[\r\n\]+\\*running,thread-id=\"1\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt" $logcontent] {
|
||||
pass "redirect log file contents"
|
||||
} else {
|
||||
fail "redirect log file contents"
|
||||
diff --git a/gdb/testsuite/gdb.opt/inline-cmds.exp b/gdb/testsuite/gdb.opt/inline-cmds.exp
|
||||
--- a/gdb/testsuite/gdb.opt/inline-cmds.exp
|
||||
+++ b/gdb/testsuite/gdb.opt/inline-cmds.exp
|
||||
@@ -331,7 +331,7 @@ proc mi_cli_step {cli_output_re message} {
|
||||
|
||||
send_gdb "interpreter-exec console \"step\"\n"
|
||||
gdb_expect {
|
||||
- -re "\\^running\r\n\\*running,thread-id=\"all\"\r\n${mi_gdb_prompt}${cli_output_re}" {
|
||||
+ -re "\\^running\r\n\\*running,thread-id=\"1\"\r\n${mi_gdb_prompt}${cli_output_re}" {
|
||||
pass $message
|
||||
}
|
||||
timeout {
|
32
SOURCES/gdb-6.6-testsuite-timeouts.patch
Normal file
32
SOURCES/gdb-6.6-testsuite-timeouts.patch
Normal file
@ -0,0 +1,32 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Fedora GDB patches <invalid@email.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-6.6-testsuite-timeouts.patch
|
||||
|
||||
;; Avoid too long timeouts on failing cases of "annota1.exp annota3.exp".
|
||||
;;=fedoratest
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/annota1.exp b/gdb/testsuite/gdb.base/annota1.exp
|
||||
--- a/gdb/testsuite/gdb.base/annota1.exp
|
||||
+++ b/gdb/testsuite/gdb.base/annota1.exp
|
||||
@@ -39,6 +39,8 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
|
||||
|
||||
clean_restart ${binfile}
|
||||
|
||||
+gdb_test "set breakpoint pending off" "" "Avoid lockup on nonexisting functions"
|
||||
+
|
||||
# The commands we test here produce many lines of output; disable "press
|
||||
# <return> to continue" prompts.
|
||||
gdb_test_no_output "set height 0"
|
||||
diff --git a/gdb/testsuite/gdb.base/annota3.exp b/gdb/testsuite/gdb.base/annota3.exp
|
||||
--- a/gdb/testsuite/gdb.base/annota3.exp
|
||||
+++ b/gdb/testsuite/gdb.base/annota3.exp
|
||||
@@ -38,6 +38,8 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
|
||||
|
||||
clean_restart ${binfile}
|
||||
|
||||
+gdb_test "set breakpoint pending off" "" "Avoid lockup on nonexisting functions"
|
||||
+
|
||||
# The commands we test here produce many lines of output; disable "press
|
||||
# <return> to continue" prompts.
|
||||
gdb_test_no_output "set height 0"
|
130
SOURCES/gdb-6.7-charsign-test.patch
Normal file
130
SOURCES/gdb-6.7-charsign-test.patch
Normal file
@ -0,0 +1,130 @@
|
||||
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.7-charsign-test.patch
|
||||
|
||||
;; Fix displaying of numeric char arrays as strings (BZ 224128).
|
||||
;;=fedoratest: But it is failing anyway, one should check the behavior more.
|
||||
|
||||
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=224128
|
||||
|
||||
2007-01-25 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* gdb.base/charsign.exp, gdb.base/charsign.c: New files.
|
||||
[ stripped ]
|
||||
|
||||
2007-10-19 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
Port to GDB-6.7 - only the testcase left, patch has been reverted,
|
||||
char-vectors restricted.
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/charsign.c b/gdb/testsuite/gdb.base/charsign.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/charsign.c
|
||||
@@ -0,0 +1,37 @@
|
||||
+/* 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 */
|
||||
+
|
||||
+int main()
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+char n[]="A";
|
||||
+signed char s[]="A";
|
||||
+unsigned char u[]="A";
|
||||
+
|
||||
+typedef char char_n;
|
||||
+typedef signed char char_s;
|
||||
+typedef unsigned char char_u;
|
||||
+
|
||||
+char_n n_typed[]="A";
|
||||
+char_s s_typed[]="A";
|
||||
+char_u u_typed[]="A";
|
||||
diff --git a/gdb/testsuite/gdb.base/charsign.exp b/gdb/testsuite/gdb.base/charsign.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/charsign.exp
|
||||
@@ -0,0 +1,63 @@
|
||||
+# 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 charsign
|
||||
+set srcfile ${testfile}.c
|
||||
+set binfile [standard_output_file ${testfile}]
|
||||
+
|
||||
+proc do_test { cflags } {
|
||||
+ global srcdir
|
||||
+ global binfile
|
||||
+ global subdir
|
||||
+ global srcfile
|
||||
+ global gdb_prompt
|
||||
+
|
||||
+ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug additional_flags=$cflags]] != "" } {
|
||||
+ 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 "p n" \
|
||||
+ "= \"A\""
|
||||
+ gdb_test "p s" \
|
||||
+ "= \\{65 'A', 0 '\\\\0'\\}"
|
||||
+ gdb_test "p u" \
|
||||
+ "= \\{65 'A', 0 '\\\\0'\\}"
|
||||
+ gdb_test "p n_typed" \
|
||||
+ "= \"A\""
|
||||
+ gdb_test "p s_typed" \
|
||||
+ "= \\{65 'A', 0 '\\\\0'\\}"
|
||||
+ gdb_test "p u_typed" \
|
||||
+ "= \\{65 'A', 0 '\\\\0'\\}"
|
||||
+}
|
||||
+
|
||||
+# The string identification works despite the compiler flags below due to
|
||||
+# gdbtypes.c:
|
||||
+# if (name && strcmp (name, "char") == 0)
|
||||
+# TYPE_FLAGS (type) |= TYPE_FLAG_NOSIGN;
|
||||
+
|
||||
+do_test {}
|
||||
+do_test {-fsigned-char}
|
||||
+do_test {-funsigned-char}
|
108
SOURCES/gdb-6.7-ppc-clobbered-registers-O2-test.patch
Normal file
108
SOURCES/gdb-6.7-ppc-clobbered-registers-O2-test.patch
Normal file
@ -0,0 +1,108 @@
|
||||
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.7-ppc-clobbered-registers-O2-test.patch
|
||||
|
||||
;; Test PPC hiding of call-volatile parameter register.
|
||||
;;=fedoratest
|
||||
|
||||
2007-11-04 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* gdb.arch/ppc-clobbered-registers-O2.exp: `powerpc64' changed to
|
||||
`powerpc*'.
|
||||
|
||||
Testcase for:
|
||||
|
||||
http://sourceware.org/ml/gdb-patches/2007-09/msg00228.html
|
||||
|
||||
2007-10-21 Luis Machado <luisgpm@br.ibm.com>
|
||||
|
||||
* rs6000-tdep.c (ppc_dwarf2_frame_init_reg): New function.
|
||||
* (rs6000_gdbarch_init): Install ppc_dwarf2_frame_init_reg as
|
||||
default dwarf2_frame_set_init_reg function.
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.arch/ppc-clobbered-registers-O2.c b/gdb/testsuite/gdb.arch/ppc-clobbered-registers-O2.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.arch/ppc-clobbered-registers-O2.c
|
||||
@@ -0,0 +1,21 @@
|
||||
+
|
||||
+unsigned * __attribute__((noinline))
|
||||
+start_sequence (unsigned * x, unsigned * y)
|
||||
+{
|
||||
+ return (unsigned *)0xdeadbeef;
|
||||
+};
|
||||
+
|
||||
+unsigned __attribute__((noinline))
|
||||
+gen_movsd (unsigned * operand0, unsigned * operand1)
|
||||
+{
|
||||
+ return *start_sequence(operand0, operand1);
|
||||
+}
|
||||
+
|
||||
+int main(void)
|
||||
+{
|
||||
+ unsigned x, y;
|
||||
+
|
||||
+ x = 13;
|
||||
+ y = 14;
|
||||
+ return (int)gen_movsd (&x, &y);
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.arch/ppc-clobbered-registers-O2.exp b/gdb/testsuite/gdb.arch/ppc-clobbered-registers-O2.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.arch/ppc-clobbered-registers-O2.exp
|
||||
@@ -0,0 +1,54 @@
|
||||
+# Copyright 2006 Free Software Foundation, Inc.
|
||||
+#
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 2 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program; if not, write to the Free Software
|
||||
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
+#
|
||||
+# This file is part of the gdb testsuite.
|
||||
+
|
||||
+# Test displaying call clobbered registers in optimized binaries for ppc.
|
||||
+# GDB should not show incorrect values.
|
||||
+
|
||||
+if ![istarget "powerpc*-*"] then {
|
||||
+ verbose "Skipping powerpc* call clobbered registers testing."
|
||||
+ return
|
||||
+}
|
||||
+
|
||||
+set testfile "ppc-clobbered-registers-O2"
|
||||
+set srcfile ${testfile}.c
|
||||
+set binfile [standard_output_file ${testfile}]
|
||||
+set compile_flags "debug additional_flags=-O2"
|
||||
+
|
||||
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable ${compile_flags}] != "" } {
|
||||
+ unsupported "Testcase compile failed."
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+gdb_exit
|
||||
+gdb_start
|
||||
+gdb_reinitialize_dir $srcdir/$subdir
|
||||
+gdb_load ${binfile}
|
||||
+
|
||||
+if ![runto_main] then {
|
||||
+ perror "Couldn't run to breakpoint"
|
||||
+ continue
|
||||
+}
|
||||
+
|
||||
+gdb_test "b start_sequence" ".*Breakpoint 2 at.*line 6.*" \
|
||||
+ "Insert breakpoint at problematic function"
|
||||
+
|
||||
+gdb_test continue ".*Breakpoint 2.*in start_sequence.*" \
|
||||
+ "Run until problematic function"
|
||||
+
|
||||
+gdb_test backtrace ".*operand0=<value optimized out>.*operand1=<value optimized out>.*" \
|
||||
+ "Check value of call clobbered registers"
|
104
SOURCES/gdb-6.7-testsuite-stable-results.patch
Normal file
104
SOURCES/gdb-6.7-testsuite-stable-results.patch
Normal file
@ -0,0 +1,104 @@
|
||||
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.7-testsuite-stable-results.patch
|
||||
|
||||
;; Testsuite fixes for more stable/comparable results.
|
||||
;;=fedoratest
|
||||
|
||||
gdb/testsuite/gdb.base/fileio.c:
|
||||
gdb/testsuite/gdb.base/fileio.exp:
|
||||
2007-12-08 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* gdb.base/fileio.c (ROOTSUBDIR): New macro.
|
||||
(main): CHDIR into ROOTSUBDIR. CHOWN ROOTSUBDIR and CHDIR into
|
||||
ROOTSUBDIR if we are being run as root.
|
||||
* gdb.base/fileio.exp: Change the startup and finish cleanup.
|
||||
Change the test file reference to be into the `fileio.dir' directory.
|
||||
|
||||
sources/gdb/testsuite/gdb.base/dump.exp:
|
||||
Found on RHEL-5.s390x.
|
||||
|
||||
gdb-6.8.50.20090209/gdb/testsuite/gdb.base/auxv.exp:
|
||||
random FAIL: gdb.base/auxv.exp: matching auxv data from live and gcore
|
||||
|
||||
gdb-6.8.50.20090209/gdb/testsuite/gdb.base/annota1.exp:
|
||||
frames-invalid can happen asynchronously.
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/fileio.c b/gdb/testsuite/gdb.base/fileio.c
|
||||
--- a/gdb/testsuite/gdb.base/fileio.c
|
||||
+++ b/gdb/testsuite/gdb.base/fileio.c
|
||||
@@ -560,6 +560,28 @@ strerrno (int err)
|
||||
int
|
||||
main ()
|
||||
{
|
||||
+ /* These tests
|
||||
+ Open for write but no write permission returns EACCES
|
||||
+ Unlinking a file in a directory w/o write access returns EACCES
|
||||
+ fail if we are being run as root - drop the privileges here. */
|
||||
+
|
||||
+ if (geteuid () == 0)
|
||||
+ {
|
||||
+ uid_t uid = 99;
|
||||
+
|
||||
+ if (chown (OUTDIR, uid, uid) != 0)
|
||||
+ {
|
||||
+ printf ("chown %d.%d %s: %s\n", (int) uid, (int) uid,
|
||||
+ OUTDIR, strerror (errno));
|
||||
+ exit (1);
|
||||
+ }
|
||||
+ if (setuid (uid) || geteuid () == 0)
|
||||
+ {
|
||||
+ printf ("setuid %d: %s\n", (int) uid, strerror (errno));
|
||||
+ exit (1);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
/* Don't change the order of the calls. They partly depend on each other */
|
||||
test_open ();
|
||||
test_write ();
|
||||
diff --git a/gdb/testsuite/gdb.base/fileio.exp b/gdb/testsuite/gdb.base/fileio.exp
|
||||
--- a/gdb/testsuite/gdb.base/fileio.exp
|
||||
+++ b/gdb/testsuite/gdb.base/fileio.exp
|
||||
@@ -24,9 +24,9 @@ if [target_info exists gdb,nofileio] {
|
||||
standard_testfile
|
||||
|
||||
if {[is_remote host]} {
|
||||
- set outdir .
|
||||
+ set outdir "fileio.dir"
|
||||
} else {
|
||||
- set outdir [standard_output_file {}]
|
||||
+ set outdir [standard_output_file "fileio.dir"]
|
||||
}
|
||||
|
||||
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
|
||||
@@ -47,7 +47,8 @@ set dir2 [standard_output_file dir2.fileio.test]
|
||||
if {[file exists $dir2] && ![file writable $dir2]} {
|
||||
system "chmod +w $dir2"
|
||||
}
|
||||
-system "rm -rf [standard_output_file *.fileio.test]"
|
||||
+system "rm -rf [standard_output_file fileio.dir]"
|
||||
+system "mkdir -m777 [standard_output_file fileio.dir]"
|
||||
|
||||
set oldtimeout $timeout
|
||||
set timeout [expr "$timeout + 60"]
|
||||
@@ -89,7 +90,7 @@ gdb_test continue \
|
||||
|
||||
gdb_test "continue" ".*" ""
|
||||
|
||||
-catch "system \"chmod -f -w [standard_output_file nowrt.fileio.test]\""
|
||||
+catch "system \"chmod -f -w [standard_output_file fileio.dir/nowrt.fileio.test]\""
|
||||
|
||||
gdb_test continue \
|
||||
"Continuing\\..*open 5:.*EACCES$stop_msg" \
|
||||
@@ -276,9 +277,7 @@ gdb_test continue \
|
||||
gdb_exit
|
||||
|
||||
# Make dir2 writable again so rm -rf of a build tree Just Works.
|
||||
-if {[file exists $dir2] && ![file writable $dir2]} {
|
||||
- system "chmod +w $dir2"
|
||||
-}
|
||||
+system "chmod -R +w $outdir"
|
||||
|
||||
set timeout $oldtimeout
|
||||
return 0
|
37
SOURCES/gdb-6.8-bz436037-reg-no-longer-active.patch
Normal file
37
SOURCES/gdb-6.8-bz436037-reg-no-longer-active.patch
Normal file
@ -0,0 +1,37 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Fedora GDB patches <invalid@email.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-6.8-bz436037-reg-no-longer-active.patch
|
||||
|
||||
;; Fix register assignments with no GDB stack frames (BZ 436037).
|
||||
;;=push+jan: This fix is incorrect.
|
||||
|
||||
diff --git a/gdb/valops.c b/gdb/valops.c
|
||||
--- a/gdb/valops.c
|
||||
+++ b/gdb/valops.c
|
||||
@@ -1104,6 +1104,8 @@ value_assign (struct value *toval, struct value *fromval)
|
||||
struct gdbarch *gdbarch;
|
||||
int value_reg;
|
||||
|
||||
+ value_reg = VALUE_REGNUM (toval);
|
||||
+
|
||||
/* Figure out which frame this is in currently.
|
||||
|
||||
We use VALUE_FRAME_ID for obtaining the value's frame id instead of
|
||||
@@ -1113,8 +1115,14 @@ value_assign (struct value *toval, struct value *fromval)
|
||||
frame. */
|
||||
frame = frame_find_by_id (VALUE_FRAME_ID (toval));
|
||||
|
||||
- value_reg = VALUE_REGNUM (toval);
|
||||
-
|
||||
+ /* "set $reg+=1" should work on programs with no debug info,
|
||||
+ but frame_find_by_id returns NULL here (RH bug 436037).
|
||||
+ Use current frame, it represents CPU state in this case.
|
||||
+ If frame_find_by_id is changed to do it internally
|
||||
+ (it is contemplated there), remove this. */
|
||||
+ if (!frame)
|
||||
+ frame = get_current_frame ();
|
||||
+ /* Probably never happens. */
|
||||
if (!frame)
|
||||
error (_("Value being assigned to is no longer active."));
|
||||
|
181
SOURCES/gdb-6.8-bz442765-threaded-exec-test.patch
Normal file
181
SOURCES/gdb-6.8-bz442765-threaded-exec-test.patch
Normal file
@ -0,0 +1,181 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Fedora GDB patches <invalid@email.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-6.8-bz442765-threaded-exec-test.patch
|
||||
|
||||
;; Test various forms of threads tracking across exec() (BZ 442765).
|
||||
;;=fedoratest
|
||||
|
||||
Test various forms of threads tracking across exec(2).
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.threads/threaded-exec.c b/gdb/testsuite/gdb.threads/threaded-exec.c
|
||||
--- a/gdb/testsuite/gdb.threads/threaded-exec.c
|
||||
+++ b/gdb/testsuite/gdb.threads/threaded-exec.c
|
||||
@@ -18,21 +18,95 @@
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <stddef.h>
|
||||
-#include <pthread.h>
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
+#include <stdio.h>
|
||||
|
||||
+#ifdef THREADS
|
||||
+
|
||||
+# include <pthread.h>
|
||||
|
||||
static void *
|
||||
threader (void *arg)
|
||||
{
|
||||
- return NULL;
|
||||
+ return NULL;
|
||||
}
|
||||
|
||||
+#endif
|
||||
+
|
||||
int
|
||||
-main (void)
|
||||
+main (int argc, char **argv)
|
||||
{
|
||||
+ char *exec_nothreads, *exec_threads, *cmd;
|
||||
+ int phase;
|
||||
+ char phase_s[8];
|
||||
+
|
||||
+ setbuf (stdout, NULL);
|
||||
+
|
||||
+ if (argc != 4)
|
||||
+ {
|
||||
+ fprintf (stderr, "%s <non-threaded> <threaded> <phase>\n", argv[0]);
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
+#ifdef THREADS
|
||||
+ puts ("THREADS: Y");
|
||||
+#else
|
||||
+ puts ("THREADS: N");
|
||||
+#endif
|
||||
+ exec_nothreads = argv[1];
|
||||
+ printf ("exec_nothreads: %s\n", exec_nothreads);
|
||||
+ exec_threads = argv[2];
|
||||
+ printf ("exec_threads: %s\n", exec_threads);
|
||||
+ phase = atoi (argv[3]);
|
||||
+ printf ("phase: %d\n", phase);
|
||||
+
|
||||
+ /* Phases: threading
|
||||
+ 0: N -> N
|
||||
+ 1: N -> Y
|
||||
+ 2: Y -> Y
|
||||
+ 3: Y -> N
|
||||
+ 4: N -> exit */
|
||||
+
|
||||
+ cmd = NULL;
|
||||
+
|
||||
+#ifndef THREADS
|
||||
+ switch (phase)
|
||||
+ {
|
||||
+ case 0:
|
||||
+ cmd = exec_nothreads;
|
||||
+ break;
|
||||
+ case 1:
|
||||
+ cmd = exec_threads;
|
||||
+ break;
|
||||
+ case 2:
|
||||
+ fprintf (stderr, "%s: We should have threads for phase %d!\n", argv[0],
|
||||
+ phase);
|
||||
+ return 1;
|
||||
+ case 3:
|
||||
+ fprintf (stderr, "%s: We should have threads for phase %d!\n", argv[0],
|
||||
+ phase);
|
||||
+ return 1;
|
||||
+ case 4:
|
||||
+ return 0;
|
||||
+ default:
|
||||
+ assert (0);
|
||||
+ }
|
||||
+#else /* THREADS */
|
||||
+ switch (phase)
|
||||
+ {
|
||||
+ case 0:
|
||||
+ fprintf (stderr, "%s: We should not have threads for phase %d!\n",
|
||||
+ argv[0], phase);
|
||||
+ return 1;
|
||||
+ case 1:
|
||||
+ fprintf (stderr, "%s: We should not have threads for phase %d!\n",
|
||||
+ argv[0], phase);
|
||||
+ return 1;
|
||||
+ case 2:
|
||||
+ cmd = exec_threads;
|
||||
+ {
|
||||
pthread_t t1;
|
||||
int i;
|
||||
|
||||
@@ -40,7 +114,34 @@ main (void)
|
||||
assert (i == 0);
|
||||
i = pthread_join (t1, NULL);
|
||||
assert (i == 0);
|
||||
+ }
|
||||
+ break;
|
||||
+ case 3:
|
||||
+ cmd = exec_nothreads;
|
||||
+ {
|
||||
+ pthread_t t1;
|
||||
+ int i;
|
||||
+
|
||||
+ i = pthread_create (&t1, NULL, threader, (void *) NULL);
|
||||
+ assert (i == 0);
|
||||
+ i = pthread_join (t1, NULL);
|
||||
+ assert (i == 0);
|
||||
+ }
|
||||
+ break;
|
||||
+ case 4:
|
||||
+ fprintf (stderr, "%s: We should not have threads for phase %d!\n",
|
||||
+ argv[0], phase);
|
||||
+ return 1;
|
||||
+ default:
|
||||
+ assert (0);
|
||||
+ }
|
||||
+#endif /* THREADS */
|
||||
+
|
||||
+ assert (cmd != NULL);
|
||||
+
|
||||
+ phase++;
|
||||
+ snprintf (phase_s, sizeof phase_s, "%d", phase);
|
||||
|
||||
- execl ("/bin/true", "/bin/true", NULL);
|
||||
- abort ();
|
||||
+ execl (cmd, cmd, exec_nothreads, exec_threads, phase_s, NULL);
|
||||
+ assert (0);
|
||||
}
|
||||
diff --git a/gdb/testsuite/gdb.threads/threaded-exec.exp b/gdb/testsuite/gdb.threads/threaded-exec.exp
|
||||
--- a/gdb/testsuite/gdb.threads/threaded-exec.exp
|
||||
+++ b/gdb/testsuite/gdb.threads/threaded-exec.exp
|
||||
@@ -20,9 +20,14 @@
|
||||
|
||||
set testfile threaded-exec
|
||||
set srcfile ${testfile}.c
|
||||
-set binfile [standard_output_file ${testfile}]
|
||||
+set binfile_nothreads [standard_output_file ${testfile}N]
|
||||
+set binfile_threads [standard_output_file ${testfile}Y]
|
||||
|
||||
-if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable []] != "" } {
|
||||
+if {[gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile_nothreads}" executable {additional_flags=-UTHREADS}] != "" } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile_threads}" executable {additional_flags=-DTHREADS}] != "" } {
|
||||
return -1
|
||||
}
|
||||
|
||||
@@ -30,9 +35,9 @@ gdb_exit
|
||||
gdb_start
|
||||
gdb_reinitialize_dir $srcdir/$subdir
|
||||
|
||||
-gdb_load ${binfile}
|
||||
+gdb_load ${binfile_nothreads}
|
||||
|
||||
-gdb_run_cmd
|
||||
+gdb_run_cmd ${binfile_nothreads} ${binfile_threads} 0
|
||||
|
||||
gdb_test_multiple {} "Program exited" {
|
||||
-re "\r\n\\\[Inferior .* exited normally\\\]\r\n$gdb_prompt $" {
|
481
SOURCES/gdb-6.8-bz466901-backtrace-full-prelinked.patch
Normal file
481
SOURCES/gdb-6.8-bz466901-backtrace-full-prelinked.patch
Normal file
@ -0,0 +1,481 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Fedora GDB patches <invalid@email.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-6.8-bz466901-backtrace-full-prelinked.patch
|
||||
|
||||
;; Fix resolving of variables at locations lists in prelinked libs (BZ 466901).
|
||||
;;=fedoratest
|
||||
|
||||
Fix resolving of variables at locations lists in prelinked libs (BZ 466901).
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked-func.S b/gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked-func.S
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked-func.S
|
||||
@@ -0,0 +1,328 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2008 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+/*
|
||||
+#include <stdlib.h>
|
||||
+
|
||||
+void
|
||||
+func (void)
|
||||
+{
|
||||
+ int i;
|
||||
+
|
||||
+ abort ();
|
||||
+}
|
||||
+*/
|
||||
+ .file "dw2-loclist-prelinked.c"
|
||||
+ .section .debug_abbrev,"",@progbits
|
||||
+.Ldebug_abbrev0:
|
||||
+ .section .debug_info,"",@progbits
|
||||
+.Ldebug_info0:
|
||||
+ .section .debug_line,"",@progbits
|
||||
+.Ldebug_line0:
|
||||
+ .text
|
||||
+.Ltext0:
|
||||
+.globl func
|
||||
+ .type func, @function
|
||||
+func:
|
||||
+.LFB2:
|
||||
+ .file 1 "dw2-loclist-prelinked.c"
|
||||
+ .loc 1 5 0
|
||||
+ pushl %ebp
|
||||
+.LCFI0:
|
||||
+ movl %esp, %ebp
|
||||
+.LCFI1:
|
||||
+ subl $24, %esp
|
||||
+.LCFI2:
|
||||
+ .loc 1 8 0
|
||||
+ call abort
|
||||
+.LFE2:
|
||||
+ .size func, .-func
|
||||
+ .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
|
||||
+ .byte 0x4
|
||||
+ .long .LCFI1-.LCFI0
|
||||
+ .byte 0xd
|
||||
+ .uleb128 0x5
|
||||
+ .align 4
|
||||
+.LEFDE0:
|
||||
+ .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 0x94
|
||||
+ .value 0x2
|
||||
+ .long .Ldebug_abbrev0
|
||||
+ .byte 0x4
|
||||
+ .uleb128 0x1
|
||||
+ .long .LASF10
|
||||
+ .byte 0x1
|
||||
+ .long .LASF11
|
||||
+ .long .LASF12
|
||||
+ .long .Ltext0
|
||||
+ .long .Letext0
|
||||
+ .long .Ldebug_line0
|
||||
+ .uleb128 0x2
|
||||
+ .byte 0x4
|
||||
+ .byte 0x7
|
||||
+ .long .LASF0
|
||||
+ .uleb128 0x3
|
||||
+ .byte 0x4
|
||||
+ .byte 0x5
|
||||
+ .string "int"
|
||||
+ .uleb128 0x2
|
||||
+ .byte 0x4
|
||||
+ .byte 0x5
|
||||
+ .long .LASF1
|
||||
+ .uleb128 0x2
|
||||
+ .byte 0x1
|
||||
+ .byte 0x8
|
||||
+ .long .LASF2
|
||||
+ .uleb128 0x2
|
||||
+ .byte 0x2
|
||||
+ .byte 0x7
|
||||
+ .long .LASF3
|
||||
+ .uleb128 0x2
|
||||
+ .byte 0x4
|
||||
+ .byte 0x7
|
||||
+ .long .LASF4
|
||||
+ .uleb128 0x2
|
||||
+ .byte 0x1
|
||||
+ .byte 0x6
|
||||
+ .long .LASF5
|
||||
+ .uleb128 0x2
|
||||
+ .byte 0x2
|
||||
+ .byte 0x5
|
||||
+ .long .LASF6
|
||||
+ .uleb128 0x2
|
||||
+ .byte 0x8
|
||||
+ .byte 0x5
|
||||
+ .long .LASF7
|
||||
+ .uleb128 0x2
|
||||
+ .byte 0x8
|
||||
+ .byte 0x7
|
||||
+ .long .LASF8
|
||||
+ .uleb128 0x4
|
||||
+ .byte 0x4
|
||||
+ .byte 0x7
|
||||
+ .uleb128 0x2
|
||||
+ .byte 0x1
|
||||
+ .byte 0x6
|
||||
+ .long .LASF9
|
||||
+ .uleb128 0x5
|
||||
+ .byte 0x1
|
||||
+ .long .LASF13
|
||||
+ .byte 0x1
|
||||
+ .byte 0x5
|
||||
+ .byte 0x1
|
||||
+ .long .LFB2
|
||||
+ .long .LFE2
|
||||
+ .long .LLST0
|
||||
+ .uleb128 0x6
|
||||
+ .string "i"
|
||||
+ .byte 0x1
|
||||
+ .byte 0x6
|
||||
+ .long 0x2c
|
||||
+ .byte 0x2
|
||||
+ .byte 0x91
|
||||
+ .sleb128 -12
|
||||
+ .byte 0x0
|
||||
+ .byte 0x0
|
||||
+ .section .debug_abbrev
|
||||
+ .uleb128 0x1
|
||||
+ .uleb128 0x11
|
||||
+ .byte 0x1
|
||||
+ .uleb128 0x25
|
||||
+ .uleb128 0xe
|
||||
+ .uleb128 0x13
|
||||
+ .uleb128 0xb
|
||||
+ .uleb128 0x3
|
||||
+ .uleb128 0xe
|
||||
+ .uleb128 0x1b
|
||||
+ .uleb128 0xe
|
||||
+ .uleb128 0x11
|
||||
+ .uleb128 0x1
|
||||
+ .uleb128 0x12
|
||||
+ .uleb128 0x1
|
||||
+ .uleb128 0x10
|
||||
+ .uleb128 0x6
|
||||
+ .byte 0x0
|
||||
+ .byte 0x0
|
||||
+ .uleb128 0x2
|
||||
+ .uleb128 0x24
|
||||
+ .byte 0x0
|
||||
+ .uleb128 0xb
|
||||
+ .uleb128 0xb
|
||||
+ .uleb128 0x3e
|
||||
+ .uleb128 0xb
|
||||
+ .uleb128 0x3
|
||||
+ .uleb128 0xe
|
||||
+ .byte 0x0
|
||||
+ .byte 0x0
|
||||
+ .uleb128 0x3
|
||||
+ .uleb128 0x24
|
||||
+ .byte 0x0
|
||||
+ .uleb128 0xb
|
||||
+ .uleb128 0xb
|
||||
+ .uleb128 0x3e
|
||||
+ .uleb128 0xb
|
||||
+ .uleb128 0x3
|
||||
+ .uleb128 0x8
|
||||
+ .byte 0x0
|
||||
+ .byte 0x0
|
||||
+ .uleb128 0x4
|
||||
+ .uleb128 0x24
|
||||
+ .byte 0x0
|
||||
+ .uleb128 0xb
|
||||
+ .uleb128 0xb
|
||||
+ .uleb128 0x3e
|
||||
+ .uleb128 0xb
|
||||
+ .byte 0x0
|
||||
+ .byte 0x0
|
||||
+ .uleb128 0x5
|
||||
+ .uleb128 0x2e
|
||||
+ .byte 0x1
|
||||
+ .uleb128 0x3f
|
||||
+ .uleb128 0xc
|
||||
+ .uleb128 0x3
|
||||
+ .uleb128 0xe
|
||||
+ .uleb128 0x3a
|
||||
+ .uleb128 0xb
|
||||
+ .uleb128 0x3b
|
||||
+ .uleb128 0xb
|
||||
+ .uleb128 0x27
|
||||
+ .uleb128 0xc
|
||||
+ .uleb128 0x11
|
||||
+ .uleb128 0x1
|
||||
+ .uleb128 0x12
|
||||
+ .uleb128 0x1
|
||||
+ .uleb128 0x40
|
||||
+ .uleb128 0x6
|
||||
+ .byte 0x0
|
||||
+ .byte 0x0
|
||||
+ .uleb128 0x6
|
||||
+ .uleb128 0x34
|
||||
+ .byte 0x0
|
||||
+ .uleb128 0x3
|
||||
+ .uleb128 0x8
|
||||
+ .uleb128 0x3a
|
||||
+ .uleb128 0xb
|
||||
+ .uleb128 0x3b
|
||||
+ .uleb128 0xb
|
||||
+ .uleb128 0x49
|
||||
+ .uleb128 0x13
|
||||
+ .uleb128 0x2
|
||||
+ .uleb128 0xa
|
||||
+ .byte 0x0
|
||||
+ .byte 0x0
|
||||
+ .byte 0x0
|
||||
+ .section .debug_pubnames,"",@progbits
|
||||
+ .long 0x17
|
||||
+ .value 0x2
|
||||
+ .long .Ldebug_info0
|
||||
+ .long 0x98
|
||||
+ .long 0x75
|
||||
+ .string "func"
|
||||
+ .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
|
||||
+.LASF7:
|
||||
+ .string "long long int"
|
||||
+.LASF0:
|
||||
+ .string "unsigned int"
|
||||
+.LASF11:
|
||||
+ .string "dw2-loclist-prelinked.c"
|
||||
+.LASF12:
|
||||
+ .string "gdb-6.8/gdb/testsuite/gdb.dwarf2"
|
||||
+.LASF4:
|
||||
+ .string "long unsigned int"
|
||||
+.LASF8:
|
||||
+ .string "long long unsigned int"
|
||||
+.LASF2:
|
||||
+ .string "unsigned char"
|
||||
+.LASF9:
|
||||
+ .string "char"
|
||||
+.LASF1:
|
||||
+ .string "long int"
|
||||
+.LASF3:
|
||||
+ .string "short unsigned int"
|
||||
+.LASF5:
|
||||
+ .string "signed char"
|
||||
+.LASF10:
|
||||
+ .string "GNU C 4.3.2 20081007 (Red Hat 4.3.2-6)"
|
||||
+.LASF13:
|
||||
+ .string "func"
|
||||
+.LASF6:
|
||||
+ .string "short int"
|
||||
+ .ident "GCC: (GNU) 4.3.2 20081007 (Red Hat 4.3.2-6)"
|
||||
+ .section .note.GNU-stack,"",@progbits
|
||||
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked-main.c b/gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked-main.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked-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 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/>. */
|
||||
+
|
||||
+/* dw2-loclist-prelinked-func.S */
|
||||
+extern void func (void);
|
||||
+
|
||||
+int
|
||||
+main (void)
|
||||
+{
|
||||
+ func ();
|
||||
+ return 0;
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked.exp b/gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked.exp
|
||||
@@ -0,0 +1,102 @@
|
||||
+# 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.
|
||||
+
|
||||
+# Minimal DWARF-2 unit test
|
||||
+
|
||||
+# This test can only be run on i386/x86_64 targets which support DWARF-2.
|
||||
+# For now pick a sampling of likely targets.
|
||||
+if {(![istarget *-*-linux*]
|
||||
+ && ![istarget *-*-gnu*]
|
||||
+ && ![istarget *-*-elf*]
|
||||
+ && ![istarget *-*-openbsd*])
|
||||
+ || (![istarget "i?86-*-*"] && ![istarget "x86_64-*-*"])} {
|
||||
+ return 0
|
||||
+}
|
||||
+
|
||||
+set testfile "dw2-loclist-prelinked"
|
||||
+set srcfuncfile ${testfile}-func.S
|
||||
+set binsharedfuncfile [standard_output_file ${testfile}.so]
|
||||
+set srcmainfile ${testfile}-main.c
|
||||
+set binfile [standard_output_file ${testfile}]
|
||||
+
|
||||
+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_shlib "${srcdir}/${subdir}/${srcfuncfile}" "${binsharedfuncfile}" {debug additional_flags=-m32}] != "" } {
|
||||
+ untested "Couldn't compile test library"
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+# The new separate debug info file will be stored in the .debug subdirectory.
|
||||
+
|
||||
+if [gdb_gnu_strip_debug ${binsharedfuncfile}] {
|
||||
+ # check that you have a recent version of strip and objcopy installed
|
||||
+ unsupported "cannot produce separate debug info files"
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+if {[catch "system \"/usr/sbin/prelink -qNR --no-exec-shield ${binsharedfuncfile}\""] != 0} {
|
||||
+ # Maybe we don't have prelink.
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+if { [gdb_compile "${srcdir}/${subdir}/${srcmainfile}" \
|
||||
+ "${binfile}" executable [list debug additional_flags=-m32 shlib=${binsharedfuncfile}]] != "" } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+gdb_exit
|
||||
+gdb_start
|
||||
+gdb_reinitialize_dir $srcdir/$subdir
|
||||
+gdb_load ${binfile}
|
||||
+
|
||||
+gdb_run_cmd
|
||||
+
|
||||
+gdb_test "" "Program received signal SIGABRT, Aborted..*" "Enter abort()"
|
||||
+
|
||||
+# Incorrect:
|
||||
+# #0 0x00110430 in __kernel_vsyscall ()
|
||||
+# No symbol table info available.
|
||||
+# #1 0x003d44c0 in raise () from /lib/libc.so.6
|
||||
+# No symbol table info available.
|
||||
+# #2 0x003d5e88 in abort () from /lib/libc.so.6
|
||||
+# No symbol table info available.
|
||||
+# #3 0x44f10437 in func () at dw2-loclist-prelinked.c:8
|
||||
+# i = Could not find the frame base for "func".
|
||||
+
|
||||
+# Correct:
|
||||
+# #0 0x00110430 in __kernel_vsyscall ()
|
||||
+# No symbol table info available.
|
||||
+# #1 0x003d44c0 in raise () from /lib/libc.so.6
|
||||
+# No symbol table info available.
|
||||
+# #2 0x003d5e88 in abort () from /lib/libc.so.6
|
||||
+# No symbol table info available.
|
||||
+# #3 0x4ae36437 in func () at dw2-loclist-prelinked.c:8
|
||||
+# i = 3827288
|
||||
+# #4 0x0804851a in main () at ../../../gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked-main.c:24
|
||||
+# No locals.
|
||||
+
|
||||
+# `abort' can get expressed as `*__GI_abort'.
|
||||
+gdb_test "bt full" "in \[^ \]*abort \\(.*in func \\(.*\r\n\[\t \]+i = -?\[0-9\].*in main \\(.*" "Backtrace after abort()"
|
78
SOURCES/gdb-6.8-quit-never-aborts.patch
Normal file
78
SOURCES/gdb-6.8-quit-never-aborts.patch
Normal file
@ -0,0 +1,78 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Fedora GDB patches <invalid@email.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-6.8-quit-never-aborts.patch
|
||||
|
||||
;; Make the GDB quit processing non-abortable to cleanup everything properly.
|
||||
;;=fedora: It was useful only after gdb-6.8-attach-signalled-detach-stopped.patch .
|
||||
|
||||
We may abort the process of detaching threads with multiple SIGINTs - which are
|
||||
being sent during a testcase terminating its child GDB.
|
||||
|
||||
Some of the threads may not be properly PTRACE_DETACHed which hurts if they
|
||||
should have been detached with SIGSTOP (as they are accidentally left running
|
||||
on the debugger termination).
|
||||
|
||||
diff --git a/gdb/defs.h b/gdb/defs.h
|
||||
--- a/gdb/defs.h
|
||||
+++ b/gdb/defs.h
|
||||
@@ -168,6 +168,10 @@ extern void default_quit_handler (void);
|
||||
/* Flag that function quit should call quit_force. */
|
||||
extern volatile int sync_quit_force_run;
|
||||
|
||||
+#ifdef NEED_DETACH_SIGSTOP
|
||||
+extern int quit_flag_cleanup;
|
||||
+#endif
|
||||
+
|
||||
extern void quit (void);
|
||||
|
||||
/* Helper for the QUIT macro. */
|
||||
diff --git a/gdb/extension.c b/gdb/extension.c
|
||||
--- a/gdb/extension.c
|
||||
+++ b/gdb/extension.c
|
||||
@@ -820,6 +820,11 @@ check_quit_flag (void)
|
||||
int i, result = 0;
|
||||
const struct extension_language_defn *extlang;
|
||||
|
||||
+#ifdef NEED_DETACH_SIGSTOP
|
||||
+ if (quit_flag_cleanup)
|
||||
+ return 0;
|
||||
+#endif
|
||||
+
|
||||
ALL_ENABLED_EXTENSION_LANGUAGES (i, extlang)
|
||||
{
|
||||
if (extlang->ops->check_quit_flag != NULL)
|
||||
diff --git a/gdb/top.c b/gdb/top.c
|
||||
--- a/gdb/top.c
|
||||
+++ b/gdb/top.c
|
||||
@@ -1606,7 +1606,13 @@ quit_force (int *exit_arg, int from_tty)
|
||||
|
||||
qt.from_tty = from_tty;
|
||||
|
||||
+#ifndef NEED_DETACH_SIGSTOP
|
||||
/* We want to handle any quit errors and exit regardless. */
|
||||
+#else
|
||||
+ /* We want to handle any quit errors and exit regardless but we should never
|
||||
+ get user-interrupted to properly detach the inferior. */
|
||||
+ quit_flag_cleanup = 1;
|
||||
+#endif
|
||||
|
||||
/* Get out of tfind mode, and kill or detach all inferiors. */
|
||||
TRY
|
||||
diff --git a/gdb/utils.c b/gdb/utils.c
|
||||
--- a/gdb/utils.c
|
||||
+++ b/gdb/utils.c
|
||||
@@ -108,6 +108,13 @@ static std::chrono::steady_clock::duration prompt_for_continue_wait_time;
|
||||
|
||||
static int debug_timestamp = 0;
|
||||
|
||||
+#ifdef NEED_DETACH_SIGSTOP
|
||||
+/* Nonzero means we are already processing the quitting cleanups and we should
|
||||
+ no longer get aborted. */
|
||||
+
|
||||
+int quit_flag_cleanup;
|
||||
+#endif
|
||||
+
|
||||
/* Nonzero means that strings with character values >0x7F should be printed
|
||||
as octal escapes. Zero means just print the value (e.g. it's an
|
||||
international character, and the terminal or window can cope.) */
|
19
SOURCES/gdb-6.8-sparc64-silence-memcpy-check.patch
Normal file
19
SOURCES/gdb-6.8-sparc64-silence-memcpy-check.patch
Normal file
@ -0,0 +1,19 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Fedora GDB patches <invalid@email.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-6.8-sparc64-silence-memcpy-check.patch
|
||||
|
||||
;; Silence memcpy check which returns false positive (sparc64)
|
||||
;;=push: But it is just a GCC workaround, look up the existing GCC PR for it.
|
||||
|
||||
diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c
|
||||
--- a/gdb/sparc-tdep.c
|
||||
+++ b/gdb/sparc-tdep.c
|
||||
@@ -1462,6 +1462,7 @@ sparc32_store_return_value (struct type *type, struct regcache *regcache,
|
||||
if (sparc_floating_p (type) || sparc_complex_floating_p (type))
|
||||
{
|
||||
/* Floating return values. */
|
||||
+ len = (len <= 8) ? len : 8;
|
||||
memcpy (buf, valbuf, len);
|
||||
regcache->cooked_write (SPARC_F0_REGNUM, buf);
|
||||
if (len > 4)
|
90
SOURCES/gdb-6.8-watchpoint-conditionals-test.patch
Normal file
90
SOURCES/gdb-6.8-watchpoint-conditionals-test.patch
Normal file
@ -0,0 +1,90 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Fedora GDB patches <invalid@email.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-6.8-watchpoint-conditionals-test.patch
|
||||
|
||||
;; Test the watchpoints conditionals works.
|
||||
;;=fedoratest
|
||||
|
||||
For:
|
||||
http://sourceware.org/ml/gdb-patches/2008-04/msg00379.html
|
||||
http://sourceware.org/ml/gdb-cvs/2008-04/msg00104.html
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/watchpoint-cond.c b/gdb/testsuite/gdb.base/watchpoint-cond.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/watchpoint-cond.c
|
||||
@@ -0,0 +1,31 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2008 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+ Please email any bugs, comments, and/or additions to this file to:
|
||||
+ bug-gdb@prep.ai.mit.edu */
|
||||
+
|
||||
+int
|
||||
+main (int argc, char **argv)
|
||||
+{
|
||||
+ static int i = 0; /* `static' to start initialized. */
|
||||
+ int j = 2;
|
||||
+
|
||||
+ for (j = 0; j < 30; j++)
|
||||
+ i = 30 - j;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.base/watchpoint-cond.exp b/gdb/testsuite/gdb.base/watchpoint-cond.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/watchpoint-cond.exp
|
||||
@@ -0,0 +1,37 @@
|
||||
+# Copyright 2008 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+set testfile watchpoint-cond
|
||||
+set srcfile ${testfile}.c
|
||||
+set binfile [standard_output_file ${testfile}]
|
||||
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
|
||||
+ untested "Couldn't compile test program"
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+# Get things started.
|
||||
+
|
||||
+gdb_exit
|
||||
+gdb_start
|
||||
+gdb_reinitialize_dir $srcdir/$subdir
|
||||
+gdb_load ${binfile}
|
||||
+
|
||||
+if { [runto_main] < 0 } {
|
||||
+ untested watchpoint-cond
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+gdb_test "watch i if i < 20" "atchpoint \[0-9\]+: i"
|
||||
+gdb_test "cont" "atchpoint \[0-9\]+: i.*Old value = 20.*New value = 19.*"
|
@ -0,0 +1,68 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Fedora GDB patches <invalid@email.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-7.2.50-sparc-add-workaround-to-broken-debug-files.patch
|
||||
|
||||
;; Toolchain on sparc is slightly broken and debuginfo files are generated
|
||||
;; with non 64bit aligned tables/offsets.
|
||||
;; See for example readelf -S ../Xvnc.debug.
|
||||
;;
|
||||
;; As a consenquence calculation of sectp->filepos as used in
|
||||
;; dwarf2_read_section (gdb/dwarf2read.c:1525) will return a non aligned buffer
|
||||
;; that cannot be used directly as done with MMAP.
|
||||
;; Usage will result in a BusError.
|
||||
;;
|
||||
;; While we figure out what's wrong in the toolchain and do a full archive
|
||||
;; rebuild to fix it, we need to be able to use gdb :)
|
||||
;;=push
|
||||
|
||||
diff --git a/gdb/gdb_bfd.c b/gdb/gdb_bfd.c
|
||||
--- a/gdb/gdb_bfd.c
|
||||
+++ b/gdb/gdb_bfd.c
|
||||
@@ -24,12 +24,14 @@
|
||||
#include "hashtab.h"
|
||||
#include "filestuff.h"
|
||||
#include "vec.h"
|
||||
+#ifndef __sparc__
|
||||
#ifdef HAVE_MMAP
|
||||
#include <sys/mman.h>
|
||||
#ifndef MAP_FAILED
|
||||
#define MAP_FAILED ((void *) -1)
|
||||
#endif
|
||||
#endif
|
||||
+#endif
|
||||
#include "target.h"
|
||||
#include "gdb/fileio.h"
|
||||
#include "inferior.h"
|
||||
@@ -484,6 +486,7 @@ free_one_bfd_section (bfd *abfd, asection *sectp, void *ignore)
|
||||
|
||||
if (sect != NULL && sect->data != NULL)
|
||||
{
|
||||
+#ifndef __sparc__
|
||||
#ifdef HAVE_MMAP
|
||||
if (sect->map_addr != NULL)
|
||||
{
|
||||
@@ -493,6 +496,7 @@ free_one_bfd_section (bfd *abfd, asection *sectp, void *ignore)
|
||||
gdb_assert (res == 0);
|
||||
}
|
||||
else
|
||||
+#endif
|
||||
#endif
|
||||
xfree (sect->data);
|
||||
}
|
||||
@@ -659,6 +663,7 @@ gdb_bfd_map_section (asection *sectp, bfd_size_type *size)
|
||||
if (descriptor->data != NULL)
|
||||
goto done;
|
||||
|
||||
+#ifndef __sparc__
|
||||
#ifdef HAVE_MMAP
|
||||
if (!bfd_is_section_compressed (abfd, sectp))
|
||||
{
|
||||
@@ -693,6 +698,7 @@ gdb_bfd_map_section (asection *sectp, bfd_size_type *size)
|
||||
}
|
||||
}
|
||||
#endif /* HAVE_MMAP */
|
||||
+#endif
|
||||
|
||||
/* Handle compressed sections, or ordinary uncompressed sections in
|
||||
the no-mmap case. */
|
97
SOURCES/gdb-archer-next-over-throw-cxx-exec.patch
Normal file
97
SOURCES/gdb-archer-next-over-throw-cxx-exec.patch
Normal file
@ -0,0 +1,97 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Fedora GDB patches <invalid@email.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-archer-next-over-throw-cxx-exec.patch
|
||||
|
||||
;; Fix follow-exec for C++ programs (bugreported by Martin Stransky).
|
||||
;;=fedoratest
|
||||
|
||||
Archer-upstreamed:
|
||||
http://sourceware.org/ml/archer/2010-q2/msg00031.html
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.cp/cxxexec.cc b/gdb/testsuite/gdb.cp/cxxexec.cc
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.cp/cxxexec.cc
|
||||
@@ -0,0 +1,25 @@
|
||||
+/* This test script is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2010 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+#include <unistd.h>
|
||||
+
|
||||
+int
|
||||
+main()
|
||||
+{
|
||||
+ execlp ("true", "true", NULL);
|
||||
+ return 1;
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.cp/cxxexec.exp b/gdb/testsuite/gdb.cp/cxxexec.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.cp/cxxexec.exp
|
||||
@@ -0,0 +1,51 @@
|
||||
+# Copyright 2010 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+if { [skip_cplus_tests] } { continue }
|
||||
+
|
||||
+set testfile cxxexec
|
||||
+if { [prepare_for_testing ${testfile}.exp ${testfile} ${testfile}.cc {c++ debug}] } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+runto_main
|
||||
+
|
||||
+# We could stop after `continue' again at `main'.
|
||||
+delete_breakpoints
|
||||
+
|
||||
+set test "p _Unwind_DebugHook"
|
||||
+gdb_test_multiple $test $test {
|
||||
+ -re " = .* 0x\[0-9a-f\].*\r\n$gdb_prompt $" {
|
||||
+ pass $test
|
||||
+ }
|
||||
+ -re "\r\nNo symbol .*\r\n$gdb_prompt $" {
|
||||
+ xfail $test
|
||||
+ untested ${testfile}.exp
|
||||
+ return -1
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+set test continue
|
||||
+gdb_test_multiple $test $test {
|
||||
+ -re "Cannot access memory at address 0x\[0-9a-f\]+\r\n$gdb_prompt $" {
|
||||
+ fail $test
|
||||
+ }
|
||||
+ -re "\r\n$gdb_prompt $" {
|
||||
+ pass $test
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+# `info inferiors' can show <null> on older GDBs.
|
||||
+gdb_test "info threads" "info threads" "program finished"
|
89
SOURCES/gdb-archer-pie-addons-keep-disabled.patch
Normal file
89
SOURCES/gdb-archer-pie-addons-keep-disabled.patch
Normal file
@ -0,0 +1,89 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Fedora GDB patches <invalid@email.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-archer-pie-addons-keep-disabled.patch
|
||||
|
||||
;;=push+jan: Breakpoints disabling matching should not be based on address.
|
||||
|
||||
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
|
||||
--- a/gdb/breakpoint.c
|
||||
+++ b/gdb/breakpoint.c
|
||||
@@ -15522,6 +15522,50 @@ initialize_breakpoint_ops (void)
|
||||
|
||||
static struct cmd_list_element *enablebreaklist = NULL;
|
||||
|
||||
+void
|
||||
+breakpoints_relocate (struct objfile *objfile, struct section_offsets *delta)
|
||||
+{
|
||||
+ struct bp_location *bl, **blp_tmp;
|
||||
+ int changed = 0;
|
||||
+
|
||||
+ gdb_assert (objfile->separate_debug_objfile_backlink == NULL);
|
||||
+
|
||||
+ ALL_BP_LOCATIONS (bl, blp_tmp)
|
||||
+ {
|
||||
+ struct obj_section *osect;
|
||||
+
|
||||
+ /* BL->SECTION can be correctly NULL for breakpoints with multiple
|
||||
+ locations expanded through symtab. */
|
||||
+
|
||||
+ ALL_OBJFILE_OSECTIONS (objfile, osect)
|
||||
+ {
|
||||
+ CORE_ADDR relocated_address;
|
||||
+ CORE_ADDR delta_offset;
|
||||
+
|
||||
+ delta_offset = ANOFFSET (delta, osect->the_bfd_section->index);
|
||||
+ if (delta_offset == 0)
|
||||
+ continue;
|
||||
+ relocated_address = bl->address + delta_offset;
|
||||
+
|
||||
+ if (obj_section_addr (osect) <= relocated_address
|
||||
+ && relocated_address < obj_section_endaddr (osect))
|
||||
+ {
|
||||
+ if (bl->inserted)
|
||||
+ remove_breakpoint (bl);
|
||||
+
|
||||
+ bl->address += delta_offset;
|
||||
+ bl->requested_address += delta_offset;
|
||||
+
|
||||
+ changed = 1;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (changed)
|
||||
+ qsort (bp_locations, bp_locations_count, sizeof (*bp_locations),
|
||||
+ bp_locations_compare);
|
||||
+}
|
||||
+
|
||||
void
|
||||
_initialize_breakpoint (void)
|
||||
{
|
||||
diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h
|
||||
--- a/gdb/breakpoint.h
|
||||
+++ b/gdb/breakpoint.h
|
||||
@@ -1679,6 +1679,9 @@ extern const char *ep_parse_optional_if_clause (const char **arg);
|
||||
UIOUT iff debugging multiple threads. */
|
||||
extern void maybe_print_thread_hit_breakpoint (struct ui_out *uiout);
|
||||
|
||||
+extern void breakpoints_relocate (struct objfile *objfile,
|
||||
+ struct section_offsets *delta);
|
||||
+
|
||||
/* Print the specified breakpoint. */
|
||||
extern void print_breakpoint (breakpoint *bp);
|
||||
|
||||
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
|
||||
--- a/gdb/objfiles.c
|
||||
+++ b/gdb/objfiles.c
|
||||
@@ -883,6 +883,11 @@ objfile_relocate1 (struct objfile *objfile,
|
||||
obj_section_addr (s));
|
||||
}
|
||||
|
||||
+ /* Final call of breakpoint_re_set can keep breakpoint locations disabled if
|
||||
+ their addresses match. */
|
||||
+ if (objfile->separate_debug_objfile_backlink == NULL)
|
||||
+ breakpoints_relocate (objfile, delta);
|
||||
+
|
||||
/* Data changed. */
|
||||
return 1;
|
||||
}
|
63
SOURCES/gdb-archer-pie-addons.patch
Normal file
63
SOURCES/gdb-archer-pie-addons.patch
Normal file
@ -0,0 +1,63 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Fedora GDB patches <invalid@email.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-archer-pie-addons.patch
|
||||
|
||||
;;=push+jan: May get obsoleted by Tom's unrelocated objfiles patch.
|
||||
|
||||
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
|
||||
--- a/gdb/gdbtypes.h
|
||||
+++ b/gdb/gdbtypes.h
|
||||
@@ -505,6 +505,7 @@ enum field_loc_kind
|
||||
{
|
||||
FIELD_LOC_KIND_BITPOS, /**< bitpos */
|
||||
FIELD_LOC_KIND_ENUMVAL, /**< enumval */
|
||||
+ /* This address is unrelocated by the objfile's ANOFFSET. */
|
||||
FIELD_LOC_KIND_PHYSADDR, /**< physaddr */
|
||||
FIELD_LOC_KIND_PHYSNAME, /**< physname */
|
||||
FIELD_LOC_KIND_DWARF_BLOCK /**< dwarf_block */
|
||||
@@ -556,6 +557,7 @@ union field_location
|
||||
field. Otherwise, physname is the mangled label of the
|
||||
static field. */
|
||||
|
||||
+ /* This address is unrelocated by the objfile's ANOFFSET. */
|
||||
CORE_ADDR physaddr;
|
||||
const char *physname;
|
||||
|
||||
@@ -1438,6 +1440,7 @@ extern void set_type_vptr_basetype (struct type *, struct type *);
|
||||
#define FIELD_ENUMVAL_LVAL(thisfld) ((thisfld).loc.enumval)
|
||||
#define FIELD_ENUMVAL(thisfld) (FIELD_ENUMVAL_LVAL (thisfld) + 0)
|
||||
#define FIELD_STATIC_PHYSNAME(thisfld) ((thisfld).loc.physname)
|
||||
+/* This address is unrelocated by the objfile's ANOFFSET. */
|
||||
#define FIELD_STATIC_PHYSADDR(thisfld) ((thisfld).loc.physaddr)
|
||||
#define FIELD_DWARF_BLOCK(thisfld) ((thisfld).loc.dwarf_block)
|
||||
#define SET_FIELD_BITPOS(thisfld, bitpos) \
|
||||
@@ -1449,6 +1452,7 @@ extern void set_type_vptr_basetype (struct type *, struct type *);
|
||||
#define SET_FIELD_PHYSNAME(thisfld, name) \
|
||||
(FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_PHYSNAME, \
|
||||
FIELD_STATIC_PHYSNAME (thisfld) = (name))
|
||||
+/* This address is unrelocated by the objfile's ANOFFSET. */
|
||||
#define SET_FIELD_PHYSADDR(thisfld, addr) \
|
||||
(FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_PHYSADDR, \
|
||||
FIELD_STATIC_PHYSADDR (thisfld) = (addr))
|
||||
@@ -1465,6 +1469,7 @@ extern void set_type_vptr_basetype (struct type *, struct type *);
|
||||
#define TYPE_FIELD_BITPOS(thistype, n) FIELD_BITPOS (TYPE_FIELD (thistype, n))
|
||||
#define TYPE_FIELD_ENUMVAL(thistype, n) FIELD_ENUMVAL (TYPE_FIELD (thistype, n))
|
||||
#define TYPE_FIELD_STATIC_PHYSNAME(thistype, n) FIELD_STATIC_PHYSNAME (TYPE_FIELD (thistype, n))
|
||||
+/* This address is unrelocated by the objfile's ANOFFSET. */
|
||||
#define TYPE_FIELD_STATIC_PHYSADDR(thistype, n) FIELD_STATIC_PHYSADDR (TYPE_FIELD (thistype, n))
|
||||
#define TYPE_FIELD_DWARF_BLOCK(thistype, n) FIELD_DWARF_BLOCK (TYPE_FIELD (thistype, n))
|
||||
#define TYPE_FIELD_ARTIFICIAL(thistype, n) FIELD_ARTIFICIAL(TYPE_FIELD(thistype,n))
|
||||
diff --git a/gdb/value.c b/gdb/value.c
|
||||
--- a/gdb/value.c
|
||||
+++ b/gdb/value.c
|
||||
@@ -2829,7 +2829,8 @@ value_static_field (struct type *type, int fieldno)
|
||||
{
|
||||
case FIELD_LOC_KIND_PHYSADDR:
|
||||
retval = value_at_lazy (TYPE_FIELD_TYPE (type, fieldno),
|
||||
- TYPE_FIELD_STATIC_PHYSADDR (type, fieldno));
|
||||
+ TYPE_FIELD_STATIC_PHYSADDR (type, fieldno)
|
||||
+ + (TYPE_OBJFILE (type) == NULL ? 0 : ANOFFSET (TYPE_OBJFILE (type)->section_offsets, SECT_OFF_TEXT (TYPE_OBJFILE (type)))));
|
||||
break;
|
||||
case FIELD_LOC_KIND_PHYSNAME:
|
||||
{
|
3737
SOURCES/gdb-archer-vla-tests.patch
Normal file
3737
SOURCES/gdb-archer-vla-tests.patch
Normal file
File diff suppressed because it is too large
Load Diff
600
SOURCES/gdb-archer.patch
Normal file
600
SOURCES/gdb-archer.patch
Normal file
@ -0,0 +1,600 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Fedora GDB patches <invalid@email.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-archer.patch
|
||||
|
||||
;; Python patches of: http://sourceware.org/gdb/wiki/ProjectArcher
|
||||
;;=push
|
||||
|
||||
http://sourceware.org/gdb/wiki/ProjectArcher
|
||||
http://sourceware.org/gdb/wiki/ArcherBranchManagement
|
||||
|
||||
GIT snapshot:
|
||||
commit 718a1618b2f691a7f407213bb50f100ac59f91c3
|
||||
|
||||
tromey/python
|
||||
|
||||
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
|
||||
--- a/gdb/Makefile.in
|
||||
+++ b/gdb/Makefile.in
|
||||
@@ -2112,6 +2112,12 @@ stamp-h: $(srcdir)/config.in config.status
|
||||
CONFIG_LINKS= \
|
||||
$(SHELL) config.status
|
||||
|
||||
+.gdbinit: $(srcdir)/gdbinit.in config.status
|
||||
+ CONFIG_FILES=".gdbinit:gdbinit.in" \
|
||||
+ CONFIG_COMMANDS= \
|
||||
+ CONFIG_HEADERS= \
|
||||
+ $(SHELL) config.status
|
||||
+
|
||||
config.status: $(srcdir)/configure configure.nat configure.tgt configure.host ../bfd/development.sh
|
||||
$(SHELL) config.status --recheck
|
||||
|
||||
diff --git a/gdb/data-directory/Makefile.in b/gdb/data-directory/Makefile.in
|
||||
--- a/gdb/data-directory/Makefile.in
|
||||
+++ b/gdb/data-directory/Makefile.in
|
||||
@@ -80,6 +80,7 @@ PYTHON_FILE_LIST = \
|
||||
gdb/unwinder.py \
|
||||
gdb/xmethod.py \
|
||||
gdb/command/__init__.py \
|
||||
+ gdb/command/ignore_errors.py \
|
||||
gdb/command/explore.py \
|
||||
gdb/command/backtrace.py \
|
||||
gdb/command/frame_filters.py \
|
||||
@@ -92,6 +93,8 @@ PYTHON_FILE_LIST = \
|
||||
gdb/function/as_string.py \
|
||||
gdb/function/caller_is.py \
|
||||
gdb/function/strfns.py \
|
||||
+ gdb/function/caller_is.py \
|
||||
+ gdb/function/in_scope.py \
|
||||
gdb/printer/__init__.py \
|
||||
gdb/printer/bound_registers.py
|
||||
|
||||
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
|
||||
--- a/gdb/doc/gdb.texinfo
|
||||
+++ b/gdb/doc/gdb.texinfo
|
||||
@@ -1245,6 +1245,16 @@ for remote debugging.
|
||||
Run using @var{device} for your program's standard input and output.
|
||||
@c FIXME: kingdon thinks there is more to -tty. Investigate.
|
||||
|
||||
+@item -P
|
||||
+@cindex @code{-P}
|
||||
+@itemx --python
|
||||
+@cindex @code{--python}
|
||||
+Change interpretation of command line so that the argument immediately
|
||||
+following this switch is taken to be the name of a Python script file.
|
||||
+This option stops option processing; subsequent options are passed to
|
||||
+Python as @code{sys.argv}. This option is only available if Python
|
||||
+scripting support was enabled when @value{GDBN} was configured.
|
||||
+
|
||||
@c resolve the situation of these eventually
|
||||
@item -tui
|
||||
@cindex @code{--tui}
|
||||
diff --git a/gdb/doc/python.texi b/gdb/doc/python.texi
|
||||
--- a/gdb/doc/python.texi
|
||||
+++ b/gdb/doc/python.texi
|
||||
@@ -88,8 +88,6 @@ containing @code{end}. For example:
|
||||
|
||||
@smallexample
|
||||
(@value{GDBP}) python
|
||||
-Type python script
|
||||
-End with a line saying just "end".
|
||||
>print 23
|
||||
>end
|
||||
23
|
||||
diff --git a/gdb/gdb-gdb.gdb.in b/gdb/gdb-gdb.gdb.in
|
||||
--- a/gdb/gdb-gdb.gdb.in
|
||||
+++ b/gdb/gdb-gdb.gdb.in
|
||||
@@ -1,5 +1,15 @@
|
||||
echo Setting up the environment for debugging gdb.\n
|
||||
|
||||
+# Set up the Python library and "require" command.
|
||||
+python
|
||||
+from os.path import abspath
|
||||
+gdb.datadir = abspath ('@srcdir@/python/lib')
|
||||
+gdb.pythonlibdir = gdb.datadir
|
||||
+gdb.__path__ = [gdb.datadir + '/gdb']
|
||||
+sys.path.insert(0, gdb.datadir)
|
||||
+end
|
||||
+source @srcdir@/python/lib/gdb/__init__.py
|
||||
+
|
||||
if !$gdb_init_done
|
||||
set variable $gdb_init_done = 1
|
||||
|
||||
diff --git a/gdb/main.c b/gdb/main.c
|
||||
--- a/gdb/main.c
|
||||
+++ b/gdb/main.c
|
||||
@@ -33,6 +33,7 @@
|
||||
|
||||
#include "interps.h"
|
||||
#include "main.h"
|
||||
+#include "python/python.h"
|
||||
#include "source.h"
|
||||
#include "cli/cli-cmds.h"
|
||||
#include "objfiles.h"
|
||||
@@ -479,7 +480,7 @@ exec_or_core_file_attach (const char *filename, int from_tty)
|
||||
}
|
||||
|
||||
static void
|
||||
-captured_main_1 (struct captured_main_args *context)
|
||||
+captured_main_1 (struct captured_main_args *context, int &python_script)
|
||||
{
|
||||
int argc = context->argc;
|
||||
char **argv = context->argv;
|
||||
@@ -695,10 +696,14 @@ captured_main_1 (struct captured_main_args *context)
|
||||
{"args", no_argument, &set_args, 1},
|
||||
{"l", required_argument, 0, 'l'},
|
||||
{"return-child-result", no_argument, &return_child_result, 1},
|
||||
+#if HAVE_PYTHON
|
||||
+ {"python", no_argument, 0, 'P'},
|
||||
+ {"P", no_argument, 0, 'P'},
|
||||
+#endif
|
||||
{0, no_argument, 0, 0}
|
||||
};
|
||||
|
||||
- while (1)
|
||||
+ while (!python_script)
|
||||
{
|
||||
int option_index;
|
||||
|
||||
@@ -716,6 +721,9 @@ captured_main_1 (struct captured_main_args *context)
|
||||
case 0:
|
||||
/* Long option that just sets a flag. */
|
||||
break;
|
||||
+ case 'P':
|
||||
+ python_script = 1;
|
||||
+ break;
|
||||
case OPT_SE:
|
||||
symarg = optarg;
|
||||
execarg = optarg;
|
||||
@@ -890,7 +898,31 @@ captured_main_1 (struct captured_main_args *context)
|
||||
|
||||
/* Now that gdb_init has created the initial inferior, we're in
|
||||
position to set args for that inferior. */
|
||||
- if (set_args)
|
||||
+ if (python_script)
|
||||
+ {
|
||||
+ /* The first argument is a python script to evaluate, and
|
||||
+ subsequent arguments are passed to the script for
|
||||
+ processing there. */
|
||||
+ if (optind >= argc)
|
||||
+ {
|
||||
+ fprintf_unfiltered (gdb_stderr,
|
||||
+ _("%s: Python script file name required\n"),
|
||||
+ argv[0]);
|
||||
+ exit (1);
|
||||
+ }
|
||||
+
|
||||
+ /* FIXME: should handle inferior I/O intelligently here.
|
||||
+ E.g., should be possible to run gdb in pipeline and have
|
||||
+ Python (and gdb) output go to stderr or file; and if a
|
||||
+ prompt is needed, open the tty. */
|
||||
+ quiet = 1;
|
||||
+ /* FIXME: should read .gdbinit if, and only if, a prompt is
|
||||
+ requested by the script. Though... maybe this is not
|
||||
+ ideal? */
|
||||
+ /* FIXME: likewise, reading in history. */
|
||||
+ inhibit_gdbinit = 1;
|
||||
+ }
|
||||
+ else if (set_args)
|
||||
{
|
||||
/* The remaining options are the command-line options for the
|
||||
inferior. The first one is the sym/exec file, and the rest
|
||||
@@ -1180,7 +1212,8 @@ captured_main_1 (struct captured_main_args *context)
|
||||
|
||||
/* Read in the old history after all the command files have been
|
||||
read. */
|
||||
- init_history ();
|
||||
+ if (!python_script)
|
||||
+ init_history ();
|
||||
|
||||
if (batch_flag)
|
||||
{
|
||||
@@ -1193,24 +1226,37 @@ static void
|
||||
captured_main (void *data)
|
||||
{
|
||||
struct captured_main_args *context = (struct captured_main_args *) data;
|
||||
+ int python_script = 0;
|
||||
|
||||
- captured_main_1 (context);
|
||||
+ captured_main_1 (context, python_script);
|
||||
|
||||
- /* NOTE: cagney/1999-11-07: There is probably no reason for not
|
||||
- moving this loop and the code found in captured_command_loop()
|
||||
- into the command_loop() proper. The main thing holding back that
|
||||
- change - SET_TOP_LEVEL() - has been eliminated. */
|
||||
- while (1)
|
||||
+#if HAVE_PYTHON
|
||||
+ if (python_script)
|
||||
{
|
||||
- TRY
|
||||
- {
|
||||
- captured_command_loop ();
|
||||
- }
|
||||
- CATCH (ex, RETURN_MASK_ALL)
|
||||
+ extern int pagination_enabled;
|
||||
+ pagination_enabled = 0;
|
||||
+ run_python_script (context->argc - optind, &context->argv[optind]);
|
||||
+ return;
|
||||
+ }
|
||||
+ else
|
||||
+#endif
|
||||
+ {
|
||||
+ /* NOTE: cagney/1999-11-07: There is probably no reason for not
|
||||
+ moving this loop and the code found in captured_command_loop()
|
||||
+ into the command_loop() proper. The main thing holding back that
|
||||
+ change - SET_TOP_LEVEL() - has been eliminated. */
|
||||
+ while (1)
|
||||
{
|
||||
- exception_print (gdb_stderr, ex);
|
||||
+ TRY
|
||||
+ {
|
||||
+ captured_command_loop ();
|
||||
+ }
|
||||
+ CATCH (ex, RETURN_MASK_ALL)
|
||||
+ {
|
||||
+ exception_print (gdb_stderr, ex);
|
||||
+ }
|
||||
+ END_CATCH
|
||||
}
|
||||
- END_CATCH
|
||||
}
|
||||
/* No exit -- exit is through quit_command. */
|
||||
}
|
||||
@@ -1253,6 +1299,12 @@ print_gdb_help (struct ui_file *stream)
|
||||
fputs_unfiltered (_("\
|
||||
This is the GNU debugger. Usage:\n\n\
|
||||
gdb [options] [executable-file [core-file or process-id]]\n\
|
||||
+ gdb [options] --args executable-file [inferior-arguments ...]\n"), stream);
|
||||
+#if HAVE_PYTHON
|
||||
+ fputs_unfiltered (_("\
|
||||
+ gdb [options] [--python|-P] script-file [script-arguments ...]\n"), stream);
|
||||
+#endif
|
||||
+ fputs_unfiltered (_("\n\
|
||||
gdb [options] --args executable-file [inferior-arguments ...]\n\n\
|
||||
"), stream);
|
||||
fputs_unfiltered (_("\
|
||||
@@ -1298,6 +1350,13 @@ Output and user interface control:\n\n\
|
||||
#endif
|
||||
fputs_unfiltered (_("\
|
||||
--dbx DBX compatibility mode.\n\
|
||||
+"), stream);
|
||||
+#if HAVE_PYTHON
|
||||
+ fputs_unfiltered (_("\
|
||||
+ --python, -P Following argument is Python script file; remaining\n\
|
||||
+ arguments are passed to script.\n"), stream);
|
||||
+#endif
|
||||
+ fputs_unfiltered (_("\
|
||||
-q, --quiet, --silent\n\
|
||||
Do not print version number on startup.\n\n\
|
||||
"), stream);
|
||||
diff --git a/gdb/python/lib/gdb/command/ignore_errors.py b/gdb/python/lib/gdb/command/ignore_errors.py
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/python/lib/gdb/command/ignore_errors.py
|
||||
@@ -0,0 +1,37 @@
|
||||
+# Ignore errors in user commands.
|
||||
+
|
||||
+# Copyright (C) 2008 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+import gdb
|
||||
+
|
||||
+class IgnoreErrorsCommand (gdb.Command):
|
||||
+ """Execute a single command, ignoring all errors.
|
||||
+Only one-line commands are supported.
|
||||
+This is primarily useful in scripts."""
|
||||
+
|
||||
+ def __init__ (self):
|
||||
+ super (IgnoreErrorsCommand, self).__init__ ("ignore-errors",
|
||||
+ gdb.COMMAND_OBSCURE,
|
||||
+ # FIXME...
|
||||
+ gdb.COMPLETE_COMMAND)
|
||||
+
|
||||
+ def invoke (self, arg, from_tty):
|
||||
+ try:
|
||||
+ gdb.execute (arg, from_tty)
|
||||
+ except:
|
||||
+ pass
|
||||
+
|
||||
+IgnoreErrorsCommand ()
|
||||
diff --git a/gdb/python/lib/gdb/function/in_scope.py b/gdb/python/lib/gdb/function/in_scope.py
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/python/lib/gdb/function/in_scope.py
|
||||
@@ -0,0 +1,47 @@
|
||||
+# In-scope function.
|
||||
+
|
||||
+# Copyright (C) 2008 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+import gdb
|
||||
+
|
||||
+class InScope (gdb.Function):
|
||||
+ """Return True if all the given variables or macros are in scope.
|
||||
+Takes one argument for each variable name to be checked."""
|
||||
+
|
||||
+ def __init__ (self):
|
||||
+ super (InScope, self).__init__ ("in_scope")
|
||||
+
|
||||
+ def invoke (self, *vars):
|
||||
+ if len (vars) == 0:
|
||||
+ raise (TypeError, "in_scope takes at least one argument")
|
||||
+
|
||||
+ # gdb.Value isn't hashable so it can't be put in a map.
|
||||
+ # Convert to string first.
|
||||
+ wanted = set (map (lambda x: x.string (), vars))
|
||||
+ found = set ()
|
||||
+ block = gdb.selected_frame ().block ()
|
||||
+ while block:
|
||||
+ for sym in block:
|
||||
+ if (sym.is_argument or sym.is_constant
|
||||
+ or sym.is_function or sym.is_variable):
|
||||
+ if sym.name in wanted:
|
||||
+ found.add (sym.name)
|
||||
+
|
||||
+ block = block.superblock
|
||||
+
|
||||
+ return wanted == found
|
||||
+
|
||||
+InScope ()
|
||||
diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h
|
||||
--- a/gdb/python/python-internal.h
|
||||
+++ b/gdb/python/python-internal.h
|
||||
@@ -644,6 +644,9 @@ class gdbpy_enter_varobj : public gdbpy_enter
|
||||
|
||||
};
|
||||
|
||||
+struct cleanup *ensure_python_env (struct gdbarch *gdbarch,
|
||||
+ const struct language_defn *language);
|
||||
+
|
||||
extern struct gdbarch *python_gdbarch;
|
||||
extern const struct language_defn *python_language;
|
||||
|
||||
diff --git a/gdb/python/python.c b/gdb/python/python.c
|
||||
--- a/gdb/python/python.c
|
||||
+++ b/gdb/python/python.c
|
||||
@@ -95,6 +95,8 @@ const struct extension_language_defn extension_language_python =
|
||||
#include "linespec.h"
|
||||
#include "source.h"
|
||||
#include "version.h"
|
||||
+#include "inferior.h"
|
||||
+#include "gdbthread.h"
|
||||
#include "target.h"
|
||||
#include "gdbthread.h"
|
||||
#include "interps.h"
|
||||
@@ -237,6 +239,29 @@ gdbpy_enter::~gdbpy_enter ()
|
||||
restore_active_ext_lang (m_previous_active);
|
||||
}
|
||||
|
||||
+static void
|
||||
+restore_python_env (void *p)
|
||||
+{
|
||||
+ gdbpy_enter *env = (gdbpy_enter *) p;
|
||||
+
|
||||
+ delete env;
|
||||
+}
|
||||
+
|
||||
+/* Called before entering the Python interpreter to install the
|
||||
+ current language and architecture to be used for Python values.
|
||||
+ Also set the active extension language for GDB so that SIGINT's
|
||||
+ are directed our way, and if necessary install the right SIGINT
|
||||
+ handler. */
|
||||
+
|
||||
+struct cleanup *
|
||||
+ensure_python_env (struct gdbarch *gdbarch,
|
||||
+ const struct language_defn *language)
|
||||
+{
|
||||
+ gdbpy_enter *env = new gdbpy_enter (gdbarch, language);
|
||||
+
|
||||
+ return make_cleanup (restore_python_env, env);
|
||||
+}
|
||||
+
|
||||
/* Set the quit flag. */
|
||||
|
||||
static void
|
||||
@@ -1367,6 +1392,92 @@ gdbpy_print_stack (void)
|
||||
|
||||
/* Return the current Progspace.
|
||||
There always is one. */
|
||||
+/* True if 'gdb -P' was used, false otherwise. */
|
||||
+static int running_python_script;
|
||||
+
|
||||
+/* True if we are currently in a call to 'gdb.cli', false otherwise. */
|
||||
+static int in_cli;
|
||||
+
|
||||
+/* Enter the command loop. */
|
||||
+
|
||||
+static PyObject *
|
||||
+gdbpy_cli (PyObject *unused1, PyObject *unused2)
|
||||
+{
|
||||
+ if (! running_python_script || in_cli)
|
||||
+ return PyErr_Format (PyExc_RuntimeError, "cannot invoke CLI recursively");
|
||||
+
|
||||
+ if (current_uiout->is_mi_like_p ())
|
||||
+ return PyErr_Format (PyExc_RuntimeError, _("Cannot invoke CLI from MI."));
|
||||
+
|
||||
+ in_cli = 1;
|
||||
+ /* See captured_command_loop. */
|
||||
+
|
||||
+ /* Give the interpreter a chance to print a prompt. */
|
||||
+ interp_pre_command_loop (top_level_interpreter ());
|
||||
+
|
||||
+ /* Now it's time to start the event loop. */
|
||||
+ start_event_loop ();
|
||||
+
|
||||
+ in_cli = 0;
|
||||
+
|
||||
+ Py_RETURN_NONE;
|
||||
+}
|
||||
+
|
||||
+/* Set up the Python argument vector and evaluate a script. This is
|
||||
+ used to implement 'gdb -P'. */
|
||||
+
|
||||
+void
|
||||
+run_python_script (int argc, char **argv)
|
||||
+{
|
||||
+ FILE *input;
|
||||
+
|
||||
+ /* We never free this, since we plan to exit at the end. */
|
||||
+ ensure_python_env (get_current_arch (), current_language);
|
||||
+
|
||||
+ running_python_script = 1;
|
||||
+
|
||||
+#if PYTHON_ABI_VERSION < 3
|
||||
+ PySys_SetArgv (argc - 1, argv + 1);
|
||||
+#else
|
||||
+ {
|
||||
+ wchar_t **wargv = (wchar_t **) alloca (sizeof (*wargv) * (argc + 1));
|
||||
+ int i;
|
||||
+
|
||||
+ for (i = 1; i < argc; i++)
|
||||
+ {
|
||||
+ size_t len = mbstowcs (NULL, argv[i], 0);
|
||||
+ /* Python-related GDB sources are built with -DNDEBUG
|
||||
+ https://sourceware.org/bugzilla/show_bug.cgi?id=20445 */
|
||||
+ size_t len2 ATTRIBUTE_UNUSED;
|
||||
+
|
||||
+ if (len == (size_t) -1)
|
||||
+ {
|
||||
+ fprintf (stderr, "Invalid multibyte argument #%d \"%s\"\n",
|
||||
+ i, argv[i]);
|
||||
+ exit (1);
|
||||
+ }
|
||||
+ wargv[i] = (wchar_t *) alloca (sizeof (**wargv) * (len + 1));
|
||||
+ len2 = mbstowcs (wargv[i], argv[i], len + 1);
|
||||
+ assert (len2 == len);
|
||||
+ }
|
||||
+ wargv[argc] = NULL;
|
||||
+ PySys_SetArgv (argc - 1, wargv + 1);
|
||||
+ }
|
||||
+#endif
|
||||
+
|
||||
+ input = fopen (argv[0], "r");
|
||||
+ if (! input)
|
||||
+ {
|
||||
+ fprintf (stderr, "could not open %s: %s\n", argv[0], strerror (errno));
|
||||
+ exit (1);
|
||||
+ }
|
||||
+ PyRun_SimpleFile (input, argv[0]);
|
||||
+ fclose (input);
|
||||
+ exit (0);
|
||||
+}
|
||||
+
|
||||
+
|
||||
+
|
||||
|
||||
static PyObject *
|
||||
gdbpy_get_current_progspace (PyObject *unused1, PyObject *unused2)
|
||||
@@ -2057,6 +2168,8 @@ PyMethodDef python_GdbMethods[] =
|
||||
Evaluate command, a string, as a gdb CLI command. Optionally returns\n\
|
||||
a Python String containing the output of the command if to_string is\n\
|
||||
set to True." },
|
||||
+ { "cli", gdbpy_cli, METH_NOARGS,
|
||||
+ "Enter the gdb CLI" },
|
||||
{ "parameter", gdbpy_parameter, METH_VARARGS,
|
||||
"Return a gdb parameter's value" },
|
||||
|
||||
diff --git a/gdb/python/python.h b/gdb/python/python.h
|
||||
--- a/gdb/python/python.h
|
||||
+++ b/gdb/python/python.h
|
||||
@@ -25,4 +25,6 @@
|
||||
/* This is all that python exports to gdb. */
|
||||
extern const struct extension_language_defn extension_language_python;
|
||||
|
||||
+extern void run_python_script (int argc, char **argv);
|
||||
+
|
||||
#endif /* GDB_PYTHON_H */
|
||||
diff --git a/gdb/testsuite/gdb.python/py-frame.exp b/gdb/testsuite/gdb.python/py-frame.exp
|
||||
--- a/gdb/testsuite/gdb.python/py-frame.exp
|
||||
+++ b/gdb/testsuite/gdb.python/py-frame.exp
|
||||
@@ -95,6 +95,8 @@ gdb_test "python print ('result = %s' % f0.read_var ('a'))" " = 1" "test Frame.r
|
||||
|
||||
gdb_test "python print ('result = %s' % (gdb.selected_frame () == f1))" " = True" "test gdb.selected_frame"
|
||||
|
||||
+gdb_test "python print ('result = %s' % (f0.block ()))" "<gdb.Block object at 0x\[\[:xdigit:\]\]+>" "test Frame.block"
|
||||
+
|
||||
# Can read SP register.
|
||||
gdb_test "python print ('result = %s' % (gdb.selected_frame ().read_register ('sp') == gdb.parse_and_eval ('\$sp')))" \
|
||||
" = True" \
|
||||
diff --git a/gdb/testsuite/gdb.python/py-value.exp b/gdb/testsuite/gdb.python/py-value.exp
|
||||
--- a/gdb/testsuite/gdb.python/py-value.exp
|
||||
+++ b/gdb/testsuite/gdb.python/py-value.exp
|
||||
@@ -384,6 +384,15 @@ proc test_value_after_death {} {
|
||||
"print value's type"
|
||||
}
|
||||
|
||||
+# Regression test for a cast failure. The bug was that if we cast a
|
||||
+# value to its own type, gdb could crash. This happened because we
|
||||
+# could end up double-freeing a struct value.
|
||||
+proc test_cast_regression {} {
|
||||
+ gdb_test "python v = gdb.Value(5)" "" "create value for cast test"
|
||||
+ gdb_test "python v = v.cast(v.type)" "" "cast value for cast test"
|
||||
+ gdb_test "python print(v)" "5" "print value for cast test"
|
||||
+}
|
||||
+
|
||||
# Regression test for invalid subscript operations. The bug was that
|
||||
# the type of the value was not being checked before allowing a
|
||||
# subscript operation to proceed.
|
||||
@@ -512,6 +521,7 @@ if ![runto_main] then {
|
||||
test_value_in_inferior
|
||||
test_inferior_function_call
|
||||
test_value_after_death
|
||||
+test_cast_regression
|
||||
|
||||
# Test either C or C++ values.
|
||||
|
||||
diff --git a/gdb/varobj.c b/gdb/varobj.c
|
||||
--- a/gdb/varobj.c
|
||||
+++ b/gdb/varobj.c
|
||||
@@ -218,6 +218,14 @@ is_root_p (const struct varobj *var)
|
||||
}
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
+/* Helper function to install a Python environment suitable for
|
||||
+ use during operations on VAR. */
|
||||
+struct cleanup *
|
||||
+varobj_ensure_python_env (const struct varobj *var)
|
||||
+{
|
||||
+ return ensure_python_env (var->root->exp->gdbarch,
|
||||
+ var->root->exp->language_defn);
|
||||
+}
|
||||
|
||||
/* See python-internal.h. */
|
||||
gdbpy_enter_varobj::gdbpy_enter_varobj (const struct varobj *var)
|
||||
diff --git a/gdb/varobj.h b/gdb/varobj.h
|
||||
--- a/gdb/varobj.h
|
||||
+++ b/gdb/varobj.h
|
||||
@@ -328,6 +328,8 @@ extern bool varobj_has_more (const struct varobj *var, int to);
|
||||
|
||||
extern bool varobj_is_dynamic_p (const struct varobj *var);
|
||||
|
||||
+extern struct cleanup *varobj_ensure_python_env (const struct varobj *var);
|
||||
+
|
||||
extern bool varobj_default_value_is_changeable_p (const struct varobj *var);
|
||||
extern bool varobj_value_is_changeable_p (const struct varobj *var);
|
||||
|
357
SOURCES/gdb-attach-fail-reasons-5of5.patch
Normal file
357
SOURCES/gdb-attach-fail-reasons-5of5.patch
Normal file
@ -0,0 +1,357 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Fedora GDB patches <invalid@email.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-attach-fail-reasons-5of5.patch
|
||||
|
||||
;; Print reasons for failed attach/spawn incl. SELinux deny_ptrace (BZ 786878).
|
||||
;;=push+jan
|
||||
|
||||
http://sourceware.org/ml/gdb-patches/2012-03/msg00171.html
|
||||
|
||||
Hi,
|
||||
|
||||
and here is the last bit for new SELinux 'deny_ptrace':
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=786878
|
||||
|
||||
As even PTRACE_TRACEME fails in such case it needs to install hook for even
|
||||
that event.
|
||||
|
||||
Thanks,
|
||||
Jan
|
||||
|
||||
gdb/
|
||||
2012-03-06 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* common/linux-ptrace.c [HAVE_SELINUX_SELINUX_H]: include
|
||||
selinux/selinux.h.
|
||||
(linux_ptrace_attach_warnings): Call linux_ptrace_create_warnings.
|
||||
(linux_ptrace_create_warnings): New.
|
||||
* common/linux-ptrace.h (linux_ptrace_create_warnings): New declaration.
|
||||
* config.in: Regenerate.
|
||||
* configure: Regenerate.
|
||||
* configure.ac: Check selinux/selinux.h and the selinux library.
|
||||
* inf-ptrace.c (inf_ptrace_me): Check the ptrace result.
|
||||
* linux-nat.c (linux_nat_create_inferior): New variable ex. Wrap
|
||||
to_create_inferior into TRY_CATCH, call linux_ptrace_create_warnings.
|
||||
|
||||
gdb/gdbserver/
|
||||
* config.in: Regenerate.
|
||||
* configure: Regenerate.
|
||||
* configure.ac: Check selinux/selinux.h and the selinux library.
|
||||
* linux-low.c (linux_traceme): New function.
|
||||
(linux_create_inferior, linux_tracefork_child): Call it instead of
|
||||
direct ptrace.
|
||||
|
||||
diff --git a/gdb/config.in b/gdb/config.in
|
||||
--- a/gdb/config.in
|
||||
+++ b/gdb/config.in
|
||||
@@ -276,6 +276,9 @@
|
||||
/* Define if librpm library is being used. */
|
||||
#undef HAVE_LIBRPM
|
||||
|
||||
+/* Define to 1 if you have the `selinux' library (-lselinux). */
|
||||
+#undef HAVE_LIBSELINUX
|
||||
+
|
||||
/* Define to 1 if you have the <libunwind-ia64.h> header file. */
|
||||
#undef HAVE_LIBUNWIND_IA64_H
|
||||
|
||||
@@ -399,6 +402,9 @@
|
||||
/* Define to 1 if you have the `scm_new_smob' function. */
|
||||
#undef HAVE_SCM_NEW_SMOB
|
||||
|
||||
+/* Define to 1 if you have the <selinux/selinux.h> header file. */
|
||||
+#undef HAVE_SELINUX_SELINUX_H
|
||||
+
|
||||
/* Define to 1 if you have the `setlocale' function. */
|
||||
#undef HAVE_SETLOCALE
|
||||
|
||||
diff --git a/gdb/configure b/gdb/configure
|
||||
--- a/gdb/configure
|
||||
+++ b/gdb/configure
|
||||
@@ -15854,6 +15854,64 @@ cat >>confdefs.h <<_ACEOF
|
||||
_ACEOF
|
||||
|
||||
|
||||
+for ac_header in selinux/selinux.h
|
||||
+do :
|
||||
+ ac_fn_c_check_header_mongrel "$LINENO" "selinux/selinux.h" "ac_cv_header_selinux_selinux_h" "$ac_includes_default"
|
||||
+if test "x$ac_cv_header_selinux_selinux_h" = x""yes; then :
|
||||
+ cat >>confdefs.h <<_ACEOF
|
||||
+#define HAVE_SELINUX_SELINUX_H 1
|
||||
+_ACEOF
|
||||
+
|
||||
+fi
|
||||
+
|
||||
+done
|
||||
+
|
||||
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for security_get_boolean_active in -lselinux" >&5
|
||||
+$as_echo_n "checking for security_get_boolean_active in -lselinux... " >&6; }
|
||||
+if test "${ac_cv_lib_selinux_security_get_boolean_active+set}" = set; then :
|
||||
+ $as_echo_n "(cached) " >&6
|
||||
+else
|
||||
+ ac_check_lib_save_LIBS=$LIBS
|
||||
+LIBS="-lselinux $LIBS"
|
||||
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
+/* end confdefs.h. */
|
||||
+
|
||||
+/* Override any GCC internal prototype to avoid an error.
|
||||
+ Use char because int might match the return type of a GCC
|
||||
+ builtin and then its argument prototype would still apply. */
|
||||
+#ifdef __cplusplus
|
||||
+extern "C"
|
||||
+#endif
|
||||
+char security_get_boolean_active ();
|
||||
+int
|
||||
+main ()
|
||||
+{
|
||||
+return security_get_boolean_active ();
|
||||
+ ;
|
||||
+ return 0;
|
||||
+}
|
||||
+_ACEOF
|
||||
+if ac_fn_c_try_link "$LINENO"; then :
|
||||
+ ac_cv_lib_selinux_security_get_boolean_active=yes
|
||||
+else
|
||||
+ ac_cv_lib_selinux_security_get_boolean_active=no
|
||||
+fi
|
||||
+rm -f core conftest.err conftest.$ac_objext \
|
||||
+ conftest$ac_exeext conftest.$ac_ext
|
||||
+LIBS=$ac_check_lib_save_LIBS
|
||||
+fi
|
||||
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_selinux_security_get_boolean_active" >&5
|
||||
+$as_echo "$ac_cv_lib_selinux_security_get_boolean_active" >&6; }
|
||||
+if test "x$ac_cv_lib_selinux_security_get_boolean_active" = x""yes; then :
|
||||
+ cat >>confdefs.h <<_ACEOF
|
||||
+#define HAVE_LIBSELINUX 1
|
||||
+_ACEOF
|
||||
+
|
||||
+ LIBS="-lselinux $LIBS"
|
||||
+
|
||||
+fi
|
||||
+
|
||||
+
|
||||
|
||||
# Support for --with-sysroot is a copy of GDB_AC_WITH_DIR,
|
||||
# except that the argument to --with-sysroot is optional.
|
||||
diff --git a/gdb/configure.ac b/gdb/configure.ac
|
||||
--- a/gdb/configure.ac
|
||||
+++ b/gdb/configure.ac
|
||||
@@ -2054,6 +2054,10 @@ case $host_os in
|
||||
esac
|
||||
AC_DEFINE_UNQUOTED(GDBINIT,"$gdbinit",[The .gdbinit filename.])
|
||||
|
||||
+dnl Check security_get_boolean_active availability.
|
||||
+AC_CHECK_HEADERS(selinux/selinux.h)
|
||||
+AC_CHECK_LIB(selinux, security_get_boolean_active)
|
||||
+
|
||||
dnl Handle optional features that can be enabled.
|
||||
|
||||
# Support for --with-sysroot is a copy of GDB_AC_WITH_DIR,
|
||||
diff --git a/gdb/gdbserver/config.in b/gdb/gdbserver/config.in
|
||||
--- a/gdb/gdbserver/config.in
|
||||
+++ b/gdb/gdbserver/config.in
|
||||
@@ -126,6 +126,9 @@
|
||||
/* Define to 1 if you have the `mcheck' library (-lmcheck). */
|
||||
#undef HAVE_LIBMCHECK
|
||||
|
||||
+/* Define to 1 if you have the `selinux' library (-lselinux). */
|
||||
+#undef HAVE_LIBSELINUX
|
||||
+
|
||||
/* Define if the target supports branch tracing. */
|
||||
#undef HAVE_LINUX_BTRACE
|
||||
|
||||
@@ -202,6 +205,9 @@
|
||||
/* Define to 1 if you have the `pwrite' function. */
|
||||
#undef HAVE_PWRITE
|
||||
|
||||
+/* Define to 1 if you have the <selinux/selinux.h> header file. */
|
||||
+#undef HAVE_SELINUX_SELINUX_H
|
||||
+
|
||||
/* Define to 1 if you have the `setns' function. */
|
||||
#undef HAVE_SETNS
|
||||
|
||||
diff --git a/gdb/gdbserver/configure b/gdb/gdbserver/configure
|
||||
--- a/gdb/gdbserver/configure
|
||||
+++ b/gdb/gdbserver/configure
|
||||
@@ -8535,6 +8535,64 @@ if $want_ipa ; then
|
||||
fi
|
||||
fi
|
||||
|
||||
+for ac_header in selinux/selinux.h
|
||||
+do :
|
||||
+ ac_fn_c_check_header_mongrel "$LINENO" "selinux/selinux.h" "ac_cv_header_selinux_selinux_h" "$ac_includes_default"
|
||||
+if test "x$ac_cv_header_selinux_selinux_h" = x""yes; then :
|
||||
+ cat >>confdefs.h <<_ACEOF
|
||||
+#define HAVE_SELINUX_SELINUX_H 1
|
||||
+_ACEOF
|
||||
+
|
||||
+fi
|
||||
+
|
||||
+done
|
||||
+
|
||||
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for security_get_boolean_active in -lselinux" >&5
|
||||
+$as_echo_n "checking for security_get_boolean_active in -lselinux... " >&6; }
|
||||
+if test "${ac_cv_lib_selinux_security_get_boolean_active+set}" = set; then :
|
||||
+ $as_echo_n "(cached) " >&6
|
||||
+else
|
||||
+ ac_check_lib_save_LIBS=$LIBS
|
||||
+LIBS="-lselinux $LIBS"
|
||||
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
+/* end confdefs.h. */
|
||||
+
|
||||
+/* Override any GCC internal prototype to avoid an error.
|
||||
+ Use char because int might match the return type of a GCC
|
||||
+ builtin and then its argument prototype would still apply. */
|
||||
+#ifdef __cplusplus
|
||||
+extern "C"
|
||||
+#endif
|
||||
+char security_get_boolean_active ();
|
||||
+int
|
||||
+main ()
|
||||
+{
|
||||
+return security_get_boolean_active ();
|
||||
+ ;
|
||||
+ return 0;
|
||||
+}
|
||||
+_ACEOF
|
||||
+if ac_fn_c_try_link "$LINENO"; then :
|
||||
+ ac_cv_lib_selinux_security_get_boolean_active=yes
|
||||
+else
|
||||
+ ac_cv_lib_selinux_security_get_boolean_active=no
|
||||
+fi
|
||||
+rm -f core conftest.err conftest.$ac_objext \
|
||||
+ conftest$ac_exeext conftest.$ac_ext
|
||||
+LIBS=$ac_check_lib_save_LIBS
|
||||
+fi
|
||||
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_selinux_security_get_boolean_active" >&5
|
||||
+$as_echo "$ac_cv_lib_selinux_security_get_boolean_active" >&6; }
|
||||
+if test "x$ac_cv_lib_selinux_security_get_boolean_active" = x""yes; then :
|
||||
+ cat >>confdefs.h <<_ACEOF
|
||||
+#define HAVE_LIBSELINUX 1
|
||||
+_ACEOF
|
||||
+
|
||||
+ LIBS="-lselinux $LIBS"
|
||||
+
|
||||
+fi
|
||||
+
|
||||
+
|
||||
|
||||
|
||||
|
||||
diff --git a/gdb/gdbserver/configure.ac b/gdb/gdbserver/configure.ac
|
||||
--- a/gdb/gdbserver/configure.ac
|
||||
+++ b/gdb/gdbserver/configure.ac
|
||||
@@ -486,6 +486,10 @@ if $want_ipa ; then
|
||||
fi
|
||||
fi
|
||||
|
||||
+dnl Check security_get_boolean_active availability.
|
||||
+AC_CHECK_HEADERS(selinux/selinux.h)
|
||||
+AC_CHECK_LIB(selinux, security_get_boolean_active)
|
||||
+
|
||||
AC_SUBST(GDBSERVER_DEPFILES)
|
||||
AC_SUBST(GDBSERVER_LIBS)
|
||||
AC_SUBST(srv_xmlbuiltin)
|
||||
diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
|
||||
--- a/gdb/gdbserver/linux-low.c
|
||||
+++ b/gdb/gdbserver/linux-low.c
|
||||
@@ -967,7 +967,16 @@ linux_ptrace_fun ()
|
||||
{
|
||||
if (ptrace (PTRACE_TRACEME, 0, (PTRACE_TYPE_ARG3) 0,
|
||||
(PTRACE_TYPE_ARG4) 0) < 0)
|
||||
- trace_start_error_with_name ("ptrace");
|
||||
+ {
|
||||
+ int save_errno = errno;
|
||||
+
|
||||
+ std::string msg (linux_ptrace_create_warnings ());
|
||||
+
|
||||
+ msg += _("Cannot trace created process");
|
||||
+
|
||||
+ errno = save_errno;
|
||||
+ trace_start_error_with_name (msg.c_str ());
|
||||
+ }
|
||||
|
||||
if (setpgid (0, 0) < 0)
|
||||
trace_start_error_with_name ("setpgid");
|
||||
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
|
||||
--- a/gdb/linux-nat.c
|
||||
+++ b/gdb/linux-nat.c
|
||||
@@ -1089,7 +1089,17 @@ linux_nat_target::create_inferior (const char *exec_file,
|
||||
/* Make sure we report all signals during startup. */
|
||||
pass_signals (0, NULL);
|
||||
|
||||
- inf_ptrace_target::create_inferior (exec_file, allargs, env, from_tty);
|
||||
+ TRY
|
||||
+ {
|
||||
+ inf_ptrace_target::create_inferior (exec_file, allargs, env, from_tty);
|
||||
+ }
|
||||
+ CATCH (ex, RETURN_MASK_ERROR)
|
||||
+ {
|
||||
+ std::string result = linux_ptrace_create_warnings ();
|
||||
+
|
||||
+ throw_error (ex.error, "%s%s", result.c_str (), ex.message);
|
||||
+ }
|
||||
+ END_CATCH
|
||||
}
|
||||
|
||||
/* Callback for linux_proc_attach_tgid_threads. Attach to PTID if not
|
||||
diff --git a/gdb/nat/linux-ptrace.c b/gdb/nat/linux-ptrace.c
|
||||
--- a/gdb/nat/linux-ptrace.c
|
||||
+++ b/gdb/nat/linux-ptrace.c
|
||||
@@ -25,6 +25,10 @@
|
||||
#include <sys/procfs.h>
|
||||
#endif
|
||||
|
||||
+#ifdef HAVE_SELINUX_SELINUX_H
|
||||
+# include <selinux/selinux.h>
|
||||
+#endif /* HAVE_SELINUX_SELINUX_H */
|
||||
+
|
||||
/* Stores the ptrace options supported by the running kernel.
|
||||
A value of -1 means we did not check for features yet. A value
|
||||
of 0 means there are no supported features. */
|
||||
@@ -50,6 +54,8 @@ linux_ptrace_attach_fail_reason (pid_t pid)
|
||||
"terminated"),
|
||||
(int) pid);
|
||||
|
||||
+ result += linux_ptrace_create_warnings ();
|
||||
+
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -583,6 +589,25 @@ linux_ptrace_init_warnings (void)
|
||||
linux_ptrace_test_ret_to_nx ();
|
||||
}
|
||||
|
||||
+/* Print all possible reasons we could fail to create a traced process. */
|
||||
+
|
||||
+std::string
|
||||
+linux_ptrace_create_warnings ()
|
||||
+{
|
||||
+ std::string result;
|
||||
+
|
||||
+#ifdef HAVE_LIBSELINUX
|
||||
+ /* -1 is returned for errors, 0 if it has no effect, 1 if PTRACE_ATTACH is
|
||||
+ forbidden. */
|
||||
+ if (security_get_boolean_active ("deny_ptrace") == 1)
|
||||
+ string_appendf (result,
|
||||
+ _("the SELinux boolean 'deny_ptrace' is enabled, "
|
||||
+ "you can disable this process attach protection by: "
|
||||
+ "(gdb) shell sudo setsebool deny_ptrace=0\n"));
|
||||
+#endif /* HAVE_LIBSELINUX */
|
||||
+ return result;
|
||||
+}
|
||||
+
|
||||
/* Extract extended ptrace event from wait status. */
|
||||
|
||||
int
|
||||
diff --git a/gdb/nat/linux-ptrace.h b/gdb/nat/linux-ptrace.h
|
||||
--- a/gdb/nat/linux-ptrace.h
|
||||
+++ b/gdb/nat/linux-ptrace.h
|
||||
@@ -184,6 +184,7 @@ extern std::string linux_ptrace_attach_fail_reason (pid_t pid);
|
||||
extern std::string linux_ptrace_attach_fail_reason_string (ptid_t ptid, int err);
|
||||
|
||||
extern void linux_ptrace_init_warnings (void);
|
||||
+extern std::string linux_ptrace_create_warnings ();
|
||||
extern void linux_check_ptrace_features (void);
|
||||
extern void linux_enable_event_reporting (pid_t pid, int attached);
|
||||
extern void linux_disable_event_reporting (pid_t pid);
|
45
SOURCES/gdb-btrobust.patch
Normal file
45
SOURCES/gdb-btrobust.patch
Normal file
@ -0,0 +1,45 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Fedora GDB patches <invalid@email.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-btrobust.patch
|
||||
|
||||
;; Continue backtrace even if a frame filter throws an exception (Phil Muldoon).
|
||||
;;=push
|
||||
|
||||
This should fix the error with glib. An error message will still be
|
||||
printed, but a default backtrace will occur in this case.
|
||||
|
||||
--
|
||||
|
||||
diff --git a/gdb/python/py-framefilter.c b/gdb/python/py-framefilter.c
|
||||
--- a/gdb/python/py-framefilter.c
|
||||
+++ b/gdb/python/py-framefilter.c
|
||||
@@ -1151,6 +1151,7 @@ gdbpy_apply_frame_filter (const struct extension_language_defn *extlang,
|
||||
htab_eq_pointer,
|
||||
NULL));
|
||||
|
||||
+ int count_printed = 0;
|
||||
while (true)
|
||||
{
|
||||
gdbpy_ref<> item (PyIter_Next (iterable.get ()));
|
||||
@@ -1159,8 +1160,8 @@ gdbpy_apply_frame_filter (const struct extension_language_defn *extlang,
|
||||
{
|
||||
if (PyErr_Occurred ())
|
||||
{
|
||||
- throw_quit_or_print_exception ();
|
||||
- return EXT_LANG_BT_ERROR;
|
||||
+ gdbpy_print_stack ();
|
||||
+ return count_printed > 0 ? EXT_LANG_BT_ERROR : EXT_LANG_BT_NO_FILTERS;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -1193,7 +1194,8 @@ gdbpy_apply_frame_filter (const struct extension_language_defn *extlang,
|
||||
/* Do not exit on error printing a single frame. Print the
|
||||
error and continue with other frames. */
|
||||
if (success == EXT_LANG_BT_ERROR)
|
||||
- throw_quit_or_print_exception ();
|
||||
+ gdbpy_print_stack ();
|
||||
+ count_printed++;
|
||||
}
|
||||
|
||||
return success;
|
178
SOURCES/gdb-bz1219747-attach-kills.patch
Normal file
178
SOURCES/gdb-bz1219747-attach-kills.patch
Normal file
@ -0,0 +1,178 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Fedora GDB patches <invalid@email.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-bz1219747-attach-kills.patch
|
||||
|
||||
;; Never kill PID on: gdb exec PID (Jan Kratochvil, RH BZ 1219747).
|
||||
;;=push+jan
|
||||
|
||||
http://sourceware.org/ml/gdb-patches/2015-10/msg00301.html
|
||||
|
||||
Hi,
|
||||
|
||||
in some cases with deleted main executable GDB will want to kill the inferior.
|
||||
|
||||
$ cp /bin/sleep /tmp/sleep;/tmp/sleep 1h&p=$!
|
||||
$ rm /tmp/sleep
|
||||
$ gdb /tmp/sleep $p
|
||||
GNU gdb (GDB) 7.10.50.20151016-cvs
|
||||
/tmp/sleep: No such file or directory.
|
||||
Attaching to process 9694
|
||||
/tmp/sleep (deleted): No such file or directory.
|
||||
A program is being debugged already. Kill it? (y or n) _
|
||||
|
||||
The first attachment of "/tmp/sleep" commandline argument errors at:
|
||||
|
||||
267 if (scratch_chan < 0)
|
||||
268 perror_with_name (filename);
|
||||
1051 if (catch_command_errors_const (exec_file_attach, execarg,
|
||||
1052 !batch_flag))
|
||||
|
||||
Then GDB tries to attach to the process $p:
|
||||
|
||||
1082 if (catch_command_errors (attach_command, pid_or_core_arg,
|
||||
1083 !batch_flag) == 0)
|
||||
|
||||
This succeeds and since this moment GDB has a valid inferior. But despite that
|
||||
the lines
|
||||
1082 if (catch_command_errors (attach_command, pid_or_core_arg,
|
||||
1083 !batch_flag) == 0)
|
||||
still fail because consequently attach_command() fails to find the associated
|
||||
executable file:
|
||||
|
||||
267 if (scratch_chan < 0)
|
||||
268 perror_with_name (filename);
|
||||
1082 if (catch_command_errors (attach_command, pid_or_core_arg,
|
||||
1083 !batch_flag) == 0)
|
||||
|
||||
and therefore GDB executes the following:
|
||||
|
||||
(gdb) bt
|
||||
2179 if (have_inferiors ())
|
||||
2180 {
|
||||
2181 if (!from_tty
|
||||
2182 || !have_live_inferiors ()
|
||||
2183 || query (_("A program is being debugged already. Kill it? ")))
|
||||
2184 iterate_over_inferiors (dispose_inferior, NULL);
|
||||
2185 else
|
||||
2186 error (_("Program not killed."));
|
||||
2187 }
|
||||
1084 catch_command_errors (core_file_command, pid_or_core_arg,
|
||||
1085 !batch_flag);
|
||||
|
||||
No regressions on {x86_64,x86_64-m32,i686}-fedora24pre-linux-gnu.
|
||||
|
||||
Thanks,
|
||||
Jan
|
||||
|
||||
gdb/ChangeLog
|
||||
2015-10-16 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* main.c (captured_main): Run core_file_command for pid_or_core_arg
|
||||
only if not have_inferiors ().
|
||||
|
||||
gdb/testsuite/ChangeLog
|
||||
2015-10-16 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* gdb.base/attach-kills.c: New.
|
||||
* gdb.base/attach-kills.exp: New.
|
||||
|
||||
diff --git a/gdb/main.c b/gdb/main.c
|
||||
--- a/gdb/main.c
|
||||
+++ b/gdb/main.c
|
||||
@@ -1115,7 +1115,10 @@ captured_main_1 (struct captured_main_args *context)
|
||||
if (isdigit (pid_or_core_arg[0]))
|
||||
{
|
||||
if (catch_command_errors (attach_command, pid_or_core_arg,
|
||||
- !batch_flag) == 0)
|
||||
+ !batch_flag) == 0
|
||||
+ /* attach_command could succeed partially and core_file_command
|
||||
+ would try to kill it. */
|
||||
+ && !have_inferiors ())
|
||||
catch_command_errors (core_file_command, pid_or_core_arg,
|
||||
!batch_flag);
|
||||
}
|
||||
diff --git a/gdb/testsuite/gdb.base/attach-kills.c b/gdb/testsuite/gdb.base/attach-kills.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/attach-kills.c
|
||||
@@ -0,0 +1,25 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2015 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+#include <unistd.h>
|
||||
+
|
||||
+int
|
||||
+main (void)
|
||||
+{
|
||||
+ sleep (600);
|
||||
+ return 0;
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.base/attach-kills.exp b/gdb/testsuite/gdb.base/attach-kills.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/attach-kills.exp
|
||||
@@ -0,0 +1,49 @@
|
||||
+# Copyright (C) 2015 Free Software Foundation, Inc.
|
||||
+#
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+if { ![can_spawn_for_attach] } {
|
||||
+ return 0
|
||||
+}
|
||||
+
|
||||
+standard_testfile
|
||||
+
|
||||
+if { [build_executable ${testfile}.exp $testfile] == -1 } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+# Start the program running and then wait for a bit, to be sure
|
||||
+# that it can be attached to.
|
||||
+
|
||||
+set test_spawn_id [spawn_wait_for_attach $binfile]
|
||||
+set testpid [spawn_id_get_pid $test_spawn_id]
|
||||
+
|
||||
+remote_exec target "cp -pf -- $binfile $binfile-copy"
|
||||
+remote_exec target "rm -f -- $binfile"
|
||||
+
|
||||
+set test "start gdb"
|
||||
+set res [gdb_spawn_with_cmdline_opts \
|
||||
+ "-iex \"set height 0\" -iex \"set width 0\" /DoEsNoTeXySt $testpid"]
|
||||
+if { $res != 0} {
|
||||
+ fail "$test (spawn)"
|
||||
+ kill_wait_spawned_process $test_spawn_id
|
||||
+ return -1
|
||||
+}
|
||||
+gdb_test_multiple "" $test {
|
||||
+ -re "\r\nAttaching to .*\r\n$gdb_prompt $" {
|
||||
+ pass $test
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+kill_wait_spawned_process $test_spawn_id
|
130
SOURCES/gdb-bz533176-fortran-omp-step.patch
Normal file
130
SOURCES/gdb-bz533176-fortran-omp-step.patch
Normal file
@ -0,0 +1,130 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Fedora GDB patches <invalid@email.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-bz533176-fortran-omp-step.patch
|
||||
|
||||
;; Fix stepping with OMP parallel Fortran sections (BZ 533176).
|
||||
;;=push+jan: It requires some better DWARF annotations.
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=533176#c4
|
||||
|
||||
I find it a bug in DWARF and gdb behaves correctly according to it. From the
|
||||
current DWARF's point of view the is a function call which you skip by "next".
|
||||
|
||||
If you hide any /usr/lib/debug such as using:
|
||||
gdb -nx -ex 'set debug-file-directory /qwe' -ex 'file ./tpcommon_gfortran44'
|
||||
and use "step" command instead of "next" there it will work.
|
||||
(You need to hide debuginfo from libgomp as you would step into libgomp sources
|
||||
to maintain the threads for execution.)
|
||||
|
||||
There should be some DWARF extension for it, currently tried to detect
|
||||
substring ".omp_fn." as this function is called "MAIN__.omp_fn.0" and do not
|
||||
consider such sub-function as a skippable by "next".
|
||||
|
||||
Another problem is that with "set scheduler-locking" being "off" (default
|
||||
upstream) or "step" (default in F/RHEL) the simultaneous execution of the
|
||||
threads is inconvenient. Setting it to "on" will lockup the debugging as the
|
||||
threads need to get synchronized at some point. This is a more general
|
||||
debugging problem of GOMP outside of the scope of this Bug.
|
||||
|
||||
diff --git a/gdb/infrun.c b/gdb/infrun.c
|
||||
--- a/gdb/infrun.c
|
||||
+++ b/gdb/infrun.c
|
||||
@@ -6695,6 +6695,16 @@ process_event_stop_test (struct execution_control_state *ecs)
|
||||
|
||||
if (ecs->event_thread->control.step_over_calls == STEP_OVER_ALL)
|
||||
{
|
||||
+ struct symbol *stop_fn = find_pc_function (stop_pc);
|
||||
+ struct minimal_symbol *stopf = lookup_minimal_symbol_by_pc (stop_pc).minsym;
|
||||
+
|
||||
+ if ((stop_fn == NULL
|
||||
+ || strstr (SYMBOL_LINKAGE_NAME (stop_fn), ".omp_fn.") == NULL)
|
||||
+ /* gcc-4.7.2-9.fc19.x86_64 uses a new format. */
|
||||
+ && (stopf == NULL
|
||||
+ || strstr (MSYMBOL_LINKAGE_NAME (stopf), "._omp_fn.") == NULL))
|
||||
+{ /* ".omp_fn." */
|
||||
+
|
||||
/* We're doing a "next".
|
||||
|
||||
Normal (forward) execution: set a breakpoint at the
|
||||
@@ -6728,6 +6738,7 @@ process_event_stop_test (struct execution_control_state *ecs)
|
||||
|
||||
keep_going (ecs);
|
||||
return;
|
||||
+} /* ".omp_fn." */
|
||||
}
|
||||
|
||||
/* If we are in a function call trampoline (a stub between the
|
||||
diff --git a/gdb/testsuite/gdb.fortran/omp-step.exp b/gdb/testsuite/gdb.fortran/omp-step.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.fortran/omp-step.exp
|
||||
@@ -0,0 +1,31 @@
|
||||
+# Copyright 2009 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+set testfile "omp-step"
|
||||
+set srcfile ${testfile}.f90
|
||||
+if { [prepare_for_testing $testfile.exp $testfile $srcfile {debug f90 additional_flags=-fopenmp}] } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+if ![runto [gdb_get_line_number "start-here"]] {
|
||||
+ perror "Couldn't run to start-here"
|
||||
+ return 0
|
||||
+}
|
||||
+
|
||||
+gdb_test "next" {!\$omp parallel} "step closer"
|
||||
+gdb_test "next" {a\(omp_get_thread_num\(\) \+ 1\) = 1} "step into omp"
|
||||
+
|
||||
+gdb_breakpoint [gdb_get_line_number "success"]
|
||||
+gdb_continue_to_breakpoint "success" ".*success.*"
|
||||
diff --git a/gdb/testsuite/gdb.fortran/omp-step.f90 b/gdb/testsuite/gdb.fortran/omp-step.f90
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.fortran/omp-step.f90
|
||||
@@ -0,0 +1,32 @@
|
||||
+! Copyright 2009 Free Software Foundation, Inc.
|
||||
+
|
||||
+! This program is free software; you can redistribute it and/or modify
|
||||
+! it under the terms of the GNU General Public License as published by
|
||||
+! the Free Software Foundation; either version 3 of the License, or
|
||||
+! (at your option) any later version.
|
||||
+!
|
||||
+! This program is distributed in the hope that it will be useful,
|
||||
+! but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+! GNU General Public License for more details.
|
||||
+!
|
||||
+! You should have received a copy of the GNU General Public License
|
||||
+! along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+ use omp_lib
|
||||
+ integer nthreads, i, a(1000)
|
||||
+ nthreads = omp_get_num_threads()
|
||||
+ if (nthreads .gt. 1000) call abort
|
||||
+
|
||||
+ do i = 1, nthreads
|
||||
+ a(i) = 0
|
||||
+ end do
|
||||
+ print *, "start-here"
|
||||
+!$omp parallel
|
||||
+ a(omp_get_thread_num() + 1) = 1
|
||||
+!$omp end parallel
|
||||
+ do i = 1, nthreads
|
||||
+ if (a(i) .ne. 1) call abort
|
||||
+ end do
|
||||
+ print *, "success"
|
||||
+ end
|
175
SOURCES/gdb-bz541866-rwatch-before-run.patch
Normal file
175
SOURCES/gdb-bz541866-rwatch-before-run.patch
Normal file
@ -0,0 +1,175 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Fedora GDB patches <invalid@email.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-bz541866-rwatch-before-run.patch
|
||||
|
||||
;; Fix i386+x86_64 rwatch+awatch before run, regression against 6.8 (BZ 541866).
|
||||
;; Fix i386 rwatch+awatch before run (BZ 688788, on top of BZ 541866).
|
||||
;;=push+jan: It should be fixed properly instead.
|
||||
|
||||
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
|
||||
--- a/gdb/breakpoint.c
|
||||
+++ b/gdb/breakpoint.c
|
||||
@@ -8807,7 +8807,7 @@ init_breakpoint_sal (struct breakpoint *b, struct gdbarch *gdbarch,
|
||||
int enabled, int internal, unsigned flags,
|
||||
int display_canonical)
|
||||
{
|
||||
- int i;
|
||||
+ int i ATTRIBUTE_UNUSED;
|
||||
|
||||
if (type == bp_hardware_breakpoint)
|
||||
{
|
||||
@@ -14356,7 +14356,7 @@ enable_breakpoint_disp (struct breakpoint *bpt, enum bpdisp disposition,
|
||||
|
||||
if (bpt->type == bp_hardware_breakpoint)
|
||||
{
|
||||
- int i;
|
||||
+ int i ATTRIBUTE_UNUSED;
|
||||
i = hw_breakpoint_used_count ();
|
||||
target_resources_ok =
|
||||
target_can_use_hardware_watchpoint (bp_hardware_breakpoint,
|
||||
diff --git a/gdb/config/i386/nm-linux.h b/gdb/config/i386/nm-linux.h
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/config/i386/nm-linux.h
|
||||
@@ -0,0 +1,28 @@
|
||||
+/* Native support for GNU/Linux i386.
|
||||
+
|
||||
+ Copyright 2010 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This file is part of GDB.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+#ifndef NM_LINUX_H
|
||||
+#define NM_LINUX_H
|
||||
+
|
||||
+#include "config/nm-linux.h"
|
||||
+
|
||||
+/* Red Hat backward compatibility with gdb-6.8. */
|
||||
+#define target_can_use_hardware_watchpoint(type, cnt, ot) 1
|
||||
+
|
||||
+#endif /* NM_LINUX64_H */
|
||||
diff --git a/gdb/config/i386/nm-linux64.h b/gdb/config/i386/nm-linux64.h
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/config/i386/nm-linux64.h
|
||||
@@ -0,0 +1,28 @@
|
||||
+/* Native support for GNU/Linux amd64.
|
||||
+
|
||||
+ Copyright 2010 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This file is part of GDB.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+#ifndef NM_LINUX64_H
|
||||
+#define NM_LINUX64_H
|
||||
+
|
||||
+#include "config/nm-linux.h"
|
||||
+
|
||||
+/* Red Hat backward compatibility with gdb-6.8. */
|
||||
+#define target_can_use_hardware_watchpoint(type, cnt, ot) 1
|
||||
+
|
||||
+#endif /* NM_LINUX64_H */
|
||||
diff --git a/gdb/configure.nat b/gdb/configure.nat
|
||||
--- a/gdb/configure.nat
|
||||
+++ b/gdb/configure.nat
|
||||
@@ -238,6 +238,7 @@ case ${gdb_host} in
|
||||
;;
|
||||
i386)
|
||||
# Host: Intel 386 running GNU/Linux.
|
||||
+ NAT_FILE="${srcdir}/config/${gdb_host_cpu}/nm-linux.h"
|
||||
NATDEPFILES="${NATDEPFILES} x86-nat.o x86-dregs.o \
|
||||
i386-linux-nat.o x86-linux-nat.o linux-btrace.o \
|
||||
x86-linux.o x86-linux-dregs.o"
|
||||
@@ -290,6 +291,7 @@ case ${gdb_host} in
|
||||
case ${gdb_host_cpu} in
|
||||
i386)
|
||||
# Host: GNU/Linux x86-64
|
||||
+ NAT_FILE="${srcdir}/config/${gdb_host_cpu}/nm-linux64.h"
|
||||
NATDEPFILES="${NATDEPFILES} x86-nat.o x86-dregs.o \
|
||||
amd64-nat.o amd64-linux-nat.o x86-linux-nat.o linux-btrace.o \
|
||||
x86-linux.o x86-linux-dregs.o amd64-linux-siginfo.o"
|
||||
diff --git a/gdb/target.h b/gdb/target.h
|
||||
--- a/gdb/target.h
|
||||
+++ b/gdb/target.h
|
||||
@@ -1953,9 +1953,11 @@ extern struct thread_info *target_thread_handle_to_thread_info
|
||||
one. OTHERTYPE is the number of watchpoints of other types than
|
||||
this one used so far. */
|
||||
|
||||
+#ifndef target_can_use_hardware_watchpoint
|
||||
#define target_can_use_hardware_watchpoint(TYPE,CNT,OTHERTYPE) \
|
||||
(current_top_target ()->can_use_hw_breakpoint) ( \
|
||||
TYPE, CNT, OTHERTYPE)
|
||||
+#endif
|
||||
|
||||
/* Returns the number of debug registers needed to watch the given
|
||||
memory region, or zero if not supported. */
|
||||
diff --git a/gdb/testsuite/gdb.base/watchpoint-hw-before-run.exp b/gdb/testsuite/gdb.base/watchpoint-hw-before-run.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/watchpoint-hw-before-run.exp
|
||||
@@ -0,0 +1,40 @@
|
||||
+# Copyright 2009, 2010 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+# Arch not supporting hw watchpoints does not imply no_hardware_watchpoints set.
|
||||
+if {(![istarget "i?86-*-*"] && ![istarget "x86_64-*-*"]
|
||||
+ && ![istarget "ia64-*-*"])
|
||||
+ || [target_info exists gdb,no_hardware_watchpoints]} then {
|
||||
+ verbose "Skipping watchpoint-hw-before-run test."
|
||||
+ return
|
||||
+}
|
||||
+
|
||||
+set test watchpoint-hw-before-run
|
||||
+set srcfile watchpoint-hw-hit-once.c
|
||||
+if { [prepare_for_testing ${test}.exp ${test} ${srcfile}] } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+gdb_test "rwatch watchee" "ardware read watchpoint 1: watchee"
|
||||
+
|
||||
+# `runto_main' or `runto main' would delete the watchpoint created above.
|
||||
+
|
||||
+if { [gdb_start_cmd] < 0 } {
|
||||
+ untested start
|
||||
+ return -1
|
||||
+}
|
||||
+gdb_test "" "main .* at .*" "start"
|
||||
+
|
||||
+gdb_test "continue" "Continuing.\r\n\r\nHardware read watchpoint \[0-9\]+: watchee\r\n\r\nValue = 0\r\n.*"
|
71
SOURCES/gdb-bz568248-oom-is-error.patch
Normal file
71
SOURCES/gdb-bz568248-oom-is-error.patch
Normal file
@ -0,0 +1,71 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Fedora GDB patches <invalid@email.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-bz568248-oom-is-error.patch
|
||||
|
||||
;; Out of memory is just an error, not fatal (uninitialized VLS vars, BZ 568248).
|
||||
;;=push+jan: Inferior objects should be read in parts, then this patch gets obsoleted.
|
||||
|
||||
http://sourceware.org/ml/gdb-patches/2010-06/msg00005.html
|
||||
|
||||
Hi,
|
||||
|
||||
unfortunately I see this problem reproducible only with the
|
||||
archer-jankratochvil-vla branch (VLA = Variable Length Arrays - char[var]).
|
||||
OTOH this branch I hopefully submit in some form for FSF GDB later.
|
||||
|
||||
In this case (a general problem but tested for example on Fedora 13 i686):
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
char a[argc];
|
||||
return a[0];
|
||||
}
|
||||
|
||||
(gdb) start
|
||||
(gdb) print a
|
||||
../../gdb/utils.c:1251: internal-error: virtual memory exhausted: can't allocate 4294951689 bytes.
|
||||
|
||||
It is apparently because boundary for the variable `a' is not initialized
|
||||
there. Users notice it due to Eclipse-CDT trying to automatically display all
|
||||
the local variables on each step.
|
||||
|
||||
Apparentl no regressions on {x86_64,x86_64-m32,i686}-fedora13-linux-gnu.
|
||||
But is anone aware of the reasons to use internal_error there?
|
||||
I find simple error as a perfectly reasonable there.
|
||||
(history only tracks it since the initial import)
|
||||
|
||||
IIRC this idea has been discussed with Tom Tromey, not sure of its origin.
|
||||
|
||||
I understand it may be offtopic for FSF GDB but from some GDB crashes I am not
|
||||
sure if it can happen only due to the VLA variables.
|
||||
|
||||
Thanks,
|
||||
Jan
|
||||
|
||||
gdb/
|
||||
2010-06-01 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
Tom Tromey <tromey@redhat.com>
|
||||
|
||||
* utils.c (nomem): Change internal_error to error.
|
||||
|
||||
diff --git a/gdb/utils.c b/gdb/utils.c
|
||||
--- a/gdb/utils.c
|
||||
+++ b/gdb/utils.c
|
||||
@@ -746,13 +746,11 @@ malloc_failure (long size)
|
||||
{
|
||||
if (size > 0)
|
||||
{
|
||||
- internal_error (__FILE__, __LINE__,
|
||||
- _("virtual memory exhausted: can't allocate %ld bytes."),
|
||||
- size);
|
||||
+ error (_("virtual memory exhausted: can't allocate %ld bytes."), size);
|
||||
}
|
||||
else
|
||||
{
|
||||
- internal_error (__FILE__, __LINE__, _("virtual memory exhausted."));
|
||||
+ error (_("virtual memory exhausted."));
|
||||
}
|
||||
}
|
||||
|
254
SOURCES/gdb-bz601887-dwarf4-rh-test.patch
Normal file
254
SOURCES/gdb-bz601887-dwarf4-rh-test.patch
Normal file
@ -0,0 +1,254 @@
|
||||
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-bz601887-dwarf4-rh-test.patch
|
||||
|
||||
;; Backport DWARF-4 support (BZ 601887, Tom Tromey).
|
||||
;;=fedoratest
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.dwarf2/rh-dwarf4-x86_64.S b/gdb/testsuite/gdb.dwarf2/rh-dwarf4-x86_64.S
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.dwarf2/rh-dwarf4-x86_64.S
|
||||
@@ -0,0 +1,167 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2010 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+ .file "rh-dwarf4-x86_64.c"
|
||||
+ .section .debug_abbrev,"",@progbits
|
||||
+.Ldebug_abbrev0:
|
||||
+ .section .debug_info,"",@progbits
|
||||
+.Ldebug_info0:
|
||||
+ .section .debug_line,"",@progbits
|
||||
+.Ldebug_line0:
|
||||
+ .text
|
||||
+.Ltext0:
|
||||
+.globl main
|
||||
+ .type main, @function
|
||||
+main:
|
||||
+.LFB0:
|
||||
+ .file 1 "gdb.dwarf2/rh-dwarf4-x86_64.c"
|
||||
+ # gdb.dwarf2/rh-dwarf4-x86_64.c:20
|
||||
+ .loc 1 20 0
|
||||
+ .cfi_startproc
|
||||
+ # basic block 2
|
||||
+ pushq %rbp
|
||||
+ .cfi_def_cfa_offset 16
|
||||
+ movq %rsp, %rbp
|
||||
+ .cfi_offset 6, -16
|
||||
+ .cfi_def_cfa_register 6
|
||||
+ # gdb.dwarf2/rh-dwarf4-x86_64.c:21
|
||||
+ .loc 1 21 0
|
||||
+ movl $0, %eax
|
||||
+ # gdb.dwarf2/rh-dwarf4-x86_64.c:22
|
||||
+ .loc 1 22 0
|
||||
+ leave
|
||||
+ .cfi_def_cfa 7, 8
|
||||
+ ret
|
||||
+ .cfi_endproc
|
||||
+.LFE0:
|
||||
+ .size main, .-main
|
||||
+.Letext0:
|
||||
+ .section .debug_info
|
||||
+ .long 0x4e # Length of Compilation Unit Info
|
||||
+ .value 0x4 # DWARF version number
|
||||
+ .long .Ldebug_abbrev0 # Offset Into Abbrev. Section
|
||||
+ .byte 0x8 # Pointer Size (in bytes)
|
||||
+ .uleb128 0x1 # (DIE (0xb) DW_TAG_compile_unit)
|
||||
+ .long .LASF0 # DW_AT_producer: "GNU C 4.4.4 20100503 (Red Hat 4.4.4-2)"
|
||||
+ .byte 0x1 # DW_AT_language
|
||||
+ .long .LASF1 # DW_AT_name: "gdb.dwarf2/rh-dwarf4-x86_64.c"
|
||||
+ .long .LASF2 # DW_AT_comp_dir
|
||||
+ .quad .Ltext0 # DW_AT_low_pc
|
||||
+ .quad .Letext0 # DW_AT_high_pc
|
||||
+ .long .Ldebug_line0 # DW_AT_stmt_list
|
||||
+ .uleb128 0x2 # (DIE (0x2d) DW_TAG_subprogram)
|
||||
+ # DW_AT_external
|
||||
+ .long .LASF3 # DW_AT_name: "main"
|
||||
+ .byte 0x1 # DW_AT_decl_file (gdb.dwarf2/rh-dwarf4-x86_64.c)
|
||||
+ .byte 0x13 # DW_AT_decl_line
|
||||
+ # DW_AT_prototyped
|
||||
+ .long 0x4a # DW_AT_type
|
||||
+ .quad .LFB0 # DW_AT_low_pc
|
||||
+ .quad .LFE0 # DW_AT_high_pc
|
||||
+ .uleb128 0x1 # DW_AT_frame_base
|
||||
+ .byte 0x9c # DW_OP_call_frame_cfa
|
||||
+ .uleb128 0x3 # (DIE (0x4a) DW_TAG_base_type)
|
||||
+ .byte 0x4 # DW_AT_byte_size
|
||||
+ .byte 0x5 # DW_AT_encoding
|
||||
+ .ascii "int\0" # DW_AT_name
|
||||
+ .byte 0x0 # end of children of DIE 0xb
|
||||
+ .section .debug_abbrev
|
||||
+ .uleb128 0x1 # (abbrev code)
|
||||
+ .uleb128 0x11 # (TAG: DW_TAG_compile_unit)
|
||||
+ .byte 0x1 # DW_children_yes
|
||||
+ .uleb128 0x25 # (DW_AT_producer)
|
||||
+ .uleb128 0xe # (DW_FORM_strp)
|
||||
+ .uleb128 0x13 # (DW_AT_language)
|
||||
+ .uleb128 0xb # (DW_FORM_data1)
|
||||
+ .uleb128 0x3 # (DW_AT_name)
|
||||
+ .uleb128 0xe # (DW_FORM_strp)
|
||||
+ .uleb128 0x1b # (DW_AT_comp_dir)
|
||||
+ .uleb128 0xe # (DW_FORM_strp)
|
||||
+ .uleb128 0x11 # (DW_AT_low_pc)
|
||||
+ .uleb128 0x1 # (DW_FORM_addr)
|
||||
+ .uleb128 0x12 # (DW_AT_high_pc)
|
||||
+ .uleb128 0x1 # (DW_FORM_addr)
|
||||
+ .uleb128 0x10 # (DW_AT_stmt_list)
|
||||
+ .uleb128 0x17 # (DW_FORM_sec_offset)
|
||||
+ .byte 0x0
|
||||
+ .byte 0x0
|
||||
+ .uleb128 0x2 # (abbrev code)
|
||||
+ .uleb128 0x2e # (TAG: DW_TAG_subprogram)
|
||||
+ .byte 0x0 # DW_children_no
|
||||
+ .uleb128 0x3f # (DW_AT_external)
|
||||
+ .uleb128 0x19 # (DW_FORM_flag_present)
|
||||
+ .uleb128 0x3 # (DW_AT_name)
|
||||
+ .uleb128 0xe # (DW_FORM_strp)
|
||||
+ .uleb128 0x3a # (DW_AT_decl_file)
|
||||
+ .uleb128 0xb # (DW_FORM_data1)
|
||||
+ .uleb128 0x3b # (DW_AT_decl_line)
|
||||
+ .uleb128 0xb # (DW_FORM_data1)
|
||||
+ .uleb128 0x27 # (DW_AT_prototyped)
|
||||
+ .uleb128 0x19 # (DW_FORM_flag_present)
|
||||
+ .uleb128 0x49 # (DW_AT_type)
|
||||
+ .uleb128 0x13 # (DW_FORM_ref4)
|
||||
+ .uleb128 0x11 # (DW_AT_low_pc)
|
||||
+ .uleb128 0x1 # (DW_FORM_addr)
|
||||
+ .uleb128 0x12 # (DW_AT_high_pc)
|
||||
+ .uleb128 0x1 # (DW_FORM_addr)
|
||||
+ .uleb128 0x40 # (DW_AT_frame_base)
|
||||
+ .uleb128 0x18 # (DW_FORM_exprloc)
|
||||
+ .byte 0x0
|
||||
+ .byte 0x0
|
||||
+ .uleb128 0x3 # (abbrev code)
|
||||
+ .uleb128 0x24 # (TAG: DW_TAG_base_type)
|
||||
+ .byte 0x0 # DW_children_no
|
||||
+ .uleb128 0xb # (DW_AT_byte_size)
|
||||
+ .uleb128 0xb # (DW_FORM_data1)
|
||||
+ .uleb128 0x3e # (DW_AT_encoding)
|
||||
+ .uleb128 0xb # (DW_FORM_data1)
|
||||
+ .uleb128 0x3 # (DW_AT_name)
|
||||
+ .uleb128 0x8 # (DW_FORM_string)
|
||||
+ .byte 0x0
|
||||
+ .byte 0x0
|
||||
+ .byte 0x0
|
||||
+ .section .debug_pubnames,"",@progbits
|
||||
+ .long 0x17 # Length of Public Names Info
|
||||
+ .value 0x2 # DWARF Version
|
||||
+ .long .Ldebug_info0 # Offset of Compilation Unit Info
|
||||
+ .long 0x52 # Compilation Unit Length
|
||||
+ .long 0x2d # DIE offset
|
||||
+ .ascii "main\0" # external name
|
||||
+ .long 0x0
|
||||
+ .section .debug_aranges,"",@progbits
|
||||
+ .long 0x2c # Length of Address Ranges Info
|
||||
+ .value 0x2 # DWARF Version
|
||||
+ .long .Ldebug_info0 # Offset of Compilation Unit Info
|
||||
+ .byte 0x8 # Size of Address
|
||||
+ .byte 0x0 # Size of Segment Descriptor
|
||||
+ .value 0x0 # Pad to 16 byte boundary
|
||||
+ .value 0x0
|
||||
+ .quad .Ltext0 # Address
|
||||
+ .quad .Letext0-.Ltext0 # Length
|
||||
+ .quad 0x0
|
||||
+ .quad 0x0
|
||||
+ .section .debug_str,"MS",@progbits,1
|
||||
+.LASF2:
|
||||
+ .string "."
|
||||
+.LASF0:
|
||||
+ .string "GNU C 4.4.4 20100503 (Red Hat 4.4.4-2)"
|
||||
+.LASF1:
|
||||
+ .string "gdb.dwarf2/rh-dwarf4-x86_64.c"
|
||||
+.LASF3:
|
||||
+ .string "main"
|
||||
+ .ident "GCC: (GNU) 4.4.4 20100503 (Red Hat 4.4.4-2)"
|
||||
+ .section .note.GNU-stack,"",@progbits
|
||||
diff --git a/gdb/testsuite/gdb.dwarf2/rh-dwarf4-x86_64.c b/gdb/testsuite/gdb.dwarf2/rh-dwarf4-x86_64.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.dwarf2/rh-dwarf4-x86_64.c
|
||||
@@ -0,0 +1,22 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2010 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+int
|
||||
+main (void)
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.dwarf2/rh-dwarf4-x86_64.exp b/gdb/testsuite/gdb.dwarf2/rh-dwarf4-x86_64.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.dwarf2/rh-dwarf4-x86_64.exp
|
||||
@@ -0,0 +1,42 @@
|
||||
+# Copyright 2010 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+# This test can only be run on targets which support DWARF-2 and use gas.
|
||||
+# 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
|
||||
+}
|
||||
+
|
||||
+if {![istarget x86_64-*]} {
|
||||
+ return 0
|
||||
+}
|
||||
+
|
||||
+set testfile "rh-dwarf4-x86_64"
|
||||
+set srcfile ${testfile}.S
|
||||
+set executable ${testfile}.x
|
||||
+set binfile [standard_output_file ${executable}]
|
||||
+
|
||||
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" object {}] != "" } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+clean_restart $executable
|
||||
+
|
||||
+gdb_test "ptype main" {type = int \(void\)}
|
41
SOURCES/gdb-bz634108-solib_address.patch
Normal file
41
SOURCES/gdb-bz634108-solib_address.patch
Normal file
@ -0,0 +1,41 @@
|
||||
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-bz634108-solib_address.patch
|
||||
|
||||
;; Verify GDB Python built-in function gdb.solib_address exists (BZ # 634108).
|
||||
;;=fedoratest
|
||||
|
||||
Fix gdb.solib_address (fix by Phil Muldoon).
|
||||
|
||||
s/solib_address/solib_name/ during upstreaming.
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.python/rh634108-solib_address.exp b/gdb/testsuite/gdb.python/rh634108-solib_address.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.python/rh634108-solib_address.exp
|
||||
@@ -0,0 +1,24 @@
|
||||
+# Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+# https://bugzilla.redhat.com/show_bug.cgi?id=634108
|
||||
+
|
||||
+gdb_exit
|
||||
+gdb_start
|
||||
+
|
||||
+# Skip all tests if Python scripting is not enabled.
|
||||
+if { [skip_python_tests] } { continue }
|
||||
+
|
||||
+gdb_test "python print gdb.solib_name(-1)" "None" "gdb.solib_name exists"
|
26
SOURCES/gdb-ccache-workaround.patch
Normal file
26
SOURCES/gdb-ccache-workaround.patch
Normal file
@ -0,0 +1,26 @@
|
||||
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-ccache-workaround.patch
|
||||
|
||||
;; Workaround ccache making lineno non-zero for command-line definitions.
|
||||
;;=fedoratest: ccache is rarely used and it is even fixed now.
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/macscp.exp b/gdb/testsuite/gdb.base/macscp.exp
|
||||
--- a/gdb/testsuite/gdb.base/macscp.exp
|
||||
+++ b/gdb/testsuite/gdb.base/macscp.exp
|
||||
@@ -25,6 +25,14 @@ if { [test_compiler_info "gcc-*"] || [test_compiler_info "clang-*"] } {
|
||||
lappend options additional_flags=-g3
|
||||
}
|
||||
|
||||
+# Workaround ccache making lineno non-zero for command-line definitions.
|
||||
+if {[find_gcc] == "gcc" && [file executable "/usr/bin/gcc"]} {
|
||||
+ set result [catch "exec which gcc" output]
|
||||
+ if {$result == 0 && [string first "/ccache/" $output] > -1} {
|
||||
+ lappend options "compiler=/usr/bin/gcc"
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
# Generate the intermediate object file. This is required by Darwin to
|
||||
# have access to the .debug_macinfo section.
|
||||
if {[gdb_compile "${srcdir}/${subdir}/macscp1.c" "${objfile}" \
|
30
SOURCES/gdb-container-rh-pkg.patch
Normal file
30
SOURCES/gdb-container-rh-pkg.patch
Normal file
@ -0,0 +1,30 @@
|
||||
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-container-rh-pkg.patch
|
||||
|
||||
;; Add messages suggesting more recent RHEL gdbserver (RH BZ 1321114).
|
||||
;;=fedora
|
||||
|
||||
diff --git a/gdb/remote.c b/gdb/remote.c
|
||||
--- a/gdb/remote.c
|
||||
+++ b/gdb/remote.c
|
||||
@@ -13909,7 +13909,17 @@ remote_target::pid_to_exec_file (int pid)
|
||||
char *annex = NULL;
|
||||
|
||||
if (packet_support (PACKET_qXfer_exec_file) != PACKET_ENABLE)
|
||||
- return NULL;
|
||||
+ {
|
||||
+ warning (_("Remote gdbserver does not support determining executable "
|
||||
+ "automatically.\n"
|
||||
+"RHEL <=6.8 and <=7.2 versions of gdbserver do not support such automatic executable detection.\n"
|
||||
+"The following versions of gdbserver support it:\n"
|
||||
+"- Upstream version of gdbserver (unsupported) 7.10 or later\n"
|
||||
+"- Red Hat Developer Toolset (DTS) version of gdbserver from DTS 4.0 or later (only on x86_64)\n"
|
||||
+"- RHEL-7.3 versions of gdbserver (on any architecture)"
|
||||
+));
|
||||
+ return NULL;
|
||||
+ }
|
||||
|
||||
inf = find_inferior_pid (pid);
|
||||
if (inf == NULL)
|
58
SOURCES/gdb-core-open-vdso-warning.patch
Normal file
58
SOURCES/gdb-core-open-vdso-warning.patch
Normal file
@ -0,0 +1,58 @@
|
||||
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-core-open-vdso-warning.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@.*>
|
||||
|
||||
http://sourceware.org/ml/gdb-patches/2009-10/msg00142.html
|
||||
Subject: [patch] Fix GNU/Linux core open: Can't read pathname for load map: Input/output error.
|
||||
|
||||
[ New patch variant. ]
|
||||
|
||||
commit 7d760051ffb8a23cdc51342d4e6243fbc462f73f
|
||||
Author: Ulrich Weigand <uweigand@de.ibm.com>
|
||||
Date: Wed Sep 25 11:52:50 2013 +0000
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/solib-symbol.exp b/gdb/testsuite/gdb.base/solib-symbol.exp
|
||||
--- a/gdb/testsuite/gdb.base/solib-symbol.exp
|
||||
+++ b/gdb/testsuite/gdb.base/solib-symbol.exp
|
||||
@@ -29,6 +29,7 @@ set testfile "solib-symbol-main"
|
||||
set srcfile ${srcdir}/${subdir}/${testfile}.c
|
||||
set binfile [standard_output_file ${testfile}]
|
||||
set bin_flags [list debug shlib=${binfile_lib}]
|
||||
+set executable ${testfile}
|
||||
|
||||
if [get_compiler_info] {
|
||||
return -1
|
||||
@@ -72,8 +73,26 @@ gdb_test "br foo2" \
|
||||
"Breakpoint.*: foo2. .2 locations..*" \
|
||||
"foo2 in mdlib"
|
||||
|
||||
-gdb_exit
|
||||
+# Test GDB warns for shared libraris which have not been found.
|
||||
|
||||
-return 0
|
||||
+gdb_test "info sharedlibrary" "/${libname}.*"
|
||||
|
||||
+clean_restart ${executable}
|
||||
+gdb_breakpoint "main"
|
||||
+gdb_run_cmd
|
||||
+set test "no warning for missing libraries"
|
||||
+gdb_test_multiple "" $test {
|
||||
+ -re "warning: Could not load shared library symbols for \[0-9\]+ libraries,.*\r\n$gdb_prompt $" {
|
||||
+ fail $test
|
||||
+ }
|
||||
+ -re "Breakpoint \[0-9\]+, main .*\r\n$gdb_prompt $" {
|
||||
+ pass $test
|
||||
+ }
|
||||
+}
|
||||
|
||||
+clean_restart ${executable}
|
||||
+gdb_test_no_output "set solib-absolute-prefix /doESnotEXIST"
|
||||
+gdb_breakpoint "main"
|
||||
+gdb_run_cmd
|
||||
+gdb_test "" "warning: Could not load shared library symbols for \[0-9\]+ libraries,.*\r\nBreakpoint \[0-9\]+, main .*" \
|
||||
+ "warning for missing libraries"
|
315
SOURCES/gdb-dts-rhel6-python-compat.patch
Normal file
315
SOURCES/gdb-dts-rhel6-python-compat.patch
Normal file
@ -0,0 +1,315 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Fedora GDB patches <invalid@email.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-dts-rhel6-python-compat.patch
|
||||
|
||||
;; [rhel6] DTS backward Python compatibility API (BZ 1020004, Phil Muldoon).
|
||||
;;=fedora
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1020004
|
||||
|
||||
diff --git a/gdb/data-directory/Makefile.in b/gdb/data-directory/Makefile.in
|
||||
--- a/gdb/data-directory/Makefile.in
|
||||
+++ b/gdb/data-directory/Makefile.in
|
||||
@@ -71,6 +71,8 @@ PYTHON_FILE_LIST = \
|
||||
gdb/__init__.py \
|
||||
gdb/FrameDecorator.py \
|
||||
gdb/FrameIterator.py \
|
||||
+ gdb/FrameWrapper.py \
|
||||
+ gdb/backtrace.py \
|
||||
gdb/frames.py \
|
||||
gdb/printing.py \
|
||||
gdb/prompt.py \
|
||||
@@ -79,6 +81,7 @@ PYTHON_FILE_LIST = \
|
||||
gdb/xmethod.py \
|
||||
gdb/command/__init__.py \
|
||||
gdb/command/explore.py \
|
||||
+ gdb/command/backtrace.py \
|
||||
gdb/command/frame_filters.py \
|
||||
gdb/command/pretty_printers.py \
|
||||
gdb/command/prompt.py \
|
||||
diff --git a/gdb/python/lib/gdb/FrameWrapper.py b/gdb/python/lib/gdb/FrameWrapper.py
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/python/lib/gdb/FrameWrapper.py
|
||||
@@ -0,0 +1,122 @@
|
||||
+# Wrapper API for frames.
|
||||
+
|
||||
+# Copyright (C) 2008, 2009 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+import gdb
|
||||
+
|
||||
+# FIXME: arguably all this should be on Frame somehow.
|
||||
+class FrameWrapper:
|
||||
+ def __init__ (self, frame):
|
||||
+ self.frame = frame;
|
||||
+
|
||||
+ def write_symbol (self, stream, sym, block):
|
||||
+ if len (sym.linkage_name):
|
||||
+ nsym, is_field_of_this = gdb.lookup_symbol (sym.linkage_name, block)
|
||||
+ if nsym.addr_class != gdb.SYMBOL_LOC_REGISTER:
|
||||
+ sym = nsym
|
||||
+
|
||||
+ stream.write (sym.print_name + "=")
|
||||
+ try:
|
||||
+ val = self.read_var (sym)
|
||||
+ if val != None:
|
||||
+ val = str (val)
|
||||
+ # FIXME: would be nice to have a more precise exception here.
|
||||
+ except RuntimeError as text:
|
||||
+ val = text
|
||||
+ if val == None:
|
||||
+ stream.write ("???")
|
||||
+ else:
|
||||
+ stream.write (str (val))
|
||||
+
|
||||
+ def print_frame_locals (self, stream, func):
|
||||
+
|
||||
+ try:
|
||||
+ block = self.frame.block()
|
||||
+ except RuntimeError:
|
||||
+ block = None
|
||||
+
|
||||
+ while block != None:
|
||||
+ if block.is_global or block.is_static:
|
||||
+ break
|
||||
+
|
||||
+ for sym in block:
|
||||
+ if sym.is_argument:
|
||||
+ continue;
|
||||
+
|
||||
+ self.write_symbol (stream, sym, block)
|
||||
+ stream.write ('\n')
|
||||
+
|
||||
+ def print_frame_args (self, stream, func):
|
||||
+
|
||||
+ try:
|
||||
+ block = self.frame.block()
|
||||
+ except RuntimeError:
|
||||
+ block = None
|
||||
+
|
||||
+ while block != None:
|
||||
+ if block.function != None:
|
||||
+ break
|
||||
+ block = block.superblock
|
||||
+
|
||||
+ first = True
|
||||
+ for sym in block:
|
||||
+ if not sym.is_argument:
|
||||
+ continue;
|
||||
+
|
||||
+ if not first:
|
||||
+ stream.write (", ")
|
||||
+
|
||||
+ self.write_symbol (stream, sym, block)
|
||||
+ first = False
|
||||
+
|
||||
+ # FIXME: this should probably just be a method on gdb.Frame.
|
||||
+ # But then we need stream wrappers.
|
||||
+ def describe (self, stream, full):
|
||||
+ if self.type () == gdb.DUMMY_FRAME:
|
||||
+ stream.write (" <function called from gdb>\n")
|
||||
+ elif self.type () == gdb.SIGTRAMP_FRAME:
|
||||
+ stream.write (" <signal handler called>\n")
|
||||
+ else:
|
||||
+ sal = self.find_sal ()
|
||||
+ pc = self.pc ()
|
||||
+ name = self.name ()
|
||||
+ if not name:
|
||||
+ name = "??"
|
||||
+ if pc != sal.pc or not sal.symtab:
|
||||
+ stream.write (" 0x%08x in" % pc)
|
||||
+ stream.write (" " + name + " (")
|
||||
+
|
||||
+ func = self.function ()
|
||||
+ self.print_frame_args (stream, func)
|
||||
+
|
||||
+ stream.write (")")
|
||||
+
|
||||
+ if sal.symtab and sal.symtab.filename:
|
||||
+ stream.write (" at " + sal.symtab.filename)
|
||||
+ stream.write (":" + str (sal.line))
|
||||
+
|
||||
+ if not self.name () or (not sal.symtab or not sal.symtab.filename):
|
||||
+ lib = gdb.solib_name (pc)
|
||||
+ if lib:
|
||||
+ stream.write (" from " + lib)
|
||||
+
|
||||
+ stream.write ("\n")
|
||||
+
|
||||
+ if full:
|
||||
+ self.print_frame_locals (stream, func)
|
||||
+
|
||||
+ def __getattr__ (self, name):
|
||||
+ return getattr (self.frame, name)
|
||||
diff --git a/gdb/python/lib/gdb/backtrace.py b/gdb/python/lib/gdb/backtrace.py
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/python/lib/gdb/backtrace.py
|
||||
@@ -0,0 +1,42 @@
|
||||
+# Filtering backtrace.
|
||||
+
|
||||
+# Copyright (C) 2008, 2011 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+import gdb
|
||||
+import itertools
|
||||
+
|
||||
+# Our only exports.
|
||||
+__all__ = ['push_frame_filter', 'create_frame_filter']
|
||||
+
|
||||
+old_frame_filter = None
|
||||
+
|
||||
+def push_frame_filter (constructor):
|
||||
+ """Register a new backtrace filter class with the 'backtrace' command.
|
||||
+The filter will be passed an iterator as an argument. The iterator
|
||||
+will return gdb.Frame-like objects. The filter should in turn act as
|
||||
+an iterator returning such objects."""
|
||||
+ global old_frame_filter
|
||||
+ if old_frame_filter == None:
|
||||
+ old_frame_filter = constructor
|
||||
+ else:
|
||||
+ old_frame_filter = lambda iterator, filter = frame_filter: constructor (filter(iterator))
|
||||
+
|
||||
+def create_frame_filter (iter):
|
||||
+ global old_frame_filter
|
||||
+ if old_frame_filter is None:
|
||||
+ return iter
|
||||
+ return old_frame_filter (iter)
|
||||
+
|
||||
diff --git a/gdb/python/lib/gdb/command/backtrace.py b/gdb/python/lib/gdb/command/backtrace.py
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/python/lib/gdb/command/backtrace.py
|
||||
@@ -0,0 +1,106 @@
|
||||
+# New backtrace command.
|
||||
+
|
||||
+# Copyright (C) 2008, 2009, 2011 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+import gdb
|
||||
+import gdb.backtrace
|
||||
+import itertools
|
||||
+from gdb.FrameIterator import FrameIterator
|
||||
+from gdb.FrameWrapper import FrameWrapper
|
||||
+import sys
|
||||
+
|
||||
+class ReverseBacktraceParameter (gdb.Parameter):
|
||||
+ """The new-backtrace command can show backtraces in 'reverse' order.
|
||||
+This means that the innermost frame will be printed last.
|
||||
+Note that reverse backtraces are more expensive to compute."""
|
||||
+
|
||||
+ set_doc = "Enable or disable reverse backtraces."
|
||||
+ show_doc = "Show whether backtraces will be printed in reverse order."
|
||||
+
|
||||
+ def __init__(self):
|
||||
+ gdb.Parameter.__init__ (self, "reverse-backtrace",
|
||||
+ gdb.COMMAND_STACK, gdb.PARAM_BOOLEAN)
|
||||
+ # Default to compatibility with gdb.
|
||||
+ self.value = False
|
||||
+
|
||||
+class FilteringBacktrace (gdb.Command):
|
||||
+ """Print backtrace of all stack frames, or innermost COUNT frames.
|
||||
+With a negative argument, print outermost -COUNT frames.
|
||||
+Use of the 'full' qualifier also prints the values of the local variables.
|
||||
+Use of the 'raw' qualifier avoids any filtering by loadable modules.
|
||||
+"""
|
||||
+
|
||||
+ def __init__ (self):
|
||||
+ # FIXME: this is not working quite well enough to replace
|
||||
+ # "backtrace" yet.
|
||||
+ gdb.Command.__init__ (self, "new-backtrace", gdb.COMMAND_STACK)
|
||||
+ self.reverse = ReverseBacktraceParameter()
|
||||
+
|
||||
+ def reverse_iter (self, iter):
|
||||
+ result = []
|
||||
+ for item in iter:
|
||||
+ result.append (item)
|
||||
+ result.reverse()
|
||||
+ return result
|
||||
+
|
||||
+ def final_n (self, iter, x):
|
||||
+ result = []
|
||||
+ for item in iter:
|
||||
+ result.append (item)
|
||||
+ return result[x:]
|
||||
+
|
||||
+ def invoke (self, arg, from_tty):
|
||||
+ i = 0
|
||||
+ count = 0
|
||||
+ filter = True
|
||||
+ full = False
|
||||
+
|
||||
+ for word in arg.split (" "):
|
||||
+ if word == '':
|
||||
+ continue
|
||||
+ elif word == 'raw':
|
||||
+ filter = False
|
||||
+ elif word == 'full':
|
||||
+ full = True
|
||||
+ else:
|
||||
+ count = int (word)
|
||||
+
|
||||
+ # FIXME: provide option to start at selected frame
|
||||
+ # However, should still number as if starting from newest
|
||||
+ newest_frame = gdb.newest_frame()
|
||||
+ iter = itertools.imap (FrameWrapper,
|
||||
+ FrameIterator (newest_frame))
|
||||
+ if filter:
|
||||
+ iter = gdb.backtrace.create_frame_filter (iter)
|
||||
+
|
||||
+ # Now wrap in an iterator that numbers the frames.
|
||||
+ iter = itertools.izip (itertools.count (0), iter)
|
||||
+
|
||||
+ # Reverse if the user wanted that.
|
||||
+ if self.reverse.value:
|
||||
+ iter = self.reverse_iter (iter)
|
||||
+
|
||||
+ # Extract sub-range user wants.
|
||||
+ if count < 0:
|
||||
+ iter = self.final_n (iter, count)
|
||||
+ elif count > 0:
|
||||
+ iter = itertools.islice (iter, 0, count)
|
||||
+
|
||||
+ for pair in iter:
|
||||
+ sys.stdout.write ("#%-2d" % pair[0])
|
||||
+ pair[1].describe (sys.stdout, full)
|
||||
+
|
||||
+FilteringBacktrace()
|
71
SOURCES/gdb-fedora-libncursesw.patch
Normal file
71
SOURCES/gdb-fedora-libncursesw.patch
Normal file
@ -0,0 +1,71 @@
|
||||
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-fedora-libncursesw.patch
|
||||
|
||||
;; Force libncursesw over libncurses to match the includes (RH BZ 1270534).
|
||||
;;=push+jan
|
||||
|
||||
Fedora: Force libncursesw over libncurses to match the includes.
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1270534
|
||||
|
||||
diff --git a/gdb/configure b/gdb/configure
|
||||
--- a/gdb/configure
|
||||
+++ b/gdb/configure
|
||||
@@ -9393,6 +9393,7 @@ if test x"$prefer_curses" = xyes; then
|
||||
# search /usr/local/include, if ncurses is installed in /usr/local. A
|
||||
# default installation of ncurses on alpha*-dec-osf* will lead to such
|
||||
# a situation.
|
||||
+ # Fedora: Force libncursesw over libncurses to match the includes.
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing waddstr" >&5
|
||||
$as_echo_n "checking for library containing waddstr... " >&6; }
|
||||
if ${ac_cv_search_waddstr+:} false; then :
|
||||
@@ -9417,7 +9418,7 @@ return waddstr ();
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
-for ac_lib in '' ncursesw ncurses cursesX curses; do
|
||||
+for ac_lib in '' ncursesw; do
|
||||
if test -z "$ac_lib"; then
|
||||
ac_res="none required"
|
||||
else
|
||||
@@ -9491,6 +9492,7 @@ case $host_os in
|
||||
esac
|
||||
|
||||
# These are the libraries checked by Readline.
|
||||
+# Fedora: Force libncursesw over libncurses to match the includes.
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing tgetent" >&5
|
||||
$as_echo_n "checking for library containing tgetent... " >&6; }
|
||||
if ${ac_cv_search_tgetent+:} false; then :
|
||||
@@ -9515,7 +9517,7 @@ return tgetent ();
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
-for ac_lib in '' termcap tinfo curses ncursesw ncurses; do
|
||||
+for ac_lib in '' termcap tinfo ncursesw; do
|
||||
if test -z "$ac_lib"; then
|
||||
ac_res="none required"
|
||||
else
|
||||
diff --git a/gdb/configure.ac b/gdb/configure.ac
|
||||
--- a/gdb/configure.ac
|
||||
+++ b/gdb/configure.ac
|
||||
@@ -766,7 +766,8 @@ if test x"$prefer_curses" = xyes; then
|
||||
# search /usr/local/include, if ncurses is installed in /usr/local. A
|
||||
# default installation of ncurses on alpha*-dec-osf* will lead to such
|
||||
# a situation.
|
||||
- AC_SEARCH_LIBS(waddstr, [ncursesw ncurses cursesX curses])
|
||||
+ # Fedora: Force libncursesw over libncurses to match the includes.
|
||||
+ AC_SEARCH_LIBS(waddstr, [ncursesw])
|
||||
|
||||
if test "$ac_cv_search_waddstr" != no; then
|
||||
curses_found=yes
|
||||
@@ -808,7 +809,8 @@ case $host_os in
|
||||
esac
|
||||
|
||||
# These are the libraries checked by Readline.
|
||||
-AC_SEARCH_LIBS(tgetent, [termcap tinfo curses ncursesw ncurses])
|
||||
+# Fedora: Force libncursesw over libncurses to match the includes.
|
||||
+AC_SEARCH_LIBS(tgetent, [termcap tinfo ncursesw])
|
||||
|
||||
if test "$ac_cv_search_tgetent" = no; then
|
||||
CONFIG_OBS="$CONFIG_OBS stub-termcap.o"
|
36
SOURCES/gdb-follow-child-stale-parent.patch
Normal file
36
SOURCES/gdb-follow-child-stale-parent.patch
Normal file
@ -0,0 +1,36 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Fedora GDB patches <invalid@email.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-follow-child-stale-parent.patch
|
||||
|
||||
;; Fix regression by python on ia64 due to stale current frame.
|
||||
;;=push+jan
|
||||
|
||||
Problem occurs with python and its get_current_arch () as it selects
|
||||
selected_frame and current_frame while still inferior_ptid is valid for the
|
||||
original parent. But since this place it is already attached and later
|
||||
unwinders try to access it, breaking:
|
||||
-PASS: gdb.threads/watchpoint-fork.exp: child: singlethreaded: breakpoint after the first fork
|
||||
-PASS: gdb.threads/watchpoint-fork.exp: child: singlethreaded: watchpoint after the first fork
|
||||
-PASS: gdb.threads/watchpoint-fork.exp: child: singlethreaded: breakpoint after the second fork
|
||||
-PASS: gdb.threads/watchpoint-fork.exp: child: singlethreaded: watchpoint after the second fork
|
||||
-PASS: gdb.threads/watchpoint-fork.exp: child: singlethreaded: finish
|
||||
+FAIL: gdb.threads/watchpoint-fork.exp: child: singlethreaded: breakpoint after the first fork
|
||||
+FAIL: gdb.threads/watchpoint-fork.exp: child: singlethreaded: watchpoint after the first fork
|
||||
+FAIL: gdb.threads/watchpoint-fork.exp: child: singlethreaded: breakpoint after the second fork
|
||||
+FAIL: gdb.threads/watchpoint-fork.exp: child: singlethreaded: watchpoint after the second fork
|
||||
+FAIL: gdb.threads/watchpoint-fork.exp: child: singlethreaded: finish
|
||||
|
||||
diff --git a/gdb/infrun.c b/gdb/infrun.c
|
||||
--- a/gdb/infrun.c
|
||||
+++ b/gdb/infrun.c
|
||||
@@ -752,6 +752,9 @@ follow_fork (void)
|
||||
}
|
||||
else
|
||||
{
|
||||
+ /* Possibly referenced PARENT is no longer valid. */
|
||||
+ reinit_frame_cache ();
|
||||
+
|
||||
/* This pending follow fork event is now handled, one way
|
||||
or another. The previous selected thread may be gone
|
||||
from the lists by now, but if it is still around, need
|
104
SOURCES/gdb-fortran-frame-string.patch
Normal file
104
SOURCES/gdb-fortran-frame-string.patch
Normal file
@ -0,0 +1,104 @@
|
||||
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-fortran-frame-string.patch
|
||||
|
||||
;; Display Fortran strings in backtraces.
|
||||
;;=fedoratest
|
||||
|
||||
http://sourceware.org/ml/gdb-patches/2014-07/msg00709.html
|
||||
|
||||
Hi,
|
||||
|
||||
for Fortran it fixes displaying normal strings also in frames/backtraces:
|
||||
|
||||
(gdb) frame
|
||||
->
|
||||
|
||||
The patch is simple and I do not see why it should not be this way.
|
||||
|
||||
For C/C++ TYPE_CODE_STRING is not used. I am not aware of Pascal but that
|
||||
language is currently not really much supported in GDB anyway.
|
||||
|
||||
This was a part of my archer/jankratochvil/vla branch but it is not a part of
|
||||
the Intel VLA patchset as it in fact is completely unrelated to "VLA".
|
||||
|
||||
No regressions on {x86_64,x86_64-m32,i686}-fedora22pre-linux-gnu.
|
||||
|
||||
Thanks,
|
||||
Jan
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.fortran/fortran-frame-string.exp b/gdb/testsuite/gdb.fortran/fortran-frame-string.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.fortran/fortran-frame-string.exp
|
||||
@@ -0,0 +1,36 @@
|
||||
+# Copyright 2014 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 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.
|
||||
+
|
||||
+standard_testfile .f90
|
||||
+if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} {debug f90}] } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+if ![runto MAIN__] then {
|
||||
+ perror "couldn't run to breakpoint MAIN__"
|
||||
+ continue
|
||||
+}
|
||||
+
|
||||
+gdb_breakpoint [gdb_get_line_number "s = s"]
|
||||
+gdb_continue_to_breakpoint "s = s"
|
||||
+
|
||||
+gdb_test "ptype s" {type = character\*3}
|
||||
+gdb_test "p s" " = 'foo'"
|
||||
+
|
||||
+# Fix rejected upstream:
|
||||
+# https://sourceware.org/ml/gdb-patches/2014-07/msg00768.html
|
||||
+setup_kfail "rejected" *-*-*
|
||||
+gdb_test "frame" { \(s='foo', .*}
|
||||
diff --git a/gdb/testsuite/gdb.fortran/fortran-frame-string.f90 b/gdb/testsuite/gdb.fortran/fortran-frame-string.f90
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.fortran/fortran-frame-string.f90
|
||||
@@ -0,0 +1,28 @@
|
||||
+! Copyright 2014 Free Software Foundation, Inc.
|
||||
+!
|
||||
+! This program is free software; you can redistribute it and/or modify
|
||||
+! it under the terms of the GNU General Public License as published by
|
||||
+! the Free Software Foundation; either version 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.
|
||||
+!
|
||||
+! Ihis file is the Fortran source file for dynamic.exp.
|
||||
+! Original file written by Jakub Jelinek <jakub@redhat.com>.
|
||||
+! Modified for the GDB testcase by Jan Kratochvil <jan.kratochvil@redhat.com>.
|
||||
+
|
||||
+ subroutine f(s)
|
||||
+ character*3 s
|
||||
+ s = s
|
||||
+ end
|
||||
+
|
||||
+ program main
|
||||
+ call f ('foo')
|
||||
+ end
|
151
SOURCES/gdb-glibc-strstr-workaround.patch
Normal file
151
SOURCES/gdb-glibc-strstr-workaround.patch
Normal file
@ -0,0 +1,151 @@
|
||||
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-glibc-strstr-workaround.patch
|
||||
|
||||
;; Workaround PR libc/14166 for inferior calls of strstr.
|
||||
;;=fedora: Compatibility with RHELs (unchecked which ones).
|
||||
|
||||
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
|
||||
--- a/gdb/dwarf2read.c
|
||||
+++ b/gdb/dwarf2read.c
|
||||
@@ -21286,6 +21286,26 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
|
||||
/* Cache this symbol's name and the name's demangled form (if any). */
|
||||
SYMBOL_SET_LANGUAGE (sym, cu->language, &objfile->objfile_obstack);
|
||||
linkagename = dwarf2_physname (name, die, cu);
|
||||
+
|
||||
+ /* Workaround for:
|
||||
+ * invalid IFUNC DW_AT_linkage_name: memmove strstr time
|
||||
+ * http://sourceware.org/bugzilla/show_bug.cgi?id=14166 */
|
||||
+ if (strcmp (linkagename, "strstr") == 0
|
||||
+ && strstr (objfile_name (objfile), "/libc") != NULL)
|
||||
+ {
|
||||
+ struct objfile *objfile_msym;
|
||||
+ struct bound_minimal_symbol bmsym;
|
||||
+
|
||||
+ if (objfile->separate_debug_objfile_backlink)
|
||||
+ objfile_msym = objfile->separate_debug_objfile_backlink;
|
||||
+ else
|
||||
+ objfile_msym = objfile;
|
||||
+ bmsym = lookup_minimal_symbol ("strstr", NULL, objfile_msym);
|
||||
+ if (bmsym.minsym != NULL
|
||||
+ && MSYMBOL_TYPE (bmsym.minsym) == mst_text_gnu_ifunc)
|
||||
+ linkagename = "__strstr";
|
||||
+ }
|
||||
+
|
||||
SYMBOL_SET_NAMES (sym, linkagename, strlen (linkagename), 0, objfile);
|
||||
|
||||
/* Fortran does not have mangling standard and the mangling does differ
|
||||
diff --git a/gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp b/gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp
|
||||
@@ -0,0 +1,108 @@
|
||||
+# 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/>.
|
||||
+
|
||||
+# Workaround for:
|
||||
+# invalid IFUNC DW_AT_linkage_name: memmove strstr time
|
||||
+# http://sourceware.org/bugzilla/show_bug.cgi?id=14166
|
||||
+
|
||||
+if {[skip_shlib_tests]} {
|
||||
+ return 0
|
||||
+}
|
||||
+
|
||||
+set testfile "gnu-ifunc-strstr-workaround"
|
||||
+set executable ${testfile}
|
||||
+set srcfile start.c
|
||||
+set binfile [standard_output_file ${executable}]
|
||||
+
|
||||
+if [prepare_for_testing ${testfile}.exp $executable $srcfile] {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+if ![runto_main] {
|
||||
+ return 0
|
||||
+}
|
||||
+
|
||||
+set test "ptype atoi"
|
||||
+gdb_test_multiple $test $test {
|
||||
+ -re "type = int \\(const char \\*\\)\r\n$gdb_prompt $" {
|
||||
+ pass $test
|
||||
+ }
|
||||
+ -re "type = int \\(\\)\r\n$gdb_prompt $" {
|
||||
+ untested "$test (no DWARF)"
|
||||
+ return 0
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+set addr ""
|
||||
+set test "print strstr"
|
||||
+gdb_test_multiple $test $test {
|
||||
+ -re " = {<text gnu-indirect-function variable, no debug info>} (0x\[0-9a-f\]+) <strstr>\r\n$gdb_prompt $" {
|
||||
+ set addr $expect_out(1,string)
|
||||
+ pass $test
|
||||
+ }
|
||||
+ -re " = {<text gnu-indirect-function variable, no debug info>} (0x\[0-9a-f\]+) <__strstr>\r\n$gdb_prompt $" {
|
||||
+ set addr $expect_out(1,string)
|
||||
+ pass "$test (GDB workaround)"
|
||||
+ }
|
||||
+ -re " = {<text gnu-indirect-function variable, no debug info>} (0x\[0-9a-f\]+) <__libc_strstr>\r\n$gdb_prompt $" {
|
||||
+ set addr $expect_out(1,string)
|
||||
+ pass "$test (fixed glibc)"
|
||||
+ }
|
||||
+ -re " = {char \\*\\(const char \\*, const char \\*\\)} 0x\[0-9a-f\]+ <strstr>\r\n$gdb_prompt $" {
|
||||
+ untested "$test (gnu-ifunc not in use by glibc)"
|
||||
+ return 0
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+set test "info sym"
|
||||
+gdb_test_multiple "info sym $addr" $test {
|
||||
+ -re "strstr in section \\.text of /lib\[^/\]*/libc.so.6\r\n$gdb_prompt $" {
|
||||
+ pass $test
|
||||
+ }
|
||||
+ -re " = {char \\*\\(const char \\*, const char \\*\\)} 0x\[0-9a-f\]+ <strstr>\r\n$gdb_prompt $" {
|
||||
+ # unexpected
|
||||
+ xfail "$test (not in libc.so.6)"
|
||||
+ return 0
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+set test "info addr strstr"
|
||||
+gdb_test_multiple $test $test {
|
||||
+ -re "Symbol \"strstr\" is a function at address $addr\\.\r\n$gdb_prompt $" {
|
||||
+ fail "$test (DWARF for strstr)"
|
||||
+ }
|
||||
+ -re "Symbol \"strstr\" is at $addr in a file compiled without debugging\\.\r\n$gdb_prompt $" {
|
||||
+ pass "$test"
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+set test "print strstr second time"
|
||||
+gdb_test_multiple "print strstr" $test {
|
||||
+ -re " = {<text gnu-indirect-function variable, no debug info>} $addr <strstr>\r\n$gdb_prompt $" {
|
||||
+ pass $test
|
||||
+ }
|
||||
+ -re " = {<text gnu-indirect-function variable, no debug info>} $addr <__strstr>\r\n$gdb_prompt $" {
|
||||
+ pass "$test (GDB workaround)"
|
||||
+ }
|
||||
+ -re " = {<text gnu-indirect-function variable, no debug info>} $addr <__libc_strstr>\r\n$gdb_prompt $" {
|
||||
+ pass "$test (fixed glibc)"
|
||||
+ }
|
||||
+ -re " = {void \\*\\(void\\)} 0x\[0-9a-f\]+ <strstr>\r\n$gdb_prompt $" {
|
||||
+ fail $test
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+gdb_test {print strstr("abc","b")} { = 0x[0-9a-f]+ "bc"}
|
||||
+gdb_test {print strstr("def","e")} { = 0x[0-9a-f]+ "ef"}
|
236
SOURCES/gdb-gnat-dwarf-crash-3of3.patch
Normal file
236
SOURCES/gdb-gnat-dwarf-crash-3of3.patch
Normal file
@ -0,0 +1,236 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Fedora GDB patches <invalid@email.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-gnat-dwarf-crash-3of3.patch
|
||||
|
||||
;; Fix crash of -readnow /usr/lib/debug/usr/bin/gnatbind.debug (BZ 1069211).
|
||||
;;=push+jan
|
||||
|
||||
http://sourceware.org/ml/gdb-patches/2014-02/msg00731.html
|
||||
|
||||
--6TrnltStXW4iwmi0
|
||||
Content-Type: text/plain; charset=us-ascii
|
||||
Content-Disposition: inline
|
||||
|
||||
Hi,
|
||||
|
||||
PR 16581:
|
||||
GDB crash on inherit_abstract_dies infinite recursion
|
||||
https://sourceware.org/bugzilla/show_bug.cgi?id=16581
|
||||
|
||||
fixed crash from an infinite recursion. But in rare cases the new code can
|
||||
now gdb_assert() due to weird DWARF file.
|
||||
|
||||
I do not yet fully understand why the DWARF is as it is but just GDB should
|
||||
never crash due to invalid DWARF anyway. The "invalid" DWARF I see only in
|
||||
Fedora GCC build, not in FSF GCC build, more info at:
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1069382
|
||||
http://people.redhat.com/jkratoch/gcc-debuginfo-4.8.2-7.fc20.x86_64-gnatbind.debug
|
||||
|
||||
Thanks,
|
||||
Jan
|
||||
|
||||
--6TrnltStXW4iwmi0
|
||||
Content-Type: text/plain; charset=us-ascii
|
||||
Content-Disposition: inline; filename="complaint.patch"
|
||||
|
||||
gdb/
|
||||
2014-02-24 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* dwarf2read.c (process_die): Change gdb_assert to complaint.
|
||||
|
||||
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
|
||||
--- a/gdb/dwarf2read.c
|
||||
+++ b/gdb/dwarf2read.c
|
||||
@@ -10499,6 +10499,13 @@ private:
|
||||
static void
|
||||
process_die (struct die_info *die, struct dwarf2_cu *cu)
|
||||
{
|
||||
+ if (die->in_process)
|
||||
+ {
|
||||
+ complaint (_("DIE at 0x%s attempted to be processed twice"),
|
||||
+ sect_offset_str (die->sect_off));
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
process_die_scope scope (die, cu);
|
||||
|
||||
switch (die->tag)
|
||||
diff --git a/gdb/infrun.c b/gdb/infrun.c
|
||||
--- a/gdb/infrun.c
|
||||
+++ b/gdb/infrun.c
|
||||
@@ -607,6 +607,13 @@ holding the child stopped. Try \"set detach-on-fork\" or \
|
||||
target_pid_to_str (process_ptid));
|
||||
}
|
||||
|
||||
+#ifdef NEED_DETACH_SIGSTOP
|
||||
+ /* We should check PID_WAS_STOPPED and detach it stopped accordingly.
|
||||
+ In this point of code it cannot be 1 as we would not get FORK
|
||||
+ executed without CONTINUE first which resets PID_WAS_STOPPED.
|
||||
+ We would have to first TARGET_STOP and WAITPID it as with running
|
||||
+ inferior PTRACE_DETACH, SIGSTOP will ignore the signal. */
|
||||
+#endif
|
||||
target_detach (parent_inf, 0);
|
||||
}
|
||||
|
||||
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
|
||||
--- a/gdb/linux-nat.c
|
||||
+++ b/gdb/linux-nat.c
|
||||
@@ -191,6 +191,12 @@ struct linux_nat_target *linux_target;
|
||||
/* Does the current host support PTRACE_GETREGSET? */
|
||||
enum tribool have_ptrace_getregset = TRIBOOL_UNKNOWN;
|
||||
|
||||
+#ifdef NEED_DETACH_SIGSTOP
|
||||
+/* PID of the inferior stopped by SIGSTOP before attaching (or zero). */
|
||||
+static pid_t pid_was_stopped;
|
||||
+
|
||||
+#endif
|
||||
+
|
||||
/* The saved to_close method, inherited from inf-ptrace.c.
|
||||
Called by our to_close. */
|
||||
static void (*super_close) (struct target_ops *);
|
||||
@@ -1027,6 +1033,9 @@ linux_nat_post_attach_wait (ptid_t ptid, int *signalled)
|
||||
if (debug_linux_nat)
|
||||
fprintf_unfiltered (gdb_stdlog,
|
||||
"LNPAW: Attaching to a stopped process\n");
|
||||
+#ifdef NEED_DETACH_SIGSTOP
|
||||
+ pid_was_stopped = ptid.pid ();
|
||||
+#endif
|
||||
|
||||
/* The process is definitely stopped. It is in a job control
|
||||
stop, unless the kernel predates the TASK_STOPPED /
|
||||
@@ -1359,6 +1368,25 @@ get_detach_signal (struct lwp_info *lp)
|
||||
return gdb_signal_to_host (signo);
|
||||
}
|
||||
|
||||
+#ifdef NEED_DETACH_SIGSTOP
|
||||
+ /* Workaround RHEL-5 kernel which has unreliable PTRACE_DETACH, SIGSTOP (that
|
||||
+ many TIDs are left unstopped). See RH Bug 496732. */
|
||||
+ if (lp->ptid.pid () == pid_was_stopped)
|
||||
+ {
|
||||
+ int err;
|
||||
+
|
||||
+ errno = 0;
|
||||
+ err = kill_lwp (lp->ptid.lwp (), SIGSTOP);
|
||||
+ if (debug_linux_nat)
|
||||
+ {
|
||||
+ fprintf_unfiltered (gdb_stdlog,
|
||||
+ "SC: lwp kill %d %s\n",
|
||||
+ err,
|
||||
+ errno ? safe_strerror (errno) : "ERRNO-OK");
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1507,6 +1535,10 @@ linux_nat_target::detach (inferior *inf, int from_tty)
|
||||
detach_one_lwp (main_lwp, &signo);
|
||||
|
||||
detach_success (inf);
|
||||
+
|
||||
+#ifdef NEED_DETACH_SIGSTOP
|
||||
+ pid_was_stopped = 0;
|
||||
+#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1765,6 +1797,16 @@ linux_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signo)
|
||||
return;
|
||||
}
|
||||
|
||||
+#ifdef NEED_DETACH_SIGSTOP
|
||||
+ /* At this point, we are going to resume the inferior and if we
|
||||
+ have attached to a stopped process, we no longer should leave
|
||||
+ it as stopped if the user detaches. PTID variable has PID set to LWP
|
||||
+ while we need to check the real PID here. */
|
||||
+
|
||||
+ if (!step && lp && pid_was_stopped == lp->ptid.pid ())
|
||||
+ pid_was_stopped = 0;
|
||||
+
|
||||
+#endif
|
||||
if (resume_many)
|
||||
iterate_over_lwps (ptid, linux_nat_resume_callback, lp);
|
||||
|
||||
@@ -3761,6 +3803,10 @@ linux_nat_target::mourn_inferior ()
|
||||
|
||||
/* Let the arch-specific native code know this process is gone. */
|
||||
linux_target->low_forget_process (pid);
|
||||
+#ifdef NEED_DETACH_SIGSTOP
|
||||
+
|
||||
+ pid_was_stopped = 0;
|
||||
+#endif
|
||||
}
|
||||
|
||||
/* Convert a native/host siginfo object, into/from the siginfo in the
|
||||
diff --git a/gdb/testsuite/gdb.threads/attach-stopped.exp b/gdb/testsuite/gdb.threads/attach-stopped.exp
|
||||
--- a/gdb/testsuite/gdb.threads/attach-stopped.exp
|
||||
+++ b/gdb/testsuite/gdb.threads/attach-stopped.exp
|
||||
@@ -56,7 +56,65 @@ proc corefunc { threadtype } {
|
||||
gdb_reinitialize_dir $srcdir/$subdir
|
||||
gdb_load ${binfile}
|
||||
|
||||
- # Verify that we can attach to the stopped process.
|
||||
+ # Verify that we can attach to the process by first giving its
|
||||
+ # executable name via the file command, and using attach with the
|
||||
+ # process ID.
|
||||
+
|
||||
+ set test "$threadtype: set file, before attach1 to stopped process"
|
||||
+ gdb_test_multiple "file $binfile" "$test" {
|
||||
+ -re "Load new symbol table from.*y or n. $" {
|
||||
+ gdb_test "y" "Reading symbols from $escapedbinfile\.\.\.*done." \
|
||||
+ "$test (re-read)"
|
||||
+ }
|
||||
+ -re "Reading symbols from $escapedbinfile\.\.\.*done.*$gdb_prompt $" {
|
||||
+ pass "$test"
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ set test "$threadtype: attach1 to stopped, after setting file"
|
||||
+ gdb_test_multiple "attach $testpid" "$test" {
|
||||
+ -re "Attaching to program.*`?$escapedbinfile'?, process $testpid.*$gdb_prompt $" {
|
||||
+ pass "$test"
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ # ".*sleep.*clone.*" would fail on s390x as bt stops at START_THREAD there.
|
||||
+ if {[string equal $threadtype threaded]} {
|
||||
+ gdb_test "thread apply all bt" ".*sleep.*start_thread.*" "$threadtype: attach1 to stopped bt"
|
||||
+ } else {
|
||||
+ gdb_test "bt" ".*sleep.*main.*" "$threadtype: attach1 to stopped bt"
|
||||
+ }
|
||||
+
|
||||
+ # Exit and detach the process.
|
||||
+
|
||||
+ gdb_exit
|
||||
+
|
||||
+ # Avoid some race:
|
||||
+ sleep 2
|
||||
+
|
||||
+ if [catch {open /proc/${testpid}/status r} fileid] {
|
||||
+ set line2 "NOTFOUND"
|
||||
+ } else {
|
||||
+ gets $fileid line1;
|
||||
+ gets $fileid line2;
|
||||
+ close $fileid;
|
||||
+ }
|
||||
+
|
||||
+ set test "$threadtype: attach1, exit leaves process stopped"
|
||||
+ if {[string match "*(stopped)*" $line2]} {
|
||||
+ pass $test
|
||||
+ } else {
|
||||
+ fail $test
|
||||
+ }
|
||||
+
|
||||
+ # At this point, the process should still be stopped
|
||||
+
|
||||
+ gdb_start
|
||||
+ gdb_reinitialize_dir $srcdir/$subdir
|
||||
+ gdb_load ${binfile}
|
||||
+
|
||||
+ # Verify that we can attach to the process just by giving the
|
||||
+ # process ID.
|
||||
|
||||
set test "$threadtype: attach2 to stopped, after setting file"
|
||||
gdb_test_multiple "attach $testpid" "$test" {
|
48
SOURCES/gdb-gstack.man
Normal file
48
SOURCES/gdb-gstack.man
Normal file
@ -0,0 +1,48 @@
|
||||
.\"
|
||||
.\" gstack manual page.
|
||||
.\" Copyright (c) 1999 Ross Thompson
|
||||
.\" Copyright (c) 2001, 2002, 2004, 2008 Red Hat, Inc.
|
||||
.\"
|
||||
.\" Original author: Ross Thompson <ross@whatsis.com>
|
||||
.\"
|
||||
.\" 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, 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; see the file COPYING. If not, write to
|
||||
.\" the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
.\" Boston, MA 02111-1307, USA.
|
||||
.\"
|
||||
.TH GSTACK 1 "Feb 15 2008" "Red Hat Linux" "Linux Programmer's Manual"
|
||||
|
||||
.SH NAME
|
||||
gstack \- print a stack trace of a running process
|
||||
|
||||
.SH SYNOPSIS
|
||||
.B gstack
|
||||
pid
|
||||
|
||||
.SH DESCRIPTION
|
||||
|
||||
\f3gstack\f1 attaches to the active process named by the \f3pid\f1 on
|
||||
the command line, and prints out an execution stack trace. If ELF
|
||||
symbols exist in the binary (usually the case unless you have run
|
||||
strip(1)), then symbolic addresses are printed as well.
|
||||
|
||||
If the process is part of a thread group, then \f3gstack\f1 will print
|
||||
out a stack trace for each of the threads in the group.
|
||||
|
||||
.SH SEE ALSO
|
||||
nm(1), ptrace(2), gdb(1)
|
||||
|
||||
.SH AUTHORS
|
||||
Ross Thompson <ross@whatsis.com>
|
||||
|
||||
Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>
|
46
SOURCES/gdb-jit-reader-multilib.patch
Normal file
46
SOURCES/gdb-jit-reader-multilib.patch
Normal file
@ -0,0 +1,46 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Fedora GDB patches <invalid@email.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-jit-reader-multilib.patch
|
||||
|
||||
;; Fix jit-reader.h for multi-lib.
|
||||
;;=push+jan
|
||||
|
||||
diff --git a/gdb/configure b/gdb/configure
|
||||
--- a/gdb/configure
|
||||
+++ b/gdb/configure
|
||||
@@ -9680,10 +9680,12 @@ _ACEOF
|
||||
|
||||
|
||||
|
||||
-if test "x${ac_cv_sizeof_unsigned_long}" = "x8"; then
|
||||
- TARGET_PTR="unsigned long"
|
||||
-elif test "x${ac_cv_sizeof_unsigned_long_long}" = "x8"; then
|
||||
+# Try to keep TARGET_PTR the same across archs so that jit-reader.h file
|
||||
+# content is the same for multilib distributions.
|
||||
+if test "x${ac_cv_sizeof_unsigned_long_long}" = "x8"; then
|
||||
TARGET_PTR="unsigned long long"
|
||||
+elif test "x${ac_cv_sizeof_unsigned_long}" = "x8"; then
|
||||
+ TARGET_PTR="unsigned long"
|
||||
elif test "x${ac_cv_sizeof_unsigned___int128}" = "x16"; then
|
||||
TARGET_PTR="unsigned __int128"
|
||||
else
|
||||
diff --git a/gdb/configure.ac b/gdb/configure.ac
|
||||
--- a/gdb/configure.ac
|
||||
+++ b/gdb/configure.ac
|
||||
@@ -843,10 +843,12 @@ AC_CHECK_SIZEOF(unsigned long long)
|
||||
AC_CHECK_SIZEOF(unsigned long)
|
||||
AC_CHECK_SIZEOF(unsigned __int128)
|
||||
|
||||
-if test "x${ac_cv_sizeof_unsigned_long}" = "x8"; then
|
||||
- TARGET_PTR="unsigned long"
|
||||
-elif test "x${ac_cv_sizeof_unsigned_long_long}" = "x8"; then
|
||||
+# Try to keep TARGET_PTR the same across archs so that jit-reader.h file
|
||||
+# content is the same for multilib distributions.
|
||||
+if test "x${ac_cv_sizeof_unsigned_long_long}" = "x8"; then
|
||||
TARGET_PTR="unsigned long long"
|
||||
+elif test "x${ac_cv_sizeof_unsigned_long}" = "x8"; then
|
||||
+ TARGET_PTR="unsigned long"
|
||||
elif test "x${ac_cv_sizeof_unsigned___int128}" = "x16"; then
|
||||
TARGET_PTR="unsigned __int128"
|
||||
else
|
23
SOURCES/gdb-libexec-add-index.patch
Normal file
23
SOURCES/gdb-libexec-add-index.patch
Normal file
@ -0,0 +1,23 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Fedora GDB patches <invalid@email.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-libexec-add-index.patch
|
||||
|
||||
;; Fix gdb-headless /usr/bin/ executables (BZ 1390251).
|
||||
;;=fedora
|
||||
|
||||
diff --git a/gdb/contrib/gdb-add-index.sh b/gdb/contrib/gdb-add-index.sh
|
||||
--- a/gdb/contrib/gdb-add-index.sh
|
||||
+++ b/gdb/contrib/gdb-add-index.sh
|
||||
@@ -21,6 +21,11 @@
|
||||
GDB=${GDB:=gdb}
|
||||
OBJCOPY=${OBJCOPY:=objcopy}
|
||||
|
||||
+GDB2=/usr/libexec/gdb
|
||||
+if test -x $GDB2 && ! which $GDB &>/dev/null; then
|
||||
+ GDB=$GDB2
|
||||
+fi
|
||||
+
|
||||
myname="${0##*/}"
|
||||
|
||||
dwarf5=""
|
165
SOURCES/gdb-lineno-makeup-test.patch
Normal file
165
SOURCES/gdb-lineno-makeup-test.patch
Normal file
@ -0,0 +1,165 @@
|
||||
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-lineno-makeup-test.patch
|
||||
|
||||
;; Testcase for "Do not make up line information" fix by Daniel Jacobowitz.
|
||||
;;=fedoratest
|
||||
|
||||
New testcase for:
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=466222
|
||||
(for the first / customer recommended fix)
|
||||
and the upstream fix:
|
||||
http://sourceware.org/ml/gdb-patches/2006-11/msg00253.html
|
||||
[rfc] Do not make up line information
|
||||
http://sourceware.org/ml/gdb-cvs/2006-11/msg00127.html
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/lineno-makeup-func.c b/gdb/testsuite/gdb.base/lineno-makeup-func.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/lineno-makeup-func.c
|
||||
@@ -0,0 +1,21 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2009 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+void
|
||||
+func (void)
|
||||
+{
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.base/lineno-makeup.c b/gdb/testsuite/gdb.base/lineno-makeup.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/lineno-makeup.c
|
||||
@@ -0,0 +1,35 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2009 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+/* DW_AT_low_pc-DW_AT_high_pc should cover the function without line number
|
||||
+ information (.debug_line) so we cannot use an external object file.
|
||||
+
|
||||
+ It must not be just a label as it would alias on the next function even for
|
||||
+ correct GDB. Therefore some stub data must be placed there.
|
||||
+
|
||||
+ We need to provide a real stub function body as at least s390
|
||||
+ (s390_analyze_prologue) would skip the whole body till reaching `main'. */
|
||||
+
|
||||
+extern void func (void);
|
||||
+asm ("func: .incbin \"" BINFILENAME "\"");
|
||||
+
|
||||
+int
|
||||
+main (void)
|
||||
+{
|
||||
+ func ();
|
||||
+ return 0;
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.base/lineno-makeup.exp b/gdb/testsuite/gdb.base/lineno-makeup.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/lineno-makeup.exp
|
||||
@@ -0,0 +1,78 @@
|
||||
+# Copyright 2009 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+set testfile "lineno-makeup"
|
||||
+set srcfuncfile ${testfile}-func.c
|
||||
+set srcfile ${testfile}.c
|
||||
+set objfuncfile [standard_output_file ${testfile}-func.o]
|
||||
+set binfuncfile [standard_output_file ${testfile}-func.bin]
|
||||
+set binfile [standard_output_file ${testfile}]
|
||||
+
|
||||
+if { [gdb_compile "${srcdir}/${subdir}/${srcfuncfile}" "${objfuncfile}" object {}] != "" } {
|
||||
+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
|
||||
+}
|
||||
+
|
||||
+set objcopy [catch "exec objcopy -O binary --only-section .text ${objfuncfile} ${binfuncfile}" output]
|
||||
+verbose -log "objcopy=$objcopy: $output"
|
||||
+if { $objcopy != 0 } {
|
||||
+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
|
||||
+}
|
||||
+set binfuncfilesize [file size $binfuncfile]
|
||||
+verbose -log "file size $binfuncfile = $binfuncfilesize"
|
||||
+
|
||||
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug additional_flags=-DBINFILENAME=\"$binfuncfile\"]] != "" } {
|
||||
+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
|
||||
+}
|
||||
+
|
||||
+gdb_exit
|
||||
+gdb_start
|
||||
+gdb_reinitialize_dir $srcdir/$subdir
|
||||
+gdb_load ${binfile}
|
||||
+
|
||||
+set b_addr ""
|
||||
+set test "break func"
|
||||
+gdb_test_multiple $test $test {
|
||||
+ -re "Breakpoint \[0-9\]+ at (0x\[0-9a-f\]+)\r\n$gdb_prompt $" {
|
||||
+ set b_addr $expect_out(1,string)
|
||||
+ pass $test
|
||||
+ }
|
||||
+ -re "Breakpoint \[0-9\]+ at (0x\[0-9a-f\]+): .*\r\n$gdb_prompt $" {
|
||||
+ set b_addr $expect_out(1,string)
|
||||
+ fail $test
|
||||
+ }
|
||||
+}
|
||||
+verbose -log "b_addr=<$b_addr>"
|
||||
+
|
||||
+set p_addr ""
|
||||
+set test "print func"
|
||||
+gdb_test_multiple $test $test {
|
||||
+ -re "\\$\[0-9\]+ = {<text variable, no debug info>} (0x\[0-9a-f\]+) <func>\r\n$gdb_prompt $" {
|
||||
+ set p_addr $expect_out(1,string)
|
||||
+ pass $test
|
||||
+ }
|
||||
+}
|
||||
+verbose -log "p_addr=<$p_addr>"
|
||||
+
|
||||
+set test "break address belongs to func"
|
||||
+if {$b_addr == $p_addr} {
|
||||
+ pass "$test (exact match)"
|
||||
+} else {
|
||||
+ set skip [expr $b_addr - $p_addr]
|
||||
+ if {$skip > 0 && $skip < $binfuncfilesize} {
|
||||
+ pass "$test (prologue skip by $skip bytes)"
|
||||
+ } else {
|
||||
+ fail $test
|
||||
+ }
|
||||
+}
|
236
SOURCES/gdb-linux_perf-bundle.patch
Normal file
236
SOURCES/gdb-linux_perf-bundle.patch
Normal file
@ -0,0 +1,236 @@
|
||||
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-linux_perf-bundle.patch
|
||||
|
||||
;; [dts+el7] [x86*] Bundle linux_perf.h for libipt (RH BZ 1256513).
|
||||
;;=fedora
|
||||
|
||||
diff --git a/gdb/configure b/gdb/configure
|
||||
--- a/gdb/configure
|
||||
+++ b/gdb/configure
|
||||
@@ -12059,7 +12059,7 @@ else
|
||||
|
||||
#include <linux/perf_event.h>
|
||||
#ifndef PERF_ATTR_SIZE_VER5
|
||||
-# error
|
||||
+// error // PERF_ATTR_SIZE_VER5_BUNDLE is not available here - Fedora+RHEL
|
||||
#endif
|
||||
|
||||
_ACEOF
|
||||
diff --git a/gdb/configure.ac b/gdb/configure.ac
|
||||
--- a/gdb/configure.ac
|
||||
+++ b/gdb/configure.ac
|
||||
@@ -1477,7 +1477,7 @@ else
|
||||
AC_PREPROC_IFELSE([AC_LANG_SOURCE([[
|
||||
#include <linux/perf_event.h>
|
||||
#ifndef PERF_ATTR_SIZE_VER5
|
||||
-# error
|
||||
+// error // PERF_ATTR_SIZE_VER5_BUNDLE is not available here - Fedora+RHEL
|
||||
#endif
|
||||
]])], [perf_event=yes], [perf_event=no])
|
||||
if test "$perf_event" != yes; then
|
||||
diff --git a/gdb/gdb.c b/gdb/gdb.c
|
||||
--- a/gdb/gdb.c
|
||||
+++ b/gdb/gdb.c
|
||||
@@ -20,11 +20,19 @@
|
||||
#include "main.h"
|
||||
#include "interps.h"
|
||||
|
||||
+#ifdef PERF_ATTR_SIZE_VER5_BUNDLE
|
||||
+extern "C" void __libipt_init(void);
|
||||
+#endif
|
||||
+
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
struct captured_main_args args;
|
||||
|
||||
+#ifdef PERF_ATTR_SIZE_VER5_BUNDLE
|
||||
+ __libipt_init();
|
||||
+#endif
|
||||
+
|
||||
memset (&args, 0, sizeof args);
|
||||
args.argc = argc;
|
||||
args.argv = argv;
|
||||
diff --git a/gdb/nat/linux-btrace.h b/gdb/nat/linux-btrace.h
|
||||
--- a/gdb/nat/linux-btrace.h
|
||||
+++ b/gdb/nat/linux-btrace.h
|
||||
@@ -28,6 +28,177 @@
|
||||
# include <linux/perf_event.h>
|
||||
#endif
|
||||
|
||||
+#ifdef PERF_ATTR_SIZE_VER5_BUNDLE
|
||||
+#ifndef HAVE_LINUX_PERF_EVENT_H
|
||||
+# error "PERF_ATTR_SIZE_VER5_BUNDLE && !HAVE_LINUX_PERF_EVENT_H"
|
||||
+#endif
|
||||
+#ifndef PERF_ATTR_SIZE_VER5
|
||||
+#define PERF_ATTR_SIZE_VER5
|
||||
+#define perf_event_mmap_page perf_event_mmap_page_bundle
|
||||
+// kernel-headers-3.10.0-493.el7.x86_64/usr/include/linux/perf_event.h
|
||||
+/*
|
||||
+ * Structure of the page that can be mapped via mmap
|
||||
+ */
|
||||
+struct perf_event_mmap_page {
|
||||
+ __u32 version; /* version number of this structure */
|
||||
+ __u32 compat_version; /* lowest version this is compat with */
|
||||
+
|
||||
+ /*
|
||||
+ * Bits needed to read the hw events in user-space.
|
||||
+ *
|
||||
+ * u32 seq, time_mult, time_shift, index, width;
|
||||
+ * u64 count, enabled, running;
|
||||
+ * u64 cyc, time_offset;
|
||||
+ * s64 pmc = 0;
|
||||
+ *
|
||||
+ * do {
|
||||
+ * seq = pc->lock;
|
||||
+ * barrier()
|
||||
+ *
|
||||
+ * enabled = pc->time_enabled;
|
||||
+ * running = pc->time_running;
|
||||
+ *
|
||||
+ * if (pc->cap_usr_time && enabled != running) {
|
||||
+ * cyc = rdtsc();
|
||||
+ * time_offset = pc->time_offset;
|
||||
+ * time_mult = pc->time_mult;
|
||||
+ * time_shift = pc->time_shift;
|
||||
+ * }
|
||||
+ *
|
||||
+ * index = pc->index;
|
||||
+ * count = pc->offset;
|
||||
+ * if (pc->cap_user_rdpmc && index) {
|
||||
+ * width = pc->pmc_width;
|
||||
+ * pmc = rdpmc(index - 1);
|
||||
+ * }
|
||||
+ *
|
||||
+ * barrier();
|
||||
+ * } while (pc->lock != seq);
|
||||
+ *
|
||||
+ * NOTE: for obvious reason this only works on self-monitoring
|
||||
+ * processes.
|
||||
+ */
|
||||
+ __u32 lock; /* seqlock for synchronization */
|
||||
+ __u32 index; /* hardware event identifier */
|
||||
+ __s64 offset; /* add to hardware event value */
|
||||
+ __u64 time_enabled; /* time event active */
|
||||
+ __u64 time_running; /* time event on cpu */
|
||||
+ union {
|
||||
+ __u64 capabilities;
|
||||
+ struct {
|
||||
+ __u64 cap_bit0 : 1, /* Always 0, deprecated, see commit 860f085b74e9 */
|
||||
+ cap_bit0_is_deprecated : 1, /* Always 1, signals that bit 0 is zero */
|
||||
+
|
||||
+ cap_user_rdpmc : 1, /* The RDPMC instruction can be used to read counts */
|
||||
+ cap_user_time : 1, /* The time_* fields are used */
|
||||
+ cap_user_time_zero : 1, /* The time_zero field is used */
|
||||
+ cap_____res : 59;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ /*
|
||||
+ * If cap_user_rdpmc this field provides the bit-width of the value
|
||||
+ * read using the rdpmc() or equivalent instruction. This can be used
|
||||
+ * to sign extend the result like:
|
||||
+ *
|
||||
+ * pmc <<= 64 - width;
|
||||
+ * pmc >>= 64 - width; // signed shift right
|
||||
+ * count += pmc;
|
||||
+ */
|
||||
+ __u16 pmc_width;
|
||||
+
|
||||
+ /*
|
||||
+ * If cap_usr_time the below fields can be used to compute the time
|
||||
+ * delta since time_enabled (in ns) using rdtsc or similar.
|
||||
+ *
|
||||
+ * u64 quot, rem;
|
||||
+ * u64 delta;
|
||||
+ *
|
||||
+ * quot = (cyc >> time_shift);
|
||||
+ * rem = cyc & (((u64)1 << time_shift) - 1);
|
||||
+ * delta = time_offset + quot * time_mult +
|
||||
+ * ((rem * time_mult) >> time_shift);
|
||||
+ *
|
||||
+ * Where time_offset,time_mult,time_shift and cyc are read in the
|
||||
+ * seqcount loop described above. This delta can then be added to
|
||||
+ * enabled and possible running (if index), improving the scaling:
|
||||
+ *
|
||||
+ * enabled += delta;
|
||||
+ * if (index)
|
||||
+ * running += delta;
|
||||
+ *
|
||||
+ * quot = count / running;
|
||||
+ * rem = count % running;
|
||||
+ * count = quot * enabled + (rem * enabled) / running;
|
||||
+ */
|
||||
+ __u16 time_shift;
|
||||
+ __u32 time_mult;
|
||||
+ __u64 time_offset;
|
||||
+ /*
|
||||
+ * If cap_usr_time_zero, the hardware clock (e.g. TSC) can be calculated
|
||||
+ * from sample timestamps.
|
||||
+ *
|
||||
+ * time = timestamp - time_zero;
|
||||
+ * quot = time / time_mult;
|
||||
+ * rem = time % time_mult;
|
||||
+ * cyc = (quot << time_shift) + (rem << time_shift) / time_mult;
|
||||
+ *
|
||||
+ * And vice versa:
|
||||
+ *
|
||||
+ * quot = cyc >> time_shift;
|
||||
+ * rem = cyc & (((u64)1 << time_shift) - 1);
|
||||
+ * timestamp = time_zero + quot * time_mult +
|
||||
+ * ((rem * time_mult) >> time_shift);
|
||||
+ */
|
||||
+ __u64 time_zero;
|
||||
+ __u32 size; /* Header size up to __reserved[] fields. */
|
||||
+
|
||||
+ /*
|
||||
+ * Hole for extension of the self monitor capabilities
|
||||
+ */
|
||||
+
|
||||
+ __u8 __reserved[118*8+4]; /* align to 1k. */
|
||||
+
|
||||
+ /*
|
||||
+ * Control data for the mmap() data buffer.
|
||||
+ *
|
||||
+ * User-space reading the @data_head value should issue an smp_rmb(),
|
||||
+ * after reading this value.
|
||||
+ *
|
||||
+ * When the mapping is PROT_WRITE the @data_tail value should be
|
||||
+ * written by userspace to reflect the last read data, after issueing
|
||||
+ * an smp_mb() to separate the data read from the ->data_tail store.
|
||||
+ * In this case the kernel will not over-write unread data.
|
||||
+ *
|
||||
+ * See perf_output_put_handle() for the data ordering.
|
||||
+ *
|
||||
+ * data_{offset,size} indicate the location and size of the perf record
|
||||
+ * buffer within the mmapped area.
|
||||
+ */
|
||||
+ __u64 data_head; /* head in the data section */
|
||||
+ __u64 data_tail; /* user-space written tail */
|
||||
+ __u64 data_offset; /* where the buffer starts */
|
||||
+ __u64 data_size; /* data buffer size */
|
||||
+
|
||||
+ /*
|
||||
+ * AUX area is defined by aux_{offset,size} fields that should be set
|
||||
+ * by the userspace, so that
|
||||
+ *
|
||||
+ * aux_offset >= data_offset + data_size
|
||||
+ *
|
||||
+ * prior to mmap()ing it. Size of the mmap()ed area should be aux_size.
|
||||
+ *
|
||||
+ * Ring buffer pointers aux_{head,tail} have the same semantics as
|
||||
+ * data_{head,tail} and same ordering rules apply.
|
||||
+ */
|
||||
+ __u64 aux_head;
|
||||
+ __u64 aux_tail;
|
||||
+ __u64 aux_offset;
|
||||
+ __u64 aux_size;
|
||||
+};
|
||||
+#endif // PERF_ATTR_SIZE_VER5
|
||||
+#endif // PERF_ATTR_SIZE_VER5_BUNDLE
|
||||
+
|
||||
struct target_ops;
|
||||
|
||||
#if HAVE_LINUX_PERF_EVENT_H
|
25
SOURCES/gdb-moribund-utrace-workaround.patch
Normal file
25
SOURCES/gdb-moribund-utrace-workaround.patch
Normal file
@ -0,0 +1,25 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Fedora GDB patches <invalid@email.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-moribund-utrace-workaround.patch
|
||||
|
||||
;; Workaround non-stop moribund locations exploited by kernel utrace (BZ 590623).
|
||||
;;=push+jan: Currently it is still not fully safe.
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=590623
|
||||
http://sources.redhat.com/bugzilla/show_bug.cgi?id=11593
|
||||
|
||||
Bug in FSF GDB exploited by the ptrace-on-utrace interaction.
|
||||
|
||||
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
|
||||
--- a/gdb/breakpoint.c
|
||||
+++ b/gdb/breakpoint.c
|
||||
@@ -12016,6 +12016,8 @@ update_global_location_list (enum ugll_insert_mode insert_mode)
|
||||
traps we can no longer explain. */
|
||||
|
||||
old_loc->events_till_retirement = 3 * (thread_count () + 1);
|
||||
+ /* Red Hat Bug 590623. */
|
||||
+ old_loc->events_till_retirement *= 10;
|
||||
old_loc->owner = NULL;
|
||||
|
||||
VEC_safe_push (bp_location_p, moribund_locations, old_loc);
|
62
SOURCES/gdb-opcodes-clflushopt-test.patch
Normal file
62
SOURCES/gdb-opcodes-clflushopt-test.patch
Normal file
@ -0,0 +1,62 @@
|
||||
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-opcodes-clflushopt-test.patch
|
||||
|
||||
;; Test clflushopt instruction decode (for RH BZ 1262471).
|
||||
;;=fedoratest
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.arch/amd64-clflushopt.S b/gdb/testsuite/gdb.arch/amd64-clflushopt.S
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.arch/amd64-clflushopt.S
|
||||
@@ -0,0 +1,19 @@
|
||||
+/* Copyright 2016 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+ This file is part of the gdb testsuite. */
|
||||
+
|
||||
+_start: .globl _start
|
||||
+ clflushopt (%edi)
|
||||
diff --git a/gdb/testsuite/gdb.arch/amd64-clflushopt.exp b/gdb/testsuite/gdb.arch/amd64-clflushopt.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.arch/amd64-clflushopt.exp
|
||||
@@ -0,0 +1,25 @@
|
||||
+# Copyright 2016 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+if { ![istarget "x86_64-*-*"] && ![istarget "i?86-*-*"] } then {
|
||||
+ verbose "Skipping amd64 clflushopt test."
|
||||
+ return
|
||||
+}
|
||||
+
|
||||
+if [prepare_for_testing amd64-clflushopt.exp amd64-clflushopt amd64-clflushopt.S [list debug "additional_flags=-nostdlib"]] {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+gdb_test "disas _start" "Dump of assembler code for function _start:\r\n *0x\[0-9a-f\]+ <\[+\]0>:\tclflushopt \\(%edi\\)\r\nEnd of assembler dump\\." "clflushopt"
|
752
SOURCES/gdb-orphanripper.c
Normal file
752
SOURCES/gdb-orphanripper.c
Normal file
@ -0,0 +1,752 @@
|
||||
/*
|
||||
* Copyright 2006-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.
|
||||
*
|
||||
* Reap any leftover children possibly holding file descriptors.
|
||||
* Children are identified by the stale file descriptor or PGID / SID.
|
||||
* Both can be missed but only the stale file descriptors are important for us.
|
||||
* PGID / SID may be set by the children on their own.
|
||||
* If we fine a candidate we kill it will all its process tree (grandchildren).
|
||||
* The child process is run with `2>&1' redirection (due to forkpty(3)).
|
||||
* 2007-07-10 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
*/
|
||||
|
||||
/* For getpgid(2). */
|
||||
#define _GNU_SOURCE 1
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#include <dirent.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
#include <fcntl.h>
|
||||
#include <assert.h>
|
||||
#include <pty.h>
|
||||
#include <poll.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#define LENGTH(x) (sizeof (x) / sizeof (*(x)))
|
||||
|
||||
static const char *progname;
|
||||
|
||||
static volatile pid_t child;
|
||||
|
||||
static void signal_chld (int signo)
|
||||
{
|
||||
}
|
||||
|
||||
static volatile int signal_alrm_hit = 0;
|
||||
|
||||
static void signal_alrm (int signo)
|
||||
{
|
||||
signal_alrm_hit = 1;
|
||||
}
|
||||
|
||||
static char childptyname[LINE_MAX];
|
||||
|
||||
static void print_child_error (const char *reason, char **argv)
|
||||
{
|
||||
char **sp;
|
||||
|
||||
fprintf (stderr, "%s: %d %s:", progname, (int) child, reason);
|
||||
for (sp = argv; *sp != NULL; sp++)
|
||||
{
|
||||
fputc (' ', stderr);
|
||||
fputs (*sp, stderr);
|
||||
}
|
||||
fputc ('\n', stderr);
|
||||
}
|
||||
|
||||
static int read_out (int amaster)
|
||||
{
|
||||
char buf[LINE_MAX];
|
||||
ssize_t buf_got;
|
||||
|
||||
buf_got = read (amaster, buf, sizeof buf);
|
||||
if (buf_got == 0)
|
||||
return 0;
|
||||
/* Weird but at least after POLLHUP we get EIO instead of just EOF. */
|
||||
if (buf_got == -1 && errno == EIO)
|
||||
return 0;
|
||||
if (buf_got == -1 && errno == EAGAIN)
|
||||
return 0;
|
||||
if (buf_got < 0)
|
||||
{
|
||||
perror ("read (amaster)");
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
if (write (STDOUT_FILENO, buf, buf_got) != buf_got)
|
||||
{
|
||||
perror ("write(2)");
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* kill (child, 0) == 0 sometimes even when CHILD's state is already "Z". */
|
||||
|
||||
static int child_exited (void)
|
||||
{
|
||||
char buf[200];
|
||||
int fd, i, retval;
|
||||
ssize_t got;
|
||||
char state[3];
|
||||
|
||||
snprintf (buf, sizeof (buf), "/proc/%ld/stat", (long) child);
|
||||
fd = open (buf, O_RDONLY);
|
||||
if (fd == -1)
|
||||
{
|
||||
perror ("open (/proc/CHILD/stat)");
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
got = read (fd, buf, sizeof(buf));
|
||||
if (got <= 0)
|
||||
{
|
||||
perror ("read (/proc/CHILD/stat)");
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
if (close (fd) != 0)
|
||||
{
|
||||
perror ("close (/proc/CHILD/stat)");
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
/* RHEL-5 does not support %ms. */
|
||||
i = sscanf (buf, "%*d%*s%2s", state);
|
||||
if (i != 1)
|
||||
{
|
||||
perror ("sscanf (/proc/CHILD/stat)");
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
retval = strcmp (state, "Z") == 0;
|
||||
return retval;
|
||||
}
|
||||
|
||||
static int spawn (char **argv, int timeout)
|
||||
{
|
||||
pid_t child_got;
|
||||
int status, amaster, i, rc;
|
||||
struct sigaction act;
|
||||
sigset_t set;
|
||||
struct termios termios;
|
||||
unsigned alarm_orig;
|
||||
|
||||
/* We do not use signal(2) to be sure we do not have SA_RESTART. */
|
||||
memset (&act, 0, sizeof (act));
|
||||
act.sa_handler = signal_chld;
|
||||
i = sigemptyset (&act.sa_mask);
|
||||
assert (i == 0);
|
||||
act.sa_flags = 0; /* !SA_RESTART */
|
||||
i = sigaction (SIGCHLD, &act, NULL);
|
||||
assert (i == 0);
|
||||
|
||||
i = sigemptyset (&set);
|
||||
assert (i == 0);
|
||||
i = sigaddset (&set, SIGCHLD);
|
||||
assert (i == 0);
|
||||
i = sigprocmask (SIG_SETMASK, &set, NULL);
|
||||
assert (i == 0);
|
||||
|
||||
/* With TERMP passed as NULL we get "\n" -> "\r\n". */
|
||||
termios.c_iflag = IGNBRK | IGNPAR;
|
||||
termios.c_oflag = 0;
|
||||
termios.c_cflag = CS8 | CREAD | CLOCAL | HUPCL | B9600;
|
||||
termios.c_lflag = IEXTEN | NOFLSH;
|
||||
memset (termios.c_cc, _POSIX_VDISABLE, sizeof (termios.c_cc));
|
||||
termios.c_cc[VTIME] = 0;
|
||||
termios.c_cc[VMIN ] = 1;
|
||||
cfmakeraw (&termios);
|
||||
#ifdef FLUSHO
|
||||
/* Workaround a readline deadlock bug in _get_tty_settings(). */
|
||||
termios.c_lflag &= ~FLUSHO;
|
||||
#endif
|
||||
child = forkpty (&amaster, childptyname, &termios, NULL);
|
||||
switch (child)
|
||||
{
|
||||
case -1:
|
||||
perror ("forkpty(3)");
|
||||
exit (EXIT_FAILURE);
|
||||
case 0:
|
||||
/* Do not replace STDIN as inferiors query its termios. */
|
||||
#if 0
|
||||
i = close (STDIN_FILENO);
|
||||
assert (i == 0);
|
||||
i = open ("/dev/null", O_RDONLY);
|
||||
assert (i == STDIN_FILENO);
|
||||
#endif
|
||||
|
||||
i = sigemptyset (&set);
|
||||
assert (i == 0);
|
||||
i = sigprocmask (SIG_SETMASK, &set, NULL);
|
||||
assert (i == 0);
|
||||
|
||||
/* Do not setpgrp(2) in the parent process as the process-group
|
||||
is shared for the whole sh(1) pipeline we could be a part
|
||||
of. The process-group is set according to PID of the first
|
||||
command in the pipeline.
|
||||
We would rip even vi(1) in the case of:
|
||||
./orphanripper sh -c 'sleep 1&' | vi -
|
||||
*/
|
||||
/* Do not setpgrp(2) as our pty would not be ours and we would
|
||||
get `SIGSTOP' later, particularly after spawning gdb(1).
|
||||
setsid(3) was already executed by forkpty(3) and it would fail if
|
||||
executed again. */
|
||||
if (getpid() != getpgrp ())
|
||||
{
|
||||
perror ("getpgrp(2)");
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
execvp (argv[0], argv);
|
||||
perror ("execvp(2)");
|
||||
exit (EXIT_FAILURE);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
i = fcntl (amaster, F_SETFL, O_RDWR | O_NONBLOCK);
|
||||
if (i != 0)
|
||||
{
|
||||
perror ("fcntl (amaster, F_SETFL, O_NONBLOCK)");
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/* We do not use signal(2) to be sure we do not have SA_RESTART. */
|
||||
act.sa_handler = signal_alrm;
|
||||
i = sigaction (SIGALRM, &act, NULL);
|
||||
assert (i == 0);
|
||||
|
||||
alarm_orig = alarm (timeout);
|
||||
assert (alarm_orig == 0);
|
||||
|
||||
i = sigemptyset (&set);
|
||||
assert (i == 0);
|
||||
|
||||
while (!signal_alrm_hit)
|
||||
{
|
||||
struct pollfd pollfd;
|
||||
|
||||
pollfd.fd = amaster;
|
||||
pollfd.events = POLLIN;
|
||||
i = ppoll (&pollfd, 1, NULL, &set);
|
||||
if (i == -1 && errno == EINTR)
|
||||
{
|
||||
if (child_exited ())
|
||||
break;
|
||||
/* Non-CHILD child may have exited. */
|
||||
continue;
|
||||
}
|
||||
assert (i == 1);
|
||||
/* Data available? Process it first. */
|
||||
if (pollfd.revents & POLLIN)
|
||||
{
|
||||
if (!read_out (amaster))
|
||||
{
|
||||
fprintf (stderr, "%s: Unexpected EOF\n", progname);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
if (pollfd.revents & POLLHUP)
|
||||
break;
|
||||
if ((pollfd.revents &= ~POLLIN) != 0)
|
||||
{
|
||||
fprintf (stderr, "%s: ppoll(2): revents 0x%x\n", progname,
|
||||
(unsigned) pollfd.revents);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
/* Child exited? */
|
||||
if (child_exited ())
|
||||
break;
|
||||
}
|
||||
|
||||
if (signal_alrm_hit)
|
||||
{
|
||||
i = kill (child, SIGKILL);
|
||||
assert (i == 0);
|
||||
}
|
||||
else
|
||||
alarm (0);
|
||||
|
||||
/* WNOHANG still could fail. */
|
||||
child_got = waitpid (child, &status, 0);
|
||||
if (child != child_got)
|
||||
{
|
||||
fprintf (stderr, "waitpid (%d) = %d: %m\n", (int) child, (int) child_got);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
if (signal_alrm_hit)
|
||||
{
|
||||
char *buf;
|
||||
|
||||
if (asprintf (&buf, "Timed out after %d seconds", timeout) != -1)
|
||||
{
|
||||
print_child_error (buf, argv);
|
||||
free (buf);
|
||||
}
|
||||
rc = 128 + SIGALRM;
|
||||
}
|
||||
else if (WIFEXITED (status))
|
||||
rc = WEXITSTATUS (status);
|
||||
else if (WIFSIGNALED (status))
|
||||
{
|
||||
print_child_error (strsignal (WTERMSIG (status)), argv);
|
||||
rc = 128 + WTERMSIG (status);
|
||||
}
|
||||
else if (WIFSTOPPED (status))
|
||||
{
|
||||
fprintf (stderr, "waitpid (%d): WIFSTOPPED - WSTOPSIG is %d\n",
|
||||
(int) child, WSTOPSIG (status));
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf (stderr, "waitpid (%d): !WIFEXITED (%d)\n", (int) child, status);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/* Not used in fact. */
|
||||
i = sigprocmask (SIG_SETMASK, &set, NULL);
|
||||
assert (i == 0);
|
||||
|
||||
/* Do not unset O_NONBLOCK as a stale child (the whole purpose of this
|
||||
program) having open its output pty would block us in read_out. */
|
||||
#if 0
|
||||
i = fcntl (amaster, F_SETFL, O_RDONLY /* !O_NONBLOCK */);
|
||||
if (i != 0)
|
||||
{
|
||||
perror ("fcntl (amaster, F_SETFL, O_RDONLY /* !O_NONBLOCK */)");
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
#endif
|
||||
|
||||
while (read_out (amaster));
|
||||
|
||||
/* Do not close the master FD as the child would have `/dev/pts/23 (deleted)'
|
||||
entries which are not expected (and expecting ` (deleted)' would be
|
||||
a race. */
|
||||
#if 0
|
||||
i = close (amaster);
|
||||
if (i != 0)
|
||||
{
|
||||
perror ("close (forkpty ()'s amaster)");
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
#endif
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* Detected commandline may look weird due to a race:
|
||||
Original command:
|
||||
./orphanripper sh -c 'sleep 1&' &
|
||||
Correct output:
|
||||
[1] 29610
|
||||
./orphanripper: Killed -9 orphan PID 29612 (PGID 29611): sleep 1
|
||||
Raced output (sh(1) child still did not update its argv[]):
|
||||
[1] 29613
|
||||
./orphanripper: Killed -9 orphan PID 29615 (PGID 29614): sh -c sleep 1&
|
||||
We could delay a bit before ripping the children. */
|
||||
static const char *read_cmdline (pid_t pid)
|
||||
{
|
||||
char cmdline_fname[32];
|
||||
static char cmdline[LINE_MAX];
|
||||
int fd;
|
||||
ssize_t got;
|
||||
char *s;
|
||||
|
||||
if (snprintf (cmdline_fname, sizeof cmdline_fname, "/proc/%d/cmdline",
|
||||
(int) pid) < 0)
|
||||
return NULL;
|
||||
fd = open (cmdline_fname, O_RDONLY);
|
||||
if (fd == -1)
|
||||
{
|
||||
/* It may have already exited - ENOENT. */
|
||||
#if 0
|
||||
fprintf (stderr, "%s: open (\"%s\"): %m\n", progname, cmdline_fname);
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
got = read (fd, cmdline, sizeof (cmdline) - 1);
|
||||
if (got == -1)
|
||||
fprintf (stderr, "%s: read (\"%s\"): %m\n", progname,
|
||||
cmdline_fname);
|
||||
if (close (fd) != 0)
|
||||
fprintf (stderr, "%s: close (\"%s\"): %m\n", progname,
|
||||
cmdline_fname);
|
||||
if (got < 0)
|
||||
return NULL;
|
||||
/* Convert '\0' argument delimiters to spaces. */
|
||||
for (s = cmdline; s < cmdline + got; s++)
|
||||
if (!*s)
|
||||
*s = ' ';
|
||||
/* Trim the trailing spaces (typically single '\0'->' '). */
|
||||
while (s > cmdline && isspace (s[-1]))
|
||||
s--;
|
||||
*s = 0;
|
||||
return cmdline;
|
||||
}
|
||||
|
||||
static int dir_scan (const char *dirname,
|
||||
int (*callback) (struct dirent *dirent, const char *pathname))
|
||||
{
|
||||
DIR *dir;
|
||||
struct dirent *dirent;
|
||||
int rc = 0;
|
||||
|
||||
dir = opendir (dirname);
|
||||
if (dir == NULL)
|
||||
{
|
||||
if (errno == EACCES || errno == ENOENT)
|
||||
return rc;
|
||||
fprintf (stderr, "%s: opendir (\"%s\"): %m\n", progname, dirname);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
while ((errno = 0, dirent = readdir (dir)))
|
||||
{
|
||||
char pathname[LINE_MAX];
|
||||
int pathname_len;
|
||||
|
||||
pathname_len = snprintf (pathname, sizeof pathname, "%s/%s",
|
||||
dirname, dirent->d_name);
|
||||
if (pathname_len <= 0 || pathname_len >= (int) sizeof pathname)
|
||||
{
|
||||
fprintf (stderr, "entry file name too long: `%s' / `%s'\n",
|
||||
dirname, dirent->d_name);
|
||||
continue;
|
||||
}
|
||||
/* RHEL-4.5 on s390x never fills in D_TYPE. */
|
||||
if (dirent->d_type == DT_UNKNOWN)
|
||||
{
|
||||
struct stat statbuf;
|
||||
int i;
|
||||
|
||||
/* We are not interested in the /proc/PID/fd/ links targets. */
|
||||
i = lstat (pathname, &statbuf);
|
||||
if (i == -1)
|
||||
{
|
||||
if (errno == EACCES || errno == ENOENT)
|
||||
continue;
|
||||
fprintf (stderr, "%s: stat (\"%s\"): %m\n", progname, pathname);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
if (S_ISDIR (statbuf.st_mode))
|
||||
dirent->d_type = DT_DIR;
|
||||
if (S_ISLNK (statbuf.st_mode))
|
||||
dirent->d_type = DT_LNK;
|
||||
/* No other D_TYPE types used in this code. */
|
||||
}
|
||||
rc = (*callback) (dirent, pathname);
|
||||
if (rc != 0)
|
||||
{
|
||||
errno = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (errno != 0)
|
||||
{
|
||||
fprintf (stderr, "%s: readdir (\"%s\"): %m\n", progname, dirname);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
if (closedir (dir) != 0)
|
||||
{
|
||||
fprintf (stderr, "%s: closedir (\"%s\"): %m\n", progname, dirname);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int fd_fs_scan (pid_t pid, int (*func) (pid_t pid, const char *link))
|
||||
{
|
||||
char dirname[64];
|
||||
|
||||
if (snprintf (dirname, sizeof dirname, "/proc/%d/fd", (int) pid) < 0)
|
||||
{
|
||||
perror ("snprintf(3)");
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
int callback (struct dirent *dirent, const char *pathname)
|
||||
{
|
||||
char buf[LINE_MAX];
|
||||
ssize_t buf_len;
|
||||
|
||||
if ((dirent->d_type != DT_DIR && dirent->d_type != DT_LNK)
|
||||
|| (dirent->d_type == DT_DIR && strcmp (dirent->d_name, ".") != 0
|
||||
&& strcmp (dirent->d_name, "..") != 0)
|
||||
|| (dirent->d_type == DT_LNK && strspn (dirent->d_name, "0123456789")
|
||||
!= strlen (dirent->d_name)))
|
||||
{
|
||||
fprintf (stderr, "Unexpected entry \"%s\" (d_type %u)"
|
||||
" on readdir (\"%s\"): %m\n",
|
||||
dirent->d_name, (unsigned) dirent->d_type, dirname);
|
||||
return 0;
|
||||
}
|
||||
if (dirent->d_type == DT_DIR)
|
||||
return 0;
|
||||
buf_len = readlink (pathname, buf, sizeof buf - 1);
|
||||
if (buf_len <= 0 || buf_len >= (ssize_t) sizeof buf - 1)
|
||||
{
|
||||
if (errno != ENOENT && errno != EACCES)
|
||||
fprintf (stderr, "Error reading link \"%s\": %m\n", pathname);
|
||||
return 0;
|
||||
}
|
||||
buf[buf_len] = 0;
|
||||
return (*func) (pid, buf);
|
||||
}
|
||||
|
||||
return dir_scan (dirname, callback);
|
||||
}
|
||||
|
||||
static void pid_fs_scan (void (*func) (pid_t pid, void *data), void *data)
|
||||
{
|
||||
int callback (struct dirent *dirent, const char *pathname)
|
||||
{
|
||||
if (dirent->d_type != DT_DIR
|
||||
|| strspn (dirent->d_name, "0123456789") != strlen (dirent->d_name))
|
||||
return 0;
|
||||
(*func) (atoi (dirent->d_name), data);
|
||||
return 0;
|
||||
}
|
||||
|
||||
dir_scan ("/proc", callback);
|
||||
}
|
||||
|
||||
static int rip_check_ptyname (pid_t pid, const char *link)
|
||||
{
|
||||
assert (pid != getpid ());
|
||||
|
||||
return strcmp (link, childptyname) == 0;
|
||||
}
|
||||
|
||||
struct pid
|
||||
{
|
||||
struct pid *next;
|
||||
pid_t pid;
|
||||
};
|
||||
static struct pid *pid_list;
|
||||
|
||||
static int pid_found (pid_t pid)
|
||||
{
|
||||
struct pid *entry;
|
||||
|
||||
for (entry = pid_list; entry != NULL; entry = entry->next)
|
||||
if (entry->pid == pid)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Single pass is not enough, a (multithreaded) process was seen to survive.
|
||||
Repeated killing of the same process is not enough, zombies can be killed.
|
||||
*/
|
||||
static int cleanup_acted;
|
||||
|
||||
static void pid_record (pid_t pid)
|
||||
{
|
||||
struct pid *entry;
|
||||
|
||||
if (pid_found (pid))
|
||||
return;
|
||||
cleanup_acted = 1;
|
||||
|
||||
entry = malloc (sizeof (*entry));
|
||||
if (entry == NULL)
|
||||
{
|
||||
fprintf (stderr, "%s: malloc: %m\n", progname);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
entry->pid = pid;
|
||||
entry->next = pid_list;
|
||||
pid_list = entry;
|
||||
}
|
||||
|
||||
static void pid_forall (void (*func) (pid_t pid))
|
||||
{
|
||||
struct pid *entry;
|
||||
|
||||
for (entry = pid_list; entry != NULL; entry = entry->next)
|
||||
(*func) (entry->pid);
|
||||
}
|
||||
|
||||
/* Returns 0 on failure. */
|
||||
static pid_t pid_get_parent (pid_t pid)
|
||||
{
|
||||
char fname[64];
|
||||
FILE *f;
|
||||
char line[LINE_MAX];
|
||||
pid_t retval = 0;
|
||||
|
||||
if (snprintf (fname, sizeof fname, "/proc/%d/status", (int) pid) < 0)
|
||||
{
|
||||
perror ("snprintf(3)");
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
f = fopen (fname, "r");
|
||||
if (f == NULL)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
while (errno = 0, fgets (line, sizeof line, f) == line)
|
||||
{
|
||||
if (strncmp (line, "PPid:\t", sizeof "PPid:\t" - 1) != 0)
|
||||
continue;
|
||||
retval = atoi (line + sizeof "PPid:\t" - 1);
|
||||
errno = 0;
|
||||
break;
|
||||
}
|
||||
if (errno != 0)
|
||||
{
|
||||
fprintf (stderr, "%s: fgets (\"%s\"): %m\n", progname, fname);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
if (fclose (f) != 0)
|
||||
{
|
||||
fprintf (stderr, "%s: fclose (\"%s\"): %m\n", progname, fname);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
static void killtree (pid_t pid);
|
||||
|
||||
static void killtree_pid_fs_scan (pid_t pid, void *data)
|
||||
{
|
||||
pid_t parent_pid = *(pid_t *) data;
|
||||
|
||||
/* Do not optimize it as we could miss some newly spawned processes.
|
||||
Always traverse all the leaves. */
|
||||
#if 0
|
||||
/* Optimization. */
|
||||
if (pid_found (pid))
|
||||
return;
|
||||
#endif
|
||||
|
||||
if (pid_get_parent (pid) != parent_pid)
|
||||
return;
|
||||
|
||||
killtree (pid);
|
||||
}
|
||||
|
||||
static void killtree (pid_t pid)
|
||||
{
|
||||
pid_record (pid);
|
||||
pid_fs_scan (killtree_pid_fs_scan, &pid);
|
||||
}
|
||||
|
||||
static void rip_pid_fs_scan (pid_t pid, void *data)
|
||||
{
|
||||
pid_t pgid;
|
||||
|
||||
/* Shouldn't happen. */
|
||||
if (pid == getpid ())
|
||||
return;
|
||||
|
||||
/* Check both PGID and the stale file descriptors. */
|
||||
pgid = getpgid (pid);
|
||||
if (pgid == child
|
||||
|| fd_fs_scan (pid, rip_check_ptyname) != 0)
|
||||
killtree (pid);
|
||||
}
|
||||
|
||||
static void killproc (pid_t pid)
|
||||
{
|
||||
const char *cmdline;
|
||||
|
||||
cmdline = read_cmdline (pid);
|
||||
/* Avoid printing the message for already gone processes. */
|
||||
if (kill (pid, 0) != 0 && errno == ESRCH)
|
||||
return;
|
||||
if (cmdline == NULL)
|
||||
cmdline = "<error>";
|
||||
fprintf (stderr, "%s: Killed -9 orphan PID %d: %s\n", progname, (int) pid, cmdline);
|
||||
if (kill (pid, SIGKILL) == 0)
|
||||
cleanup_acted = 1;
|
||||
else if (errno != ESRCH)
|
||||
fprintf (stderr, "%s: kill (%d, SIGKILL): %m\n", progname, (int) pid);
|
||||
/* RHEL-3 kernels cannot SIGKILL a `T (stopped)' process. */
|
||||
kill (pid, SIGCONT);
|
||||
/* Do not waitpid(2) as it cannot be our direct descendant and it gets
|
||||
cleaned up by init(8). */
|
||||
#if 0
|
||||
pid_t pid_got;
|
||||
pid_got = waitpid (pid, NULL, 0);
|
||||
if (pid != pid_got)
|
||||
{
|
||||
fprintf (stderr, "%s: waitpid (%d) != %d: %m\n", progname,
|
||||
(int) pid, (int) pid_got);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void rip (void)
|
||||
{
|
||||
cleanup_acted = 0;
|
||||
do
|
||||
{
|
||||
if (cleanup_acted)
|
||||
usleep (1000000 / 10);
|
||||
cleanup_acted = 0;
|
||||
pid_fs_scan (rip_pid_fs_scan, NULL);
|
||||
pid_forall (killproc);
|
||||
}
|
||||
while (cleanup_acted);
|
||||
}
|
||||
|
||||
int main (int argc, char **argv)
|
||||
{
|
||||
int timeout = 0;
|
||||
int rc;
|
||||
|
||||
progname = *argv++;
|
||||
argc--;
|
||||
|
||||
if (argc < 1 || strcmp (*argv, "-h") == 0
|
||||
|| strcmp (*argv, "--help") == 0)
|
||||
{
|
||||
puts ("Syntax: orphanripper [-t <seconds>] <execvp(3) commandline>");
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
if ((*argv)[0] == '-' && (*argv)[1] == 't')
|
||||
{
|
||||
char *timeout_s = NULL;
|
||||
|
||||
if ((*argv)[2] == 0)
|
||||
timeout_s = *++argv;
|
||||
else if (isdigit ((*argv)[2]))
|
||||
timeout_s = (*argv) + 2;
|
||||
if (timeout_s != NULL)
|
||||
{
|
||||
long l;
|
||||
char *endptr;
|
||||
|
||||
argv++;
|
||||
l = strtol (timeout_s, &endptr, 0);
|
||||
timeout = l;
|
||||
if ((endptr != NULL && *endptr != 0) || timeout < 0 || timeout != l)
|
||||
{
|
||||
fprintf (stderr, "%s: Invalid timeout value: %s\n", progname,
|
||||
timeout_s);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rc = spawn (argv, timeout);
|
||||
rip ();
|
||||
return rc;
|
||||
}
|
234
SOURCES/gdb-physname-pr11734-test.patch
Normal file
234
SOURCES/gdb-physname-pr11734-test.patch
Normal file
@ -0,0 +1,234 @@
|
||||
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-physname-pr11734-test.patch
|
||||
|
||||
;; Fix regressions on C++ names resolving (PR 11734, PR 12273, Keith Seitz).
|
||||
;;=fedoratest
|
||||
|
||||
http://sourceware.org/ml/gdb-patches/2010-12/msg00263.html
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.cp/pr11734-1.cc b/gdb/testsuite/gdb.cp/pr11734-1.cc
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.cp/pr11734-1.cc
|
||||
@@ -0,0 +1,30 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2010 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+ Please email any bugs, comments, and/or additions to this file to:
|
||||
+ bug-gdb@gnu.org */
|
||||
+
|
||||
+#include "pr11734.h"
|
||||
+
|
||||
+int
|
||||
+main ()
|
||||
+{
|
||||
+ pr11734 *p = new pr11734;
|
||||
+ p->foo ();
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
diff --git a/gdb/testsuite/gdb.cp/pr11734-2.cc b/gdb/testsuite/gdb.cp/pr11734-2.cc
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.cp/pr11734-2.cc
|
||||
@@ -0,0 +1,27 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2010 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+ Please email any bugs, comments, and/or additions to this file to:
|
||||
+ bug-gdb@gnu.org */
|
||||
+
|
||||
+#include "pr11734.h"
|
||||
+
|
||||
+void
|
||||
+pr11734::foo(void)
|
||||
+{
|
||||
+}
|
||||
+
|
||||
diff --git a/gdb/testsuite/gdb.cp/pr11734-3.cc b/gdb/testsuite/gdb.cp/pr11734-3.cc
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.cp/pr11734-3.cc
|
||||
@@ -0,0 +1,27 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2010 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+ Please email any bugs, comments, and/or additions to this file to:
|
||||
+ bug-gdb@gnu.org */
|
||||
+
|
||||
+#include "pr11734.h"
|
||||
+
|
||||
+void
|
||||
+pr11734::foo (int a)
|
||||
+{
|
||||
+}
|
||||
+
|
||||
diff --git a/gdb/testsuite/gdb.cp/pr11734-4.cc b/gdb/testsuite/gdb.cp/pr11734-4.cc
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.cp/pr11734-4.cc
|
||||
@@ -0,0 +1,27 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2010 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+ Please email any bugs, comments, and/or additions to this file to:
|
||||
+ bug-gdb@gnu.org */
|
||||
+
|
||||
+#include "pr11734.h"
|
||||
+
|
||||
+void
|
||||
+pr11734::foo (char *a)
|
||||
+{
|
||||
+}
|
||||
+
|
||||
diff --git a/gdb/testsuite/gdb.cp/pr11734.exp b/gdb/testsuite/gdb.cp/pr11734.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.cp/pr11734.exp
|
||||
@@ -0,0 +1,55 @@
|
||||
+# Copyright 2010 Free Software Foundation, Inc.
|
||||
+#
|
||||
+# Contributed by Red Hat, originally written by Keith Seitz.
|
||||
+#
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+# This file is part of the gdb testsuite.
|
||||
+
|
||||
+if { [skip_cplus_tests] } { continue }
|
||||
+
|
||||
+set testfile "pr11734"
|
||||
+set class $testfile
|
||||
+
|
||||
+set srcfiles {}
|
||||
+for {set i 1} {$i < 5} {incr i} {
|
||||
+ lappend srcfiles $testfile-$i.cc
|
||||
+}
|
||||
+
|
||||
+prepare_for_testing pr11734 $testfile $srcfiles {c++ debug}
|
||||
+
|
||||
+if {![runto_main]} {
|
||||
+ perror "couldn't run to breakpoint"
|
||||
+ continue
|
||||
+}
|
||||
+
|
||||
+# An array holding the overload types for the method pr11734::foo. The
|
||||
+# first element is the overloaded method parameter. The second element
|
||||
+# is the expected source file number, e.g. "pr11734-?.cc".
|
||||
+array set tests {
|
||||
+ "char*" 4
|
||||
+ "int" 3
|
||||
+ "" 2
|
||||
+}
|
||||
+
|
||||
+# Test each overload instance twice: once quoted, once unquoted
|
||||
+foreach ovld [array names tests] {
|
||||
+ set method "${class}::foo\($ovld\)"
|
||||
+ set result "Breakpoint (\[0-9\]).*file .*/$class-$tests($ovld).*"
|
||||
+ gdb_test "break $method" $result
|
||||
+ gdb_test "break '$method'" $result
|
||||
+}
|
||||
+
|
||||
+gdb_exit
|
||||
+return 0
|
||||
diff --git a/gdb/testsuite/gdb.cp/pr11734.h b/gdb/testsuite/gdb.cp/pr11734.h
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.cp/pr11734.h
|
||||
@@ -0,0 +1,28 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2010 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+ Please email any bugs, comments, and/or additions to this file to:
|
||||
+ bug-gdb@gnu.org */
|
||||
+
|
||||
+class pr11734
|
||||
+{
|
||||
+ public:
|
||||
+ void foo ();
|
||||
+ void foo (int);
|
||||
+ void foo (char *);
|
||||
+};
|
||||
+
|
103
SOURCES/gdb-physname-pr12273-test.patch
Normal file
103
SOURCES/gdb-physname-pr12273-test.patch
Normal file
@ -0,0 +1,103 @@
|
||||
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-physname-pr12273-test.patch
|
||||
|
||||
;; Fix regressions on C++ names resolving (PR 11734, PR 12273, Keith Seitz).
|
||||
;;=fedoratest
|
||||
|
||||
http://sourceware.org/ml/gdb-patches/2010-12/msg00264.html
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.cp/pr12273.cc b/gdb/testsuite/gdb.cp/pr12273.cc
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.cp/pr12273.cc
|
||||
@@ -0,0 +1,37 @@
|
||||
+/* This test case is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2010 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+template <typename T>
|
||||
+class GDB
|
||||
+{
|
||||
+ public:
|
||||
+ static int simple (void) { return 0; }
|
||||
+ static int harder (T a) { return 1; }
|
||||
+ template <typename X>
|
||||
+ static X even_harder (T a) { return static_cast<X> (a); }
|
||||
+ int operator == (GDB const& other)
|
||||
+ { return 1; }
|
||||
+};
|
||||
+
|
||||
+int main(int argc, char **argv)
|
||||
+{
|
||||
+ GDB<int> a, b;
|
||||
+ if (a == b)
|
||||
+ return GDB<char>::harder('a') + GDB<int>::harder(3)
|
||||
+ + GDB<char>::even_harder<int> ('a');
|
||||
+ return GDB<int>::simple ();
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.cp/pr12273.exp b/gdb/testsuite/gdb.cp/pr12273.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.cp/pr12273.exp
|
||||
@@ -0,0 +1,46 @@
|
||||
+# Copyright 2010 Free Software Foundation, Inc.
|
||||
+#
|
||||
+# Contributed by Red Hat, originally written by Keith Seitz.
|
||||
+#
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+# This file is part of the gdb testsuite.
|
||||
+
|
||||
+if {[skip_cplus_tests]} { continue }
|
||||
+
|
||||
+set testfile "pr12273"
|
||||
+# Do NOT compile with debug flag.
|
||||
+prepare_for_testing pr12273 $testfile $testfile.cc {c++}
|
||||
+
|
||||
+gdb_test_no_output "set language c++"
|
||||
+
|
||||
+# A list of minimal symbol names to check.
|
||||
+# Note that GDB<char>::even_harder<int>(char) is quoted and includes
|
||||
+# the return type. This is necessary because this is the demangled name
|
||||
+# of the minimal symbol.
|
||||
+set min_syms [list \
|
||||
+ "GDB<int>::operator ==" \
|
||||
+ "GDB<int>::operator==(GDB<int> const&)" \
|
||||
+ "GDB<char>::harder(char)" \
|
||||
+ "GDB<int>::harder(int)" \
|
||||
+ {"int GDB<char>::even_harder<int>(char)"} \
|
||||
+ "GDB<int>::simple()"]
|
||||
+
|
||||
+foreach sym $min_syms {
|
||||
+ if {[gdb_breakpoint $sym]} {
|
||||
+ pass "setting breakpoint at $sym"
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+gdb_exit
|
303
SOURCES/gdb-ppc-power7-test.patch
Normal file
303
SOURCES/gdb-ppc-power7-test.patch
Normal file
@ -0,0 +1,303 @@
|
||||
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-ppc-power7-test.patch
|
||||
|
||||
;; Test power7 ppc disassembly.
|
||||
;;=fedoratest
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.arch/powerpc-power7rh.exp b/gdb/testsuite/gdb.arch/powerpc-power7rh.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.arch/powerpc-power7rh.exp
|
||||
@@ -0,0 +1,178 @@
|
||||
+# Copyright 2009 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 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 PowerPC Power7 instructions disassembly.
|
||||
+
|
||||
+if {![istarget "powerpc*-*-*"]} then {
|
||||
+ verbose "Skipping PowerPC Power7 instructions disassembly."
|
||||
+ return
|
||||
+}
|
||||
+
|
||||
+set testfile "powerpc-power7rh"
|
||||
+set srcfile ${testfile}.s
|
||||
+set objfile [standard_output_file ${testfile}.o]
|
||||
+
|
||||
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${objfile}" object {debug}] != "" } {
|
||||
+ untested "PowerPC Power7 instructions disassembly"
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+
|
||||
+gdb_exit
|
||||
+gdb_start
|
||||
+gdb_reinitialize_dir $srcdir/$subdir
|
||||
+gdb_load ${objfile}
|
||||
+
|
||||
+
|
||||
+# Disassemble the function.
|
||||
+
|
||||
+set test "disass func"
|
||||
+gdb_test_multiple $test $test {
|
||||
+ -re "\r\nDump of assembler code for function func:(\r\n.*\r\n)End of assembler dump.\r\n$gdb_prompt $" {
|
||||
+ set func $expect_out(1,string)
|
||||
+ pass $test
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+proc instr_to_patt {offset instr} {
|
||||
+ # 0x0000000000000018 <func+24>: stxvd2x vs43,r4,r5
|
||||
+ return ".*\r\n\[ \t\]*[string map {0x 0x0*} $offset] <(func)?\\+?\[0-9\]*>:\[ \t\]*[string map [list { } "\[ \t\]+" . {\.}] $instr]\[ \t\]*\r\n.*"
|
||||
+}
|
||||
+
|
||||
+# KFAIL strings would not exist if -Many would print the same as -Mpower7.
|
||||
+# That means the power7 form should be the preferred one.
|
||||
+# http://sourceware.org/ml/gdb-patches/2009-03/threads.html#00020
|
||||
+
|
||||
+proc func_check {offset instr {kfail ""}} {
|
||||
+ global func
|
||||
+
|
||||
+ set test "Found $offset: $instr"
|
||||
+ if [regexp -nocase -line [instr_to_patt $offset $instr] $func] {
|
||||
+ pass $test
|
||||
+ } elseif {$kfail != "" && [regexp -nocase -line [instr_to_patt $offset $kfail] $func]} {
|
||||
+ kfail gdb/NNNN $test
|
||||
+ } else {
|
||||
+ fail $test
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+func_check 0x0 "lxvd2x vs3,r4,r5"
|
||||
+# [PATCH] Remove support for POWER7 VSX load/store with update instructions
|
||||
+# http://sourceware.org/ml/binutils/2009-09/msg00680.html
|
||||
+# http://sourceware.org/ml/binutils-cvs/2009-09/msg00331.html
|
||||
+func_check 0x4 "lxvb16x vs3,r4,r5"
|
||||
+func_check 0x8 "lxvd2x vs43,r4,r5"
|
||||
+func_check 0xc "lxvb16x vs43,r4,r5"
|
||||
+func_check 0x10 "stxvd2x vs3,r4,r5"
|
||||
+func_check 0x14 "stxvb16x vs3,r4,r5"
|
||||
+func_check 0x18 "stxvd2x vs43,r4,r5"
|
||||
+func_check 0x1c "stxvb16x vs43,r4,r5"
|
||||
+func_check 0x20 "xxmrghd vs3,vs4,vs5"
|
||||
+func_check 0x24 "xxmrghd vs43,vs44,vs45"
|
||||
+func_check 0x28 "xxmrgld vs3,vs4,vs5"
|
||||
+func_check 0x2c "xxmrgld vs43,vs44,vs45"
|
||||
+func_check 0x30 "xxmrghd vs3,vs4,vs5"
|
||||
+func_check 0x34 "xxmrghd vs43,vs44,vs45"
|
||||
+func_check 0x38 "xxmrgld vs3,vs4,vs5"
|
||||
+func_check 0x3c "xxmrgld vs43,vs44,vs45"
|
||||
+func_check 0x40 "xxpermdi vs3,vs4,vs5,1"
|
||||
+func_check 0x44 "xxpermdi vs43,vs44,vs45,1"
|
||||
+func_check 0x48 "xxpermdi vs3,vs4,vs5,2"
|
||||
+func_check 0x4c "xxpermdi vs43,vs44,vs45,2"
|
||||
+func_check 0x50 "xvmovdp vs3,vs4"
|
||||
+func_check 0x54 "xvmovdp vs43,vs44"
|
||||
+func_check 0x58 "xvmovdp vs3,vs4"
|
||||
+func_check 0x5c "xvmovdp vs43,vs44"
|
||||
+func_check 0x60 "xvcpsgndp vs3,vs4,vs5"
|
||||
+func_check 0x64 "xvcpsgndp vs43,vs44,vs45"
|
||||
+func_check 0x68 "wait"
|
||||
+func_check 0x6c "wait"
|
||||
+func_check 0x70 "waitrsv"
|
||||
+func_check 0x74 "waitrsv"
|
||||
+func_check 0x78 "waitimpl"
|
||||
+func_check 0x7c "waitimpl"
|
||||
+func_check 0x80 "doze"
|
||||
+func_check 0x84 "nap"
|
||||
+func_check 0x88 "sleep"
|
||||
+func_check 0x8c "rvwinkle"
|
||||
+func_check 0x90 "prtyw r3,r4"
|
||||
+func_check 0x94 "prtyd r13,r14"
|
||||
+func_check 0x98 "mfcfar r10" "mfspr r10,28"
|
||||
+func_check 0x9c "mtcfar r11" "mtspr 28,r11"
|
||||
+func_check 0xa0 "cmpb r3,r4,r5"
|
||||
+func_check 0xa4 "lwzcix r10,r11,r12"
|
||||
+func_check 0xa8 "dadd f16,f17,f18"
|
||||
+func_check 0xac "daddq f20,f22,f24"
|
||||
+func_check 0xb0 "dss 3"
|
||||
+func_check 0xb4 "dssall"
|
||||
+func_check 0xb8 "dst r5,r4,1"
|
||||
+func_check 0xbc "dstt r8,r7,0"
|
||||
+func_check 0xc0 "dstst r5,r6,3"
|
||||
+func_check 0xc4 "dststt r4,r5,2"
|
||||
+func_check 0xc8 "divwe r10,r11,r12"
|
||||
+func_check 0xcc "divwe. r11,r12,r13"
|
||||
+func_check 0xd0 "divweo r12,r13,r14"
|
||||
+func_check 0xd4 "divweo. r13,r14,r15"
|
||||
+func_check 0xd8 "divweu r10,r11,r12"
|
||||
+func_check 0xdc "divweu. r11,r12,r13"
|
||||
+func_check 0xe0 "divweuo r12,r13,r14"
|
||||
+func_check 0xe4 "divweuo. r13,r14,r15"
|
||||
+func_check 0xe8 "bpermd r7,r17,r27"
|
||||
+func_check 0xec "popcntw r10,r20"
|
||||
+func_check 0xf0 "popcntd r10,r20"
|
||||
+func_check 0xf4 "ldbrx r20,r21,r22"
|
||||
+func_check 0xf8 "stdbrx r20,r21,r22"
|
||||
+func_check 0xfc "lfiwzx f10,0,r10"
|
||||
+func_check 0x100 "lfiwzx f10,r9,r10"
|
||||
+func_check 0x104 "fcfids f4,f5"
|
||||
+func_check 0x108 "fcfids. f4,f5"
|
||||
+func_check 0x10c "fcfidus f4,f5"
|
||||
+func_check 0x110 "fcfidus. f4,f5"
|
||||
+func_check 0x114 "fctiwu f4,f5"
|
||||
+func_check 0x118 "fctiwu. f4,f5"
|
||||
+func_check 0x11c "fctiwuz f4,f5"
|
||||
+func_check 0x120 "fctiwuz. f4,f5"
|
||||
+func_check 0x124 "fctidu f4,f5"
|
||||
+func_check 0x128 "fctidu. f4,f5"
|
||||
+func_check 0x12c "fctiduz f4,f5"
|
||||
+func_check 0x130 "fctiduz. f4,f5"
|
||||
+func_check 0x134 "fcfidu f4,f5"
|
||||
+func_check 0x138 "fcfidu. f4,f5"
|
||||
+func_check 0x13c "ftdiv cr0,f10,f11"
|
||||
+func_check 0x140 "ftdiv cr7,f10,f11"
|
||||
+func_check 0x144 "ftsqrt cr0,f10"
|
||||
+func_check 0x148 "ftsqrt cr7,f10"
|
||||
+func_check 0x14c "dcbtt r8,r9" "dcbt 16,r8,r9"
|
||||
+func_check 0x150 "dcbtstt r8,r9" "dcbtst 16,r8,r9"
|
||||
+func_check 0x154 "dcffix f10,f12"
|
||||
+func_check 0x158 "dcffix. f20,f22"
|
||||
+func_check 0x15c "lbarx r10,r11,r12"
|
||||
+func_check 0x160 "lbarx r10,r11,r12"
|
||||
+func_check 0x164 "lbarx r10,r11,r12,1"
|
||||
+func_check 0x168 "lharx r20,r21,r22"
|
||||
+func_check 0x16c "lharx r20,r21,r22"
|
||||
+func_check 0x170 "lharx r20,r21,r22,1"
|
||||
+func_check 0x174 "stbcx. r10,r11,r12"
|
||||
+func_check 0x178 "sthcx. r10,r11,r12"
|
||||
+func_check 0x17c "fre f14,f15"
|
||||
+func_check 0x180 "fre. f14,f15"
|
||||
+func_check 0x184 "fres f14,f15"
|
||||
+func_check 0x188 "fres. f14,f15"
|
||||
+func_check 0x18c "frsqrte f14,f15"
|
||||
+func_check 0x190 "frsqrte. f14,f15"
|
||||
+func_check 0x194 "frsqrtes f14,f15"
|
||||
+func_check 0x198 "frsqrtes. f14,f15"
|
||||
+func_check 0x19c "isel r2,r3,r4,28"
|
||||
diff --git a/gdb/testsuite/gdb.arch/powerpc-power7rh.s b/gdb/testsuite/gdb.arch/powerpc-power7rh.s
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.arch/powerpc-power7rh.s
|
||||
@@ -0,0 +1,107 @@
|
||||
+ .text
|
||||
+ .globl func
|
||||
+func:
|
||||
+ .long 0x7c642e98 /* 0: lxvd2x vs3,r4,r5 */
|
||||
+ .long 0x7c642ed8 /* 4: lxvd2ux vs3,r4,r5 */
|
||||
+ .long 0x7d642e99 /* 8: lxvd2x vs43,r4,r5 */
|
||||
+ .long 0x7d642ed9 /* c: lxvd2ux vs43,r4,r5 */
|
||||
+ .long 0x7c642f98 /* 10: stxvd2x vs3,r4,r5 */
|
||||
+ .long 0x7c642fd8 /* 14: stxvd2ux vs3,r4,r5 */
|
||||
+ .long 0x7d642f99 /* 18: stxvd2x vs43,r4,r5 */
|
||||
+ .long 0x7d642fd9 /* 1c: stxvd2ux vs43,r4,r5 */
|
||||
+ .long 0xf0642850 /* 20: xxmrghd vs3,vs4,vs5 */
|
||||
+ .long 0xf16c6857 /* 24: xxmrghd vs43,vs44,vs45 */
|
||||
+ .long 0xf0642b50 /* 28: xxmrgld vs3,vs4,vs5 */
|
||||
+ .long 0xf16c6b57 /* 2c: xxmrgld vs43,vs44,vs45 */
|
||||
+ .long 0xf0642850 /* 30: xxmrghd vs3,vs4,vs5 */
|
||||
+ .long 0xf16c6857 /* 34: xxmrghd vs43,vs44,vs45 */
|
||||
+ .long 0xf0642b50 /* 38: xxmrgld vs3,vs4,vs5 */
|
||||
+ .long 0xf16c6b57 /* 3c: xxmrgld vs43,vs44,vs45 */
|
||||
+ .long 0xf0642950 /* 40: xxpermdi vs3,vs4,vs5,1 */
|
||||
+ .long 0xf16c6957 /* 44: xxpermdi vs43,vs44,vs45,1 */
|
||||
+ .long 0xf0642a50 /* 48: xxpermdi vs3,vs4,vs5,2 */
|
||||
+ .long 0xf16c6a57 /* 4c: xxpermdi vs43,vs44,vs45,2 */
|
||||
+ .long 0xf0642780 /* 50: xvmovdp vs3,vs4 */
|
||||
+ .long 0xf16c6787 /* 54: xvmovdp vs43,vs44 */
|
||||
+ .long 0xf0642780 /* 58: xvmovdp vs3,vs4 */
|
||||
+ .long 0xf16c6787 /* 5c: xvmovdp vs43,vs44 */
|
||||
+ .long 0xf0642f80 /* 60: xvcpsgndp vs3,vs4,vs5 */
|
||||
+ .long 0xf16c6f87 /* 64: xvcpsgndp vs43,vs44,vs45 */
|
||||
+ .long 0x7c00007c /* 68: wait */
|
||||
+ .long 0x7c00007c /* 6c: wait */
|
||||
+ .long 0x7c20007c /* 70: waitrsv */
|
||||
+ .long 0x7c20007c /* 74: waitrsv */
|
||||
+ .long 0x7c40007c /* 78: waitimpl */
|
||||
+ .long 0x7c40007c /* 7c: waitimpl */
|
||||
+ .long 0x4c000324 /* 80: doze */
|
||||
+ .long 0x4c000364 /* 84: nap */
|
||||
+ .long 0x4c0003a4 /* 88: sleep */
|
||||
+ .long 0x4c0003e4 /* 8c: rvwinkle */
|
||||
+ .long 0x7c830134 /* 90: prtyw r3,r4 */
|
||||
+ .long 0x7dcd0174 /* 94: prtyd r13,r14 */
|
||||
+ .long 0x7d5c02a6 /* 98: mfcfar r10 */
|
||||
+ .long 0x7d7c03a6 /* 9c: mtcfar r11 */
|
||||
+ .long 0x7c832bf8 /* a0: cmpb r3,r4,r5 */
|
||||
+ .long 0x7d4b662a /* a4: lwzcix r10,r11,r12 */
|
||||
+ .long 0xee119004 /* a8: dadd f16,f17,f18 */
|
||||
+ .long 0xfe96c004 /* ac: daddq f20,f22,f24 */
|
||||
+ .long 0x7c60066c /* b0: dss 3 */
|
||||
+ .long 0x7e00066c /* b4: dssall */
|
||||
+ .long 0x7c2522ac /* b8: dst r5,r4,1 */
|
||||
+ .long 0x7e083aac /* bc: dstt r8,r7,0 */
|
||||
+ .long 0x7c6532ec /* c0: dstst r5,r6,3 */
|
||||
+ .long 0x7e442aec /* c4: dststt r4,r5,2 */
|
||||
+ .long 0x7d4b6356 /* c8: divwe r10,r11,r12 */
|
||||
+ .long 0x7d6c6b57 /* cc: divwe. r11,r12,r13 */
|
||||
+ .long 0x7d8d7756 /* d0: divweo r12,r13,r14 */
|
||||
+ .long 0x7dae7f57 /* d4: divweo. r13,r14,r15 */
|
||||
+ .long 0x7d4b6316 /* d8: divweu r10,r11,r12 */
|
||||
+ .long 0x7d6c6b17 /* dc: divweu. r11,r12,r13 */
|
||||
+ .long 0x7d8d7716 /* e0: divweuo r12,r13,r14 */
|
||||
+ .long 0x7dae7f17 /* e4: divweuo. r13,r14,r15 */
|
||||
+ .long 0x7e27d9f8 /* e8: bpermd r7,r17,r27 */
|
||||
+ .long 0x7e8a02f4 /* ec: popcntw r10,r20 */
|
||||
+ .long 0x7e8a03f4 /* f0: popcntd r10,r20 */
|
||||
+ .long 0x7e95b428 /* f4: ldbrx r20,r21,r22 */
|
||||
+ .long 0x7e95b528 /* f8: stdbrx r20,r21,r22 */
|
||||
+ .long 0x7d4056ee /* fc: lfiwzx f10,0,r10 */
|
||||
+ .long 0x7d4956ee /* 100: lfiwzx f10,r9,r10 */
|
||||
+ .long 0xec802e9c /* 104: fcfids f4,f5 */
|
||||
+ .long 0xec802e9d /* 108: fcfids. f4,f5 */
|
||||
+ .long 0xec802f9c /* 10c: fcfidus f4,f5 */
|
||||
+ .long 0xec802f9d /* 110: fcfidus. f4,f5 */
|
||||
+ .long 0xfc80291c /* 114: fctiwu f4,f5 */
|
||||
+ .long 0xfc80291d /* 118: fctiwu. f4,f5 */
|
||||
+ .long 0xfc80291e /* 11c: fctiwuz f4,f5 */
|
||||
+ .long 0xfc80291f /* 120: fctiwuz. f4,f5 */
|
||||
+ .long 0xfc802f5c /* 124: fctidu f4,f5 */
|
||||
+ .long 0xfc802f5d /* 128: fctidu. f4,f5 */
|
||||
+ .long 0xfc802f5e /* 12c: fctiduz f4,f5 */
|
||||
+ .long 0xfc802f5f /* 130: fctiduz. f4,f5 */
|
||||
+ .long 0xfc802f9c /* 134: fcfidu f4,f5 */
|
||||
+ .long 0xfc802f9d /* 138: fcfidu. f4,f5 */
|
||||
+ .long 0xfc0a5900 /* 13c: ftdiv cr0,f10,f11 */
|
||||
+ .long 0xff8a5900 /* 140: ftdiv cr7,f10,f11 */
|
||||
+ .long 0xfc005140 /* 144: ftsqrt cr0,f10 */
|
||||
+ .long 0xff805140 /* 148: ftsqrt cr7,f10 */
|
||||
+ .long 0x7e084a2c /* 14c: dcbtt r8,r9 */
|
||||
+ .long 0x7e0849ec /* 150: dcbtstt r8,r9 */
|
||||
+ .long 0xed406644 /* 154: dcffix f10,f12 */
|
||||
+ .long 0xee80b645 /* 158: dcffix. f20,f22 */
|
||||
+ .long 0x7d4b6068 /* 15c: lbarx r10,r11,r12 */
|
||||
+ .long 0x7d4b6068 /* 160: lbarx r10,r11,r12 */
|
||||
+ .long 0x7d4b6069 /* 164: lbarx r10,r11,r12,1 */
|
||||
+ .long 0x7e95b0e8 /* 168: lharx r20,r21,r22 */
|
||||
+ .long 0x7e95b0e8 /* 16c: lharx r20,r21,r22 */
|
||||
+ .long 0x7e95b0e9 /* 170: lharx r20,r21,r22,1 */
|
||||
+ .long 0x7d4b656d /* 174: stbcx. r10,r11,r12 */
|
||||
+ .long 0x7d4b65ad /* 178: sthcx. r10,r11,r12 */
|
||||
+ .long 0xfdc07830 /* 17c: fre f14,f15 */
|
||||
+ .long 0xfdc07831 /* 180: fre. f14,f15 */
|
||||
+ .long 0xedc07830 /* 184: fres f14,f15 */
|
||||
+ .long 0xedc07831 /* 188: fres. f14,f15 */
|
||||
+ .long 0xfdc07834 /* 18c: frsqrte f14,f15 */
|
||||
+ .long 0xfdc07835 /* 190: frsqrte. f14,f15 */
|
||||
+ .long 0xedc07834 /* 194: frsqrtes f14,f15 */
|
||||
+ .long 0xedc07835 /* 198: frsqrtes. f14,f15 */
|
||||
+ .long 0x7c43271e /* 19c: isel r2,r3,r4,28 */
|
241
SOURCES/gdb-python-gil.patch
Normal file
241
SOURCES/gdb-python-gil.patch
Normal file
@ -0,0 +1,241 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Fedora GDB patches <invalid@email.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-python-gil.patch
|
||||
|
||||
;; Fix Python GIL with gdb.execute("continue") (Phil Muldoon, BZ 1116957).
|
||||
;;=push
|
||||
|
||||
diff --git a/gdb/doc/python.texi b/gdb/doc/python.texi
|
||||
--- a/gdb/doc/python.texi
|
||||
+++ b/gdb/doc/python.texi
|
||||
@@ -232,6 +232,14 @@ returned as a string. The default is @code{False}, in which case the
|
||||
return value is @code{None}. If @var{to_string} is @code{True}, the
|
||||
@value{GDBN} virtual terminal will be temporarily set to unlimited width
|
||||
and height, and its pagination will be disabled; @pxref{Screen Size}.
|
||||
+
|
||||
+The @var{release_gil} flag specifies whether @value{GDBN} ought to
|
||||
+release the Python GIL before executing the command. This is useful
|
||||
+in multi-threaded Python programs where by default the Python
|
||||
+interpreter will acquire the GIL and lock other threads from
|
||||
+executing. After the command has completed executing in @value{GDBN}
|
||||
+the Python GIL is reacquired. This flag must be a boolean value. If
|
||||
+omitted, it defaults to @code{False}.
|
||||
@end defun
|
||||
|
||||
@findex gdb.breakpoints
|
||||
diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h
|
||||
--- a/gdb/python/python-internal.h
|
||||
+++ b/gdb/python/python-internal.h
|
||||
@@ -148,6 +148,8 @@ typedef int Py_ssize_t;
|
||||
#define PyGILState_Release(ARG) ((void)(ARG))
|
||||
#define PyEval_InitThreads()
|
||||
#define PyThreadState_Swap(ARG) ((void)(ARG))
|
||||
+#define PyEval_SaveThread() ((void)(ARG))
|
||||
+#define PyEval_RestoreThread(ARG) ((void)(ARG))
|
||||
#define PyEval_ReleaseLock()
|
||||
#endif
|
||||
|
||||
diff --git a/gdb/python/python.c b/gdb/python/python.c
|
||||
--- a/gdb/python/python.c
|
||||
+++ b/gdb/python/python.c
|
||||
@@ -556,12 +556,16 @@ execute_gdb_command (PyObject *self, PyObject *args, PyObject *kw)
|
||||
{
|
||||
const char *arg;
|
||||
PyObject *from_tty_obj = NULL, *to_string_obj = NULL;
|
||||
- int from_tty, to_string;
|
||||
- static const char *keywords[] = { "command", "from_tty", "to_string", NULL };
|
||||
+ int from_tty, to_string, release_gil;
|
||||
+ static const char *keywords[] = {"command", "from_tty", "to_string", "release_gil", NULL };
|
||||
+ PyObject *release_gil_obj = NULL;
|
||||
+ /* Initialize it just to avoid a GCC false warning. */
|
||||
+ PyThreadState *state = NULL;
|
||||
|
||||
- if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "s|O!O!", keywords, &arg,
|
||||
+ if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "s|O!O!O!", keywords, &arg,
|
||||
&PyBool_Type, &from_tty_obj,
|
||||
- &PyBool_Type, &to_string_obj))
|
||||
+ &PyBool_Type, &to_string_obj,
|
||||
+ &PyBool_Type, &release_gil_obj))
|
||||
return NULL;
|
||||
|
||||
from_tty = 0;
|
||||
@@ -582,6 +586,15 @@ execute_gdb_command (PyObject *self, PyObject *args, PyObject *kw)
|
||||
to_string = cmp;
|
||||
}
|
||||
|
||||
+ release_gil = 0;
|
||||
+ if (release_gil_obj)
|
||||
+ {
|
||||
+ int cmp = PyObject_IsTrue (release_gil_obj);
|
||||
+ if (cmp < 0)
|
||||
+ return NULL;
|
||||
+ release_gil = cmp;
|
||||
+ }
|
||||
+
|
||||
std::string to_string_res;
|
||||
|
||||
TRY
|
||||
@@ -602,6 +615,13 @@ execute_gdb_command (PyObject *self, PyObject *args, PyObject *kw)
|
||||
|
||||
counted_command_line lines = read_command_lines_1 (reader, 1, nullptr);
|
||||
|
||||
+ /* In the case of long running GDB commands, allow the user to
|
||||
+ release the Python GIL acquired by Python. Restore the GIL
|
||||
+ after the command has completed before handing back to
|
||||
+ Python. */
|
||||
+ if (release_gil)
|
||||
+ state = PyEval_SaveThread();
|
||||
+
|
||||
scoped_restore save_async = make_scoped_restore (¤t_ui->async, 0);
|
||||
|
||||
scoped_restore save_uiout = make_scoped_restore (¤t_uiout);
|
||||
@@ -617,10 +637,22 @@ execute_gdb_command (PyObject *self, PyObject *args, PyObject *kw)
|
||||
from_tty);
|
||||
else
|
||||
execute_control_commands (lines.get (), from_tty);
|
||||
+
|
||||
+ /* Reacquire the GIL if it was released earlier. */
|
||||
+ if (release_gil)
|
||||
+ PyEval_RestoreThread (state);
|
||||
}
|
||||
CATCH (except, RETURN_MASK_ALL)
|
||||
{
|
||||
- GDB_PY_HANDLE_EXCEPTION (except);
|
||||
+ if (except.reason < 0)
|
||||
+ {
|
||||
+ /* Reacquire the GIL if it was released earlier. */
|
||||
+ if (release_gil)
|
||||
+ PyEval_RestoreThread (state);
|
||||
+
|
||||
+ gdbpy_convert_exception (except);
|
||||
+ return NULL;
|
||||
+ }
|
||||
}
|
||||
END_CATCH
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.python/py-gil-mthread.c b/gdb/testsuite/gdb.python/py-gil-mthread.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.python/py-gil-mthread.c
|
||||
@@ -0,0 +1,13 @@
|
||||
+#include <stdio.h>
|
||||
+#include <unistd.h>
|
||||
+
|
||||
+int
|
||||
+main (void)
|
||||
+{
|
||||
+ int i;
|
||||
+ for (i = 0; i < 10; i++)
|
||||
+ {
|
||||
+ sleep (1); /* break-here */
|
||||
+ printf ("Sleeping %d\n", i);
|
||||
+ }
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.python/py-gil-mthread.exp b/gdb/testsuite/gdb.python/py-gil-mthread.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.python/py-gil-mthread.exp
|
||||
@@ -0,0 +1,69 @@
|
||||
+# Copyright (C) 2014 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+standard_testfile .c .py
|
||||
+set executable $testfile
|
||||
+
|
||||
+if { [prepare_for_testing $testfile.exp $executable $srcfile] } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+# Skip all tests if Python scripting is not enabled.
|
||||
+if { [skip_python_tests] } { continue }
|
||||
+
|
||||
+if ![runto_main] {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+gdb_breakpoint $srcfile:[gdb_get_line_number "break-here"] temporary
|
||||
+gdb_continue_to_breakpoint "break-here" ".* break-here .*"
|
||||
+
|
||||
+set test "response"
|
||||
+set timeout 60
|
||||
+set sleeping_last -1
|
||||
+set hello_last 0
|
||||
+set minimal 5
|
||||
+gdb_test_multiple "python exec (open ('$srcdir/$subdir/$srcfile2').read ())" $test {
|
||||
+ -re "Error: unable to start thread\r\n" {
|
||||
+ fail $test
|
||||
+ # Not $gdb_prompt-synced!
|
||||
+ }
|
||||
+ -re "Sleeping (\[0-9\]+)\r\n" {
|
||||
+ set n $expect_out(1,string)
|
||||
+ if { $sleeping_last + 1 != $n } {
|
||||
+ fail $test
|
||||
+ } else {
|
||||
+ set sleeping_last $n
|
||||
+ if { $sleeping_last >= $minimal && $hello_last >= $minimal } {
|
||||
+ pass $test
|
||||
+ } else {
|
||||
+ exp_continue
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ -re "Hello \\( (\[0-9\]+) \\)\r\n" {
|
||||
+ set n $expect_out(1,string)
|
||||
+ if { $hello_last + 1 != $n } {
|
||||
+ fail $test
|
||||
+ } else {
|
||||
+ set hello_last $n
|
||||
+ if { $sleeping_last >= $minimal && $hello_last >= $minimal } {
|
||||
+ pass $test
|
||||
+ } else {
|
||||
+ exp_continue
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.python/py-gil-mthread.py b/gdb/testsuite/gdb.python/py-gil-mthread.py
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.python/py-gil-mthread.py
|
||||
@@ -0,0 +1,28 @@
|
||||
+try:
|
||||
+ import thread
|
||||
+except:
|
||||
+ import _thread
|
||||
+import time
|
||||
+import gdb
|
||||
+
|
||||
+# Define a function for the thread
|
||||
+def print_thread_hello():
|
||||
+ count = 0
|
||||
+ while count < 10:
|
||||
+ time.sleep(1)
|
||||
+ count += 1
|
||||
+ print ("Hello ( %d )" % count)
|
||||
+
|
||||
+# Create a threads a continue
|
||||
+try:
|
||||
+ thread.start_new_thread (print_thread_hello, ())
|
||||
+ gdb.execute ("continue", release_gil=True)
|
||||
+except:
|
||||
+ try:
|
||||
+ _thread.start_new_thread (print_thread_hello, ())
|
||||
+ gdb.execute ("continue", release_gil=True)
|
||||
+ except:
|
||||
+ print ("Error: unable to start thread")
|
||||
+
|
||||
+while 1:
|
||||
+ pass
|
25
SOURCES/gdb-readline62-ask-more-rh.patch
Normal file
25
SOURCES/gdb-readline62-ask-more-rh.patch
Normal file
@ -0,0 +1,25 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Fedora GDB patches <invalid@email.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-readline62-ask-more-rh.patch
|
||||
|
||||
;; Work around readline-6.2 incompatibility not asking for --more-- (BZ 701131).
|
||||
;;=fedora
|
||||
|
||||
diff --git a/gdb/event-top.c b/gdb/event-top.c
|
||||
--- a/gdb/event-top.c
|
||||
+++ b/gdb/event-top.c
|
||||
@@ -1183,6 +1183,13 @@ gdb_setup_readline (int editing)
|
||||
{
|
||||
struct ui *ui = current_ui;
|
||||
|
||||
+#ifdef NEED_RL_STATE_FEDORA_GDB
|
||||
+ /* 6.2 regression: no longed asks for --more--
|
||||
+ gdb.base/readline-ask.exp
|
||||
+ https://bugzilla.redhat.com/show_bug.cgi?id=701131 */
|
||||
+ RL_SETSTATE (RL_STATE_FEDORA_GDB);
|
||||
+#endif
|
||||
+
|
||||
/* This function is a noop for the sync case. The assumption is
|
||||
that the sync setup is ALL done in gdb_init, and we would only
|
||||
mess it up here. The sync stuff should really go away over
|
@ -0,0 +1,83 @@
|
||||
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-rhbz-818343-set-solib-absolute-prefix-testcase.patch
|
||||
|
||||
;; Testcase for `Setting solib-absolute-prefix breaks vDSO' (BZ 818343).
|
||||
;;=fedoratest
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/set-solib-absolute-prefix.c b/gdb/testsuite/gdb.base/set-solib-absolute-prefix.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/set-solib-absolute-prefix.c
|
||||
@@ -0,0 +1,26 @@
|
||||
+/* Copyright (C) 2012 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This file is part of GDB.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
+
|
||||
+int
|
||||
+main (int argc, char *argv[])
|
||||
+{
|
||||
+ printf ("Hello, World.\n");
|
||||
+ abort ();
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.base/set-solib-absolute-prefix.exp b/gdb/testsuite/gdb.base/set-solib-absolute-prefix.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/set-solib-absolute-prefix.exp
|
||||
@@ -0,0 +1,39 @@
|
||||
+# Copyright 2012 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+set testfile "set-solib-absolute-prefix"
|
||||
+set srcfile ${testfile}.c
|
||||
+
|
||||
+# It is necessary to verify if the binary is 32-bit, so that the system
|
||||
+# call `__kernel_vsyscall' originates from vDSO.
|
||||
+
|
||||
+if { ![is_ilp32_target] } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+if { [prepare_for_testing $testfile.exp $testfile $srcfile] } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+if { ![runto_main] } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+gdb_test "continue" "Program received signal SIGABRT, Aborted.*" \
|
||||
+ "continue until abort"
|
||||
+gdb_test "set solib-absolute-prefix /BOGUS_DIRECT" \
|
||||
+ ".*warning: Unable to find dynamic linker breakpoint function.*" \
|
||||
+ "set solib-absolute-prefix"
|
||||
+gdb_test "bt" "__kernel_vsyscall.*" "backtrace with __kernel_vsyscall"
|
170
SOURCES/gdb-rhbz1007614-memleak-infpy_read_memory-test.patch
Normal file
170
SOURCES/gdb-rhbz1007614-memleak-infpy_read_memory-test.patch
Normal file
@ -0,0 +1,170 @@
|
||||
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-rhbz1007614-memleak-infpy_read_memory-test.patch
|
||||
|
||||
;; Fix 'memory leak in infpy_read_memory()' (RH BZ 1007614)
|
||||
;;=fedoratest
|
||||
|
||||
Original message by Tom Tromey:
|
||||
|
||||
<https://sourceware.org/ml/gdb-patches/2012-03/msg00955.html>
|
||||
Message-ID: <871uoc1va3.fsf@fleche.redhat.com>
|
||||
|
||||
Comment from Sergio Durigan Junior:
|
||||
|
||||
In order to correctly test this patch, I wrote a testcase based on Jan
|
||||
Kratochvil's <gdb/testsuite/gdb.base/gcore-excessive-memory.exp>. The
|
||||
testcase, which can be seen below, tests GDB in order to see if the
|
||||
amount of memory being leaked is minimal, as requested in the bugzilla.
|
||||
It is hard to define what "minimum" is, so I ran the testcase on all
|
||||
supported RHEL architectures and came up with an average.
|
||||
|
||||
commit cc0265cdda9dc7e8665e8bfcf5b4477489daf27c
|
||||
Author: Tom Tromey <tromey@redhat.com>
|
||||
Date: Wed Mar 28 17:38:08 2012 +0000
|
||||
|
||||
* python/py-inferior.c (infpy_read_memory): Remove cleanups and
|
||||
explicitly free 'buffer' on exit paths. Decref 'membuf_object'
|
||||
before returning.
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.python/py-gdb-rhbz1007614-memleak-infpy_read_memory.c b/gdb/testsuite/gdb.python/py-gdb-rhbz1007614-memleak-infpy_read_memory.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.python/py-gdb-rhbz1007614-memleak-infpy_read_memory.c
|
||||
@@ -0,0 +1,27 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2014 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+static struct x
|
||||
+ {
|
||||
+ char unsigned u[4096];
|
||||
+ } x, *px = &x;
|
||||
+
|
||||
+int
|
||||
+main (int argc, char *argv[])
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.python/py-gdb-rhbz1007614-memleak-infpy_read_memory.exp b/gdb/testsuite/gdb.python/py-gdb-rhbz1007614-memleak-infpy_read_memory.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.python/py-gdb-rhbz1007614-memleak-infpy_read_memory.exp
|
||||
@@ -0,0 +1,68 @@
|
||||
+# Copyright 2014 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+set testfile py-gdb-rhbz1007614-memleak-infpy_read_memory
|
||||
+set srcfile ${testfile}.c
|
||||
+set binfile [standard_output_file ${testfile}]
|
||||
+
|
||||
+if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile}] } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+if { [skip_python_tests] } { continue }
|
||||
+
|
||||
+set pid_of_gdb [exp_pid -i [board_info host fileid]]
|
||||
+
|
||||
+proc memory_v_pages_get {} {
|
||||
+ global pid_of_gdb
|
||||
+ 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
|
||||
+}
|
||||
+
|
||||
+if { ![runto_main] } {
|
||||
+ untested $testfile.exp
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+set remote_python_file [remote_download host ${srcdir}/${subdir}/${testfile}.py]
|
||||
+
|
||||
+gdb_test "source ${remote_python_file}" ""
|
||||
+
|
||||
+gdb_test "hello-world" ""
|
||||
+
|
||||
+set kbytes_before [memory_v_pages_get]
|
||||
+verbose -log "kbytes_before = $kbytes_before"
|
||||
+
|
||||
+gdb_test "hello-world" ""
|
||||
+
|
||||
+set kbytes_after [memory_v_pages_get]
|
||||
+verbose -log "kbytes_after = $kbytes_after"
|
||||
+
|
||||
+set kbytes_diff [expr $kbytes_after - $kbytes_before]
|
||||
+verbose -log "kbytes_diff = $kbytes_diff"
|
||||
+
|
||||
+# The value "1000" was calculated by running a few GDB sessions with this
|
||||
+# testcase, and seeing how much (in average) the memory consumption
|
||||
+# increased after the "hello-world" command issued above. The average
|
||||
+# was around 500 bytes, so I chose 1000 as a high estimate.
|
||||
+if { $kbytes_diff > 1000 } {
|
||||
+ fail "there is a memory leak on GDB (RHBZ 1007614)"
|
||||
+} else {
|
||||
+ pass "there is not a memory leak on GDB (RHBZ 1007614)"
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.python/py-gdb-rhbz1007614-memleak-infpy_read_memory.py b/gdb/testsuite/gdb.python/py-gdb-rhbz1007614-memleak-infpy_read_memory.py
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.python/py-gdb-rhbz1007614-memleak-infpy_read_memory.py
|
||||
@@ -0,0 +1,30 @@
|
||||
+# Copyright (C) 2014 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+class HelloWorld (gdb.Command):
|
||||
+ """Greet the whole world."""
|
||||
+
|
||||
+ def __init__ (self):
|
||||
+ super (HelloWorld, self).__init__ ("hello-world",
|
||||
+ gdb.COMMAND_OBSCURE)
|
||||
+
|
||||
+ def invoke (self, arg, from_tty):
|
||||
+ px = gdb.parse_and_eval("px")
|
||||
+ core = gdb.inferiors()[0]
|
||||
+ for i in range(256 * 1024):
|
||||
+ chunk = core.read_memory(px, 4096)
|
||||
+ print "Hello, World!"
|
||||
+
|
||||
+HelloWorld ()
|
@ -0,0 +1,235 @@
|
||||
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-rhbz1084404-ppc64-s390x-wrong-prologue-skip-O2-g-3of3.patch
|
||||
|
||||
;; Fix '[ppc64] and [s390x] wrong prologue skip on -O2 -g code' (Jan
|
||||
;; Kratochvil, RH BZ 1084404).
|
||||
;;=fedoratest
|
||||
|
||||
These testcases have been created by compiling glibc-2.17-78 on
|
||||
RHEL-7.1 s390x/ppc64 boxes, and then taking the "select.o" file
|
||||
present at $builddir/misc/select.o.
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.arch/ppc64-prologue-skip.exp b/gdb/testsuite/gdb.arch/ppc64-prologue-skip.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.arch/ppc64-prologue-skip.exp
|
||||
@@ -0,0 +1,34 @@
|
||||
+# Copyright 2015 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+if { ![istarget powerpc64-*linux-*] || ![is_lp64_target] } {
|
||||
+ verbose "Skipping ppc64-prologue-skip.exp"
|
||||
+ return
|
||||
+}
|
||||
+
|
||||
+set testfile "ppc64-prologue-skip"
|
||||
+set uufile "${srcdir}/${subdir}/${testfile}.o.uu"
|
||||
+set ofile "${srcdir}/${subdir}/${testfile}.o"
|
||||
+
|
||||
+if { [catch "system \"uudecode -o ${ofile} ${uufile}\"" ] != 0 } {
|
||||
+ untested "failed uudecode"
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+gdb_exit
|
||||
+gdb_start
|
||||
+gdb_load $ofile
|
||||
+
|
||||
+gdb_test "break ___newselect_nocancel" "Breakpoint $decimal at 0xc: file ../sysdeps/unix/syscall-template.S, line 81." "breakpoint on ___newselect_nocancel"
|
||||
diff --git a/gdb/testsuite/gdb.arch/ppc64-prologue-skip.o.uu b/gdb/testsuite/gdb.arch/ppc64-prologue-skip.o.uu
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.arch/ppc64-prologue-skip.o.uu
|
||||
@@ -0,0 +1,70 @@
|
||||
+begin 644 ppc64-skip-prologue.o.uu
|
||||
+M?T5,1@("`0`````````````!`!4````!````````````````````````````
|
||||
+M``-(``````!```````!``!0`$8%-B-`L"@``0,(`-#@``(Y$```"3.,`('P(
|
||||
+M`J;X`0`0^"'_D4@```%@````Z`$`@#@A`'!\"`.F3H``(/@A_X%]*`*F^2$`
|
||||
+MD/CA`-#XP0#(^*$`P/B!`+CX80"P2````6````#X80!PZ.$`T.C!`,CHH0#`
|
||||
+MZ($`N.AA`+`X``".1````GP``";X80!X^`$`B.AA`'!(```!8````.DA`)#H
|
||||
+M`0"(Z&$`>'TH`Z9\#_$@."$`@$SC`"!+__]@```````,($``````````O``(
|
||||
+M7U]S96QE8W0```````````````````````````!6``(````Y!`'[#@T``0$!
|
||||
+M`0````$```$N+B]S>7-D97!S+W5N:7@``'-Y<V-A;&PM=&5M<&QA=&4N4P`!
|
||||
+M``````D"```````````#T``!`BT3`@D``0$```"/``(`````"`$`````````
|
||||
+M`````````````````"XN+W-Y<V1E<',O=6YI>"]S>7-C86QL+71E;7!L871E
|
||||
+M+E,`+W)O;W0O9VQI8F,O9VQI8F,M,BXQ-RTW."YE;#<N<W)C+V=L:6)C+3(N
|
||||
+M,3<M8S<U.&$V.#8O;6ES8P!'3E4@05,@,BXR,RXU,BXP+C$`@`$!$0`0!A$!
|
||||
+M$@$#"!L()0@3!0`````````````````L``(`````"```````````````````
|
||||
+M````````V``````````````````````````0``````%Z4@`$>$$!&PP!````
|
||||
+M`#`````8`````````+P`20YP$4%^1`X`009!0@Z``4(107Y2$49_20X`!D$&
|
||||
+M1@``````+G-Y;71A8@`N<W1R=&%B`"YS:'-T<G1A8@`N<F5L82YT97AT`"YD
|
||||
+M871A`"YB<W,`+G)E;&$N;W!D`"YN;W1E+D=.52US=&%C:P`N<F5L82YD96)U
|
||||
+M9U]L:6YE`"YR96QA+F1E8G5G7VEN9F\`+F1E8G5G7V%B8G)E=@`N<F5L82YD
|
||||
+M96)U9U]A<F%N9V5S`"YR96QA+F5H7V9R86UE````````````````````````
|
||||
+M````````````````````````````````````````````````````````````
|
||||
+M`````````"`````!``````````8```````````````````!``````````-@`
|
||||
+M```````````````````$```````````````;````!```````````````````
|
||||
+M```````````*>`````````!(````$@````$`````````"``````````8````
|
||||
+M)@````$``````````P```````````````````1@`````````````````````
|
||||
+M``````````$``````````````"P````(``````````,`````````````````
|
||||
+M``$8```````````````````````````````!```````````````V`````0``
|
||||
+M```````#```````````````````!&``````````0````````````````````
|
||||
+M"```````````````,0````0`````````````````````````````"L``````
|
||||
+M````,````!(````%``````````@`````````&````#L````!````````````
|
||||
+M``````````````````$H```````````````````````````````!````````
|
||||
+M``````!0`````0`````````````````````````````!*`````````!:````
|
||||
+M`````````````````0``````````````2P````0`````````````````````
|
||||
+M````````"O``````````&````!(````(``````````@`````````&````&$`
|
||||
+M```!``````````````````````````````&"`````````),`````````````
|
||||
+M```````!``````````````!<````!``````````````````````````````+
|
||||
+M"`````````!@````$@````H`````````"``````````8````;0````$`````
|
||||
+M`````````````````````````A4`````````%`````````````````````$`
|
||||
+M`````````````(`````!``````````````````````````````(P````````
|
||||
+M`#`````````````````````0``````````````![````!```````````````
|
||||
+M```````````````+:``````````P````$@````T`````````"``````````8
|
||||
+M````E`````$``````````@```````````````````F``````````2```````
|
||||
+M``````````````@``````````````(\````$````````````````````````
|
||||
+M``````N8`````````!@````2````#P`````````(`````````!@````1````
|
||||
+M`P`````````````````````````````"J`````````">````````````````
|
||||
+M`````0```````````````0````(`````````````````````````````"$@`
|
||||
+M```````!L````!,````+``````````@`````````&`````D````#````````
|
||||
+M``````````````````````GX`````````'H````````````````````!````
|
||||
+M`````````````````````````````````````````````P```0``````````
|
||||
+M`````````````````P```P```````````````````````````P``!```````
|
||||
+M`````````````````````P``!0```````````````````````````P``"@``
|
||||
+M`````````````````````````P``#````````````````````````````P``
|
||||
+M"````````````````````````````P``#0``````````````````````````
|
||||
+M`P``#P```````````````````````````P``!P``````````````````````
|
||||
+M```!$@``!0```````````````````-@````*$@```0`````````,````````
|
||||
+M`#`````@$``````````````````````````````P$```````````````````
|
||||
+M``````````!*$`````````````````````````````!E(@``!0``````````
|
||||
+M`````````-@```!S(@``!0```````````````````-@`7U]S96QE8W0`7U]?
|
||||
+M;F5W<V5L96-T7VYO8V%N8V5L`%]?<WES8V%L;%]E<G)O<@!?7VQI8F-?96YA
|
||||
+M8FQE7V%S>6YC8V%N8V5L`%]?;&EB8U]D:7-A8FQE7V%S>6YC8V%N8V5L`%]?
|
||||
+M;&EB8U]S96QE8W0`<V5L96-T```````````````````D````#0````H`````
|
||||
+M``````````````!<````#@````H```````````````````"4````#P````H`
|
||||
+M`````````````````````````0```"8````````````````````(````````
|
||||
+M`#,```````````````````!&`````0```"8````````````````````&````
|
||||
+M!@````$````````````````````,````!P````$````````````````````0
|
||||
+M`````0```"8````````````````````8`````0```"8`````````V```````
|
||||
+M```&````!0````$````````````````````0`````0```"8`````````````
|
||||
+6```````<`````0```!H`````````````
|
||||
+`
|
||||
+end
|
||||
diff --git a/gdb/testsuite/gdb.arch/s390x-prologue-skip.exp b/gdb/testsuite/gdb.arch/s390x-prologue-skip.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.arch/s390x-prologue-skip.exp
|
||||
@@ -0,0 +1,34 @@
|
||||
+# Copyright 2015 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+if { ![istarget s390x-*linux-*] || ![is_lp64_target] } {
|
||||
+ verbose "Skipping s390x-prologue-skip.exp"
|
||||
+ return
|
||||
+}
|
||||
+
|
||||
+set testfile "s390x-prologue-skip"
|
||||
+set uufile "${srcdir}/${subdir}/${testfile}.o.uu"
|
||||
+set ofile "${srcdir}/${subdir}/${testfile}.o"
|
||||
+
|
||||
+if { [catch "system \"uudecode -o ${ofile} ${uufile}\"" ] != 0 } {
|
||||
+ untested "failed uudecode"
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+gdb_exit
|
||||
+gdb_start
|
||||
+gdb_load $ofile
|
||||
+
|
||||
+gdb_test "break select" "Breakpoint $decimal at 0x48: file ../sysdeps/unix/syscall-template.S, line 81." "breakpoint on select"
|
||||
diff --git a/gdb/testsuite/gdb.arch/s390x-prologue-skip.o.uu b/gdb/testsuite/gdb.arch/s390x-prologue-skip.o.uu
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.arch/s390x-prologue-skip.o.uu
|
||||
@@ -0,0 +1,64 @@
|
||||
+begin 644 s390x-prologue-skip.o.uu
|
||||
+M?T5,1@("`0`````````````!`!8````!````````````````````````````
|
||||
+M``+```````!```````!``!(`#^LE\!``).O?\&@`)+D$`.^G^_]@X^#P```D
|
||||
+MP.4`````N00``NLE\+``!`J.N00`TKD$`"#`Y0````"Y!``MZ]_Q"``$I_0`
|
||||
+M"L`0`````+\/$`"G=/_7"HZG2?`!N2$`),"T``````?^````5@`"````.0$!
|
||||
+M^PX-``$!`0$````!```!+BXO<WES9&5P<R]U;FEX``!S>7-C86QL+71E;7!L
|
||||
+M871E+E,``0`````)`@```````````]```0)F$P("``$!````CP`"``````@!
|
||||
+M```````````````````````````N+B]S>7-D97!S+W5N:7@O<WES8V%L;"UT
|
||||
+M96UP;&%T92Y3`"]R;V]T+V=L:6)C+V=L:6)C+3(N,3<M-S@N96PW+G-R8R]G
|
||||
+M;&EB8RTR+C$W+6,W-3AA-C@V+VUI<V,`1TY5($%3(#(N,C,N-3(N,"XQ`(`!
|
||||
+M`1$`$`81`1(!`P@;""4($P4`````````````````+``"``````@`````````
|
||||
+M`````````````````&@`````````````````````````%``````!>E(``7@.
|
||||
+M`1L,#Z`!````````&````!P`````````1`!,CP6.!HT'2`[``@```!`````X
|
||||
+M`````````"```````"YS>6UT86(`+G-T<G1A8@`N<VAS=')T86(`+G)E;&$N
|
||||
+M=&5X=``N9&%T80`N8G-S`"YN;W1E+D=.52US=&%C:P`N<F5L82YD96)U9U]L
|
||||
+M:6YE`"YR96QA+F1E8G5G7VEN9F\`+F1E8G5G7V%B8G)E=@`N<F5L82YD96)U
|
||||
+M9U]A<F%N9V5S`"YR96QA+F5H7V9R86UE````````````````````````````
|
||||
+M````````````````````````````````````````````````````````````
|
||||
+M````````(`````$`````````!@```````````````````$``````````:```
|
||||
+M``````````````````0``````````````!L````$````````````````````
|
||||
+M``````````F``````````&`````0`````0`````````(`````````!@````F
|
||||
+M`````0`````````#````````````````````J```````````````````````
|
||||
+M````````!```````````````+`````@``````````P``````````````````
|
||||
+M`*@```````````````````````````````0``````````````#$````!````
|
||||
+M``````````````````````````"H```````````````````````````````!
|
||||
+M``````````````!&`````0``````````````````````````````J```````
|
||||
+M``!:`````````````````````0``````````````00````0`````````````
|
||||
+M````````````````">``````````&````!`````&``````````@`````````
|
||||
+M&````%<````!``````````````````````````````$"`````````),`````
|
||||
+M```````````````!``````````````!2````!```````````````````````
|
||||
+M```````)^`````````!@````$`````@`````````"``````````8````8P``
|
||||
+M``$``````````````````````````````94`````````%```````````````
|
||||
+M``````$``````````````'8````!``````````````````````````````&P
|
||||
+M`````````#`````````````````````0``````````````!Q````!```````
|
||||
+M```````````````````````*6``````````P````$`````L`````````"```
|
||||
+M```````8````B@````$``````````@```````````````````>``````````
|
||||
+M2`````````````````````@``````````````(4````$````````````````
|
||||
+M``````````````J(`````````#`````0````#0`````````(`````````!@`
|
||||
+M```1`````P`````````````````````````````"*`````````"4````````
|
||||
+M`````````````0```````````````0````(`````````````````````````
|
||||
+M````!T`````````!L````!$````*``````````@`````````&`````D````#
|
||||
+M``````````````````````````````CP`````````(X`````````````````
|
||||
+M```!`````````````````````````````````````````````````P```0``
|
||||
+M`````````````````````````P```P```````````````````````````P``
|
||||
+M!````````````````````````````P``"```````````````````````````
|
||||
+M`P``"@```````````````````````````P``!@``````````````````````
|
||||
+M`````P``"P```````````````````````````P``#0``````````````````
|
||||
+M`````````P``!0`````````````````````````!$```````````````````
|
||||
+M```````````;$``````````````````````````````V$@```0````````!(
|
||||
+M`````````"`````_$`````````````````````````````!7$@```0``````
|
||||
+M``!6`````````!````!I$`````````````````````````````!Y(@```0``
|
||||
+M``````!(`````````"````"'(@```0````````!(`````````"``7U]L:6)C
|
||||
+M7V5N86)L95]A<WEN8V-A;F-E;`!?7VQI8F-?9&ES86)L95]A<WEN8V-A;F-E
|
||||
+M;`!?7W-E;&5C=`!?7VQI8F-?;75L=&EP;&5?=&AR96%D<P!?7W-E;&5C=%]N
|
||||
+M;V-A;F-E;`!?7W-Y<V-A;&Q?97)R;W(`7U]L:6)C7W-E;&5C=`!S96QE8W0`
|
||||
+M````````````'`````H````3``````````(`````````-@````L````3````
|
||||
+M``````(`````````2@````T````3``````````(`````````8@````\````3
|
||||
+M``````````(`````````1@````$````6````````````````````!@````4`
|
||||
+M```$````````````````````#`````8````$````````````````````$```
|
||||
+M``$````6````````````````````&`````$````6`````````&@`````````
|
||||
+M!@````0````$````````````````````$`````$````6````````````````
|
||||
+L````(`````$````%````````````````````/`````$````%`````````$@`
|
||||
+`
|
||||
+end
|
123
SOURCES/gdb-rhbz1149205-catch-syscall-after-fork-test.patch
Normal file
123
SOURCES/gdb-rhbz1149205-catch-syscall-after-fork-test.patch
Normal file
@ -0,0 +1,123 @@
|
||||
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-rhbz1149205-catch-syscall-after-fork-test.patch
|
||||
|
||||
;; Fix '`catch syscall' doesn't work for parent after `fork' is called'
|
||||
;; (Philippe Waroquiers, RH BZ 1149205).
|
||||
;;=fedoratest
|
||||
|
||||
URL: <https://sourceware.org/ml/gdb-patches/2013-05/msg00364.html>
|
||||
Message-ID: <1368136582.30058.7.camel@soleil>
|
||||
|
||||
From: Philippe Waroquiers <philippe dot waroquiers at skynet dot be>
|
||||
To: gdb-patches at sourceware dot org
|
||||
Subject: RFA: fix gdb_assert caused by 'catch signal ...' and fork
|
||||
Date: Thu, 09 May 2013 23:56:22 +0200
|
||||
|
||||
The attached patch fixes a gdb_assert caused by the combination of catch
|
||||
signal and fork:
|
||||
break-catch-sig.c:152: internal-error: signal_catchpoint_remove_location: Assertion `signal_catch_counts[iter] > 0' failed.
|
||||
|
||||
The problem is that the signal_catch_counts is decremented by detach_breakpoints.
|
||||
The fix consists in not detaching breakpoint locations of type bp_loc_other.
|
||||
The patch introduces a new test.
|
||||
|
||||
Comments by Sergio Durigan Junior:
|
||||
|
||||
I addded a specific testcase for this patch, which tests exactly the
|
||||
issue that the customer is facing. This patch does not solve the
|
||||
whole problem of catching a syscall and forking (for more details,
|
||||
see <https://sourceware.org/bugzilla/show_bug.cgi?id=13457>,
|
||||
specifically comment #3), but it solves the issue reported by the
|
||||
customer.
|
||||
|
||||
I also removed the original testcase of this patch, because it
|
||||
relied on "catch signal", which is a command that is not implemented
|
||||
in this version of GDB.
|
||||
|
||||
commit bd9673a4ded96ea5c108601501c8e59003ea1be6
|
||||
Author: Philippe Waroquiers <philippe@sourceware.org>
|
||||
Date: Tue May 21 18:47:05 2013 +0000
|
||||
|
||||
Fix internal error caused by interaction between catch signal and fork
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/gdb-rhbz1149205-catch-syscall-fork.c b/gdb/testsuite/gdb.base/gdb-rhbz1149205-catch-syscall-fork.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/gdb-rhbz1149205-catch-syscall-fork.c
|
||||
@@ -0,0 +1,11 @@
|
||||
+#include <stdio.h>
|
||||
+#include <unistd.h>
|
||||
+
|
||||
+int
|
||||
+main (int argc, char **argv)
|
||||
+{
|
||||
+ if (fork () == 0)
|
||||
+ sleep (1);
|
||||
+ chdir (".");
|
||||
+ return 0;
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.base/gdb-rhbz1149205-catch-syscall-fork.exp b/gdb/testsuite/gdb.base/gdb-rhbz1149205-catch-syscall-fork.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/gdb-rhbz1149205-catch-syscall-fork.exp
|
||||
@@ -0,0 +1,58 @@
|
||||
+# Copyright 2015 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+if { [is_remote target] || ![isnative] } then {
|
||||
+ continue
|
||||
+}
|
||||
+
|
||||
+set testfile "gdb-rhbz1149205-catch-syscall-fork"
|
||||
+set srcfile ${testfile}.c
|
||||
+set binfile [standard_output_file ${testfile}]
|
||||
+
|
||||
+# Until "catch syscall" is implemented on other targets...
|
||||
+if {![istarget "hppa*-hp-hpux*"] && ![istarget "*-linux*"]} then {
|
||||
+ continue
|
||||
+}
|
||||
+
|
||||
+# This shall be updated whenever 'catch syscall' is implemented
|
||||
+# on some architecture.
|
||||
+#if { ![istarget "i\[34567\]86-*-linux*"]
|
||||
+if { ![istarget "x86_64-*-linux*"] && ![istarget "i\[34567\]86-*-linux*"]
|
||||
+ && ![istarget "powerpc-*-linux*"] && ![istarget "powerpc64-*-linux*"]
|
||||
+ && ![istarget "sparc-*-linux*"] && ![istarget "sparc64-*-linux*"] } {
|
||||
+ continue
|
||||
+}
|
||||
+
|
||||
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
|
||||
+ untested ${testfile}.exp
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+gdb_exit
|
||||
+gdb_start
|
||||
+gdb_reinitialize_dir $srcdir/$subdir
|
||||
+gdb_load $binfile
|
||||
+
|
||||
+if { ![runto_main] } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+gdb_test "catch syscall chdir" \
|
||||
+ "Catchpoint $decimal \\\(syscall (.)?chdir(.)? \\\[$decimal\\\]\\\)" \
|
||||
+ "catch syscall chdir"
|
||||
+
|
||||
+gdb_test "continue" \
|
||||
+ "Continuing\.\r\n.*\r\nCatchpoint $decimal \\\(call to syscall .?chdir.?.*" \
|
||||
+ "continue from catch syscall after fork"
|
350
SOURCES/gdb-rhbz1156192-recursive-dlopen-test.patch
Normal file
350
SOURCES/gdb-rhbz1156192-recursive-dlopen-test.patch
Normal file
@ -0,0 +1,350 @@
|
||||
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-rhbz1156192-recursive-dlopen-test.patch
|
||||
|
||||
;; Testcase for '[SAP] Recursive dlopen causes SAP HANA installer to
|
||||
;; crash.' (RH BZ 1156192).
|
||||
;;=fedoratest
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen-libbar.c b/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen-libbar.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen-libbar.c
|
||||
@@ -0,0 +1,30 @@
|
||||
+/* Testcase for recursive dlopen calls.
|
||||
+
|
||||
+ Copyright (C) 2014 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This file is part of GDB.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+/* This test was copied from glibc's testcase called
|
||||
+ <dlfcn/tst-rec-dlopen.c> and related files. */
|
||||
+
|
||||
+#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
+
|
||||
+void
|
||||
+bar (void)
|
||||
+{
|
||||
+ printf ("Called bar.\n");
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen-libfoo.c b/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen-libfoo.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen-libfoo.c
|
||||
@@ -0,0 +1,30 @@
|
||||
+/* Testcase for recursive dlopen calls.
|
||||
+
|
||||
+ Copyright (C) 2014 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This file is part of GDB.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+/* This test was copied from glibc's testcase called
|
||||
+ <dlfcn/tst-rec-dlopen.c> and related files. */
|
||||
+
|
||||
+#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
+
|
||||
+void
|
||||
+foo (void)
|
||||
+{
|
||||
+ printf ("Called foo.\n");
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.c b/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.c
|
||||
@@ -0,0 +1,124 @@
|
||||
+/* Testcase for recursive dlopen calls.
|
||||
+
|
||||
+ Copyright (C) 2014 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This file is part of GDB.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+/* This test was copied from glibc's testcase called
|
||||
+ <dlfcn/tst-rec-dlopen.c> and related files. */
|
||||
+
|
||||
+#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <malloc.h>
|
||||
+#include <dlfcn.h>
|
||||
+
|
||||
+#define DSO "gdb-rhbz1156192-recursive-dlopen-libfoo.so"
|
||||
+#define FUNC "foo"
|
||||
+
|
||||
+#define DSO1 "gdb-rhbz1156192-recursive-dlopen-libbar.so"
|
||||
+#define FUNC1 "bar"
|
||||
+
|
||||
+/* Prototype for my hook. */
|
||||
+void *custom_malloc_hook (size_t, const void *);
|
||||
+
|
||||
+/* Pointer to old malloc hooks. */
|
||||
+void *(*old_malloc_hook) (size_t, const void *);
|
||||
+
|
||||
+/* Call function func_name in DSO dso_name via dlopen. */
|
||||
+void
|
||||
+call_func (const char *dso_name, const char *func_name)
|
||||
+{
|
||||
+ int ret;
|
||||
+ void *dso;
|
||||
+ void (*func) (void);
|
||||
+ char *err;
|
||||
+
|
||||
+ /* Open the DSO. */
|
||||
+ dso = dlopen (dso_name, RTLD_NOW|RTLD_GLOBAL);
|
||||
+ if (dso == NULL)
|
||||
+ {
|
||||
+ err = dlerror ();
|
||||
+ fprintf (stderr, "%s\n", err);
|
||||
+ exit (1);
|
||||
+ }
|
||||
+ /* Clear any errors. */
|
||||
+ dlerror ();
|
||||
+
|
||||
+ /* Lookup func. */
|
||||
+ *(void **) (&func) = dlsym (dso, func_name);
|
||||
+ if (func == NULL)
|
||||
+ {
|
||||
+ err = dlerror ();
|
||||
+ if (err != NULL)
|
||||
+ {
|
||||
+ fprintf (stderr, "%s\n", err);
|
||||
+ exit (1);
|
||||
+ }
|
||||
+ }
|
||||
+ /* Call func twice. */
|
||||
+ (*func) ();
|
||||
+
|
||||
+ /* Close the library and look for errors too. */
|
||||
+ ret = dlclose (dso);
|
||||
+ if (ret != 0)
|
||||
+ {
|
||||
+ err = dlerror ();
|
||||
+ fprintf (stderr, "%s\n", err);
|
||||
+ exit (1);
|
||||
+ }
|
||||
+
|
||||
+}
|
||||
+
|
||||
+/* Empty hook that does nothing. */
|
||||
+void *
|
||||
+custom_malloc_hook (size_t size, const void *caller)
|
||||
+{
|
||||
+ void *result;
|
||||
+ /* Restore old hooks. */
|
||||
+ __malloc_hook = old_malloc_hook;
|
||||
+ /* First call a function in another library via dlopen. */
|
||||
+ call_func (DSO1, FUNC1);
|
||||
+ /* Called recursively. */
|
||||
+ result = malloc (size);
|
||||
+ /* Restore new hooks. */
|
||||
+ __malloc_hook = custom_malloc_hook;
|
||||
+ return result;
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+main (void)
|
||||
+{
|
||||
+
|
||||
+ /* Save old hook. */
|
||||
+ old_malloc_hook = __malloc_hook;
|
||||
+ /* Install new hook. */
|
||||
+ __malloc_hook = custom_malloc_hook;
|
||||
+
|
||||
+ /* Attempt to dlopen a shared library. This dlopen will
|
||||
+ trigger an access to the ld.so.cache, and that in turn
|
||||
+ will require a malloc to duplicate data in the cache.
|
||||
+ The malloc will call our malloc hook which calls dlopen
|
||||
+ recursively, and upon return of this dlopen the non-ref
|
||||
+ counted ld.so.cache mapping will be unmapped. We will
|
||||
+ return to the original dlopen and crash trying to access
|
||||
+ dlopened data. */
|
||||
+ call_func (DSO, FUNC);
|
||||
+
|
||||
+ /* Restore old hook. */
|
||||
+ __malloc_hook = old_malloc_hook;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.exp b/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.exp
|
||||
@@ -0,0 +1,137 @@
|
||||
+# Copyright 2014 Free Software Foundation, Inc.
|
||||
+#
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+if { [skip_shlib_tests] } {
|
||||
+ return 0
|
||||
+}
|
||||
+
|
||||
+# Library foo
|
||||
+set libname1 "gdb-rhbz1156192-recursive-dlopen-libfoo"
|
||||
+set srcfile_lib1 ${srcdir}/${subdir}/${libname1}.c
|
||||
+set binfile_lib1 [standard_output_file ${libname1}.so]
|
||||
+# Library bar
|
||||
+set libname2 "gdb-rhbz1156192-recursive-dlopen-libbar"
|
||||
+set srcfile_lib2 ${srcdir}/${subdir}/${libname2}.c
|
||||
+set binfile_lib2 [standard_output_file ${libname2}.so]
|
||||
+
|
||||
+set testfile "gdb-rhbz1156192-recursive-dlopen"
|
||||
+set srcfile ${testfile}.c
|
||||
+set executable ${testfile}
|
||||
+set binfile [standard_output_file ${executable}]
|
||||
+
|
||||
+if { [gdb_compile_shlib ${srcfile_lib1} ${binfile_lib1} \
|
||||
+ { debug "additional_flags=-fPIC" }] != "" } {
|
||||
+ untested "Could not compile ${binfile_lib1}"
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+if { [gdb_compile_shlib ${srcfile_lib2} ${binfile_lib2} \
|
||||
+ { debug "additional_flags=-fPIC" }] != "" } {
|
||||
+ untested "Could not compile ${binfile_lib2}"
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+if { [prepare_for_testing ${testfile}.exp ${executable} ${srcfile} \
|
||||
+ [ list debug shlib_load "additional_flags=-Wno-deprecated-declarations" ]] } {
|
||||
+ untested "Could not compile ${executable}"
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+proc do_test { has_libfoo has_libbar } {
|
||||
+ global hex binfile_lib2 binfile_lib1 gdb_prompt
|
||||
+ set libbar_match "[string_to_regexp $binfile_lib2]"
|
||||
+ set libfoo_match "[string_to_regexp $binfile_lib1]"
|
||||
+
|
||||
+ gdb_test_multiple "info shared" "info shared" {
|
||||
+ -re ".*$libfoo_match\r\n.*$libbar_match\(\r\n.*Shared library is missing\)?.*\r\n${gdb_prompt} $" {
|
||||
+ if { $has_libfoo && $has_libbar } {
|
||||
+ pass "matched libfoo and libbar"
|
||||
+ } else {
|
||||
+ fail "matched libfoo and libbar (has_libfoo = $has_libfoo, has_libbar = $has_libbar)"
|
||||
+ }
|
||||
+ }
|
||||
+ -re ".*$libfoo_match\(\r\n.*Shared library is missing\)?.*\r\n${gdb_prompt} $" {
|
||||
+ if { $has_libfoo && !$has_libbar } {
|
||||
+ pass "matched libfoo"
|
||||
+ } else {
|
||||
+ fail "matched libfoo (has_libfoo = $has_libfoo, has_libbar = $has_libbar)"
|
||||
+ }
|
||||
+ }
|
||||
+ -re ".*$libbar_match\(\r\n.*Shared library is missing\)?.*\r\n${gdb_prompt} $" {
|
||||
+ if { $has_libbar && !$has_libfoo } {
|
||||
+ pass "matched libbar"
|
||||
+ } else {
|
||||
+ fail "matched libbar (has_libfoo = $has_libfoo, has_libbar = $has_libbar)"
|
||||
+ }
|
||||
+ }
|
||||
+ "\r\n${gdb_prompt} $" {
|
||||
+ if { !$has_libfoo && !$has_libbar } {
|
||||
+ pass "did not match libfoo nor libbar"
|
||||
+ } else {
|
||||
+ fail "did not match libfoo nor libbar (has_libfoo = $has_libfoo, has_libbar = $has_libbar)"
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+proc test_stop_on_solib_events { } {
|
||||
+ set pass 0
|
||||
+ # This variable holds the information about whether libfoo and
|
||||
+ # libbar (respectively) are expected in the "info shared" output.
|
||||
+ set solib_event_order { { 0 0 } { 0 0 } { 0 0 } { 0 1 } \
|
||||
+ { 0 1 } { 0 0 } { 0 0 } { 0 1 } \
|
||||
+ { 0 1 } { 0 0 } { 0 0 } { 0 1 } \
|
||||
+ { 0 1 } { 0 0 } { 0 0 1 } { 1 1 } \
|
||||
+ { 1 1 } { 1 0 } { 1 0 } { 1 1 } \
|
||||
+ { 1 1 } { 1 0 1 } { 1 0 } { 1 0 } }
|
||||
+
|
||||
+ with_test_prefix "stop-on-solib-events" {
|
||||
+ gdb_test_no_output "set stop-on-solib-events 1" "setting stop-on-solib-events"
|
||||
+
|
||||
+ gdb_run_cmd
|
||||
+ foreach l $solib_event_order {
|
||||
+ incr pass
|
||||
+ with_test_prefix "pass #$pass" {
|
||||
+ set should_be_corrupted [expr 0+0[lindex $l 2]]
|
||||
+ do_test [lindex $l 0] [lindex $l 1]
|
||||
+ set test "continue"
|
||||
+ global gdb_prompt
|
||||
+ gdb_test_multiple $test $test {
|
||||
+ -re "\r\nwarning: Corrupted shared library list:.*\r\nStopped due to shared library event.*\r\n$gdb_prompt $" {
|
||||
+ set corrupted 1
|
||||
+ pass $test
|
||||
+ }
|
||||
+ -re "\r\nStopped due to shared library event.*\r\n$gdb_prompt $" {
|
||||
+ set corrupted 0
|
||||
+ pass $test
|
||||
+ }
|
||||
+ }
|
||||
+ set test "corrupted=$corrupted but should_be_corrupted=$should_be_corrupted"
|
||||
+ if {$corrupted == $should_be_corrupted} {
|
||||
+ pass $test
|
||||
+ } else {
|
||||
+ fail $test
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ # In the last pass we do not expect to see libfoo or libbar.
|
||||
+ incr pass
|
||||
+ with_test_prefix "pass #$pass" {
|
||||
+ do_test 0 0
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+test_stop_on_solib_events
|
@ -0,0 +1,135 @@
|
||||
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-rhbz1186476-internal-error-unqualified-name-re-set-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
|
||||
|
||||
Comments from Sergio Durigan Junior:
|
||||
|
||||
The "proper" fix for this whole problem would be to backport the
|
||||
"ambiguous linespec" patch series. However, it is really not
|
||||
recommended to do that for RHEL GDB, because the patch series is too
|
||||
big and could introduce unwanted regressions. Instead, what we
|
||||
chose to do was to replace the gdb_assert call by a warning (which
|
||||
allows the user to continue the debugging session), and tell the
|
||||
user that, although more than one location was found for his/her
|
||||
breakpoint, only one will be used.
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.cp/gdb-rhbz1186476-internal-error-unqualified-name-re-set-main.cc b/gdb/testsuite/gdb.cp/gdb-rhbz1186476-internal-error-unqualified-name-re-set-main.cc
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.cp/gdb-rhbz1186476-internal-error-unqualified-name-re-set-main.cc
|
||||
@@ -0,0 +1,22 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2015 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+int
|
||||
+main (int argc, char *argv[])
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.cp/gdb-rhbz1186476-internal-error-unqualified-name-re-set.cc b/gdb/testsuite/gdb.cp/gdb-rhbz1186476-internal-error-unqualified-name-re-set.cc
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.cp/gdb-rhbz1186476-internal-error-unqualified-name-re-set.cc
|
||||
@@ -0,0 +1,26 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2015 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+class C
|
||||
+ {
|
||||
+ public:
|
||||
+ C () {}
|
||||
+ C (int x) {}
|
||||
+ };
|
||||
+
|
||||
+C a;
|
||||
+C b (1);
|
||||
diff --git a/gdb/testsuite/gdb.cp/gdb-rhbz1186476-internal-error-unqualified-name-re-set.exp b/gdb/testsuite/gdb.cp/gdb-rhbz1186476-internal-error-unqualified-name-re-set.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.cp/gdb-rhbz1186476-internal-error-unqualified-name-re-set.exp
|
||||
@@ -0,0 +1,51 @@
|
||||
+# Copyright 2015 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+if { [skip_cplus_tests] } { continue }
|
||||
+if { [skip_shlib_tests] } { continue }
|
||||
+if { [is_remote target] } { continue }
|
||||
+if { [target_info exists use_gdb_stub] } { continue }
|
||||
+
|
||||
+set testfile gdb-rhbz1186476-internal-error-unqualified-name-re-set-main
|
||||
+set srcfile $testfile.cc
|
||||
+set executable $testfile
|
||||
+set binfile [standard_output_file $executable]
|
||||
+
|
||||
+set libtestfile gdb-rhbz1186476-internal-error-unqualified-name-re-set
|
||||
+set libsrcfile $libtestfile.cc
|
||||
+set sofile [standard_output_file lib$libtestfile.so]
|
||||
+
|
||||
+# Create and source the file that provides information about the compiler
|
||||
+# used to compile the test case.
|
||||
+if [get_compiler_info "c++"] {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+if { [gdb_compile_shlib $srcdir/$subdir/$libsrcfile $sofile {debug c++ "additional_flags=-fPIC"}] != ""
|
||||
+ || [gdb_compile $srcdir/$subdir/$srcfile $binfile executable [list additional_flags=-Wl,-rpath,[file dirname ${sofile}] "c++" shlib=${sofile} ]] != ""} {
|
||||
+ untested $libtestfile.exp
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+clean_restart $executable
|
||||
+
|
||||
+gdb_test_no_output "set breakpoint pending on"
|
||||
+# gdb_breakpoint would print a failure because of some warning messages
|
||||
+gdb_test "break C::C" "Breakpoint $decimal \\(C::C\\) pending."
|
||||
+
|
||||
+#gdb_test "run" "warning: Found more than one location for breakpoint #$decimal; only the first location will be used.(\r\n)+Breakpoint $decimal, C::C.*"
|
||||
+gdb_test "run"
|
||||
+
|
||||
+gdb_test "info break" " in C::C\\(\\) at .* in C::C\\(int\\) at .*"
|
65
SOURCES/gdb-rhbz1187581-power8-regs-1of7.patch
Normal file
65
SOURCES/gdb-rhbz1187581-power8-regs-1of7.patch
Normal file
@ -0,0 +1,65 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
Date: Thu, 9 Aug 2018 17:09:48 +0200
|
||||
Subject: gdb-rhbz1187581-power8-regs-1of7.patch
|
||||
|
||||
;; Add GDB support to access/display POWER8 registers (IBM, RH BZ 1187581).
|
||||
|
||||
commit 05abfc39c719e740530000059bb963ad33462479
|
||||
Author: Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
|
||||
Date: Mon Aug 6 16:24:55 2018 -0300
|
||||
|
||||
Fix indentation in remote_target::download_tracepoint
|
||||
|
||||
gdb/ChangeLog:
|
||||
2018-08-06 Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
|
||||
|
||||
* remote.c (remote_target::download_tracepoint): Fix indentation
|
||||
in for block.
|
||||
|
||||
diff --git a/gdb/remote.c b/gdb/remote.c
|
||||
--- a/gdb/remote.c
|
||||
+++ b/gdb/remote.c
|
||||
@@ -12912,24 +12912,24 @@ remote_target::download_tracepoint (struct bp_location *loc)
|
||||
error (_("Error on target while setting tracepoints."));
|
||||
}
|
||||
|
||||
- for (auto action_it = stepping_actions.begin ();
|
||||
- action_it != stepping_actions.end (); action_it++)
|
||||
- {
|
||||
- QUIT; /* Allow user to bail out with ^C. */
|
||||
-
|
||||
- bool is_first = action_it == stepping_actions.begin ();
|
||||
- bool has_more = action_it != stepping_actions.end ();
|
||||
-
|
||||
- xsnprintf (buf, BUF_SIZE, "QTDP:-%x:%s:%s%s%s",
|
||||
- b->number, addrbuf, /* address */
|
||||
- is_first ? "S" : "",
|
||||
- action_it->c_str (),
|
||||
- has_more ? "-" : "");
|
||||
- putpkt (buf);
|
||||
- remote_get_noisy_reply ();
|
||||
- if (strcmp (rs->buf, "OK"))
|
||||
- error (_("Error on target while setting tracepoints."));
|
||||
- }
|
||||
+ for (auto action_it = stepping_actions.begin ();
|
||||
+ action_it != stepping_actions.end (); action_it++)
|
||||
+ {
|
||||
+ QUIT; /* Allow user to bail out with ^C. */
|
||||
+
|
||||
+ bool is_first = action_it == stepping_actions.begin ();
|
||||
+ bool has_more = action_it != stepping_actions.end ();
|
||||
+
|
||||
+ xsnprintf (buf, BUF_SIZE, "QTDP:-%x:%s:%s%s%s",
|
||||
+ b->number, addrbuf, /* address */
|
||||
+ is_first ? "S" : "",
|
||||
+ action_it->c_str (),
|
||||
+ has_more ? "-" : "");
|
||||
+ putpkt (buf);
|
||||
+ remote_get_noisy_reply ();
|
||||
+ if (strcmp (rs->buf, "OK"))
|
||||
+ error (_("Error on target while setting tracepoints."));
|
||||
+ }
|
||||
|
||||
if (packet_support (PACKET_TracepointSource) == PACKET_ENABLE)
|
||||
{
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user