diff --git a/SPECS/_gdb.spec.Patch.include b/SPECS/_gdb.spec.Patch.include new file mode 100644 index 0000000..0a15ee8 --- /dev/null +++ b/SPECS/_gdb.spec.Patch.include @@ -0,0 +1,745 @@ +# 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 -completion crash (Gary Benson, RH BZ 1398387). +#=fedoratest +Patch117: gdb-rhbz1398387-tab-crash-test.patch + +# [testsuite] Fix false selftest.exp FAIL from system readline-6.3+ (Patrick Palka). +#=fedoratest +Patch118: gdb-testsuite-readline63-sigint.patch + +# Python patches of: http://sourceware.org/gdb/wiki/ProjectArcher +#=push +Patch119: gdb-archer.patch + +# Revert upstream commit 469412dd9ccc4de5874fd3299b105833f36b34cd +Patch120: gdb-vla-intel-fix-print-char-array.patch + +# [s390x] Backport arch12 instructions decoding (RH BZ 1553104). +# =fedoratest +Patch121: gdb-rhbz1553104-s390x-arch12-test.patch + +# Implement IPv6 support for GDB/gdbserver (RH BZ 881849, Sergio Durigan Junior). +Patch122: gdb-rhbz881849-ipv6-1of3.patch + + +Patch123: gdb-rhbz881849-ipv6-2of3.patch + + +Patch124: gdb-rhbz881849-ipv6-3of3.patch + +# Add GDB support to access/display POWER8 registers (IBM, RH BZ 1187581). +Patch125: gdb-rhbz1187581-power8-regs-1of7.patch + +# Add GDB support to access/display POWER8 registers (IBM, RH BZ 1187581). +Patch126: gdb-rhbz1187581-power8-regs-2of7.patch + +# Add GDB support to access/display POWER8 registers (IBM, RH BZ 1187581). +Patch127: gdb-rhbz1187581-power8-regs-3of7.patch + +# Add GDB support to access/display POWER8 registers (IBM, RH BZ 1187581). +Patch128: gdb-rhbz1187581-power8-regs-4of7.patch + +# Add GDB support to access/display POWER8 registers (IBM, RH BZ 1187581). +Patch129: gdb-rhbz1187581-power8-regs-5of7.patch + +# Add GDB support to access/display POWER8 registers (IBM, RH BZ 1187581). +Patch130: gdb-rhbz1187581-power8-regs-6of7.patch + +# Add GDB support to access/display POWER8 registers (IBM, RH BZ 1187581). +Patch131: gdb-rhbz1187581-power8-regs-7of7.patch + +# Fix for 'gdb in batch mode always exit with status 0' (Gary Benson) +# RHBZ #1491128 +Patch132: gdb-rhbz1491128-batch-mode-exit-status-1of2.patch + +# Fix for 'gdb in batch mode always exit with status 0' (Gary Benson) +# RHBZ #1491128 +Patch133: gdb-rhbz1491128-batch-mode-exit-status-2of2.patch + +# Use pulongest in aarch64-linux-tdep.c. +# This patch was forgotten during the 8.2 release process, and is +# needed to unbreak GDB when compiling on 32-bit arches. +Patch134: gdb-use-pulongest-aarch64-linux-tdep.patch + +# Fix for 'GDB crashes when running from a deleted directory' +# (Tom Tromey, RHBZ#1653410) +Patch135: gdb-rhbz1653410-avoid-crash-when-calling-warning-too-early.patch + +# Fix for 'py-bt is broken, results in exception'. +# RHBZ 1639242 +Patch136: gdb-rhbz1639242-fix-dwarf2_find_containing_comp_unit-binary-search.patch + +# Fix 'Assertion `SYMBOL_LANGUAGE (sym) == DICT_LANGUAGE (dict)->la_language' failed.' +# Keith Seitz, RHBZ#1560010. +Patch137: gdb-rhbz1560010-fix-assertion-symbol-language-dict-language-1of5.patch + +# Fix 'Assertion `SYMBOL_LANGUAGE (sym) == DICT_LANGUAGE (dict)->la_language' failed.' +# Keith Seitz, RHBZ#1560010. +Patch138: gdb-rhbz1560010-fix-assertion-symbol-language-dict-language-2of5.patch + +# Fix 'Assertion `SYMBOL_LANGUAGE (sym) == DICT_LANGUAGE (dict)->la_language' failed.' +# Keith Seitz, RHBZ#1560010. +Patch139: gdb-rhbz1560010-fix-assertion-symbol-language-dict-language-3of5.patch + +# Fix 'Assertion `SYMBOL_LANGUAGE (sym) == DICT_LANGUAGE (dict)->la_language' failed.' +# Keith Seitz, RHBZ#1560010. +Patch140: gdb-rhbz1560010-fix-assertion-symbol-language-dict-language-4of5.patch + +# Fix 'Assertion `SYMBOL_LANGUAGE (sym) == DICT_LANGUAGE (dict)->la_language' failed.' +# Keith Seitz, RHBZ#1560010. +Patch141: gdb-rhbz1560010-fix-assertion-symbol-language-dict-language-5of5.patch + +# Fix 'gdb suggests using "dnf debuginfo-install' +# Keith Seitz, RHBZ 1666249 +Patch142: gdb-rhbz1666249-suggest-yum-instead-of-dnf.patch + +# Fix 'libiberty: Memory leak in demangle_template function resulting in a denial of service" +# Simon Marchi, RH BZ 1668635 +Patch143: gdb-rhbz1668635-libiberty-demangle_template-memleak.patch + +# Fix 'gdb fails to read zN registers from corefile with aarch64 SVE' +# Alan Hayward, RH BZ 1669953 +Patch144: gdb-rhbz1669953-aarch64-sve-binutils.patch + +# Fix remote.c build failure +# Szabolcs Nagy, RH BZ 1187581 +Patch145: gdb-rhbz1187581-power8-regs-not-in-8.2-01of15.patch + +# Add grok/write functions for new ppc core note sections +# Edjunior Barbosa Machado, RH BZ 1187581 +Patch146: gdb-rhbz1187581-power8-regs-not-in-8.2-02of15.patch + +# Zero-initialize linux note sections +# Pedro Franco de Carvalho, RH BZ 1187581 +Patch147: gdb-rhbz1187581-power8-regs-not-in-8.2-03of15.patch + +# [PowerPC] Don't zero-initialize vector register buffers +# Pedro Franco de Carvalho, RH BZ 1187581 +Patch148: gdb-rhbz1187581-power8-regs-not-in-8.2-04of15.patch + +# Add decfloat registers to float reggroup +# Pedro Franco de Carvalho, RH BZ 1187581 +Patch149: gdb-rhbz1187581-power8-regs-not-in-8.2-05of15.patch + +# [PowerPC] Remove rs6000_pseudo_register_reggroup_p +# Pedro Franco de Carvalho, RH BZ 1187581 +Patch150: gdb-rhbz1187581-power8-regs-not-in-8.2-06of15.patch + +# [PowerPC] Fix two if statements in gdb/ppc-linux-nat.c +# Pedro Franco de Carvalho, RH BZ 1187581 +Patch151: gdb-rhbz1187581-power8-regs-not-in-8.2-07of15.patch + +# [PowerPC] Fix indentation in arch/ppc-linux-common.c +# Pedro Franco de Carvalho, RH BZ 1187581 +Patch152: gdb-rhbz1187581-power8-regs-not-in-8.2-08of15.patch + +# [PowerPC] Refactor have_ initializers in rs6000-tdep.c +# Pedro Franco de Carvalho, RH BZ 1187581 +Patch153: gdb-rhbz1187581-power8-regs-not-in-8.2-09of15.patch + +# [PowerPC] Add support for PPR and DSCR +# Edjunior Barbosa Machado and Pedro Franco de Carvalho, RH BZ 1187581 +Patch154: gdb-rhbz1187581-power8-regs-not-in-8.2-10of15.patch + +# [PowerPC] Add support for TAR +# Edjunior Barbosa Machado and Pedro Franco de Carvalho, RH BZ 1187581 +Patch155: gdb-rhbz1187581-power8-regs-not-in-8.2-11of15.patch + +# [PowerPC] Add support for EBB and PMU registers +# Edjunior Barbosa Machado and Pedro Franco de Carvalho, RH BZ 1187581m +Patch156: gdb-rhbz1187581-power8-regs-not-in-8.2-12of15.patch + +# [PowerPC] Reject tdescs with VSX and no FPU or Altivec +# Pedro Franco de Carvalho, RH BZ 1187581 +Patch157: gdb-rhbz1187581-power8-regs-not-in-8.2-13of15.patch + +# [PowerPC] Add support for HTM registers +# Edjunior Barbosa Machado and Pedro Franco de Carvalho, RH BZ 1187581 +Patch158: gdb-rhbz1187581-power8-regs-not-in-8.2-14of15.patch + +# [PowerPC] Document requirements for VSX feature +# Pedro Franco de Carvalho, RH BZ 1187581 +Patch159: gdb-rhbz1187581-power8-regs-not-in-8.2-15of15.patch + +# "Fix" segfault that happens on parse_macro_definition because +# debugedit corrupts the .debug_macro section. +# Sergio Durigan Junior, RH BZ 1708192. +Patch160: gdb-rhbz1708192-parse_macro_definition-crash.patch + +# Prevent buffer overflow with sections with invalid sizes. +# Keith Seitz, RH BZ 1740299. +Patch161: gdb-rhbz1742099-reject-sections-with-invalid-sizes.patch + +# Fix 'GDB needs s390x arch13 binutils patches' +# RHBZ 1768593, Andreas Krebbel +# This patch contains only the opcodes change. +Patch162: gdb-rhbz1768593-s390x-arch13-01.patch + +# Fix 'GDB needs s390x arch13 binutils patches' +# RHBZ 1768593, Andreas Krebbel +# This patch contains only the opcodes and include changes. +Patch163: gdb-rhbz1768593-s390x-arch13-02.patch + +# Fix 'GDB needs s390x arch13 binutils patches' +# RHBZ 1768593, Andreas Krebbel +Patch164: gdb-rhbz1768593-s390x-arch13-03.patch + +# Backport z15 record/replay +# Andreas Arnaz, RH BZ 1659535 +Patch165: gdb-rhbz1659535-z15-record-replay.patch + +# Fix terminal problems when error() is called +# Alan Hayward (RH BZ 1852580) +Patch166: gdb-rhbz1852580-terminal-woes.patch + +# Remove hack for GDB which sets the section size to 0 +# Kevin Buettner, RH BZ 1842691 +Patch167: gdb-rhbz1842691-corefile-mem-access-1of15.patch + +# Adjust corefile.exp test to show regression after bfd hack removal +# Kevin Buettner, RH BZ 1842691 +Patch168: gdb-rhbz1842691-corefile-mem-access-2of15.patch + +# section_table_xfer_memory: Replace section name with callback predicate +# Kevin Buettner, RH BZ 1842691 +Patch169: gdb-rhbz1842691-corefile-mem-access-3of15.patch + +# Provide access to non SEC_HAS_CONTENTS core file sections +# Kevin Buettner, RH BZ 1842961 +Patch170: gdb-rhbz1842691-corefile-mem-access-4of15.patch + +# Test ability to access unwritten-to mmap data in core file +# Kevin Buettner, RH BZ 1842961 +Patch171: gdb-rhbz1842691-corefile-mem-access-5of15.patch + +# Update binary_get_section_contents to seek using section's file position +# Kevin Buettner, RH BZ 1842961 +Patch172: gdb-rhbz1842691-corefile-mem-access-6of15.patch + +# Add new gdbarch method, read_core_file_mappings +# Kevin Buettner, RH BZ 1842961 +Patch173: gdb-rhbz1842691-corefile-mem-access-7of15.patch + +# Use NT_FILE note section for reading core target memory +# Kevin Buettner, RH BZ 1842961 +Patch174: gdb-rhbz1842691-corefile-mem-access-8of15.patch + +# Add test for accessing read-only mmapped data in a core file +# Kevin Buettner, RH BZ 1842691 +Patch175: gdb-rhbz1842691-corefile-mem-access-9of15.patch + +# gcore command: Place all file-backed mappings in NT_FILE note +# Kevin Buettner, RH BZ 1842961 +Patch176: gdb-rhbz1842691-corefile-mem-access-10of15.patch + +# Adjust coredump-filter.exp to account for NT_FILE note handling +# Kevin Buettner, RH BZ 1842961 +Patch177: gdb-rhbz1842691-corefile-mem-access-11of15.patch + +# Add new command "maint print core-file-backed-mappings" +# Kevin Buettner, RH BZ 1842961 +Patch178: gdb-rhbz1842691-corefile-mem-access-12of15.patch + +# Add documentation for "maint print core-file-backed-mappings" +# Kevin Buettner, RH BZ 1842961 +Patch179: gdb-rhbz1842691-corefile-mem-access-13of15.patch + +# New core file tests with mappings over existing program memory +# Kevin Buettner, RH BZ 1842961 +Patch180: gdb-rhbz1842691-corefile-mem-access-14of15.patch + +# Add period to help text for maint print core-file-backed-mappings +# Kevin Buettner, RH BZ 1842961 +Patch181: gdb-rhbz1842691-corefile-mem-access-15of15.patch + +# Backport "Stop the BFD library from issuing a warning message when +# processing allocated sections in debuginfo files that lie outside of +# Nick Clifton and Keith Seitz, RH BZ 1878810 +Patch182: gdb-rhbz1878810-bfd-suppress-loadable-section-outside-ELF-sections.patch + diff --git a/SPECS/_gdb.spec.patch.include b/SPECS/_gdb.spec.patch.include new file mode 100644 index 0000000..68a3258 --- /dev/null +++ b/SPECS/_gdb.spec.patch.include @@ -0,0 +1,182 @@ +%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 +%patch160 -p1 +%patch161 -p1 +%patch162 -p1 +%patch163 -p1 +%patch164 -p1 +%patch165 -p1 +%patch166 -p1 +%patch167 -p1 +%patch168 -p1 +%patch169 -p1 +%patch170 -p1 +%patch171 -p1 +%patch172 -p1 +%patch173 -p1 +%patch174 -p1 +%patch175 -p1 +%patch176 -p1 +%patch177 -p1 +%patch178 -p1 +%patch179 -p1 +%patch180 -p1 +%patch181 -p1 +%patch182 -p1 diff --git a/SPECS/gdb-8.2.tar.xz b/SPECS/gdb-8.2.tar.xz new file mode 100644 index 0000000..fc5ae3c Binary files /dev/null and b/SPECS/gdb-8.2.tar.xz differ diff --git a/SPECS/gdb-gstack.man b/SPECS/gdb-gstack.man new file mode 100644 index 0000000..1f4e406 --- /dev/null +++ b/SPECS/gdb-gstack.man @@ -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 +.\" +.\" 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 + +Red Hat, Inc. diff --git a/SPECS/gdb-libstdc++-v3-python-8.1.1-20180626.tar.xz b/SPECS/gdb-libstdc++-v3-python-8.1.1-20180626.tar.xz new file mode 100644 index 0000000..379b39c Binary files /dev/null and b/SPECS/gdb-libstdc++-v3-python-8.1.1-20180626.tar.xz differ diff --git a/SPECS/gdb-orphanripper.c b/SPECS/gdb-orphanripper.c new file mode 100644 index 0000000..2653dd2 --- /dev/null +++ b/SPECS/gdb-orphanripper.c @@ -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 + */ + +/* For getpgid(2). */ +#define _GNU_SOURCE 1 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#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 = ""; + 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 ] "); + 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; +} diff --git a/SPECS/gdb-testsuite-readline63-sigint-revert.patch b/SPECS/gdb-testsuite-readline63-sigint-revert.patch new file mode 100644 index 0000000..c5e1b2e --- /dev/null +++ b/SPECS/gdb-testsuite-readline63-sigint-revert.patch @@ -0,0 +1,33 @@ +diff --git b/gdb/testsuite/gdb.gdb/selftest.exp a/gdb/testsuite/gdb.gdb/selftest.exp +index 7e6a4e1..969797a 100644 +--- b/gdb/testsuite/gdb.gdb/selftest.exp ++++ a/gdb/testsuite/gdb.gdb/selftest.exp +@@ -451,25 +451,9 @@ proc test_with_self { executable } { + } + + set description "send SIGINT signal to child process" +- gdb_test_multiple "signal SIGINT" "$description" { +- -re "^signal SIGINT\r\nContinuing with signal SIGINT.\r\nQuit\r\n" { +- pass "$description" +- } +- } +- +- set description "send ^C to child process again" +- send_gdb "\003" +- gdb_expect { +- -re "(Thread .*|Program) received signal SIGINT.*$gdb_prompt $" { +- pass "$description" +- } +- -re ".*$gdb_prompt $" { +- fail "$description" +- } +- timeout { +- fail "$description (timeout)" +- } +- } ++ gdb_test "signal SIGINT" \ ++ "Continuing with signal SIGINT.*" \ ++ "$description" + + # Switch back to the GDB thread if Guile support is linked in. + # "signal SIGINT" could also switch the current thread. diff --git a/SPECS/gdbinit b/SPECS/gdbinit new file mode 100644 index 0000000..b59fb0d --- /dev/null +++ b/SPECS/gdbinit @@ -0,0 +1,9 @@ +# System-wide GDB initialization file. +python +import glob +# glob.iglob is not available in python-2.4 (RHEL-5). +for f in glob.glob('%{_sysconfdir}/gdbinit.d/*.gdb'): + gdb.execute('source %s' % f) +for f in glob.glob('%{_sysconfdir}/gdbinit.d/*.py'): + gdb.execute('source %s' % f) +end diff --git a/SPECS/gdbtui b/SPECS/gdbtui new file mode 100755 index 0000000..88f9d55 --- /dev/null +++ b/SPECS/gdbtui @@ -0,0 +1,2 @@ +#! /bin/sh +exec gdb -tui "$@" diff --git a/SPECS/v1.5-libipt-static.patch b/SPECS/v1.5-libipt-static.patch new file mode 100644 index 0000000..6599445 --- /dev/null +++ b/SPECS/v1.5-libipt-static.patch @@ -0,0 +1,26 @@ +Index: processor-trace-2.0/libipt/CMakeLists.txt +=================================================================== +--- processor-trace-2.0.orig/libipt/CMakeLists.txt ++++ processor-trace-2.0/libipt/CMakeLists.txt +@@ -85,7 +85,7 @@ endif (CMAKE_HOST_WIN32) + + set(LIBIPT_FILES ${LIBIPT_FILES} ${LIBIPT_SECTION_FILES}) + +-add_library(libipt SHARED ++add_library(libipt STATIC + ${LIBIPT_FILES} + ) + +Index: processor-trace-2.0/libipt/src/posix/init.c +=================================================================== +--- processor-trace-2.0.orig/libipt/src/posix/init.c ++++ processor-trace-2.0/libipt/src/posix/init.c +@@ -29,7 +29,7 @@ + #include "pt_ild.h" + + +-static void __attribute__((constructor)) init(void) ++void __libipt_init(void) + { + /* Initialize the Intel(R) Processor Trace instruction decoder. */ + pt_ild_init(); diff --git a/SPECS/v2.0.tar.gz b/SPECS/v2.0.tar.gz new file mode 100644 index 0000000..fb81654 Binary files /dev/null and b/SPECS/v2.0.tar.gz differ