commit 950e642bdd5762f3c997cf24a1ca4e3d5e8fe753 Author: Toshaan Bharvani Date: Fri Oct 18 00:37:18 2024 +0200 initial package creation Signed-off-by: Toshaan Bharvani diff --git a/SOURCES/_gdb.spec.Patch.include b/SOURCES/_gdb.spec.Patch.include new file mode 100644 index 0000000..a1230be --- /dev/null +++ b/SOURCES/_gdb.spec.Patch.include @@ -0,0 +1,514 @@ +# Match the Fedora's version info. +#=fedora +Patch001: gdb-6.3-rh-testversion-20041202.patch + +# Add a wrapper script to GDB that implements pstack using the +# --readnever option. +#=push +Patch002: gdb-6.3-gstack-20050411.patch + +# Test support of multiple destructors just like multiple constructors +#=fedoratest +Patch003: gdb-6.3-test-dtorfix-20050121.patch + +# Fix to support executable moving +#=fedoratest +Patch004: gdb-6.3-test-movedir-20050125.patch + +# Test sibling threads to set threaded watchpoints for x86 and x86-64 +#=fedoratest +Patch005: gdb-6.3-threaded-watchpoints2-20050225.patch + +# Notify observers that the inferior has been created +#=fedoratest +Patch006: gdb-6.3-inferior-notification-20050721.patch + +# Verify printing of inherited members test +#=fedoratest +Patch007: gdb-6.3-inheritancetest-20050726.patch + +# Support TLS symbols (+`errno' suggestion if no pthread is found) (BZ 185337). +#=push+jan: It should be replaced by Infinity project. +Patch008: 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. +Patch009: 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. +Patch010: gdb-6.5-BEA-testsuite.patch + +# Testcase for deadlocking on last address space byte; for corrupted backtraces. +#=fedoratest +Patch011: gdb-6.5-last-address-space-byte-test.patch + +# Fix readline segfault on excessively long hand-typed lines. +#=fedoratest +Patch012: gdb-6.5-readline-long-line-crash-test.patch + +# Fix lockup on trampoline vs. its function lookup; unreproducible (BZ 218379). +#=fedora +Patch013: gdb-6.5-bz218379-solib-trampoline-lookup-lock-fix.patch + +# Find symbols properly at their original (included) file (BZ 109921). +#=fedoratest +Patch014: gdb-6.5-bz109921-DW_AT_decl_file-test.patch + +# Update PPC unwinding patches to their upstream variants (BZ 140532). +#=fedoratest +Patch015: gdb-6.3-bz140532-ppc-unwinding-test.patch + +# Testcase for exec() from threaded program (BZ 202689). +#=fedoratest +Patch016: gdb-6.3-bz202689-exec-from-pthread-test.patch + +# Testcase for PPC Power6/DFP instructions disassembly (BZ 230000). +#=fedoratest +Patch017: gdb-6.6-bz230000-power6-disassembly-test.patch + +# Allow running `/usr/bin/gcore' with provided but inaccessible tty (BZ 229517). +#=fedoratest +Patch018: gdb-6.6-bz229517-gcore-without-terminal.patch + +# Avoid too long timeouts on failing cases of "annota1.exp annota3.exp". +#=fedoratest +Patch019: gdb-6.6-testsuite-timeouts.patch + +# Support for stepping over PPC atomic instruction sequences (BZ 237572). +#=fedoratest +Patch020: gdb-6.6-bz237572-ppc-atomic-sequence-test.patch + +# Test kernel VDSO decoding while attaching to an i386 process. +#=fedoratest +Patch021: gdb-6.3-attach-see-vdso-test.patch + +# Test leftover zombie process (BZ 243845). +#=fedoratest +Patch022: gdb-6.5-bz243845-stale-testing-zombie-test.patch + +# New locating of the matching binaries from the pure core file (build-id). +#=push+jan +Patch023: 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 +Patch024: gdb-6.6-buildid-locate-solib-missing-ids.patch + +#=push+jan +Patch025: 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. +Patch026: gdb-6.7-charsign-test.patch + +# Test PPC hiding of call-volatile parameter register. +#=fedoratest +Patch027: gdb-6.7-ppc-clobbered-registers-O2-test.patch + +# Testsuite fixes for more stable/comparable results. +#=fedoratest +Patch028: gdb-6.7-testsuite-stable-results.patch + +# Test ia64 memory leaks of the code using libunwind. +#=fedoratest +Patch029: gdb-6.5-ia64-libunwind-leak-test.patch + +# Test hiding unexpected breakpoints on intentional step commands. +#=fedoratest +Patch030: gdb-6.5-missed-trap-on-step-test.patch + +# Test gcore memory and time requirements for large inferiors. +#=fedoratest +Patch031: 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. +Patch032: gdb-6.3-mapping-zero-inode-test.patch + +# Test a crash on `focus cmd', `focus prev' commands. +#=fedoratest +Patch033: gdb-6.3-focus-cmd-prev-test.patch + +# Test various forms of threads tracking across exec() (BZ 442765). +#=fedoratest +Patch034: gdb-6.8-bz442765-threaded-exec-test.patch + +# Test a crash on libraries missing the .text section. +#=fedoratest +Patch035: gdb-6.5-section-num-fixup-test.patch + +# Fix resolving of variables at locations lists in prelinked libs (BZ 466901). +#=fedoratest +Patch036: gdb-6.8-bz466901-backtrace-full-prelinked.patch + +# New test for step-resume breakpoint placed in multiple threads at once. +#=fedoratest +Patch037: 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@.*> +Patch038: gdb-core-open-vdso-warning.patch + +# Workaround ccache making lineno non-zero for command-line definitions. +#=fedoratest: ccache is rarely used and it is even fixed now. +Patch039: gdb-ccache-workaround.patch + +# Testcase for "Do not make up line information" fix by Daniel Jacobowitz. +#=fedoratest +Patch040: gdb-lineno-makeup-test.patch + +# Test power7 ppc disassembly. +#=fedoratest +Patch041: gdb-ppc-power7-test.patch + +# Fix follow-exec for C++ programs (bugreported by Martin Stransky). +#=fedoratest +Patch042: gdb-archer-next-over-throw-cxx-exec.patch + +# Backport DWARF-4 support (BZ 601887, Tom Tromey). +#=fedoratest +Patch043: gdb-bz601887-dwarf4-rh-test.patch + +# Workaround librpm BZ 643031 due to its unexpected exit() calls (BZ 642879). +#=push+jan +Patch044: gdb-6.6-buildid-locate-rpm-librpm-workaround.patch + +# [delayed-symfile] Test a backtrace regression on CFIs without DIE (BZ 614604). +#=fedoratest +Patch045: gdb-test-bt-cfi-without-die.patch + +# Verify GDB Python built-in function gdb.solib_address exists (BZ # 634108). +#=fedoratest +Patch046: gdb-bz634108-solib_address.patch + +# New test gdb.arch/x86_64-pid0-core.exp for kernel PID 0 cores (BZ 611435). +#=fedoratest +Patch047: gdb-test-pid0-core.patch + +# [archer-tromey-delayed-symfile] New test gdb.dwarf2/dw2-aranges.exp. +#=fedoratest +Patch048: gdb-test-dw2-aranges.patch + +# [archer-keiths-expr-cumulative+upstream] Import C++ testcases. +#=fedoratest +Patch049: gdb-test-expr-cumulative-archer.patch + +# Fix regressions on C++ names resolving (PR 11734, PR 12273, Keith Seitz). +#=fedoratest +Patch050: gdb-physname-pr11734-test.patch + +# Fix regressions on C++ names resolving (PR 11734, PR 12273, Keith Seitz). +#=fedoratest +Patch051: gdb-physname-pr12273-test.patch + +# Test GDB opcodes/ disassembly of Intel Ivy Bridge instructions (BZ 696890). +#=fedoratest +Patch052: gdb-test-ivy-bridge.patch + +# Hack for proper PIE run of the testsuite. +#=fedoratest +Patch053: gdb-runtest-pie-override.patch + +# Workaround PR libc/14166 for inferior calls of strstr. +#=fedoratest: Compatibility with RHELs (unchecked which ones). +Patch054: gdb-glibc-strstr-workaround.patch + +# Include testcase for `Unable to see a variable inside a module (XLF)' (BZ 823789). +#=fedoratest +Patch055: gdb-rhel5.9-testcase-xlf-var-inside-mod.patch + +# Testcase for `Setting solib-absolute-prefix breaks vDSO' (BZ 818343). +#=fedoratest +Patch056: gdb-rhbz-818343-set-solib-absolute-prefix-testcase.patch + +# Import regression test for `gdb/findvar.c:417: internal-error: +# read_var_value: Assertion `frame' failed.' (RH BZ 947564) from RHEL 6.5. +#=fedoratest +Patch057: gdb-rhbz947564-findvar-assertion-frame-failed-testcase.patch + +# Fix 'memory leak in infpy_read_memory()' (RH BZ 1007614) +#=fedoratest +Patch058: 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 +Patch059: gdb-6.6-buildid-locate-misleading-warning-missing-debuginfo-rhbz981154.patch + +# Display Fortran strings in backtraces. +#=fedoratest +Patch060: gdb-fortran-frame-string.patch + +# Testcase for '[SAP] Recursive dlopen causes SAP HANA installer to +# crash.' (RH BZ 1156192). +#=fedoratest +Patch061: gdb-rhbz1156192-recursive-dlopen-test.patch + +# Fix '`catch syscall' doesn't work for parent after `fork' is called' +# (Philippe Waroquiers, RH BZ 1149205). +#=fedoratest +Patch062: 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 +Patch063: gdb-rhbz1186476-internal-error-unqualified-name-re-set-test.patch + +# Test 'info type-printers' Python error (RH BZ 1350436). +#=fedoratest +Patch064: gdb-rhbz1350436-type-printers-error.patch + +# Fix '[ppc64] and [s390x] wrong prologue skip on -O2 -g code' (Jan +# Kratochvil, RH BZ 1084404). +#=fedoratest +Patch065: gdb-rhbz1084404-ppc64-s390x-wrong-prologue-skip-O2-g-3of3.patch + +# Force libncursesw over libncurses to match the includes (RH BZ 1270534). +#=push+jan +Patch066: gdb-fedora-libncursesw.patch + +# Test clflushopt instruction decode (for RH BZ 1262471). +#=fedoratest +Patch067: gdb-opcodes-clflushopt-test.patch + +# [SCL] Skip deprecated .gdb_index warning for Red Hat built files (BZ 953585). +#=push+jan +Patch068: gdb-6.6-buildid-locate-rpm-scl.patch + +# [aarch64] Fix hardware watchpoints (RH BZ 1261564). +#=fedoratest +Patch069: gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch + +# Add messages suggesting more recent RHEL gdbserver (RH BZ 1321114). +#=fedora +Patch070: gdb-container-rh-pkg.patch + +# New test for Python "Cannot locate object file for block" (for RH BZ 1325795). +#=fedoratest +Patch071: gdb-rhbz1325795-framefilters-test.patch + +# [dts+el7] [x86*] Bundle linux_perf.h for libipt (RH BZ 1256513). +#=fedora +Patch072: gdb-linux_perf-bundle.patch + +# Fix gdb-headless /usr/bin/ executables (BZ 1390251). +# +# Also, make /usr/bin/gdb.minimal be the default GDB used, if it's +# present. For rationale, see: +# +# https://fedoraproject.org/wiki/Changes/Minimal_GDB_in_buildroot +#=fedora +Patch073: gdb-libexec-add-index.patch + +# New testcase for: Fix -completion crash (Gary Benson, RH BZ 1398387). +#=fedoratest +Patch074: gdb-rhbz1398387-tab-crash-test.patch + +# [s390x] Backport arch12 instructions decoding (RH BZ 1553104). +# =fedoratest +Patch075: gdb-rhbz1553104-s390x-arch12-test.patch + +# Fix off-by-one error in ada_fold_name.patch (RH BZ 1905996) +# Upstream patch proposal: https://sourceware.org/pipermail/gdb-patches/2020-December/173935.html +# =fedoratest +Patch076: gdb-rhbz1905996-fix-off-by-one-error-in-ada_fold_name.patch + +# Backport fix for libstdc++ assert when performing tab completion +# (RH BZ 1912985). +Patch077: gdb-rhbz1912985-libstdc++-assert.patch + +# Backport fix for frame_id_p assertion failure (RH BZ 1909902). +Patch078: gdb-rhbz1909902-frame_id_p-assert-1.patch + +# Backport patch #2 which fixes a frame_id_p assertion failure (RH BZ 1909902). +Patch079: gdb-rhbz1909902-frame_id_p-assert-2.patch + +# Backport change which fixes gdbserver testing hang on f34 and rawhide. +Patch080: gdb-rhbz1941080-fix-gdbserver-hang.patch + +# Backport "Disable bracketed paste mode in GDB tests" +# (Tom Tromey) +Patch081: testing-custom-inputrc.patch + +# Backport "Save/restore file offset while reading notes in core file" +# (Keith Seitz, RHBZ 1931344) +Patch082: gdb-rhbz1931344-bfd_seek-elf_read_notes.patch + +# [fortran] Backport Andrew Burgess's commit which cleans up +# array/string expression evaluation. +Patch083: gdb-rhbz1964167-fortran-clean-up-array-expression-evaluation.patch + +# [fortran] Backport Andrew Burgess's commit which moves Fortran +# expression handling to f-lang.c. +Patch084: gdb-rhbz1964167-move-fortran-expr-handling.patch + +# [fortran] Backport Andrew Burgess's commit which eliminates undesirable +# whitespace when printing arrays. +Patch085: gdb-rhbz1964167-fortran-whitespace_array.patch + +# [fortran] Backport Andrew Burgess's commit which changes enum +# range_type into a bit field enum. +Patch086: gdb-rhbz1964167-convert-enum-range_type.patch + +# [fortran] Backport Andrew Burgess's commit which renames enum +# range_type to enum range_flag. +Patch087: gdb-rhbz1964167-fortran-range_type-to-range_flag.patch + +# [fortran] Backport Andrew Burgess's commit which adds support +# for array strides in expressions. +Patch088: gdb-rhbz1964167-fortran-array-strides-in-expressions.patch + +# [fortran] Backport Andrew Burgess's commit for Fortran array +# slice support +Patch089: gdb-rhbz1964167-fortran-array-slices-at-prompt.patch + +# [fortran] Backport Simon Marchi's commit which fixes a 32-bit build +# problem in gdb/f-lang.c. +Patch090: gdb-rhbz1964167-fortran-fix-type-format-mismatch-in-f-lang.c.patch + +# Backport of "Exclude debuginfo files from 'outside of ELF segments' +# warning" (Keith Seitz) +Patch091: gdb-rhbz1898252-loadable-section-outside-ELF-segments.patch + +# Backport of "Correct recording of 'store on condition' insns" +# Andreas Arnaz (RH BZ 1903374) +Patch092: gdb-rhbz1903375-s390x-store-on-condition.patch + +# Backport "Fix crash when expanding partial symtabs with DW_TAG_imported_unit" +# (Tom Tromey, gdb/27743) +Patch093: gdb-gdb27743-psymtab-imported-unit.patch + +# Backport "[gdb/server] Don't overwrite fs/gs_base with -m32" +# (Tom de Vries) +Patch094: gdb-dont-overwrite-fsgsbase-m32.patch + +# Backport "Fix gdb.fortran/array-slices.exp with -m32" +# (Tom de Vres) +Patch095: gdb-testsuite26997-fix-array-slices-m32.patch + +# Backport "adjust gdb.python/flexible-array-member.exp expected pattern" +# (Simon Marchi) +Patch096: gdb-flexible-array-member-expected-pattern.patch + +# Backport "gdb: try to load libthread_db only after reading all +# shared libraries when attaching / handling a fork child" +# (Simon Marchi, RH BZ 1971095) +Patch097: gdb-rhbz1971095-libthread_db-update-1of5.patch + +# Backport "libthread_db initialization changes related to upcoming +# glibc-2.34" +# (Kevin Buettner, RH BZ 19710950 +Patch098: gdb-rhbz1971095-libthread_db-update-2of5.patch + +# Backport "testsuite/glib-2.34: Match/consume optional libthread_db +# related output" +# (Kevin Buettner, RH BZ 19710950 +Patch099: gdb-rhbz1971095-libthread_db-update-3of5.patch + +# Backport "print-symbol-loading.exp: Allow libc symbols to be already loaded" +# (Kevin Buettner, RH BZ 1971095) +Patch100: gdb-rhbz1971095-libthread_db-update-4of5.patch + +# Backport "mi-sym-info.exp: Increase timeout for 114-symbol-info-functions" +# (Kevin Buettner, RH BZ 1971095) +Patch101: gdb-rhbz1971095-libthread_db-update-5of5.patch + +# Backport "PowerPC remove 512 bytes region limit if 2nd DAWR is available" +# (Rogerio Alves, RHBZ 1870029) +Patch102: gdb-rhbz1870029-powerpc-remove-region-limit-dawr.patch + +# Backport "displaced stepping across addpcis/lnia" +# (Will Schmidt, RHBZ 1870031) +Patch103: gdb-rhbz1870031-p10-prefixed-insn-1of3.patch + +# Backport "gdb-power10-single-step" +# (Will Schmidt, RHBZ 1870031) +Patch104: gdb-rhbz1870031-p10-prefixed-insn-2of3.patch + +# Backport "Fix build failure for 32-bit targets with..." +# (Luis Machado, RHBZ 1870031) +Patch105: gdb-rhbz1870031-p10-prefixed-insn-3of3.patch + +# IBM Z: Add support for HLASM extended mnemonics +# (Andreas Krebbel, RHBZ 2012819) +Patch106: gdb-rhbz2012819-ibmz-update-1of5.patch + +# IBM Z: Add risbgz and risbgnz extended mnemonics +# (Andreas Krebbel, RHBZ 2012819) +Patch107: gdb-rhbz2012819-ibmz-update-2of5.patch + +# IBM Z: Implement instruction set extensions +# (Andreas Krebbel, RHBZ 2012819) +Patch108: gdb-rhbz2012819-ibmz-update-3of5.patch + +# IBM Z: Remove lpswey parameter +# (Andreas Krebbel, RH BZ 2012819) +Patch109: gdb-rhbz2012819-ibmz-update-4of5.patch + +# IBM Z: Add another arch14 instruction +# (Andreas Krebbel, RHBZ 2012819) +Patch110: gdb-rhbz2012819-ibmz-update-5of5.patch + +# Backport "Add Power 10 PLT instruction patterns" +# (Carl Love, RHBZ 1870017) +Patch111: gdb-rhbz1870017-p10-plt-prologue-skipping.patch + +# Backport "fix logic of find_comp_unit and set_comp_unit" +# (Simon Marchi, RHBZ 2086761) +Patch112: gdb-rhbz2086761-unknown-cfa-rule.patch + +# Backport "Fix assertion failure in copy_type" +# (Tom Tromey, RHBZ2155439) +Patch113: gdb-rhbz2155439-assert-failure-copy_type.patch + +# Backport "[gdb/testsuite] Fix PR20630 regression test in gdb.base/printcmds.exp" +# (Tom de Vries) +Patch114: gdb-fix-gdb.base-printcmds-s390x-regressions.patch + +# Backport "[gdb/breakpoint] Fix assert in jit_event_handler" +# (Tom de Vries, RHBZ2130624) +Patch115: gdb-rhbz-2130624-assert_in_jit_event_handler.patch + +# Backport libiberty: prevent buffer overflow when decoding user input +# (Luís Ferreira, RHBZ2132600) +Patch116: libiberty-rhbz-2132600-prevent-buffer-overflow.patch + +# Backport: Fix crash in Fortran code +# (Tom Tromey, RHEL-7328) +Patch117: gdb-rhel-7328-fix-fortran-28801.patch + +# Backport "libiberty: Fix infinite recursion in rust demangler." +# (Nick Clifton) +Patch118: libiberty-infinite-recursion-fix-1-of-3.patch + +# Backport Add a recursion limit to the demangle_const function in the Rust demangler. +# (Nick Clifton, RHEL-4234) +Patch119: libiberty-infinite-recursion-fix-2-of-3.patch + +# Backport Fix typo in recent code to add stack recursion limit to the Rust demangler. +# (Nick Clifton) +Patch120: libiberty-infinite-recursion-fix-3-of-3.patch + +# Backport "gdbsupport: make gdb_abspath return an std::string" +# (Simon Marchi) +Patch121: gdb-find_and_open_source-empty-string-ub-1of4.patch + +# Backport "gdbsupport: add path_join function" +# (Simon Marchi) +Patch122: gdb-find_and_open_source-empty-string-ub-2of4.patch + +# Backport "Fix undefined behaviour dereferencing empty string" +# (Magne Hov, RHEL-17631) +Patch123: gdb-find_and_open_source-empty-string-ub-3of4.patch + +# Backport "gdbsupport: change path_join parameter to +# array_view" +# (Simon Marchi) +Patch124: gdb-find_and_open_source-empty-string-ub-4of4.patch + diff --git a/SOURCES/_gdb.spec.patch.include b/SOURCES/_gdb.spec.patch.include new file mode 100644 index 0000000..97f12c4 --- /dev/null +++ b/SOURCES/_gdb.spec.patch.include @@ -0,0 +1,124 @@ +%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 diff --git a/SOURCES/gdb-6.3-attach-see-vdso-test.patch b/SOURCES/gdb-6.3-attach-see-vdso-test.patch new file mode 100644 index 0000000..daba42f --- /dev/null +++ b/SOURCES/gdb-6.3-attach-see-vdso-test.patch @@ -0,0 +1,120 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +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 ++ ++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,77 @@ ++# 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 . ++ ++# This test only works on Linux ++if { ![istarget "*-*-linux-gnu*"] } { ++ return 0 ++} ++ ++if {[use_gdb_stub]} { ++ untested "skipping test because of use_gdb_stub" ++ return -1 ++} ++ ++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}" diff --git a/SOURCES/gdb-6.3-bz140532-ppc-unwinding-test.patch b/SOURCES/gdb-6.3-bz140532-ppc-unwinding-test.patch new file mode 100644 index 0000000..2e38a26 --- /dev/null +++ b/SOURCES/gdb-6.3-bz140532-ppc-unwinding-test.patch @@ -0,0 +1,320 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +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 ++ ++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 ++ ++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 + } diff --git a/SOURCES/gdb-6.3-bz202689-exec-from-pthread-test.patch b/SOURCES/gdb-6.3-bz202689-exec-from-pthread-test.patch new file mode 100644 index 0000000..74684dd --- /dev/null +++ b/SOURCES/gdb-6.3-bz202689-exec-from-pthread-test.patch @@ -0,0 +1,109 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Jan Kratochvil +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 + + * 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 ++#include ++#include ++#include ++#include ++ ++ ++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" ++ } ++} diff --git a/SOURCES/gdb-6.3-focus-cmd-prev-test.patch b/SOURCES/gdb-6.3-focus-cmd-prev-test.patch new file mode 100644 index 0000000..27c85f1 --- /dev/null +++ b/SOURCES/gdb-6.3-focus-cmd-prev-test.patch @@ -0,0 +1,53 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +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 ++ } ++} diff --git a/SOURCES/gdb-6.3-gstack-20050411.patch b/SOURCES/gdb-6.3-gstack-20050411.patch new file mode 100644 index 0000000..35c2de1 --- /dev/null +++ b/SOURCES/gdb-6.3-gstack-20050411.patch @@ -0,0 +1,258 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Andrew Cagney +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 + + * Makefile.in (uninstall-gstack, install-gstack): New rules, add + to install and uninstall. + * gstack.sh, gstack.1: New files. + +diff --git a/gdb/Makefile.in b/gdb/Makefile.in +--- a/gdb/Makefile.in ++++ b/gdb/Makefile.in +@@ -1726,7 +1726,7 @@ info install-info clean-info dvi pdf install-pdf html install-html: force + install: all + @$(MAKE) $(FLAGS_TO_PASS) install-only + +-install-only: $(CONFIG_INSTALL) ++install-only: install-gstack $(CONFIG_INSTALL) + transformed_name=`t='$(program_transform_name)'; \ + echo gdb | sed -e "$$t"` ; \ + if test "x$$transformed_name" = x; then \ +@@ -1775,7 +1775,25 @@ install-guile: + install-python: + $(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(GDB_DATADIR)/python/gdb + +-uninstall: force $(CONFIG_UNINSTALL) ++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 \ +@@ -1798,6 +1816,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` " 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 <&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 . */ ++ ++#include ++#include ++#include ++ ++void ++func (void) ++{ ++ const char msg[] = "looping\n"; ++ ++ /* Use the most simple notification not to get caught by attach on exiting ++ the function. */ ++ write (1, msg, strlen (msg)); ++ ++ for (;;); ++} ++ ++int ++main (void) ++{ ++ alarm (60); ++ nice (100); ++ ++ func (); ++ ++ return 0; ++} +diff --git a/gdb/testsuite/gdb.base/gstack.exp b/gdb/testsuite/gdb.base/gstack.exp +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.base/gstack.exp +@@ -0,0 +1,84 @@ ++# Copyright (C) 2012 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++ ++set testfile gstack ++set executable ${testfile} ++set binfile [standard_output_file $executable] ++if {[build_executable ${testfile} ${executable} "" {debug}] == -1} { ++ return -1 ++} ++ ++set test "spawn inferior" ++set command "${binfile}" ++set res [remote_spawn host $command]; ++if { $res < 0 || $res == "" } { ++ perror "Spawning $command failed." ++ fail $test ++ return ++} ++ ++# The spawn id of the test inferior. ++set test_spawn_id $res ++ ++set use_gdb_stub 1 ++set pid [exp_pid -i $res] ++gdb_expect { ++ -re "looping\r\n" { ++ pass $test ++ } ++ eof { ++ fail "$test (eof)" ++ return ++ } ++ timeout { ++ fail "$test (timeout)" ++ return ++ } ++} ++ ++# Testcase uses the most simple notification not to get caught by attach on ++# exiting the function. Still we could retry the gstack command if we fail. ++ ++set test "spawn gstack" ++set command "sh -c GDB=$GDB\\ GDBARGS=-data-directory\\\\\\ $BUILD_DATA_DIRECTORY\\ sh\\ ${srcdir}/../gstack.sh\\ $pid\\;echo\\ GSTACK-END" ++set res [remote_spawn host $command]; ++if { $res < 0 || $res == "" } { ++ perror "Spawning $command failed." ++ fail $test ++} ++ ++set gdb_spawn_id $res ++ ++gdb_test_multiple "" $test { ++ -re "^#0 +(0x\[0-9a-f\]+ in )?\\.?func \\(\\) at \[^\r\n\]*\r\n#1 +0x\[0-9a-f\]+ in \\.?main \\(\\) at \[^\r\n\]*\r\nGSTACK-END\r\n\$" { ++ pass $test ++ } ++} ++ ++gdb_test_multiple "" "gstack exits" { ++ eof { ++ set result [wait -i $gdb_spawn_id] ++ verbose $result ++ ++ gdb_assert { [lindex $result 2] == 0 } "gstack exits with no error" ++ gdb_assert { [lindex $result 3] == 0 } "gstack's exit status is 0" ++ ++ remote_close host ++ clear_gdb_spawn_id ++ } ++} ++ ++# Kill the test inferior. ++kill_wait_spawned_process $test_spawn_id diff --git a/SOURCES/gdb-6.3-inferior-notification-20050721.patch b/SOURCES/gdb-6.3-inferior-notification-20050721.patch new file mode 100644 index 0000000..894ef79 --- /dev/null +++ b/SOURCES/gdb-6.3-inferior-notification-20050721.patch @@ -0,0 +1,324 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Jeff Johnston +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 + + * 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 + + * 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 ++ ++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,246 @@ ++# 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 {[use_gdb_stub]} { ++ untested "skipping test because of use_gdb_stub" ++ return -1 ++} ++ ++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 "-iex \"set height 0\" --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 "-iex \"set height 0\" --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 ++#include ++#include ++ ++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); ++} diff --git a/SOURCES/gdb-6.3-inheritancetest-20050726.patch b/SOURCES/gdb-6.3-inheritancetest-20050726.patch new file mode 100644 index 0000000..6e12c82 --- /dev/null +++ b/SOURCES/gdb-6.3-inheritancetest-20050726.patch @@ -0,0 +1,160 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Jeff Johnston +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 + + * 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,31 @@ ++#include "b146835.h" ++#include ++ ++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) {} diff --git a/SOURCES/gdb-6.3-mapping-zero-inode-test.patch b/SOURCES/gdb-6.3-mapping-zero-inode-test.patch new file mode 100644 index 0000000..32b62d5 --- /dev/null +++ b/SOURCES/gdb-6.3-mapping-zero-inode-test.patch @@ -0,0 +1,247 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +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 ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++/* 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 ++ } ++} diff --git a/SOURCES/gdb-6.3-rh-testversion-20041202.patch b/SOURCES/gdb-6.3-rh-testversion-20041202.patch new file mode 100644 index 0000000..7b0ed45 --- /dev/null +++ b/SOURCES/gdb-6.3-rh-testversion-20041202.patch @@ -0,0 +1,38 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Elena Zannoni +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 + + * 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 +diff --git a/gdb/top.c b/gdb/top.c +--- a/gdb/top.c ++++ b/gdb/top.c +@@ -2163,7 +2163,7 @@ init_gdb_version_vars (void) + struct internalvar *major_version_var = create_internalvar ("_gdb_major"); + struct internalvar *minor_version_var = create_internalvar ("_gdb_minor"); + int vmajor = 0, vminor = 0, vrevision = 0; +- sscanf (version, "%d.%d.%d", &vmajor, &vminor, &vrevision); ++ sscanf (version, "Red Hat Enterprise Linux %d.%d.%d", &vmajor, &vminor, &vrevision); + set_internalvar_integer (major_version_var, vmajor); + set_internalvar_integer (minor_version_var, vminor + (vrevision > 0)); + } diff --git a/SOURCES/gdb-6.3-test-dtorfix-20050121.patch b/SOURCES/gdb-6.3-test-dtorfix-20050121.patch new file mode 100644 index 0000000..01c0d56 --- /dev/null +++ b/SOURCES/gdb-6.3-test-dtorfix-20050121.patch @@ -0,0 +1,247 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +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" diff --git a/SOURCES/gdb-6.3-test-movedir-20050125.patch b/SOURCES/gdb-6.3-test-movedir-20050125.patch new file mode 100644 index 0000000..31fbc60 --- /dev/null +++ b/SOURCES/gdb-6.3-test-movedir-20050125.patch @@ -0,0 +1,101 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Elena Zannoni +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 + + * 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,9 @@ ++#include ++#include ++#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,6 @@ ++#include ++ ++void other() { ++ const char* ostring = "other"; ++ printf ("%s\n", ostring);; ++} diff --git a/SOURCES/gdb-6.3-threaded-watchpoints2-20050225.patch b/SOURCES/gdb-6.3-threaded-watchpoints2-20050225.patch new file mode 100644 index 0000000..42b5260 --- /dev/null +++ b/SOURCES/gdb-6.3-threaded-watchpoints2-20050225.patch @@ -0,0 +1,253 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Jeff Johnston +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 + + * 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,65 @@ ++/* 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 ++#include ++#include ++#include ++ ++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].*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].*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 ++} diff --git a/SOURCES/gdb-6.5-BEA-testsuite.patch b/SOURCES/gdb-6.5-BEA-testsuite.patch new file mode 100644 index 0000000..a15cec2 --- /dev/null +++ b/SOURCES/gdb-6.5-BEA-testsuite.patch @@ -0,0 +1,938 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +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 ++ * #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 ++ * #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 ++ * #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 ++ * #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 ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#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 \ [\ \] ++ 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 < $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 < /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 < $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 < $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 \ ++ 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 < $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 < /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 < $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 < $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 diff --git a/SOURCES/gdb-6.5-bz109921-DW_AT_decl_file-test.patch b/SOURCES/gdb-6.5-bz109921-DW_AT_decl_file-test.patch new file mode 100644 index 0000000..8d03e3f --- /dev/null +++ b/SOURCES/gdb-6.5-bz109921-DW_AT_decl_file-test.patch @@ -0,0 +1,134 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Jan Kratochvil +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 + Daniel Jacobowitz + + * gdb.base/included.c, gdb.base/included.exp, + gdb.base/included.h: New files. + +------------------------------------------------------------------------------ + +2007-01-09 Jan Kratochvil + + * 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; diff --git a/SOURCES/gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch b/SOURCES/gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch new file mode 100644 index 0000000..5cdf65f --- /dev/null +++ b/SOURCES/gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch @@ -0,0 +1,264 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Jan Kratochvil +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 + + 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 + + * ./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 +@@ -1210,6 +1210,10 @@ print_command_1 (const char *args, int voidprint) + + if (exp != nullptr && *exp) + { ++ /* '*((int *(*) (void)) __errno_location) ()' is incompatible with ++ function descriptors. */ ++ if (target_has_execution && strcmp (exp, "errno") == 0) ++ exp = "*(*(int *(*)(void)) __errno_location) ()"; + expression_up expr = parse_expression (exp); + val = evaluate_expression (expr.get ()); + } +diff --git a/gdb/testsuite/gdb.dwarf2/dw2-errno.c b/gdb/testsuite/gdb.dwarf2/dw2-errno.c +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.dwarf2/dw2-errno.c +@@ -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 . ++ ++ Please email any bugs, comments, and/or additions to this file to: ++ bug-gdb@prep.ai.mit.edu */ ++ ++#include ++ ++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 . ++ ++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 . ++ ++ Please email any bugs, comments, and/or additions to this file to: ++ bug-gdb@prep.ai.mit.edu */ ++ ++#include ++ ++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 . ++ ++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? diff --git a/SOURCES/gdb-6.5-bz218379-solib-trampoline-lookup-lock-fix.patch b/SOURCES/gdb-6.5-bz218379-solib-trampoline-lookup-lock-fix.patch new file mode 100644 index 0000000..54c1a1e --- /dev/null +++ b/SOURCES/gdb-6.5-bz218379-solib-trampoline-lookup-lock-fix.patch @@ -0,0 +1,27 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +Date: Fri, 27 Oct 2017 21:07:50 +0200 +Subject: gdb-6.5-bz218379-solib-trampoline-lookup-lock-fix.patch + +;; Fix lockup on trampoline vs. its function lookup; unreproducible (BZ 218379). +;;=fedora + +https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=218379 + +diff --git a/gdb/symtab.c b/gdb/symtab.c +--- a/gdb/symtab.c ++++ b/gdb/symtab.c +@@ -3169,6 +3169,13 @@ find_pc_sect_line (CORE_ADDR pc, struct obj_section *section, int notcurrent) + msymbol->linkage_name ()); */ + ; + /* fall through */ ++ /* `msymbol' trampoline may be located before its .text symbol ++ but this text symbol may be the address we were looking for. ++ Avoid `find_pc_sect_line'<->`find_pc_line' infinite loop. ++ Red Hat Bug 218379. */ ++ else if (BMSYMBOL_VALUE_ADDRESS (mfunsym) == pc) ++ warning ("In stub for %s (0x%s); interlocked, please submit the binary to http://bugzilla.redhat.com", msymbol.minsym->linkage_name (), paddress (target_gdbarch (), pc)); ++ /* fall through */ + else + { + /* Detect an obvious case of infinite recursion. If this diff --git a/SOURCES/gdb-6.5-bz243845-stale-testing-zombie-test.patch b/SOURCES/gdb-6.5-bz243845-stale-testing-zombie-test.patch new file mode 100644 index 0000000..2d62949 --- /dev/null +++ b/SOURCES/gdb-6.5-bz243845-stale-testing-zombie-test.patch @@ -0,0 +1,89 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +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,76 @@ ++# 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 {[use_gdb_stub]} { ++ untested "skipping test because of use_gdb_stub" ++ return -1 ++} ++ ++# 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 ++} diff --git a/SOURCES/gdb-6.5-gcore-buffer-limit-test.patch b/SOURCES/gdb-6.5-gcore-buffer-limit-test.patch new file mode 100644 index 0000000..07ba1e9 --- /dev/null +++ b/SOURCES/gdb-6.5-gcore-buffer-limit-test.patch @@ -0,0 +1,154 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +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 ++#include ++ ++#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,99 @@ ++# 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 {[use_gdb_stub]} { ++ untested "skipping test because of use_gdb_stub" ++ return -1 ++} ++ ++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 diff --git a/SOURCES/gdb-6.5-ia64-libunwind-leak-test.patch b/SOURCES/gdb-6.5-ia64-libunwind-leak-test.patch new file mode 100644 index 0000000..6efdca9 --- /dev/null +++ b/SOURCES/gdb-6.5-ia64-libunwind-leak-test.patch @@ -0,0 +1,135 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +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 ++ ++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,88 @@ ++# Copyright 2007 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 2 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program; if not, write to the Free Software ++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++ ++if {[use_gdb_stub]} { ++ untested "skipping test because of use_gdb_stub" ++ return -1 ++} ++ ++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 ++ } ++} diff --git a/SOURCES/gdb-6.5-last-address-space-byte-test.patch b/SOURCES/gdb-6.5-last-address-space-byte-test.patch new file mode 100644 index 0000000..e99d811 --- /dev/null +++ b/SOURCES/gdb-6.5-last-address-space-byte-test.patch @@ -0,0 +1,62 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +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} diff --git a/SOURCES/gdb-6.5-missed-trap-on-step-test.patch b/SOURCES/gdb-6.5-missed-trap-on-step-test.patch new file mode 100644 index 0000000..0ad8ad1 --- /dev/null +++ b/SOURCES/gdb-6.5-missed-trap-on-step-test.patch @@ -0,0 +1,95 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +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" diff --git a/SOURCES/gdb-6.5-readline-long-line-crash-test.patch b/SOURCES/gdb-6.5-readline-long-line-crash-test.patch new file mode 100644 index 0000000..087f916 --- /dev/null +++ b/SOURCES/gdb-6.5-readline-long-line-crash-test.patch @@ -0,0 +1,111 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +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,96 @@ ++# 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 ++ ++# This file is part of the gdb testsuite. ++ ++# ++# Tests for readline buffer overflow. ++# ++ ++if $tracelevel { ++ strace $tracelevel ++} ++ ++global env ++ ++save_vars { env(GDBHISTFILE) env(HISTSIZE) TERM timeout } { ++ # The arrow key test relies on the standard VT100 bindings, so ++ # make sure that an appropriate terminal is selected. The same ++ # bug doesn't show up if we use ^P / ^N instead. ++ setenv TERM vt100 ++ ++ set timeout 600 ++ ++ 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" ++} diff --git a/SOURCES/gdb-6.5-section-num-fixup-test.patch b/SOURCES/gdb-6.5-section-num-fixup-test.patch new file mode 100644 index 0000000..2fa3995 --- /dev/null +++ b/SOURCES/gdb-6.5-section-num-fixup-test.patch @@ -0,0 +1,127 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +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,56 @@ ++# 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 {[use_gdb_stub]} { ++ untested "skipping test because of use_gdb_stub" ++ return -1 ++} ++ ++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" diff --git a/SOURCES/gdb-6.5-sharedlibrary-path.patch b/SOURCES/gdb-6.5-sharedlibrary-path.patch new file mode 100644 index 0000000..360e5d3 --- /dev/null +++ b/SOURCES/gdb-6.5-sharedlibrary-path.patch @@ -0,0 +1,193 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Jan Kratochvil +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 + + * solib-svr4.c (svr4_fetch_objfile_link_map): Match even absolute + requested pathnames to the internal loaded relative pathnames. + +2007-10-16 Jan Kratochvil + + Port to GDB-6.7. + +2008-02-27 Jan Kratochvil + + 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,31 @@ ++/* 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 ++ ++extern __thread int var; ++ ++int main() ++{ ++ /* Ensure we link against pthreads even with --as-needed. */ ++ pthread_testcancel(); ++ return var; ++} +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,94 @@ ++# Copyright 2006 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 2 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program; if not, write to the Free Software ++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++ ++# This test uses gdb_exit and gdb_start, which are not supported ++# on non-extended-remote sessions. ++if {[use_gdb_stub]} { ++ untested "skipping test because of stub" ++ return 0 ++} ++ ++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" ++} diff --git a/SOURCES/gdb-6.6-buildid-locate-misleading-warning-missing-debuginfo-rhbz981154.patch b/SOURCES/gdb-6.6-buildid-locate-misleading-warning-missing-debuginfo-rhbz981154.patch new file mode 100644 index 0000000..985cb6a --- /dev/null +++ b/SOURCES/gdb-6.6-buildid-locate-misleading-warning-missing-debuginfo-rhbz981154.patch @@ -0,0 +1,129 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +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 : + + 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 + 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/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 . ++ ++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}]" diff --git a/SOURCES/gdb-6.6-buildid-locate-rpm-librpm-workaround.patch b/SOURCES/gdb-6.6-buildid-locate-rpm-librpm-workaround.patch new file mode 100644 index 0000000..c86ec6b --- /dev/null +++ b/SOURCES/gdb-6.6-buildid-locate-rpm-librpm-workaround.patch @@ -0,0 +1,42 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +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 +@@ -708,6 +708,19 @@ build_id_to_filename (const struct bfd_build_id *build_id, char **link_return) + #include + #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; + }; diff --git a/SOURCES/gdb-6.6-buildid-locate-rpm-scl.patch b/SOURCES/gdb-6.6-buildid-locate-rpm-scl.patch new file mode 100644 index 0000000..81056cc --- /dev/null +++ b/SOURCES/gdb-6.6-buildid-locate-rpm-scl.patch @@ -0,0 +1,128 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +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 +@@ -742,7 +742,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; +@@ -849,7 +853,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; +@@ -967,6 +975,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); + } +@@ -976,6 +1015,20 @@ missing_rpm_enlist (const char *filename) + return count; + } + ++#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); ++} ++#endif ++ + static bool + missing_rpm_list_compar (const char *ap, const char *bp) + { +diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c +--- a/gdb/dwarf2/read.c ++++ b/gdb/dwarf2/read.c +@@ -3034,6 +3034,16 @@ read_gdb_index_from_buffer (const char *filename, + "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) + { +@@ -3045,6 +3055,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), diff --git a/SOURCES/gdb-6.6-buildid-locate-rpm.patch b/SOURCES/gdb-6.6-buildid-locate-rpm.patch new file mode 100644 index 0000000..bf783da --- /dev/null +++ b/SOURCES/gdb-6.6-buildid-locate-rpm.patch @@ -0,0 +1,1499 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +Date: Fri, 27 Oct 2017 21:07:50 +0200 +Subject: gdb-6.6-buildid-locate-rpm.patch + +;;=push+jan + +diff --git a/gdb/aclocal.m4 b/gdb/aclocal.m4 +--- a/gdb/aclocal.m4 ++++ b/gdb/aclocal.m4 +@@ -11,7 +11,223 @@ + # even the implied warranty of MERCHANTABILITY or FITNESS FOR A + # PARTICULAR PURPOSE. + ++# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- ++# serial 1 (pkg-config-0.24) ++# ++# Copyright © 2004 Scott James Remnant . ++# ++# 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. ++# ++# As a special exception to the GNU General Public License, if you ++# distribute this file as part of a program that contains a ++# configuration script generated by Autoconf, you may include it under ++# the same distribution terms that you use for the rest of that program. ++ ++# PKG_PROG_PKG_CONFIG([MIN-VERSION]) ++# ---------------------------------- ++AC_DEFUN([PKG_PROG_PKG_CONFIG], ++[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) ++m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) ++m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) ++AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) ++AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) ++AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) ++ ++if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then ++ AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) ++fi ++if test -n "$PKG_CONFIG"; then ++ _pkg_min_version=m4_default([$1], [0.9.0]) ++ AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) ++ if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then ++ AC_MSG_RESULT([yes]) ++ else ++ AC_MSG_RESULT([no]) ++ PKG_CONFIG="" ++ fi ++fi[]dnl ++])# PKG_PROG_PKG_CONFIG ++ ++# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) ++# ++# Check to see whether a particular set of modules exists. Similar ++# to PKG_CHECK_MODULES(), but does not set variables or print errors. ++# ++# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) ++# only at the first occurence in configure.ac, so if the first place ++# it's called might be skipped (such as if it is within an "if", you ++# have to call PKG_CHECK_EXISTS manually ++# -------------------------------------------------------------- ++AC_DEFUN([PKG_CHECK_EXISTS], ++[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl ++if test -n "$PKG_CONFIG" && \ ++ AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then ++ m4_default([$2], [:]) ++m4_ifvaln([$3], [else ++ $3])dnl ++fi]) ++ ++# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) ++# --------------------------------------------- ++m4_define([_PKG_CONFIG], ++[if test -n "$$1"; then ++ pkg_cv_[]$1="$$1" ++ elif test -n "$PKG_CONFIG"; then ++ PKG_CHECK_EXISTS([$3], ++ [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` ++ test "x$?" != "x0" && pkg_failed=yes ], ++ [pkg_failed=yes]) ++ else ++ pkg_failed=untried ++fi[]dnl ++])# _PKG_CONFIG ++ ++# _PKG_SHORT_ERRORS_SUPPORTED ++# ----------------------------- ++AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], ++[AC_REQUIRE([PKG_PROG_PKG_CONFIG]) ++if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then ++ _pkg_short_errors_supported=yes ++else ++ _pkg_short_errors_supported=no ++fi[]dnl ++])# _PKG_SHORT_ERRORS_SUPPORTED ++ ++ ++# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], ++# [ACTION-IF-NOT-FOUND]) ++# ++# ++# Note that if there is a possibility the first call to ++# PKG_CHECK_MODULES might not happen, you should be sure to include an ++# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac ++# ++# ++# -------------------------------------------------------------- ++AC_DEFUN([PKG_CHECK_MODULES], ++[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl ++AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl ++AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl ++ ++pkg_failed=no ++AC_MSG_CHECKING([for $1]) ++ ++_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) ++_PKG_CONFIG([$1][_LIBS], [libs], [$2]) ++ ++m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS ++and $1[]_LIBS to avoid the need to call pkg-config. ++See the pkg-config man page for more details.]) ++ ++if test $pkg_failed = yes; then ++ AC_MSG_RESULT([no]) ++ _PKG_SHORT_ERRORS_SUPPORTED ++ if test $_pkg_short_errors_supported = yes; then ++ $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` ++ else ++ $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` ++ fi ++ # Put the nasty error message in config.log where it belongs ++ echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD ++ ++ m4_default([$4], [AC_MSG_ERROR( ++[Package requirements ($2) were not met: ++ ++$$1_PKG_ERRORS ++ ++Consider adjusting the PKG_CONFIG_PATH environment variable if you ++installed software in a non-standard prefix. ++ ++_PKG_TEXT])[]dnl ++ ]) ++elif test $pkg_failed = untried; then ++ AC_MSG_RESULT([no]) ++ m4_default([$4], [AC_MSG_FAILURE( ++[The pkg-config script could not be found or is too old. Make sure it ++is in your PATH or set the PKG_CONFIG environment variable to the full ++path to pkg-config. ++ ++_PKG_TEXT ++ ++To get pkg-config, see .])[]dnl ++ ]) ++else ++ $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS ++ $1[]_LIBS=$pkg_cv_[]$1[]_LIBS ++ AC_MSG_RESULT([yes]) ++ $3 ++fi[]dnl ++])# PKG_CHECK_MODULES ++ ++ ++# PKG_INSTALLDIR(DIRECTORY) ++# ------------------------- ++# Substitutes the variable pkgconfigdir as the location where a module ++# should install pkg-config .pc files. By default the directory is ++# $libdir/pkgconfig, but the default can be changed by passing ++# DIRECTORY. The user can override through the --with-pkgconfigdir ++# parameter. ++AC_DEFUN([PKG_INSTALLDIR], ++[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])]) ++m4_pushdef([pkg_description], ++ [pkg-config installation directory @<:@]pkg_default[@:>@]) ++AC_ARG_WITH([pkgconfigdir], ++ [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],, ++ [with_pkgconfigdir=]pkg_default) ++AC_SUBST([pkgconfigdir], [$with_pkgconfigdir]) ++m4_popdef([pkg_default]) ++m4_popdef([pkg_description]) ++]) dnl PKG_INSTALLDIR ++ ++ ++# PKG_NOARCH_INSTALLDIR(DIRECTORY) ++# ------------------------- ++# Substitutes the variable noarch_pkgconfigdir as the location where a ++# module should install arch-independent pkg-config .pc files. By ++# default the directory is $datadir/pkgconfig, but the default can be ++# changed by passing DIRECTORY. The user can override through the ++# --with-noarch-pkgconfigdir parameter. ++AC_DEFUN([PKG_NOARCH_INSTALLDIR], ++[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])]) ++m4_pushdef([pkg_description], ++ [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@]) ++AC_ARG_WITH([noarch-pkgconfigdir], ++ [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],, ++ [with_noarch_pkgconfigdir=]pkg_default) ++AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir]) ++m4_popdef([pkg_default]) ++m4_popdef([pkg_description]) ++]) dnl PKG_NOARCH_INSTALLDIR ++ ++ ++# PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE, ++# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) ++# ------------------------------------------- ++# Retrieves the value of the pkg-config variable for the given module. ++AC_DEFUN([PKG_CHECK_VAR], ++[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl ++AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl ++ ++_PKG_CONFIG([$1], [variable="][$3]["], [$2]) ++AS_VAR_COPY([$1], [pkg_cv_][$1]) ++ ++AS_VAR_IF([$1], [""], [$5], [$4])dnl ++])# PKG_CHECK_VAR ++ + m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) ++ + # AM_AUX_DIR_EXPAND -*- Autoconf -*- + + # Copyright (C) 2001-2017 Free Software Foundation, Inc. +diff --git a/gdb/build-id.c b/gdb/build-id.c +--- a/gdb/build-id.c ++++ b/gdb/build-id.c +@@ -33,6 +33,7 @@ + #include "gdb_bfd.h" + #include "gdbcmd.h" + #include "gdbcore.h" ++#include "inferior.h" + #include "objfiles.h" + #include "observable.h" + #include "symfile.h" +@@ -697,8 +698,374 @@ build_id_to_filename (const struct bfd_build_id *build_id, char **link_return) + return result; + } + ++#ifdef HAVE_LIBRPM ++ ++#include ++#include ++#include ++#include ++#ifdef DLOPEN_LIBRPM ++#include ++#endif ++ ++/* This MISSING_RPM_HASH tracker is used to collect all the missing rpm files ++ and avoid their duplicities during a single inferior run. */ ++ ++static struct htab *missing_rpm_hash; ++ ++/* This MISSING_RPM_LIST tracker is used to collect and print as a single line ++ all the rpms right before the nearest GDB prompt. It gets cleared after ++ each such print (it is questionable if we should clear it after the print). ++ */ ++ ++struct missing_rpm ++ { ++ struct missing_rpm *next; ++ char rpm[1]; ++ }; ++static struct missing_rpm *missing_rpm_list; ++static int missing_rpm_list_entries; ++ ++/* Returns the count of newly added rpms. */ ++ ++static int ++missing_rpm_enlist (const char *filename) ++{ ++ static int rpm_init_done = 0; ++ rpmts ts; ++ rpmdbMatchIterator mi; ++ int count = 0; ++ ++#ifdef DLOPEN_LIBRPM ++ /* Duplicate here the declarations to verify they match. The same sanity ++ check is present also in `configure.ac'. */ ++ extern char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg); ++ static char *(*headerFormat_p) (Header h, const char * fmt, errmsg_t *errmsg); ++ extern int rpmReadConfigFiles(const char * file, const char * target); ++ static int (*rpmReadConfigFiles_p) (const char * file, const char * target); ++ extern rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi); ++ static rpmdbMatchIterator (*rpmdbFreeIterator_p) (rpmdbMatchIterator mi); ++ extern Header rpmdbNextIterator(rpmdbMatchIterator mi); ++ static Header (*rpmdbNextIterator_p) (rpmdbMatchIterator mi); ++ extern rpmts rpmtsCreate(void); ++ static rpmts (*rpmtsCreate_p) (void); ++ extern rpmts rpmtsFree(rpmts ts); ++ static rpmts (*rpmtsFree_p) (rpmts ts); ++ extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag, ++ const void * keyp, size_t keylen); ++ static rpmdbMatchIterator (*rpmtsInitIterator_p) (const rpmts ts, ++ rpmTag rpmtag, ++ const void *keyp, ++ size_t keylen); ++#else /* !DLOPEN_LIBRPM */ ++# define headerFormat_p headerFormat ++# define rpmReadConfigFiles_p rpmReadConfigFiles ++# define rpmdbFreeIterator_p rpmdbFreeIterator ++# define rpmdbNextIterator_p rpmdbNextIterator ++# define rpmtsCreate_p rpmtsCreate ++# define rpmtsFree_p rpmtsFree ++# define rpmtsInitIterator_p rpmtsInitIterator ++#endif /* !DLOPEN_LIBRPM */ ++ ++ gdb_assert (filename != NULL); ++ ++ if (strcmp (filename, BUILD_ID_MAIN_EXECUTABLE_FILENAME) == 0) ++ return 0; ++ ++ if (is_target_filename (filename)) ++ return 0; ++ ++ if (filename[0] != '/') ++ { ++ warning (_("Ignoring non-absolute filename: <%s>"), filename); ++ return 0; ++ } ++ ++ if (!rpm_init_done) ++ { ++ static int init_tried; ++ ++ /* Already failed the initialization before? */ ++ if (init_tried) ++ return 0; ++ init_tried = 1; ++ ++#ifdef DLOPEN_LIBRPM ++ { ++ void *h; ++ ++ h = dlopen (DLOPEN_LIBRPM, RTLD_LAZY); ++ if (!h) ++ { ++ warning (_("Unable to open \"%s\" (%s), " ++ "missing debuginfos notifications will not be displayed"), ++ DLOPEN_LIBRPM, dlerror ()); ++ return 0; ++ } ++ ++ if (!((headerFormat_p = (char *(*) (Header h, const char * fmt, errmsg_t *errmsg)) dlsym (h, "headerFormat")) ++ && (rpmReadConfigFiles_p = (int (*) (const char * file, const char * target)) dlsym (h, "rpmReadConfigFiles")) ++ && (rpmdbFreeIterator_p = (rpmdbMatchIterator (*) (rpmdbMatchIterator mi)) dlsym (h, "rpmdbFreeIterator")) ++ && (rpmdbNextIterator_p = (Header (*) (rpmdbMatchIterator mi)) dlsym (h, "rpmdbNextIterator")) ++ && (rpmtsCreate_p = (rpmts (*) (void)) dlsym (h, "rpmtsCreate")) ++ && (rpmtsFree_p = (rpmts (*) (rpmts ts)) dlsym (h, "rpmtsFree")) ++ && (rpmtsInitIterator_p = (rpmdbMatchIterator (*) (const rpmts ts, rpmTag rpmtag, const void *keyp, size_t keylen)) dlsym (h, "rpmtsInitIterator")))) ++ { ++ warning (_("Opened library \"%s\" is incompatible (%s), " ++ "missing debuginfos notifications will not be displayed"), ++ DLOPEN_LIBRPM, dlerror ()); ++ if (dlclose (h)) ++ warning (_("Error closing library \"%s\": %s\n"), DLOPEN_LIBRPM, ++ dlerror ()); ++ return 0; ++ } ++ } ++#endif /* DLOPEN_LIBRPM */ ++ ++ if (rpmReadConfigFiles_p (NULL, NULL) != 0) ++ { ++ warning (_("Error reading the rpm configuration files")); ++ return 0; ++ } ++ ++ rpm_init_done = 1; ++ } ++ ++ ts = rpmtsCreate_p (); ++ ++ mi = rpmtsInitIterator_p (ts, RPMTAG_BASENAMES, filename, 0); ++ if (mi != NULL) ++ { ++ for (;;) ++ { ++ Header h; ++ char *debuginfo, **slot, *s, *s2; ++ errmsg_t err; ++ size_t srcrpmlen = sizeof (".src.rpm") - 1; ++ size_t debuginfolen = sizeof ("-debuginfo") - 1; ++ rpmdbMatchIterator mi_debuginfo; ++ ++ h = rpmdbNextIterator_p (mi); ++ if (h == NULL) ++ break; ++ ++ /* Verify the debuginfo file is not already installed. */ ++ ++ debuginfo = headerFormat_p (h, "%{sourcerpm}-debuginfo.%{arch}", ++ &err); ++ if (!debuginfo) ++ { ++ warning (_("Error querying the rpm file `%s': %s"), filename, ++ err); ++ continue; ++ } ++ /* s = `.src.rpm-debuginfo.%{arch}' */ ++ s = strrchr (debuginfo, '-') - srcrpmlen; ++ s2 = NULL; ++ if (s > debuginfo && memcmp (s, ".src.rpm", srcrpmlen) == 0) ++ { ++ /* s2 = `-%{release}.src.rpm-debuginfo.%{arch}' */ ++ s2 = (char *) memrchr (debuginfo, '-', s - debuginfo); ++ } ++ if (s2) ++ { ++ /* s2 = `-%{version}-%{release}.src.rpm-debuginfo.%{arch}' */ ++ s2 = (char *) memrchr (debuginfo, '-', s2 - debuginfo); ++ } ++ if (!s2) ++ { ++ warning (_("Error querying the rpm file `%s': %s"), filename, ++ debuginfo); ++ xfree (debuginfo); ++ continue; ++ } ++ /* s = `.src.rpm-debuginfo.%{arch}' */ ++ /* s2 = `-%{version}-%{release}.src.rpm-debuginfo.%{arch}' */ ++ memmove (s2 + debuginfolen, s2, s - s2); ++ memcpy (s2, "-debuginfo", debuginfolen); ++ /* s = `XXXX.%{arch}' */ ++ /* strlen ("XXXX") == srcrpmlen + debuginfolen */ ++ /* s2 = `-debuginfo-%{version}-%{release}XX.%{arch}' */ ++ /* strlen ("XX") == srcrpmlen */ ++ memmove (s + debuginfolen, s + srcrpmlen + debuginfolen, ++ strlen (s + srcrpmlen + debuginfolen) + 1); ++ /* s = `-debuginfo-%{version}-%{release}.%{arch}' */ ++ ++ /* RPMDBI_PACKAGES requires keylen == sizeof (int). */ ++ /* RPMDBI_LABEL is an interface for NVR-based dbiFindByLabel(). */ ++ mi_debuginfo = rpmtsInitIterator_p (ts, (rpmTag) RPMDBI_LABEL, debuginfo, 0); ++ xfree (debuginfo); ++ if (mi_debuginfo) ++ { ++ rpmdbFreeIterator_p (mi_debuginfo); ++ count = 0; ++ break; ++ } ++ ++ /* The allocated memory gets utilized below for MISSING_RPM_HASH. */ ++ debuginfo = headerFormat_p (h, ++ "%{name}-%{version}-%{release}.%{arch}", ++ &err); ++ if (!debuginfo) ++ { ++ warning (_("Error querying the rpm file `%s': %s"), filename, ++ err); ++ continue; ++ } ++ ++ /* Base package name for `debuginfo-install'. We do not use the ++ `yum' command directly as the line ++ yum --enablerepo='*debug*' install NAME-debuginfo.ARCH ++ would be more complicated than just: ++ debuginfo-install NAME-VERSION-RELEASE.ARCH ++ Do not supply the rpm base name (derived from .src.rpm name) as ++ debuginfo-install is unable to install the debuginfo package if ++ the base name PKG binary rpm is not installed while for example ++ PKG-libs would be installed (RH Bug 467901). ++ FUTURE: After multiple debuginfo versions simultaneously installed ++ get supported the support for the VERSION-RELEASE tags handling ++ may need an update. */ ++ ++ if (missing_rpm_hash == NULL) ++ { ++ /* DEL_F is passed NULL as MISSING_RPM_LIST's HTAB_DELETE ++ should not deallocate the entries. */ ++ ++ missing_rpm_hash = htab_create_alloc (64, htab_hash_string, ++ (int (*) (const void *, const void *)) streq, ++ NULL, xcalloc, xfree); ++ } ++ slot = (char **) htab_find_slot (missing_rpm_hash, debuginfo, INSERT); ++ /* XCALLOC never returns NULL. */ ++ gdb_assert (slot != NULL); ++ if (*slot == NULL) ++ { ++ struct missing_rpm *missing_rpm; ++ ++ *slot = debuginfo; ++ ++ missing_rpm = (struct missing_rpm *) xmalloc (sizeof (*missing_rpm) + strlen (debuginfo)); ++ strcpy (missing_rpm->rpm, debuginfo); ++ missing_rpm->next = missing_rpm_list; ++ missing_rpm_list = missing_rpm; ++ missing_rpm_list_entries++; ++ } ++ else ++ xfree (debuginfo); ++ count++; ++ } ++ ++ rpmdbFreeIterator_p (mi); ++ } ++ ++ rpmtsFree_p (ts); ++ ++ return count; ++} ++ ++static bool ++missing_rpm_list_compar (const char *ap, const char *bp) ++{ ++ return strcoll (ap, bp) < 0; ++} ++ ++/* It returns a NULL-terminated array of strings needing to be FREEd. It may ++ also return only NULL. */ ++ ++static void ++missing_rpm_list_print (void) ++{ ++ struct missing_rpm *list_iter; ++ ++ if (missing_rpm_list_entries == 0) ++ return; ++ ++ std::vector array (missing_rpm_list_entries); ++ size_t idx = 0; ++ ++ for (list_iter = missing_rpm_list; list_iter != NULL; ++ list_iter = list_iter->next) ++ { ++ array[idx++] = list_iter->rpm; ++ } ++ gdb_assert (idx == missing_rpm_list_entries); ++ ++ std::sort (array.begin (), array.end (), missing_rpm_list_compar); ++ ++ /* We zero out the number of missing RPMs here because of a nasty ++ bug (see RHBZ 1801974). ++ ++ When we call 'puts_unfiltered' below, if pagination is on and if ++ the number of missing RPMs is big enough to trigger pagination, ++ we will end up in an infinite recursion. The call chain looks ++ like this: ++ ++ missing_rpm_list_print -> puts_unfiltered -> fputs_maybe_filtered ++ -> prompt_for_continue -> display_gdb_prompt -> ++ debug_flush_missing -> missing_rpm_list_print ... ++ ++ For this reason, we make sure MISSING_RPM_LIST_ENTRIES is zero ++ *before* calling any print function. */ ++ missing_rpm_list_entries = 0; ++ ++ printf_unfiltered (_("Missing separate debuginfos, use: %s"), ++#ifdef DNF_DEBUGINFO_INSTALL ++ "dnf " ++#endif ++ "debuginfo-install"); ++ for (const char *el : array) ++ { ++ puts_unfiltered (" "); ++ puts_unfiltered (el); ++ } ++ puts_unfiltered ("\n"); ++ ++ while (missing_rpm_list != NULL) ++ { ++ list_iter = missing_rpm_list; ++ missing_rpm_list = list_iter->next; ++ xfree (list_iter); ++ } ++} ++ ++static void ++missing_rpm_change (void) ++{ ++ debug_flush_missing (); ++ ++ gdb_assert (missing_rpm_list == NULL); ++ if (missing_rpm_hash != NULL) ++ { ++ htab_delete (missing_rpm_hash); ++ missing_rpm_hash = NULL; ++ } ++} ++ ++enum missing_exec ++ { ++ /* Init state. EXEC_BFD also still could be NULL. */ ++ MISSING_EXEC_NOT_TRIED, ++ /* We saw a non-NULL EXEC_BFD but RPM has no info about it. */ ++ MISSING_EXEC_NOT_FOUND, ++ /* We found EXEC_BFD by RPM and we either have its symbols (either embedded ++ or separate) or the main executable's RPM is now contained in ++ MISSING_RPM_HASH. */ ++ MISSING_EXEC_ENLISTED ++ }; ++static enum missing_exec missing_exec = MISSING_EXEC_NOT_TRIED; ++ ++#endif /* HAVE_LIBRPM */ ++ ++void ++debug_flush_missing (void) ++{ ++#ifdef HAVE_LIBRPM ++ missing_rpm_list_print (); ++#endif ++} ++ + /* This MISSING_FILEPAIR_HASH tracker is used only for the duplicite messages +- Try to install the hash file ... ++ yum --enablerepo='*debug*' install ... + avoidance. */ + + struct missing_filepair +@@ -752,11 +1119,17 @@ missing_filepair_change (void) + /* All their memory came just from missing_filepair_OBSTACK. */ + missing_filepair_hash = NULL; + } ++#ifdef HAVE_LIBRPM ++ missing_exec = MISSING_EXEC_NOT_TRIED; ++#endif + } + + static void + debug_print_executable_changed (void) + { ++#ifdef HAVE_LIBRPM ++ missing_rpm_change (); ++#endif + missing_filepair_change (); + } + +@@ -823,14 +1196,38 @@ debug_print_missing (const char *binary, const char *debug) + + *slot = missing_filepair; + +- /* We do not collect and flush these messages as each such message +- already requires its own separate lines. */ ++#ifdef HAVE_LIBRPM ++ if (missing_exec == MISSING_EXEC_NOT_TRIED) ++ { ++ const char *execfilename = get_exec_file (0); + +- fprintf_unfiltered (gdb_stdlog, +- _("Missing separate debuginfo for %s\n"), binary); +- if (debug != NULL) +- fprintf_unfiltered (gdb_stdlog, _("Try to install the hash file %s\n"), +- debug); ++ if (execfilename != NULL) ++ { ++ if (missing_rpm_enlist (execfilename) == 0) ++ missing_exec = MISSING_EXEC_NOT_FOUND; ++ else ++ missing_exec = MISSING_EXEC_ENLISTED; ++ } ++ } ++ if (missing_exec != MISSING_EXEC_ENLISTED) ++ if ((binary[0] == 0 || missing_rpm_enlist (binary) == 0) ++ && (debug == NULL || missing_rpm_enlist (debug) == 0)) ++#endif /* HAVE_LIBRPM */ ++ { ++ /* We do not collect and flush these messages as each such message ++ already requires its own separate lines. */ ++ ++ fprintf_unfiltered (gdb_stdlog, ++ _("Missing separate debuginfo for %s\n"), binary); ++ if (debug != NULL) ++ fprintf_unfiltered (gdb_stdlog, _("Try: %s %s\n"), ++#ifdef DNF_DEBUGINFO_INSTALL ++ "dnf" ++#else ++ "yum" ++#endif ++ " --enablerepo='*debug*' install", debug); ++ } + } + + /* See build-id.h. */ +diff --git a/gdb/config.in b/gdb/config.in +--- a/gdb/config.in ++++ b/gdb/config.in +@@ -39,6 +39,9 @@ + /* Handle .ctf type-info sections */ + #undef ENABLE_LIBCTF + ++/* librpm version specific library name to dlopen. */ ++#undef DLOPEN_LIBRPM ++ + /* Define to 1 if translation of program messages to the user's native + language is requested. */ + #undef ENABLE_NLS +@@ -247,6 +250,9 @@ + /* Define if you have the mpfr library. */ + #undef HAVE_LIBMPFR + ++/* Define if librpm library is being used. */ ++#undef HAVE_LIBRPM ++ + /* Define to 1 if you have the header file. */ + #undef HAVE_LIBUNWIND_IA64_H + +diff --git a/gdb/configure b/gdb/configure +--- a/gdb/configure ++++ b/gdb/configure +@@ -769,6 +769,11 @@ PKG_CONFIG + HAVE_NATIVE_GCORE_TARGET + TARGET_OBS + subdirs ++RPM_LIBS ++RPM_CFLAGS ++PKG_CONFIG_LIBDIR ++PKG_CONFIG_PATH ++PKG_CONFIG + GDB_DATADIR + DEBUGDIR + MAKEINFO_EXTRA_FLAGS +@@ -873,6 +878,7 @@ with_gdb_datadir + with_relocated_sources + with_auto_load_dir + with_auto_load_safe_path ++with_rpm + enable_targets + enable_64_bit_bfd + enable_gdbmi +@@ -949,6 +955,8 @@ PKG_CONFIG_PATH + PKG_CONFIG_LIBDIR + DEBUGINFOD_CFLAGS + DEBUGINFOD_LIBS ++RPM_CFLAGS ++RPM_LIBS + YACC + YFLAGS + XMKMF' +@@ -1621,6 +1629,8 @@ Optional Packages: + do not restrict auto-loaded files locations + --with-debuginfod Enable debuginfo lookups with debuginfod + (auto/yes/no) ++ --with-rpm query rpm database for missing debuginfos (yes/no, ++ def. auto=librpm.so) + --with-libunwind-ia64 use libunwind frame unwinding for ia64 targets + --with-curses use the curses library instead of the termcap + library +@@ -1702,6 +1712,8 @@ Some influential environment variables: + C compiler flags for DEBUGINFOD, overriding pkg-config + DEBUGINFOD_LIBS + linker flags for DEBUGINFOD, overriding pkg-config ++ RPM_CFLAGS C compiler flags for RPM, overriding pkg-config ++ RPM_LIBS linker flags for RPM, overriding pkg-config + YACC The `Yet Another Compiler Compiler' implementation to use. + Defaults to the first program found out of: `bison -y', `byacc', + `yacc'. +@@ -6666,6 +6678,494 @@ _ACEOF + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_auto_load_safe_path" >&5 + $as_echo "$with_auto_load_safe_path" >&6; } + ++# Integration with rpm library to support missing debuginfo suggestions. ++# --without-rpm: Disable any rpm support. ++# --with-rpm=libname.so: Try to dynamically open `libname.so' during runtime. ++# Even with runtime missing `libname.so' GDB will still other run correctly. ++# Missing `libname.so' during ./configure will abort the configuration. ++# --with-rpm=librpm.so: Like `--with-rpm=libname.so' but try to find specific ++# minor version first such as `librpm-4.6.so' as minor version differences ++# mean API+ABI incompatibility. If the specific match versioned library name ++# could not be found still open dynamically at least `librpm.so'. ++# --with-rpm: Like `--with-rpm=librpm.so' but if any of its detection fails try ++# to find librpm for compilation-time linking by pkg-config. GDB binary will ++# be probably linked with the version specific library (as `librpm-4.6.so'). ++# Failure to find librpm by pkg-config will abort the configuration. ++# (default) --with-rpm=auto: Like `--with-rpm=librpm.so' but if even pkg-config ++# cannot find librpm use to the rpmless compilation (like `--without-rpm'). ++ ++ ++# Check whether --with-rpm was given. ++if test "${with_rpm+set}" = set; then : ++ withval=$with_rpm; ++else ++ with_rpm="auto" ++fi ++ ++ ++ ++ ++if test "x$with_rpm" != "xno"; then ++ if test "x$with_rpm" = "xyes"; then ++ LIBRPM="librpm.so" ++ RPM_REQUIRE=true ++ DLOPEN_REQUIRE=false ++ elif test "x$with_rpm" = "xauto"; then ++ LIBRPM="librpm.so" ++ RPM_REQUIRE=false ++ DLOPEN_REQUIRE=false ++ else ++ LIBRPM="$with_rpm" ++ RPM_REQUIRE=true ++ DLOPEN_REQUIRE=true ++ fi ++ LIBRPM_STRING='"'"$LIBRPM"'"' ++ ++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking specific librpm version" >&5 ++$as_echo_n "checking specific librpm version... " >&6; } ++ HAVE_DLOPEN_LIBRPM=false ++ save_LIBS="$LIBS" ++ LIBS="$LIBS -ldl" ++ if test "$cross_compiling" = yes; then : ++ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 ++$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} ++as_fn_error "cannot run test program while cross compiling ++See \`config.log' for more details." "$LINENO" 5; } ++else ++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext ++/* end confdefs.h. */ ++ ++#include ++#include ++#include ++ ++int ++main () ++{ ++ ++ void *h; ++ const char *const *rpmverp; ++ FILE *f; ++ ++ f = fopen ("conftest.out", "w"); ++ if (!f) ++ { ++ fprintf (stderr, "Cannot write \"%s\": %s\n", "conftest.out", ++ strerror (errno)); ++ return 1; ++ } ++ h = dlopen ($LIBRPM_STRING, RTLD_LAZY); ++ if (!h) ++ { ++ fprintf (stderr, "dlopen (\"%s\"): %s\n", $LIBRPM_STRING, dlerror ()); ++ return 1; ++ } ++ rpmverp = dlsym (h, "RPMVERSION"); ++ if (!rpmverp) ++ { ++ fprintf (stderr, "dlsym (\"RPMVERSION\"): %s\n", dlerror ()); ++ return 1; ++ } ++ fprintf (stderr, "RPMVERSION is: \""); ++ fprintf (stderr, "%s\"\n", *rpmverp); ++ ++ /* Try to find the specific librpm version only for "librpm.so" as we do ++ not know how to assemble the version string otherwise. */ ++ ++ if (strcmp ("librpm.so", $LIBRPM_STRING) != 0) ++ { ++ fprintf (f, "%s\n", $LIBRPM_STRING); ++ return 0; ++ } ++ else ++ { ++ char *h2_name; ++ void *h2; ++ int major, minor; ++ ++ if (sscanf (*rpmverp, "%d.%d", &major, &minor) != 2) ++ { ++ fprintf (stderr, "Unable to parse RPMVERSION.\n"); ++ fprintf (f, "%s\n", $LIBRPM_STRING); ++ return 0; ++ } ++ /* Avoid the square brackets by malloc. */ ++ h2_name = malloc (64); ++ sprintf (h2_name, "librpm-%d.%d.so", major, minor); ++ h2 = dlopen (h2_name, RTLD_LAZY); ++ if (!h2) ++ { ++ fprintf (stderr, "dlopen (\"%s\"): %s\n", h2_name, dlerror ()); ++ fprintf (f, "%s\n", $LIBRPM_STRING); ++ return 0; ++ } ++ if (h2 != h) ++ { ++ fprintf (stderr, "dlopen of \"%s\" and \"%s\" are different.\n", ++ $LIBRPM_STRING, h2_name); ++ fprintf (f, "%s\n", $LIBRPM_STRING); ++ return 0; ++ } ++ /* Found the valid .so name with a specific version. */ ++ fprintf (f, "%s\n", h2_name); ++ return 0; ++ } ++ ++ ; ++ return 0; ++} ++_ACEOF ++if ac_fn_c_try_run "$LINENO"; then : ++ ++ DLOPEN_LIBRPM="`cat conftest.out`" ++ if test "x$DLOPEN_LIBRPM" != "x"; then ++ HAVE_DLOPEN_LIBRPM=true ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLOPEN_LIBRPM" >&5 ++$as_echo "$DLOPEN_LIBRPM" >&6; } ++ fi ++ ++fi ++rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ ++ conftest.$ac_objext conftest.beam conftest.$ac_ext ++fi ++ ++ rm -f conftest.out ++ ++ ++ ++ if $HAVE_DLOPEN_LIBRPM; then ++ ++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking rpm library API compatibility" >&5 ++$as_echo_n "checking rpm library API compatibility... " >&6; } ++ # The compilation requires -Werror to verify anything. ++ save_CFLAGS="$CFLAGS" ++ CFLAGS="$CFLAGS -Werror" ++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext ++/* end confdefs.h. */ ++ ++/* Duplicate here the declarations to verify they match "elfread.c". */ ++#include ++#include ++#include ++#include ++extern char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg); ++extern int rpmReadConfigFiles(const char * file, const char * target); ++extern rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi); ++extern Header rpmdbNextIterator(rpmdbMatchIterator mi); ++extern rpmts rpmtsCreate(void); ++extern rpmts rpmtsFree(rpmts ts); ++extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag, ++ const void * keyp, size_t keylen); ++ ++int ++main () ++{ ++ ++ ; ++ return 0; ++} ++_ACEOF ++if ac_fn_c_try_compile "$LINENO"; then : ++ ++ LIBRPM_COMPAT=true ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 ++$as_echo "yes" >&6; } ++ ++else ++ ++ LIBRPM_COMPAT=false ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 ++$as_echo "no" >&6; } ++ ++fi ++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ++ CFLAGS="$save_CFLAGS" ++ ++ if ! $LIBRPM_COMPAT; then ++ HAVE_DLOPEN_LIBRPM=false ++ fi ++ fi ++ ++ if $HAVE_DLOPEN_LIBRPM; then ++ DLOPEN_LIBRPM_STRING='"'"$DLOPEN_LIBRPM"'"' ++ ++cat >>confdefs.h <<_ACEOF ++#define DLOPEN_LIBRPM $DLOPEN_LIBRPM_STRING ++_ACEOF ++ ++ ++$as_echo "#define HAVE_LIBRPM 1" >>confdefs.h ++ ++ else ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 ++$as_echo "no" >&6; } ++ LIBS="$save_LIBS" ++ if $DLOPEN_REQUIRE; then ++ as_fn_error "Specific name $LIBRPM was requested but it could not be opened." "$LINENO" 5 ++ fi ++ ++ ++ ++ ++ ++ ++ ++if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then ++ if test -n "$ac_tool_prefix"; then ++ # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. ++set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 ++$as_echo_n "checking for $ac_word... " >&6; } ++if test "${ac_cv_path_PKG_CONFIG+set}" = set; then : ++ $as_echo_n "(cached) " >&6 ++else ++ case $PKG_CONFIG in ++ [\\/]* | ?:[\\/]*) ++ ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. ++ ;; ++ *) ++ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR ++for as_dir in $PATH ++do ++ IFS=$as_save_IFS ++ test -z "$as_dir" && as_dir=. ++ for ac_exec_ext in '' $ac_executable_extensions; do ++ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ++ ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" ++ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 ++ break 2 ++ fi ++done ++ done ++IFS=$as_save_IFS ++ ++ ;; ++esac ++fi ++PKG_CONFIG=$ac_cv_path_PKG_CONFIG ++if test -n "$PKG_CONFIG"; then ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 ++$as_echo "$PKG_CONFIG" >&6; } ++else ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 ++$as_echo "no" >&6; } ++fi ++ ++ ++fi ++if test -z "$ac_cv_path_PKG_CONFIG"; then ++ ac_pt_PKG_CONFIG=$PKG_CONFIG ++ # Extract the first word of "pkg-config", so it can be a program name with args. ++set dummy pkg-config; ac_word=$2 ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 ++$as_echo_n "checking for $ac_word... " >&6; } ++if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then : ++ $as_echo_n "(cached) " >&6 ++else ++ case $ac_pt_PKG_CONFIG in ++ [\\/]* | ?:[\\/]*) ++ ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. ++ ;; ++ *) ++ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR ++for as_dir in $PATH ++do ++ IFS=$as_save_IFS ++ test -z "$as_dir" && as_dir=. ++ for ac_exec_ext in '' $ac_executable_extensions; do ++ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ++ ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" ++ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 ++ break 2 ++ fi ++done ++ done ++IFS=$as_save_IFS ++ ++ ;; ++esac ++fi ++ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG ++if test -n "$ac_pt_PKG_CONFIG"; then ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 ++$as_echo "$ac_pt_PKG_CONFIG" >&6; } ++else ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 ++$as_echo "no" >&6; } ++fi ++ ++ if test "x$ac_pt_PKG_CONFIG" = x; then ++ PKG_CONFIG="" ++ else ++ case $cross_compiling:$ac_tool_warned in ++yes:) ++{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 ++$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ++ac_tool_warned=yes ;; ++esac ++ PKG_CONFIG=$ac_pt_PKG_CONFIG ++ fi ++else ++ PKG_CONFIG="$ac_cv_path_PKG_CONFIG" ++fi ++ ++fi ++if test -n "$PKG_CONFIG"; then ++ _pkg_min_version=0.9.0 ++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 ++$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } ++ if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 ++$as_echo "yes" >&6; } ++ else ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 ++$as_echo "no" >&6; } ++ PKG_CONFIG="" ++ fi ++fi ++ ++pkg_failed=no ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for RPM" >&5 ++$as_echo_n "checking for RPM... " >&6; } ++ ++if test -n "$RPM_CFLAGS"; then ++ pkg_cv_RPM_CFLAGS="$RPM_CFLAGS" ++ elif test -n "$PKG_CONFIG"; then ++ if test -n "$PKG_CONFIG" && \ ++ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"rpm\""; } >&5 ++ ($PKG_CONFIG --exists --print-errors "rpm") 2>&5 ++ ac_status=$? ++ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 ++ test $ac_status = 0; }; then ++ pkg_cv_RPM_CFLAGS=`$PKG_CONFIG --cflags "rpm" 2>/dev/null` ++ test "x$?" != "x0" && pkg_failed=yes ++else ++ pkg_failed=yes ++fi ++ else ++ pkg_failed=untried ++fi ++if test -n "$RPM_LIBS"; then ++ pkg_cv_RPM_LIBS="$RPM_LIBS" ++ elif test -n "$PKG_CONFIG"; then ++ if test -n "$PKG_CONFIG" && \ ++ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"rpm\""; } >&5 ++ ($PKG_CONFIG --exists --print-errors "rpm") 2>&5 ++ ac_status=$? ++ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 ++ test $ac_status = 0; }; then ++ pkg_cv_RPM_LIBS=`$PKG_CONFIG --libs "rpm" 2>/dev/null` ++ test "x$?" != "x0" && pkg_failed=yes ++else ++ pkg_failed=yes ++fi ++ else ++ pkg_failed=untried ++fi ++ ++ ++ ++if test $pkg_failed = yes; then ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 ++$as_echo "no" >&6; } ++ ++if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then ++ _pkg_short_errors_supported=yes ++else ++ _pkg_short_errors_supported=no ++fi ++ if test $_pkg_short_errors_supported = yes; then ++ RPM_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "rpm" 2>&1` ++ else ++ RPM_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "rpm" 2>&1` ++ fi ++ # Put the nasty error message in config.log where it belongs ++ echo "$RPM_PKG_ERRORS" >&5 ++ ++ HAVE_LIBRPM=false ++elif test $pkg_failed = untried; then ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 ++$as_echo "no" >&6; } ++ HAVE_LIBRPM=false ++else ++ RPM_CFLAGS=$pkg_cv_RPM_CFLAGS ++ RPM_LIBS=$pkg_cv_RPM_LIBS ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 ++$as_echo "yes" >&6; } ++ HAVE_LIBRPM=true ++fi ++ ++ if $HAVE_LIBRPM; then ++ ++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking rpm library API compatibility" >&5 ++$as_echo_n "checking rpm library API compatibility... " >&6; } ++ # The compilation requires -Werror to verify anything. ++ save_CFLAGS="$CFLAGS" ++ CFLAGS="$CFLAGS -Werror" ++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext ++/* end confdefs.h. */ ++ ++/* Duplicate here the declarations to verify they match "elfread.c". */ ++#include ++#include ++#include ++#include ++extern char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg); ++extern int rpmReadConfigFiles(const char * file, const char * target); ++extern rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi); ++extern Header rpmdbNextIterator(rpmdbMatchIterator mi); ++extern rpmts rpmtsCreate(void); ++extern rpmts rpmtsFree(rpmts ts); ++extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag, ++ const void * keyp, size_t keylen); ++ ++int ++main () ++{ ++ ++ ; ++ return 0; ++} ++_ACEOF ++if ac_fn_c_try_compile "$LINENO"; then : ++ ++ LIBRPM_COMPAT=true ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 ++$as_echo "yes" >&6; } ++ ++else ++ ++ LIBRPM_COMPAT=false ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 ++$as_echo "no" >&6; } ++ ++fi ++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ++ CFLAGS="$save_CFLAGS" ++ ++ if ! $LIBRPM_COMPAT; then ++ HAVE_LIBRPM=false ++ RPM_PKG_ERRORS="Found $LIBRPM API is incompatibile with this GDB" ++ fi ++ fi ++ ++ if $HAVE_LIBRPM; then ++ ++$as_echo "#define HAVE_LIBRPM 1" >>confdefs.h ++ ++ CFLAGS="$CFLAGS $RPM_CFLAGS" ++ LIBS="$LIBS $RPM_LIBS" ++ else ++ if $RPM_REQUIRE; then ++ as_fn_error "$RPM_PKG_ERRORS" "$LINENO" 5 ++ else ++ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $RPM_PKG_ERRORS" >&5 ++$as_echo "$as_me: WARNING: $RPM_PKG_ERRORS" >&2;} ++ fi ++ fi ++ fi ++fi ++ + + + subdirs="$subdirs testsuite" +diff --git a/gdb/configure.ac b/gdb/configure.ac +--- a/gdb/configure.ac ++++ b/gdb/configure.ac +@@ -143,6 +143,199 @@ AC_DEFINE_DIR(AUTO_LOAD_SAFE_PATH, escape_dir, + [Directories safe to hold auto-loaded files.]) + AC_MSG_RESULT([$with_auto_load_safe_path]) + ++# Integration with rpm library to support missing debuginfo suggestions. ++# --without-rpm: Disable any rpm support. ++# --with-rpm=libname.so: Try to dynamically open `libname.so' during runtime. ++# Even with runtime missing `libname.so' GDB will still other run correctly. ++# Missing `libname.so' during ./configure will abort the configuration. ++# --with-rpm=librpm.so: Like `--with-rpm=libname.so' but try to find specific ++# minor version first such as `librpm-4.6.so' as minor version differences ++# mean API+ABI incompatibility. If the specific match versioned library name ++# could not be found still open dynamically at least `librpm.so'. ++# --with-rpm: Like `--with-rpm=librpm.so' but if any of its detection fails try ++# to find librpm for compilation-time linking by pkg-config. GDB binary will ++# be probably linked with the version specific library (as `librpm-4.6.so'). ++# Failure to find librpm by pkg-config will abort the configuration. ++# (default) --with-rpm=auto: Like `--with-rpm=librpm.so' but if even pkg-config ++# cannot find librpm use to the rpmless compilation (like `--without-rpm'). ++ ++AC_ARG_WITH([rpm], ++ [AS_HELP_STRING([--with-rpm], ++ [query rpm database for missing debuginfos (yes/no, def. auto=librpm.so)])], [], [with_rpm="auto"]) ++ ++m4_pattern_allow([^AC_MSG_ERROR$]) ++m4_pattern_allow([^AC_MSG_WARN$]) ++if test "x$with_rpm" != "xno"; then ++ if test "x$with_rpm" = "xyes"; then ++ LIBRPM="librpm.so" ++ RPM_REQUIRE=true ++ DLOPEN_REQUIRE=false ++ elif test "x$with_rpm" = "xauto"; then ++ LIBRPM="librpm.so" ++ RPM_REQUIRE=false ++ DLOPEN_REQUIRE=false ++ else ++ LIBRPM="$with_rpm" ++ RPM_REQUIRE=true ++ DLOPEN_REQUIRE=true ++ fi ++ LIBRPM_STRING='"'"$LIBRPM"'"' ++ ++ AC_MSG_CHECKING([specific librpm version]) ++ HAVE_DLOPEN_LIBRPM=false ++ save_LIBS="$LIBS" ++ LIBS="$LIBS -ldl" ++ AC_RUN_IFELSE(AC_LANG_PROGRAM([[ ++#include ++#include ++#include ++ ]], [[ ++ void *h; ++ const char *const *rpmverp; ++ FILE *f; ++ ++ f = fopen ("conftest.out", "w"); ++ if (!f) ++ { ++ fprintf (stderr, "Cannot write \"%s\": %s\n", "conftest.out", ++ strerror (errno)); ++ return 1; ++ } ++ h = dlopen ($LIBRPM_STRING, RTLD_LAZY); ++ if (!h) ++ { ++ fprintf (stderr, "dlopen (\"%s\"): %s\n", $LIBRPM_STRING, dlerror ()); ++ return 1; ++ } ++ rpmverp = dlsym (h, "RPMVERSION"); ++ if (!rpmverp) ++ { ++ fprintf (stderr, "dlsym (\"RPMVERSION\"): %s\n", dlerror ()); ++ return 1; ++ } ++ fprintf (stderr, "RPMVERSION is: \""); ++ fprintf (stderr, "%s\"\n", *rpmverp); ++ ++ /* Try to find the specific librpm version only for "librpm.so" as we do ++ not know how to assemble the version string otherwise. */ ++ ++ if (strcmp ("librpm.so", $LIBRPM_STRING) != 0) ++ { ++ fprintf (f, "%s\n", $LIBRPM_STRING); ++ return 0; ++ } ++ else ++ { ++ char *h2_name; ++ void *h2; ++ int major, minor; ++ ++ if (sscanf (*rpmverp, "%d.%d", &major, &minor) != 2) ++ { ++ fprintf (stderr, "Unable to parse RPMVERSION.\n"); ++ fprintf (f, "%s\n", $LIBRPM_STRING); ++ return 0; ++ } ++ /* Avoid the square brackets by malloc. */ ++ h2_name = malloc (64); ++ sprintf (h2_name, "librpm-%d.%d.so", major, minor); ++ h2 = dlopen (h2_name, RTLD_LAZY); ++ if (!h2) ++ { ++ fprintf (stderr, "dlopen (\"%s\"): %s\n", h2_name, dlerror ()); ++ fprintf (f, "%s\n", $LIBRPM_STRING); ++ return 0; ++ } ++ if (h2 != h) ++ { ++ fprintf (stderr, "dlopen of \"%s\" and \"%s\" are different.\n", ++ $LIBRPM_STRING, h2_name); ++ fprintf (f, "%s\n", $LIBRPM_STRING); ++ return 0; ++ } ++ /* Found the valid .so name with a specific version. */ ++ fprintf (f, "%s\n", h2_name); ++ return 0; ++ } ++ ]]), [ ++ DLOPEN_LIBRPM="`cat conftest.out`" ++ if test "x$DLOPEN_LIBRPM" != "x"; then ++ HAVE_DLOPEN_LIBRPM=true ++ AC_MSG_RESULT($DLOPEN_LIBRPM) ++ fi ++ ]) ++ rm -f conftest.out ++ ++ m4_define([CHECK_LIBRPM_COMPAT], [ ++ AC_MSG_CHECKING([rpm library API compatibility]) ++ # The compilation requires -Werror to verify anything. ++ save_CFLAGS="$CFLAGS" ++ CFLAGS="$CFLAGS -Werror" ++ AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[ ++/* Duplicate here the declarations to verify they match "elfread.c". */ ++#include ++#include ++#include ++#include ++extern char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg); ++extern int rpmReadConfigFiles(const char * file, const char * target); ++extern rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi); ++extern Header rpmdbNextIterator(rpmdbMatchIterator mi); ++extern rpmts rpmtsCreate(void); ++extern rpmts rpmtsFree(rpmts ts); ++extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag, ++ const void * keyp, size_t keylen); ++ ]]), [ ++ LIBRPM_COMPAT=true ++ AC_MSG_RESULT(yes) ++ ], [ ++ LIBRPM_COMPAT=false ++ AC_MSG_RESULT(no) ++ ]) ++ CFLAGS="$save_CFLAGS" ++ ]) ++ ++ if $HAVE_DLOPEN_LIBRPM; then ++ CHECK_LIBRPM_COMPAT ++ if ! $LIBRPM_COMPAT; then ++ HAVE_DLOPEN_LIBRPM=false ++ fi ++ fi ++ ++ if $HAVE_DLOPEN_LIBRPM; then ++ DLOPEN_LIBRPM_STRING='"'"$DLOPEN_LIBRPM"'"' ++ AC_DEFINE_UNQUOTED(DLOPEN_LIBRPM, $DLOPEN_LIBRPM_STRING, [librpm version specific library name to dlopen.]) ++ AC_DEFINE(HAVE_LIBRPM, 1, [Define if librpm library is being used.]) ++ else ++ AC_MSG_RESULT(no) ++ LIBS="$save_LIBS" ++ if $DLOPEN_REQUIRE; then ++ AC_MSG_ERROR([Specific name $LIBRPM was requested but it could not be opened.]) ++ fi ++ PKG_CHECK_MODULES(RPM, rpm, [HAVE_LIBRPM=true], [HAVE_LIBRPM=false]) ++ ++ if $HAVE_LIBRPM; then ++ CHECK_LIBRPM_COMPAT ++ if ! $LIBRPM_COMPAT; then ++ HAVE_LIBRPM=false ++ RPM_PKG_ERRORS="Found $LIBRPM API is incompatibile with this GDB" ++ fi ++ fi ++ ++ if $HAVE_LIBRPM; then ++ AC_DEFINE(HAVE_LIBRPM, 1, [Define if librpm library is being used.]) ++ CFLAGS="$CFLAGS $RPM_CFLAGS" ++ LIBS="$LIBS $RPM_LIBS" ++ else ++ if $RPM_REQUIRE; then ++ AC_MSG_ERROR($RPM_PKG_ERRORS) ++ else ++ AC_MSG_WARN($RPM_PKG_ERRORS) ++ fi ++ fi ++ fi ++fi ++ + AC_CONFIG_SUBDIRS(testsuite) + + # Check whether to support alternative target configurations +diff --git a/gdb/event-top.c b/gdb/event-top.c +--- a/gdb/event-top.c ++++ b/gdb/event-top.c +@@ -42,6 +42,7 @@ + #include "gdbsupport/gdb_select.h" + #include "gdbsupport/gdb-sigmask.h" + #include "async-event.h" ++#include "symfile.h" + + /* readline include files. */ + #include "readline/readline.h" +@@ -364,6 +365,8 @@ display_gdb_prompt (const char *new_prompt) + /* Reset the nesting depth used when trace-commands is set. */ + reset_command_nest_depth (); + ++ debug_flush_missing (); ++ + /* Do not call the python hook on an explicit prompt change as + passed to this function, as this forms a secondary/local prompt, + IE, displayed but not set. */ +@@ -773,7 +776,10 @@ command_line_handler (gdb::unique_xmalloc_ptr &&rl) + command_handler (cmd); + + if (ui->prompt_state != PROMPTED) +- display_gdb_prompt (0); ++ { ++ debug_flush_missing (); ++ display_gdb_prompt (0); ++ } + } + } + +diff --git a/gdb/symfile.h b/gdb/symfile.h +--- a/gdb/symfile.h ++++ b/gdb/symfile.h +@@ -560,6 +560,7 @@ extern void generic_load (const char *args, int from_tty); + /* build-id support. */ + extern struct bfd_build_id *build_id_addr_get (CORE_ADDR addr); + extern void debug_print_missing (const char *binary, const char *debug); ++extern void debug_flush_missing (void); + #define BUILD_ID_MAIN_EXECUTABLE_FILENAME _("the main executable file") + + /* From dwarf2read.c */ diff --git a/SOURCES/gdb-6.6-buildid-locate-solib-missing-ids.patch b/SOURCES/gdb-6.6-buildid-locate-solib-missing-ids.patch new file mode 100644 index 0000000..f1f5e83 --- /dev/null +++ b/SOURCES/gdb-6.6-buildid-locate-solib-missing-ids.patch @@ -0,0 +1,237 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +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 +@@ -1340,14 +1340,27 @@ svr4_read_so_list (svr4_info *info, 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; +@@ -1362,23 +1375,7 @@ svr4_read_so_list (svr4_info *info, 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 . */ ++ ++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 . */ ++ ++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 . ++ ++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" diff --git a/SOURCES/gdb-6.6-buildid-locate.patch b/SOURCES/gdb-6.6-buildid-locate.patch new file mode 100644 index 0000000..f606793 --- /dev/null +++ b/SOURCES/gdb-6.6-buildid-locate.patch @@ -0,0 +1,1428 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +Date: Fri, 27 Oct 2017 21:07:50 +0200 +Subject: gdb-6.6-buildid-locate.patch + +;; New locating of the matching binaries from the pure core file (build-id). +;;=push+jan + +diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h +--- a/bfd/libbfd-in.h ++++ b/bfd/libbfd-in.h +@@ -121,7 +121,7 @@ static inline char * + bfd_strdup (const char *str) + { + size_t len = strlen (str) + 1; +- char *buf = bfd_malloc (len); ++ char *buf = (char *) bfd_malloc (len); + if (buf != NULL) + memcpy (buf, str, len); + return buf; +diff --git a/bfd/libbfd.h b/bfd/libbfd.h +--- a/bfd/libbfd.h ++++ b/bfd/libbfd.h +@@ -126,7 +126,7 @@ static inline char * + bfd_strdup (const char *str) + { + size_t len = strlen (str) + 1; +- char *buf = bfd_malloc (len); ++ char *buf = (char *) bfd_malloc (len); + if (buf != NULL) + memcpy (buf, str, len); + return buf; +diff --git a/gdb/build-id.c b/gdb/build-id.c +--- a/gdb/build-id.c ++++ b/gdb/build-id.c +@@ -24,13 +24,70 @@ + #include "gdbsupport/gdb_vecs.h" + #include "symfile.h" + #include "objfiles.h" ++#include ++#include "elf-bfd.h" ++#include "elf/common.h" ++#include "elf/external.h" ++#include "elf/internal.h" + #include "filenames.h" ++#include "gdb_bfd.h" ++#include "gdbcmd.h" + #include "gdbcore.h" ++#include "objfiles.h" ++#include "observable.h" ++#include "symfile.h" ++ ++#define BUILD_ID_VERBOSE_NONE 0 ++#define BUILD_ID_VERBOSE_FILENAMES 1 ++#define BUILD_ID_VERBOSE_BINARY_PARSE 2 ++static int build_id_verbose = BUILD_ID_VERBOSE_FILENAMES; ++static void ++show_build_id_verbose (struct ui_file *file, int from_tty, ++ struct cmd_list_element *c, const char *value) ++{ ++ fprintf_filtered (file, _("Verbosity level of the build-id locator is %s.\n"), ++ value); ++} ++/* Locate NT_GNU_BUILD_ID and return its matching debug filename. ++ FIXME: NOTE decoding should be unified with the BFD core notes decoding. */ ++ ++static struct bfd_build_id * ++build_id_buf_get (bfd *templ, gdb_byte *buf, bfd_size_type size) ++{ ++ bfd_byte *p; ++ ++ p = buf; ++ while (p < buf + size) ++ { ++ /* FIXME: bad alignment assumption. */ ++ Elf_External_Note *xnp = (Elf_External_Note *) p; ++ size_t namesz = H_GET_32 (templ, xnp->namesz); ++ size_t descsz = H_GET_32 (templ, xnp->descsz); ++ bfd_byte *descdata = (gdb_byte *) xnp->name + BFD_ALIGN (namesz, 4); ++ ++ if (H_GET_32 (templ, xnp->type) == NT_GNU_BUILD_ID ++ && namesz == sizeof "GNU" ++ && memcmp (xnp->name, "GNU", sizeof "GNU") == 0) ++ { ++ size_t sz = descsz; ++ gdb_byte *data = (gdb_byte *) descdata; ++ struct bfd_build_id *retval; ++ ++ retval = (struct bfd_build_id *) xmalloc (sizeof *retval - 1 + sz); ++ retval->size = sz; ++ memcpy (retval->data, data, sz); ++ ++ return retval; ++ } ++ p = descdata + BFD_ALIGN (descsz, 4); ++ } ++ return NULL; ++} + + /* See build-id.h. */ + + const struct bfd_build_id * +-build_id_bfd_get (bfd *abfd) ++build_id_bfd_shdr_get (bfd *abfd) + { + if (!bfd_check_format (abfd, bfd_object) + && !bfd_check_format (abfd, bfd_core)) +@@ -43,6 +100,348 @@ build_id_bfd_get (bfd *abfd) + return NULL; + } + ++/* Core files may have missing (corrupt) SHDR but PDHR is correct there. ++ bfd_elf_bfd_from_remote_memory () has too much overhead by ++ allocating/reading all the available ELF PT_LOADs. */ ++ ++static struct bfd_build_id * ++build_id_phdr_get (bfd *templ, bfd_vma loadbase, unsigned e_phnum, ++ Elf_Internal_Phdr *i_phdr) ++{ ++ int i; ++ struct bfd_build_id *retval = NULL; ++ ++ for (i = 0; i < e_phnum; i++) ++ if (i_phdr[i].p_type == PT_NOTE && i_phdr[i].p_filesz > 0) ++ { ++ Elf_Internal_Phdr *hdr = &i_phdr[i]; ++ gdb_byte *buf; ++ int err; ++ ++ buf = (gdb_byte *) xmalloc (hdr->p_filesz); ++ err = target_read_memory (loadbase + i_phdr[i].p_vaddr, buf, ++ hdr->p_filesz); ++ if (err == 0) ++ retval = build_id_buf_get (templ, buf, hdr->p_filesz); ++ else ++ retval = NULL; ++ xfree (buf); ++ if (retval != NULL) ++ break; ++ } ++ return retval; ++} ++ ++/* First we validate the file by reading in the ELF header and checking ++ the magic number. */ ++ ++static inline bfd_boolean ++elf_file_p (Elf64_External_Ehdr *x_ehdrp64) ++{ ++ gdb_assert (sizeof (Elf64_External_Ehdr) >= sizeof (Elf32_External_Ehdr)); ++ gdb_assert (offsetof (Elf64_External_Ehdr, e_ident) ++ == offsetof (Elf32_External_Ehdr, e_ident)); ++ gdb_assert (sizeof (((Elf64_External_Ehdr *) 0)->e_ident) ++ == sizeof (((Elf32_External_Ehdr *) 0)->e_ident)); ++ ++ return ((x_ehdrp64->e_ident[EI_MAG0] == ELFMAG0) ++ && (x_ehdrp64->e_ident[EI_MAG1] == ELFMAG1) ++ && (x_ehdrp64->e_ident[EI_MAG2] == ELFMAG2) ++ && (x_ehdrp64->e_ident[EI_MAG3] == ELFMAG3)); ++} ++ ++/* Translate an ELF file header in external format into an ELF file header in ++ internal format. */ ++ ++#define H_GET_WORD(bfd, ptr) (is64 ? H_GET_64 (bfd, (ptr)) \ ++ : H_GET_32 (bfd, (ptr))) ++#define H_GET_SIGNED_WORD(bfd, ptr) (is64 ? H_GET_S64 (bfd, (ptr)) \ ++ : H_GET_S32 (bfd, (ptr))) ++ ++static void ++elf_swap_ehdr_in (bfd *abfd, ++ const Elf64_External_Ehdr *src64, ++ Elf_Internal_Ehdr *dst) ++{ ++ int is64 = bfd_get_arch_size (abfd) == 64; ++#define SRC(field) (is64 ? src64->field \ ++ : ((const Elf32_External_Ehdr *) src64)->field) ++ ++ int signed_vma = get_elf_backend_data (abfd)->sign_extend_vma; ++ memcpy (dst->e_ident, SRC (e_ident), EI_NIDENT); ++ dst->e_type = H_GET_16 (abfd, SRC (e_type)); ++ dst->e_machine = H_GET_16 (abfd, SRC (e_machine)); ++ dst->e_version = H_GET_32 (abfd, SRC (e_version)); ++ if (signed_vma) ++ dst->e_entry = H_GET_SIGNED_WORD (abfd, SRC (e_entry)); ++ else ++ dst->e_entry = H_GET_WORD (abfd, SRC (e_entry)); ++ dst->e_phoff = H_GET_WORD (abfd, SRC (e_phoff)); ++ dst->e_shoff = H_GET_WORD (abfd, SRC (e_shoff)); ++ dst->e_flags = H_GET_32 (abfd, SRC (e_flags)); ++ dst->e_ehsize = H_GET_16 (abfd, SRC (e_ehsize)); ++ dst->e_phentsize = H_GET_16 (abfd, SRC (e_phentsize)); ++ dst->e_phnum = H_GET_16 (abfd, SRC (e_phnum)); ++ dst->e_shentsize = H_GET_16 (abfd, SRC (e_shentsize)); ++ dst->e_shnum = H_GET_16 (abfd, SRC (e_shnum)); ++ dst->e_shstrndx = H_GET_16 (abfd, SRC (e_shstrndx)); ++ ++#undef SRC ++} ++ ++/* Translate an ELF program header table entry in external format into an ++ ELF program header table entry in internal format. */ ++ ++static void ++elf_swap_phdr_in (bfd *abfd, ++ const Elf64_External_Phdr *src64, ++ Elf_Internal_Phdr *dst) ++{ ++ int is64 = bfd_get_arch_size (abfd) == 64; ++#define SRC(field) (is64 ? src64->field \ ++ : ((const Elf32_External_Phdr *) src64)->field) ++ ++ int signed_vma = get_elf_backend_data (abfd)->sign_extend_vma; ++ ++ dst->p_type = H_GET_32 (abfd, SRC (p_type)); ++ dst->p_flags = H_GET_32 (abfd, SRC (p_flags)); ++ dst->p_offset = H_GET_WORD (abfd, SRC (p_offset)); ++ if (signed_vma) ++ { ++ dst->p_vaddr = H_GET_SIGNED_WORD (abfd, SRC (p_vaddr)); ++ dst->p_paddr = H_GET_SIGNED_WORD (abfd, SRC (p_paddr)); ++ } ++ else ++ { ++ dst->p_vaddr = H_GET_WORD (abfd, SRC (p_vaddr)); ++ dst->p_paddr = H_GET_WORD (abfd, SRC (p_paddr)); ++ } ++ dst->p_filesz = H_GET_WORD (abfd, SRC (p_filesz)); ++ dst->p_memsz = H_GET_WORD (abfd, SRC (p_memsz)); ++ dst->p_align = H_GET_WORD (abfd, SRC (p_align)); ++ ++#undef SRC ++} ++ ++#undef H_GET_SIGNED_WORD ++#undef H_GET_WORD ++ ++static Elf_Internal_Phdr * ++elf_get_phdr (bfd *templ, bfd_vma ehdr_vma, unsigned *e_phnum_pointer, ++ bfd_vma *loadbase_pointer) ++{ ++ /* sizeof (Elf64_External_Ehdr) >= sizeof (Elf32_External_Ehdr) */ ++ Elf64_External_Ehdr x_ehdr64; /* Elf file header, external form */ ++ Elf_Internal_Ehdr i_ehdr; /* Elf file header, internal form */ ++ bfd_size_type x_phdrs_size; ++ gdb_byte *x_phdrs_ptr; ++ Elf_Internal_Phdr *i_phdrs; ++ int err; ++ unsigned int i; ++ bfd_vma loadbase; ++ int loadbase_set; ++ ++ gdb_assert (templ != NULL); ++ gdb_assert (sizeof (Elf64_External_Ehdr) >= sizeof (Elf32_External_Ehdr)); ++ ++ /* Read in the ELF header in external format. */ ++ err = target_read_memory (ehdr_vma, (bfd_byte *) &x_ehdr64, sizeof x_ehdr64); ++ if (err) ++ { ++ if (build_id_verbose >= BUILD_ID_VERBOSE_BINARY_PARSE) ++ warning (_("build-id: Error reading ELF header at address 0x%lx"), ++ (unsigned long) ehdr_vma); ++ return NULL; ++ } ++ ++ /* Now check to see if we have a valid ELF file, and one that BFD can ++ make use of. The magic number must match, the address size ('class') ++ and byte-swapping must match our XVEC entry. */ ++ ++ if (! elf_file_p (&x_ehdr64) ++ || x_ehdr64.e_ident[EI_VERSION] != EV_CURRENT ++ || !((bfd_get_arch_size (templ) == 64 ++ && x_ehdr64.e_ident[EI_CLASS] == ELFCLASS64) ++ || (bfd_get_arch_size (templ) == 32 ++ && x_ehdr64.e_ident[EI_CLASS] == ELFCLASS32))) ++ { ++ if (build_id_verbose >= BUILD_ID_VERBOSE_BINARY_PARSE) ++ warning (_("build-id: Unrecognized ELF header at address 0x%lx"), ++ (unsigned long) ehdr_vma); ++ return NULL; ++ } ++ ++ /* Check that file's byte order matches xvec's */ ++ switch (x_ehdr64.e_ident[EI_DATA]) ++ { ++ case ELFDATA2MSB: /* Big-endian */ ++ if (! bfd_header_big_endian (templ)) ++ { ++ if (build_id_verbose >= BUILD_ID_VERBOSE_BINARY_PARSE) ++ warning (_("build-id: Unrecognized " ++ "big-endian ELF header at address 0x%lx"), ++ (unsigned long) ehdr_vma); ++ return NULL; ++ } ++ break; ++ case ELFDATA2LSB: /* Little-endian */ ++ if (! bfd_header_little_endian (templ)) ++ { ++ if (build_id_verbose >= BUILD_ID_VERBOSE_BINARY_PARSE) ++ warning (_("build-id: Unrecognized " ++ "little-endian ELF header at address 0x%lx"), ++ (unsigned long) ehdr_vma); ++ return NULL; ++ } ++ break; ++ case ELFDATANONE: /* No data encoding specified */ ++ default: /* Unknown data encoding specified */ ++ if (build_id_verbose >= BUILD_ID_VERBOSE_BINARY_PARSE) ++ warning (_("build-id: Unrecognized " ++ "ELF header endianity at address 0x%lx"), ++ (unsigned long) ehdr_vma); ++ return NULL; ++ } ++ ++ elf_swap_ehdr_in (templ, &x_ehdr64, &i_ehdr); ++ ++ /* The file header tells where to find the program headers. ++ These are what we use to actually choose what to read. */ ++ ++ if (i_ehdr.e_phentsize != (bfd_get_arch_size (templ) == 64 ++ ? sizeof (Elf64_External_Phdr) ++ : sizeof (Elf32_External_Phdr)) ++ || i_ehdr.e_phnum == 0) ++ { ++ if (build_id_verbose >= BUILD_ID_VERBOSE_BINARY_PARSE) ++ warning (_("build-id: Invalid ELF program headers from the ELF header " ++ "at address 0x%lx"), (unsigned long) ehdr_vma); ++ return NULL; ++ } ++ ++ x_phdrs_size = (bfd_get_arch_size (templ) == 64 ? sizeof (Elf64_External_Phdr) ++ : sizeof (Elf32_External_Phdr)); ++ ++ i_phdrs = (Elf_Internal_Phdr *) xmalloc (i_ehdr.e_phnum * (sizeof *i_phdrs + x_phdrs_size)); ++ x_phdrs_ptr = (gdb_byte *) &i_phdrs[i_ehdr.e_phnum]; ++ err = target_read_memory (ehdr_vma + i_ehdr.e_phoff, (bfd_byte *) x_phdrs_ptr, ++ i_ehdr.e_phnum * x_phdrs_size); ++ if (err) ++ { ++ free (i_phdrs); ++ if (build_id_verbose >= BUILD_ID_VERBOSE_BINARY_PARSE) ++ warning (_("build-id: Error reading " ++ "ELF program headers at address 0x%lx"), ++ (unsigned long) (ehdr_vma + i_ehdr.e_phoff)); ++ return NULL; ++ } ++ ++ loadbase = ehdr_vma; ++ loadbase_set = 0; ++ for (i = 0; i < i_ehdr.e_phnum; ++i) ++ { ++ elf_swap_phdr_in (templ, (Elf64_External_Phdr *) ++ (x_phdrs_ptr + i * x_phdrs_size), &i_phdrs[i]); ++ /* IA-64 vDSO may have two mappings for one segment, where one mapping ++ is executable only, and one is read only. We must not use the ++ executable one (PF_R is the first one, PF_X the second one). */ ++ if (i_phdrs[i].p_type == PT_LOAD && (i_phdrs[i].p_flags & PF_R)) ++ { ++ /* Only the first PT_LOAD segment indicates the file bias. ++ Next segments may have P_VADDR arbitrarily higher. ++ If the first segment has P_VADDR zero any next segment must not ++ confuse us, the first one sets LOADBASE certainly enough. */ ++ if (!loadbase_set && i_phdrs[i].p_offset == 0) ++ { ++ loadbase = ehdr_vma - i_phdrs[i].p_vaddr; ++ loadbase_set = 1; ++ } ++ } ++ } ++ ++ if (build_id_verbose >= BUILD_ID_VERBOSE_BINARY_PARSE) ++ warning (_("build-id: Found ELF header at address 0x%lx, loadbase 0x%lx"), ++ (unsigned long) ehdr_vma, (unsigned long) loadbase); ++ ++ *e_phnum_pointer = i_ehdr.e_phnum; ++ *loadbase_pointer = loadbase; ++ return i_phdrs; ++} ++ ++/* BUILD_ID_ADDR_GET gets ADDR located somewhere in the object. ++ Find the first section before ADDR containing an ELF header. ++ We rely on the fact the sections from multiple files do not mix. ++ FIXME: We should check ADDR is contained _inside_ the section with possibly ++ missing content (P_FILESZ < P_MEMSZ). These omitted sections are currently ++ hidden by _BFD_ELF_MAKE_SECTION_FROM_PHDR. */ ++ ++static CORE_ADDR build_id_addr; ++struct build_id_addr_sect ++ { ++ struct build_id_addr_sect *next; ++ asection *sect; ++ }; ++static struct build_id_addr_sect *build_id_addr_sect; ++ ++static void build_id_addr_candidate (bfd *abfd, asection *sect, void *obj) ++{ ++ if (build_id_addr >= bfd_section_vma (sect)) ++ { ++ struct build_id_addr_sect *candidate; ++ ++ candidate = (struct build_id_addr_sect *) xmalloc (sizeof *candidate); ++ candidate->next = build_id_addr_sect; ++ build_id_addr_sect = candidate; ++ candidate->sect = sect; ++ } ++} ++ ++struct bfd_build_id * ++build_id_addr_get (CORE_ADDR addr) ++{ ++ struct build_id_addr_sect *candidate; ++ struct bfd_build_id *retval = NULL; ++ Elf_Internal_Phdr *i_phdr = NULL; ++ bfd_vma loadbase = 0; ++ unsigned e_phnum = 0; ++ ++ if (core_bfd == NULL) ++ return NULL; ++ ++ build_id_addr = addr; ++ gdb_assert (build_id_addr_sect == NULL); ++ bfd_map_over_sections (core_bfd, build_id_addr_candidate, NULL); ++ ++ /* Sections are sorted in the high-to-low VMAs order. ++ Stop the search on the first ELF header we find. ++ Do not continue the search even if it does not contain NT_GNU_BUILD_ID. */ ++ ++ for (candidate = build_id_addr_sect; candidate != NULL; ++ candidate = candidate->next) ++ { ++ i_phdr = elf_get_phdr (core_bfd, ++ bfd_section_vma (candidate->sect), ++ &e_phnum, &loadbase); ++ if (i_phdr != NULL) ++ break; ++ } ++ ++ if (i_phdr != NULL) ++ { ++ retval = build_id_phdr_get (core_bfd, loadbase, e_phnum, i_phdr); ++ xfree (i_phdr); ++ } ++ ++ while (build_id_addr_sect != NULL) ++ { ++ candidate = build_id_addr_sect; ++ build_id_addr_sect = candidate->next; ++ xfree (candidate); ++ } ++ ++ return retval; ++} ++ + /* See build-id.h. */ + + int +@@ -51,7 +450,7 @@ build_id_verify (bfd *abfd, size_t check_len, const bfd_byte *check) + const struct bfd_build_id *found; + int retval = 0; + +- found = build_id_bfd_get (abfd); ++ found = build_id_bfd_shdr_get (abfd); + + if (found == NULL) + warning (_("File \"%s\" has no build-id, file skipped"), +@@ -66,56 +465,159 @@ build_id_verify (bfd *abfd, size_t check_len, const bfd_byte *check) + return retval; + } + ++static char * ++link_resolve (const char *symlink, int level) ++{ ++ char buf[PATH_MAX + 1], *target, *retval; ++ ssize_t got; ++ ++ if (level > 10) ++ return xstrdup (symlink); ++ ++ got = readlink (symlink, buf, sizeof (buf)); ++ if (got < 0 || got >= sizeof (buf)) ++ return xstrdup (symlink); ++ buf[got] = '\0'; ++ ++ if (IS_ABSOLUTE_PATH (buf)) ++ target = xstrdup (buf); ++ else ++ { ++ const std::string dir (ldirname (symlink)); ++ ++ target = xstrprintf ("%s" ++#ifndef HAVE_DOS_BASED_FILE_SYSTEM ++ "/" ++#else /* HAVE_DOS_BASED_FILE_SYSTEM */ ++ "\\" ++#endif /* HAVE_DOS_BASED_FILE_SYSTEM */ ++ "%s", dir.c_str(), buf); ++ } ++ ++ retval = link_resolve (target, level + 1); ++ xfree (target); ++ return retval; ++} ++ + /* Helper for build_id_to_debug_bfd. LINK is a path to a potential + build-id-based separate debug file, potentially a symlink to the real file. + If the file exists and matches BUILD_ID, return a BFD reference to it. */ + + static gdb_bfd_ref_ptr +-build_id_to_debug_bfd_1 (const std::string &link, size_t build_id_len, +- const bfd_byte *build_id) ++build_id_to_debug_bfd_1 (const std::string &orig_link, size_t build_id_len, ++ const bfd_byte *build_id, char **link_return) + { ++ gdb_bfd_ref_ptr ret_bfd = {}; ++ std::string ret_link; ++ + if (separate_debug_file_debug) + { +- printf_unfiltered (_(" Trying %s..."), link.c_str ()); ++ printf_unfiltered (_(" Trying %s..."), orig_link.c_str ()); + gdb_flush (gdb_stdout); + } + +- /* lrealpath() is expensive even for the usually non-existent files. */ +- gdb::unique_xmalloc_ptr filename; +- if (access (link.c_str (), F_OK) == 0) +- filename.reset (lrealpath (link.c_str ())); +- +- if (filename == NULL) ++ for (unsigned seqno = 0;; seqno++) + { +- if (separate_debug_file_debug) +- printf_unfiltered (_(" no, unable to compute real path\n")); ++ std::string link = orig_link; + +- return {}; +- } ++ if (seqno > 0) ++ { ++ /* There can be multiple build-id symlinks pointing to real files ++ with the same build-id (such as hard links). Some of the real ++ files may not be installed. */ ++ ++ string_appendf (link, ".%u", seqno); ++ } + +- /* We expect to be silent on the non-existing files. */ +- gdb_bfd_ref_ptr debug_bfd = gdb_bfd_open (filename.get (), gnutarget); ++ ret_link = link; + +- if (debug_bfd == NULL) +- { +- if (separate_debug_file_debug) +- printf_unfiltered (_(" no, unable to open.\n")); ++ struct stat statbuf_trash; ++ ++ /* `access' automatically dereferences LINK. */ ++ if (lstat (link.c_str (), &statbuf_trash) != 0) ++ { ++ /* Stop increasing SEQNO. */ ++ break; ++ } ++ ++ /* lrealpath() is expensive even for the usually non-existent files. */ ++ gdb::unique_xmalloc_ptr filename; ++ ++ if (access (link.c_str (), F_OK) == 0) ++ filename.reset (lrealpath (link.c_str ())); ++ ++ if (filename == NULL) ++ { ++ if (separate_debug_file_debug) ++ printf_unfiltered (_(" no, unable to compute real path\n")); ++ ++ continue; ++ } ++ ++ /* We expect to be silent on the non-existing files. */ ++ gdb_bfd_ref_ptr debug_bfd = gdb_bfd_open (filename.get (), gnutarget, -1); + +- return {}; ++ if (debug_bfd == NULL) ++ { ++ if (separate_debug_file_debug) ++ printf_unfiltered (_(" no, unable to open.\n")); ++ ++ continue; ++ } ++ ++ if (!build_id_verify (debug_bfd.get(), build_id_len, build_id)) ++ { ++ if (separate_debug_file_debug) ++ printf_unfiltered (_(" no, build-id does not match.\n")); ++ ++ continue; ++ } ++ ++ ret_bfd = debug_bfd; ++ break; + } + +- if (!build_id_verify (debug_bfd.get(), build_id_len, build_id)) ++ std::string link_all; ++ ++ if (ret_bfd != NULL) + { + if (separate_debug_file_debug) +- printf_unfiltered (_(" no, build-id does not match.\n")); +- +- return {}; ++ printf_unfiltered (_(" yes!\n")); ++ } ++ else ++ { ++ /* If none of the real files is found report as missing file ++ always the non-.%u-suffixed file. */ ++ std::string link0 = orig_link; ++ ++ /* If the symlink has target request to install the target. ++ BASE-debuginfo.rpm contains the symlink but BASE.rpm may be missing. ++ https://bugzilla.redhat.com/show_bug.cgi?id=981154 */ ++ std::string link0_resolved (link_resolve (link0.c_str (), 0)); ++ ++ if (link_all.empty ()) ++ link_all = link0_resolved; ++ else ++ { ++ /* Use whitespace instead of DIRNAME_SEPARATOR to be compatible with ++ its possible use as an argument for installation command. */ ++ link_all += " " + link0_resolved; ++ } + } + +- if (separate_debug_file_debug) +- printf_unfiltered (_(" yes!\n")); ++ if (link_return != NULL) ++ { ++ if (ret_bfd != NULL) ++ { ++ *link_return = xstrdup (ret_link.c_str ()); ++ } ++ else ++ { ++ *link_return = xstrdup (link_all.c_str ()); ++ } ++ } + +- return debug_bfd; ++ return ret_bfd; + } + + /* Common code for finding BFDs of a given build-id. This function +@@ -124,7 +626,7 @@ build_id_to_debug_bfd_1 (const std::string &link, size_t build_id_len, + + static gdb_bfd_ref_ptr + build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id, +- const char *suffix) ++ const char *suffix, char **link_return) + { + /* Keep backward compatibility so that DEBUG_FILE_DIRECTORY being "" will + cause "/.build-id/..." lookups. */ +@@ -147,16 +649,17 @@ build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id, + if (size > 0) + { + size--; +- string_appendf (link, "%02x/", (unsigned) *data++); ++ string_appendf (link, "%02x", (unsigned) *data++); + } +- ++ if (size > 0) ++ link += "/"; + while (size-- > 0) + string_appendf (link, "%02x", (unsigned) *data++); + + link += suffix; + + gdb_bfd_ref_ptr debug_bfd +- = build_id_to_debug_bfd_1 (link, build_id_len, build_id); ++ = build_id_to_debug_bfd_1 (link, build_id_len, build_id, link_return); + if (debug_bfd != NULL) + return debug_bfd; + +@@ -170,7 +673,8 @@ build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id, + if (strcmp (gdb_sysroot, TARGET_SYSROOT_PREFIX) != 0) + { + link = gdb_sysroot + link; +- debug_bfd = build_id_to_debug_bfd_1 (link, build_id_len, build_id); ++ debug_bfd = build_id_to_debug_bfd_1 (link, build_id_len, build_id, ++ link_return); + if (debug_bfd != NULL) + return debug_bfd; + } +@@ -179,38 +683,208 @@ build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id, + return {}; + } + ++char * ++build_id_to_filename (const struct bfd_build_id *build_id, char **link_return) ++{ ++ gdb_bfd_ref_ptr abfd; ++ char *result; ++ ++ abfd = build_id_to_exec_bfd (build_id->size, build_id->data, link_return); ++ if (abfd == NULL) ++ return NULL; ++ ++ result = xstrdup (bfd_get_filename (abfd.get ())); ++ return result; ++} ++ ++/* This MISSING_FILEPAIR_HASH tracker is used only for the duplicite messages ++ Try to install the hash file ... ++ avoidance. */ ++ ++struct missing_filepair ++ { ++ char *binary; ++ char *debug; ++ char data[1]; ++ }; ++ ++static struct htab *missing_filepair_hash; ++static struct obstack missing_filepair_obstack; ++ ++static void * ++missing_filepair_xcalloc (size_t nmemb, size_t nmemb_size) ++{ ++ void *retval; ++ size_t size = nmemb * nmemb_size; ++ ++ retval = obstack_alloc (&missing_filepair_obstack, size); ++ memset (retval, 0, size); ++ return retval; ++} ++ ++static hashval_t ++missing_filepair_hash_func (const struct missing_filepair *elem) ++{ ++ hashval_t retval = 0; ++ ++ retval ^= htab_hash_string (elem->binary); ++ if (elem->debug != NULL) ++ retval ^= htab_hash_string (elem->debug); ++ ++ return retval; ++} ++ ++static int ++missing_filepair_eq (const struct missing_filepair *elem1, ++ const struct missing_filepair *elem2) ++{ ++ return strcmp (elem1->binary, elem2->binary) == 0 ++ && ((elem1->debug == NULL) == (elem2->debug == NULL)) ++ && (elem1->debug == NULL || strcmp (elem1->debug, elem2->debug) == 0); ++} ++ ++static void ++missing_filepair_change (void) ++{ ++ if (missing_filepair_hash != NULL) ++ { ++ obstack_free (&missing_filepair_obstack, NULL); ++ /* All their memory came just from missing_filepair_OBSTACK. */ ++ missing_filepair_hash = NULL; ++ } ++} ++ ++static void ++debug_print_executable_changed (void) ++{ ++ missing_filepair_change (); ++} ++ ++/* Notify user the file BINARY with (possibly NULL) associated separate debug ++ information file DEBUG is missing. DEBUG may or may not be the build-id ++ file such as would be: ++ /usr/lib/debug/.build-id/dd/b1d2ce632721c47bb9e8679f369e2295ce71be.debug ++ */ ++ ++void ++debug_print_missing (const char *binary, const char *debug) ++{ ++ size_t binary_len0 = strlen (binary) + 1; ++ size_t debug_len0 = debug ? strlen (debug) + 1 : 0; ++ struct missing_filepair missing_filepair_find; ++ struct missing_filepair *missing_filepair; ++ struct missing_filepair **slot; ++ ++ if (build_id_verbose < BUILD_ID_VERBOSE_FILENAMES) ++ return; ++ ++ if (missing_filepair_hash == NULL) ++ { ++ obstack_init (&missing_filepair_obstack); ++ missing_filepair_hash = htab_create_alloc (64, ++ (hashval_t (*) (const void *)) missing_filepair_hash_func, ++ (int (*) (const void *, const void *)) missing_filepair_eq, NULL, ++ missing_filepair_xcalloc, NULL); ++ } ++ ++ /* Use MISSING_FILEPAIR_FIND first instead of calling obstack_alloc with ++ obstack_free in the case of a (rare) match. The problem is ALLOC_F for ++ MISSING_FILEPAIR_HASH allocates from MISSING_FILEPAIR_OBSTACK maintenance ++ structures for MISSING_FILEPAIR_HASH. Calling obstack_free would possibly ++ not to free only MISSING_FILEPAIR but also some such structures (allocated ++ during the htab_find_slot call). */ ++ ++ missing_filepair_find.binary = (char *) binary; ++ missing_filepair_find.debug = (char *) debug; ++ slot = (struct missing_filepair **) htab_find_slot (missing_filepair_hash, ++ &missing_filepair_find, ++ INSERT); ++ ++ /* While it may be still printed duplicitely with the missing debuginfo file ++ * it is due to once printing about the binary file build-id link and once ++ * about the .debug file build-id link as both the build-id symlinks are ++ * located in the debuginfo package. */ ++ ++ if (*slot != NULL) ++ return; ++ ++ missing_filepair = (struct missing_filepair *) obstack_alloc (&missing_filepair_obstack, ++ sizeof (*missing_filepair) - 1 ++ + binary_len0 + debug_len0); ++ missing_filepair->binary = missing_filepair->data; ++ memcpy (missing_filepair->binary, binary, binary_len0); ++ if (debug != NULL) ++ { ++ missing_filepair->debug = missing_filepair->binary + binary_len0; ++ memcpy (missing_filepair->debug, debug, debug_len0); ++ } ++ else ++ missing_filepair->debug = NULL; ++ ++ *slot = missing_filepair; ++ ++ /* We do not collect and flush these messages as each such message ++ already requires its own separate lines. */ ++ ++ fprintf_unfiltered (gdb_stdlog, ++ _("Missing separate debuginfo for %s\n"), binary); ++ if (debug != NULL) ++ fprintf_unfiltered (gdb_stdlog, _("Try to install the hash file %s\n"), ++ debug); ++} ++ + /* See build-id.h. */ + + gdb_bfd_ref_ptr +-build_id_to_debug_bfd (size_t build_id_len, const bfd_byte *build_id) ++build_id_to_debug_bfd (size_t build_id_len, const bfd_byte *build_id, ++ char **link_return) + { +- return build_id_to_bfd_suffix (build_id_len, build_id, ".debug"); ++ return build_id_to_bfd_suffix (build_id_len, build_id, ".debug", ++ link_return); + } + + /* See build-id.h. */ + + gdb_bfd_ref_ptr +-build_id_to_exec_bfd (size_t build_id_len, const bfd_byte *build_id) ++build_id_to_exec_bfd (size_t build_id_len, const bfd_byte *build_id, ++ char **link_return) + { +- return build_id_to_bfd_suffix (build_id_len, build_id, ""); ++ return build_id_to_bfd_suffix (build_id_len, build_id, "", link_return); + } + + /* See build-id.h. */ + + std::string +-find_separate_debug_file_by_buildid (struct objfile *objfile) ++find_separate_debug_file_by_buildid (struct objfile *objfile, ++ gdb::unique_xmalloc_ptr *build_id_filename_return) + { + const struct bfd_build_id *build_id; + +- build_id = build_id_bfd_get (objfile->obfd); ++ if (build_id_filename_return) ++ *build_id_filename_return = NULL; ++ ++ build_id = build_id_bfd_shdr_get (objfile->obfd); + if (build_id != NULL) + { + if (separate_debug_file_debug) + printf_unfiltered (_("\nLooking for separate debug info (build-id) for " + "%s\n"), objfile_name (objfile)); + ++ char *build_id_filename_cstr = NULL; + gdb_bfd_ref_ptr abfd (build_id_to_debug_bfd (build_id->size, +- build_id->data)); ++ build_id->data, ++ (!build_id_filename_return ? NULL : &build_id_filename_cstr))); ++ if (build_id_filename_return) ++ { ++ if (!build_id_filename_cstr) ++ gdb_assert (!*build_id_filename_return); ++ else ++ { ++ *build_id_filename_return = gdb::unique_xmalloc_ptr (build_id_filename_cstr); ++ build_id_filename_cstr = NULL; ++ } ++ } ++ + /* Prevent looping on a stripped .debug file. */ + if (abfd != NULL + && filename_cmp (bfd_get_filename (abfd.get ()), +@@ -223,3 +897,21 @@ find_separate_debug_file_by_buildid (struct objfile *objfile) + + return std::string (); + } ++ ++extern void _initialize_build_id (void); ++ ++void ++_initialize_build_id (void) ++{ ++ add_setshow_zinteger_cmd ("build-id-verbose", no_class, &build_id_verbose, ++ _("\ ++Set debugging level of the build-id locator."), _("\ ++Show debugging level of the build-id locator."), _("\ ++Level 1 (default) enables printing the missing debug filenames,\n\ ++level 2 also prints the parsing of binaries to find the identificators."), ++ NULL, ++ show_build_id_verbose, ++ &setlist, &showlist); ++ ++ gdb::observers::executable_changed.attach (debug_print_executable_changed); ++} +diff --git a/gdb/build-id.h b/gdb/build-id.h +--- a/gdb/build-id.h ++++ b/gdb/build-id.h +@@ -23,9 +23,10 @@ + #include "gdb_bfd.h" + #include "gdbsupport/rsp-low.h" + +-/* Locate NT_GNU_BUILD_ID from ABFD and return its content. */ ++/* Separate debuginfo files have corrupted PHDR but SHDR is correct there. ++ Locate NT_GNU_BUILD_ID from ABFD and return its content. */ + +-extern const struct bfd_build_id *build_id_bfd_get (bfd *abfd); ++extern const struct bfd_build_id *build_id_bfd_shdr_get (bfd *abfd); + + /* Return true if ABFD has NT_GNU_BUILD_ID matching the CHECK value. + Otherwise, issue a warning and return false. */ +@@ -38,21 +39,26 @@ extern int build_id_verify (bfd *abfd, + can be found, return NULL. */ + + extern gdb_bfd_ref_ptr build_id_to_debug_bfd (size_t build_id_len, +- const bfd_byte *build_id); ++ const bfd_byte *build_id, ++ char **link_return); ++ ++extern char *build_id_to_filename (const struct bfd_build_id *build_id, ++ char **link_return); + + /* Find and open a BFD for an executable file given a build-id. If no BFD + can be found, return NULL. The returned reference to the BFD must be + released by the caller. */ + + extern gdb_bfd_ref_ptr build_id_to_exec_bfd (size_t build_id_len, +- const bfd_byte *build_id); ++ const bfd_byte *build_id, ++ char **link_return); + + /* Find the separate debug file for OBJFILE, by using the build-id + associated with OBJFILE's BFD. If successful, returns the file name for the + separate debug file, otherwise, return an empty string. */ + +-extern std::string find_separate_debug_file_by_buildid +- (struct objfile *objfile); ++extern std::string find_separate_debug_file_by_buildid (struct objfile *objfile, ++ gdb::unique_xmalloc_ptr *build_id_filename_return); + + /* Return an hex-string representation of BUILD_ID. */ + +diff --git a/gdb/coffread.c b/gdb/coffread.c +--- a/gdb/coffread.c ++++ b/gdb/coffread.c +@@ -709,7 +709,8 @@ coff_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags) + /* Try to add separate debug file if no symbols table found. */ + if (!objfile_has_partial_symbols (objfile)) + { +- std::string debugfile = find_separate_debug_file_by_buildid (objfile); ++ std::string debugfile = find_separate_debug_file_by_buildid (objfile, ++ NULL); + + if (debugfile.empty ()) + debugfile = find_separate_debug_file_by_debuglink (objfile); +diff --git a/gdb/corelow.c b/gdb/corelow.c +--- a/gdb/corelow.c ++++ b/gdb/corelow.c +@@ -22,6 +22,10 @@ + #include + #include + #include "frame.h" /* required by inferior.h */ ++#include "auxv.h" ++#include "build-id.h" ++#include "elf/common.h" ++#include "gdbcmd.h" + #include "inferior.h" + #include "infrun.h" + #include "symtab.h" +@@ -362,6 +366,8 @@ add_to_thread_list (bfd *abfd, asection *asect, void *reg_sect_arg) + switch_to_thread (thr); /* Yes, make it current. */ + } + ++static bool build_id_core_loads = true; ++ + /* Issue a message saying we have no core to debug, if FROM_TTY. */ + + static void +@@ -398,19 +404,25 @@ core_file_command (const char *filename, int from_tty) + static void + locate_exec_from_corefile_build_id (bfd *abfd, int from_tty) + { +- const bfd_build_id *build_id = build_id_bfd_get (abfd); ++ const bfd_build_id *build_id = build_id_bfd_shdr_get (abfd); + if (build_id == nullptr) + return; + ++ char *build_id_filename; + gdb_bfd_ref_ptr execbfd +- = build_id_to_exec_bfd (build_id->size, build_id->data); ++ = build_id_to_exec_bfd (build_id->size, build_id->data, ++ &build_id_filename); + + if (execbfd != nullptr) + { + exec_file_attach (bfd_get_filename (execbfd.get ()), from_tty); + symbol_file_add_main (bfd_get_filename (execbfd.get ()), + symfile_add_flag (from_tty ? SYMFILE_VERBOSE : 0)); ++ if (symfile_objfile != NULL) ++ symfile_objfile->flags |= OBJF_BUILD_ID_CORE_LOADED; + } ++ else ++ debug_print_missing (BUILD_ID_MAIN_EXECUTABLE_FILENAME, build_id_filename); + } + + /* See gdbcore.h. */ +@@ -1189,4 +1201,11 @@ _initialize_corelow () + maintenance_print_core_file_backed_mappings, + _("Print core file's file-backed mappings."), + &maintenanceprintlist); ++ ++ add_setshow_boolean_cmd ("build-id-core-loads", class_files, ++ &build_id_core_loads, _("\ ++Set whether CORE-FILE loads the build-id associated files automatically."), _("\ ++Show whether CORE-FILE loads the build-id associated files automatically."), ++ NULL, NULL, NULL, ++ &setlist, &showlist); + } +diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo +--- a/gdb/doc/gdb.texinfo ++++ b/gdb/doc/gdb.texinfo +@@ -21074,6 +21074,27 @@ information files. + + @end table + ++You can also adjust the current verbosity of the @dfn{build id} locating. ++ ++@table @code ++ ++@kindex set build-id-verbose ++@item set build-id-verbose 0 ++No additional messages are printed. ++ ++@item set build-id-verbose 1 ++Missing separate debug filenames are printed. ++ ++@item set build-id-verbose 2 ++Missing separate debug filenames are printed and also all the parsing of the ++binaries to find their @dfn{build id} content is printed. ++ ++@kindex show build-id-verbose ++@item show build-id-verbose ++Show the current verbosity value for the @dfn{build id} content locating. ++ ++@end table ++ + @cindex @code{.gnu_debuglink} sections + @cindex debug link sections + A debug link is a special section of the executable file named +diff --git a/gdb/dwarf2/index-cache.c b/gdb/dwarf2/index-cache.c +--- a/gdb/dwarf2/index-cache.c ++++ b/gdb/dwarf2/index-cache.c +@@ -95,7 +95,7 @@ index_cache::store (dwarf2_per_objfile *per_objfile) + return; + + /* Get build id of objfile. */ +- const bfd_build_id *build_id = build_id_bfd_get (obj->obfd); ++ const bfd_build_id *build_id = build_id_bfd_shdr_get (obj->obfd); + if (build_id == nullptr) + { + if (debug_index_cache) +@@ -113,7 +113,8 @@ index_cache::store (dwarf2_per_objfile *per_objfile) + + if (dwz != nullptr) + { +- const bfd_build_id *dwz_build_id = build_id_bfd_get (dwz->dwz_bfd.get ()); ++ const bfd_build_id *dwz_build_id ++ = build_id_bfd_shdr_get (dwz->dwz_bfd.get ()); + + if (dwz_build_id == nullptr) + { +diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c +--- a/gdb/dwarf2/read.c ++++ b/gdb/dwarf2/read.c +@@ -2225,7 +2225,7 @@ dwarf2_get_dwz_file (dwarf2_per_bfd *per_bfd) + } + + if (dwz_bfd == NULL) +- dwz_bfd = build_id_to_debug_bfd (buildid_len, buildid); ++ dwz_bfd = build_id_to_debug_bfd (buildid_len, buildid, NULL); + + if (dwz_bfd == nullptr) + { +@@ -5989,7 +5989,7 @@ get_gdb_index_contents_from_section (objfile *obj, T *section_owner) + static gdb::array_view + get_gdb_index_contents_from_cache (objfile *obj, dwarf2_per_bfd *dwarf2_per_bfd) + { +- const bfd_build_id *build_id = build_id_bfd_get (obj->obfd); ++ const bfd_build_id *build_id = build_id_bfd_shdr_get (obj->obfd); + if (build_id == nullptr) + return {}; + +@@ -6002,7 +6002,7 @@ get_gdb_index_contents_from_cache (objfile *obj, dwarf2_per_bfd *dwarf2_per_bfd) + static gdb::array_view + get_gdb_index_contents_from_cache_dwz (objfile *obj, dwz_file *dwz) + { +- const bfd_build_id *build_id = build_id_bfd_get (dwz->dwz_bfd.get ()); ++ const bfd_build_id *build_id = build_id_bfd_shdr_get (dwz->dwz_bfd.get ()); + if (build_id == nullptr) + return {}; + +diff --git a/gdb/elfread.c b/gdb/elfread.c +--- a/gdb/elfread.c ++++ b/gdb/elfread.c +@@ -1298,7 +1298,9 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags) + && objfile->separate_debug_objfile == NULL + && objfile->separate_debug_objfile_backlink == NULL) + { +- std::string debugfile = find_separate_debug_file_by_buildid (objfile); ++ gdb::unique_xmalloc_ptr build_id_filename; ++ std::string debugfile ++ = find_separate_debug_file_by_buildid (objfile, &build_id_filename); + + if (debugfile.empty ()) + debugfile = find_separate_debug_file_by_debuglink (objfile); +@@ -1313,7 +1315,7 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags) + else + { + has_dwarf2 = false; +- const struct bfd_build_id *build_id = build_id_bfd_get (objfile->obfd); ++ const struct bfd_build_id *build_id = build_id_bfd_shdr_get (objfile->obfd); + + if (build_id != nullptr) + { +@@ -1338,6 +1340,10 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags) + has_dwarf2 = true; + } + } ++ /* Check if any separate debug info has been extracted out. */ ++ else if (bfd_get_section_by_name (objfile->obfd, ".gnu_debuglink") ++ != NULL) ++ debug_print_missing (objfile_name (objfile), build_id_filename.get ()); + } + } + } +diff --git a/gdb/exec.c b/gdb/exec.c +--- a/gdb/exec.c ++++ b/gdb/exec.c +@@ -264,7 +264,7 @@ validate_exec_file (int from_tty) + reopen_exec_file (); + current_exec_file = get_exec_file (0); + +- const bfd_build_id *exec_file_build_id = build_id_bfd_get (exec_bfd); ++ const bfd_build_id *exec_file_build_id = build_id_bfd_shdr_get (exec_bfd); + if (exec_file_build_id != nullptr) + { + /* Prepend the target prefix, to force gdb_bfd_open to open the +@@ -277,7 +277,7 @@ validate_exec_file (int from_tty) + if (abfd != nullptr) + { + const bfd_build_id *target_exec_file_build_id +- = build_id_bfd_get (abfd.get ()); ++ = build_id_bfd_shdr_get (abfd.get ()); + + if (target_exec_file_build_id != nullptr) + { +diff --git a/gdb/objfiles.h b/gdb/objfiles.h +--- a/gdb/objfiles.h ++++ b/gdb/objfiles.h +@@ -714,6 +714,10 @@ struct objfile + bool skip_jit_symbol_lookup = false; + }; + ++/* This file was loaded according to the BUILD_ID_CORE_LOADS rules. */ ++ ++#define OBJF_BUILD_ID_CORE_LOADED static_cast(1 << 12) ++ + /* A deleter for objfile. */ + + struct objfile_deleter +diff --git a/gdb/python/py-objfile.c b/gdb/python/py-objfile.c +--- a/gdb/python/py-objfile.c ++++ b/gdb/python/py-objfile.c +@@ -132,7 +132,7 @@ objfpy_get_build_id (PyObject *self, void *closure) + + try + { +- build_id = build_id_bfd_get (objfile->obfd); ++ build_id = build_id_bfd_shdr_get (objfile->obfd); + } + catch (const gdb_exception &except) + { +@@ -600,7 +600,7 @@ objfpy_lookup_objfile_by_build_id (const char *build_id) + /* Don't return separate debug files. */ + if (objfile->separate_debug_objfile_backlink != NULL) + continue; +- obfd_build_id = build_id_bfd_get (objfile->obfd); ++ obfd_build_id = build_id_bfd_shdr_get (objfile->obfd); + if (obfd_build_id == NULL) + continue; + if (objfpy_build_id_matches (obfd_build_id, build_id)) +diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c +--- a/gdb/solib-svr4.c ++++ b/gdb/solib-svr4.c +@@ -45,6 +45,7 @@ + #include "auxv.h" + #include "gdb_bfd.h" + #include "probe.h" ++#include "build-id.h" + + static struct link_map_offsets *svr4_fetch_link_map_offsets (void); + static int svr4_have_link_map_offsets (void); +@@ -1338,9 +1339,51 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm, + continue; + } + +- strncpy (newobj->so_name, buffer.get (), SO_NAME_MAX_PATH_SIZE - 1); +- newobj->so_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0'; +- strcpy (newobj->so_original_name, newobj->so_name); ++ { ++ struct bfd_build_id *build_id; ++ ++ 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); ++ if (build_id != NULL) ++ { ++ char *name, *build_id_filename; ++ ++ /* Missing the build-id matching separate debug info file ++ would be handled while SO_NAME gets loaded. */ ++ name = build_id_to_filename (build_id, &build_id_filename); ++ if (name != NULL) ++ { ++ strncpy (newobj->so_name, name, SO_NAME_MAX_PATH_SIZE - 1); ++ newobj->so_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0'; ++ 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; ++ } ++ ++ xfree (build_id_filename); ++ xfree (build_id); ++ } ++ } + + /* If this entry has no name, or its name matches the name + for the main executable, don't include it in the list. */ +diff --git a/gdb/source.c b/gdb/source.c +--- a/gdb/source.c ++++ b/gdb/source.c +@@ -1165,7 +1165,7 @@ open_source_file (struct symtab *s) + srcpath += s->filename; + } + +- const struct bfd_build_id *build_id = build_id_bfd_get (ofp->obfd); ++ const struct bfd_build_id *build_id = build_id_bfd_shdr_get (ofp->obfd); + + /* Query debuginfod for the source file. */ + if (build_id != nullptr && !srcpath.empty ()) +diff --git a/gdb/symfile.h b/gdb/symfile.h +--- a/gdb/symfile.h ++++ b/gdb/symfile.h +@@ -550,12 +550,18 @@ void expand_symtabs_matching + void map_symbol_filenames (symbol_filename_ftype *fun, void *data, + int need_fullname); + ++ + /* Target-agnostic function to load the sections of an executable into memory. + + ARGS should be in the form "EXECUTABLE [OFFSET]", where OFFSET is an + optional offset to apply to each section. */ + extern void generic_load (const char *args, int from_tty); + ++/* build-id support. */ ++extern struct bfd_build_id *build_id_addr_get (CORE_ADDR addr); ++extern void debug_print_missing (const char *binary, const char *debug); ++#define BUILD_ID_MAIN_EXECUTABLE_FILENAME _("the main executable file") ++ + /* From dwarf2read.c */ + + /* Names for a dwarf2 debugging section. The field NORMAL is the normal +diff --git a/gdb/testsuite/gdb.base/corefile.exp b/gdb/testsuite/gdb.base/corefile.exp +--- a/gdb/testsuite/gdb.base/corefile.exp ++++ b/gdb/testsuite/gdb.base/corefile.exp +@@ -343,3 +343,33 @@ gdb_test_multiple "core-file $corefile" $test { + pass $test + } + } ++ ++ ++# Test auto-loading of binary files through build-id from the core file. ++set buildid [build_id_debug_filename_get $binfile] ++set wholetest "binfile found by build-id" ++if {$buildid == ""} { ++ untested "$wholetest (binary has no build-id)" ++} else { ++ gdb_exit ++ gdb_start ++ ++ regsub {\.debug$} $buildid {} buildid ++ set debugdir [standard_output_file ${testfile}-debugdir] ++ file delete -force -- $debugdir ++ file mkdir $debugdir/[file dirname $buildid] ++ file copy $binfile $debugdir/$buildid ++ ++ set test "show debug-file-directory" ++ gdb_test_multiple $test $test { ++ -re "The directory where separate debug symbols are searched for is \"(.*)\"\\.\r\n$gdb_prompt $" { ++ set debugdir_orig $expect_out(1,string) ++ pass $test ++ } ++ } ++ gdb_test_no_output "set debug-file-directory $debugdir:$debugdir_orig" "set debug-file-directory" ++ gdb_test "show build-id-core-loads" {Whether CORE-FILE loads the build-id associated files automatically is on\.} ++ gdb_test "core-file $corefile" "\r\nProgram terminated with .*" "core-file without executable" ++ gdb_test "info files" "Local exec file:\r\n\[ \t\]*`[string_to_regexp $debugdir/$buildid]', file type .*" ++ pass $wholetest ++} +diff --git a/gdb/testsuite/gdb.base/gdbinit-history.exp b/gdb/testsuite/gdb.base/gdbinit-history.exp +--- a/gdb/testsuite/gdb.base/gdbinit-history.exp ++++ b/gdb/testsuite/gdb.base/gdbinit-history.exp +@@ -181,7 +181,8 @@ proc test_empty_history_filename { } { + global env + global gdb_prompt + +- set common_history [list "set height 0" "set width 0"] ++ set common_history [list "set height 0" "set width 0" \ ++ "set build-id-verbose 0"] + + set test_dir [standard_output_file history_test] + remote_exec host "mkdir -p $test_dir" +diff --git a/gdb/testsuite/gdb.base/new-ui-pending-input.exp b/gdb/testsuite/gdb.base/new-ui-pending-input.exp +--- a/gdb/testsuite/gdb.base/new-ui-pending-input.exp ++++ b/gdb/testsuite/gdb.base/new-ui-pending-input.exp +@@ -62,6 +62,7 @@ proc test_command_line_new_ui_pending_input {} { + set options "" + append options " -iex \"set height 0\"" + append options " -iex \"set width 0\"" ++ append options " -iex \"set build-id-verbose 0\"" + append options " -iex \"new-ui console $extra_tty_name\"" + append options " -ex \"b $bpline\"" + append options " -ex \"run\"" +diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp +--- a/gdb/testsuite/lib/gdb.exp ++++ b/gdb/testsuite/lib/gdb.exp +@@ -2011,6 +2011,17 @@ proc default_gdb_start { } { + } + } + ++ # Turn off the missing warnings as the testsuite does not expect it. ++ send_gdb "set build-id-verbose 0\n" ++ gdb_expect 10 { ++ -re "$gdb_prompt $" { ++ verbose "Disabled the missing debug infos warnings." 2 ++ } ++ timeout { ++ warning "Could not disable the missing debug infos warnings.." ++ } ++ } ++ + gdb_debug_init + return 0 + } +diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp +--- a/gdb/testsuite/lib/mi-support.exp ++++ b/gdb/testsuite/lib/mi-support.exp +@@ -308,6 +308,16 @@ proc default_mi_gdb_start { args } { + warning "Couldn't set the width to 0." + } + } ++ # Turn off the missing warnings as the testsuite does not expect it. ++ send_gdb "190-gdb-set build-id-verbose 0\n" ++ gdb_expect 10 { ++ -re ".*190-gdb-set build-id-verbose 0\r\n190\\\^done\r\n$mi_gdb_prompt$" { ++ verbose "Disabled the missing debug infos warnings." 2 ++ } ++ timeout { ++ warning "Could not disable the missing debug infos warnings.." ++ } ++ } + + if { $separate_inferior_pty } { + mi_create_inferior_pty diff --git a/SOURCES/gdb-6.6-bz229517-gcore-without-terminal.patch b/SOURCES/gdb-6.6-bz229517-gcore-without-terminal.patch new file mode 100644 index 0000000..2c127cc --- /dev/null +++ b/SOURCES/gdb-6.6-bz229517-gcore-without-terminal.patch @@ -0,0 +1,188 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Jan Kratochvil +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 + + * gdb_gcore.sh: Redirect GDB from ` + + * 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 ++#include ++#include ++#include ++#include ++#include ++#include ++ ++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} \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 . ++# 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" diff --git a/SOURCES/gdb-6.6-bz230000-power6-disassembly-test.patch b/SOURCES/gdb-6.6-bz230000-power6-disassembly-test.patch new file mode 100644 index 0000000..2b36147 --- /dev/null +++ b/SOURCES/gdb-6.6-bz230000-power6-disassembly-test.patch @@ -0,0 +1,94 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +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 */ diff --git a/SOURCES/gdb-6.6-bz237572-ppc-atomic-sequence-test.patch b/SOURCES/gdb-6.6-bz237572-ppc-atomic-sequence-test.patch new file mode 100644 index 0000000..4faef13 --- /dev/null +++ b/SOURCES/gdb-6.6-bz237572-ppc-atomic-sequence-test.patch @@ -0,0 +1,278 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Jan Kratochvil +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 + + * 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 ++#include ++#include ++#include ++#include ++ ++#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" diff --git a/SOURCES/gdb-6.6-testsuite-timeouts.patch b/SOURCES/gdb-6.6-testsuite-timeouts.patch new file mode 100644 index 0000000..a896313 --- /dev/null +++ b/SOURCES/gdb-6.6-testsuite-timeouts.patch @@ -0,0 +1,32 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +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 + # 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 + # to continue" prompts. + gdb_test_no_output "set height 0" diff --git a/SOURCES/gdb-6.7-charsign-test.patch b/SOURCES/gdb-6.7-charsign-test.patch new file mode 100644 index 0000000..1a66390 --- /dev/null +++ b/SOURCES/gdb-6.7-charsign-test.patch @@ -0,0 +1,130 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Jan Kratochvil +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 + + * gdb.base/charsign.exp, gdb.base/charsign.c: New files. + [ stripped ] + +2007-10-19 Jan Kratochvil + + 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} diff --git a/SOURCES/gdb-6.7-ppc-clobbered-registers-O2-test.patch b/SOURCES/gdb-6.7-ppc-clobbered-registers-O2-test.patch new file mode 100644 index 0000000..08ee2f9 --- /dev/null +++ b/SOURCES/gdb-6.7-ppc-clobbered-registers-O2-test.patch @@ -0,0 +1,108 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Jan Kratochvil +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 + + * 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 + + * 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=.*operand1=.*" \ ++ "Check value of call clobbered registers" diff --git a/SOURCES/gdb-6.7-testsuite-stable-results.patch b/SOURCES/gdb-6.7-testsuite-stable-results.patch new file mode 100644 index 0000000..0eca1a7 --- /dev/null +++ b/SOURCES/gdb-6.7-testsuite-stable-results.patch @@ -0,0 +1,104 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Jan Kratochvil +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 + + * 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 +@@ -559,6 +559,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 diff --git a/SOURCES/gdb-6.8-bz442765-threaded-exec-test.patch b/SOURCES/gdb-6.8-bz442765-threaded-exec-test.patch new file mode 100644 index 0000000..90685c7 --- /dev/null +++ b/SOURCES/gdb-6.8-bz442765-threaded-exec-test.patch @@ -0,0 +1,181 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +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 +-#include + #include + #include + #include ++#include + ++#ifdef THREADS ++ ++# include + + 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 \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 [list ${binfile_nothreads} ${binfile_threads} 0] + + gdb_test_multiple {} "Program exited" { + -re "\r\n\\\[Inferior .* exited normally\\\]\r\n$gdb_prompt $" { diff --git a/SOURCES/gdb-6.8-bz466901-backtrace-full-prelinked.patch b/SOURCES/gdb-6.8-bz466901-backtrace-full-prelinked.patch new file mode 100644 index 0000000..39d8947 --- /dev/null +++ b/SOURCES/gdb-6.8-bz466901-backtrace-full-prelinked.patch @@ -0,0 +1,481 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +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 . */ ++ ++/* ++#include ++ ++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 . */ ++ ++/* 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()" diff --git a/SOURCES/gdb-archer-next-over-throw-cxx-exec.patch b/SOURCES/gdb-archer-next-over-throw-cxx-exec.patch new file mode 100644 index 0000000..ba71cd3 --- /dev/null +++ b/SOURCES/gdb-archer-next-over-throw-cxx-exec.patch @@ -0,0 +1,88 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +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 . */ ++ ++#include ++ ++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,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 . ++ ++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 ++ } ++} ++ ++# Run to end. The buggy GDB failed instead with: ++# Cannot access memory at address ADDR. ++gdb_continue_to_end "" "continue" 1 diff --git a/SOURCES/gdb-bz601887-dwarf4-rh-test.patch b/SOURCES/gdb-bz601887-dwarf4-rh-test.patch new file mode 100644 index 0000000..966c986 --- /dev/null +++ b/SOURCES/gdb-bz601887-dwarf4-rh-test.patch @@ -0,0 +1,254 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +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 . */ ++ ++ .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 . */ ++ ++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 . ++ ++# 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\)} diff --git a/SOURCES/gdb-bz634108-solib_address.patch b/SOURCES/gdb-bz634108-solib_address.patch new file mode 100644 index 0000000..58b473f --- /dev/null +++ b/SOURCES/gdb-bz634108-solib_address.patch @@ -0,0 +1,41 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +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 . ++ ++# 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" diff --git a/SOURCES/gdb-ccache-workaround.patch b/SOURCES/gdb-ccache-workaround.patch new file mode 100644 index 0000000..60bc5cc --- /dev/null +++ b/SOURCES/gdb-ccache-workaround.patch @@ -0,0 +1,26 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +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}" \ diff --git a/SOURCES/gdb-container-rh-pkg.patch b/SOURCES/gdb-container-rh-pkg.patch new file mode 100644 index 0000000..04a7f3c --- /dev/null +++ b/SOURCES/gdb-container-rh-pkg.patch @@ -0,0 +1,30 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +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 +@@ -14031,7 +14031,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; ++ } + + inferior *inf = find_inferior_pid (this, pid); + if (inf == NULL) diff --git a/SOURCES/gdb-core-open-vdso-warning.patch b/SOURCES/gdb-core-open-vdso-warning.patch new file mode 100644 index 0000000..f58d8be --- /dev/null +++ b/SOURCES/gdb-core-open-vdso-warning.patch @@ -0,0 +1,58 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +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 +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 +@@ -71,8 +72,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" diff --git a/SOURCES/gdb-dont-overwrite-fsgsbase-m32.patch b/SOURCES/gdb-dont-overwrite-fsgsbase-m32.patch new file mode 100644 index 0000000..ee9ad49 --- /dev/null +++ b/SOURCES/gdb-dont-overwrite-fsgsbase-m32.patch @@ -0,0 +1,139 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Tue, 1 Jun 2021 10:14:31 -0700 +Subject: gdb-dont-overwrite-fsgsbase-m32.patch + +;; Backport "[gdb/server] Don't overwrite fs/gs_base with -m32" +;; (Tom de Vries) + +Consider a minimal test-case test.c: +... +int main (void) { return 0; } +... +compiled with -m32: +... +$ gcc test.c -m32 +... + +When running the exec using gdbserver on openSUSE Factory (currently running a +linux kernel version 5.10.5): +... +$ gdbserver localhost:12345 a.out +... +to which we connect in a gdb session, we run into a segfault in the inferior: +... +$ gdb -batch -q -ex "target remote localhost:12345" -ex continue +Program received signal SIGSEGV, Segmentation fault. +0xf7dd8bd2 in init_cacheinfo () at ../sysdeps/x86/cacheinfo.c:761 +... + +The segfault is caused by gdbserver overwriting $gs_base with 0 using +PTRACE_SETREGS. After it is overwritten, the next use of $gs in the inferior +will trigger the segfault. + +Before linux kernel version 5.9, the value used by PTRACE_SETREGS for $gs_base +was ignored, but starting version 5.9, the linux kernel has support for +intel architecture extension FSGSBASE, which allows users to modify $gs_base, +and consequently PTRACE_SETREGS can no longer ignore the $gs_base value. + +The overwrite of $gs_base with 0 is done by a memset in x86_fill_gregset, +which was added in commit 9e0aa64f551 "Fix gdbserver qGetTLSAddr for +x86_64 -m32". The memset intends to zero-extend 32-bit registers that are +tracked in the regcache to 64-bit when writing them into the PTRACE_SETREGS +data argument. But in addition, it overwrites other registers that are +not tracked in the regcache, such as $gs_base. + +Fix the segfault by redoing the fix from commit 9e0aa64f551 in minimal form. + +Tested on x86_64-linux: +- openSUSE Leap 15.2 (using kernel version 5.3.18): + - native + - gdbserver -m32 + - -m32 +- openSUSE Factory (using kernel version 5.10.5): + - native + - m32 + +gdbserver/ChangeLog: + +2021-01-20 Tom de Vries + + * linux-x86-low.cc (collect_register_i386): New function. + (x86_fill_gregset): Remove memset. Use collect_register_i386. + +diff --git a/gdbserver/linux-x86-low.cc b/gdbserver/linux-x86-low.cc +--- a/gdbserver/linux-x86-low.cc ++++ b/gdbserver/linux-x86-low.cc +@@ -397,6 +397,35 @@ x86_target::low_cannot_fetch_register (int regno) + return regno >= I386_NUM_REGS; + } + ++static void ++collect_register_i386 (struct regcache *regcache, int regno, void *buf) ++{ ++ collect_register (regcache, regno, buf); ++ ++#ifdef __x86_64__ ++ /* In case of x86_64 -m32, collect_register only writes 4 bytes, but the ++ space reserved in buf for the register is 8 bytes. Make sure the entire ++ reserved space is initialized. */ ++ ++ gdb_assert (register_size (regcache->tdesc, regno) == 4); ++ ++ if (regno == RAX) ++ { ++ /* Sign extend EAX value to avoid potential syscall restart ++ problems. ++ ++ See amd64_linux_collect_native_gregset() in ++ gdb/amd64-linux-nat.c for a detailed explanation. */ ++ *(int64_t *) buf = *(int32_t *) buf; ++ } ++ else ++ { ++ /* Zero-extend. */ ++ *(uint64_t *) buf = *(uint32_t *) buf; ++ } ++#endif ++} ++ + static void + x86_fill_gregset (struct regcache *regcache, void *buf) + { +@@ -411,32 +440,14 @@ x86_fill_gregset (struct regcache *regcache, void *buf) + + return; + } +- +- /* 32-bit inferior registers need to be zero-extended. +- Callers would read uninitialized memory otherwise. */ +- memset (buf, 0x00, X86_64_USER_REGS * 8); + #endif + + for (i = 0; i < I386_NUM_REGS; i++) +- collect_register (regcache, i, ((char *) buf) + i386_regmap[i]); +- +- collect_register_by_name (regcache, "orig_eax", +- ((char *) buf) + ORIG_EAX * REGSIZE); ++ collect_register_i386 (regcache, i, ((char *) buf) + i386_regmap[i]); + +-#ifdef __x86_64__ +- /* Sign extend EAX value to avoid potential syscall restart +- problems. +- +- See amd64_linux_collect_native_gregset() in gdb/amd64-linux-nat.c +- for a detailed explanation. */ +- if (register_size (regcache->tdesc, 0) == 4) +- { +- void *ptr = ((gdb_byte *) buf +- + i386_regmap[find_regno (regcache->tdesc, "eax")]); +- +- *(int64_t *) ptr = *(int32_t *) ptr; +- } +-#endif ++ /* Handle ORIG_EAX, which is not in i386_regmap. */ ++ collect_register_i386 (regcache, find_regno (regcache->tdesc, "orig_eax"), ++ ((char *) buf) + ORIG_EAX * REGSIZE); + } + + static void diff --git a/SOURCES/gdb-fedora-libncursesw.patch b/SOURCES/gdb-fedora-libncursesw.patch new file mode 100644 index 0000000..7c620fb --- /dev/null +++ b/SOURCES/gdb-fedora-libncursesw.patch @@ -0,0 +1,71 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +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 +@@ -9649,6 +9649,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 : +@@ -9673,7 +9674,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 +@@ -9747,6 +9748,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 : +@@ -9771,7 +9773,7 @@ return tgetent (); + return 0; + } + _ACEOF +-for ac_lib in '' termcap tinfow tinfo curses ncursesw ncurses; do ++for ac_lib in '' 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 +@@ -712,7 +712,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 +@@ -754,7 +755,8 @@ case $host_os in + esac + + # These are the libraries checked by Readline. +-AC_SEARCH_LIBS(tgetent, [termcap tinfow tinfo curses ncursesw ncurses]) ++# Fedora: Force libncursesw over libncurses to match the includes. ++AC_SEARCH_LIBS(tgetent, [ncursesw]) + + if test "$ac_cv_search_tgetent" = no; then + CONFIG_OBS="$CONFIG_OBS stub-termcap.o" diff --git a/SOURCES/gdb-find_and_open_source-empty-string-ub-1of4.patch b/SOURCES/gdb-find_and_open_source-empty-string-ub-1of4.patch new file mode 100644 index 0000000..543b410 --- /dev/null +++ b/SOURCES/gdb-find_and_open_source-empty-string-ub-1of4.patch @@ -0,0 +1,327 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Keith Seitz +Date: Mon, 4 Dec 2023 11:04:22 -0800 +Subject: gdb-find_and_open_source-empty-string-ub-1of4.patch + +;; Backport "gdbsupport: make gdb_abspath return an std::string" +;; (Simon Marchi) + +I'm trying to switch these functions to use std::string instead of char +arrays, as much as possible. Some callers benefit from it (can avoid +doing a copy of the result), while others suffer (have to make one more +copy). + +Change-Id: Iced49b8ee2f189744c5072a3b217aab5af17a993 + +diff --git a/gdb/compile/compile.c b/gdb/compile/compile.c +--- a/gdb/compile/compile.c ++++ b/gdb/compile/compile.c +@@ -295,8 +295,8 @@ compile_file_command (const char *args, int from_tty) + error (_("You must provide a filename for this command.")); + + args = skip_spaces (args); +- gdb::unique_xmalloc_ptr abspath = gdb_abspath (args); +- std::string buffer = string_printf ("#include \"%s\"\n", abspath.get ()); ++ std::string abspath = gdb_abspath (args); ++ std::string buffer = string_printf ("#include \"%s\"\n", abspath.c_str ()); + eval_compile_command (NULL, buffer.c_str (), scope, NULL); + } + +diff --git a/gdb/completer.c b/gdb/completer.c +--- a/gdb/completer.c ++++ b/gdb/completer.c +@@ -2036,7 +2036,7 @@ gdb_completion_word_break_characters_throw () + rl_basic_quote_characters = NULL; + } + +- return rl_completer_word_break_characters; ++ return (char *) rl_completer_word_break_characters; + } + + char * +diff --git a/gdb/corelow.c b/gdb/corelow.c +--- a/gdb/corelow.c ++++ b/gdb/corelow.c +@@ -447,7 +447,7 @@ core_target_open (const char *arg, int from_tty) + + gdb::unique_xmalloc_ptr filename (tilde_expand (arg)); + if (!IS_ABSOLUTE_PATH (filename.get ())) +- filename = gdb_abspath (filename.get ()); ++ filename = make_unique_xstrdup (gdb_abspath (filename.get ()).c_str ()); + + flags = O_BINARY | O_LARGEFILE; + if (write_files) +diff --git a/gdb/dwarf2/index-cache.c b/gdb/dwarf2/index-cache.c +--- a/gdb/dwarf2/index-cache.c ++++ b/gdb/dwarf2/index-cache.c +@@ -291,7 +291,8 @@ set_index_cache_directory_command (const char *arg, int from_tty, + cmd_list_element *element) + { + /* Make sure the index cache directory is absolute and tilde-expanded. */ +- gdb::unique_xmalloc_ptr abs (gdb_abspath (index_cache_directory)); ++ gdb::unique_xmalloc_ptr abs ++ = make_unique_xstrdup (gdb_abspath (index_cache_directory).c_str ()); + xfree (index_cache_directory); + index_cache_directory = abs.release (); + global_index_cache.set_directory (index_cache_directory); +diff --git a/gdb/main.c b/gdb/main.c +--- a/gdb/main.c ++++ b/gdb/main.c +@@ -135,12 +135,7 @@ set_gdb_data_directory (const char *new_datadir) + "../foo" and "../foo" doesn't exist then we'll record $(pwd)/../foo which + isn't canonical, but that's ok. */ + if (!IS_ABSOLUTE_PATH (gdb_datadir.c_str ())) +- { +- gdb::unique_xmalloc_ptr abs_datadir +- = gdb_abspath (gdb_datadir.c_str ()); +- +- gdb_datadir = abs_datadir.get (); +- } ++ gdb_datadir = gdb_abspath (gdb_datadir.c_str ()); + } + + /* Relocate a file or directory. PROGNAME is the name by which gdb +diff --git a/gdb/objfiles.c b/gdb/objfiles.c +--- a/gdb/objfiles.c ++++ b/gdb/objfiles.c +@@ -341,7 +341,7 @@ objfile::objfile (bfd *abfd, const char *name, objfile_flags flags_) + + objfile_alloc_data (this); + +- gdb::unique_xmalloc_ptr name_holder; ++ std::string name_holder; + if (name == NULL) + { + gdb_assert (abfd == NULL); +@@ -354,7 +354,7 @@ objfile::objfile (bfd *abfd, const char *name, objfile_flags flags_) + else + { + name_holder = gdb_abspath (name); +- expanded_name = name_holder.get (); ++ expanded_name = name_holder.c_str (); + } + original_name = obstack_strdup (&objfile_obstack, expanded_name); + +diff --git a/gdb/source.c b/gdb/source.c +--- a/gdb/source.c ++++ b/gdb/source.c +@@ -512,15 +512,15 @@ add_path (const char *dirname, char **which_path, int parse_separators) + + for (const gdb::unique_xmalloc_ptr &name_up : dir_vec) + { +- char *name = name_up.get (); ++ const char *name = name_up.get (); + char *p; + struct stat st; +- gdb::unique_xmalloc_ptr new_name_holder; ++ std::string new_name_holder; + + /* Spaces and tabs will have been removed by buildargv(). + NAME is the start of the directory. + P is the '\0' following the end. */ +- p = name + strlen (name); ++ p = name_up.get () + strlen (name); + + while (!(IS_DIR_SEPARATOR (*name) && p <= name + 1) /* "/" */ + #ifdef HAVE_DOS_BASED_FILE_SYSTEM +@@ -561,16 +561,18 @@ add_path (const char *dirname, char **which_path, int parse_separators) + } + + if (name[0] == '~') +- new_name_holder.reset (tilde_expand (name)); ++ new_name_holder ++ = gdb::unique_xmalloc_ptr (tilde_expand (name)).get (); + #ifdef HAVE_DOS_BASED_FILE_SYSTEM + else if (IS_ABSOLUTE_PATH (name) && p == name + 2) /* "d:" => "d:." */ +- new_name_holder.reset (concat (name, ".", (char *) NULL)); ++ new_name_holder = std::string (name) + "."; + #endif + else if (!IS_ABSOLUTE_PATH (name) && name[0] != '$') + new_name_holder = gdb_abspath (name); + else +- new_name_holder.reset (savestring (name, p - name)); +- name = new_name_holder.get (); ++ new_name_holder = std::string (name, p - name); ++ ++ name = new_name_holder.c_str (); + + /* Unless it's a variable, check existence. */ + if (name[0] != '$') +@@ -915,7 +917,8 @@ openp (const char *path, openp_flags opts, const char *string, + else if ((opts & OPF_RETURN_REALPATH) != 0) + *filename_opened = gdb_realpath (filename); + else +- *filename_opened = gdb_abspath (filename); ++ *filename_opened ++ = make_unique_xstrdup (gdb_abspath (filename).c_str ()); + } + + errno = last_errno; +diff --git a/gdb/top.c b/gdb/top.c +--- a/gdb/top.c ++++ b/gdb/top.c +@@ -2065,8 +2065,7 @@ init_history (void) + const char *fname = ".gdb_history"; + #endif + +- gdb::unique_xmalloc_ptr temp (gdb_abspath (fname)); +- history_filename = temp.release (); ++ history_filename = xstrdup (gdb_abspath (fname).c_str ()); + } + + if (!history_filename_empty ()) +@@ -2150,10 +2149,10 @@ set_history_filename (const char *args, + that was read. */ + if (!history_filename_empty () && !IS_ABSOLUTE_PATH (history_filename)) + { +- gdb::unique_xmalloc_ptr temp (gdb_abspath (history_filename)); ++ std::string temp = gdb_abspath (history_filename); + + xfree (history_filename); +- history_filename = temp.release (); ++ history_filename = xstrdup (temp.c_str ()); + } + } + +diff --git a/gdb/tracefile-tfile.c b/gdb/tracefile-tfile.c +--- a/gdb/tracefile-tfile.c ++++ b/gdb/tracefile-tfile.c +@@ -471,7 +471,7 @@ tfile_target_open (const char *arg, int from_tty) + + gdb::unique_xmalloc_ptr filename (tilde_expand (arg)); + if (!IS_ABSOLUTE_PATH (filename.get ())) +- filename = gdb_abspath (filename.get ()); ++ filename = make_unique_xstrdup (gdb_abspath (filename.get ()).c_str ()); + + flags = O_BINARY | O_LARGEFILE; + flags |= O_RDONLY; +diff --git a/gdbserver/server.cc b/gdbserver/server.cc +--- a/gdbserver/server.cc ++++ b/gdbserver/server.cc +@@ -93,31 +93,31 @@ bool non_stop; + static struct { + /* Set the PROGRAM_PATH. Here we adjust the path of the provided + binary if needed. */ +- void set (gdb::unique_xmalloc_ptr &&path) ++ void set (const char *path) + { +- m_path = std::move (path); ++ m_path = path; + + /* Make sure we're using the absolute path of the inferior when + creating it. */ +- if (!contains_dir_separator (m_path.get ())) ++ if (!contains_dir_separator (m_path.c_str ())) + { + int reg_file_errno; + + /* Check if the file is in our CWD. If it is, then we prefix + its name with CURRENT_DIRECTORY. Otherwise, we leave the + name as-is because we'll try searching for it in $PATH. */ +- if (is_regular_file (m_path.get (), ®_file_errno)) +- m_path = gdb_abspath (m_path.get ()); ++ if (is_regular_file (m_path.c_str (), ®_file_errno)) ++ m_path = gdb_abspath (m_path.c_str ()); + } + } + + /* Return the PROGRAM_PATH. */ +- char *get () +- { return m_path.get (); } ++ const char *get () ++ { return m_path.empty () ? nullptr : m_path.c_str (); } + + private: + /* The program name, adjusted if needed. */ +- gdb::unique_xmalloc_ptr m_path; ++ std::string m_path; + } program_path; + static std::vector program_args; + static std::string wrapper_argv; +@@ -3054,7 +3054,7 @@ handle_v_run (char *own_buf) + } + } + else +- program_path.set (gdb::unique_xmalloc_ptr (new_program_name)); ++ program_path.set (new_program_name); + + /* Free the old argv and install the new one. */ + free_vector_argv (program_args); +@@ -3845,7 +3845,7 @@ captured_main (int argc, char *argv[]) + int i, n; + + n = argc - (next_arg - argv); +- program_path.set (make_unique_xstrdup (next_arg[0])); ++ program_path.set (next_arg[0]); + for (i = 1; i < n; i++) + program_args.push_back (xstrdup (next_arg[i])); + +diff --git a/gdbsupport/pathstuff.cc b/gdbsupport/pathstuff.cc +--- a/gdbsupport/pathstuff.cc ++++ b/gdbsupport/pathstuff.cc +@@ -126,23 +126,23 @@ gdb_realpath_keepfile (const char *filename) + + /* See gdbsupport/pathstuff.h. */ + +-gdb::unique_xmalloc_ptr ++std::string + gdb_abspath (const char *path) + { + gdb_assert (path != NULL && path[0] != '\0'); + + if (path[0] == '~') +- return gdb_tilde_expand_up (path); ++ return gdb_tilde_expand (path); + + if (IS_ABSOLUTE_PATH (path) || current_directory == NULL) +- return make_unique_xstrdup (path); ++ return path; + + /* Beware the // my son, the Emacs barfs, the botch that catch... */ +- return gdb::unique_xmalloc_ptr +- (concat (current_directory, +- IS_DIR_SEPARATOR (current_directory[strlen (current_directory) - 1]) +- ? "" : SLASH_STRING, +- path, (char *) NULL)); ++ return string_printf ++ ("%s%s%s", current_directory, ++ (IS_DIR_SEPARATOR (current_directory[strlen (current_directory) - 1]) ++ ? "" : SLASH_STRING), ++ path); + } + + /* See gdbsupport/pathstuff.h. */ +@@ -225,8 +225,8 @@ get_standard_cache_dir () + if (xdg_cache_home != NULL) + { + /* Make sure the path is absolute and tilde-expanded. */ +- gdb::unique_xmalloc_ptr abs (gdb_abspath (xdg_cache_home)); +- return string_printf ("%s/gdb", abs.get ()); ++ std::string abs = gdb_abspath (xdg_cache_home); ++ return string_printf ("%s/gdb", abs.c_str ()); + } + #endif + +@@ -234,8 +234,8 @@ get_standard_cache_dir () + if (home != NULL) + { + /* Make sure the path is absolute and tilde-expanded. */ +- gdb::unique_xmalloc_ptr abs (gdb_abspath (home)); +- return string_printf ("%s/" HOME_CACHE_DIR "/gdb", abs.get ()); ++ std::string abs = gdb_abspath (home); ++ return string_printf ("%s/" HOME_CACHE_DIR "/gdb", abs.c_str ()); + } + + return {}; +diff --git a/gdbsupport/pathstuff.h b/gdbsupport/pathstuff.h +--- a/gdbsupport/pathstuff.h ++++ b/gdbsupport/pathstuff.h +@@ -49,7 +49,7 @@ extern gdb::unique_xmalloc_ptr + If CURRENT_DIRECTORY is NULL, this function returns a copy of + PATH. */ + +-extern gdb::unique_xmalloc_ptr gdb_abspath (const char *path); ++extern std::string gdb_abspath (const char *path); + + /* If the path in CHILD is a child of the path in PARENT, return a + pointer to the first component in the CHILD's pathname below the diff --git a/SOURCES/gdb-find_and_open_source-empty-string-ub-2of4.patch b/SOURCES/gdb-find_and_open_source-empty-string-ub-2of4.patch new file mode 100644 index 0000000..0c988cd --- /dev/null +++ b/SOURCES/gdb-find_and_open_source-empty-string-ub-2of4.patch @@ -0,0 +1,475 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Keith Seitz +Date: Mon, 4 Dec 2023 11:02:16 -0800 +Subject: gdb-find_and_open_source-empty-string-ub-2of4.patch + +;; Backport "gdbsupport: add path_join function" +;; (Simon Marchi) + +In this review [1], Eli pointed out that we should be careful when +concatenating file names to avoid duplicated slashes. On Windows, a +double slash at the beginning of a file path has a special meaning. So +naively concatenating "/" and "foo/bar" would give "//foo/bar", which +would not give the desired results. We already have a few spots doing: + + if (first_path ends with a slash) + path = first_path + second_path + else + path = first_path + slash + second_path + +In general, I think it's nice to avoid superfluous slashes in file +paths, since they might end up visible to the user and look a bit +unprofessional. + +Introduce the path_join function that can be used to join multiple path +components together (along with unit tests). + +I initially wanted to make it possible to join two absolute paths, to +support the use case of prepending a sysroot path to a target file path, +or the prepending the debug-file-directory to a target file path. But +the code in solib_find_1 shows that it is more complex than this anyway +(for example, when the right hand side is a Windows path with a drive +letter). So I don't think we need to support that case in path_join. +That also keeps the implementation simpler. + +Change a few spots to use path_join to show how it can be used. I +believe that all the spots I changed are guarded by some checks that +ensure the right hand side operand is not an absolute path. + +Regression-tested on Ubuntu 18.04. Built-tested on Windows, and I also +ran the new unit-test there. + +[1] https://sourceware.org/pipermail/gdb-patches/2022-April/187559.html + +Change-Id: I0df889f7e3f644e045f42ff429277b732eb6c752 + +diff --git a/gdb/Makefile.in b/gdb/Makefile.in +--- a/gdb/Makefile.in ++++ b/gdb/Makefile.in +@@ -446,6 +446,7 @@ SELFTESTS_SRCS = \ + unittests/observable-selftests.c \ + unittests/optional-selftests.c \ + unittests/parse-connection-spec-selftests.c \ ++ unittests/path-join-selftests.c \ + unittests/ptid-selftests.c \ + unittests/main-thread-selftests.c \ + unittests/mkdir-recursive-selftests.c \ +diff --git a/gdb/buildsym.c b/gdb/buildsym.c +--- a/gdb/buildsym.c ++++ b/gdb/buildsym.c +@@ -19,6 +19,7 @@ + #include "defs.h" + #include "buildsym-legacy.h" + #include "bfd.h" ++#include "gdbsupport/pathstuff.h" + #include "gdb_obstack.h" + #include "symtab.h" + #include "symfile.h" +@@ -512,27 +513,22 @@ buildsym_compunit::start_subfile (const char *name) + + for (subfile = m_subfiles; subfile; subfile = subfile->next) + { +- char *subfile_name; ++ std::string subfile_name; + + /* If NAME is an absolute path, and this subfile is not, then + attempt to create an absolute path to compare. */ + if (IS_ABSOLUTE_PATH (name) + && !IS_ABSOLUTE_PATH (subfile->name) + && subfile_dirname != NULL) +- subfile_name = concat (subfile_dirname, SLASH_STRING, +- subfile->name, (char *) NULL); ++ subfile_name = path_join (subfile_dirname, subfile->name); + else + subfile_name = subfile->name; + +- if (FILENAME_CMP (subfile_name, name) == 0) ++ if (FILENAME_CMP (subfile_name.c_str (), name) == 0) + { + m_current_subfile = subfile; +- if (subfile_name != subfile->name) +- xfree (subfile_name); + return; + } +- if (subfile_name != subfile->name) +- xfree (subfile_name); + } + + /* This subfile is not known. Add an entry for it. */ +diff --git a/gdb/dwarf2/line-header.c b/gdb/dwarf2/line-header.c +--- a/gdb/dwarf2/line-header.c ++++ b/gdb/dwarf2/line-header.c +@@ -24,6 +24,7 @@ + #include "dwarf2/read.h" + #include "complaints.h" + #include "filenames.h" ++#include "gdbsupport/pathstuff.h" + + void + line_header::add_include_dir (const char *include_dir) +@@ -73,9 +74,7 @@ line_header::file_file_name (int file) const + { + const char *dir = fe->include_dir (this); + if (dir != NULL) +- return gdb::unique_xmalloc_ptr (concat (dir, SLASH_STRING, +- fe->name, +- (char *) NULL)); ++ return make_unique_xstrdup (path_join (dir, fe->name).c_str ()); + } + return make_unique_xstrdup (fe->name); + } +diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c +--- a/gdb/dwarf2/read.c ++++ b/gdb/dwarf2/read.c +@@ -12782,14 +12782,13 @@ open_dwo_file (dwarf2_per_objfile *per_objfile, + + if (comp_dir != NULL) + { +- gdb::unique_xmalloc_ptr path_to_try +- (concat (comp_dir, SLASH_STRING, file_name, (char *) NULL)); ++ std::string path_to_try = path_join (comp_dir, file_name); + + /* NOTE: If comp_dir is a relative path, this will also try the + search path, which seems useful. */ +- gdb_bfd_ref_ptr abfd (try_open_dwop_file (per_objfile, path_to_try.get (), +- 0 /*is_dwp*/, +- 1 /*search_cwd*/)); ++ gdb_bfd_ref_ptr abfd (try_open_dwop_file ++ (per_objfile, path_to_try.c_str (), 0 /*is_dwp*/, 1 /*search_cwd*/)); ++ + if (abfd != NULL) + return abfd; + } +@@ -20537,7 +20536,7 @@ static const char * + psymtab_include_file_name (const struct line_header *lh, const file_entry &fe, + const dwarf2_psymtab *pst, + const char *comp_dir, +- gdb::unique_xmalloc_ptr *name_holder) ++ std::string &name_holder) + { + const char *include_name = fe.name; + const char *include_name_to_compare = include_name; +@@ -20546,7 +20545,7 @@ psymtab_include_file_name (const struct line_header *lh, const file_entry &fe, + + const char *dir_name = fe.include_dir (lh); + +- gdb::unique_xmalloc_ptr hold_compare; ++ std::string hold_compare; + if (!IS_ABSOLUTE_PATH (include_name) + && (dir_name != NULL || comp_dir != NULL)) + { +@@ -20573,26 +20572,23 @@ psymtab_include_file_name (const struct line_header *lh, const file_entry &fe, + + if (dir_name != NULL) + { +- name_holder->reset (concat (dir_name, SLASH_STRING, +- include_name, (char *) NULL)); +- include_name = name_holder->get (); ++ name_holder = path_join (dir_name, include_name); ++ include_name = name_holder.c_str (); + include_name_to_compare = include_name; + } + if (!IS_ABSOLUTE_PATH (include_name) && comp_dir != NULL) + { +- hold_compare.reset (concat (comp_dir, SLASH_STRING, +- include_name, (char *) NULL)); +- include_name_to_compare = hold_compare.get (); ++ hold_compare = path_join (comp_dir, include_name); ++ include_name_to_compare = hold_compare.c_str (); + } + } + + pst_filename = pst->filename; +- gdb::unique_xmalloc_ptr copied_name; ++ std::string copied_name; + if (!IS_ABSOLUTE_PATH (pst_filename) && pst->dirname != NULL) + { +- copied_name.reset (concat (pst->dirname, SLASH_STRING, +- pst_filename, (char *) NULL)); +- pst_filename = copied_name.get (); ++ copied_name = path_join (pst->dirname, pst_filename); ++ pst_filename = copied_name.c_str (); + } + + file_is_pst = FILENAME_CMP (include_name_to_compare, pst_filename) == 0; +@@ -21303,10 +21299,10 @@ dwarf_decode_lines (struct line_header *lh, const char *comp_dir, + for (auto &file_entry : lh->file_names ()) + if (file_entry.included_p == 1) + { +- gdb::unique_xmalloc_ptr name_holder; ++ std::string name_holder; + const char *include_name = + psymtab_include_file_name (lh, file_entry, pst, +- comp_dir, &name_holder); ++ comp_dir, name_holder); + if (include_name != NULL) + dwarf2_create_include_psymtab (include_name, pst, objfile); + } +@@ -21360,7 +21356,7 @@ static void + dwarf2_start_subfile (struct dwarf2_cu *cu, const char *filename, + const char *dirname) + { +- gdb::unique_xmalloc_ptr copy; ++ std::string copy; + + /* In order not to lose the line information directory, + we concatenate it to the filename when it makes sense. +@@ -21371,8 +21367,8 @@ dwarf2_start_subfile (struct dwarf2_cu *cu, const char *filename, + + if (!IS_ABSOLUTE_PATH (filename) && dirname != NULL) + { +- copy.reset (concat (dirname, SLASH_STRING, filename, (char *) NULL)); +- filename = copy.get (); ++ copy = path_join (dirname, filename); ++ filename = copy.c_str (); + } + + cu->get_builder ()->start_subfile (filename); +diff --git a/gdb/macrotab.c b/gdb/macrotab.c +--- a/gdb/macrotab.c ++++ b/gdb/macrotab.c +@@ -18,6 +18,7 @@ + along with this program. If not, see . */ + + #include "defs.h" ++#include "gdbsupport/pathstuff.h" + #include "gdb_obstack.h" + #include "splay-tree.h" + #include "filenames.h" +@@ -1071,5 +1072,5 @@ macro_source_fullname (struct macro_source_file *file) + if (comp_dir == NULL || IS_ABSOLUTE_PATH (file->filename)) + return file->filename; + +- return std::string (comp_dir) + SLASH_STRING + file->filename; ++ return path_join (comp_dir, file->filename); + } +diff --git a/gdb/testsuite/gdb.mi/mi-fullname-deleted.exp b/gdb/testsuite/gdb.mi/mi-fullname-deleted.exp +--- a/gdb/testsuite/gdb.mi/mi-fullname-deleted.exp ++++ b/gdb/testsuite/gdb.mi/mi-fullname-deleted.exp +@@ -36,6 +36,12 @@ if { [regsub {^(/[^/]+)/} $srcfileabs {\1subst/} srcfileabssubst] != 1 + return -1 + } + ++# Generate a regular expression which to match $srcfileabs with ++# or without the doubled slash. This is used by the substituted ++# fullname test. ++set srcfileabssubst_regexp [string_to_regexp $srcfileabssubst] ++regsub {//} $srcfileabssubst_regexp {\0?} srcfileabssubst_regexp ++ + set f [open $srcfileabs "w"] + puts $f "int main (void) { return 0; }" + close $f +@@ -54,7 +60,7 @@ mi_gdb_test "-interpreter-exec console \"set substitute-path ${initdir} ${initdi + + mi_gdb_test "-file-list-exec-source-file" ".*\",fullname=\".*\".*" "fullname present" + +-mi_gdb_test "-file-list-exec-source-file" ".*\",fullname=\"[string_to_regexp $srcfileabssubst]\".*" "substituted fullname" ++mi_gdb_test "-file-list-exec-source-file" ".*\",fullname=\"$srcfileabssubst_regexp\".*" "substituted fullname" + + # Test compare_filenames_for_search does not falsely use absolute filename as + # a relative one. +diff --git a/gdb/unittests/path-join-selftests.c b/gdb/unittests/path-join-selftests.c +new file mode 100644 +--- /dev/null ++++ b/gdb/unittests/path-join-selftests.c +@@ -0,0 +1,73 @@ ++/* Self tests for path_join for GDB, the GNU debugger. ++ ++ Copyright (C) 2022 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 . */ ++ ++#include "defs.h" ++#include "gdbsupport/pathstuff.h" ++#include "gdbsupport/selftest.h" ++ ++namespace selftests { ++namespace path_join { ++ ++template ++static void ++test_one (const char *expected, Args... paths) ++{ ++ std::string actual = ::path_join (paths...); ++ ++ SELF_CHECK (actual == expected); ++} ++ ++/* Test path_join. */ ++ ++static void ++test () ++{ ++ test_one ("/foo/bar", "/foo", "bar"); ++ test_one ("/bar", "/", "bar"); ++ test_one ("foo/bar/", "foo", "bar", ""); ++ test_one ("foo", "", "foo"); ++ test_one ("foo/bar", "foo", "", "bar"); ++ test_one ("foo/", "foo", ""); ++ test_one ("foo/", "foo/", ""); ++ ++ test_one ("D:/foo/bar", "D:/foo", "bar"); ++ test_one ("D:/foo/bar", "D:/foo/", "bar"); ++ ++#if defined(_WIN32) ++ /* The current implementation doesn't recognize backslashes as directory ++ separators on Unix-like systems, so only run these tests on Windows. If ++ we ever switch our implementation to use std::filesystem::path, they ++ should work anywhere, in theory. */ ++ test_one ("D:\\foo/bar", "D:\\foo", "bar"); ++ test_one ("D:\\foo\\bar", "D:\\foo\\", "bar"); ++ test_one ("\\\\server\\dir\\file", "\\\\server\\dir\\", "file"); ++ test_one ("\\\\server\\dir/file", "\\\\server\\dir", "file"); ++#endif /* _WIN32 */ ++} ++ ++} ++} ++ ++void _initialize_path_join_selftests (); ++void ++_initialize_path_join_selftests () ++{ ++ selftests::register_test ("path_join", ++ selftests::path_join::test); ++} +diff --git a/gdbsupport/pathstuff.cc b/gdbsupport/pathstuff.cc +--- a/gdbsupport/pathstuff.cc ++++ b/gdbsupport/pathstuff.cc +@@ -87,7 +87,6 @@ gdb_realpath_keepfile (const char *filename) + { + const char *base_name = lbasename (filename); + char *dir_name; +- char *result; + + /* Extract the basename of filename, and return immediately + a copy of filename if it does not contain any directory prefix. */ +@@ -116,12 +115,7 @@ gdb_realpath_keepfile (const char *filename) + directory separator, avoid doubling it. */ + gdb::unique_xmalloc_ptr path_storage = gdb_realpath (dir_name); + const char *real_path = path_storage.get (); +- if (IS_DIR_SEPARATOR (real_path[strlen (real_path) - 1])) +- result = concat (real_path, base_name, (char *) NULL); +- else +- result = concat (real_path, SLASH_STRING, base_name, (char *) NULL); +- +- return gdb::unique_xmalloc_ptr (result); ++ return make_unique_xstrdup (path_join (real_path, base_name).c_str ()); + } + + /* See gdbsupport/pathstuff.h. */ +@@ -137,12 +131,7 @@ gdb_abspath (const char *path) + if (IS_ABSOLUTE_PATH (path) || current_directory == NULL) + return path; + +- /* Beware the // my son, the Emacs barfs, the botch that catch... */ +- return string_printf +- ("%s%s%s", current_directory, +- (IS_DIR_SEPARATOR (current_directory[strlen (current_directory) - 1]) +- ? "" : SLASH_STRING), +- path); ++ return path_join (current_directory, path); + } + + /* See gdbsupport/pathstuff.h. */ +@@ -197,6 +186,29 @@ child_path (const char *parent, const char *child) + + /* See gdbsupport/pathstuff.h. */ + ++std::string ++path_join (gdb::array_view paths) ++{ ++ std::string ret; ++ ++ for (int i = 0; i < paths.size (); ++i) ++ { ++ const gdb::string_view path = paths[i]; ++ ++ if (i > 0) ++ gdb_assert (!IS_ABSOLUTE_PATH (path)); ++ ++ if (!ret.empty () && !IS_DIR_SEPARATOR (ret.back ())) ++ ret += '/'; ++ ++ ret.append (path.begin (), path.end ()); ++ } ++ ++ return ret; ++} ++ ++/* See gdbsupport/pathstuff.h. */ ++ + bool + contains_dir_separator (const char *path) + { +@@ -226,7 +238,7 @@ get_standard_cache_dir () + { + /* Make sure the path is absolute and tilde-expanded. */ + std::string abs = gdb_abspath (xdg_cache_home); +- return string_printf ("%s/gdb", abs.c_str ()); ++ return path_join (abs.c_str (), "gdb"); + } + #endif + +@@ -235,7 +247,7 @@ get_standard_cache_dir () + { + /* Make sure the path is absolute and tilde-expanded. */ + std::string abs = gdb_abspath (home); +- return string_printf ("%s/" HOME_CACHE_DIR "/gdb", abs.c_str ()); ++ return path_join (abs.c_str (), HOME_CACHE_DIR, "gdb"); + } + + return {}; +diff --git a/gdbsupport/pathstuff.h b/gdbsupport/pathstuff.h +--- a/gdbsupport/pathstuff.h ++++ b/gdbsupport/pathstuff.h +@@ -21,6 +21,7 @@ + #define COMMON_PATHSTUFF_H + + #include "gdbsupport/byte-vector.h" ++#include "gdbsupport/array-view.h" + + /* Path utilities. */ + +@@ -57,6 +58,28 @@ extern std::string gdb_abspath (const char *path); + + extern const char *child_path (const char *parent, const char *child); + ++/* Join elements in PATHS into a single path. ++ ++ The first element can be absolute or relative. All the others must be ++ relative. */ ++ ++extern std::string path_join (gdb::array_view paths); ++ ++/* Same as the above, but accept paths as distinct parameters. */ ++ ++template ++std::string ++path_join (Args... paths) ++{ ++ /* It doesn't make sense to join less than two paths. */ ++ gdb_static_assert (sizeof... (Args) >= 2); ++ ++ std::array views ++ { gdb::string_view (paths)... }; ++ ++ return path_join (gdb::array_view (views)); ++} ++ + /* Return whether PATH contains a directory separator character. */ + + extern bool contains_dir_separator (const char *path); diff --git a/SOURCES/gdb-find_and_open_source-empty-string-ub-3of4.patch b/SOURCES/gdb-find_and_open_source-empty-string-ub-3of4.patch new file mode 100644 index 0000000..4cf6d67 --- /dev/null +++ b/SOURCES/gdb-find_and_open_source-empty-string-ub-3of4.patch @@ -0,0 +1,47 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Keith Seitz +Date: Tue, 5 Dec 2023 08:47:16 -0800 +Subject: gdb-find_and_open_source-empty-string-ub-3of4.patch + +;; Backport "Fix undefined behaviour dereferencing empty string" +;; (Magne Hov, RHEL-17631) + +When a source file's dirname is solely made up of directory separators +we end up trying to dereference the last character of an empty string +with std::string::back, which results in undefined behaviour. A typical +use case where this can happen is when the root directory "/" is used as +a compilation directory. + +With libstdc++.so.6.0.28 we get no out-of-bounds checks and the byte +preceding the storage of the empty string is returned. The character +value of this byte depends on heap implementation and usage, but when +this byte happens to hold the value of the directory separator character +we go on to call std::string::pop_back on the empty string which results +in an out_of_range exception which terminates GDB. + +Fix this by using path_join. prepare_path_for_appending ensures that the +filename component is relative. + +The testsuite has been run before and after the change and no +regressions were found. + +diff --git a/gdb/source.c b/gdb/source.c +--- a/gdb/source.c ++++ b/gdb/source.c +@@ -1111,15 +1111,7 @@ find_and_open_source (const char *filename, + helpful if part of the compilation directory was removed, + e.g. using gcc's -fdebug-prefix-map, and we have added the missing + prefix to source_path. */ +- std::string cdir_filename (dirname); +- +- /* Remove any trailing directory separators. */ +- while (IS_DIR_SEPARATOR (cdir_filename.back ())) +- cdir_filename.pop_back (); +- +- /* Add our own directory separator. */ +- cdir_filename.append (SLASH_STRING); +- cdir_filename.append (filename_start); ++ std::string cdir_filename = path_join (dirname, filename_start); + + result = openp (path, OPF_SEARCH_IN_PATH | OPF_RETURN_REALPATH, + cdir_filename.c_str (), OPEN_MODE, fullname); diff --git a/SOURCES/gdb-find_and_open_source-empty-string-ub-4of4.patch b/SOURCES/gdb-find_and_open_source-empty-string-ub-4of4.patch new file mode 100644 index 0000000..b6d37f7 --- /dev/null +++ b/SOURCES/gdb-find_and_open_source-empty-string-ub-4of4.patch @@ -0,0 +1,113 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Keith Seitz +Date: Wed, 6 Dec 2023 07:19:49 -0800 +Subject: gdb-find_and_open_source-empty-string-ub-4of4.patch + +;; Backport "gdbsupport: change path_join parameter to +;; array_view" +;; (Simon Marchi) + +When a GDB built with -D_GLIBCXX_DEBUG=1 reads a binary with a single +character name, we hit this assertion failure: + + $ ./gdb -q --data-directory=data-directory -nx ./x + /usr/include/c++/12.1.0/string_view:239: constexpr const std::basic_string_view<_CharT, _Traits>::value_type& std::basic_string_view<_CharT, _Traits>::operator[](size_type) const [with _CharT = char; _Traits = std::char_traits; const_reference = const char&; size_type = long unsigned int]: Assertion '__pos < this->_M_len' failed. + +The backtrace: + + #3 0x00007ffff6c0f002 in std::__glibcxx_assert_fail (file=, line=, function=, condition=) at /usr/src/debug/gcc/libstdc++-v3/src/c++11/debug.cc:60 + #4 0x000055555da8a864 in std::basic_string_view >::operator[] (this=0x7fffffffcc30, __pos=1) at /usr/include/c++/12.1.0/string_view:239 + #5 0x00005555609dcb88 in path_join[abi:cxx11](gdb::array_view > const>) (paths=...) at /home/simark/src/binutils-gdb/gdbsupport/pathstuff.cc:203 + #6 0x000055555e0443f4 in path_join () at /home/simark/src/binutils-gdb/gdb/../gdbsupport/pathstuff.h:84 + #7 0x00005555609dc336 in gdb_realpath_keepfile[abi:cxx11](char const*) (filename=0x6060000a8d40 "/home/simark/build/binutils-gdb-one-target/gdb/./x") at /home/simark/src/binutils-gdb/gdbsupport/pathstuff.cc:122 + #8 0x000055555ebd2794 in exec_file_attach (filename=0x7fffffffe0f9 "./x", from_tty=1) at /home/simark/src/binutils-gdb/gdb/exec.c:471 + #9 0x000055555f2b3fb0 in catch_command_errors (command=0x55555ebd1ab6 , arg=0x7fffffffe0f9 "./x", from_tty=1, do_bp_actions=false) at /home/simark/src/binutils-gdb/gdb/main.c:513 + #10 0x000055555f2b7e11 in captured_main_1 (context=0x7fffffffdb60) at /home/simark/src/binutils-gdb/gdb/main.c:1209 + #11 0x000055555f2b9144 in captured_main (data=0x7fffffffdb60) at /home/simark/src/binutils-gdb/gdb/main.c:1319 + #12 0x000055555f2b9226 in gdb_main (args=0x7fffffffdb60) at /home/simark/src/binutils-gdb/gdb/main.c:1344 + #13 0x000055555d938c5e in main (argc=5, argv=0x7fffffffdcf8) at /home/simark/src/binutils-gdb/gdb/gdb.c:32 + +The problem is this line in path_join: + + gdb_assert (strlen (path) == 0 || !IS_ABSOLUTE_PATH (path)); + +... where `path` is "x". IS_ABSOLUTE_PATH eventually calls +HAS_DRIVE_SPEC_1: + + #define HAS_DRIVE_SPEC_1(dos_based, f) \ + ((f)[0] && ((f)[1] == ':') && (dos_based)) + +This macro accesses indices 0 and 1 of the input string. However, `f` +is a string_view of length 1, so it's incorrect to try to access index +1. We know that the string_view's underlying object is a null-terminated +string, so in practice there's no harm. But as far as the string_view +is concerned, index 1 is considered out of bounds. + +This patch makes the easy fix, that is to change the path_join parameter +from a vector of to a vector of `const char *`. Another solution would +be to introduce a non-standard gdb::cstring_view class, which would be a +view over a null-terminated string. With that class, it would be +correct to access index 1, it would yield the NUL character. If there +is interest in having this class (it has been mentioned a few times in +the past) I can do it and use it here. + +This was found by running tests such as gdb.ada/arrayidx.exp, which +produce 1-char long filenames, so adding a new test is not necessary. + +Change-Id: Ia41a16c7243614636b18754fd98a41860756f7af + +diff --git a/gdbsupport/pathstuff.cc b/gdbsupport/pathstuff.cc +--- a/gdbsupport/pathstuff.cc ++++ b/gdbsupport/pathstuff.cc +@@ -187,21 +187,21 @@ child_path (const char *parent, const char *child) + /* See gdbsupport/pathstuff.h. */ + + std::string +-path_join (gdb::array_view paths) ++path_join (gdb::array_view paths) + { + std::string ret; + + for (int i = 0; i < paths.size (); ++i) + { +- const gdb::string_view path = paths[i]; ++ const char *path = paths[i]; + + if (i > 0) +- gdb_assert (!IS_ABSOLUTE_PATH (path)); ++ gdb_assert (strlen (path) == 0 || !IS_ABSOLUTE_PATH (path)); + + if (!ret.empty () && !IS_DIR_SEPARATOR (ret.back ())) + ret += '/'; + +- ret.append (path.begin (), path.end ()); ++ ret.append (path); + } + + return ret; +diff --git a/gdbsupport/pathstuff.h b/gdbsupport/pathstuff.h +--- a/gdbsupport/pathstuff.h ++++ b/gdbsupport/pathstuff.h +@@ -63,7 +63,7 @@ extern const char *child_path (const char *parent, const char *child); + The first element can be absolute or relative. All the others must be + relative. */ + +-extern std::string path_join (gdb::array_view paths); ++extern std::string path_join (gdb::array_view paths); + + /* Same as the above, but accept paths as distinct parameters. */ + +@@ -74,10 +74,10 @@ path_join (Args... paths) + /* It doesn't make sense to join less than two paths. */ + gdb_static_assert (sizeof... (Args) >= 2); + +- std::array views +- { gdb::string_view (paths)... }; ++ std::array path_array ++ { paths... }; + +- return path_join (gdb::array_view (views)); ++ return path_join (gdb::array_view (path_array)); + } + + /* Return whether PATH contains a directory separator character. */ diff --git a/SOURCES/gdb-fix-gdb.base-printcmds-s390x-regressions.patch b/SOURCES/gdb-fix-gdb.base-printcmds-s390x-regressions.patch new file mode 100644 index 0000000..edf28c9 --- /dev/null +++ b/SOURCES/gdb-fix-gdb.base-printcmds-s390x-regressions.patch @@ -0,0 +1,71 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Mon, 12 Dec 2022 15:21:33 +0100 +Subject: gdb-fix-gdb.base-printcmds-s390x-regressions.patch + +;; Backport "[gdb/testsuite] Fix PR20630 regression test in gdb.base/printcmds.exp" +;; (Tom de Vries) + +On s390x-linux, I run into: +... +(gdb) print {unsigned char}{65}^M +$749 = 0 '\000'^M +(gdb) FAIL: gdb.base/printcmds.exp: print {unsigned char}{65} +... + +In contrast, on x86_64-linux, we have: +... +(gdb) print {unsigned char}{65}^M +$749 = 65 'A'^M +(gdb) PASS: gdb.base/printcmds.exp: print {unsigned char}{65} +... + +The first problem here is that the test is supposed to be a regression test +for PR20630, which can be reproduced (for an unfixed gdb) like this: +... +(gdb) p {unsigned char[]}{0x17} +gdbtypes.c:4641: internal-error: copy_type: \ + Assertion `TYPE_OBJFILE_OWNED (type)' failed. +... +but it's not due to insufficient quoting (note the dropped '[]'). + +That's easy to fix, but after that we have on s390 (big endian): +... +(gdb) print {unsigned char[]}{65}^M +$749 = ""^M +... +and on x86_64 (little endian): +... +(gdb) print {unsigned char[]}{65}^M +$749 = "A"^M +... + +Fix this by using 0xffffffff, such that in both cases we have: +... +(gdb) print {unsigned char[]}{0xffffffff}^M +$749 = "\377\377\377\377"^M +... + +Tested on x86_64-linux and s390x-linux. + +diff --git a/gdb/testsuite/gdb.base/printcmds.exp b/gdb/testsuite/gdb.base/printcmds.exp +--- a/gdb/testsuite/gdb.base/printcmds.exp ++++ b/gdb/testsuite/gdb.base/printcmds.exp +@@ -717,6 +717,7 @@ proc test_print_string_constants {} { + } + + proc test_print_array_constants {} { ++ global hex + + if [target_info exists gdb,cannot_call_functions] { + unsupported "this target can not call functions" +@@ -735,7 +736,8 @@ proc test_print_array_constants {} { + gdb_test "print *&{4,5,6}\[1\]" "Attempt to take address of value not located in memory." + + # This used to cause a crash. +- gdb_test "print {unsigned char[]}{65}" " = 65 'A'" ++ set val [string_to_regexp {"\377\377\377\377"}] ++ gdb_test "print {unsigned char\[\]}{0xffffffff}" " = $val" + } + + proc test_print_enums {} { diff --git a/SOURCES/gdb-flexible-array-member-expected-pattern.patch b/SOURCES/gdb-flexible-array-member-expected-pattern.patch new file mode 100644 index 0000000..f61a661 --- /dev/null +++ b/SOURCES/gdb-flexible-array-member-expected-pattern.patch @@ -0,0 +1,88 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Simon Marchi +Date: Tue, 4 May 2021 11:20:09 -0400 +Subject: gdb-flexible-array-member-expected-pattern.patch + +;; Backport "adjust gdb.python/flexible-array-member.exp expected pattern" +;; (Simon Marchi) + +The `Type.range ()` tests in gdb.python/flexible-array-member.exp pass +when the test is compiled with gcc 9 or later, but not with gcc 8 or +earlier: + + $ make check TESTS="gdb.python/flexible-array-member.exp" RUNTESTFLAGS="CC_FOR_TARGET='gcc-8'" + + python print(zs['items'].type.range())^M + (0, 0)^M + (gdb) FAIL: gdb.python/flexible-array-member.exp: python print(zs['items'].type.range()) + python print(zso['items'].type.range())^M + (0, 0)^M + (gdb) FAIL: gdb.python/flexible-array-member.exp: python print(zso['items'].type.range()) + +The value that we get for the upper bound of a flexible array member +declared with a "0" size is 0 with gcc <= 8 and is -1 for gcc >= 9. +This is due to different debug info. For this member, gcc 8 does: + + 0x000000d5: DW_TAG_array_type + DW_AT_type [DW_FORM_ref4] (0x00000034 "int") + DW_AT_sibling [DW_FORM_ref4] (0x000000e4) + + 0x000000de: DW_TAG_subrange_type + DW_AT_type [DW_FORM_ref4] (0x0000002d "long unsigned int") + +For the same type, gcc 9 does: + + 0x000000d5: DW_TAG_array_type + DW_AT_type [DW_FORM_ref4] (0x00000034 "int") + DW_AT_sibling [DW_FORM_ref4] (0x000000e5) + + 0x000000de: DW_TAG_subrange_type + DW_AT_type [DW_FORM_ref4] (0x0000002d "long unsigned int") + DW_AT_count [DW_FORM_data1] (0x00) + +Ideally, GDB would present a consistent and documented value for an +array member declared with size 0, regardless of how the debug info +looks like. But for now, just change the test to accept the two +values, to get rid of the failure and make the test in sync + +I also realized (by looking at the py-type.exp test) that calling the +fields method on an array type yields one field representing the "index" +of the array. The type of that field is of type range +(gdb.TYPE_CODE_RANGE). When calling `.range()` on that range type, it +yields the same range tuple as when calling `.range()` on the array type +itself. For completeness, add some tests to access the range tuple +through that range type as well. + +gdb/testsuite/ChangeLog: + + * gdb.python/flexible-array-member.exp: Adjust expected range + value for member declared with 0 size. Test accessing range + tuple through range type. + +Change-Id: Ie4e06d99fe9315527f04577888f48284d649ca4c + +diff --git a/gdb/testsuite/gdb.python/flexible-array-member.exp b/gdb/testsuite/gdb.python/flexible-array-member.exp +--- a/gdb/testsuite/gdb.python/flexible-array-member.exp ++++ b/gdb/testsuite/gdb.python/flexible-array-member.exp +@@ -76,9 +76,17 @@ gdb_test "python print(zso\['items'\] == zso\['items'\]\[0\].address)" "True" + gdb_test "python print(zso\['items'\]\[0\].address + 1 == zso\['items'\]\[1\].address)" "True" + + # Verify the range attribute. It looks a bit inconsistent that the high bound +-# is sometimes 0, sometimes -1, but that's what GDB produces today, so that's +-# what we test. ++# is sometimes 0, sometimes -1. It depends on the way the flexible array ++# member is specified and on the compiler version (the debug info is ++# different). But that's what GDB produces today, so that's what we test. + + gdb_test "python print(ns\['items'\].type.range())" "\\(0, 0\\)" +-gdb_test "python print(zs\['items'\].type.range())" "\\(0, -1\\)" +-gdb_test "python print(zso\['items'\].type.range())" "\\(0, -1\\)" ++gdb_test "python print(zs\['items'\].type.range())" "\\(0, (0|-1)\\)" ++gdb_test "python print(zso\['items'\].type.range())" "\\(0, (0|-1)\\)" ++ ++# Test the same thing, but going explicitly through the array index's range ++# type. ++ ++gdb_test "python print(ns\['items'\].type.fields()\[0\].type.range())" "\\(0, 0\\)" ++gdb_test "python print(zs\['items'\].type.fields()\[0\].type.range())" "\\(0, (0|-1)\\)" ++gdb_test "python print(zso\['items'\].type.fields()\[0\].type.range())" "\\(0, (0|-1)\\)" diff --git a/SOURCES/gdb-fortran-frame-string.patch b/SOURCES/gdb-fortran-frame-string.patch new file mode 100644 index 0000000..4bdd059 --- /dev/null +++ b/SOURCES/gdb-fortran-frame-string.patch @@ -0,0 +1,104 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +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 . ++! Modified for the GDB testcase by Jan Kratochvil . ++ ++ subroutine f(s) ++ character*3 s ++ s = s ++ end ++ ++ program main ++ call f ('foo') ++ end diff --git a/SOURCES/gdb-gdb27743-psymtab-imported-unit.patch b/SOURCES/gdb-gdb27743-psymtab-imported-unit.patch new file mode 100644 index 0000000..c129b6d --- /dev/null +++ b/SOURCES/gdb-gdb27743-psymtab-imported-unit.patch @@ -0,0 +1,281 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Tom Tromey +Date: Fri, 23 Apr 2021 11:28:48 -0600 +Subject: gdb-gdb27743-psymtab-imported-unit.patch + +;; Backport "Fix crash when expanding partial symtabs with DW_TAG_imported_unit" +;; (Tom Tromey, gdb/27743) + + From e7d77ce0c408e7019f9885b8be64c9cdb46dd312 Mon Sep 17 00:00:00 2001 + Subject: [PATCH] Fix crash when expanding partial symtabs with + DW_TAG_imported_unit + +PR gdb/27743 points out a gdb crash when expanding partial symtabs, +where one of the compilation units uses DW_TAG_imported_unit. + +The bug is that partial_map_expand_apply expects only to be called for +the outermost psymtab. However, filename searching doesn't (and +probably shouldn't) guarantee this. The fix is to walk upward to find +the outermost CU. + +A new test case is included. It is mostly copied from other test +cases, which really sped up the effort. + +This bug does not occur on trunk. There, +psym_map_symtabs_matching_filename is gone, replaced by +psymbol_functions::expand_symtabs_matching. When this find a match, +it calls psymtab_to_symtab, which does this same upward walk. + +Tested on x86-64 Fedora 32. + +I propose checking in this patch on the gdb-10 branch, and just the +new test case on trunk. + +gdb/ChangeLog +2021-04-23 Tom Tromey + + PR gdb/27743: + * psymtab.c (partial_map_expand_apply): Expand outermost psymtab. + +gdb/testsuite/ChangeLog +2021-04-23 Tom Tromey + + PR gdb/27743: + * gdb.dwarf2/imported-unit-bp.exp: New file. + * gdb.dwarf2/imported-unit-bp-main.c: New file. + * gdb.dwarf2/imported-unit-bp-alt.c: New file. + +diff --git a/gdb/psymtab.c b/gdb/psymtab.c +--- a/gdb/psymtab.c ++++ b/gdb/psymtab.c +@@ -127,9 +127,10 @@ partial_map_expand_apply (struct objfile *objfile, + { + struct compunit_symtab *last_made = objfile->compunit_symtabs; + +- /* Shared psymtabs should never be seen here. Instead they should +- be handled properly by the caller. */ +- gdb_assert (pst->user == NULL); ++ /* We may see a shared psymtab here, but we want to expand the ++ outermost symtab. */ ++ while (pst->user != nullptr) ++ pst = pst->user; + + /* Don't visit already-expanded psymtabs. */ + if (pst->readin_p (objfile)) +diff --git a/gdb/testsuite/gdb.dwarf2/imported-unit-bp-alt.c b/gdb/testsuite/gdb.dwarf2/imported-unit-bp-alt.c +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.dwarf2/imported-unit-bp-alt.c +@@ -0,0 +1,50 @@ ++/* Copyright 2020-2021 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 . */ ++ ++/* Used to insert labels with which we can build a fake line table. */ ++#define LL(N) asm ("line_label_" #N ": .globl line_label_" #N) ++ ++volatile int var; ++volatile int bar; ++ ++/* Generate some code to take up some space. */ ++#define FILLER do { \ ++ var = 99; \ ++} while (0) ++ ++int ++func (void) ++{ /* func prologue */ ++ asm ("func_label: .globl func_label"); ++ LL (1); // F1, Ln 16 ++ FILLER; ++ LL (2); // F1, Ln 17 ++ FILLER; ++ LL (3); // F2, Ln 21 ++ FILLER; ++ LL (4); // F2, Ln 22 // F1, Ln 18, !S ++ FILLER; ++ LL (5); // F1, Ln 19 !S ++ FILLER; ++ LL (6); // F1, Ln 20 ++ FILLER; ++ LL (7); ++ FILLER; ++ return 0; /* func end */ ++} ++ ++#ifdef WITHMAIN ++int main () { return 0; } ++#endif +diff --git a/gdb/testsuite/gdb.dwarf2/imported-unit-bp-main.c b/gdb/testsuite/gdb.dwarf2/imported-unit-bp-main.c +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.dwarf2/imported-unit-bp-main.c +@@ -0,0 +1,24 @@ ++/* This testcase is part of GDB, the GNU debugger. ++ ++ Copyright 2004-2021 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 . */ ++ ++extern int func (void); ++ ++int ++main() ++{ ++ return func (); ++} +diff --git a/gdb/testsuite/gdb.dwarf2/imported-unit-bp.exp b/gdb/testsuite/gdb.dwarf2/imported-unit-bp.exp +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.dwarf2/imported-unit-bp.exp +@@ -0,0 +1,128 @@ ++# Copyright 2020-2021 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 . ++ ++# Test that "break /absolute/file:line" works ok with imported CUs. ++ ++load_lib dwarf.exp ++ ++# This test can only be run on targets which support DWARF-2 and use gas. ++if {![dwarf2_support]} { ++ return 0 ++} ++ ++# The .c files use __attribute__. ++if [get_compiler_info] { ++ return -1 ++} ++if !$gcc_compiled { ++ return 0 ++} ++ ++standard_testfile imported-unit-bp-alt.c .S imported-unit-bp-main.c ++ ++set build_options {nodebug optimize=-O1} ++ ++set asm_file [standard_output_file $srcfile2] ++Dwarf::assemble $asm_file { ++ global srcdir subdir srcfile srcfile ++ global build_options ++ declare_labels lines_label callee_subprog_label cu_label ++ ++ get_func_info func "$build_options additional_flags=-DWITHMAIN" ++ ++ cu {} { ++ compile_unit { ++ {language @DW_LANG_C} ++ {name ""} ++ } { ++ imported_unit { ++ {import %$cu_label} ++ } ++ } ++ } ++ ++ cu {} { ++ cu_label: compile_unit { ++ {producer "gcc"} ++ {language @DW_LANG_C} ++ {name ${srcfile}} ++ {comp_dir "/tmp"} ++ {low_pc 0 addr} ++ {stmt_list ${lines_label} DW_FORM_sec_offset} ++ } { ++ callee_subprog_label: subprogram { ++ {external 1 flag} ++ {name callee} ++ {inline 3 data1} ++ } ++ subprogram { ++ {external 1 flag} ++ {name func} ++ {low_pc $func_start addr} ++ {high_pc "$func_start + $func_len" addr} ++ } { ++ } ++ } ++ } ++ ++ lines {version 2 default_is_stmt 1} lines_label { ++ include_dir "/tmp" ++ file_name "$srcfile" 1 ++ ++ program { ++ {DW_LNE_set_address line_label_1} ++ {DW_LNS_advance_line 15} ++ {DW_LNS_copy} ++ ++ {DW_LNE_set_address line_label_2} ++ {DW_LNS_advance_line 1} ++ {DW_LNS_copy} ++ ++ {DW_LNE_set_address line_label_3} ++ {DW_LNS_advance_line 4} ++ {DW_LNS_copy} ++ ++ {DW_LNE_set_address line_label_4} ++ {DW_LNS_advance_line 1} ++ {DW_LNS_copy} ++ ++ {DW_LNS_advance_line -4} ++ {DW_LNS_negate_stmt} ++ {DW_LNS_copy} ++ ++ {DW_LNE_set_address line_label_5} ++ {DW_LNS_advance_line 1} ++ {DW_LNS_copy} ++ ++ {DW_LNE_set_address line_label_6} ++ {DW_LNS_advance_line 1} ++ {DW_LNS_negate_stmt} ++ {DW_LNS_copy} ++ ++ {DW_LNE_set_address line_label_7} ++ {DW_LNE_end_sequence} ++ } ++ } ++} ++ ++if { [prepare_for_testing "failed to prepare" ${testfile} \ ++ [list $srcfile $asm_file $srcfile3] $build_options] } { ++ return -1 ++} ++ ++gdb_reinitialize_dir /tmp ++ ++# Using an absolute path is important to see the bug. ++gdb_test "break /tmp/${srcfile}:19" "Breakpoint .* file $srcfile, line .*" diff --git a/SOURCES/gdb-glibc-strstr-workaround.patch b/SOURCES/gdb-glibc-strstr-workaround.patch new file mode 100644 index 0000000..da9c5de --- /dev/null +++ b/SOURCES/gdb-glibc-strstr-workaround.patch @@ -0,0 +1,132 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +Date: Fri, 27 Oct 2017 21:07:50 +0200 +Subject: gdb-glibc-strstr-workaround.patch + +;; Workaround PR libc/14166 for inferior calls of strstr. +;;=fedoratest: Compatibility with RHELs (unchecked which ones). + +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,119 @@ ++# 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 . ++ ++# 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 ++ } ++ -re "type = \\(\\)\r\n$gdb_prompt $" { ++ untested "$test (no DWARF)" ++ return 0 ++ } ++} ++ ++set addr "" ++set test "print strstr" ++gdb_test_multiple $test $test { ++ -re " = {} (0x\[0-9a-f\]+) \r\n$gdb_prompt $" { ++ set addr $expect_out(1,string) ++ pass $test ++ } ++ -re " = {} (0x\[0-9a-f\]+) <__strstr>\r\n$gdb_prompt $" { ++ set addr $expect_out(1,string) ++ pass "$test (GDB workaround)" ++ } ++ -re " = {} (0x\[0-9a-f\]+) <__libc_strstr>\r\n$gdb_prompt $" { ++ set addr $expect_out(1,string) ++ pass "$test (fixed glibc)" ++ } ++ -re " = {} (0x\[0-9a-f\]+) <__libc_strstr_ifunc>\r\n$gdb_prompt $" { ++ set addr $expect_out(1,string) ++ pass "$test (fixed glibc)" ++ } ++ -re " = {char \\*\\(const char \\*, const char \\*\\)} 0x\[0-9a-f\]+ \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\]+ \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 " = {} $addr \r\n$gdb_prompt $" { ++ pass $test ++ } ++ -re " = {} $addr <__strstr>\r\n$gdb_prompt $" { ++ pass "$test (GDB workaround)" ++ } ++ -re " = {} $addr <__libc_strstr>\r\n$gdb_prompt $" { ++ pass "$test (fixed glibc)" ++ } ++ -re " = {} $addr <__libc_strstr_ifunc>\r\n$gdb_prompt $" { ++ pass "$test (fixed glibc)" ++ } ++ -re " = {void \\*\\(void\\)} 0x\[0-9a-f\]+ \r\n$gdb_prompt $" { ++ fail $test ++ } ++} ++ ++gdb_test {print (char *)strstr("abc","b")} { = 0x[0-9a-f]+ "bc"} ++gdb_test {print (char *)strstr("def","e")} { = 0x[0-9a-f]+ "ef"} diff --git a/SOURCES/gdb-gstack.man b/SOURCES/gdb-gstack.man new file mode 100644 index 0000000..1f4e406 --- /dev/null +++ b/SOURCES/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/SOURCES/gdb-libexec-add-index.patch b/SOURCES/gdb-libexec-add-index.patch new file mode 100644 index 0000000..19f6b54 --- /dev/null +++ b/SOURCES/gdb-libexec-add-index.patch @@ -0,0 +1,37 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +Date: Fri, 27 Oct 2017 21:07:50 +0200 +Subject: gdb-libexec-add-index.patch + +;; Fix gdb-headless /usr/bin/ executables (BZ 1390251). +;; +;; Also, make /usr/bin/gdb.minimal be the default GDB used, if it's +;; present. For rationale, see: +;; +;; https://fedoraproject.org/wiki/Changes/Minimal_GDB_in_buildroot +;;=fedora + +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 +@@ -22,6 +22,20 @@ GDB=${GDB:=gdb} + OBJCOPY=${OBJCOPY:=objcopy} + READELF=${READELF:=readelf} + ++GDB2=/usr/libexec/gdb ++if test -x $GDB2 && ! which $GDB &>/dev/null; then ++ GDB=$GDB2 ++fi ++ ++# We default to using /usr/bin/gdb.minimal if it's present. See ++# https://bugzilla.redhat.com/show_bug.cgi?id=1695015 and ++# https://fedoraproject.org/wiki/Changes/Minimal_GDB_in_buildroot for ++# explanations. ++GDB3=/usr/bin/gdb.minimal ++if test -x $GDB3; then ++ GDB=$GDB3 ++fi ++ + myname="${0##*/}" + + dwarf5="" diff --git a/SOURCES/gdb-lineno-makeup-test.patch b/SOURCES/gdb-lineno-makeup-test.patch new file mode 100644 index 0000000..4b96286 --- /dev/null +++ b/SOURCES/gdb-lineno-makeup-test.patch @@ -0,0 +1,165 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +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 . */ ++ ++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 . */ ++ ++/* 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 . ++ ++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\]+ = {} (0x\[0-9a-f\]+) \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 ++ } ++} diff --git a/SOURCES/gdb-linux_perf-bundle.patch b/SOURCES/gdb-linux_perf-bundle.patch new file mode 100644 index 0000000..728f463 --- /dev/null +++ b/SOURCES/gdb-linux_perf-bundle.patch @@ -0,0 +1,224 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +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/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 +@@ -27,6 +27,177 @@ + # include + #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 +diff --git a/gdbsupport/common.m4 b/gdbsupport/common.m4 +--- a/gdbsupport/common.m4 ++++ b/gdbsupport/common.m4 +@@ -145,7 +145,7 @@ AC_DEFUN([GDB_AC_COMMON], [ + AC_PREPROC_IFELSE([AC_LANG_SOURCE([[ + #include + #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/SOURCES/gdb-opcodes-clflushopt-test.patch b/SOURCES/gdb-opcodes-clflushopt-test.patch new file mode 100644 index 0000000..f95999e --- /dev/null +++ b/SOURCES/gdb-opcodes-clflushopt-test.patch @@ -0,0 +1,62 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +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 . ++ ++ 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 . ++ ++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" diff --git a/SOURCES/gdb-orphanripper.c b/SOURCES/gdb-orphanripper.c new file mode 100644 index 0000000..2653dd2 --- /dev/null +++ b/SOURCES/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/SOURCES/gdb-physname-pr11734-test.patch b/SOURCES/gdb-physname-pr11734-test.patch new file mode 100644 index 0000000..835e18c --- /dev/null +++ b/SOURCES/gdb-physname-pr11734-test.patch @@ -0,0 +1,229 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +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,29 @@ ++/* 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 . ++ ++ 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,26 @@ ++/* 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 . ++ ++ 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,26 @@ ++/* 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 . ++ ++ 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,26 @@ ++/* 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 . ++ ++ 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 . ++ ++# 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,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 . ++ ++ 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 *); ++}; diff --git a/SOURCES/gdb-physname-pr12273-test.patch b/SOURCES/gdb-physname-pr12273-test.patch new file mode 100644 index 0000000..6c943ad --- /dev/null +++ b/SOURCES/gdb-physname-pr12273-test.patch @@ -0,0 +1,103 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +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 . */ ++ ++template ++class GDB ++{ ++ public: ++ static int simple (void) { return 0; } ++ static int harder (T a) { return 1; } ++ template ++ static X even_harder (T a) { return static_cast (a); } ++ int operator == (GDB const& other) ++ { return 1; } ++}; ++ ++int main(int argc, char **argv) ++{ ++ GDB a, b; ++ if (a == b) ++ return GDB::harder('a') + GDB::harder(3) ++ + GDB::even_harder ('a'); ++ return GDB::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 . ++ ++# 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::even_harder(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::operator ==" \ ++ "GDB::operator==(GDB const&)" \ ++ "GDB::harder(char)" \ ++ "GDB::harder(int)" \ ++ {"int GDB::even_harder(char)"} \ ++ "GDB::simple()"] ++ ++foreach sym $min_syms { ++ if {[gdb_breakpoint $sym]} { ++ pass "setting breakpoint at $sym" ++ } ++} ++ ++gdb_exit diff --git a/SOURCES/gdb-ppc-power7-test.patch b/SOURCES/gdb-ppc-power7-test.patch new file mode 100644 index 0000000..c8b22cf --- /dev/null +++ b/SOURCES/gdb-ppc-power7-test.patch @@ -0,0 +1,303 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +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 : 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 */ diff --git a/SOURCES/gdb-rhbz-2130624-assert_in_jit_event_handler.patch b/SOURCES/gdb-rhbz-2130624-assert_in_jit_event_handler.patch new file mode 100644 index 0000000..488aaa3 --- /dev/null +++ b/SOURCES/gdb-rhbz-2130624-assert_in_jit_event_handler.patch @@ -0,0 +1,115 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Fri, 21 May 2021 15:09:14 +0200 +Subject: gdb-rhbz-2130624-assert_in_jit_event_handler.patch + +;; Backport "[gdb/breakpoint] Fix assert in jit_event_handler" +;; (Tom de Vries, RHBZ2130624) + +Consider a minimal test-case test.c: +... +int main (void) { return 0; } +... +which we can compile into llvm byte code using clang: +... +$ clang -g -S -emit-llvm --target=x86_64-unknown-unknown-elf test.c +... +and then run using lli, which uses the llvm jit: +... +$ lli test.ll +... + +If we run this under gdb, we run into an assert: +... +$ gdb -q -batch -ex run --args /usr/bin/lli test.ll +Dwarf Error: Cannot not find DIE at 0x18a936e7 \ + [from module libLLVM.so.10-10.0.1-lp152.30.4.x86_64.debug] + +[Thread debugging using libthread_db enabled] +Using host libthread_db library "/lib64/libthread_db.so.1". +src/gdb/jit.c:1178: internal-error: \ + void jit_event_handler(gdbarch*, objfile*): \ + Assertion `jiter->jiter_data != nullptr' failed. +... + +This is caused by the following. + +When running jit_breakpoint_re_set_internal, we first handle +libLLVM.so.10.debug, and set a jit breakpoint. + +Next we handle libLLVM.so.10: +... +(gdb) p the_objfile.original_name +$42 = 0x2494170 "libLLVM.so.10" +... +but the minimal symbols we find are from libLLVM.so.10.debug: +... +(gdb) p reg_symbol.objfile.original_name +$43 = 0x38e7c50 "libLLVM.so.10-10.0.1-lp152.30.4.x86_64.debug" +(gdb) p desc_symbol.objfile.original_name +$44 = 0x38e7c50 "libLLVM.so.10-10.0.1-lp152.30.4.x86_64.debug" +... +and consequently, the objf_data is the one from libLLVM.so.10.debug: +... + jiter_objfile_data *objf_data + = get_jiter_objfile_data (reg_symbol.objfile); +... +and so we hit this: +... + if (objf_data->cached_code_address == addr) + continue; +... +and no second jit breakpoint is inserted. + +Subsequently, the jit breakpoint is triggered and handled, but when finding +the symbol for the breakpoint address we get: +... +(gdb) p jit_bp_sym.objfile.original_name +$52 = 0x2494170 "libLLVM.so.10" +... + +The assert 'jiter->jiter_data != nullptr' triggers because it checks +libLLVM.so.10 while the one with jiter_data setup is libLLVM.so.10.debug. + +This fixes the assert: +... + jiter_objfile_data *objf_data +- = get_jiter_objfile_data (reg_symbol.objfile); +- = get_jiter_objfile_data (the_objfile); +... +but consequently we'll have two jit breakpoints, so we also make sure we don't +set a jit breakpoint on separate debug objects like libLLVM.so.10.debug. + +Tested on x86_64-linux. + +gdb/ChangeLog: + +2021-05-21 Tom de Vries + + PR breakpoint/27889 + * jit.c (jit_breakpoint_re_set_internal): Skip separate debug + objects. Call get_jiter_objfile_data with the_objfile. + +diff --git a/gdb/jit.c b/gdb/jit.c +--- a/gdb/jit.c ++++ b/gdb/jit.c +@@ -893,6 +893,10 @@ jit_breakpoint_re_set_internal (struct gdbarch *gdbarch, program_space *pspace) + { + for (objfile *the_objfile : pspace->objfiles ()) + { ++ /* Skip separate debug objects. */ ++ if (the_objfile->separate_debug_objfile_backlink != nullptr) ++ continue; ++ + if (the_objfile->skip_jit_symbol_lookup) + continue; + +@@ -919,7 +923,7 @@ jit_breakpoint_re_set_internal (struct gdbarch *gdbarch, program_space *pspace) + } + + jiter_objfile_data *objf_data +- = get_jiter_objfile_data (reg_symbol.objfile); ++ = get_jiter_objfile_data (the_objfile); + objf_data->register_code = reg_symbol.minsym; + objf_data->descriptor = desc_symbol.minsym; + diff --git a/SOURCES/gdb-rhbz-818343-set-solib-absolute-prefix-testcase.patch b/SOURCES/gdb-rhbz-818343-set-solib-absolute-prefix-testcase.patch new file mode 100644 index 0000000..20e5f75 --- /dev/null +++ b/SOURCES/gdb-rhbz-818343-set-solib-absolute-prefix-testcase.patch @@ -0,0 +1,83 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +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 . */ ++ ++#include ++#include ++ ++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 . ++ ++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" diff --git a/SOURCES/gdb-rhbz1007614-memleak-infpy_read_memory-test.patch b/SOURCES/gdb-rhbz1007614-memleak-infpy_read_memory-test.patch new file mode 100644 index 0000000..4d05ba5 --- /dev/null +++ b/SOURCES/gdb-rhbz1007614-memleak-infpy_read_memory-test.patch @@ -0,0 +1,170 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +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: + + + 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 . 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 +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 . */ ++ ++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 . ++ ++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 . ++ ++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 () diff --git a/SOURCES/gdb-rhbz1084404-ppc64-s390x-wrong-prologue-skip-O2-g-3of3.patch b/SOURCES/gdb-rhbz1084404-ppc64-s390x-wrong-prologue-skip-O2-g-3of3.patch new file mode 100644 index 0000000..d92bfc3 --- /dev/null +++ b/SOURCES/gdb-rhbz1084404-ppc64-s390x-wrong-prologue-skip-O2-g-3of3.patch @@ -0,0 +1,235 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +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 . ++ ++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"]S>7-C86QL+71E;7!L871E ++M+E,`+W)O;W0O9VQI8F,O9VQI8F,M,BXQ-RTW."YE;#$$!&PP!```` ++M`#`````8`````````+P`20YP$4%^1`X`009!0@Z``4(107Y2$49_20X`!D$& ++M1@``````+G-Y;71A8@`N`````````!(````$@````$`````````"``````````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;F5W6YC8V%N8V5L`%]?;&EB8U]D:7-A8FQE7V%S>6YC8V%N8V5L`%]? ++M;&EB8U]S96QE8W0`. ++ ++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$````!```!+BXO7-C86QL+71E;7!L ++M871E+E,``0`````)`@```````````]```0)F$P("``$!````CP`"``````@! ++M```````````````````````````N+B]S>7-D97!S+W5N:7@OE(``7@. ++M`1L,#Z`!````````&````!P`````````1`!,CP6.!HT'2`[``@```!`````X ++M`````````"```````"YS>6UT86(`+G-T``````````&````!`````&``````````@````````` ++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 +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: +Message-ID: <1368136582.30058.7.camel@soleil> + + From: Philippe Waroquiers + 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 , + 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 +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 ++#include ++ ++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 . ++ ++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" diff --git a/SOURCES/gdb-rhbz1156192-recursive-dlopen-test.patch b/SOURCES/gdb-rhbz1156192-recursive-dlopen-test.patch new file mode 100644 index 0000000..96b93ae --- /dev/null +++ b/SOURCES/gdb-rhbz1156192-recursive-dlopen-test.patch @@ -0,0 +1,371 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +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 . */ ++ ++/* This test was copied from glibc's testcase called ++ and related files. */ ++ ++#include ++#include ++ ++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 . */ ++ ++/* This test was copied from glibc's testcase called ++ and related files. */ ++ ++#include ++#include ++ ++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,125 @@ ++/* 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 . */ ++ ++/* This test was copied from glibc's testcase called ++ and related files. */ ++ ++#include ++#include ++#include ++#include ++ ++#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. */ ++ old_malloc_hook = __malloc_hook; ++ __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,157 @@ ++# 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 . ++ ++if {[skip_shlib_tests]} { ++ untested "skipping shlib tests" ++ return 0 ++} elseif {[use_gdb_stub]} { ++ untested "skipping tests because of stub" ++ 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 ++} ++ ++set supported 0 ++gdb_test_multiple "run" "initial trial run" { ++ -re -wrap "exited normally.*" { ++ set supported 1 ++ pass $gdb_test_name ++ } ++ -re -wrap "exited with code.*" { ++ untested "failed at $gdb_test_name" ++ } ++} ++ ++if { $supported == 0 } { ++ 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 ++ gdb_test "" "Wait for first prompt" ++ 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 diff --git a/SOURCES/gdb-rhbz1186476-internal-error-unqualified-name-re-set-test.patch b/SOURCES/gdb-rhbz1186476-internal-error-unqualified-name-re-set-test.patch new file mode 100644 index 0000000..21a1a08 --- /dev/null +++ b/SOURCES/gdb-rhbz1186476-internal-error-unqualified-name-re-set-test.patch @@ -0,0 +1,135 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +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 . */ ++ ++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 . */ ++ ++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 . ++ ++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 .*" diff --git a/SOURCES/gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch b/SOURCES/gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch new file mode 100644 index 0000000..a0eb440 --- /dev/null +++ b/SOURCES/gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch @@ -0,0 +1,104 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +Date: Fri, 27 Oct 2017 21:07:50 +0200 +Subject: gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch + +;; [aarch64] Fix hardware watchpoints (RH BZ 1261564). +;;=fedoratest + +diff --git a/gdb/testsuite/gdb.base/rhbz1261564-aarch64-watchpoint.c b/gdb/testsuite/gdb.base/rhbz1261564-aarch64-watchpoint.c +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.base/rhbz1261564-aarch64-watchpoint.c +@@ -0,0 +1,33 @@ ++/* This testcase is part of GDB, the GNU debugger. ++ ++ 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 . */ ++ ++__attribute__((aligned(16))) struct ++{ ++ int var0, var4, var8; ++} aligned; ++ ++int ++main (void) ++{ ++ aligned.var0 = 1; ++ aligned.var4 = 2; ++ aligned.var8 = 3; ++ ++ aligned.var4 = aligned.var0; ++ ++ return 0; ++} +diff --git a/gdb/testsuite/gdb.base/rhbz1261564-aarch64-watchpoint.exp b/gdb/testsuite/gdb.base/rhbz1261564-aarch64-watchpoint.exp +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.base/rhbz1261564-aarch64-watchpoint.exp +@@ -0,0 +1,53 @@ ++# Copyright (C) 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 . ++ ++if { [prepare_for_testing rhbz1261564-aarch64-watchpoint.exp "rhbz1261564-aarch64-watchpoint"] } { ++ return -1 ++} ++ ++if { ! [ runto main ] } then { return 0 } ++ ++set test "rwatch aligned.var4" ++if [istarget "s390*-*-*"] { ++ gdb_test $test {Target does not support this type of hardware watchpoint\.} ++ untested "s390* does not support hw read watchpoint" ++ return ++} ++gdb_test $test "Hardware read watchpoint \[0-9\]+: aligned.var4" ++ ++proc checkvar { address } { ++ global gdb_prompt ++ ++ set test "p &aligned.var$address" ++ gdb_test_multiple $test $test { ++ -re " = \\(int \\*\\) 0x\[0-9a-f\]+$address \r\n$gdb_prompt $" { ++ pass $test ++ } ++ -re "\r\n$gdb_prompt $" { ++ untested "$test (unexpected ELF layout)" ++ return 0 ++ } ++ } ++ return 1 ++} ++if ![checkvar "0"] { return } ++if ![checkvar "4"] { return } ++if ![checkvar "8"] { return } ++ ++# Assumes: PPC_PTRACE_GETHWDBGINFO::data_bp_alignment == 8 ++# 'lwz' does read only 4 bytes but the hw watchpoint is 8 bytes wide. ++setup_xfail "powerpc*-*-*" ++ ++gdb_continue_to_end diff --git a/SOURCES/gdb-rhbz1325795-framefilters-test.patch b/SOURCES/gdb-rhbz1325795-framefilters-test.patch new file mode 100644 index 0000000..cfe309d --- /dev/null +++ b/SOURCES/gdb-rhbz1325795-framefilters-test.patch @@ -0,0 +1,176 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +Date: Fri, 27 Oct 2017 21:07:50 +0200 +Subject: gdb-rhbz1325795-framefilters-test.patch + +;; New test for Python "Cannot locate object file for block" (for RH BZ 1325795). +;;=fedoratest + +diff --git a/gdb/testsuite/gdb.python/py-framefilter-thread.c b/gdb/testsuite/gdb.python/py-framefilter-thread.c +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.python/py-framefilter-thread.c +@@ -0,0 +1,39 @@ ++/* This testcase is part of GDB, the GNU debugger. ++ ++ 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 . */ ++ ++#include ++#include ++ ++static void * ++start (void *arg) ++{ ++ return arg; /* Backtrace end breakpoint */ ++} ++ ++int ++main (void) ++{ ++ pthread_t thread1; ++ int i; ++ ++ i = pthread_create (&thread1, NULL, start, NULL); ++ assert (i == 0); ++ i = pthread_join (thread1, NULL); ++ assert (i == 0); ++ ++ return 0; ++} +diff --git a/gdb/testsuite/gdb.python/py-framefilter-thread.exp b/gdb/testsuite/gdb.python/py-framefilter-thread.exp +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.python/py-framefilter-thread.exp +@@ -0,0 +1,54 @@ ++# Copyright (C) 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 . ++ ++load_lib gdb-python.exp ++ ++standard_testfile ++ ++if {[prepare_for_testing $testfile.exp $testfile $srcfile {debug pthreads}]} { ++ return -1 ++} ++ ++# Skip all tests if Python scripting is not enabled. ++if { [skip_python_tests] } { continue } ++ ++if ![runto_main] then { ++ return ++} ++gdb_test_no_output "set python print-stack full" \ ++ "Set python print-stack to full" ++ ++# Load global frame-filters ++set remote_python_file [remote_download host ${srcdir}/${subdir}/${testfile}.py] ++gdb_test_no_output "python exec (open ('${remote_python_file}').read ())" \ ++ "Load python file" ++ ++gdb_breakpoint [gdb_get_line_number "Backtrace end breakpoint"] ++gdb_continue_to_breakpoint "Backtrace end breakpoint" ++ ++# #2 0x00007ffff75f228d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:113^M ++gdb_test "bt no-filters" " in (\\.?_*clone|thread_start) \[^\r\n\]*" "bt no-filters" ++ ++# #2 0x00007ffff75f228d in 941595343737041 () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:113^M ++# vs. ++# #2 0x00007ffff75f228d in 941595343737041Traceback (most recent call last): ++# File "/home/jkratoch/redhat/rhel/gdb/rhel-7.3/gdb-7.6.1/gdb/testsuite/../data-directory/python/gdb/FrameDecorator.py", line 145, in frame_args ++# return self._base.frame_args() ++# File "/home/jkratoch/redhat/rhel/gdb/rhel-7.3/gdb-7.6.1/gdb/testsuite/../data-directory/python/gdb/FrameDecorator.py", line 152, in frame_args ++# return args.fetch_frame_args() ++# File "/home/jkratoch/redhat/rhel/gdb/rhel-7.3/gdb-7.6.1/gdb/testsuite/../data-directory/python/gdb/FrameDecorator.py", line 276, in fetch_frame_args ++# block = self.frame.block() ++# RuntimeError: Cannot locate object file for block. ++gdb_test "bt" " in \[0-9\]+ \[^\r\n\]*" "bt with filters" +diff --git a/gdb/testsuite/gdb.python/py-framefilter-thread.py b/gdb/testsuite/gdb.python/py-framefilter-thread.py +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.python/py-framefilter-thread.py +@@ -0,0 +1,60 @@ ++# Copyright (C) 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 . ++ ++# This file is part of the GDB testsuite. It tests Python-based ++# frame-filters. ++ ++# This test is specifically crafted for RH BZ 1197665. ++ ++import gdb ++import itertools ++from gdb.FrameDecorator import FrameDecorator ++import copy ++ ++class Reverse_Function (FrameDecorator): ++ ++ def __init__(self, fobj): ++ super(Reverse_Function, self).__init__(fobj) ++ self.fobj = fobj ++ ++ def function (self): ++ # This function call should not fail. ++ gdb.target_charset () ++ ++ fname = str (self.fobj.function()) ++ if (fname == None or fname == ""): ++ return None ++ else: ++ fname = fname[::-1] ++ return fname ++ ++class FrameFilter (): ++ ++ def __init__ (self): ++ self.name = "Reverse" ++ self.priority = 100 ++ self.enabled = True ++ gdb.frame_filters [self.name] = self ++ ++ def filter (self, frame_iter): ++ # Python 3.x moved the itertools.imap functionality to map(), ++ # so check if it is available. ++ if hasattr(itertools, "imap"): ++ frame_iter = itertools.imap (Reverse_Function, frame_iter) ++ else: ++ frame_iter = map (Reverse_Function, frame_iter) ++ return frame_iter ++ ++FrameFilter() diff --git a/SOURCES/gdb-rhbz1350436-type-printers-error.patch b/SOURCES/gdb-rhbz1350436-type-printers-error.patch new file mode 100644 index 0000000..d06e121 --- /dev/null +++ b/SOURCES/gdb-rhbz1350436-type-printers-error.patch @@ -0,0 +1,81 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +Date: Fri, 27 Oct 2017 21:07:50 +0200 +Subject: gdb-rhbz1350436-type-printers-error.patch + +;; Test 'info type-printers' Python error (RH BZ 1350436). +;;=fedoratest + +Typo in Python support breaks info type-printers command +https://bugzilla.redhat.com/show_bug.cgi?id=1350436 + +[testsuite patch] PR python/17136: 'info type-printers' causes an exception when there are per-objfile printers +https://sourceware.org/ml/gdb-patches/2016-06/msg00455.html + +diff --git a/gdb/testsuite/gdb.python/py-typeprint.cc b/gdb/testsuite/gdb.python/py-typeprint.cc +--- a/gdb/testsuite/gdb.python/py-typeprint.cc ++++ b/gdb/testsuite/gdb.python/py-typeprint.cc +@@ -31,6 +31,12 @@ templ s; + + basic_string bs; + ++class Other ++{ ++}; ++ ++Other ovar; ++ + int main() + { + return 0; +diff --git a/gdb/testsuite/gdb.python/py-typeprint.exp b/gdb/testsuite/gdb.python/py-typeprint.exp +--- a/gdb/testsuite/gdb.python/py-typeprint.exp ++++ b/gdb/testsuite/gdb.python/py-typeprint.exp +@@ -50,3 +50,7 @@ gdb_test_no_output "enable type-printer string" + gdb_test "whatis bs" "string" "whatis with enabled printer" + + gdb_test "whatis s" "templ" ++ ++gdb_test "info type-printers" "Type printers for \[^\r\n\]*/py-typeprint:\r\n *other\r\n.*" \ ++ "info type-printers for other" ++gdb_test "whatis ovar" "type = Another" +diff --git a/gdb/testsuite/gdb.python/py-typeprint.py b/gdb/testsuite/gdb.python/py-typeprint.py +--- a/gdb/testsuite/gdb.python/py-typeprint.py ++++ b/gdb/testsuite/gdb.python/py-typeprint.py +@@ -15,7 +15,7 @@ + + import gdb + +-class Recognizer(object): ++class StringRecognizer(object): + def __init__(self): + self.enabled = True + +@@ -30,6 +30,26 @@ class StringTypePrinter(object): + self.enabled = True + + def instantiate(self): +- return Recognizer() ++ return StringRecognizer() + + gdb.type_printers.append(StringTypePrinter()) ++ ++class OtherRecognizer(object): ++ def __init__(self): ++ self.enabled = True ++ ++ def recognize(self, type_obj): ++ if type_obj.tag == 'Other': ++ return 'Another' ++ return None ++ ++class OtherTypePrinter(object): ++ def __init__(self): ++ self.name = 'other' ++ self.enabled = True ++ ++ def instantiate(self): ++ return OtherRecognizer() ++ ++import gdb.types ++gdb.types.register_type_printer(gdb.objfiles()[0], OtherTypePrinter()) diff --git a/SOURCES/gdb-rhbz1398387-tab-crash-test.patch b/SOURCES/gdb-rhbz1398387-tab-crash-test.patch new file mode 100644 index 0000000..d0555c0 --- /dev/null +++ b/SOURCES/gdb-rhbz1398387-tab-crash-test.patch @@ -0,0 +1,454 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +Date: Fri, 27 Oct 2017 21:07:50 +0200 +Subject: gdb-rhbz1398387-tab-crash-test.patch + +;; New testcase for: Fix -completion crash (Gary Benson, RH BZ 1398387). +;;=fedoratest + +diff --git a/gdb/testsuite/gdb.base/tab-crash.bz2.uu b/gdb/testsuite/gdb.base/tab-crash.bz2.uu +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.base/tab-crash.bz2.uu +@@ -0,0 +1,393 @@ ++begin 644 /tmp/libgcc_s-6.3.1-20161221.so.1-objcopyR.debug.bz2 ++M0EIH.3%!6293622@"44`>Q=_____________________________________ ++M________X#\<>SD#OM[7/HAP:R]\H#D"=!/";NP7!]OOJG>U[N;WW'KVV?9I ++M[[,[X.\/;%2U``[[NUM7P^T[U617V#12M]6M7W;M7CZU<=!]/8WL[LI=AZZ> ++MJ5XW;QP]W]DVHY@]/6RS= ++M8[:2][W/F01Z:GIID,IC$GHU-HR$:@T0F ++M@$PC($P"`$PF)D9-&IZFCT-4\$TRI^330-$TR>32>FFF@F!H0GJ>TD_*9!E, ++MR3Q3/11M-,%#T-3:-3T9(P-3T3TT@;1ZD>C1E,AM0:`@@303"`(Q*>FGHU)Z ++MGDFR8FFJ'L5/1C313R3U/*?JF]&35-J!Y3U/TI^1$\IZGFBGJ>HVF4>H])ZA ++MZC)ZFT)H>IH]0>H!H&RC0,F0T9E!HT-`TT`)-1(A$R&J?J3T80]313\F0GHC ++MU3:90\H]$]3:C93U-!LH\IIZ$]0R>:D>329J--`/4_5'I-`TT9#3U!ZC0>H# ++M0])H!H9!Z@#30VH#30-/4T'J`]09%$!4\)A3R,-1'J`S2#0--,$:/$C9-3TG ++MH:FR9-(T>D\4],HT'I`/4`>HVFIIZFR:FR:)Y,3*/3*;"FT:(VIYJC:FF)Z: ++MCTFAIZCTAH:#U!F*")1`0!`"9#4Q-,FT(R33R-4VFE/U&TU-3RGZ1FJ>&H]2 ++M;U38GJ-J3TQ0Q'DU-'J?JF]2&30-'J:>H,FC1HWJ@#RFC0!Z#2-/4T&&4T-/ ++M2:&(>D'J,5#"1JH5B["KJTH:1R2I95!0TXN8+PQ'&*+8%8JVQCC/1G1D0A-S ++M91MLJJLK];M*G>^]MGIW=W7E>KL ++M)MXKMO7VV\M77ANM3H=6LGI)+AR&CF'#<66)4&4S6:;*26:S5DUQGS$+>97< ++M!3.,U$LQELITU,X3Y5[GW>0?IM4(5>Z!^AE04E8=:H(X[7T$U.`@QRT\Z]_" ++M7?`4-8Q_UDP"AQ@$1,B`G(D*S"^7Z%ABZ-%T6MS+#&8M+G ++M)M>_Y9ME3-K"RMO>,UK^9/4HYU5!3:6'45^1-AA23JG7FH&=KT9ZK-!6>?\- ++M;_HD;$V3C,[X\-20B*R?`.(:CK$3A&J2!XYI6TW[U*HI*560[F!42LB.:FO9 ++MT2S-`KC"H/^S^JJFC(54?*/HIBKH,!73^2++62,G98Y/*,\,%R,Y08$R@$&L ++MC#"P#E53*YTZS&>L\]4*"<8&2^]*I?02,46;3.V(P+2P`3$>F+HNTY/(%Z<` ++MM.P&I]6,NED[M1J4`O?!J@8`&>?1 ++M%!8/]>.7UF-'?ZO,O??);\\L:3X7JN-O^ZWAPV:'ONI*N$I2REEE+$\Q47N6 ++M)NB0W\O.LZ)TMD[9VG1NS+?94@_.$$=!P2#U2(8;*%.99OOW:1@#`W]ZV:OR ++M1IWEL,R4\*2Y2^>SP[^QB ++M_,U-)GY3;9KT/P=Q.GX.7G"Q:>QK&9"$ ++M[#-J-&>2W>*T.XDRFC(,4I`"ED(D0(($(R0#&6;D6H(.:&R(R,:JBHZ!54G< ++M11T9V@K&&$`@8+T3IN#,:<5@P(RTBD1%(JP%55$2*#^!4E,%ER22`*-**JU6 ++MJZII6%N>*+(`*J_?LDI@")%A1D1`@0D?O:UXU=+B+/%.C.3P3935G@9N(=B( ++M39SA1$,K(<1`/."P@;M&4XI&*(9N(H[,#92F)PFDD,V:;%@V(`6%EHV(`6$+T`+00*I0;U ++M`+6F`+<5+:@OPH!:+<%V-Y:H6@0ST6@@$DQO&U0"]M7&.2N,;AN4`HP8H!<7 ++MT;QP4`N;A(R`&`P88BZ-&+V-:04?;20GS/LL>$_B,!&RT)$%@$(*)!"$E!7/ ++M#&8("!8N/9=K.,FB'MY.._/VD>C9#^`XS.XJ/S:XR1TI^MMN1AER0/FI,QI< ++MI!S/-3&8!4S2B>DK$=5/`G2Z><=$L7)SB`(%.`?MXB?J?H_!K]]%1:Q0>>D5 ++M@*,0!$21@`8Q[N?N_7_H;4[#S/![4O,^[NUOC?7F"'Z'YMMYO*;_)-K^K9([W=II7_32_/>'@"M-U3'I3>\5F/7!,>LN:H3*N!L;; ++M")']UU7>>-S\,?K65#!/&(542)(!76C2F<92T@@7G-NX#D][M'6*;YS)AF7< ++M!W7=#3Y1,RGT_`:&!`EU8>JEM/&JEI"+[5?4O\_]DT0",,XH95*#$@#=L,AO4L+ ++M1BB(3Q$X?C1IAS!$AY.>_%4]AI=*'&F6&\>U;\YG,QV14-HP9\BY30H/3].G ++MTW36AQ.N"4&8U(-$CSEJ:IAKE6J,KC=.U9$\H:1I/5!WK37"2WTTCL+"6YJD ++MVV8?W_`MAI=@)]J^U-YAOBS;:'(S4SPBJP))LEQ'+GK;<]US[@5VN)U.SEI] ++M@B6(>WE8&UNN(Z_Y^_U`>?=I*[4=\'V/"\YOXXU=RH7$2P ++MZ8AP5/2@#F" ++M^(R"5",K@5=:R=P=>/%\_!=LCS0>*ISX$*;G?\$9(P-<"734Z=7:V/E#,EJ3 ++MR#)DN].):$0+S";E13Q8UADO"%],GD)5UBLWUDCN34&A3.I3U+69_K:PL#9:%6F) ++M[AU5/05TLKLJ2*QB0,US:"U%(#G!9N81MN&'7T1O*J^]%%^#HV->-]LNGN*= ++M"C%H8>WG7$,^&0"244E4:#V6Y!289:<&E<<-ZGKH1[>$BW"MUU,#SL;,,),V ++M565B6/E!Z,H8E#]WD=(P%@X(,/C7GD0D ++MP-:,NZ$0>8GQY;JN=^^\XXXN0&5=W>Z5]AZ1HYC%E&S'8*.!D@5[<8]"EYC) ++M7*.I"&7-3RH1V#K4>$VO7@MZ*G*`]>M6049!\$(C%$3O$(">"B@IT'Y=.=H)`'G ++MP?T,;OF2.6;FQ;,.#Y<(PT)/0+73.OI!]&#-""F[4ST51A!FJDN2B3PA ++MCB(Q@J)!V14/5@R7:FG%FN\:RY!,K%>T32S-L$$!!OM9<,*\;?V9^D]EW* ++MBQ6*UR5PQ\J=9&)2U[%%,*&2VK(M$(BHTDQO)TV^76K`\E7:.HV99X,B$L68 ++MSG"]BK3]QP^-(JA!,M42_#=-`S`(@)8T4R,S_Y[7P__.8YW/0JJJJJJJNK8X ++M-=3PO'T&C*J9)`]F0`%K%$*P$#"""'MX"\OETF6EW>4IT9RN8.;PY_?U:<^? ++M*X$4&<5`%`1414BR`"1@4.DH8`QG9@#`TT7)^C&:7C@IA^%"_<3WTX+Q5*-=*7Y#/IE(_)_ ++MYYO52X/>^`A8NS+]GQ6$%J!9HFB5*_*22UE#*>TYS.T"1U[AFR44'A(ZIZ$N ++M7O')DXRK49/4T!7XG8#F7\)CF+,TPJAPV;\#4,AD7,Z/*?9D2DQDGR.^]LB( ++M%[`,/\]CK_:F,LN`#`T>]RT?A*WQ[K='\FN+&[/YKKD[GOG)".MPK9KOE&2> ++M4312<,\Y^C:>3=S-OHU-R)^F^*9H5Q"=7^-'_#GT?0V-ZX-3_S"6N2Q?O;7: ++M=G#ZR=L/JQG[ ++MO\_!J];07#9:XP=/JNC6V$KW5]`_.82T05/S?='X=WG0YS.[I94'X$?S()[N ++M#_Y@OQH(_`@/2399*2&\0*8=X^IVZ-3#*-44=7^#1YU#@<+A<&%:']\FNF[I ++M29_6J&Z$R.&H/.2,M8LDC$UZC*6*@F7SBW:"GQ3@-&AS/D'%[PAX*Z.!&Q`! ++MK?M_?V/CA,ZX91WMR-A0992O)T0BR^HF9=VIA-3&20"GDL&" ++M2O*AJJ$K`'3#X"@L61'"0N\_-&J])J,%%(*O_R0A*R3X>_<_]4=+TNCF/6?< ++M]IGY%UQ&M/IX7^;)C'TSL++)C1,MUVW257A0K(-$P.$V@S/RDA=MA.W#)`^< ++MI.1!C(@-*E;AB)^IQOD_^YWQ:2]K^31Z+%2J$@W$OT7PD.02BH.>E@'022(E ++M3@Y$+>HD)''I ++MK!<&,1@9T",6@FYM(V?[Q8KX6%]RJ`*8F:0\/6K-)X%%08$0"I?TTOH7J&:2 ++MP"RV[FF`@B!MYU]ZA5,A0DG2_Q)37"OW#@@D%P1P53,Y9BTRN'V=+Z4!-QP> ++M0Y0QJ(A,6"07X?-ZWOBHFM&@L1]UFNEG^IKIM+R/9>.LI"N99-[D[:+A+S@] ++M9SU/\?K]_\Q%2,`!A(D20!4>@D8$G;HBBL(!"(2`J'98-5R/N2MRE[9.N+,! ++MO"/VT9Y%Q@(TM(/8\%_VL"*'2P^*D+N2,C?4!XXM?3VL;&:5WJ^+#L>F7!H_,N ++MIUM`#L5Y[#M_O]A6"9J&&AI_78:(A$4RYACP^Q[,#B9?EORFBL,[/%'C)]'[ ++M.CACW"3O$#=`(=[_-\UU>&,/=25L+C^"'BK/E0!N1^$_"JB+_JPA`*]8CO(: ++M`,.^+BG;`ZF7BV09<[-_][:8^4KLHF.(1`0<SWGYJ3I.3K!0![LX-.34%X ++MKYZ.+[/.9+T`A+UD=Y@88X+WRYRQ#Z.0GAL_X^DU8%6CXLM.6/V<%ZXA\X\>Z?;"LR((5^)BH[ ++M9YVM6QCU[L+>4:^0@[(+A[*2R473>#_#80G05=[MO!0B83]S4Y#69SL\FU;, ++MM[%]++>'XGB[M<9CU9H/*ZY^J8LEQ/Y>=4H#=D ++M076@OV1*HU!09+VY&I##%336?/5%)M>9>5%%"0;X0^D(!5LP%ZR;J#4AL2A( ++MVL=+2L3>4N`V%1T%AG`R@("$$@E`4)0]>@`6#Y_ ++M!?KZ5D(#B^G8"OV,(-.'8LE-"R&W?C;5W&U,*%TS9#DQGG02?LI;-V'6_'VD:/[B\[^!BK._+R4O,AIRU>SJ67X@ ++M9BGP5'Z*.")D_)5(1^2U>5IE7MC^?6;KS0@W,1]%[_1Q>7T[6YJ6XJQ.^W;Y ++M/EBI?KRW$W[U(3Z"^#'K&C9:437[_,^`K\[(S?[&%\T)U''KMU:$5SAVI&?1 ++MO)WDB92)(QL1_:14'+!3-4<$"%!A'EL*M:SVOPL/C22OB0/^XF ++MK<69BJ[(VD8/"J7=>==O$-;WW//)P10\;N+6!'EH$U.A3!PVG>^?[V.QP)[E ++MM#M7!J:JJ5FI.V-&A9([(@[VAQ'!<$'(1S;SN=_.6>^5#L1AQ&_D'TL&-9`/ ++M68$)7J_190&=D@#5'\F^+AINR/5:*)DDUZ[PNR9<+9KN3=Z?U+GOLD3<33S= ++MITE&9$Q@::(*8DUSZ<4:QI+(U)BWK2;WBIFENWDW[`N'(FMFG:Z>V\N0-.!C ++M]U#!U]T8<9HC9P8<^B_][RM5^;"??IE6G\((HDSM:T1.%M7\:[:DU2F*_DM4 ++MYS/(B9,$-F_^*?"5:RW^<#:*&>C'":.!%4R6T1D?:_G=$H[JG;^K-&;DAU5X ++M&\$R"F*J1F;BV>]?N_E7K/--@V7(QI0@&I.NR=19-&!(=T.&_,X7T=/'`?1* ++M%W!R_DXWII`J:7?>BE$CIAWG*'YBZ$Q'_%_<27$JIQGYCU"!+X5C(PDS@W[\ ++M7\*E`_CB_W[+#`2HNE+Z5(.40BX]1`,]W]9L2=-5S\JMIA,-W<&@; ++M^[8^O76V>0CBYD0'SW%)\GD[WPO%X,)C%,*J;0T`C:JCB'+92>O:H';H,-[R ++M=DRZ#I]-'NVA`SO3(FDOZW8P4EL?@9A=5^0Y7FCDLWBFFUTVRG&%.[D2V^=` ++M5#K.+)QE0NXQY^M7*(C1-,N?>U93STMV@CGTY>&R$>RPK3'2R2*?5I5(24S/ ++M3K0$S`PJ(?/0Q9_SG%)RTTU3HP8:\7'A72DJ57`^O/MG`YY><>SSD?WAH=M: ++M"RO5HS+T!`\:(`9QAYB=#3-8"F2'/%UT1%Q3?D&F$[TQ2-M#%>'(OH`!2E./ ++M)389QV:(LHH6GG+(3N1L[?82L*K4K0&9XD2X6@M+0N,)U%K,T-":?/Y]\MK5 ++MK_Z:_I>'2UZ7+0:AKH\.K%VYPA6E!DHVG,PO?KU25M)+DT,P/AGJ<1$85R9% ++MPF!G=#T]U45@%VRRB)A-TW^ZQ(Q_ZZED+F:K/ ++M%[7I:0$4UD$#WL$0]Y40\#A.AW7;\'O>+#S^/JY/1OZ/3K>4XW>>[AD]#5PU ++M:AAQU[/W.(AMMJ>4Q`29&#B9U_*;%>_:VI]+:'MP6ICV=R&`\X8;_^^!.GMS ++M[CNN,)<#02E3:J,LVK(;7-QHKD@J'][T+:HKY^3V'XE@FQ3YWDML=KUMVS9T ++M--UE*6'ES*\2LIZ+T;BH^&&6:[X%`OG)G&&W,6 ++M)H$T1"14@OL:/PY6'YT^RE4`/70$D`%\6*J_[>]LELD`/3H$FC6R':]3T>]R:N[G/F>L^-Z8W(@05",604",9-Y"A3TN;K^7U_D?5 ++M]+)>,!C#_7R<;\D\CX1PL]S$^X[C@`P,/0"-31'T61;6DR@][DZ>GRX>I6>`E\3;J]#&J;J-QZDEZ ++MN`Z"S<>Q9D;G8V4DQ'4T:78NL=:(*1TE&S_R-!0N)EE'3[0&B*! ++MXQ*NL=1!1^MME#CP3"#Z\>EWS"6?=]^))"@K:@'@@WDG:-N)I=7TH:&]V:HU#$8H@2H7&5C!B8/< ++M>+*R`ZN=[,`1\>^V(NU#+I]][;J]J$$)=@@8!C&8F38Z2ZYW@!C;&*7UJH?S ++MQ*8,+&MJ!D'$H2WJ"=:##R1L!V.SV:FBB#KMJZ-A8U=P'F)%DBD+Y(]`W<76 ++M0"B`P'7/I#2C1W`Q//G]JRCF4N!U6V.,:6B(^'F_PM]?37_I^G\>W:F,#`!L ++M#$,?SLN]D@92+./&PT_IX_D\#C]]P.?H=A[GX8-3>EHG#-5Y:9#51"%*"@8, ++MR,#P4(,M6C4*U0!009;_,O-S^;=Q%1U4]/RN)VFLJGPB`SJ%?B]A6)UT%0>\ ++M7?CM)8U>&P!P_@=A7"`%&/ZL=2/B:J/Z>/Q_QN./XO]HL>FR%6\R]CX<7IV1 ++MM0K6BSY&M4Q1/\^R5ZB<#`'BZ1KJHV!@LE\&)<,`$827-VNZ1PXSI0/%T;N2 ++M:'A7:2NQC\#-SZFY*DG.9SA'QL/C0XYFJ`..@)-DDV29VD5#RDE>]G8Q^3VW ++ML)IY;;C3C--_D9B/%?0-[\A)B^]1S.A,'R5))?(UTRN%AZ[R=7^#1>8QD6;? ++M\\>9'WS7+Q2MMQB$4G'&LKKE_5:P6VHX=!IXC/A?V!&;E12BA`S"D%5]>PD& ++MLS[;Q-_NX\>E1,6!J!`.E>BKU-7><]ML_>YUY`*]=J1"%3^'=ZG#M`_=FP\5 ++M_1@U\L5HC!6/M^AK=6RKL$<4WMRZ#=/)WD-JE[^K[$5:2F,WF$W:PM9.*M4Y ++M,1F3/&3Z4AKF[0P[+OYJE&NVX5N("$H-U)M)Q]U1O+/^/[+5!F0AOSIW)JO1 ++M-W"XB@\FPFF^^+'I5<9E=\R":I,J$XM:0Y$V!"D*0/[J>C4]94.6F>7>N3E^ ++MZS4N7`.VR=BDAPI]W\W2SM;LA4L[C%P*HES%0]GNJ_4,L#<[Z^]\A0P/G_9< ++M-GJDQ,;U!M7+G$4.Q774HG@<3ZR^,@.(C5#=9R1V,1BJ>G;B^X1G8:0*J9PI ++M0O;M#TOG'I,BH@=IM=C3M.?3S+JKI7#,9^+T0K`E=MSFF.*<'F(&]5Y[G99G ++M$Q0MHQB/4_,W&S73.T(4?>X?VDZ)REP[?IQJS%,A"CV=$(_EC6+=\=C[AZ^L ++MT6_?WU:<<"*P,*F!BTVR-7-UZ8R*<(0Z,?*JV<():T68@T1[:_##<>AN:?DT ++MFK>X6UN;;41]M,=73:_5`8T)T.!>[ADD@M$)!&9DX4_BU5+'$2![3L[L]J^Z ++MNB>(E(74J3W"%&E0J0Z!0A1"@K/[XD5C,*BGM#&WV3BL+08N0>"'P6\JH&%[ ++M_'ONYQUCK5P8Z@\6BSVU0/@G(./1*RH.1^?4F$S2GX":4R%3D!X_,0:@()!, ++MX.-/LI6"D^5H9QOY(BMN;Y[FTCO5U^=_V]-005[^R6@N"H]!I"@*J2I9445_ ++M?LM+4&A$:4*A`@3/(K`5895(TB768N-]$Y",C9W-PTE8>7<6FSV_800?X^2Q ++ML6'"\!JHI4"AC#]EJ"+343WC0"P%!X6Z=Z+>/#;E\:3H ++M*J9Z)ZHG?FL$!@@([X%`13X]*>3\4W=4+!:?80*1;@X_:7`V2$",%O%+Y;NW ++MSK?IH.1]7FZJ%F6T;`NP\"[HC>M:RB9@9CM ++MN5V'C^C]SZ+:[B[]+=^EM]A+]F_!\*>SA;M^^UT*,[^Z802/D8,&I$20.*F'Q/!Z_P-@_2/8^OT^"0@))K'@?MU`W<04B($7/6DU3`./KY ++M:1.?^/Y_JBD3"%"(29.P4)IHI_DA+0R?6Z%LR#'D>>-RY]_<[&]";4S'N9LZ ++M"Y_Z2\H5#%Z.7J?>2_*H\+?3*3@?E2>)5$*M1;0//-@K!L7>5:>)F4[WO4.>,LM,94O5/E$SMAZ>H ++M\![?H>XT]I?,L*YE4(_XY&?7:=O,PS0::.'M8IM8F#)34%%76)^HW?:5.S=Y6&,4AE,AE@%G2V47(DXEPJT)0 ++M..PL_..*EQ-^+I,4 ++M56.:ST1Q#2EAT>"]%8+(?\>5O`*'!.B37T7>L6.7PW*[?5@`6%UD\A!('2L+ ++M.$R'/6!C>GKC#<5U,GN3M%F9WZDL`#J-4OYO1/K#W'8/.+L-B!CG ++MX>C5+"2X.U^#\@\X%#M@H7^B?UMO@_`IC<6<>OX?O"ZMQ?_D-P]Z(A[$]Z_% ++M+`/EE#J)UQ1L@*%@C[$1"K]>"A+B&;O@8'Q?I;)U?/;1OP=SD7X(0+@/D`C ++M/D>5DIGL#VVM`4V40(D($48(AZH0`3N`(J^_Z7C^-$K2C]+3I-44+?CE2BE: ++M#.]`(@$(E,*(A?*OS&D'J%0$X>>2#.C>W]UAB?==P[^@X@.USAH$4HVQ5N0` ++MZODUS#,W(T.=7,.=4Z"1PJ7D&>!D_"SMO9HN>!IEBHY@LWU&4`A2C*%!*P@F ++M8:NPEZZ1OJ+8!2PM4`I5D,(BM2`%DHF4@!@-D)G$G;9"2$@VMR@%5`*C5O"T ++M4`BYZ*`8%I9>WMXV(`8>GP<;"C@H!&EW$,0`H)-61KVF4`"BE8`&6*P(T5MY ++M[,,;ND@P0:%;$:!6,4@"?R*`@&(I`?/V.OR$P*:HNV,TP%#5A;Z`2JI_A9J' ++M][V!`!.$/:?0EGVF8TSR<_YI`4.0%0RB(=X"A!$/`!0OJ`)50["B$$0M!0I0 ++M2"H11'R04*J-04+S-FYJBAX210"0]YV;I/?,69?B1'DF7D;]MP`1`).+&>KUBK4B?4=S:MC<=XWW$U4KM[G[J2EVCN; ++M/@/-;<73F[?O[4P!0W`4.`%#R=[`2!W.O9K37>X]!V]56Z^)X;I9Q1+C!41$ ++MA)"20]?3*9`AEP?L?*3)N`Q3!3D0`LC0"E*)%1I%>]!0VP4.J"ALW`8GBTD@ ++M#L^)$P#&[CW_!W%E/`IFIAB>S2DGPA)&9)!F9F`A"*L=/@R,)LXZQI19P9&2 ++M15")D#(0,00(D`:\P,X<1RJ9G3.Q+U&^0G`B'FW@#<8A8&_T9K"I@@00;!0V ++MFV+(\9;GZW-.K6N_:8*<.7D+*!;[0KZ.DM+/;Q1#DO]1P=U0K$SDMIB"0,=)TI=B1D1`&1@9+]015`AUX.G%YCZTQSMP&.NF[Q2D ++MLFF^%S/`X*6,"GT/\-3\I.+EJ[:-C*DVU%JVK?RT55HA5M ++M=IL\W`ZX8X'%R6G6UJ($"HG#NPH6)[9)5#I>#661&#'.,(R#0BA?#,(=4P<9 ++MC849O*SG1$]L9,1UH*!1HCV=J7?)NP'\_L2T\!H*$(67:P!AE18K\Z$!Z8K# ++M3**H"OOKTP&`WF3K!\@2',QTC=T"G1R-J+][XLV ++M(+8U@=`1MFP\,V/E5"&F8=JAMA>ST4A8R]DFB-V.8J;>MYL^"G(IU)_!1T1S ++M1ZKUQC]A"6W+L==(4)^N[[/IW.W'V>OI3ZQ3I)5#=,;"[4`WYH:H"EIO#QP] ++MSLR@!H'@:TL;M]IPBL<^H8]HE8\TV##;I=QSPY_]QF;P ++MM/>O"3T)[*80=VMJ@'7HE+(S=H(%<+PY^)\@S]_< ++M;HPZ-X4BF#W(*'(0`K;8HF.\+K,J(@7U(\$0%_L?>;GX@ZBQQ8+SQM-(KZ,T ++M9C:"/-1$LP6-!UB!H'J`"Z[BU1&&*B])JICY7IM$"$[=1A]Z(`N00(;F^!CC ++M5^P%&$;?H8DTT347F=$+184JBY0.(9!0,+$N[M:9UZ'XN^`PG`&KU$+X:VQP^/6EA!K$],NI#&V[..-H-1%"/>\UILE?@CGDZ_->"R,B!V.L@$ ++M\&)YAC4=[_/OLTGHN.\HM45P\AYL%3UTXX8UK89FA0IA!,I6./VBK\XR="PY ++MX$>0E!].'NBXP53HL[#=M+887P^KJ$O*\J%%R3%HS53F3>PW"W)RE^0XP`&B ++MX5S4FXKO7KFF=!'B*40SE(LCGE4:[%<'28D=N(EZTAK?KT,J8/+0;J:&KD4Q ++MB[OTEDH1OBO+GDKUP8>/$/I/K&79VH!DW(/A#%O11Q,@?43>'>UDD\ER#*FT ++M')J(=2J>5.VW66K+2X(DT)IN(PK1W!R2F&OY&3M18,?"*L,:G@I^8P.Q>&WF ++M#.EZ:?20E*9N80_^%7)T'JNIOAM2U8J7U%SQ!5SP<%>O\CD:[T#9,"[%5=`GHARQIT ++M%\QD4*(FQ4)1^"94)MT,<05.QG++X<\&]/K$6S/WCS493!P1"*-:=F<4IPIN ++M/+HA_?]9K12Z4?9#B^ZG``&8)YPC&'J`:.$+6*I=A&GX74>)[[HP]&G1Q'WD ++M&I$34#4[D:E&0X>6!PZ:3'B0^W>(,D=*^/92`7Q>Q9-VAPUEQY3OTL_HZO#; ++M>#LA+:6P2J`"-2V,RA8$1Z7F[]*K)3,'CQHY$78K\B']@`8P%]=;,/U'E7#N ++M*&)X?MY1EQ%FK,8H:9K>;;!S?'N^@'EQ,87%WG+>)!%3C>! ++MPG)6ZNZG!P'@4%04Y;)`BM,$\7AB]3RL4:\XW7W00(".LJFSTKGT*M2TN^L7 ++M%@0`B`(A<`$"(1N!QX5FD\?@KO;H<;O.81WCXCX0Q*/U9@/0C ++M%(`V()O@A7*8\:4@&#F)EC0I05R7\PBCBCE#2XF,#"KCFN@W ++M>X>>N2Q1:\ZY(2F0,Q?:''2/&A[N9<9W,W"C.BFA"X6`#S/>PH?FQ$NZU?L5 ++M:%KJY31\`:46RYB8I12>4+@=KUF'V84*AZ9)<=+3`TMQSW!&4&1 ++MOVK3F)P\F'+M>@6I@UR)FR&V&]@54]WN43U=;>HIBQ14'9V"IBLL3##*Q],) ++M]QWNQWGS@"VU^,'ZK(O"&XX73+[$P:JK;=PJN[)=#R\,!3RVIIE4%#$M#M:[T;+*^L[L\_E->?;7GBTF.WV'SA^,C ++MI_(U5I*^F0K_A\E2M,7C("1S"";,76BQS-J0\@"(!@A7K8LPYTN8I$"81B%1 ++M`2=VC#?M08HPA"!^5`AU)@H2LH%WI7IIQW$(44H5I@A&_(*0&2]9BH$/S424 ++MA[ID(4F0PG+%CL8%'F96&M\T#-$984"5((`GI9O\^J`G)"3 ++MF$F&UPO%T7I"-_4@?=<7448N.,D(T:\SOC/B0Q[.&;'-BYP3#<._R"(7]"@2 ++MB;[:-2ACE"YUZ)"\@RP@*&P7C0%#GO?PG1Z($QPJPJX;0J% ++MM77KK\]``=R#J10T14"4D%<\6L+ME\?UG3^>^5U.OD!0]L0`3B!0@@KR<9-P ++MXQ-;L=B_?>*S;KP@@@<.\Z#.-M"Q%IPM$S$,EA?"(H)'AE%@E>(`38$0KENH ++M]!A=)P]Y_=LLSAE$R%+").Z_8;-;K9`DT\WCWG0Y"P]#];[*TR"=W$V,V91A ++M71,P*$:G9H`TMG,HETJ\/!38KNF;OK\P*&5H!OJJO>I!4(\(*&-IF"F@%#?: ++MYPX,&FHI(<=[S*;`*%BV3+ ++M@P&<#C!ZMB!2%%`=4,*!O.H4S#`@H%NK\B\5#*>?XGQMCF8W'\*G4SGM?J3$ ++M.[`K2U%`44!BQ&16V,KX'0*3KCCC(@8G90&TX@*';F\]9.BEPZ+322R/-M10 ++MR5`$IZ@@N9>,I984,W=;)`QC)JX*%>Y?0&'-AM15=<-%!(&;ZK>!O.*&]IL/,LNP44\D;(=EVWGN. ++M<:*;Y.R9TN"O:[A73N%1/,)PN)6#(&+%6B&Y"2A!;:[G-0( ++M^-\(=F/B/>'L(+-)POFTHV%?R5\SNC[ABBN!J7%-YELS%@L5(H5@58P5D`B` ++MQ/D!-HQ7,::HBH&,@RH3&"0PAK<0`BHRSV)WVT<&3@">YM+7(7/6<0U33JH% ++MFYS:'!VWP`!*]J2!E)"0B0B*((HQ$11B/WIB!1L2$UPD9"-3(1C`4W^Z@.T2 ++M$RV=VM%5165C3(]7JSZ`N=#Z<"=NM9G/\83I['_K/4_HWCFKHWV:J:Y?Y'7A ++M?DI$1`BM`$0%(``A]#ENPDS3Z^)MN7]3\W6%.*Z'<&R.8+:@@0!@(0% ++M"09`0($!0@H)Q;WT=+2$%0GCY,%V.FV#8+C555,5:JE1I*&A64J4TRPD#?A"`A7A?E=V;H^5^.-Z ++M6;9:`B>RV7/ZWMF<\GFAL7@"0.W=<"A9CT-E%!,43[^,@)S]'FB,H9"!IZQH ++MH1S!EM)#>P@B%+J@H=P:#%`(H!&-^E\:4(U/%V"IIP!0VP4,!8N3#&7E(4*% ++M)0E+QR`H8:"X`T;-Y?41POCSN=O=DYGW<]63['4"AD9$])!#N0$%Y%49R1H] ++M6*"?%YJ!HJ9E39'VPG`9;O/EH#D8L95,.A8F&DHX/>60794`1,M0S,&B"%^> ++M[P>L"]1T,P1:P($'TD0"Y41OAU@4,@*&P>W@],!U&R'%CMFQ:HY5&CU!-N[: ++M:`]:H6HH)F;`H[WL[.Z[\^9ZZ[8.CHFX(ZCAF4T3E@H1&D:F)3>UXW%).3O] ++MRT3:,VU>!F(A42\]S]WA?`OT/W'0ZPB&3&:)2,V*VM25/IZA($,I-Z0HI"08 ++M-.R5&JC:35G(%UE`@`EGDP"BC`(HW^#4+@4(!-L%"/8+F@V"(0E!$*(9H2M" ++MHPD"AN&[" ++MHYN6'+C&PP%&S;A:II;HDMNP,&X`2"C@&373*.8%#/6+@=`;!$.`>9,UQMY*T*=9H'VFCSJY7!1 ++MH?-G*%!;>7G+:^;0H7;MI8I6M-//XE"IS@R@H7E ++MY\2C1W-"$VZCS`4,FYEC"$C)Q.UJUX'2_3P_3?C7Y81 ++MP,^I,KDUEX*'2RG3Z1TR=K[S57UI`^G-6<@AIA:KW**=FLHRLF,>RE9I:;CV ++M4C_OU2_?Z=CQ.71PKA'F+1J.K@V'#!L0F\Q=I##\/`0="-8S0ZE_`R/TQF'CHT4`W8<[TPTZU!0+[.[FW,VK1354`PU6:N@I$Y ++M1)%S)K0='IB5-T]&)5RK!@S/9"_3E$4!NNR>F!0@9T1/(CV^`DDA/[34!0RQ ++M%#(P6<\X#56L2%-:EHOT6QP7!X.0;!#X&/ASC>:8LLPWEBS*LKKB9-)5-!59 ++M;6UU`W:U?"X$VMI5J-"JJM33NIPX&OL!*OGM;9XNSKN6C=V;OA4M:TIL8[8* ++M%^J)980DA-L3E:P4-XO,2W1]3!ORDA(8FT"AA0@TH(;+`IJ,.ZW.(-U!^J\((H=5D)E'S]CYGC\FGS[,.=D#, ++M(@6/J18(LK%TQ`B`(48]'1WW<%0RDAXIVF(Y#P3)VT/;XM?VC8[E<)6]2F'B^O^_4N,>`RGOW`@G[W'RU`?#%[PDA$DU(]^8A?^ ++MDQ/MS"1D8>ER,>3H3/'H7"ZZZZZ8`23.A,Z?;PB*/NR+C\>IA[S;IO[X\L(U ++M*8+6$!40?^>X!1K^-^)7O8>D0_%NKYCSHZS]:)( ++M#/7AQ%$8&:1AS>,M=[MMCGM6%&D&#F`2`,8!0\5[J>,"A_;L#]"=R+AE/7]C ++M8_=MCV(DO(2>>\_GL\JRX/G?045JAA`"?.G7@>0?@4#[;Q3V6/>^I+CR_SZ/ ++M,QH'S_0_0J>U@>)/_$/5:-1JY7&7'UTX3B"P`2@J&]3PK1Y37045.-[&RU@C ++MRZE!QRM1S7R%'CX/#[_R-&9Z3/H$A9[*ITAY+H87N/MQ^XRSN=4GN]8J"*9T ++M4R?\IT_Z'OD_W1@',I\5%O.?>V!^_>KA%_VPS55;10&&]E*IK?KLI,/7_/>L ++M^UO:R&]I_AK"3J+\;_ ++M27^:>[[K:'0_IRO#AY]*0D\W_]V,W?7WO7[;][\4N]4J;74]OKR#I("ZF)[\D.+7[JW<1M_S+T\R07]^.GHN2N_V9W^UAH/?M6L(]G=;K8`^ ++MNGF*OQV7S(P>`QF$K9K.8#_/:_`86%)Q#=W]L'PKE*TZ/Q/>W0X:[]Z!=MVAGZ3XE^R4@7Z<;!&Y2#\_ ++MZ)!2!?*E\$B%&8XI)1DC5[YX0Q.D!U5!X>T_#9.<7W8\W8*\2(#[7OKPL/%P ++MMCZ'U_NJ)T\='S>((D_7A^ELI=U(3,[P-9[+TT'PWDE'"$\!X=_\_).ROW^? ++MC=.S-W,8.>T2CBVG&3T>S'H/R==M"JX)?-VOP7GM- ++M?2\':;;5N;OB<3>9^20W4&3S:/LW:AARVH-G6TXL ++MDV\!)L(@OU(`.H@8<80FQRK)$PE(T\YV=T-QZICXH'U:!W.%:XYY4M:_.D`5 ++M6YB":A=D94"H`(#`W"$#%A,')0]-U:>&S":X@W%\BOH3^V+%,$"HQKE""HB- ++M0A!C@V((WR@$O#G3>I#[/G[2P@U&5UR47BO1?WMZ5$;Y`0%V0?IONU7!O;OQ ++M$->N4W#HL,OL_MU_I-KT.>\Z;3O>4:*LX#Q,&CM7">7Z$\6]4ZMY7I=NTYM% ++MZ)IY48P2K*WEJ^2V-(B`/`IKS(?6MQ2E'=>U[*5&>8($I,!YRH*,FI%59T3G ++MCT@9#11"[,IUXXTZJ=+@L^BO,#!,@8`B,,'D:[,(IRKJN!N(PCUN7ETFMNQ> ++MT.M,<5L4#9FB*%?$W!57FM?/^ZBA@2T-7E"Z%F;\[:8XR0<6)_+$E*H!FF8. ++M-XG<(8#8^U:S%08IU0*`6B3A$>0E<[+JG_>:@;>-`Y1E`&`8=(RYUE')]1`TYY(A:#RB0FG3$PE+)8S ++MGU.@!,R[6^+K@E&1>47'U:5Y9^H"9N$SLJ5J?%:_%JV9"PQ"#C%I;C:?MTG) ++M<_+^*U#T[J#O`$?NA$H`J5@CT><;M?J"+89:J5'/N15EU7F7>F1"I0/G+">Y ++M3+-@8%+J^"D)LAGHE1:IW4%D>L70=!S'KQZ=T/&:X3,<[QS#1;Q0:L.Y4(WR ++MIS8('-XK,_=EA`C,5^$HZS9@[X!)(&TP;5L0+F9IIL:86^R:&;<$8IY<9"=$ ++M980D2B%BWIQ8MF1**D]I;;CK69[X^A0WPLO@0K_*(X]F;<'PTXE7 ++M=W36:V(H)-CY_U'(8WEH]4NH>1WYRQ+BR@4% ++M$1U.K,)S+4!]61]+Q!Q];=1<:0H&&9F^&`@320!JS8'6STZ[:=E*IZ;&BDC7 ++M0Z/7-5O>MY:IK*BM/5>;X56^9&U^#42.H)OFI54HV1)`TJC7_B33GAVXJ]7O ++M;?1"OI([IPP,[MV,/M;SJ$X)F]1/8&A&510:&ID)5D![*U)9=_1^5X(."9$3 ++MAKAD3Q"G(58]/R>7K9'EWM'SQL4<(VSXPXG5&YKMU-_C3ND*S57\G4:0+B9, ++MJ5UN=Z]5!0TZS\:=[S.J>H-)[0]6K0B-@S.BC387!M ++M$S)!YJMA-!`JT[;'[Z^+^[0R-)::%H%GHKM=7G#8VW_]:.U^;<&A9&M/6UP?W""!BY%` ++M#![EE,U-#7?W49=0ZXLS<=KZ:P-?Z3.X9G9?7W,9U.N2TLZ.@I-#Z@G7\7TV ++MWHSA0AEJ*,1,`G^Y-'RV*AEKF,/?,:P^UZ&F<"J&#J0NMG0&<\V@F>9R#G`8 ++M8"2$M4:2?X:&&W[K8\*=>CQHL8G]'<]@CN1F#'"X-ZO8\(=;X+BJT=]2+C:H ++M4PL_D99">XRIU6^@S@B;6=;A"S6J!DD&;F8.@CY3\G*1J,;%1,\3U?C65;#&*>6OE! ++MFVJJJM,IDRO),/K661%M4\6#1,IBT04O9HXN64;!]\FH*H#<46AK6%-'LCF9 ++MR+1L24TY4/W_$$4`;*4R6-)=-<[!3VX70!7=GKY%5A/>5U.!KP4`/^X".'H%Q?;P',T8(,[(O1T\\K!%">*#TZ3L)AZ$/:3# ++MN#L_''38,`!CF+]:(8[7>H+[G4L`8'8$'2;(;A-TB>Y-?`Z0SHGO<-&]>=?1 ++M.%\D]#]-"\?6"0!S,$=]"\WZJKFWW+0,KN8@H5#,P4JO+2[I8+)K.GE;OZ'7 ++MW6^-;6=X]"-%4;W@V9C.#*N(]M'VAWIC7&N_#'E;W?3^T'>]-2-X=9B^4;U\ ++MT'*-(H-.>>8:,Q(3.V46OUD]TQT7D-PM+!C5]1&$A5_.0$FU.WL(&AB[^J(W ++MC9_.U;3@%I%C#)%M;R_(%(ZBT`U7Z%$^2K53FF"->R$&0GTQ1HJCRC*ZNL1@ ++M;F!0>FK6OK[E(YYHF^=GYS,F>9DC+2@>J2@N@/>\BL^-6Z=!H*-?OLIAZ_NK ++MLDN"E,GB8]*I2!;=UH7JBS.6AF88^:>-ZOR=_N7A"M\B,YE=CKV?B(2%+;-$FTH0P@=0=)7(@D5HIYCOV$EW.MZP_:HB ++M&,OED]W=BZGUITM#NKAC8,`1SO"V/<*,?4Q+AGF/V=O(_QZ9Q08'TG;(.%W> ++M3QI"^R0+9F25\+`V81V6@)V/X&8HAATY-]YTO.V[=I1-2`X6_"5%@0JCBP0? ++M!4@"!(7#-S*G*12#Q7ISP]OR(^?&&48%!EP>;\@B($4F'_XNY(IPH2!)0!** ++` ++end +diff --git a/gdb/testsuite/gdb.base/tab-crash.exp b/gdb/testsuite/gdb.base/tab-crash.exp +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.base/tab-crash.exp +@@ -0,0 +1,43 @@ ++# This testcase is part of GDB, the GNU debugger. ++ ++# Copyright 2017 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 . ++ ++if { ![istarget x86_64-*-* ] || ![is_lp64_target] } { ++ return ++} ++ ++standard_testfile ++ ++# gcc-base-debuginfo-6.3.1-1.fc25.x86_64 ++# /usr/lib/debug/lib64/libgcc_s-6.3.1-20161221.so.1.debug ++# objcopy -R .debug_loc -R .debug_ranges -R .debug_info -R .debug_abbrev -R .debug_aranges -R .debug_str -R .comment ... ++ ++set debugfilebz2uu ${srcdir}/${subdir}/${testfile}.bz2.uu ++set debugfile [standard_output_file ${testfile}] ++ ++if {[catch "system \"uudecode -o - ${debugfilebz2uu} | bzip2 -dc >${debugfile}\""] != 0} { ++ untested "failed uudecode or bzip2" ++ return -1 ++} ++file stat ${debugfile} debugfilestat ++if {$debugfilestat(size) != 71936} { ++ untested "uudecode or bzip2 produce invalid result" ++ return -1 ++} ++ ++clean_restart ${debugfile} ++ ++gdb_test "complete p si" "complete p si\r\np size_of_encoded_value" diff --git a/SOURCES/gdb-rhbz1553104-s390x-arch12-test.patch b/SOURCES/gdb-rhbz1553104-s390x-arch12-test.patch new file mode 100644 index 0000000..2cb15e5 --- /dev/null +++ b/SOURCES/gdb-rhbz1553104-s390x-arch12-test.patch @@ -0,0 +1,81 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Jan Kratochvil +Date: Fri, 23 Mar 2018 20:42:44 +0100 +Subject: gdb-rhbz1553104-s390x-arch12-test.patch + +;; [s390x] Backport arch12 instructions decoding (RH BZ 1553104). +;; =fedoratest + +diff --git a/gdb/testsuite/gdb.arch/s390x-arch12.S b/gdb/testsuite/gdb.arch/s390x-arch12.S +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.arch/s390x-arch12.S +@@ -0,0 +1,4 @@ ++.text ++.globl load_guarded ++load_guarded: ++.byte 0xeb,0xbf,0xf0,0x58,0x00,0x24,0xe3,0xf0,0xff,0x50,0xff,0x71,0xb9,0x04,0x00,0xbf,0xe3,0x20,0xb0,0xa0,0x00,0x24,0xe3,0x10,0xb0,0xa0,0x00,0x04,0xe3,0x10,0x10,0x00,0x00,0x4c,0xe3,0x10,0xb0,0xa8,0x00,0x24,0xe3,0x10,0xb0,0xa8,0x00,0x04,0xb9,0x04,0x00,0x21,0xe3,0x40,0xb1,0x20,0x00,0x04,0xeb,0xbf,0xb1,0x08,0x00,0x04,0x07,0xf4 +diff --git a/gdb/testsuite/gdb.arch/s390x-arch12.exp b/gdb/testsuite/gdb.arch/s390x-arch12.exp +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.arch/s390x-arch12.exp +@@ -0,0 +1,34 @@ ++# Copyright 2018 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++ ++#if { ![istarget s390x-*linux-*] || ![is_lp64_target] } { ++# verbose "Skipping s390x-prologue-skip.exp" ++# return ++#} ++ ++set testfile "s390x-arch12" ++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 "disas load_guarded" " <\\+28>:\tlgg\t%r1,0\\(%r1\\)\r\n\[^\r\n\]* <\\+34>:\tstg\t%r1,168\\(%r11\\)\r\n.*" +diff --git a/gdb/testsuite/gdb.arch/s390x-arch12.o.uu b/gdb/testsuite/gdb.arch/s390x-arch12.o.uu +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.arch/s390x-arch12.o.uu +@@ -0,0 +1,20 @@ ++begin 644 s390x-arch12.o ++M?T5,1@("`0`````````````!`!8````!```````````````````````````` ++M``$X``````!```````!```<`!.N_\%@`)./P_U#_<;D$`+_C(+"@`"3C$+"@ ++M``3C$!```$SC$+"H`"3C$+"H``2Y!``AXT"Q(``$Z[^Q"``$!_0`+G-Y;71A ++M8@`N +Date: Thu, 29 Apr 2021 17:19:13 -0500 +Subject: gdb-rhbz1870017-p10-plt-prologue-skipping.patch + +;; Backport "Add Power 10 PLT instruction patterns" +;; (Carl Love, RHBZ 1870017) + +gdb/ChangeLog: + +2021-06-07 Carl Love + + * ppc-tdep.h (ppc_insn_prefix_dform): Declare. + * ppc64-tdep.c(insn_md, insn_x, insn_xo): New macros. + (ppc64_plt_pcrel_entry_point, ppc64_pcrel_linkage1_target, + ppc64_pcrel_linkage2_target): New functions. + (ppc64_standard_linkage9, ppc64_standard_linkage10, + ppc64_standard_linkage11, ppc64_standard_linkage12): New ppc + instruction patterns. + (ppc64_standard_linkage9, ppc64_standard_linkage10, + ppc64_standard_linkage11, ppc64_standard_linkage12): New variables + in define MAX expression. + (ppc64_skip_trampoline_code_1): Handle ppc64_standard_linkage9, + ppc64_standard_linkage10, ppc64_standard_linkage11, + ppc64_standard_linkage12. + * (ppc_insn_prefix_dform): New function. + +diff --git a/gdb/ppc-tdep.h b/gdb/ppc-tdep.h +--- a/gdb/ppc-tdep.h ++++ b/gdb/ppc-tdep.h +@@ -426,6 +426,8 @@ extern int ppc_insns_match_pattern (struct frame_info *frame, CORE_ADDR pc, + extern CORE_ADDR ppc_insn_d_field (unsigned int insn); + + extern CORE_ADDR ppc_insn_ds_field (unsigned int insn); ++extern CORE_ADDR ppc_insn_prefix_dform (unsigned int insn1, ++ unsigned int insn2); + + extern int ppc_process_record (struct gdbarch *gdbarch, + struct regcache *regcache, CORE_ADDR addr); +diff --git a/gdb/ppc64-tdep.c b/gdb/ppc64-tdep.c +--- a/gdb/ppc64-tdep.c ++++ b/gdb/ppc64-tdep.c +@@ -49,6 +49,38 @@ + | (((unsigned (spr)) & 0x3e0) << 6) \ + | (((unsigned (xo)) & 0x3ff) << 1)) + ++#define prefix(a, b, R, do) \ ++ (((0x1) << 26) \ ++ | (((unsigned (a)) & 0x3) << 24) \ ++ | (((unsigned (b)) & 0x1) << 23) \ ++ | (((unsigned (R)) & 0x1) << 20) \ ++ | ((unsigned (do)) & 0x3ffff)) ++ ++#define insn_md(opcd, ra, rs, sh, me, rc) \ ++ ((((unsigned (opcd)) & 0x3f) << 26) \ ++ | (((unsigned (rs)) & 0x1f) << 21) \ ++ | (((unsigned (ra)) & 0x1f) << 16) \ ++ | (((unsigned (sh)) & 0x3e) << 11) \ ++ | (((unsigned (me)) & 0x3f) << 25) \ ++ | (((unsigned (sh)) & 0x1) << 1) \ ++ | ((unsigned (rc)) & 0x1)) ++ ++#define insn_x(opcd, rt, ra, rb, opc2) \ ++ ((((unsigned (opcd)) & 0x3f) << 26) \ ++ | (((unsigned (rt)) & 0x1f) << 21) \ ++ | (((unsigned (ra)) & 0x1f) << 16) \ ++ | (((unsigned (rb)) & 0x3e) << 11) \ ++ | (((unsigned (opc2)) & 0x3FF) << 1)) ++ ++#define insn_xo(opcd, rt, ra, rb, oe, rc, opc2) \ ++ ((((unsigned (opcd)) & 0x3f) << 26) \ ++ | (((unsigned (rt)) & 0x1f) << 21) \ ++ | (((unsigned (ra)) & 0x1f) << 16) \ ++ | (((unsigned (rb)) & 0x3e) << 11) \ ++ | (((unsigned (oe)) & 0x1) << 10) \ ++ | (((unsigned (opc2)) & 0x1FF) << 1) \ ++ | (((unsigned (rc))))) ++ + /* PLT_OFF is the TOC-relative offset of a 64-bit PowerPC PLT entry. + Return the function's entry point. */ + +@@ -75,6 +107,18 @@ ppc64_plt_entry_point (struct frame_info *frame, CORE_ADDR plt_off) + return read_memory_unsigned_integer (tocp + plt_off, 8, byte_order); + } + ++static CORE_ADDR ++ppc64_plt_pcrel_entry_point (struct frame_info *frame, CORE_ADDR plt_off, ++ CORE_ADDR pc) ++{ ++ struct gdbarch *gdbarch = get_frame_arch (frame); ++ enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); ++ ++ /* Execution direction doesn't matter, entry is pc + plt_off either way. ++ The first word of the PLT entry is the function entry point. */ ++ return read_memory_unsigned_integer (pc + plt_off, 8, byte_order); ++} ++ + /* Patterns for the standard linkage functions. These are built by + build_plt_stub in bfd/elf64-ppc.c. */ + +@@ -342,6 +386,110 @@ static const struct ppc_insn_pattern ppc64_standard_linkage8[] = + { 0, 0, 0 } + }; + ++/* Power 10 ELFv2 PLT call stubs */ ++static const struct ppc_insn_pattern ppc64_standard_linkage9[] = ++ { ++ /* std %r2,0+40(%r1) */ ++ { insn_ds (-1, -1, -1, 0, 1), insn_ds (62, 2, 1, 40, 0), 1 }, ++ ++ /* pld r12, */ ++ { prefix (-1, -1, 1, 0), prefix (0, 0, 1, 0), 0 }, ++ { insn_d (-1, -1, -1, 0), insn_d (57, 12, 0, 0), 0 }, ++ ++ /* mtctr r12 */ ++ { insn_xfx (-1, -1, -1, -1), insn_xfx (31, 12, 9, 467), 0 }, ++ ++ /* bctr */ ++ { (unsigned) -1, 0x4e800420, 0 }, ++ ++ { 0, 0, 0 } ++ }; ++ ++static const struct ppc_insn_pattern ppc64_standard_linkage10[] = ++ { ++ /* std %r2,0+40(%r1) */ ++ { insn_ds (-1, -1, -1, 0, 1), insn_ds (62, 2, 1, 40, 0), 1 }, ++ ++ /* paddi r12, */ ++ { prefix (-1, -1, 1, 0), prefix (2, 0, 1, 0), 0 }, ++ { insn_d (-1, -1, -1, 0), insn_d (14, 12, 0, 0), 0 }, ++ ++ /* mtctr r12 */ ++ { insn_xfx (-1, -1, -1, -1), insn_xfx (31, 12, 9, 467), 0 }, ++ ++ /* bctr */ ++ { (unsigned) -1, 0x4e800420, 0 }, ++ ++ { 0, 0, 0 } ++ }; ++ ++static const struct ppc_insn_pattern ppc64_standard_linkage11[] = ++ { ++ /* std %r2,0+40(%r1) */ ++ { insn_ds (-1, -1, -1, 0, 1), insn_ds (62, 2, 1, 40, 0), 1 }, ++ ++ /* li %r11,0 */ ++ { insn_d (-1, -1, -1, 0), insn_d (14, 11, 0, 0), 1 }, ++ ++ /* sldi %r11,%r11,34 */ ++ { insn_md (-1, -1, -1, 0, 0, 1), insn_md (30, 11, 11, 34, 63-34, 0), 1 }, ++ ++ /* paddi r12, */ ++ { prefix (-1, -1, 1, 0), prefix (2, 0, 1, 0), 0 }, ++ { insn_d (-1, -1, -1, 0), insn_d (14, 12, 0, 0), 0 }, ++ ++ /* ldx %r12,%r11,%r12 */ ++ { (unsigned) -1, insn_x (31, 12, 11, 12, 21), 1 }, ++ ++ /* add %r12,%r11,%r12 */ ++ { (unsigned) -1, insn_xo (31, 12, 11, 12, 0, 0, 40), 1 }, ++ ++ /* mtctr r12 */ ++ { insn_xfx (-1, -1, -1, -1), insn_xfx (31, 12, 9, 467), 0 }, ++ ++ /* bctr */ // 13, 14, 15, 16 ++ { (unsigned) -1, 0x4e800420, 0 }, ++ ++ { 0, 0, 0 } ++ }; ++ ++static const struct ppc_insn_pattern ppc64_standard_linkage12[] = ++ { ++ /* std %r2,0+40(%r1) */ ++ { insn_ds (-1, -1, -1, 0, 1), insn_ds (62, 2, 1, 40, 0), 1 }, ++ ++ /* lis %r11,xxx@ha */ ++ /* addis r12, r2, */ ++ { insn_d (-1, -1, -1, 0), insn_d (15, 12, 2, 0), 0 }, ++ ++ /* ori %r11,%r11,xxx@l */ ++ { insn_d (-1, -1, -1, 0), insn_d (24, 11, 11, 0), 0 }, ++ ++ /* sldi %r11,%r11,34 */ ++ { (unsigned) -1, insn_md (30, 11, 11, 34, 63-34, 0), 1 }, ++ ++ /*paddi r12, */ ++ { prefix (-1, -1, 1, 0), prefix (2, 0, 1, 0), 0 }, ++ { insn_d (-1, -1, -1, 0), insn_d (14, 12, 0, 0), 0 }, ++ ++ /* sldi %r11,%r11,34 */ ++ { (unsigned) -1, insn_md (30, 11, 11, 34, 63-34, 0), 1 }, ++ ++ /* ldx %r12,%r11,%r12 */ ++ { (unsigned) -1, insn_x (31, 12, 11, 12, 21), 1 }, ++ ++ /* add %r12,%r11,%r12 */ ++ { (unsigned) -1, insn_xo (31, 12, 11, 12, 0, 0, 40), 1 }, ++ ++ /* mtctr r12 */ ++ { insn_xfx (-1, -1, -1, -1), insn_xfx (31, 12, 9, 467), 0 }, ++ ++ /* bctr */ // 17, 18, 19, 20 ++ { (unsigned) -1, 0x4e800420, 0 }, ++ ++ { 0, 0, 0 } ++ }; ++ + /* When the dynamic linker is doing lazy symbol resolution, the first + call to a function in another object will go like this: + +@@ -432,6 +580,29 @@ ppc64_standard_linkage4_target (struct frame_info *frame, unsigned int *insn) + return ppc64_plt_entry_point (frame, plt_off); + } + ++static CORE_ADDR ++ppc64_pcrel_linkage1_target (struct frame_info *frame, unsigned int *insn, ++ CORE_ADDR pc) ++{ ++ /* insn[0] is for the std instruction. */ ++ CORE_ADDR plt_off = ppc_insn_prefix_dform (insn[1], insn[2]); ++ ++ return ppc64_plt_pcrel_entry_point (frame, plt_off, pc); ++} ++ ++static CORE_ADDR ++ppc64_pcrel_linkage2_target (struct frame_info *frame, unsigned int *insn, ++ CORE_ADDR pc) ++{ ++ CORE_ADDR plt_off; ++ ++ /* insn[0] is for the std instruction. ++ insn[1] is for the li r11 instruction */ ++ plt_off = ppc_insn_prefix_dform (insn[2], insn[3]); ++ ++ return ppc64_plt_pcrel_entry_point (frame, plt_off, pc); ++} ++ + + /* Given that we've begun executing a call trampoline at PC, return + the entry point of the function the trampoline will go to. +@@ -447,10 +618,15 @@ ppc64_skip_trampoline_code_1 (struct frame_info *frame, CORE_ADDR pc) + ARRAY_SIZE (ppc64_standard_linkage2)), + MAX (ARRAY_SIZE (ppc64_standard_linkage3), + ARRAY_SIZE (ppc64_standard_linkage4))), +- MAX (MAX (ARRAY_SIZE (ppc64_standard_linkage5), ++ MAX(MAX (MAX (ARRAY_SIZE (ppc64_standard_linkage5), + ARRAY_SIZE (ppc64_standard_linkage6)), + MAX (ARRAY_SIZE (ppc64_standard_linkage7), +- ARRAY_SIZE (ppc64_standard_linkage8)))) ++ ARRAY_SIZE (ppc64_standard_linkage8))), ++ MAX (MAX (ARRAY_SIZE (ppc64_standard_linkage9), ++ ARRAY_SIZE (ppc64_standard_linkage10)), ++ MAX (ARRAY_SIZE (ppc64_standard_linkage11), ++ ARRAY_SIZE (ppc64_standard_linkage12))))) ++ + - 1]; + CORE_ADDR target; + int scan_limit, i; +@@ -463,7 +639,19 @@ ppc64_skip_trampoline_code_1 (struct frame_info *frame, CORE_ADDR pc) + + for (i = 0; i < scan_limit; i++) + { +- if (i < ARRAY_SIZE (ppc64_standard_linkage8) - 1 ++ if (i < ARRAY_SIZE (ppc64_standard_linkage12) - 1 ++ && ppc_insns_match_pattern (frame, pc, ppc64_standard_linkage12, insns)) ++ pc = ppc64_pcrel_linkage1_target (frame, insns, pc); ++ else if (i < ARRAY_SIZE (ppc64_standard_linkage11) - 1 ++ && ppc_insns_match_pattern (frame, pc, ppc64_standard_linkage11, insns)) ++ pc = ppc64_pcrel_linkage2_target (frame, insns, pc); ++ else if (i < ARRAY_SIZE (ppc64_standard_linkage10) - 1 ++ && ppc_insns_match_pattern (frame, pc, ppc64_standard_linkage10, insns)) ++ pc = ppc64_pcrel_linkage1_target (frame, insns, pc); ++ else if (i < ARRAY_SIZE (ppc64_standard_linkage9) - 1 ++ && ppc_insns_match_pattern (frame, pc, ppc64_standard_linkage9, insns)) ++ pc = ppc64_pcrel_linkage1_target (frame, insns, pc); ++ else if (i < ARRAY_SIZE (ppc64_standard_linkage8) - 1 + && ppc_insns_match_pattern (frame, pc, ppc64_standard_linkage8, insns)) + pc = ppc64_standard_linkage4_target (frame, insns); + else if (i < ARRAY_SIZE (ppc64_standard_linkage7) - 1 +diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c +--- a/gdb/rs6000-tdep.c ++++ b/gdb/rs6000-tdep.c +@@ -7361,6 +7361,14 @@ ppc_insn_ds_field (unsigned int insn) + return ((((CORE_ADDR) insn & 0xfffc) ^ 0x8000) - 0x8000); + } + ++CORE_ADDR ++ppc_insn_prefix_dform (unsigned int insn1, unsigned int insn2) ++{ ++ /* result is 34-bits */ ++ return (CORE_ADDR) ((((insn1 & 0x3ffff) ^ 0x20000) - 0x20000) << 16) ++ | (CORE_ADDR)(insn2 & 0xffff); ++} ++ + /* Initialization code. */ + + void _initialize_rs6000_tdep (); diff --git a/SOURCES/gdb-rhbz1870029-powerpc-remove-region-limit-dawr.patch b/SOURCES/gdb-rhbz1870029-powerpc-remove-region-limit-dawr.patch new file mode 100644 index 0000000..b110d70 --- /dev/null +++ b/SOURCES/gdb-rhbz1870029-powerpc-remove-region-limit-dawr.patch @@ -0,0 +1,79 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Keith Seitz +Date: Wed, 5 May 2021 09:11:12 -0700 +Subject: gdb-rhbz1870029-powerpc-remove-region-limit-dawr.patch + +;; Backport "PowerPC remove 512 bytes region limit if 2nd DAWR is available" +;; (Rogerio Alves, RHBZ 1870029) + + commit 539d71e89a21990d9fd15641477e4790129bdb11 + Author: Rogerio Alves + Date: Tue Dec 1 16:53:38 2020 -0300 + + PowerPC remove 512 bytes region limit if 2nd DAWR is avaliable. + + Power 10 introduces the 2nd DAWR (second watchpoint) and also removed + a restriction that limit the watch region to 512 bytes. + + 2020-11-08 Rogerio A. Cardoso + + /gdb + + * ppc-linux-nat.c: (PPC_DEBUG_FEATURE_DATA_BP_ARCH_31): New define. + (region_ok_for_hw_watchpoint): Check if 2nd DAWR is avaliable before + set region. + +diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c +--- a/gdb/ppc-linux-nat.c ++++ b/gdb/ppc-linux-nat.c +@@ -138,6 +138,11 @@ struct ppc_hw_breakpoint + #define PPC_DEBUG_FEATURE_DATA_BP_DAWR 0x10 + #endif /* PPC_DEBUG_FEATURE_DATA_BP_DAWR */ + ++/* Feature defined on Linux kernel v5.1: Second watchpoint support. */ ++#ifndef PPC_DEBUG_FEATURE_DATA_BP_ARCH_31 ++#define PPC_DEBUG_FEATURE_DATA_BP_ARCH_31 0x20 ++#endif /* PPC_DEBUG_FEATURE_DATA_BP_ARCH_31 */ ++ + /* The version of the PowerPC HWDEBUG kernel interface that we will use, if + available. */ + #define PPC_DEBUG_CURRENT_VERSION 1 +@@ -2108,9 +2113,10 @@ ppc_linux_nat_target::region_ok_for_hw_watchpoint (CORE_ADDR addr, int len) + watchpoints. */ + if (m_dreg_interface.hwdebug_p ()) + { +- int region_size; + const struct ppc_debug_info &hwdebug_info = (m_dreg_interface + .hwdebug_info ()); ++ int region_size = hwdebug_info.data_bp_alignment; ++ int region_align = region_size; + + /* Embedded DAC-based processors, like the PowerPC 440 have ranged + watchpoints and can watch any access within an arbitrary memory +@@ -2122,15 +2128,19 @@ ppc_linux_nat_target::region_ok_for_hw_watchpoint (CORE_ADDR addr, int len) + return 2; + /* Check if the processor provides DAWR interface. */ + if (hwdebug_info.features & PPC_DEBUG_FEATURE_DATA_BP_DAWR) +- /* DAWR interface allows to watch up to 512 byte wide ranges which +- can't cross a 512 byte boundary. */ +- region_size = 512; +- else +- region_size = hwdebug_info.data_bp_alignment; ++ { ++ /* DAWR interface allows to watch up to 512 byte wide ranges. */ ++ region_size = 512; ++ /* DAWR interface allows to watch up to 512 byte wide ranges which ++ can't cross a 512 byte bondary on machines that doesn't have a ++ second DAWR (P9 or less). */ ++ if (!(hwdebug_info.features & PPC_DEBUG_FEATURE_DATA_BP_ARCH_31)) ++ region_align = 512; ++ } + /* Server processors provide one hardware watchpoint and addr+len should + fall in the watchable region provided by the ptrace interface. */ +- if (region_size +- && (addr + len > (addr & ~(region_size - 1)) + region_size)) ++ if (region_align ++ && (addr + len > (addr & ~(region_align - 1)) + region_size)) + return 0; + } + /* addr+len must fall in the 8 byte watchable region for DABR-based diff --git a/SOURCES/gdb-rhbz1870031-p10-prefixed-insn-1of3.patch b/SOURCES/gdb-rhbz1870031-p10-prefixed-insn-1of3.patch new file mode 100644 index 0000000..7515711 --- /dev/null +++ b/SOURCES/gdb-rhbz1870031-p10-prefixed-insn-1of3.patch @@ -0,0 +1,89 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Keith Seitz +Date: Thu, 6 May 2021 14:12:00 -0400 +Subject: gdb-rhbz1870031-p10-prefixed-insn-1of3.patch + +;; Backport "displaced stepping across addpcis/lnia" +;; (Will Schmidt, RHBZ 1870031) + + commit e3d528d7e6a6b863d30aaecf74adf8c78286f84c + Author: Will Schmidt + Date: Mon Apr 12 13:35:54 2021 -0500 + + [PATCH, rs6000, v3][PR gdb/27525] displaced stepping across addpcis/lnia. + + This addresses PR gdb/27525. The lnia and other variations + of the addpcis instruction write the value of the NIA into a target register. + If we are single-stepping across a breakpoint, the instruction is executed + from a displaced location, and thusly the written value of the PC/NIA + will be incorrect. The changes here will measure the displacement + offset, and adjust the target register value to compensate. + + YYYY-MM-DD Will Schmidt + + gdb/ChangeLog: + + * rs6000-tdep.c (ppc_displaced_step_fixup): Update to handle + the addpcis/lnia instruction. + + gdb/testsuite/ChangeLog: + + * gdb.arch/powerpc-addpcis.exp: Testcase harness to + exercise single-stepping over subpcis,lnia,addpcis instructions + with displacement. + * gdb.arch/powerpc-addpcis.s: Testcase with stream + of addpcis/lnia/subpcis instructions. + * gdb.arch/powerpc-lnia.exp: Testcase harness to exercise + single-stepping over lnia instructions with displacement. + * gdb.arch/powerpc-lnia.s: Testcase with stream of + lnia instructions. + +diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c +--- a/gdb/rs6000-tdep.c ++++ b/gdb/rs6000-tdep.c +@@ -836,6 +836,12 @@ typedef BP_MANIPULATION_ENDIAN (little_breakpoint, big_breakpoint) + #define STHCX_INSTRUCTION 0x7c0005ad + #define STQCX_INSTRUCTION 0x7c00016d + ++/* Instruction masks for single-stepping of addpcis/lnia. */ ++#define ADDPCIS_INSN 0x4c000004 ++#define ADDPCIS_INSN_MASK 0xfc00003e ++#define ADDPCIS_TARGET_REGISTER 0x03F00000 ++#define ADDPCIS_INSN_REGSHIFT 21 ++ + /* Check if insn is one of the Load And Reserve instructions used for atomic + sequences. */ + #define IS_LOAD_AND_RESERVE_INSN(insn) ((insn & LOAD_AND_RESERVE_MASK) == LWARX_INSTRUCTION \ +@@ -923,8 +929,31 @@ ppc_displaced_step_fixup (struct gdbarch *gdbarch, + paddress (gdbarch, from), paddress (gdbarch, to)); + + ++ /* Handle the addpcis/lnia instruction. */ ++ if ((insn & ADDPCIS_INSN_MASK) == ADDPCIS_INSN) ++ { ++ LONGEST displaced_offset; ++ ULONGEST current_val; ++ /* Measure the displacement. */ ++ displaced_offset = from - to; ++ /* Identify the target register that was updated by the instruction. */ ++ int regnum = (insn & ADDPCIS_TARGET_REGISTER) >> ADDPCIS_INSN_REGSHIFT; ++ /* Read and update the target value. */ ++ regcache_cooked_read_unsigned (regs, regnum , ¤t_val); ++ if (debug_displaced) ++ fprintf_unfiltered (gdb_stdlog, ++ "displaced: {ppc} addpcis target regnum %d was " ++ "0x%lx now 0x%lx", ++ regnum, current_val, ++ current_val + displaced_offset); ++ regcache_cooked_write_unsigned (regs, regnum, ++ current_val + displaced_offset); ++ /* point the PC back at the non-displaced instruction. */ ++ regcache_cooked_write_unsigned (regs, gdbarch_pc_regnum (gdbarch), ++ from + offset); ++ } + /* Handle PC-relative branch instructions. */ +- if (opcode == B_INSN || opcode == BC_INSN || opcode == BXL_INSN) ++ else if (opcode == B_INSN || opcode == BC_INSN || opcode == BXL_INSN) + { + ULONGEST current_pc; + diff --git a/SOURCES/gdb-rhbz1870031-p10-prefixed-insn-2of3.patch b/SOURCES/gdb-rhbz1870031-p10-prefixed-insn-2of3.patch new file mode 100644 index 0000000..e3dac8f --- /dev/null +++ b/SOURCES/gdb-rhbz1870031-p10-prefixed-insn-2of3.patch @@ -0,0 +1,633 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Keith Seitz +Date: Thu, 6 May 2021 14:53:00 -0400 +Subject: gdb-rhbz1870031-p10-prefixed-insn-2of3.patch + +;; Backport "gdb-power10-single-step" +;; (Will Schmidt, RHBZ 1870031) + + commit c8a379440e0f8bf94ed5730e823c9256e64bf37c + Author: Will Schmidt + Date: Mon Apr 12 14:11:02 2021 -0500 + + [PATCH] gdb-power10-single-step + + Hi, + This is based on a patch originally written by Alan Modra. + Powerpc / Power10 ISA 3.1 adds prefixed instructions, which + are 8 bytes in length. This is in contrast to powerpc previously + always having 4 byte instruction length. This patch implements + changes to allow GDB to better detect prefixed instructions, and + handle single stepping across the 8 byte instructions. + + Added #defines to help test for PNOP and prefix instructions. + Update ppc_displaced_step_copy_insn() to handle pnop and prefixed + instructions whem R=0 (non-pc-relative). + + Updated ppc_displaced_step_fixup() to properly handle the offset + value matching the current instruction size + + Updated the for-loop within ppc_deal_with_atomic_sequence() to + count instructions properly in case we have a mix of 4-byte and + 8-byte instructions within the atomic_sequence_length. + + Added testcase and harness to exercise pc-relative load/store + instructions with R=0. + + 2021-04-12 Will Schmidt + + gdb/ChangeLog: + * rs6000-tdep.c: Add support for single-stepping of + prefixed instructions. + + gdb/testsuite/ChangeLog: + * gdb.arch/powerpc-plxv-nonrel.s: Testcase using + non-relative plxv instructions. + * gdb.arch/powerpc-plxv-nonrel.exp: Testcase harness. + +diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c +--- a/gdb/rs6000-tdep.c ++++ b/gdb/rs6000-tdep.c +@@ -814,7 +814,7 @@ typedef BP_MANIPULATION_ENDIAN (little_breakpoint, big_breakpoint) + rs6000_breakpoint; + + /* Instruction masks for displaced stepping. */ +-#define BRANCH_MASK 0xfc000000 ++#define OP_MASK 0xfc000000 + #define BP_MASK 0xFC0007FE + #define B_INSN 0x48000000 + #define BC_INSN 0x40000000 +@@ -842,6 +842,11 @@ typedef BP_MANIPULATION_ENDIAN (little_breakpoint, big_breakpoint) + #define ADDPCIS_TARGET_REGISTER 0x03F00000 + #define ADDPCIS_INSN_REGSHIFT 21 + ++#define PNOP_MASK 0xfff3ffff ++#define PNOP_INSN 0x07000000 ++#define R_MASK 0x00100000 ++#define R_ZERO 0x00000000 ++ + /* Check if insn is one of the Load And Reserve instructions used for atomic + sequences. */ + #define IS_LOAD_AND_RESERVE_INSN(insn) ((insn & LOAD_AND_RESERVE_MASK) == LWARX_INSTRUCTION \ +@@ -873,10 +878,38 @@ ppc_displaced_step_copy_insn (struct gdbarch *gdbarch, + enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); + int insn; + +- read_memory (from, buf, len); ++ len = target_read (current_inferior()->top_target(), TARGET_OBJECT_MEMORY, NULL, ++ buf, from, len); ++ if ((ssize_t) len < PPC_INSN_SIZE) ++ memory_error (TARGET_XFER_E_IO, from); + + insn = extract_signed_integer (buf, PPC_INSN_SIZE, byte_order); + ++ /* Check for PNOP and for prefixed instructions with R=0. Those ++ instructions are safe to displace. Prefixed instructions with R=1 ++ will read/write data to/from locations relative to the current PC. ++ We would not be able to fixup after an instruction has written data ++ into a displaced location, so decline to displace those instructions. */ ++ if ((insn & OP_MASK) == 1 << 26) ++ { ++ if (((insn & PNOP_MASK) != PNOP_INSN) ++ && ((insn & R_MASK) != R_ZERO)) ++ { ++ fprintf_unfiltered (gdb_stdlog, ++ "displaced: {ppc} Not displacing prefixed " ++ "instruction %08x at %s", ++ insn, paddress (gdbarch, from)); ++ return NULL; ++ } ++ } ++ else ++ /* Non-prefixed instructions.. */ ++ { ++ /* Set the instruction length to 4 to match the actual instruction ++ length. */ ++ len = 4; ++ } ++ + /* Assume all atomic sequences start with a Load and Reserve instruction. */ + if (IS_LOAD_AND_RESERVE_INSN (insn)) + { +@@ -917,11 +950,17 @@ ppc_displaced_step_fixup (struct gdbarch *gdbarch, + ppc_displaced_step_closure *closure = (ppc_displaced_step_closure *) closure_; + ULONGEST insn = extract_unsigned_integer (closure->buf.data (), + PPC_INSN_SIZE, byte_order); +- ULONGEST opcode = 0; ++ ULONGEST opcode; + /* Offset for non PC-relative instructions. */ +- LONGEST offset = PPC_INSN_SIZE; ++ LONGEST offset; + +- opcode = insn & BRANCH_MASK; ++ opcode = insn & OP_MASK; ++ ++ /* Set offset to 8 if this is an 8-byte (prefixed) instruction. */ ++ if ((opcode) == 1 << 26) ++ offset = 2 * PPC_INSN_SIZE; ++ else ++ offset = PPC_INSN_SIZE; + + if (debug_displaced) + fprintf_unfiltered (gdb_stdlog, +@@ -1058,13 +1097,16 @@ ppc_deal_with_atomic_sequence (struct regcache *regcache) + instructions. */ + for (insn_count = 0; insn_count < atomic_sequence_length; ++insn_count) + { +- loc += PPC_INSN_SIZE; ++ if ((insn & OP_MASK) == 1 << 26) ++ loc += 2 * PPC_INSN_SIZE; ++ else ++ loc += PPC_INSN_SIZE; + insn = read_memory_integer (loc, PPC_INSN_SIZE, byte_order); + + /* Assume that there is at most one conditional branch in the atomic + sequence. If a conditional branch is found, put a breakpoint in + its destination address. */ +- if ((insn & BRANCH_MASK) == BC_INSN) ++ if ((insn & OP_MASK) == BC_INSN) + { + int immediate = ((insn & 0xfffc) ^ 0x8000) - 0x8000; + int absolute = insn & 2; +@@ -7095,7 +7137,7 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) + set_gdbarch_displaced_step_location (gdbarch, + displaced_step_at_entry_point); + +- set_gdbarch_max_insn_length (gdbarch, PPC_INSN_SIZE); ++ set_gdbarch_max_insn_length (gdbarch, 2 * PPC_INSN_SIZE); + + /* Hook in ABI-specific overrides, if they have been registered. */ + info.target_desc = tdesc; +diff --git a/gdb/testsuite/gdb.arch/powerpc-addpcis.exp b/gdb/testsuite/gdb.arch/powerpc-addpcis.exp +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.arch/powerpc-addpcis.exp +@@ -0,0 +1,104 @@ ++# Copyright 2021 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 . ++ ++ ++# Test to confirm that gdb is properly single stepping over the ++# displaced addpcis instruction. ++# The addpcis instruction and its extended mnemonics lnia and subpcis ++# apply an immediate shifted value (X || 0x0000) to the current PC/NIA ++# value, and store that value into the instructions target register. ++# When the instruction is displaced, it needs special handling. ++ ++# lnia Rx == addpcis Rx,0 ++# subcis Rx,value == addpcis Rx,-value ++ ++if { ![istarget powerpc*-*] } { ++ verbose "Skipping powerpc addpcis test." ++ return ++} ++ ++set retval 0 ++ ++standard_testfile .s ++ ++if { [prepare_for_testing "failed to prepare" $testfile "$srcfile" \ ++ {debug quiet}] } { ++ return -1 ++} ++ ++if ![runto_main] then { ++ return ++} ++ ++set check_pc [get_hexadecimal_valueof "\$pc" "default0"] ++set bp1 *$check_pc+4 ++set bp2 *$check_pc+12 ++set bp3 *$check_pc+16 ++gdb_breakpoint $bp1 ++gdb_breakpoint $bp2 ++gdb_breakpoint $bp3 ++ ++gdb_test "stepi" "" "set r3 " ++set check_r3 [get_hexadecimal_valueof "\$r3" "default0"] ++gdb_test "stepi" "" "set r4" ++set check_r4 [get_hexadecimal_valueof "\$r4" "default0"] ++gdb_test "stepi" "" "set r5" ++set check_r5 [get_hexadecimal_valueof "\$r5" "default0"] ++gdb_test "stepi" "" "set r6" ++set check_r6 [get_hexadecimal_valueof "\$r6" "default0"] ++gdb_test "stepi" "" "set r7" ++set check_r7 [get_hexadecimal_valueof "\$r7" "default0"] ++gdb_test "stepi" "" "set r8" ++set check_r8 [get_hexadecimal_valueof "\$r8" "default0"] ++gdb_test "stepi" "" "set r9" ++set check_r9 [get_hexadecimal_valueof "\$r9" "default0"] ++ ++# R6 will contain the reference value. All other ++# instructions in this test will be storing values ++# relative to what is stored in R6. ++ ++# subpcis 3,+0x100 # /* set r3 */ ++# subpcis 4,+0x10 # /* set r4 */ ++# subpcis 5,+0x1 # /* set r5 */ ++# lnia 6 # /* set r6 */ ++# addpcis 7,+0x1 # /* set r7 */ ++# addpcis 8,+0x10 # /* set r8 */ ++# addpcis 9,+0x100 # /* set r9 */ ++ ++if [expr $check_r3 + 0x1000000 != $check_r6 - 0xc ] { ++ fail "unexpected value r3 + 0x1,000,000 != r6 + 0xc ; r3: $check_r3 r6: $check_r6 " ++} ++if [expr $check_r4 + 0x100000 != $check_r6 - 0x8 ] { ++ fail "unexpected value r4 + 0x100,000 != r6 - 0x8 ; r4: $check_r4 r6: $check_r6 " ++} ++if [expr $check_r5 + 0x10000 != $check_r6 - 0x4 ] { ++ fail "unexpected value r5 + 0x10,000 != r6 , r5: $check_r5 r6: $check_r6 " ++} ++if [expr $check_r6 != $check_r6] { ++ fail "unexpected value r6 != r6 , r6: $check_r6 r6: $check_r6 " ++} ++if [expr $check_r7 - 0x10000 != $check_r6 + 0x4] { ++ fail "unexpected value r7 - 0x10,000 != r6 + 0x4 , r7: $check_r7 r7: $check_r6 " ++} ++if [expr $check_r8 - 0x100000 != $check_r6 + 0x8 ] { ++ fail "unexpected value r8 - 0x100,000 != r6 , r8: $check_r8 r8: $check_r6 " ++} ++if [expr $check_r9 - 0x1000000 != $check_r6 + 0xc ] { ++ fail "unexpected value r9 - 0x1,000,000 != r6 + 0xc , r9: $check_r9 r6: $check_r6 " ++} ++ ++gdb_test "info break" ++gdb_test "info register r3 r4 r5 r6 r7 r8 r9" ++gdb_test "disas main" +diff --git a/gdb/testsuite/gdb.arch/powerpc-addpcis.s b/gdb/testsuite/gdb.arch/powerpc-addpcis.s +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.arch/powerpc-addpcis.s +@@ -0,0 +1,33 @@ ++/* This testcase is part of GDB, the GNU debugger. ++ ++ Copyright 2021 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 . */ ++ ++ ++/* Test to confirm that gdb is properly single stepping over the ++ displaced addpcis instruction. */ ++ ++.global main ++.type main,function ++# addpcis: the sum of NIA + ( D || 0x0000) is placed in RT. ++main: ++ subpcis 3,+0x100 # /* set r3 */ ++ subpcis 4,+0x10 # /* set r4 */ ++ subpcis 5,+0x1 # /* set r5 */ ++ lnia 6 # /* set r6 */ ++ addpcis 7,+0x1 # /* set r7 */ ++ addpcis 8,+0x10 # /* set r8 */ ++ addpcis 9,+0x100 # /* set r9 */ ++ blr +diff --git a/gdb/testsuite/gdb.arch/powerpc-lnia.exp b/gdb/testsuite/gdb.arch/powerpc-lnia.exp +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.arch/powerpc-lnia.exp +@@ -0,0 +1,100 @@ ++# Copyright 2021 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 . ++ ++# Test to see if gdb is properly single stepping over the ++# displaced lnia instruction. This test checks that a series ++# of lnia instructions are loading ascending values as expected. ++ ++# lnia is an extended mnemonic for the addpcis instruction, which ++# stores the $NIA plus an immediate value into a register. ++# ++# lnia Rx == addpcis Rx,0 == lnia Rx ++# subcis Rx,value == addpcis Rx,-value ++ ++if { ![istarget powerpc*-*] } { ++ verbose "Skipping powerpc lnia test." ++ return ++} ++ ++set retval 0 ++ ++standard_testfile .s ++ ++if { [prepare_for_testing "failed to prepare" $testfile "$srcfile" \ ++ {debug quiet}] } { ++ return -1 ++} ++ ++if ![runto_main] then { ++ return ++} ++ ++set before_pc 0 ++set check_pc [get_hexadecimal_valueof "\$pc" "default0"] ++ ++# set some breakpoints on the instructions below main(). ++set bp1 *$check_pc+4 ++set bp2 *$check_pc+12 ++set bp3 *$check_pc+16 ++gdb_breakpoint $bp1 ++gdb_breakpoint $bp2 ++gdb_breakpoint $bp3 ++ ++# single-step through the lnia instructions, and retrieve the ++# register values as we proceed. ++gdb_test "stepi" "" "set r3" ++set check_r3 [get_hexadecimal_valueof "\$r3" "default0"] ++gdb_test "stepi" "" "set r4" ++set check_r4 [get_hexadecimal_valueof "\$r4" "default0"] ++gdb_test "stepi" "" "set r5" ++set check_r5 [get_hexadecimal_valueof "\$r5" "default0"] ++gdb_test "stepi" "" "set r6" ++set check_r6 [get_hexadecimal_valueof "\$r6" "default0"] ++gdb_test "stepi" "" "set r7" ++set check_r7 [get_hexadecimal_valueof "\$r7" "default0"] ++gdb_test "stepi" "" "set r8" ++set check_r8 [get_hexadecimal_valueof "\$r8" "default0"] ++gdb_test "stepi" "" "set r9" ++set check_r9 [get_hexadecimal_valueof "\$r9" "default0"] ++ ++# Ensure that our register values are as expected. ++# Specifically that the values loaded by the lnia instruction ++# reflect the value of the PC as if the instruction was ++# not displaced. ++if [expr $check_r3 + 4 != $check_r4] { ++ fail "unexpected value r3+4 != r4 , r3: $check_r3 r4: $check_r4 " ++} ++if [expr $check_r4 + 4 != $check_r5] { ++ fail "unexpected value r4+4 != r5 , r4: $check_r4 r5: $check_r5 " ++} ++if [expr $check_r5 + 4 != $check_r6] { ++ fail "unexpected value r5+4 != r6 , r5: $check_r5 r6: $check_r6 " ++} ++if [expr $check_r6 + 4 != $check_r7] { ++ fail "unexpected value r6+4 != r7 , r6: $check_r6 r7: $check_r7 " ++} ++if [expr $check_r7 + 4 != $check_r8] { ++ fail "unexpected value r7+4 != r8 , r7: $check_r7 r8: $check_r8 " ++} ++if [expr $check_r8 + 4 != $check_r9] { ++ fail "unexpected value r8+4 != r9 , r8: $check_r8 r9: $check_r9 " ++} ++ ++gdb_test "info break" ++gdb_test "info register r3 r4 r5 r6 r7 r8 r9" ++gdb_test "disas main" ++ ++# Let the inferior store all vector registers in a buffer, then dump ++# the buffer and check it. +diff --git a/gdb/testsuite/gdb.arch/powerpc-lnia.s b/gdb/testsuite/gdb.arch/powerpc-lnia.s +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.arch/powerpc-lnia.s +@@ -0,0 +1,32 @@ ++/* This testcase is part of GDB, the GNU debugger. ++ ++ Copyright 2021 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 . */ ++ ++/* Test to confirm that gdb properly handles lnia instructions ++ that load the current PC into a target register when executed ++ from a displaced location. */ ++ ++.global main ++.type main,function ++main: ++ lnia 3 # /* set r3 */ ++ lnia 4 # /* set r4 */ ++ lnia 5 # /* set r5 */ ++ lnia 6 # /* set r6 */ ++ lnia 7 # /* set r7 */ ++ lnia 8 # /* set r8 */ ++ lnia 9 # /* set r9 */ ++ blr +diff --git a/gdb/testsuite/gdb.arch/powerpc-plxv-nonrel.exp b/gdb/testsuite/gdb.arch/powerpc-plxv-nonrel.exp +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.arch/powerpc-plxv-nonrel.exp +@@ -0,0 +1,130 @@ ++# Copyright 2021 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 . ++ ++# Test to see if gdb is properly single stepping over the ++# displaced plxv instruction. ++ ++if { ![istarget powerpc*-*] } { ++ verbose "Skipping powerpc plxv test." ++ return ++} ++ ++set retval 0 ++ ++standard_testfile .s ++ ++if { [prepare_for_testing "failed to prepare" $testfile "$srcfile" \ ++ {debug quiet}] } { ++ return -1 ++} ++ ++gdb_test "set radix 0b10000" ++gdb_test "set debug displaced" ++ ++if ![runto_main] then { ++ return ++} ++ ++gdb_test "set debug displaced on" ++ ++# Proc to extract the uint128 hex value from the output of ++# a print vector statement. ++proc get_vector_hexadecimal_valueof { exp default {test ""} } { ++ set val "0x0000" ++ global gdb_prompt ++ if {$test == ""} { ++ set test "get vector_hexadecimal valueof \"${exp}\"" ++ } ++ gdb_test_multiple "print $${exp}.uint128" $test { ++ -re -wrap "\\$\[0-9\]* = (0x\[0-9a-zA-Z\]+).*" { ++ set val $expect_out(1,string) ++ pass "$test" ++ } ++ -re -wrap ".*Illegal instruction.* $" { ++ fail "Illegal instruction on print." ++ set val 0xffff ++ } ++ } ++ return ${val} ++} ++ ++# Proc to do a single-step, and ensure we gently handle ++# an illegal instruction situation. ++proc stepi_over_instruction { xyz } { ++ global gdb_prompt ++ gdb_test_multiple "stepi" "${xyz} " { ++ -re -wrap ".*Illegal instruction.*" { ++ fail "Illegal instruction on single step." ++ return ++ } ++ -re -wrap ".*" { ++ pass "stepi ${xyz}" ++ } ++ } ++} ++ ++set check_pc [get_hexadecimal_valueof "\$pc" "default0"] ++ ++# set some breakpoints on the instructions below main(). ++gdb_test "disas /r main" ++set bp1 *$check_pc+4 ++set bp2 *$check_pc+0d12 ++set bp3 *$check_pc+0d20 ++set bp4 *$check_pc+0d28 ++gdb_breakpoint $bp1 ++gdb_breakpoint $bp2 ++gdb_breakpoint $bp3 ++gdb_breakpoint $bp4 ++ ++# single-step through the plxv instructions, and retrieve the ++# register values as we proceed. ++ ++stepi_over_instruction "stepi over NOP" ++stepi_over_instruction "stepi over lnia" ++stepi_over_instruction "stepi over addi" ++ ++stepi_over_instruction "stepi over vs4 assignment" ++set check_vs4 [get_vector_hexadecimal_valueof "vs4" "default0"] ++ ++stepi_over_instruction "stepi over vs5 assignment" ++set check_vs5 [get_vector_hexadecimal_valueof "vs5" "default0"] ++ ++stepi_over_instruction "stepi over vs6 assignment" ++set check_vs6 [get_vector_hexadecimal_valueof "vs6" "default0"] ++ ++stepi_over_instruction "stepi over vs7 assignment" ++set check_vs7 [get_vector_hexadecimal_valueof "vs7" "default0"] ++ ++set vs4_expected 0xa5b5c5d5a4b4c4d4a3b3c3d3a2b2c2d2 ++set vs5_expected 0xa7b7c7d7a6b6c6d6a5b5c5d5a4b4c4d4 ++set vs6_expected 0xa9b9c9d9a8b8c8d8a7b7c7d7a6b6c6d6 ++set vs7_expected 0xabbbcbdbaabacadaa9b9c9d9a8b8c8d8 ++ ++if [expr $check_vs4 != $vs4_expected] { ++ fail "unexpected value vs4; actual:$check_vs4 expected:$vs4_expected" ++} ++if [expr $check_vs5 != $vs5_expected ] { ++ fail "unexpected value vs5; actual:$check_vs5 expected:$vs5_expected" ++} ++if [expr $check_vs6 != $vs6_expected ] { ++ fail "unexpected value vs6; actual:$check_vs6 expected:$vs6_expected" ++} ++if [expr $check_vs7 != $vs7_expected ] { ++ fail "unexpected value vs7; actual:$check_vs7 expected:$vs7_expected" ++} ++ ++gdb_test "info break" ++gdb_test "info register vs4 vs5 vs6 vs7 " ++gdb_test "disas main #2" +diff --git a/gdb/testsuite/gdb.arch/powerpc-plxv-nonrel.s b/gdb/testsuite/gdb.arch/powerpc-plxv-nonrel.s +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.arch/powerpc-plxv-nonrel.s +@@ -0,0 +1,44 @@ ++# Copyright 2021 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 . ++ ++ ++# test to verify that the prefixed instructions that ++# load/store non-relative values work OK. ++ ++.global main ++.type main,function ++main: ++ nop ++ lnia 4 ++ addi 4,4,40 ++ plxv 4,4(4),0 ++ plxv 5,12(4),0 ++ plxv 6,20(4),0 ++ plxv 7,28(4),0 ++check_here: ++ blr ++mydata: ++ .long 0xa1b1c1d1 # <<- ++ .long 0xa2b2c2d2 # <<- loaded into vs4 ++ .long 0xa3b3c3d3 # <<- loaded into vs4 ++ .long 0xa4b4c4d4 # <<- loaded into vs4, vs5 ++ .long 0xa5b5c5d5 # <<- loaded into vs4, vs5 ++ .long 0xa6b6c6d6 # <<- loaded into vs5, vs6 ++ .long 0xa7b7c7d7 # <<- loaded into vs5, vs6 ++ .long 0xa8b8c8d8 # <<- loaded into vs6, vs7 ++ .long 0xa9b9c9d9 # <<- loaded into vs6, vs7 ++ .long 0xaabacada # <<- loaded into vs7 ++ .long 0xabbbcbdb # <<- loaded into vs7 ++ .long 0xacbcccdc # <<- diff --git a/SOURCES/gdb-rhbz1870031-p10-prefixed-insn-3of3.patch b/SOURCES/gdb-rhbz1870031-p10-prefixed-insn-3of3.patch new file mode 100644 index 0000000..276cabf --- /dev/null +++ b/SOURCES/gdb-rhbz1870031-p10-prefixed-insn-3of3.patch @@ -0,0 +1,39 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Keith Seitz +Date: Thu, 6 May 2021 15:39:45 -0400 +Subject: gdb-rhbz1870031-p10-prefixed-insn-3of3.patch + +;; Backport "Fix build failure for 32-bit targets with..." +;; (Luis Machado, RHBZ 1870031) + + commit d9d2ef05f11736bf2e889047cc7588d0c0dd907e + Author: Luis Machado + Date: Tue Apr 13 09:19:52 2021 -0300 + + Fix build failure for 32-bit targets with --enable-targets=all + + Replace use of %lx with %s. + + gdb/ChangeLog: + + 2021-04-13 Luis Machado + + * rs6000-tdep.c (ppc_displaced_step_fixup): Use %s to print + hex values. + +diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c +--- a/gdb/rs6000-tdep.c ++++ b/gdb/rs6000-tdep.c +@@ -982,9 +982,9 @@ ppc_displaced_step_fixup (struct gdbarch *gdbarch, + if (debug_displaced) + fprintf_unfiltered (gdb_stdlog, + "displaced: {ppc} addpcis target regnum %d was " +- "0x%lx now 0x%lx", +- regnum, current_val, +- current_val + displaced_offset); ++ "%s now %s", ++ regnum, paddress (gdbarch, current_val), ++ paddress (gdbarch, current_val + displaced_offset)); + regcache_cooked_write_unsigned (regs, regnum, + current_val + displaced_offset); + /* point the PC back at the non-displaced instruction. */ diff --git a/SOURCES/gdb-rhbz1898252-loadable-section-outside-ELF-segments.patch b/SOURCES/gdb-rhbz1898252-loadable-section-outside-ELF-segments.patch new file mode 100644 index 0000000..1419455 --- /dev/null +++ b/SOURCES/gdb-rhbz1898252-loadable-section-outside-ELF-segments.patch @@ -0,0 +1,67 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Keith Seitz +Date: Mon, 16 Nov 2020 12:42:09 -0500 +Subject: gdb-rhbz1898252-loadable-section-outside-ELF-segments.patch + +;; Backport of "Exclude debuginfo files from 'outside of ELF segments' +;; warning" (Keith Seitz) + + Exclude debuginfo files from "outside of ELF segments" warning + + When GDB loads an ELF file, it will warn when a section is not located + in an ELF segment: + + $ ./gdb -q -iex "set build-id-verbose 0" --ex "b systemctl_main" -ex "r" -batch --args systemctl kexec + Breakpoint 1 at 0xc24d: file ../src/systemctl/systemctl.c, line 8752. + warning: Loadable section ".note.gnu.property" outside of ELF segments + in .gnu_debugdata for /lib64/libgcc_s.so.1 + [Thread debugging using libthread_db enabled] + Using host libthread_db library "/lib64/libthread_db.so.1". + warning: Loadable section ".note.gnu.property" outside of ELF segments + in .gnu_debugdata for /lib64/libcap.so.2 + warning: Loadable section ".note.gnu.property" outside of ELF segments + in .gnu_debugdata for /lib64/libacl.so.1 + warning: Loadable section ".note.gnu.property" outside of ELF segments + in .gnu_debugdata for /lib64/libcryptsetup.so.12 + warning: Loadable section ".note.gnu.property" outside of ELF segments + in .gnu_debugdata for /lib64/libgcrypt.so.20 + warning: Loadable section ".note.gnu.property" outside of ELF segments + in .gnu_debugdata for /lib64/libip4tc.so.2 + [snip] + This has feature has also been reported by various users, most notably + the Fedora-EOL'd bug 1553086. + + Mark Wielaard explains the issue quite nicely in + + https://sourceware.org/bugzilla/show_bug.cgi?id=24717#c2 + + The short of it is, the ELF program headers for debuginfo files are + not suited to this particular use case. Consequently, the warning + generated above really is useless and should be ignored. + + This patch follows the same heuristic that BFD itself uses. + + gdb/ChangeLog + 2020-11-13 Keith Seitz + + https://bugzilla.redhat.com/show_bug.cgi?id=1553086 + * elfread.c (elf_symfile_segments): Omit "Loadable section ... + outside of ELF segments" warning for debugin + +diff --git a/gdb/elfread.c b/gdb/elfread.c +--- a/gdb/elfread.c ++++ b/gdb/elfread.c +@@ -147,7 +147,12 @@ elf_symfile_segments (bfd *abfd) + RealView) use SHT_NOBITS for uninitialized data. Since it is + uninitialized, it doesn't need a program header. Such + binaries are not relocatable. */ +- if (bfd_section_size (sect) > 0 && j == num_segments ++ ++ /* Exclude debuginfo files from this warning, too, since those ++ are often not strictly compliant with the standard. See, e.g., ++ ld/24717 for more discussion. */ ++ if (!is_debuginfo_file (abfd) ++ && bfd_section_size (sect) > 0 && j == num_segments + && (bfd_section_flags (sect) & SEC_LOAD) != 0) + warning (_("Loadable section \"%s\" outside of ELF segments"), + bfd_section_name (sect)); diff --git a/SOURCES/gdb-rhbz1903375-s390x-store-on-condition.patch b/SOURCES/gdb-rhbz1903375-s390x-store-on-condition.patch new file mode 100644 index 0000000..242e36f --- /dev/null +++ b/SOURCES/gdb-rhbz1903375-s390x-store-on-condition.patch @@ -0,0 +1,64 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Andreas Arnez +Date: Thu, 19 Nov 2020 19:10:58 +0100 +Subject: gdb-rhbz1903375-s390x-store-on-condition.patch + +;; Backport of "Correct recording of 'store on condition' insns" +;; Andreas Arnaz (RH BZ 1903374) + +gdb/s390: Correct recording of "store on condition" insns + +The "store on condition" instructions STOC, STOCG, and STOCFH are recorded +as if their instruction formats resembled that of STG. This is wrong, +usually resulting in "failed to record execution log" errors when trying +to record code with any of these instructions. + +This patch fixes the recording of these instructions. + +gdb/ChangeLog: + + PR tdep/26916 + * s390-tdep.c (s390_process_record): Fix recording of STOC, STOCG, + and STOCFH. + +diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c +--- a/gdb/s390-tdep.c ++++ b/gdb/s390-tdep.c +@@ -5382,7 +5382,6 @@ s390_process_record (struct gdbarch *gdbarch, struct regcache *regcache, + case 0xe325: /* NTSTG - nontransactional store */ + case 0xe326: /* CVDY - convert to decimal */ + case 0xe32f: /* STRVG - store reversed */ +- case 0xebe3: /* STOCG - store on condition */ + case 0xed67: /* STDY - store */ + oaddr = s390_record_calc_disp (gdbarch, regcache, inib[3], insn[1], ibyte[4]); + if (record_full_arch_list_add_mem (oaddr, 8)) +@@ -5411,8 +5410,6 @@ s390_process_record (struct gdbarch *gdbarch, struct regcache *regcache, + case 0xe33e: /* STRV - store reversed */ + case 0xe350: /* STY - store */ + case 0xe3cb: /* STFH - store high */ +- case 0xebe1: /* STOCFH - store high on condition */ +- case 0xebf3: /* STOC - store on condition */ + case 0xed66: /* STEY - store */ + oaddr = s390_record_calc_disp (gdbarch, regcache, inib[3], insn[1], ibyte[4]); + if (record_full_arch_list_add_mem (oaddr, 4)) +@@ -6125,6 +6122,20 @@ s390_process_record (struct gdbarch *gdbarch, struct regcache *regcache, + + /* 0xeb9c-0xebbf undefined */ + /* 0xebc1-0xebdb undefined */ ++ ++ case 0xebe1: /* STOCFH - store high on condition */ ++ case 0xebf3: /* STOC - store on condition */ ++ oaddr = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], ibyte[4]); ++ if (record_full_arch_list_add_mem (oaddr, 4)) ++ return -1; ++ break; ++ ++ case 0xebe3: /* STOCG - store on condition */ ++ oaddr = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], ibyte[4]); ++ if (record_full_arch_list_add_mem (oaddr, 8)) ++ return -1; ++ break; ++ + /* 0xebe5 undefined */ + /* 0xebe9 undefined */ + /* 0xebeb-0xebf1 undefined */ diff --git a/SOURCES/gdb-rhbz1905996-fix-off-by-one-error-in-ada_fold_name.patch b/SOURCES/gdb-rhbz1905996-fix-off-by-one-error-in-ada_fold_name.patch new file mode 100644 index 0000000..5e1bc57 --- /dev/null +++ b/SOURCES/gdb-rhbz1905996-fix-off-by-one-error-in-ada_fold_name.patch @@ -0,0 +1,82 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Kevin Buettner +Date: Tue, 8 Dec 2020 14:07:45 -0700 +Subject: gdb-rhbz1905996-fix-off-by-one-error-in-ada_fold_name.patch + +;; Fix off-by-one error in ada_fold_name.patch (RH BZ 1905996) +;; Upstream patch proposal: https://sourceware.org/pipermail/gdb-patches/2020-December/173935.html +;; =fedoratest + +Fix off-by-one error in ada_fold_name + +I'm seeing a libstdc++ assertion failure when running GDB's "maint selftest" +command when GDB is configured with the following CFLAGS and CXXFLAGS as +part of the configure line: + + CFLAGS='-D_GLIBCXX_DEBUG -g3 -O0' CXXFLAGS='-D_GLIBCXX_DEBUG -g3 -O0' + +This is what I see when running the self tests: + +(gdb) maint selftest +Running selftest aarch64-analyze-prologue. +Running selftest aarch64-process-record. +Running selftest arm-record. +Running selftest arm_analyze_prologue. +Running selftest array_view. +Running selftest child_path. +Running selftest cli_utils. +Running selftest command_structure_invariants. +Running selftest copy_bitwise. +Running selftest copy_integer_to_size. +Running selftest cp_remove_params. +Running selftest cp_symbol_name_matches. +Running selftest dw2_expand_symtabs_matching. +/usr/include/c++/11/string_view:211: constexpr const value_type& std::basic_string_view<_CharT, _Traits>::operator[](std::basic_string_view<_CharT, _Traits>::size_type) const [with _CharT = char; _Traits = std::char_traits; std::basic_string_view<_CharT, _Traits>::const_reference = const char&; std::basic_string_view<_CharT, _Traits>::size_type = long unsigned int]: Assertion '__pos < this->_M_len' failed. +Aborted (core dumped) + +Here's a partial stack trace: + + #0 0x00007ffff6ef6262 in raise () from /lib64/libc.so.6 + #1 0x00007ffff6edf8a4 in abort () from /lib64/libc.so.6 + #2 0x00000000004249bf in std::__replacement_assert ( + __file=0xef7480 "/usr/include/c++/11/string_view", __line=211, + __function=0xef7328 "constexpr const value_type& std::basic_string_view<_CharT, _Traits>::operator[](std::basic_string_view<_CharT, _Traits>::size_type) const [with _CharT = char; _Traits = std::char_traits; std::ba"..., + __condition=0xef7311 "__pos < this->_M_len") + at /usr/include/c++/11/x86_64-redhat-linux/bits/c++config.h:2624 + #3 0x0000000000451737 in std::basic_string_view >::operator[] (this=0x7fffffffc200, __pos=8) + at /usr/include/c++/11/string_view:211 + #4 0x00000000004329f5 in ada_fold_name (name="function") + at /ironwood1/sourceware-git/rawhide-master/bld/../../worktree-master/gdb/ada-lang.c:988 + +And, looking at frame #4... + +(top-gdb) up 4 + at /ironwood1/sourceware-git/rawhide-master/bld/../../worktree-master/gdb/ada-lang.c:988 +988 fold_buffer[i] = tolower (name[i]); +(top-gdb) p i +$1 = 8 +(top-gdb) p name.size() +$2 = 8 + +My patch adjusts the comparison to only copy name.size() characters +from the string. I've added a separate statement for NUL character +termination of fold_buffer[]. + +gdb/ChangeLog: + + * ada-lang.c (ada_fold_name): Fix off-by-one error. + +diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c +--- a/gdb/ada-lang.c ++++ b/gdb/ada-lang.c +@@ -1006,8 +1006,9 @@ ada_fold_name (gdb::string_view name) + { + int i; + +- for (i = 0; i <= len; i += 1) ++ for (i = 0; i < len; i += 1) + fold_buffer[i] = tolower (name[i]); ++ fold_buffer[i] = '\0'; + } + + return fold_buffer; diff --git a/SOURCES/gdb-rhbz1909902-frame_id_p-assert-1.patch b/SOURCES/gdb-rhbz1909902-frame_id_p-assert-1.patch new file mode 100644 index 0000000..8dd99a5 --- /dev/null +++ b/SOURCES/gdb-rhbz1909902-frame_id_p-assert-1.patch @@ -0,0 +1,593 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Pedro Alves +Date: Fri, 30 Oct 2020 18:26:15 +0100 +Subject: gdb-rhbz1909902-frame_id_p-assert-1.patch + +;; Backport fix for frame_id_p assertion failure (RH BZ 1909902). + +Make scoped_restore_current_thread's cdtors exception free (RFC) + +If the remote target closes while we're reading registers/memory for +restoring the selected frame in scoped_restore_current_thread's dtor, +the corresponding TARGET_CLOSE_ERROR error is swallowed by the +scoped_restore_current_thread's dtor, because letting exceptions +escape from a dtor is bad. It isn't great to lose that errors like +that, though. I've been thinking about how to avoid it, and I came up +with this patch. + +The idea here is to make scoped_restore_current_thread's dtor do as +little as possible, to avoid any work that might throw in the first +place. And to do that, instead of having the dtor call +restore_selected_frame, which re-finds the previously selected frame, +just record the frame_id/level of the desired selected frame, and have +get_selected_frame find the frame the next time it is called. In +effect, this implements most of Cagney's suggestion, here: + + /* On demand, create the selected frame and then return it. If the + selected frame can not be created, this function prints then throws + an error. When MESSAGE is non-NULL, use it for the error message, + otherwize use a generic error message. */ + /* FIXME: cagney/2002-11-28: At present, when there is no selected + frame, this function always returns the current (inner most) frame. + It should instead, when a thread has previously had its frame + selected (but not resumed) and the frame cache invalidated, find + and then return that thread's previously selected frame. */ + extern struct frame_info *get_selected_frame (const char *message); + +The only thing missing to fully implement that would be to make +reinit_frame_cache just clear selected_frame instead of calling +select_frame(NULL), and the call select_frame(NULL) explicitly in the +places where we really wanted reinit_frame_cache to go back to the +current frame too. That can done separately, though, I'm not +proposing to do that in this patch. + +Note that this patch renames restore_selected_frame to +lookup_selected_frame, and adds a new restore_selected_frame function +that doesn't throw, to be paired with the also-new save_selected_frame +function. + +There's a restore_selected_frame function in infrun.c that I think can +be replaced by the new one in frame.c. + +Also done in this patch is make the get_selected_frame's parameter be +optional, so that we don't have to pass down nullptr explicitly all +over the place. + +lookup_selected_frame should really move from thread.c to frame.c, but +I didn't do that here, just to avoid churn in the patch while it +collects comments. I did make it extern and declared it in frame.h +already, preparing for the move. I will do the move as a follow up +patch if people agree with this approach. + +Incidentally, this patch alone would fix the crashes fixed by the +previous patches in the series, because with this, +scoped_restore_current_thread's constructor doesn't throw either. + +gdb/ChangeLog: + + * blockframe.c (block_innermost_frame): Use get_selected_frame. + * frame.c + (scoped_restore_selected_frame::scoped_restore_selected_frame): + Use save_selected_frame. Save language as well. + (scoped_restore_selected_frame::~scoped_restore_selected_frame): + Use restore_selected_frame, and restore language as well. + (selected_frame_id, selected_frame_level): New. + (selected_frame): Update comments. + (save_selected_frame, restore_selected_frame): New. + (get_selected_frame): Use lookup_selected_frame. + (get_selected_frame_if_set): Delete. + (select_frame): Record selected_frame_level and selected_frame_id. + * frame.h (scoped_restore_selected_frame) : New + fields. + (get_selected_frame): Make 'message' parameter optional. + (get_selected_frame_if_set): Delete declaration. + (select_frame): Update comments. + (save_selected_frame, restore_selected_frame) + (lookup_selected_frame): Declare. + * gdbthread.h (scoped_restore_current_thread) : New field. + * infrun.c (struct infcall_control_state) : + New field. + (save_infcall_control_state): Use save_selected_frame. + (restore_selected_frame): Delete. + (restore_infcall_control_state): Use restore_selected_frame. + * stack.c (select_frame_command_core, frame_command_core): Use + get_selected_frame. + * thread.c (restore_selected_frame): Rename to ... + (lookup_selected_frame): ... this and make extern. Select the + current frame if the frame level is -1. + (scoped_restore_current_thread::restore): Also restore the + language. + (scoped_restore_current_thread::~scoped_restore_current_thread): + Don't try/catch. + (scoped_restore_current_thread::scoped_restore_current_thread): + Save the language as well. Use save_selected_frame. + +Change-Id: I73fd1cfc40d8513c28e5596383b7ecd8bcfe700f + +diff --git a/gdb/blockframe.c b/gdb/blockframe.c +--- a/gdb/blockframe.c ++++ b/gdb/blockframe.c +@@ -464,14 +464,10 @@ find_gnu_ifunc_target_type (CORE_ADDR resolver_funaddr) + struct frame_info * + block_innermost_frame (const struct block *block) + { +- struct frame_info *frame; +- + if (block == NULL) + return NULL; + +- frame = get_selected_frame_if_set (); +- if (frame == NULL) +- frame = get_current_frame (); ++ frame_info *frame = get_selected_frame (); + while (frame != NULL) + { + const struct block *frame_block = get_frame_block (frame, NULL); +diff --git a/gdb/frame.c b/gdb/frame.c +--- a/gdb/frame.c ++++ b/gdb/frame.c +@@ -317,17 +317,15 @@ frame_stash_invalidate (void) + /* See frame.h */ + scoped_restore_selected_frame::scoped_restore_selected_frame () + { +- m_fid = get_frame_id (get_selected_frame (NULL)); ++ m_lang = current_language->la_language; ++ save_selected_frame (&m_fid, &m_level); + } + + /* See frame.h */ + scoped_restore_selected_frame::~scoped_restore_selected_frame () + { +- frame_info *frame = frame_find_by_id (m_fid); +- if (frame == NULL) +- warning (_("Unable to restore previously selected frame.")); +- else +- select_frame (frame); ++ restore_selected_frame (m_fid, m_level); ++ set_language (m_lang); + } + + /* Flag to control debugging. */ +@@ -1685,10 +1683,63 @@ get_current_frame (void) + } + + /* The "selected" stack frame is used by default for local and arg +- access. May be zero, for no selected frame. */ +- ++ access. ++ ++ The "single source of truth" for the selected frame is the ++ SELECTED_FRAME_ID / SELECTED_FRAME_LEVEL pair. ++ ++ Frame IDs can be saved/restored across reinitializing the frame ++ cache, while frame_info pointers can't (frame_info objects are ++ invalidated). If we know the corresponding frame_info object, it ++ is cached in SELECTED_FRAME. ++ ++ If SELECTED_FRAME_ID / SELECTED_FRAME_LEVEL are null_frame_id / -1, ++ and the target has stack and is stopped, the selected frame is the ++ current (innermost) frame. This means that SELECTED_FRAME_LEVEL is ++ never 0 and SELECTED_FRAME_ID is never the ID of the innermost ++ frame. ++ ++ If SELECTED_FRAME_ID / SELECTED_FRAME_LEVEL are null_frame_id / -1, ++ and the target has no stack or is executing, then there's no ++ selected frame. */ ++static frame_id selected_frame_id = null_frame_id; ++static int selected_frame_level = -1; ++ ++/* The cached frame_info object pointing to the selected frame. ++ Looked up on demand by get_selected_frame. */ + static struct frame_info *selected_frame; + ++/* See frame.h. */ ++ ++void ++save_selected_frame (frame_id *frame_id, int *frame_level) ++ noexcept ++{ ++ *frame_id = selected_frame_id; ++ *frame_level = selected_frame_level; ++} ++ ++/* See frame.h. */ ++ ++void ++restore_selected_frame (frame_id frame_id, int frame_level) ++ noexcept ++{ ++ /* save_selected_frame never returns level == 0, so we shouldn't see ++ it here either. */ ++ gdb_assert (frame_level != 0); ++ ++ /* FRAME_ID can be null_frame_id only IFF frame_level is -1. */ ++ gdb_assert ((frame_level == -1 && !frame_id_p (frame_id)) ++ || (frame_level != -1 && frame_id_p (frame_id))); ++ ++ selected_frame_id = frame_id; ++ selected_frame_level = frame_level; ++ ++ /* Will be looked up later by get_selected_frame. */ ++ selected_frame = nullptr; ++} ++ + bool + has_stack_frames () + { +@@ -1715,9 +1766,7 @@ has_stack_frames () + return true; + } + +-/* Return the selected frame. Always non-NULL (unless there isn't an +- inferior sufficient for creating a frame) in which case an error is +- thrown. */ ++/* See frame.h. */ + + struct frame_info * + get_selected_frame (const char *message) +@@ -1726,24 +1775,14 @@ get_selected_frame (const char *message) + { + if (message != NULL && !has_stack_frames ()) + error (("%s"), message); +- /* Hey! Don't trust this. It should really be re-finding the +- last selected frame of the currently selected thread. This, +- though, is better than nothing. */ +- select_frame (get_current_frame ()); ++ ++ lookup_selected_frame (selected_frame_id, selected_frame_level); + } + /* There is always a frame. */ + gdb_assert (selected_frame != NULL); + return selected_frame; + } + +-/* If there is a selected frame, return it. Otherwise, return NULL. */ +- +-struct frame_info * +-get_selected_frame_if_set (void) +-{ +- return selected_frame; +-} +- + /* This is a variant of get_selected_frame() which can be called when + the inferior does not have a frame; in that case it will return + NULL instead of calling error(). */ +@@ -1756,12 +1795,42 @@ deprecated_safe_get_selected_frame (void) + return get_selected_frame (NULL); + } + +-/* Select frame FI (or NULL - to invalidate the current frame). */ ++/* Select frame FI (or NULL - to invalidate the selected frame). */ + + void + select_frame (struct frame_info *fi) + { + selected_frame = fi; ++ selected_frame_level = frame_relative_level (fi); ++ if (selected_frame_level == 0) ++ { ++ /* Treat the current frame especially -- we want to always ++ save/restore it without warning, even if the frame ID changes ++ (see lookup_selected_frame). E.g.: ++ ++ // The current frame is selected, the target had just stopped. ++ { ++ scoped_restore_selected_frame restore_frame; ++ some_operation_that_changes_the_stack (); ++ } ++ // scoped_restore_selected_frame's dtor runs, but the ++ // original frame_id can't be found. No matter whether it ++ // is found or not, we still end up with the now-current ++ // frame selected. Warning in lookup_selected_frame in this ++ // case seems pointless. ++ ++ Also get_frame_id may access the target's registers/memory, ++ and thus skipping get_frame_id optimizes the common case. ++ ++ Saving the selected frame this way makes get_selected_frame ++ and restore_current_frame return/re-select whatever frame is ++ the innermost (current) then. */ ++ selected_frame_level = -1; ++ selected_frame_id = null_frame_id; ++ } ++ else ++ selected_frame_id = get_frame_id (fi); ++ + /* NOTE: cagney/2002-05-04: FI can be NULL. This occurs when the + frame is being invalidated. */ + +diff --git a/gdb/frame.h b/gdb/frame.h +--- a/gdb/frame.h ++++ b/gdb/frame.h +@@ -186,8 +186,14 @@ class scoped_restore_selected_frame + + private: + +- /* The ID of the previously selected frame. */ ++ /* The ID and level of the previously selected frame. */ + struct frame_id m_fid; ++ int m_level; ++ ++ /* Save/restore the language as well, because selecting a frame ++ changes the current language to the frame's language if "set ++ language auto". */ ++ enum language m_lang; + }; + + /* Methods for constructing and comparing Frame IDs. */ +@@ -316,24 +322,49 @@ extern bool has_stack_frames (); + modifies the target invalidating the frame cache). */ + extern void reinit_frame_cache (void); + +-/* On demand, create the selected frame and then return it. If the +- selected frame can not be created, this function prints then throws +- an error. When MESSAGE is non-NULL, use it for the error message, ++/* Return the selected frame. Always returns non-NULL. If there ++ isn't an inferior sufficient for creating a frame, an error is ++ thrown. When MESSAGE is non-NULL, use it for the error message, + otherwise use a generic error message. */ + /* FIXME: cagney/2002-11-28: At present, when there is no selected + frame, this function always returns the current (inner most) frame. + It should instead, when a thread has previously had its frame + selected (but not resumed) and the frame cache invalidated, find + and then return that thread's previously selected frame. */ +-extern struct frame_info *get_selected_frame (const char *message); +- +-/* If there is a selected frame, return it. Otherwise, return NULL. */ +-extern struct frame_info *get_selected_frame_if_set (void); ++extern struct frame_info *get_selected_frame (const char *message = nullptr); + +-/* Select a specific frame. NULL, apparently implies re-select the +- inner most frame. */ ++/* Select a specific frame. NULL implies re-select the inner most ++ frame. */ + extern void select_frame (struct frame_info *); + ++/* Save the frame ID and frame level of the selected frame in FRAME_ID ++ and FRAME_LEVEL, to be restored later with restore_selected_frame. ++ ++ This is preferred over getting the same info out of ++ get_selected_frame directly because this function does not create ++ the selected-frame's frame_info object if it hasn't been created ++ yet, and thus is more efficient and doesn't throw. */ ++extern void save_selected_frame (frame_id *frame_id, int *frame_level) ++ noexcept; ++ ++/* Restore selected frame as saved with save_selected_frame. ++ ++ Does not try to find the corresponding frame_info object. Instead ++ the next call to get_selected_frame will look it up and cache the ++ result. ++ ++ This function does not throw. It is designed to be safe to called ++ from the destructors of RAII types. */ ++extern void restore_selected_frame (frame_id frame_id, int frame_level) ++ noexcept; ++ ++/* Lookup the frame_info object for the selected frame FRAME_ID / ++ FRAME_LEVEL and cache the result. ++ ++ If FRAME_LEVEL > 0 and the originally selected frame isn't found, ++ warn and select the innermost (current) frame. */ ++extern void lookup_selected_frame (frame_id frame_id, int frame_level); ++ + /* Given a FRAME, return the next (more inner, younger) or previous + (more outer, older) frame. */ + extern struct frame_info *get_prev_frame (struct frame_info *); +diff --git a/gdb/gdbthread.h b/gdb/gdbthread.h +--- a/gdb/gdbthread.h ++++ b/gdb/gdbthread.h +@@ -673,6 +673,10 @@ class scoped_restore_current_thread + frame_id m_selected_frame_id; + int m_selected_frame_level; + bool m_was_stopped; ++ /* Save/restore the language as well, because selecting a frame ++ changes the current language to the frame's language if "set ++ language auto". */ ++ enum language m_lang; + }; + + /* Returns a pointer into the thread_info corresponding to +diff --git a/gdb/infrun.c b/gdb/infrun.c +--- a/gdb/infrun.c ++++ b/gdb/infrun.c +@@ -9006,8 +9006,10 @@ struct infcall_control_state + enum stop_stack_kind stop_stack_dummy = STOP_NONE; + int stopped_by_random_signal = 0; + +- /* ID if the selected frame when the inferior function call was made. */ ++ /* ID and level of the selected frame when the inferior function ++ call was made. */ + struct frame_id selected_frame_id {}; ++ int selected_frame_level = -1; + }; + + /* Save all of the information associated with the inferior<==>gdb +@@ -9036,27 +9038,12 @@ save_infcall_control_state () + inf_status->stop_stack_dummy = stop_stack_dummy; + inf_status->stopped_by_random_signal = stopped_by_random_signal; + +- inf_status->selected_frame_id = get_frame_id (get_selected_frame (NULL)); ++ save_selected_frame (&inf_status->selected_frame_id, ++ &inf_status->selected_frame_level); + + return inf_status; + } + +-static void +-restore_selected_frame (const frame_id &fid) +-{ +- frame_info *frame = frame_find_by_id (fid); +- +- /* If inf_status->selected_frame_id is NULL, there was no previously +- selected frame. */ +- if (frame == NULL) +- { +- warning (_("Unable to restore previously selected frame.")); +- return; +- } +- +- select_frame (frame); +-} +- + /* Restore inferior session state to INF_STATUS. */ + + void +@@ -9084,21 +9071,8 @@ restore_infcall_control_state (struct infcall_control_state *inf_status) + + if (target_has_stack) + { +- /* The point of the try/catch is that if the stack is clobbered, +- walking the stack might encounter a garbage pointer and +- error() trying to dereference it. */ +- try +- { +- restore_selected_frame (inf_status->selected_frame_id); +- } +- catch (const gdb_exception_error &ex) +- { +- exception_fprintf (gdb_stderr, ex, +- "Unable to restore previously selected frame:\n"); +- /* Error in restoring the selected frame. Select the +- innermost frame. */ +- select_frame (get_current_frame ()); +- } ++ restore_selected_frame (inf_status->selected_frame_id, ++ inf_status->selected_frame_level); + } + + delete inf_status; +diff --git a/gdb/stack.c b/gdb/stack.c +--- a/gdb/stack.c ++++ b/gdb/stack.c +@@ -1842,9 +1842,9 @@ trailing_outermost_frame (int count) + static void + select_frame_command_core (struct frame_info *fi, bool ignored) + { +- struct frame_info *prev_frame = get_selected_frame_if_set (); ++ frame_info *prev_frame = get_selected_frame (); + select_frame (fi); +- if (get_selected_frame_if_set () != prev_frame) ++ if (get_selected_frame () != prev_frame) + gdb::observers::user_selected_context_changed.notify (USER_SELECTED_FRAME); + } + +@@ -1863,10 +1863,9 @@ select_frame_for_mi (struct frame_info *fi) + static void + frame_command_core (struct frame_info *fi, bool ignored) + { +- struct frame_info *prev_frame = get_selected_frame_if_set (); +- ++ frame_info *prev_frame = get_selected_frame (); + select_frame (fi); +- if (get_selected_frame_if_set () != prev_frame) ++ if (get_selected_frame () != prev_frame) + gdb::observers::user_selected_context_changed.notify (USER_SELECTED_FRAME); + else + print_selected_thread_frame (current_uiout, USER_SELECTED_FRAME); +diff --git a/gdb/thread.c b/gdb/thread.c +--- a/gdb/thread.c ++++ b/gdb/thread.c +@@ -1325,20 +1325,26 @@ switch_to_thread (process_stratum_target *proc_target, ptid_t ptid) + switch_to_thread (thr); + } + +-static void +-restore_selected_frame (struct frame_id a_frame_id, int frame_level) ++/* See frame.h. */ ++ ++void ++lookup_selected_frame (struct frame_id a_frame_id, int frame_level) + { + struct frame_info *frame = NULL; + int count; + +- /* This means there was no selected frame. */ ++ /* This either means there was no selected frame, or the selected ++ frame was the current frame. In either case, select the current ++ frame. */ + if (frame_level == -1) + { +- select_frame (NULL); ++ select_frame (get_current_frame ()); + return; + } + +- gdb_assert (frame_level >= 0); ++ /* select_frame never saves 0 in SELECTED_FRAME_LEVEL, so we ++ shouldn't see it here. */ ++ gdb_assert (frame_level > 0); + + /* Restore by level first, check if the frame id is the same as + expected. If that fails, try restoring by frame id. If that +@@ -1409,64 +1415,28 @@ scoped_restore_current_thread::restore () + && target_has_stack + && target_has_memory) + restore_selected_frame (m_selected_frame_id, m_selected_frame_level); ++ ++ set_language (m_lang); + } + + scoped_restore_current_thread::~scoped_restore_current_thread () + { + if (!m_dont_restore) +- { +- try +- { +- restore (); +- } +- catch (const gdb_exception &ex) +- { +- /* We're in a dtor, there's really nothing else we can do +- but swallow the exception. */ +- } +- } ++ restore (); + } + + scoped_restore_current_thread::scoped_restore_current_thread () + { + m_inf = inferior_ref::new_reference (current_inferior ()); + ++ m_lang = current_language->la_language; ++ + if (inferior_ptid != null_ptid) + { + m_thread = thread_info_ref::new_reference (inferior_thread ()); + +- struct frame_info *frame; +- + m_was_stopped = m_thread->state == THREAD_STOPPED; +- if (m_was_stopped +- && target_has_registers +- && target_has_stack +- && target_has_memory) +- { +- /* When processing internal events, there might not be a +- selected frame. If we naively call get_selected_frame +- here, then we can end up reading debuginfo for the +- current frame, but we don't generally need the debuginfo +- at this point. */ +- frame = get_selected_frame_if_set (); +- } +- else +- frame = NULL; +- +- try +- { +- m_selected_frame_id = get_frame_id (frame); +- m_selected_frame_level = frame_relative_level (frame); +- } +- catch (const gdb_exception_error &ex) +- { +- m_selected_frame_id = null_frame_id; +- m_selected_frame_level = -1; +- +- /* Better let this propagate. */ +- if (ex.error == TARGET_CLOSE_ERROR) +- throw; +- } ++ save_selected_frame (&m_selected_frame_id, &m_selected_frame_level); + } + } + diff --git a/SOURCES/gdb-rhbz1909902-frame_id_p-assert-2.patch b/SOURCES/gdb-rhbz1909902-frame_id_p-assert-2.patch new file mode 100644 index 0000000..d804bbe --- /dev/null +++ b/SOURCES/gdb-rhbz1909902-frame_id_p-assert-2.patch @@ -0,0 +1,169 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Pedro Alves +Date: Sat, 31 Oct 2020 00:27:18 +0000 +Subject: gdb-rhbz1909902-frame_id_p-assert-2.patch + +;; Backport patch #2 which fixes a frame_id_p assertion failure (RH BZ 1909902). + +Fix frame cycle detection + +The recent commit to make scoped_restore_current_thread's cdtors +exception free regressed gdb.base/eh_return.exp: + + Breakpoint 1, 0x00000000004012bb in eh2 (gdb/frame.c:641: internal-error: frame_id get_frame_id(frame_info*): Assertion `stashed' failed. + A problem internal to GDB has been detected, + further debugging may prove unreliable. + Quit this debugging session? (y or n) FAIL: gdb.base/eh_return.exp: hit breakpoint (GDB internal error) + +That testcase uses __builtin_eh_return and, before the regression, the +backtrace at eh2 looked like this: + + (gdb) bt + #0 0x00000000004006eb in eh2 (p=0x4006ec ) at src/gdb/testsuite/gdb.base/eh_return.c:54 + Backtrace stopped: previous frame identical to this frame (corrupt stack?) + +That "previous frame identical to this frame" is caught by the cycle +detection based on frame id. + +The assertion failing is this one: + + 638 /* Since this is the first frame in the chain, this should + 639 always succeed. */ + 640 bool stashed = frame_stash_add (fi); + 641 gdb_assert (stashed); + +originally added by + + commit f245535cf583ae4ca13b10d47b3c7d3334593ece + Author: Pedro Alves + AuthorDate: Mon Sep 5 18:41:38 2016 +0100 + + Fix PR19927: Avoid unwinder recursion if sniffer uses calls parse_and_eval + +The assertion is failing because frame #1's frame id was stashed +before the id of frame #0 is stashed. The frame id of frame #1 was +stashed here: + + (top-gdb) bt + #0 frame_stash_add (frame=0x1e24c90) at src/gdb/frame.c:276 + #1 0x0000000000669c1b in get_prev_frame_if_no_cycle (this_frame=0x19f8370) at src/gdb/frame.c:2120 + #2 0x000000000066a339 in get_prev_frame_always_1 (this_frame=0x19f8370) at src/gdb/frame.c:2303 + #3 0x000000000066a360 in get_prev_frame_always (this_frame=0x19f8370) at src/gdb/frame.c:2319 + #4 0x000000000066b56c in get_frame_unwind_stop_reason (frame=0x19f8370) at src/gdb/frame.c:3028 + #5 0x000000000059f929 in dwarf2_frame_cfa (this_frame=0x19f8370) at src/gdb/dwarf2/frame.c:1462 + #6 0x00000000005ce434 in dwarf_evaluate_loc_desc::get_frame_cfa (this=0x7fffffffc070) at src/gdb/dwarf2/loc.c:666 + #7 0x00000000005989a9 in dwarf_expr_context::execute_stack_op (this=0x7fffffffc070, op_ptr=0x1b2a053 "\364\003", op_end=0x1b2a053 "\364\003") at src/gdb/dwarf2/expr.c:1161 + #8 0x0000000000596af6 in dwarf_expr_context::eval (this=0x7fffffffc070, addr=0x1b2a052 "\234\364\003", len=1) at src/gdb/dwarf2/expr.c:303 + #9 0x0000000000597b4e in dwarf_expr_context::execute_stack_op (this=0x7fffffffc070, op_ptr=0x1b2a063 "", op_end=0x1b2a063 "") at src/gdb/dwarf2/expr.c:865 + #10 0x0000000000596af6 in dwarf_expr_context::eval (this=0x7fffffffc070, addr=0x1b2a061 "\221X", len=2) at src/gdb/dwarf2/expr.c:303 + #11 0x00000000005c8b5a in dwarf2_evaluate_loc_desc_full (type=0x1b564d0, frame=0x19f8370, data=0x1b2a061 "\221X", size=2, per_cu=0x1b28760, per_objfile=0x1a84930, subobj_type=0x1b564d0, subobj_byte_offset=0) at src/gdb/dwarf2/loc.c:2260 + #12 0x00000000005c9243 in dwarf2_evaluate_loc_desc (type=0x1b564d0, frame=0x19f8370, data=0x1b2a061 "\221X", size=2, per_cu=0x1b28760, per_objfile=0x1a84930) at src/gdb/dwarf2/loc.c:2444 + #13 0x00000000005cb769 in locexpr_read_variable (symbol=0x1b59840, frame=0x19f8370) at src/gdb/dwarf2/loc.c:3687 + #14 0x0000000000663137 in language_defn::read_var_value (this=0x122ea60 , var=0x1b59840, var_block=0x0, frame=0x19f8370) at src/gdb/findvar.c:618 + #15 0x0000000000663c3b in read_var_value (var=0x1b59840, var_block=0x0, frame=0x19f8370) at src/gdb/findvar.c:822 + #16 0x00000000008c7d9f in read_frame_arg (fp_opts=..., sym=0x1b59840, frame=0x19f8370, argp=0x7fffffffc470, entryargp=0x7fffffffc490) at src/gdb/stack.c:542 + #17 0x00000000008c89cd in print_frame_args (fp_opts=..., func=0x1b597c0, frame=0x19f8370, num=-1, stream=0x1aba860) at src/gdb/stack.c:890 + #18 0x00000000008c9bf8 in print_frame (fp_opts=..., frame=0x19f8370, print_level=0, print_what=SRC_AND_LOC, print_args=1, sal=...) at src/gdb/stack.c:1394 + #19 0x00000000008c92b9 in print_frame_info (fp_opts=..., frame=0x19f8370, print_level=0, print_what=SRC_AND_LOC, print_args=1, set_current_sal=1) at src/gdb/stack.c:1119 + #20 0x00000000008c75f0 in print_stack_frame (frame=0x19f8370, print_level=0, print_what=SRC_AND_LOC, set_current_sal=1) at src/gdb/stack.c:366 + #21 0x000000000070250b in print_stop_location (ws=0x7fffffffc9e0) at src/gdb/infrun.c:8110 + #22 0x0000000000702569 in print_stop_event (uiout=0x1a8b9e0, displays=true) at src/gdb/infrun.c:8126 + #23 0x000000000096d04b in tui_on_normal_stop (bs=0x1bcd1c0, print_frame=1) at src/gdb/tui/tui-interp.c:98 + ... + +Before the commit to make scoped_restore_current_thread's cdtors +exception free, scoped_restore_current_thread's dtor would call +get_frame_id on the selected frame, and we use +scoped_restore_current_thread pervasively. That had the side effect +of stashing the frame id of frame #0 before reaching the path shown in +the backtrace. I.e., the frame id of frame #0 happened to be stashed +before the frame id of frame #1. But that was by chance, not by +design. + +This commit: + + commit 256ae5dbc73d1348850f86ee77a0dc3b04bc7cc0 + Author: Kevin Buettner + AuthorDate: Mon Oct 31 12:47:42 2016 -0700 + + Stash frame id of current frame before stashing frame id for previous frame + +Fixed a similar problem, by making sure get_prev_frame computes the +frame id of the current frame before unwinding the previous frame, so +that the cycle detection works properly. That fix misses the scenario +we're now running against, because if you notice, the backtrace above +shows that frame #4 calls get_prev_frame_always, not get_prev_frame. +I.e., nothing is calling get_frame_id on the current frame. + +The fix here is to move Kevin's fix down from get_prev_frame to +get_prev_frame_always. Or actually, a bit further down to +get_prev_frame_always_1 -- note that inline_frame_this_id calls +get_prev_frame_always, so we need to be careful to avoid recursion in +that scenario. + +gdb/ChangeLog: + + * frame.c (get_prev_frame): Move get_frame_id call from here ... + (get_prev_frame_always_1): ... to here. + * inline-frame.c (inline_frame_this_id): Mention + get_prev_frame_always_1 in comment. + +Change-Id: Id960c98ab2d072c48a436c3eb160cc4b2a5cfd1d + +diff --git a/gdb/frame.c b/gdb/frame.c +--- a/gdb/frame.c ++++ b/gdb/frame.c +@@ -2133,6 +2133,23 @@ get_prev_frame_always_1 (struct frame_info *this_frame) + if (get_frame_type (this_frame) == INLINE_FRAME) + return get_prev_frame_if_no_cycle (this_frame); + ++ /* If this_frame is the current frame, then compute and stash its ++ frame id prior to fetching and computing the frame id of the ++ previous frame. Otherwise, the cycle detection code in ++ get_prev_frame_if_no_cycle() will not work correctly. When ++ get_frame_id() is called later on, an assertion error will be ++ triggered in the event of a cycle between the current frame and ++ its previous frame. ++ ++ Note we do this after the INLINE_FRAME check above. That is ++ because the inline frame's frame id computation needs to fetch ++ the frame id of its previous real stack frame. I.e., we need to ++ avoid recursion in that case. This is OK since we're sure the ++ inline frame won't create a cycle with the real stack frame. See ++ inline_frame_this_id. */ ++ if (this_frame->level == 0) ++ get_frame_id (this_frame); ++ + /* Check that this frame is unwindable. If it isn't, don't try to + unwind to the prev frame. */ + this_frame->stop_reason +@@ -2410,16 +2427,6 @@ get_prev_frame (struct frame_info *this_frame) + something should be calling get_selected_frame() or + get_current_frame(). */ + gdb_assert (this_frame != NULL); +- +- /* If this_frame is the current frame, then compute and stash +- its frame id prior to fetching and computing the frame id of the +- previous frame. Otherwise, the cycle detection code in +- get_prev_frame_if_no_cycle() will not work correctly. When +- get_frame_id() is called later on, an assertion error will +- be triggered in the event of a cycle between the current +- frame and its previous frame. */ +- if (this_frame->level == 0) +- get_frame_id (this_frame); + + frame_pc_p = get_frame_pc_if_available (this_frame, &frame_pc); + +diff --git a/gdb/inline-frame.c b/gdb/inline-frame.c +--- a/gdb/inline-frame.c ++++ b/gdb/inline-frame.c +@@ -161,7 +161,8 @@ inline_frame_this_id (struct frame_info *this_frame, + real frame's this_id method. So we must call + get_prev_frame_always. Because we are inlined into some + function, there must be previous frames, so this is safe - as +- long as we're careful not to create any cycles. */ ++ long as we're careful not to create any cycles. See related ++ comments in get_prev_frame_always_1. */ + *this_id = get_frame_id (get_prev_frame_always (this_frame)); + + /* We need a valid frame ID, so we need to be based on a valid diff --git a/SOURCES/gdb-rhbz1912985-libstdc++-assert.patch b/SOURCES/gdb-rhbz1912985-libstdc++-assert.patch new file mode 100644 index 0000000..196e309 --- /dev/null +++ b/SOURCES/gdb-rhbz1912985-libstdc++-assert.patch @@ -0,0 +1,64 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Kevin Buettner +Date: Wed, 17 Feb 2021 17:58:54 -0700 +Subject: gdb-rhbz1912985-libstdc++-assert.patch + +;; Backport fix for libstdc++ assert when performing tab completion +;; (RH BZ 1912985). + +Fix completion related libstdc++ assert when using -D_GLIBCXX_DEBUG + +This commit fixes a libstdc++ assertion failure encountered when +running gdb.base/completion.exp. In order to see this problem, +GDB must be built with the follow CFLAGS and CXXFLAGS as part +of the configure line: + + CFLAGS='-D_GLIBCXX_DEBUG' CXXFLAGS='-D_GLIBCXX_DEBUG' + +(Also, this problem was encountered using Fedora rawhide. It might +not be reproducible in Fedora versions prior to Fedora 34.) + +Using the gdb.base/completion.exp test program, the problem can be +observed as follows: + +[kev@rawhide-1 gdb]$ ./gdb -q testsuite/outputs/gdb.base/completion/completion +Reading symbols from testsuite/outputs/gdb.base/completion/completion... +(gdb) start +Temporary breakpoint 1 at 0x401179: file ../../worktree-master/gdb/testsuite/gdb.base/break.c, line 43. +Starting program: testsuite/outputs/gdb.base/completion/completion + +Temporary breakpoint 1, main (argc=1, argv=0x7fffffffd718, envp=0x7fffffffd728) at ../../worktree-master/gdb/testsuite/gdb.base/break.c:43 +43 if (argc == 12345) { /* an unlikely value < 2^16, in case uninited */ /* set breakpoint 6 here */ +(gdb) p /usr/include/c++/11/string_view:211: constexpr const value_type& std::basic_string_view<_CharT, _Traits>::operator[](std::basic_string_view<_CharT, _Traits>::size_type) const [with _CharT = char; _Traits = std::char_traits; std::basic_string_view<_CharT, _Traits>::const_reference = const char&; std::basic_string_view<_CharT, _Traits>::size_type = long unsigned int]: Assertion '__pos < this->_M_len' failed. +Aborted (core dumped) + +(Note that I added "" to make it clear where the tab key was +pressed.) + +gdb/ChangeLog: + + * ada-lang.c (ada_fold_name): Check for non-empty string prior + to accessing it. + (ada_lookup_name_info): Likewise. + +diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c +--- a/gdb/ada-lang.c ++++ b/gdb/ada-lang.c +@@ -997,7 +997,7 @@ ada_fold_name (gdb::string_view name) + int len = name.size (); + GROW_VECT (fold_buffer, fold_buffer_size, len + 1); + +- if (name[0] == '\'') ++ if (!name.empty () && name[0] == '\'') + { + strncpy (fold_buffer, name.data () + 1, len - 2); + fold_buffer[len - 2] = '\000'; +@@ -13597,7 +13597,7 @@ ada_lookup_name_info::ada_lookup_name_info (const lookup_name_info &lookup_name) + { + gdb::string_view user_name = lookup_name.name (); + +- if (user_name[0] == '<') ++ if (!user_name.empty () && user_name[0] == '<') + { + if (user_name.back () == '>') + m_encoded_name diff --git a/SOURCES/gdb-rhbz1931344-bfd_seek-elf_read_notes.patch b/SOURCES/gdb-rhbz1931344-bfd_seek-elf_read_notes.patch new file mode 100644 index 0000000..e212dc6 --- /dev/null +++ b/SOURCES/gdb-rhbz1931344-bfd_seek-elf_read_notes.patch @@ -0,0 +1,87 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Keith Seitz +Date: Thu, 25 Mar 2021 10:31:48 -0700 +Subject: gdb-rhbz1931344-bfd_seek-elf_read_notes.patch + +;; Backport "Save/restore file offset while reading notes in core file" +;; (Keith Seitz, RHBZ 1931344) + +A recent bug (RH BZ 1931344) has exposed a bug in the core file +build-ID support that I introduced a while ago. It is pretty +easy to demonstate the problem following a simplified procedure +outlined in that bug: + +[shell1] +shell1$ /usr/libexec/qemu-kvm + +[shell2] +shell2$ pkill -SEGV -x qemu-kvm + +[shell1] +Segmentation fault (core dumped) + +Load this core file into GDB without specifying an executable +(an unfortunate Fedora/RHEL-ism), and GDB will inform the user +to install debuginfo for the "missing" executable: + +$ gdb -nx -q core.12345 +... +Missing separate debuginfo for the main executable file +Try: dnf --enablerepo='*debug*' install /usr/lib/debug/.build-id/e2/e9c66d3117fb2bbb5b2be122f04f2664e5df54 +Core was generated by `/usr/libexec/qemu-kvm'. +Program terminated with signal SIGSEGV, Segmentation fault. +... + +The suggested build-ID is actaully for gmp not qemu-kvm. The problem +lies in _bfd_elf_core_find_build_id, where we loop over program headers +looking for note segments: + + /* Read in program headers and parse notes. */ + for (i = 0; i < i_ehdr.e_phnum; ++i, ++i_phdr) + { + Elf_External_Phdr x_phdr; + + if (bfd_bread (&x_phdr, sizeof (x_phdr), abfd) != sizeof (x_phdr)) + goto fail; + elf_swap_phdr_in (abfd, &x_phdr, i_phdr); + + if (i_phdr->p_type == PT_NOTE && i_phdr->p_filesz > 0) + { + elf_read_notes (abfd, offset + i_phdr->p_offset, + i_phdr->p_filesz, i_phdr->p_align); + + if (abfd->build_id != NULL) + return TRUE; + } + +elf_read_notes uses bfd_seek to forward the stream to the location of +the note segment. When control returns to _bfd_elf_core_fild_build_id, +the stream is no longer in the location looking at program headers, and +all subsequent reads will read from the wrong file offset. + +To fix this, this patch marks the stream location and ensures +that it is restored after elf_read_notes is called. + +bfd/ChangeLog +2021-03-26 Keith Seitz + + * elfcore.h (_bfd_elf_core_find_build_id): Seek file + offset of program headers after calling elf_read_notes. + +diff --git a/bfd/elfcore.h b/bfd/elfcore.h +--- a/bfd/elfcore.h ++++ b/bfd/elfcore.h +@@ -410,6 +410,13 @@ NAME(_bfd_elf, core_find_build_id) + { + elf_read_notes (abfd, offset + i_phdr->p_offset, + i_phdr->p_filesz, i_phdr->p_align); ++ ++ /* Make sure ABFD returns to processing the program headers. */ ++ if (bfd_seek (abfd, (file_ptr) (offset + i_ehdr.e_phoff ++ + (i + 1) * sizeof (x_phdr)), ++ SEEK_SET) != 0) ++ goto fail; ++ + if (abfd->build_id != NULL) + return TRUE; + } diff --git a/SOURCES/gdb-rhbz1941080-fix-gdbserver-hang.patch b/SOURCES/gdb-rhbz1941080-fix-gdbserver-hang.patch new file mode 100644 index 0000000..512092a --- /dev/null +++ b/SOURCES/gdb-rhbz1941080-fix-gdbserver-hang.patch @@ -0,0 +1,58 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Kevin Buettner +Date: Fri, 19 Mar 2021 11:07:11 -0700 +Subject: gdb-rhbz1941080-fix-gdbserver-hang.patch + +;; Backport change which fixes gdbserver testing hang on f34 and rawhide. + +Fix potential hang during gdbserver testing + +We're currently seeing testing of native-extended-gdbserver hang while +testing the x86_64 architecture on both Fedora 34 and Fedora Rawhide. +The test responsible for the hang is gdb.threads/fork-plus-threads.exp. + +While there is clearly a problem/bug with this test on F34 and +Rawhide, it's also the case that testing should not hang. This commit +prevents the hang by waiting with the "-nowait" flag in +close_gdbserver. + +The -nowait flag is also used in the kill_wait_spawned_process proc in +gdb/testsuite/lib/gdb.exp, so there is precedent for doing this. + +There are also 15 other uses of "wait -i" scattered throughout the +test suite. While it's tempting to change these to also use the +-nowait flag, I think it might be safer to defer doing so until we +actually see a problem. + +I've tested this patch on Fedora 32, 33, 34, and Rawhide. Results are +comparable on Fedora 32 and 33. On Fedora 34 and Rawhide, with this +commit in place, testing completes when the target_board is +native-extended-gdbserver. On those OSes, when not using this commit, +testing usually hangs due to a problem with +gdb.threads/fork-plus-threads.exp. I've also tested on all of the +mentioned OSes with target_board=native-gdbserver; for that testing, +I achieved comparable results over a number of runs. (Unfortunately +results are rarely identical due to racy tests.) + +gdb/testsuite/ChangeLog: + + * lib/gdbserver-support.exp (gdbserver_exit): Use the + "-nowait" flag when waiting for gdbserver to exit. + +diff --git a/gdb/testsuite/lib/gdbserver-support.exp b/gdb/testsuite/lib/gdbserver-support.exp +--- a/gdb/testsuite/lib/gdbserver-support.exp ++++ b/gdb/testsuite/lib/gdbserver-support.exp +@@ -418,7 +418,12 @@ proc close_gdbserver {} { + verbose "Quitting GDBserver" + + catch "close -i $server_spawn_id" +- catch "wait -i $server_spawn_id" ++ ++ # If gdbserver misbehaves, and ignores the close, waiting for it ++ # without the -nowait flag will cause testing to hang. Passing ++ # -nowait makes expect tell Tcl to wait for the process in the ++ # background. ++ catch "wait -nowait -i $server_spawn_id" + unset server_spawn_id + } + diff --git a/SOURCES/gdb-rhbz1964167-convert-enum-range_type.patch b/SOURCES/gdb-rhbz1964167-convert-enum-range_type.patch new file mode 100644 index 0000000..ecf8042 --- /dev/null +++ b/SOURCES/gdb-rhbz1964167-convert-enum-range_type.patch @@ -0,0 +1,375 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Kevin Buettner +Date: Mon, 24 May 2021 17:10:28 -0700 +Subject: gdb-rhbz1964167-convert-enum-range_type.patch + +;; [fortran] Backport Andrew Burgess's commit which changes enum +;; range_type into a bit field enum. + +gdb: Convert enum range_type to a bit field enum + +The expression range_type enum represents the following ideas: + + - Lower bound is set to default, + - Upper bound is set to default, + - Upper bound is exclusive. + +There are currently 6 entries in the enum to represent the combination +of all those ideas. + +In a future commit I'd like to add stride information to the range, +this could in theory appear with any of the existing enum entries, so +this would take us to 12 enum entries. + +This feels like its getting a little out of hand, so in this commit I +switch the range_type enum over to being a flags style enum. There's +one entry to represent no flags being set, then 3 flags to represent +the 3 ideas above. Adding stride information will require adding only +one more enum flag. + +I've then gone through and updated the code to handle this change. + +There should be no user visible changes after this commit. + +gdb/ChangeLog: + + * expprint.c (print_subexp_standard): Update to reflect changes to + enum range_type. + (dump_subexp_body_standard): Likewise. + * expression.h (enum range_type): Convert to a bit field enum, and + make the enum unsigned. + * f-exp.y (subrange): Update to reflect changes to enum + range_type. + * f-lang.c (value_f90_subarray): Likewise. + * parse.c (operator_length_standard): Likewise. + * rust-exp.y (rust_parser::convert_ast_to_expression): Likewise. + * rust-lang.c (rust_range): Likewise. + (rust_compute_range): Likewise. + (rust_subscript): Likewise. + +diff --git a/gdb/expprint.c b/gdb/expprint.c +--- a/gdb/expprint.c ++++ b/gdb/expprint.c +@@ -584,17 +584,13 @@ print_subexp_standard (struct expression *exp, int *pos, + longest_to_int (exp->elts[pc + 1].longconst); + *pos += 2; + +- if (range_type == NONE_BOUND_DEFAULT_EXCLUSIVE +- || range_type == LOW_BOUND_DEFAULT_EXCLUSIVE) ++ if (range_type & RANGE_HIGH_BOUND_EXCLUSIVE) + fputs_filtered ("EXCLUSIVE_", stream); + fputs_filtered ("RANGE(", stream); +- if (range_type == HIGH_BOUND_DEFAULT +- || range_type == NONE_BOUND_DEFAULT +- || range_type == NONE_BOUND_DEFAULT_EXCLUSIVE) ++ if (!(range_type & RANGE_LOW_BOUND_DEFAULT)) + print_subexp (exp, pos, stream, PREC_ABOVE_COMMA); + fputs_filtered ("..", stream); +- if (range_type == LOW_BOUND_DEFAULT +- || range_type == NONE_BOUND_DEFAULT) ++ if (!(range_type & RANGE_HIGH_BOUND_DEFAULT)) + print_subexp (exp, pos, stream, PREC_ABOVE_COMMA); + fputs_filtered (")", stream); + return; +@@ -1114,36 +1110,19 @@ dump_subexp_body_standard (struct expression *exp, + longest_to_int (exp->elts[elt].longconst); + elt += 2; + +- switch (range_type) +- { +- case BOTH_BOUND_DEFAULT: +- fputs_filtered ("Range '..'", stream); +- break; +- case LOW_BOUND_DEFAULT: +- fputs_filtered ("Range '..EXP'", stream); +- break; +- case LOW_BOUND_DEFAULT_EXCLUSIVE: +- fputs_filtered ("ExclusiveRange '..EXP'", stream); +- break; +- case HIGH_BOUND_DEFAULT: +- fputs_filtered ("Range 'EXP..'", stream); +- break; +- case NONE_BOUND_DEFAULT: +- fputs_filtered ("Range 'EXP..EXP'", stream); +- break; +- case NONE_BOUND_DEFAULT_EXCLUSIVE: +- fputs_filtered ("ExclusiveRange 'EXP..EXP'", stream); +- break; +- default: +- fputs_filtered ("Invalid Range!", stream); +- break; +- } ++ if (range_type & RANGE_HIGH_BOUND_EXCLUSIVE) ++ fputs_filtered ("Exclusive", stream); ++ fputs_filtered ("Range '", stream); ++ if (!(range_type & RANGE_LOW_BOUND_DEFAULT)) ++ fputs_filtered ("EXP", stream); ++ fputs_filtered ("..", stream); ++ if (!(range_type & RANGE_HIGH_BOUND_DEFAULT)) ++ fputs_filtered ("EXP", stream); ++ fputs_filtered ("'", stream); + +- if (range_type == HIGH_BOUND_DEFAULT +- || range_type == NONE_BOUND_DEFAULT) ++ if (!(range_type & RANGE_LOW_BOUND_DEFAULT)) + elt = dump_subexp (exp, stream, elt); +- if (range_type == LOW_BOUND_DEFAULT +- || range_type == NONE_BOUND_DEFAULT) ++ if (!(range_type & RANGE_HIGH_BOUND_DEFAULT)) + elt = dump_subexp (exp, stream, elt); + } + break; +diff --git a/gdb/expression.h b/gdb/expression.h +--- a/gdb/expression.h ++++ b/gdb/expression.h +@@ -185,22 +185,22 @@ extern void dump_prefix_expression (struct expression *, struct ui_file *); + or inclusive. So we have six sorts of subrange. This enumeration + type is to identify this. */ + +-enum range_type ++enum range_type : unsigned + { +- /* Neither the low nor the high bound was given -- so this refers to +- the entire available range. */ +- BOTH_BOUND_DEFAULT, +- /* The low bound was not given and the high bound is inclusive. */ +- LOW_BOUND_DEFAULT, +- /* The high bound was not given and the low bound in inclusive. */ +- HIGH_BOUND_DEFAULT, +- /* Both bounds were given and both are inclusive. */ +- NONE_BOUND_DEFAULT, +- /* The low bound was not given and the high bound is exclusive. */ +- NONE_BOUND_DEFAULT_EXCLUSIVE, +- /* Both bounds were given. The low bound is inclusive and the high +- bound is exclusive. */ +- LOW_BOUND_DEFAULT_EXCLUSIVE, ++ /* This is a standard range. Both the lower and upper bounds are ++ defined, and the bounds are inclusive. */ ++ RANGE_STANDARD = 0, ++ ++ /* The low bound was not given. */ ++ RANGE_LOW_BOUND_DEFAULT = 1 << 0, ++ ++ /* The high bound was not given. */ ++ RANGE_HIGH_BOUND_DEFAULT = 1 << 1, ++ ++ /* The high bound of this range is exclusive. */ ++ RANGE_HIGH_BOUND_EXCLUSIVE = 1 << 2, + }; + ++DEF_ENUM_FLAGS_TYPE (enum range_type, range_types); ++ + #endif /* !defined (EXPRESSION_H) */ +diff --git a/gdb/f-exp.y b/gdb/f-exp.y +--- a/gdb/f-exp.y ++++ b/gdb/f-exp.y +@@ -287,26 +287,30 @@ arglist : arglist ',' exp %prec ABOVE_COMMA + /* There are four sorts of subrange types in F90. */ + + subrange: exp ':' exp %prec ABOVE_COMMA +- { write_exp_elt_opcode (pstate, OP_RANGE); +- write_exp_elt_longcst (pstate, NONE_BOUND_DEFAULT); ++ { write_exp_elt_opcode (pstate, OP_RANGE); ++ write_exp_elt_longcst (pstate, RANGE_STANDARD); + write_exp_elt_opcode (pstate, OP_RANGE); } + ; + + subrange: exp ':' %prec ABOVE_COMMA + { write_exp_elt_opcode (pstate, OP_RANGE); +- write_exp_elt_longcst (pstate, HIGH_BOUND_DEFAULT); ++ write_exp_elt_longcst (pstate, ++ RANGE_HIGH_BOUND_DEFAULT); + write_exp_elt_opcode (pstate, OP_RANGE); } + ; + + subrange: ':' exp %prec ABOVE_COMMA + { write_exp_elt_opcode (pstate, OP_RANGE); +- write_exp_elt_longcst (pstate, LOW_BOUND_DEFAULT); ++ write_exp_elt_longcst (pstate, ++ RANGE_LOW_BOUND_DEFAULT); + write_exp_elt_opcode (pstate, OP_RANGE); } + ; + + subrange: ':' %prec ABOVE_COMMA + { write_exp_elt_opcode (pstate, OP_RANGE); +- write_exp_elt_longcst (pstate, BOTH_BOUND_DEFAULT); ++ write_exp_elt_longcst (pstate, ++ (RANGE_LOW_BOUND_DEFAULT ++ | RANGE_HIGH_BOUND_DEFAULT)); + write_exp_elt_opcode (pstate, OP_RANGE); } + ; + +diff --git a/gdb/f-lang.c b/gdb/f-lang.c +--- a/gdb/f-lang.c ++++ b/gdb/f-lang.c +@@ -131,12 +131,12 @@ value_f90_subarray (struct value *array, + + *pos += 3; + +- if (range_type == LOW_BOUND_DEFAULT || range_type == BOTH_BOUND_DEFAULT) ++ if (range_type & RANGE_LOW_BOUND_DEFAULT) + low_bound = range->bounds ()->low.const_val (); + else + low_bound = value_as_long (evaluate_subexp (nullptr, exp, pos, noside)); + +- if (range_type == HIGH_BOUND_DEFAULT || range_type == BOTH_BOUND_DEFAULT) ++ if (range_type & RANGE_HIGH_BOUND_DEFAULT) + high_bound = range->bounds ()->high.const_val (); + else + high_bound = value_as_long (evaluate_subexp (nullptr, exp, pos, noside)); +diff --git a/gdb/parse.c b/gdb/parse.c +--- a/gdb/parse.c ++++ b/gdb/parse.c +@@ -921,21 +921,13 @@ operator_length_standard (const struct expression *expr, int endpos, + range_type = (enum range_type) + longest_to_int (expr->elts[endpos - 2].longconst); + +- switch (range_type) +- { +- case LOW_BOUND_DEFAULT: +- case LOW_BOUND_DEFAULT_EXCLUSIVE: +- case HIGH_BOUND_DEFAULT: +- args = 1; +- break; +- case BOTH_BOUND_DEFAULT: +- args = 0; +- break; +- case NONE_BOUND_DEFAULT: +- case NONE_BOUND_DEFAULT_EXCLUSIVE: +- args = 2; +- break; +- } ++ /* Assume the range has 2 arguments (low bound and high bound), then ++ reduce the argument count if any bounds are set to default. */ ++ args = 2; ++ if (range_type & RANGE_LOW_BOUND_DEFAULT) ++ --args; ++ if (range_type & RANGE_HIGH_BOUND_DEFAULT) ++ --args; + + break; + +diff --git a/gdb/rust-exp.y b/gdb/rust-exp.y +--- a/gdb/rust-exp.y ++++ b/gdb/rust-exp.y +@@ -2492,24 +2492,29 @@ rust_parser::convert_ast_to_expression (const struct rust_op *operation, + + case OP_RANGE: + { +- enum range_type kind = BOTH_BOUND_DEFAULT; ++ enum range_type kind = (RANGE_HIGH_BOUND_DEFAULT ++ | RANGE_LOW_BOUND_DEFAULT); + + if (operation->left.op != NULL) + { + convert_ast_to_expression (operation->left.op, top); +- kind = HIGH_BOUND_DEFAULT; ++ kind &= ~RANGE_LOW_BOUND_DEFAULT; + } + if (operation->right.op != NULL) + { + convert_ast_to_expression (operation->right.op, top); +- if (kind == BOTH_BOUND_DEFAULT) +- kind = (operation->inclusive +- ? LOW_BOUND_DEFAULT : LOW_BOUND_DEFAULT_EXCLUSIVE); ++ if (kind == (RANGE_HIGH_BOUND_DEFAULT | RANGE_LOW_BOUND_DEFAULT)) ++ { ++ kind = RANGE_LOW_BOUND_DEFAULT; ++ if (!operation->inclusive) ++ kind |= RANGE_HIGH_BOUND_EXCLUSIVE; ++ } + else + { +- gdb_assert (kind == HIGH_BOUND_DEFAULT); +- kind = (operation->inclusive +- ? NONE_BOUND_DEFAULT : NONE_BOUND_DEFAULT_EXCLUSIVE); ++ gdb_assert (kind == RANGE_HIGH_BOUND_DEFAULT); ++ kind = RANGE_STANDARD; ++ if (!operation->inclusive) ++ kind |= RANGE_HIGH_BOUND_EXCLUSIVE; + } + } + else +diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c +--- a/gdb/rust-lang.c ++++ b/gdb/rust-lang.c +@@ -1082,13 +1082,11 @@ rust_range (struct expression *exp, int *pos, enum noside noside) + kind = (enum range_type) longest_to_int (exp->elts[*pos + 1].longconst); + *pos += 3; + +- if (kind == HIGH_BOUND_DEFAULT || kind == NONE_BOUND_DEFAULT +- || kind == NONE_BOUND_DEFAULT_EXCLUSIVE) ++ if (!(kind & RANGE_LOW_BOUND_DEFAULT)) + low = evaluate_subexp (nullptr, exp, pos, noside); +- if (kind == LOW_BOUND_DEFAULT || kind == LOW_BOUND_DEFAULT_EXCLUSIVE +- || kind == NONE_BOUND_DEFAULT || kind == NONE_BOUND_DEFAULT_EXCLUSIVE) ++ if (!(kind & RANGE_HIGH_BOUND_DEFAULT)) + high = evaluate_subexp (nullptr, exp, pos, noside); +- bool inclusive = (kind == NONE_BOUND_DEFAULT || kind == LOW_BOUND_DEFAULT); ++ bool inclusive = !(kind & RANGE_HIGH_BOUND_EXCLUSIVE); + + if (noside == EVAL_SKIP) + return value_from_longest (builtin_type (exp->gdbarch)->builtin_int, 1); +@@ -1171,13 +1169,13 @@ rust_range (struct expression *exp, int *pos, enum noside noside) + static void + rust_compute_range (struct type *type, struct value *range, + LONGEST *low, LONGEST *high, +- enum range_type *kind) ++ range_types *kind) + { + int i; + + *low = 0; + *high = 0; +- *kind = BOTH_BOUND_DEFAULT; ++ *kind = RANGE_LOW_BOUND_DEFAULT | RANGE_HIGH_BOUND_DEFAULT; + + if (type->num_fields () == 0) + return; +@@ -1185,15 +1183,15 @@ rust_compute_range (struct type *type, struct value *range, + i = 0; + if (strcmp (TYPE_FIELD_NAME (type, 0), "start") == 0) + { +- *kind = HIGH_BOUND_DEFAULT; ++ *kind = RANGE_HIGH_BOUND_DEFAULT; + *low = value_as_long (value_field (range, 0)); + ++i; + } + if (type->num_fields () > i + && strcmp (TYPE_FIELD_NAME (type, i), "end") == 0) + { +- *kind = (*kind == BOTH_BOUND_DEFAULT +- ? LOW_BOUND_DEFAULT : NONE_BOUND_DEFAULT); ++ *kind = (*kind == (RANGE_LOW_BOUND_DEFAULT | RANGE_HIGH_BOUND_DEFAULT) ++ ? RANGE_LOW_BOUND_DEFAULT : RANGE_STANDARD); + *high = value_as_long (value_field (range, i)); + + if (rust_inclusive_range_type_p (type)) +@@ -1211,7 +1209,7 @@ rust_subscript (struct expression *exp, int *pos, enum noside noside, + struct type *rhstype; + LONGEST low, high_bound; + /* Initialized to appease the compiler. */ +- enum range_type kind = BOTH_BOUND_DEFAULT; ++ range_types kind = RANGE_LOW_BOUND_DEFAULT | RANGE_HIGH_BOUND_DEFAULT; + LONGEST high = 0; + int want_slice = 0; + +@@ -1308,8 +1306,7 @@ rust_subscript (struct expression *exp, int *pos, enum noside noside, + else + error (_("Cannot subscript non-array type")); + +- if (want_slice +- && (kind == BOTH_BOUND_DEFAULT || kind == LOW_BOUND_DEFAULT)) ++ if (want_slice && (kind & RANGE_LOW_BOUND_DEFAULT)) + low = low_bound; + if (low < 0) + error (_("Index less than zero")); +@@ -1327,7 +1324,7 @@ rust_subscript (struct expression *exp, int *pos, enum noside noside, + CORE_ADDR addr; + struct value *addrval, *tem; + +- if (kind == BOTH_BOUND_DEFAULT || kind == HIGH_BOUND_DEFAULT) ++ if (kind & RANGE_HIGH_BOUND_DEFAULT) + high = high_bound; + if (high < 0) + error (_("High index less than zero")); diff --git a/SOURCES/gdb-rhbz1964167-fortran-array-slices-at-prompt.patch b/SOURCES/gdb-rhbz1964167-fortran-array-slices-at-prompt.patch new file mode 100644 index 0000000..05e5890 --- /dev/null +++ b/SOURCES/gdb-rhbz1964167-fortran-array-slices-at-prompt.patch @@ -0,0 +1,2660 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Kevin Buettner +Date: Mon, 24 May 2021 22:46:21 -0700 +Subject: gdb-rhbz1964167-fortran-array-slices-at-prompt.patch + +;; [fortran] Backport Andrew Burgess's commit for Fortran array +;; slice support + +gdb/fortran: Add support for Fortran array slices at the GDB prompt + +This commit brings array slice support to GDB. + +WARNING: This patch contains a rather big hack which is limited to +Fortran arrays, this can be seen in gdbtypes.c and f-lang.c. More +details on this below. + +This patch rewrites two areas of GDB's Fortran support, the code to +extract an array slice, and the code to print an array. + +After this commit a user can, from the GDB prompt, ask for a slice of +a Fortran array and should get the correct result back. Slices can +(optionally) have the lower bound, upper bound, and a stride +specified. Slices can also have a negative stride. + +Fortran has the concept of repacking array slices. Within a compiled +Fortran program if a user passes a non-contiguous array slice to a +function then the compiler may have to repack the slice, this involves +copying the elements of the slice to a new area of memory before the +call, and copying the elements back to the original array after the +call. Whether repacking occurs will depend on which version of +Fortran is being used, and what type of function is being called. + +This commit adds support for both packed, and unpacked array slicing, +with the default being unpacked. + +With an unpacked array slice, when the user asks for a slice of an +array GDB creates a new type that accurately describes where the +elements of the slice can be found within the original array, a +value of this type is then returned to the user. The address of an +element within the slice will be equal to the address of an element +within the original array. + +A user can choose to select packed array slices instead using: + + (gdb) set fortran repack-array-slices on|off + (gdb) show fortran repack-array-slices + +With packed array slices GDB creates a new type that reflects how the +elements of the slice would look if they were laid out in contiguous +memory, allocates a value of this type, and then fetches the elements +from the original array and places then into the contents buffer of +the new value. + +One benefit of using packed slices over unpacked slices is the memory +usage, taking a small slice of N elements from a large array will +require (in GDB) N * ELEMENT_SIZE bytes of memory, while an unpacked +array will also include all of the "padding" between the +non-contiguous elements. There are new tests added that highlight +this difference. + +There is also a new debugging flag added with this commit that +introduces these commands: + + (gdb) set debug fortran-array-slicing on|off + (gdb) show debug fortran-array-slicing + +This prints information about how the array slices are being built. + +As both the repacking, and the array printing requires GDB to walk +through a multi-dimensional Fortran array visiting each element, this +commit adds the file f-array-walk.h, which introduces some +infrastructure to support this process. This means the array printing +code in f-valprint.c is significantly reduced. + +The only slight issue with this commit is the "rather big hack" that I +mentioned above. This hack allows us to handle one specific case, +array slices with negative strides. This is something that I don't +believe the current GDB value contents model will allow us to +correctly handle, and rather than rewrite the value contents code +right now, I'm hoping to slip this hack in as a work around. + +The problem is that, as I see it, the current value contents model +assumes that an object base address will be the lowest address within +that object, and that the contents of the object start at this base +address and occupy the TYPE_LENGTH bytes after that. + +( We do have the embedded_offset, which is used for C++ sub-classes, +such that an object can start at some offset from the content buffer, +however, the assumption that the object then occupies the next +TYPE_LENGTH bytes is still true within GDB. ) + +The problem is that Fortran arrays with a negative stride don't follow +this pattern. In this case the base address of the object points to +the element with the highest address, the contents of the array then +start at some offset _before_ the base address, and proceed for one +element _past_ the base address. + +As the stride for such an array would be negative then, in theory the +TYPE_LENGTH for this type would also be negative. However, in many +places a value in GDB will degrade to a pointer + length, and the +length almost always comes from the TYPE_LENGTH. + +It is my belief that in order to correctly model this case the value +content handling of GDB will need to be reworked to split apart the +value's content buffer (which is a block of memory with a length), and +the object's in memory base address and length, which could be +negative. + +Things are further complicated because arrays with negative strides +like this are always dynamic types. When a value has a dynamic type +and its base address needs resolving we actually store the address of +the object within the resolved dynamic type, not within the value +object itself. + +In short I don't currently see an easy path to cleanly support this +situation within GDB. And so I believe that leaves two options, +either add a work around, or catch cases where the user tries to make +use of a negative stride, or access an array with a negative stride, +and throw an error. + +This patch currently goes with adding a work around, which is that +when we resolve a dynamic Fortran array type, if the stride is +negative, then we adjust the base address to point to the lowest +address required by the array. The printing and slicing code is aware +of this adjustment and will correctly slice and print Fortran arrays. + +Where this hack will show through to the user is if they ask for the +address of an array in their program with a negative array stride, the +address they get from GDB will not match the address that would be +computed within the Fortran program. + +gdb/ChangeLog: + + * Makefile.in (HFILES_NO_SRCDIR): Add f-array-walker.h. + * NEWS: Mention new options. + * f-array-walker.h: New file. + * f-lang.c: Include 'gdbcmd.h' and 'f-array-walker.h'. + (repack_array_slices): New static global. + (show_repack_array_slices): New function. + (fortran_array_slicing_debug): New static global. + (show_fortran_array_slicing_debug): New function. + (value_f90_subarray): Delete. + (skip_undetermined_arglist): Delete. + (class fortran_array_repacker_base_impl): New class. + (class fortran_lazy_array_repacker_impl): New class. + (class fortran_array_repacker_impl): New class. + (fortran_value_subarray): Complete rewrite. + (set_fortran_list): New static global. + (show_fortran_list): Likewise. + (_initialize_f_language): Register new commands. + (fortran_adjust_dynamic_array_base_address_hack): New function. + * f-lang.h (fortran_adjust_dynamic_array_base_address_hack): + Declare. + * f-valprint.c: Include 'f-array-walker.h'. + (class fortran_array_printer_impl): New class. + (f77_print_array_1): Delete. + (f77_print_array): Delete. + (fortran_print_array): New. + (f_value_print_inner): Update to call fortran_print_array. + * gdbtypes.c: Include 'f-lang.h'. + (resolve_dynamic_type_internal): Call + fortran_adjust_dynamic_array_base_address_hack. + +gdb/testsuite/ChangeLog: + + * gdb.fortran/array-slices-bad.exp: New file. + * gdb.fortran/array-slices-bad.f90: New file. + * gdb.fortran/array-slices-sub-slices.exp: New file. + * gdb.fortran/array-slices-sub-slices.f90: New file. + * gdb.fortran/array-slices.exp: Rewrite tests. + * gdb.fortran/array-slices.f90: Rewrite tests. + * gdb.fortran/vla-sizeof.exp: Correct expected results. + +gdb/doc/ChangeLog: + + * gdb.texinfo (Debugging Output): Document 'set/show debug + fortran-array-slicing'. + (Special Fortran Commands): Document 'set/show fortran + repack-array-slices'. + +diff --git a/gdb/Makefile.in b/gdb/Makefile.in +--- a/gdb/Makefile.in ++++ b/gdb/Makefile.in +@@ -1268,6 +1268,7 @@ HFILES_NO_SRCDIR = \ + expression.h \ + extension.h \ + extension-priv.h \ ++ f-array-walker.h \ + f-lang.h \ + fbsd-nat.h \ + fbsd-tdep.h \ +diff --git a/gdb/NEWS b/gdb/NEWS +--- a/gdb/NEWS ++++ b/gdb/NEWS +@@ -111,6 +111,19 @@ maintenance print core-file-backed-mappings + Prints file-backed mappings loaded from a core file's note section. + Output is expected to be similar to that of "info proc mappings". + ++set debug fortran-array-slicing on|off ++show debug fortran-array-slicing ++ Print debugging when taking slices of Fortran arrays. ++ ++set fortran repack-array-slices on|off ++show fortran repack-array-slices ++ When taking slices from Fortran arrays and strings, if the slice is ++ non-contiguous within the original value then, when this option is ++ on, the new value will be repacked into a single contiguous value. ++ When this option is off, then the value returned will consist of a ++ descriptor that describes the slice within the memory of the ++ original parent value. ++ + * Changed commands + + alias [-a] [--] ALIAS = COMMAND [DEFAULT-ARGS...] +diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo +--- a/gdb/doc/gdb.texinfo ++++ b/gdb/doc/gdb.texinfo +@@ -16919,6 +16919,29 @@ This command prints the values contained in the Fortran @code{COMMON} + block whose name is @var{common-name}. With no argument, the names of + all @code{COMMON} blocks visible at the current program location are + printed. ++@cindex arrays slices (Fortran) ++@kindex set fortran repack-array-slices ++@kindex show fortran repack-array-slices ++@item set fortran repack-array-slices [on|off] ++@item show fortran repack-array-slices ++When taking a slice from an array, a Fortran compiler can choose to ++either produce an array descriptor that describes the slice in place, ++or it may repack the slice, copying the elements of the slice into a ++new region of memory. ++ ++When this setting is on, then @value{GDBN} will also repack array ++slices in some situations. When this setting is off, then ++@value{GDBN} will create array descriptors for slices that reference ++the original data in place. ++ ++@value{GDBN} will never repack an array slice if the data for the ++slice is contiguous within the original array. ++ ++@value{GDBN} will always repack string slices if the data for the ++slice is non-contiguous within the original string as @value{GDBN} ++does not support printing non-contiguous strings. ++ ++The default for this setting is @code{off}. + @end table + + @node Pascal +@@ -26507,6 +26530,16 @@ Show the current state of FreeBSD LWP debugging messages. + Turns on or off debugging messages from the FreeBSD native target. + @item show debug fbsd-nat + Show the current state of FreeBSD native target debugging messages. ++ ++@item set debug fortran-array-slicing ++@cindex fortran array slicing debugging info ++Turns on or off display of @value{GDBN} Fortran array slicing ++debugging info. The default is off. ++ ++@item show debug fortran-array-slicing ++Displays the current state of displaying @value{GDBN} Fortran array ++slicing debugging info. ++ + @item set debug frame + @cindex frame debugging info + Turns on or off display of @value{GDBN} frame debugging info. The +diff --git a/gdb/f-array-walker.h b/gdb/f-array-walker.h +new file mode 100644 +--- /dev/null ++++ b/gdb/f-array-walker.h +@@ -0,0 +1,265 @@ ++/* Copyright (C) 2020 Free Software Foundation, Inc. ++ ++ This file is part of GDB. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ ++ ++/* Support classes to wrap up the process of iterating over a ++ multi-dimensional Fortran array. */ ++ ++#ifndef F_ARRAY_WALKER_H ++#define F_ARRAY_WALKER_H ++ ++#include "defs.h" ++#include "gdbtypes.h" ++#include "f-lang.h" ++ ++/* Class for calculating the byte offset for elements within a single ++ dimension of a Fortran array. */ ++class fortran_array_offset_calculator ++{ ++public: ++ /* Create a new offset calculator for TYPE, which is either an array or a ++ string. */ ++ explicit fortran_array_offset_calculator (struct type *type) ++ { ++ /* Validate the type. */ ++ type = check_typedef (type); ++ if (type->code () != TYPE_CODE_ARRAY ++ && (type->code () != TYPE_CODE_STRING)) ++ error (_("can only compute offsets for arrays and strings")); ++ ++ /* Get the range, and extract the bounds. */ ++ struct type *range_type = type->index_type (); ++ if (!get_discrete_bounds (range_type, &m_lowerbound, &m_upperbound)) ++ error ("unable to read array bounds"); ++ ++ /* Figure out the stride for this array. */ ++ struct type *elt_type = check_typedef (TYPE_TARGET_TYPE (type)); ++ m_stride = type->index_type ()->bounds ()->bit_stride (); ++ if (m_stride == 0) ++ m_stride = type_length_units (elt_type); ++ else ++ { ++ struct gdbarch *arch = get_type_arch (elt_type); ++ int unit_size = gdbarch_addressable_memory_unit_size (arch); ++ m_stride /= (unit_size * 8); ++ } ++ }; ++ ++ /* Get the byte offset for element INDEX within the type we are working ++ on. There is no bounds checking done on INDEX. If the stride is ++ negative then we still assume that the base address (for the array ++ object) points to the element with the lowest memory address, we then ++ calculate an offset assuming that index 0 will be the element at the ++ highest address, index 1 the next highest, and so on. This is not ++ quite how Fortran works in reality; in reality the base address of ++ the object would point at the element with the highest address, and ++ we would index backwards from there in the "normal" way, however, ++ GDB's current value contents model doesn't support having the base ++ address be near to the end of the value contents, so we currently ++ adjust the base address of Fortran arrays with negative strides so ++ their base address points at the lowest memory address. This code ++ here is part of working around this weirdness. */ ++ LONGEST index_offset (LONGEST index) ++ { ++ LONGEST offset; ++ if (m_stride < 0) ++ offset = std::abs (m_stride) * (m_upperbound - index); ++ else ++ offset = std::abs (m_stride) * (index - m_lowerbound); ++ return offset; ++ } ++ ++private: ++ ++ /* The stride for the type we are working with. */ ++ LONGEST m_stride; ++ ++ /* The upper bound for the type we are working with. */ ++ LONGEST m_upperbound; ++ ++ /* The lower bound for the type we are working with. */ ++ LONGEST m_lowerbound; ++}; ++ ++/* A base class used by fortran_array_walker. There's no virtual methods ++ here, sub-classes should just override the functions they want in order ++ to specialise the behaviour to their needs. The functionality ++ provided in these default implementations will visit every array ++ element, but do nothing for each element. */ ++ ++struct fortran_array_walker_base_impl ++{ ++ /* Called when iterating between the lower and upper bounds of each ++ dimension of the array. Return true if GDB should continue iterating, ++ otherwise, return false. ++ ++ SHOULD_CONTINUE indicates if GDB is going to stop anyway, and should ++ be taken into consideration when deciding what to return. If ++ SHOULD_CONTINUE is false then this function must also return false, ++ the function is still called though in case extra work needs to be ++ done as part of the stopping process. */ ++ bool continue_walking (bool should_continue) ++ { return should_continue; } ++ ++ /* Called when GDB starts iterating over a dimension of the array. The ++ argument INNER_P is true for the inner most dimension (the dimension ++ containing the actual elements of the array), and false for more outer ++ dimensions. For a concrete example of how this function is called ++ see the comment on process_element below. */ ++ void start_dimension (bool inner_p) ++ { /* Nothing. */ } ++ ++ /* Called when GDB finishes iterating over a dimension of the array. The ++ argument INNER_P is true for the inner most dimension (the dimension ++ containing the actual elements of the array), and false for more outer ++ dimensions. LAST_P is true for the last call at a particular ++ dimension. For a concrete example of how this function is called ++ see the comment on process_element below. */ ++ void finish_dimension (bool inner_p, bool last_p) ++ { /* Nothing. */ } ++ ++ /* Called when processing the inner most dimension of the array, for ++ every element in the array. ELT_TYPE is the type of the element being ++ extracted, and ELT_OFF is the offset of the element from the start of ++ array being walked, and LAST_P is true only when this is the last ++ element that will be processed in this dimension. ++ ++ Given this two dimensional array ((1, 2) (3, 4)), the calls to ++ start_dimension, process_element, and finish_dimension look like this: ++ ++ start_dimension (false); ++ start_dimension (true); ++ process_element (TYPE, OFFSET, false); ++ process_element (TYPE, OFFSET, true); ++ finish_dimension (true, false); ++ start_dimension (true); ++ process_element (TYPE, OFFSET, false); ++ process_element (TYPE, OFFSET, true); ++ finish_dimension (true, true); ++ finish_dimension (false, true); */ ++ void process_element (struct type *elt_type, LONGEST elt_off, bool last_p) ++ { /* Nothing. */ } ++}; ++ ++/* A class to wrap up the process of iterating over a multi-dimensional ++ Fortran array. IMPL is used to specialise what happens as we walk over ++ the array. See class FORTRAN_ARRAY_WALKER_BASE_IMPL (above) for the ++ methods than can be used to customise the array walk. */ ++template ++class fortran_array_walker ++{ ++ /* Ensure that Impl is derived from the required base class. This just ++ ensures that all of the required API methods are available and have a ++ sensible default implementation. */ ++ gdb_static_assert ((std::is_base_of::value)); ++ ++public: ++ /* Create a new array walker. TYPE is the type of the array being walked ++ over, and ADDRESS is the base address for the object of TYPE in ++ memory. All other arguments are forwarded to the constructor of the ++ template parameter class IMPL. */ ++ template ++ fortran_array_walker (struct type *type, CORE_ADDR address, ++ Args... args) ++ : m_type (type), ++ m_address (address), ++ m_impl (type, address, args...) ++ { ++ m_ndimensions = calc_f77_array_dims (m_type); ++ } ++ ++ /* Walk the array. */ ++ void ++ walk () ++ { ++ walk_1 (1, m_type, 0, false); ++ } ++ ++private: ++ /* The core of the array walking algorithm. NSS is the current ++ dimension number being processed, TYPE is the type of this dimension, ++ and OFFSET is the offset (in bytes) for the start of this dimension. */ ++ void ++ walk_1 (int nss, struct type *type, int offset, bool last_p) ++ { ++ /* Extract the range, and get lower and upper bounds. */ ++ struct type *range_type = check_typedef (type)->index_type (); ++ LONGEST lowerbound, upperbound; ++ if (!get_discrete_bounds (range_type, &lowerbound, &upperbound)) ++ error ("failed to get range bounds"); ++ ++ /* CALC is used to calculate the offsets for each element in this ++ dimension. */ ++ fortran_array_offset_calculator calc (type); ++ ++ m_impl.start_dimension (nss == m_ndimensions); ++ ++ if (nss != m_ndimensions) ++ { ++ /* For dimensions other than the inner most, walk each element and ++ recurse while peeling off one more dimension of the array. */ ++ for (LONGEST i = lowerbound; ++ m_impl.continue_walking (i < upperbound + 1); ++ i++) ++ { ++ /* Use the index and the stride to work out a new offset. */ ++ LONGEST new_offset = offset + calc.index_offset (i); ++ ++ /* Now print the lower dimension. */ ++ struct type *subarray_type ++ = TYPE_TARGET_TYPE (check_typedef (type)); ++ walk_1 (nss + 1, subarray_type, new_offset, (i == upperbound)); ++ } ++ } ++ else ++ { ++ /* For the inner most dimension of the array, process each element ++ within this dimension. */ ++ for (LONGEST i = lowerbound; ++ m_impl.continue_walking (i < upperbound + 1); ++ i++) ++ { ++ LONGEST elt_off = offset + calc.index_offset (i); ++ ++ struct type *elt_type = check_typedef (TYPE_TARGET_TYPE (type)); ++ if (is_dynamic_type (elt_type)) ++ { ++ CORE_ADDR e_address = m_address + elt_off; ++ elt_type = resolve_dynamic_type (elt_type, {}, e_address); ++ } ++ ++ m_impl.process_element (elt_type, elt_off, (i == upperbound)); ++ } ++ } ++ ++ m_impl.finish_dimension (nss == m_ndimensions, last_p || nss == 1); ++ } ++ ++ /* The array type being processed. */ ++ struct type *m_type; ++ ++ /* The address in target memory for the object of M_TYPE being ++ processed. This is required in order to resolve dynamic types. */ ++ CORE_ADDR m_address; ++ ++ /* An instance of the template specialisation class. */ ++ Impl m_impl; ++ ++ /* The total number of dimensions in M_TYPE. */ ++ int m_ndimensions; ++}; ++ ++#endif /* F_ARRAY_WALKER_H */ +diff --git a/gdb/f-lang.c b/gdb/f-lang.c +--- a/gdb/f-lang.c ++++ b/gdb/f-lang.c +@@ -36,9 +36,36 @@ + #include "c-lang.h" + #include "target-float.h" + #include "gdbarch.h" ++#include "gdbcmd.h" ++#include "f-array-walker.h" + + #include + ++/* Whether GDB should repack array slices created by the user. */ ++static bool repack_array_slices = false; ++ ++/* Implement 'show fortran repack-array-slices'. */ ++static void ++show_repack_array_slices (struct ui_file *file, int from_tty, ++ struct cmd_list_element *c, const char *value) ++{ ++ fprintf_filtered (file, _("Repacking of Fortran array slices is %s.\n"), ++ value); ++} ++ ++/* Debugging of Fortran's array slicing. */ ++static bool fortran_array_slicing_debug = false; ++ ++/* Implement 'show debug fortran-array-slicing'. */ ++static void ++show_fortran_array_slicing_debug (struct ui_file *file, int from_tty, ++ struct cmd_list_element *c, ++ const char *value) ++{ ++ fprintf_filtered (file, _("Debugging of Fortran array slicing is %s.\n"), ++ value); ++} ++ + /* Local functions */ + + /* Return the encoding that should be used for the character type +@@ -114,57 +141,6 @@ enum f_primitive_types { + nr_f_primitive_types + }; + +-/* Called from fortran_value_subarray to take a slice of an array or a +- string. ARRAY is the array or string to be accessed. EXP, POS, and +- NOSIDE are as for evaluate_subexp_standard. Return a value that is a +- slice of the array. */ +- +-static struct value * +-value_f90_subarray (struct value *array, +- struct expression *exp, int *pos, enum noside noside) +-{ +- int pc = (*pos) + 1; +- LONGEST low_bound, high_bound, stride; +- struct type *range = check_typedef (value_type (array)->index_type ()); +- enum range_flag range_flag +- = (enum range_flag) longest_to_int (exp->elts[pc].longconst); +- +- *pos += 3; +- +- if (range_flag & RANGE_LOW_BOUND_DEFAULT) +- low_bound = range->bounds ()->low.const_val (); +- else +- low_bound = value_as_long (evaluate_subexp (nullptr, exp, pos, noside)); +- +- if (range_flag & RANGE_HIGH_BOUND_DEFAULT) +- high_bound = range->bounds ()->high.const_val (); +- else +- high_bound = value_as_long (evaluate_subexp (nullptr, exp, pos, noside)); +- +- if (range_flag & RANGE_HAS_STRIDE) +- stride = value_as_long (evaluate_subexp (nullptr, exp, pos, noside)); +- else +- stride = 1; +- +- if (stride != 1) +- error (_("Fortran array strides are not currently supported")); +- +- return value_slice (array, low_bound, high_bound - low_bound + 1); +-} +- +-/* Helper for skipping all the arguments in an undetermined argument list. +- This function was designed for use in the OP_F77_UNDETERMINED_ARGLIST +- case of evaluate_subexp_standard as multiple, but not all, code paths +- require a generic skip. */ +- +-static void +-skip_undetermined_arglist (int nargs, struct expression *exp, int *pos, +- enum noside noside) +-{ +- for (int i = 0; i < nargs; ++i) +- evaluate_subexp (nullptr, exp, pos, noside); +-} +- + /* Return the number of dimensions for a Fortran array or string. */ + + int +@@ -189,6 +165,145 @@ calc_f77_array_dims (struct type *array_type) + return ndimen; + } + ++/* A class used by FORTRAN_VALUE_SUBARRAY when repacking Fortran array ++ slices. This is a base class for two alternative repacking mechanisms, ++ one for when repacking from a lazy value, and one for repacking from a ++ non-lazy (already loaded) value. */ ++class fortran_array_repacker_base_impl ++ : public fortran_array_walker_base_impl ++{ ++public: ++ /* Constructor, DEST is the value we are repacking into. */ ++ fortran_array_repacker_base_impl (struct value *dest) ++ : m_dest (dest), ++ m_dest_offset (0) ++ { /* Nothing. */ } ++ ++ /* When we start processing the inner most dimension, this is where we ++ will be creating values for each element as we load them and then copy ++ them into the M_DEST value. Set a value mark so we can free these ++ temporary values. */ ++ void start_dimension (bool inner_p) ++ { ++ if (inner_p) ++ { ++ gdb_assert (m_mark == nullptr); ++ m_mark = value_mark (); ++ } ++ } ++ ++ /* When we finish processing the inner most dimension free all temporary ++ value that were created. */ ++ void finish_dimension (bool inner_p, bool last_p) ++ { ++ if (inner_p) ++ { ++ gdb_assert (m_mark != nullptr); ++ value_free_to_mark (m_mark); ++ m_mark = nullptr; ++ } ++ } ++ ++protected: ++ /* Copy the contents of array element ELT into M_DEST at the next ++ available offset. */ ++ void copy_element_to_dest (struct value *elt) ++ { ++ value_contents_copy (m_dest, m_dest_offset, elt, 0, ++ TYPE_LENGTH (value_type (elt))); ++ m_dest_offset += TYPE_LENGTH (value_type (elt)); ++ } ++ ++ /* The value being written to. */ ++ struct value *m_dest; ++ ++ /* The byte offset in M_DEST at which the next element should be ++ written. */ ++ LONGEST m_dest_offset; ++ ++ /* Set with a call to VALUE_MARK, and then reset after calling ++ VALUE_FREE_TO_MARK. */ ++ struct value *m_mark = nullptr; ++}; ++ ++/* A class used by FORTRAN_VALUE_SUBARRAY when repacking Fortran array ++ slices. This class is specialised for repacking an array slice from a ++ lazy array value, as such it does not require the parent array value to ++ be loaded into GDB's memory; the parent value could be huge, while the ++ slice could be tiny. */ ++class fortran_lazy_array_repacker_impl ++ : public fortran_array_repacker_base_impl ++{ ++public: ++ /* Constructor. TYPE is the type of the slice being loaded from the ++ parent value, so this type will correctly reflect the strides required ++ to find all of the elements from the parent value. ADDRESS is the ++ address in target memory of value matching TYPE, and DEST is the value ++ we are repacking into. */ ++ explicit fortran_lazy_array_repacker_impl (struct type *type, ++ CORE_ADDR address, ++ struct value *dest) ++ : fortran_array_repacker_base_impl (dest), ++ m_addr (address) ++ { /* Nothing. */ } ++ ++ /* Create a lazy value in target memory representing a single element, ++ then load the element into GDB's memory and copy the contents into the ++ destination value. */ ++ void process_element (struct type *elt_type, LONGEST elt_off, bool last_p) ++ { ++ copy_element_to_dest (value_at_lazy (elt_type, m_addr + elt_off)); ++ } ++ ++private: ++ /* The address in target memory where the parent value starts. */ ++ CORE_ADDR m_addr; ++}; ++ ++/* A class used by FORTRAN_VALUE_SUBARRAY when repacking Fortran array ++ slices. This class is specialised for repacking an array slice from a ++ previously loaded (non-lazy) array value, as such it fetches the ++ element values from the contents of the parent value. */ ++class fortran_array_repacker_impl ++ : public fortran_array_repacker_base_impl ++{ ++public: ++ /* Constructor. TYPE is the type for the array slice within the parent ++ value, as such it has stride values as required to find the elements ++ within the original parent value. ADDRESS is the address in target ++ memory of the value matching TYPE. BASE_OFFSET is the offset from ++ the start of VAL's content buffer to the start of the object of TYPE, ++ VAL is the parent object from which we are loading the value, and ++ DEST is the value into which we are repacking. */ ++ explicit fortran_array_repacker_impl (struct type *type, CORE_ADDR address, ++ LONGEST base_offset, ++ struct value *val, struct value *dest) ++ : fortran_array_repacker_base_impl (dest), ++ m_base_offset (base_offset), ++ m_val (val) ++ { ++ gdb_assert (!value_lazy (val)); ++ } ++ ++ /* Extract an element of ELT_TYPE at offset (M_BASE_OFFSET + ELT_OFF) ++ from the content buffer of M_VAL then copy this extracted value into ++ the repacked destination value. */ ++ void process_element (struct type *elt_type, LONGEST elt_off, bool last_p) ++ { ++ struct value *elt ++ = value_from_component (m_val, elt_type, (elt_off + m_base_offset)); ++ copy_element_to_dest (elt); ++ } ++ ++private: ++ /* The offset into the content buffer of M_VAL to the start of the slice ++ being extracted. */ ++ LONGEST m_base_offset; ++ ++ /* The parent value from which we are extracting a slice. */ ++ struct value *m_val; ++}; ++ + /* Called from evaluate_subexp_standard to perform array indexing, and + sub-range extraction, for Fortran. As well as arrays this function + also handles strings as they can be treated like arrays of characters. +@@ -200,51 +315,394 @@ static struct value * + fortran_value_subarray (struct value *array, struct expression *exp, + int *pos, int nargs, enum noside noside) + { +- if (exp->elts[*pos].opcode == OP_RANGE) +- return value_f90_subarray (array, exp, pos, noside); +- +- if (noside == EVAL_SKIP) ++ type *original_array_type = check_typedef (value_type (array)); ++ bool is_string_p = original_array_type->code () == TYPE_CODE_STRING; ++ ++ /* Perform checks for ARRAY not being available. The somewhat overly ++ complex logic here is just to keep backward compatibility with the ++ errors that we used to get before FORTRAN_VALUE_SUBARRAY was ++ rewritten. Maybe a future task would streamline the error messages we ++ get here, and update all the expected test results. */ ++ if (exp->elts[*pos].opcode != OP_RANGE) + { +- skip_undetermined_arglist (nargs, exp, pos, noside); +- /* Return the dummy value with the correct type. */ +- return array; ++ if (type_not_associated (original_array_type)) ++ error (_("no such vector element (vector not associated)")); ++ else if (type_not_allocated (original_array_type)) ++ error (_("no such vector element (vector not allocated)")); ++ } ++ else ++ { ++ if (type_not_associated (original_array_type)) ++ error (_("array not associated")); ++ else if (type_not_allocated (original_array_type)) ++ error (_("array not allocated")); + } + +- LONGEST subscript_array[MAX_FORTRAN_DIMS]; +- int ndimensions = 1; +- struct type *type = check_typedef (value_type (array)); ++ /* First check that the number of dimensions in the type we are slicing ++ matches the number of arguments we were passed. */ ++ int ndimensions = calc_f77_array_dims (original_array_type); ++ if (nargs != ndimensions) ++ error (_("Wrong number of subscripts")); + +- if (nargs > MAX_FORTRAN_DIMS) +- error (_("Too many subscripts for F77 (%d Max)"), MAX_FORTRAN_DIMS); ++ /* This will be initialised below with the type of the elements held in ++ ARRAY. */ ++ struct type *inner_element_type; + +- ndimensions = calc_f77_array_dims (type); ++ /* Extract the types of each array dimension from the original array ++ type. We need these available so we can fill in the default upper and ++ lower bounds if the user requested slice doesn't provide that ++ information. Additionally unpacking the dimensions like this gives us ++ the inner element type. */ ++ std::vector dim_types; ++ { ++ dim_types.reserve (ndimensions); ++ struct type *type = original_array_type; ++ for (int i = 0; i < ndimensions; ++i) ++ { ++ dim_types.push_back (type); ++ type = TYPE_TARGET_TYPE (type); ++ } ++ /* TYPE is now the inner element type of the array, we start the new ++ array slice off as this type, then as we process the requested slice ++ (from the user) we wrap new types around this to build up the final ++ slice type. */ ++ inner_element_type = type; ++ } + +- if (nargs != ndimensions) +- error (_("Wrong number of subscripts")); ++ /* As we analyse the new slice type we need to understand if the data ++ being referenced is contiguous. Do decide this we must track the size ++ of an element at each dimension of the new slice array. Initially the ++ elements of the inner most dimension of the array are the same inner ++ most elements as the original ARRAY. */ ++ LONGEST slice_element_size = TYPE_LENGTH (inner_element_type); ++ ++ /* Start off assuming all data is contiguous, this will be set to false ++ if access to any dimension results in non-contiguous data. */ ++ bool is_all_contiguous = true; ++ ++ /* The TOTAL_OFFSET is the distance in bytes from the start of the ++ original ARRAY to the start of the new slice. This is calculated as ++ we process the information from the user. */ ++ LONGEST total_offset = 0; ++ ++ /* A structure representing information about each dimension of the ++ resulting slice. */ ++ struct slice_dim ++ { ++ /* Constructor. */ ++ slice_dim (LONGEST l, LONGEST h, LONGEST s, struct type *idx) ++ : low (l), ++ high (h), ++ stride (s), ++ index (idx) ++ { /* Nothing. */ } ++ ++ /* The low bound for this dimension of the slice. */ ++ LONGEST low; ++ ++ /* The high bound for this dimension of the slice. */ ++ LONGEST high; ++ ++ /* The byte stride for this dimension of the slice. */ ++ LONGEST stride; ++ ++ struct type *index; ++ }; ++ ++ /* The dimensions of the resulting slice. */ ++ std::vector slice_dims; ++ ++ /* Process the incoming arguments. These arguments are in the reverse ++ order to the array dimensions, that is the first argument refers to ++ the last array dimension. */ ++ if (fortran_array_slicing_debug) ++ debug_printf ("Processing array access:\n"); ++ for (int i = 0; i < nargs; ++i) ++ { ++ /* For each dimension of the array the user will have either provided ++ a ranged access with optional lower bound, upper bound, and ++ stride, or the user will have supplied a single index. */ ++ struct type *dim_type = dim_types[ndimensions - (i + 1)]; ++ if (exp->elts[*pos].opcode == OP_RANGE) ++ { ++ int pc = (*pos) + 1; ++ enum range_flag range_flag = (enum range_flag) exp->elts[pc].longconst; ++ *pos += 3; ++ ++ LONGEST low, high, stride; ++ low = high = stride = 0; ++ ++ if ((range_flag & RANGE_LOW_BOUND_DEFAULT) == 0) ++ low = value_as_long (evaluate_subexp (nullptr, exp, pos, noside)); ++ else ++ low = f77_get_lowerbound (dim_type); ++ if ((range_flag & RANGE_HIGH_BOUND_DEFAULT) == 0) ++ high = value_as_long (evaluate_subexp (nullptr, exp, pos, noside)); ++ else ++ high = f77_get_upperbound (dim_type); ++ if ((range_flag & RANGE_HAS_STRIDE) == RANGE_HAS_STRIDE) ++ stride = value_as_long (evaluate_subexp (nullptr, exp, pos, noside)); ++ else ++ stride = 1; ++ ++ if (stride == 0) ++ error (_("stride must not be 0")); ++ ++ /* Get information about this dimension in the original ARRAY. */ ++ struct type *target_type = TYPE_TARGET_TYPE (dim_type); ++ struct type *index_type = dim_type->index_type (); ++ LONGEST lb = f77_get_lowerbound (dim_type); ++ LONGEST ub = f77_get_upperbound (dim_type); ++ LONGEST sd = index_type->bit_stride (); ++ if (sd == 0) ++ sd = TYPE_LENGTH (target_type) * 8; ++ ++ if (fortran_array_slicing_debug) ++ { ++ debug_printf ("|-> Range access\n"); ++ std::string str = type_to_string (dim_type); ++ debug_printf ("| |-> Type: %s\n", str.c_str ()); ++ debug_printf ("| |-> Array:\n"); ++ debug_printf ("| | |-> Low bound: %ld\n", lb); ++ debug_printf ("| | |-> High bound: %ld\n", ub); ++ debug_printf ("| | |-> Bit stride: %ld\n", sd); ++ debug_printf ("| | |-> Byte stride: %ld\n", sd / 8); ++ debug_printf ("| | |-> Type size: %ld\n", ++ TYPE_LENGTH (dim_type)); ++ debug_printf ("| | '-> Target type size: %ld\n", ++ TYPE_LENGTH (target_type)); ++ debug_printf ("| |-> Accessing:\n"); ++ debug_printf ("| | |-> Low bound: %ld\n", ++ low); ++ debug_printf ("| | |-> High bound: %ld\n", ++ high); ++ debug_printf ("| | '-> Element stride: %ld\n", ++ stride); ++ } ++ ++ /* Check the user hasn't asked for something invalid. */ ++ if (high > ub || low < lb) ++ error (_("array subscript out of bounds")); ++ ++ /* Calculate what this dimension of the new slice array will look ++ like. OFFSET is the byte offset from the start of the ++ previous (more outer) dimension to the start of this ++ dimension. E_COUNT is the number of elements in this ++ dimension. REMAINDER is the number of elements remaining ++ between the last included element and the upper bound. For ++ example an access '1:6:2' will include elements 1, 3, 5 and ++ have a remainder of 1 (element #6). */ ++ LONGEST lowest = std::min (low, high); ++ LONGEST offset = (sd / 8) * (lowest - lb); ++ LONGEST e_count = std::abs (high - low) + 1; ++ e_count = (e_count + (std::abs (stride) - 1)) / std::abs (stride); ++ LONGEST new_low = 1; ++ LONGEST new_high = new_low + e_count - 1; ++ LONGEST new_stride = (sd * stride) / 8; ++ LONGEST last_elem = low + ((e_count - 1) * stride); ++ LONGEST remainder = high - last_elem; ++ if (low > high) ++ { ++ offset += std::abs (remainder) * TYPE_LENGTH (target_type); ++ if (stride > 0) ++ error (_("incorrect stride and boundary combination")); ++ } ++ else if (stride < 0) ++ error (_("incorrect stride and boundary combination")); ++ ++ /* Is the data within this dimension contiguous? It is if the ++ newly computed stride is the same size as a single element of ++ this dimension. */ ++ bool is_dim_contiguous = (new_stride == slice_element_size); ++ is_all_contiguous &= is_dim_contiguous; ++ ++ if (fortran_array_slicing_debug) ++ { ++ debug_printf ("| '-> Results:\n"); ++ debug_printf ("| |-> Offset = %ld\n", offset); ++ debug_printf ("| |-> Elements = %ld\n", e_count); ++ debug_printf ("| |-> Low bound = %ld\n", new_low); ++ debug_printf ("| |-> High bound = %ld\n", new_high); ++ debug_printf ("| |-> Byte stride = %ld\n", new_stride); ++ debug_printf ("| |-> Last element = %ld\n", last_elem); ++ debug_printf ("| |-> Remainder = %ld\n", remainder); ++ debug_printf ("| '-> Contiguous = %s\n", ++ (is_dim_contiguous ? "Yes" : "No")); ++ } ++ ++ /* Figure out how big (in bytes) an element of this dimension of ++ the new array slice will be. */ ++ slice_element_size = std::abs (new_stride * e_count); ++ ++ slice_dims.emplace_back (new_low, new_high, new_stride, ++ index_type); ++ ++ /* Update the total offset. */ ++ total_offset += offset; ++ } ++ else ++ { ++ /* There is a single index for this dimension. */ ++ LONGEST index ++ = value_as_long (evaluate_subexp_with_coercion (exp, pos, noside)); ++ ++ /* Get information about this dimension in the original ARRAY. */ ++ struct type *target_type = TYPE_TARGET_TYPE (dim_type); ++ struct type *index_type = dim_type->index_type (); ++ LONGEST lb = f77_get_lowerbound (dim_type); ++ LONGEST ub = f77_get_upperbound (dim_type); ++ LONGEST sd = index_type->bit_stride () / 8; ++ if (sd == 0) ++ sd = TYPE_LENGTH (target_type); ++ ++ if (fortran_array_slicing_debug) ++ { ++ debug_printf ("|-> Index access\n"); ++ std::string str = type_to_string (dim_type); ++ debug_printf ("| |-> Type: %s\n", str.c_str ()); ++ debug_printf ("| |-> Array:\n"); ++ debug_printf ("| | |-> Low bound: %ld\n", lb); ++ debug_printf ("| | |-> High bound: %ld\n", ub); ++ debug_printf ("| | |-> Byte stride: %ld\n", sd); ++ debug_printf ("| | |-> Type size: %ld\n", TYPE_LENGTH (dim_type)); ++ debug_printf ("| | '-> Target type size: %ld\n", ++ TYPE_LENGTH (target_type)); ++ debug_printf ("| '-> Accessing:\n"); ++ debug_printf ("| '-> Index: %ld\n", index); ++ } ++ ++ /* If the array has actual content then check the index is in ++ bounds. An array without content (an unbound array) doesn't ++ have a known upper bound, so don't error check in that ++ situation. */ ++ if (index < lb ++ || (dim_type->index_type ()->bounds ()->high.kind () != PROP_UNDEFINED ++ && index > ub) ++ || (VALUE_LVAL (array) != lval_memory ++ && dim_type->index_type ()->bounds ()->high.kind () == PROP_UNDEFINED)) ++ { ++ if (type_not_associated (dim_type)) ++ error (_("no such vector element (vector not associated)")); ++ else if (type_not_allocated (dim_type)) ++ error (_("no such vector element (vector not allocated)")); ++ else ++ error (_("no such vector element")); ++ } + +- gdb_assert (nargs > 0); ++ /* Calculate using the type stride, not the target type size. */ ++ LONGEST offset = sd * (index - lb); ++ total_offset += offset; ++ } ++ } + +- /* Now that we know we have a legal array subscript expression let us +- actually find out where this element exists in the array. */ ++ if (noside == EVAL_SKIP) ++ return array; + +- /* Take array indices left to right. */ +- for (int i = 0; i < nargs; i++) ++ /* Build a type that represents the new array slice in the target memory ++ of the original ARRAY, this type makes use of strides to correctly ++ find only those elements that are part of the new slice. */ ++ struct type *array_slice_type = inner_element_type; ++ for (const auto &d : slice_dims) + { +- /* Evaluate each subscript; it must be a legal integer in F77. */ +- value *arg2 = evaluate_subexp_with_coercion (exp, pos, noside); ++ /* Create the range. */ ++ dynamic_prop p_low, p_high, p_stride; ++ ++ p_low.set_const_val (d.low); ++ p_high.set_const_val (d.high); ++ p_stride.set_const_val (d.stride); ++ ++ struct type *new_range ++ = create_range_type_with_stride ((struct type *) NULL, ++ TYPE_TARGET_TYPE (d.index), ++ &p_low, &p_high, 0, &p_stride, ++ true); ++ array_slice_type ++ = create_array_type (nullptr, array_slice_type, new_range); ++ } + +- /* Fill in the subscript array. */ +- subscript_array[i] = value_as_long (arg2); ++ if (fortran_array_slicing_debug) ++ { ++ debug_printf ("'-> Final result:\n"); ++ debug_printf (" |-> Type: %s\n", ++ type_to_string (array_slice_type).c_str ()); ++ debug_printf (" |-> Total offset: %ld\n", total_offset); ++ debug_printf (" |-> Base address: %s\n", ++ core_addr_to_string (value_address (array))); ++ debug_printf (" '-> Contiguous = %s\n", ++ (is_all_contiguous ? "Yes" : "No")); + } + +- /* Internal type of array is arranged right to left. */ +- for (int i = nargs; i > 0; i--) ++ /* Should we repack this array slice? */ ++ if (!is_all_contiguous && (repack_array_slices || is_string_p)) + { +- struct type *array_type = check_typedef (value_type (array)); +- LONGEST index = subscript_array[i - 1]; ++ /* Build a type for the repacked slice. */ ++ struct type *repacked_array_type = inner_element_type; ++ for (const auto &d : slice_dims) ++ { ++ /* Create the range. */ ++ dynamic_prop p_low, p_high, p_stride; ++ ++ p_low.set_const_val (d.low); ++ p_high.set_const_val (d.high); ++ p_stride.set_const_val (TYPE_LENGTH (repacked_array_type)); ++ ++ struct type *new_range ++ = create_range_type_with_stride ((struct type *) NULL, ++ TYPE_TARGET_TYPE (d.index), ++ &p_low, &p_high, 0, &p_stride, ++ true); ++ repacked_array_type ++ = create_array_type (nullptr, repacked_array_type, new_range); ++ } + +- array = value_subscripted_rvalue (array, index, +- f77_get_lowerbound (array_type)); ++ /* Now copy the elements from the original ARRAY into the packed ++ array value DEST. */ ++ struct value *dest = allocate_value (repacked_array_type); ++ if (value_lazy (array) ++ || (total_offset + TYPE_LENGTH (array_slice_type) ++ > TYPE_LENGTH (check_typedef (value_type (array))))) ++ { ++ fortran_array_walker p ++ (array_slice_type, value_address (array) + total_offset, dest); ++ p.walk (); ++ } ++ else ++ { ++ fortran_array_walker p ++ (array_slice_type, value_address (array) + total_offset, ++ total_offset, array, dest); ++ p.walk (); ++ } ++ array = dest; ++ } ++ else ++ { ++ if (VALUE_LVAL (array) == lval_memory) ++ { ++ /* If the value we're taking a slice from is not yet loaded, or ++ the requested slice is outside the values content range then ++ just create a new lazy value pointing at the memory where the ++ contents we're looking for exist. */ ++ if (value_lazy (array) ++ || (total_offset + TYPE_LENGTH (array_slice_type) ++ > TYPE_LENGTH (check_typedef (value_type (array))))) ++ array = value_at_lazy (array_slice_type, ++ value_address (array) + total_offset); ++ else ++ array = value_from_contents_and_address (array_slice_type, ++ (value_contents (array) ++ + total_offset), ++ (value_address (array) ++ + total_offset)); ++ } ++ else if (!value_lazy (array)) ++ { ++ const void *valaddr = value_contents (array) + total_offset; ++ array = allocate_value (array_slice_type); ++ memcpy (value_contents_raw (array), valaddr, TYPE_LENGTH (array_slice_type)); ++ } ++ else ++ error (_("cannot subscript arrays that are not in memory")); + } + + return array; +@@ -1031,11 +1489,50 @@ builtin_f_type (struct gdbarch *gdbarch) + return (const struct builtin_f_type *) gdbarch_data (gdbarch, f_type_data); + } + ++/* Command-list for the "set/show fortran" prefix command. */ ++static struct cmd_list_element *set_fortran_list; ++static struct cmd_list_element *show_fortran_list; ++ + void _initialize_f_language (); + void + _initialize_f_language () + { + f_type_data = gdbarch_data_register_post_init (build_fortran_types); ++ ++ add_basic_prefix_cmd ("fortran", no_class, ++ _("Prefix command for changing Fortran-specific settings."), ++ &set_fortran_list, "set fortran ", 0, &setlist); ++ ++ add_show_prefix_cmd ("fortran", no_class, ++ _("Generic command for showing Fortran-specific settings."), ++ &show_fortran_list, "show fortran ", 0, &showlist); ++ ++ add_setshow_boolean_cmd ("repack-array-slices", class_vars, ++ &repack_array_slices, _("\ ++Enable or disable repacking of non-contiguous array slices."), _("\ ++Show whether non-contiguous array slices are repacked."), _("\ ++When the user requests a slice of a Fortran array then we can either return\n\ ++a descriptor that describes the array in place (using the original array data\n\ ++in its existing location) or the original data can be repacked (copied) to a\n\ ++new location.\n\ ++\n\ ++When the content of the array slice is contiguous within the original array\n\ ++then the result will never be repacked, but when the data for the new array\n\ ++is non-contiguous within the original array repacking will only be performed\n\ ++when this setting is on."), ++ NULL, ++ show_repack_array_slices, ++ &set_fortran_list, &show_fortran_list); ++ ++ /* Debug Fortran's array slicing logic. */ ++ add_setshow_boolean_cmd ("fortran-array-slicing", class_maintenance, ++ &fortran_array_slicing_debug, _("\ ++Set debugging of Fortran array slicing."), _("\ ++Show debugging of Fortran array slicing."), _("\ ++When on, debugging of Fortran array slicing is enabled."), ++ NULL, ++ show_fortran_array_slicing_debug, ++ &setdebuglist, &showdebuglist); + } + + /* See f-lang.h. */ +@@ -1074,3 +1571,56 @@ fortran_preserve_arg_pointer (struct value *arg, struct type *type) + return value_type (arg); + return type; + } ++ ++/* See f-lang.h. */ ++ ++CORE_ADDR ++fortran_adjust_dynamic_array_base_address_hack (struct type *type, ++ CORE_ADDR address) ++{ ++ gdb_assert (type->code () == TYPE_CODE_ARRAY); ++ ++ int ndimensions = calc_f77_array_dims (type); ++ LONGEST total_offset = 0; ++ ++ /* Walk through each of the dimensions of this array type and figure out ++ if any of the dimensions are "backwards", that is the base address ++ for this dimension points to the element at the highest memory ++ address and the stride is negative. */ ++ struct type *tmp_type = type; ++ for (int i = 0 ; i < ndimensions; ++i) ++ { ++ /* Grab the range for this dimension and extract the lower and upper ++ bounds. */ ++ tmp_type = check_typedef (tmp_type); ++ struct type *range_type = tmp_type->index_type (); ++ LONGEST lowerbound, upperbound, stride; ++ if (!get_discrete_bounds (range_type, &lowerbound, &upperbound)) ++ error ("failed to get range bounds"); ++ ++ /* Figure out the stride for this dimension. */ ++ struct type *elt_type = check_typedef (TYPE_TARGET_TYPE (tmp_type)); ++ stride = tmp_type->index_type ()->bounds ()->bit_stride (); ++ if (stride == 0) ++ stride = type_length_units (elt_type); ++ else ++ { ++ struct gdbarch *arch = get_type_arch (elt_type); ++ int unit_size = gdbarch_addressable_memory_unit_size (arch); ++ stride /= (unit_size * 8); ++ } ++ ++ /* If this dimension is "backward" then figure out the offset ++ adjustment required to point to the element at the lowest memory ++ address, and add this to the total offset. */ ++ LONGEST offset = 0; ++ if (stride < 0 && lowerbound < upperbound) ++ offset = (upperbound - lowerbound) * stride; ++ total_offset += offset; ++ tmp_type = TYPE_TARGET_TYPE (tmp_type); ++ } ++ ++ /* Adjust the address of this object and return it. */ ++ address += total_offset; ++ return address; ++} +diff --git a/gdb/f-lang.h b/gdb/f-lang.h +--- a/gdb/f-lang.h ++++ b/gdb/f-lang.h +@@ -64,7 +64,6 @@ extern void f77_get_dynamic_array_length (struct type *); + + extern int calc_f77_array_dims (struct type *); + +- + /* Fortran (F77) types */ + + struct builtin_f_type +@@ -122,4 +121,22 @@ extern struct value *fortran_argument_convert (struct value *value, + extern struct type *fortran_preserve_arg_pointer (struct value *arg, + struct type *type); + ++/* Fortran arrays can have a negative stride. When this happens it is ++ often the case that the base address for an object is not the lowest ++ address occupied by that object. For example, an array slice (10:1:-1) ++ will be encoded with lower bound 1, upper bound 10, a stride of ++ -ELEMENT_SIZE, and have a base address pointer that points at the ++ element with the highest address in memory. ++ ++ This really doesn't play well with our current model of value contents, ++ but could easily require a significant update in order to be supported ++ "correctly". ++ ++ For now, we manually force the base address to be the lowest addressed ++ element here. Yes, this will break some things, but it fixes other ++ things. The hope is that it fixes more than it breaks. */ ++ ++extern CORE_ADDR fortran_adjust_dynamic_array_base_address_hack ++ (struct type *type, CORE_ADDR address); ++ + #endif /* F_LANG_H */ +diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c +--- a/gdb/f-valprint.c ++++ b/gdb/f-valprint.c +@@ -35,6 +35,7 @@ + #include "dictionary.h" + #include "cli/cli-style.h" + #include "gdbarch.h" ++#include "f-array-walker.h" + + static void f77_get_dynamic_length_of_aggregate (struct type *); + +@@ -100,100 +101,103 @@ f77_get_dynamic_length_of_aggregate (struct type *type) + * TYPE_LENGTH (check_typedef (TYPE_TARGET_TYPE (type))); + } + +-/* Actual function which prints out F77 arrays, Valaddr == address in +- the superior. Address == the address in the inferior. */ ++/* A class used by FORTRAN_PRINT_ARRAY as a specialisation of the array ++ walking template. This specialisation prints Fortran arrays. */ + +-static void +-f77_print_array_1 (int nss, int ndimensions, struct type *type, +- const gdb_byte *valaddr, +- int embedded_offset, CORE_ADDR address, +- struct ui_file *stream, int recurse, +- const struct value *val, +- const struct value_print_options *options, +- int *elts) ++class fortran_array_printer_impl : public fortran_array_walker_base_impl + { +- struct type *range_type = check_typedef (type)->index_type (); +- CORE_ADDR addr = address + embedded_offset; +- LONGEST lowerbound, upperbound; +- LONGEST i; +- +- get_discrete_bounds (range_type, &lowerbound, &upperbound); +- +- if (nss != ndimensions) +- { +- struct gdbarch *gdbarch = get_type_arch (type); +- size_t dim_size = type_length_units (TYPE_TARGET_TYPE (type)); +- int unit_size = gdbarch_addressable_memory_unit_size (gdbarch); +- size_t byte_stride = type->bit_stride () / (unit_size * 8); +- if (byte_stride == 0) +- byte_stride = dim_size; +- size_t offs = 0; +- +- for (i = lowerbound; +- (i < upperbound + 1 && (*elts) < options->print_max); +- i++) +- { +- struct value *subarray = value_from_contents_and_address +- (TYPE_TARGET_TYPE (type), value_contents_for_printing_const (val) +- + offs, addr + offs); +- +- fprintf_filtered (stream, "("); +- f77_print_array_1 (nss + 1, ndimensions, value_type (subarray), +- value_contents_for_printing (subarray), +- value_embedded_offset (subarray), +- value_address (subarray), +- stream, recurse, subarray, options, elts); +- offs += byte_stride; +- fprintf_filtered (stream, ")"); +- +- if (i < upperbound) +- fprintf_filtered (stream, " "); +- } +- if (*elts >= options->print_max && i < upperbound) +- fprintf_filtered (stream, "..."); +- } +- else +- { +- for (i = lowerbound; i < upperbound + 1 && (*elts) < options->print_max; +- i++, (*elts)++) +- { +- struct value *elt = value_subscript ((struct value *)val, i); +- +- common_val_print (elt, stream, recurse, options, current_language); +- +- if (i != upperbound) +- fprintf_filtered (stream, ", "); +- +- if ((*elts == options->print_max - 1) +- && (i != upperbound)) +- fprintf_filtered (stream, "..."); +- } +- } +-} ++public: ++ /* Constructor. TYPE is the array type being printed, ADDRESS is the ++ address in target memory for the object of TYPE being printed. VAL is ++ the GDB value (of TYPE) being printed. STREAM is where to print to, ++ RECOURSE is passed through (and prevents infinite recursion), and ++ OPTIONS are the printing control options. */ ++ explicit fortran_array_printer_impl (struct type *type, ++ CORE_ADDR address, ++ struct value *val, ++ struct ui_file *stream, ++ int recurse, ++ const struct value_print_options *options) ++ : m_elts (0), ++ m_val (val), ++ m_stream (stream), ++ m_recurse (recurse), ++ m_options (options) ++ { /* Nothing. */ } ++ ++ /* Called while iterating over the array bounds. When SHOULD_CONTINUE is ++ false then we must return false, as we have reached the end of the ++ array bounds for this dimension. However, we also return false if we ++ have printed too many elements (after printing '...'). In all other ++ cases, return true. */ ++ bool continue_walking (bool should_continue) ++ { ++ bool cont = should_continue && (m_elts < m_options->print_max); ++ if (!cont && should_continue) ++ fputs_filtered ("...", m_stream); ++ return cont; ++ } ++ ++ /* Called when we start iterating over a dimension. If it's not the ++ inner most dimension then print an opening '(' character. */ ++ void start_dimension (bool inner_p) ++ { ++ fputs_filtered ("(", m_stream); ++ } ++ ++ /* Called when we finish processing a batch of items within a dimension ++ of the array. Depending on whether this is the inner most dimension ++ or not we print different things, but this is all about adding ++ separators between elements, and dimensions of the array. */ ++ void finish_dimension (bool inner_p, bool last_p) ++ { ++ fputs_filtered (")", m_stream); ++ if (!last_p) ++ fputs_filtered (" ", m_stream); ++ } ++ ++ /* Called to process an element of ELT_TYPE at offset ELT_OFF from the ++ start of the parent object. */ ++ void process_element (struct type *elt_type, LONGEST elt_off, bool last_p) ++ { ++ /* Extract the element value from the parent value. */ ++ struct value *e_val ++ = value_from_component (m_val, elt_type, elt_off); ++ common_val_print (e_val, m_stream, m_recurse, m_options, current_language); ++ if (!last_p) ++ fputs_filtered (", ", m_stream); ++ ++m_elts; ++ } ++ ++private: ++ /* The number of elements printed so far. */ ++ int m_elts; ++ ++ /* The value from which we are printing elements. */ ++ struct value *m_val; ++ ++ /* The stream we should print too. */ ++ struct ui_file *m_stream; ++ ++ /* The recursion counter, passed through when we print each element. */ ++ int m_recurse; ++ ++ /* The print control options. Gives us the maximum number of elements to ++ print, and is passed through to each element that we print. */ ++ const struct value_print_options *m_options = nullptr; ++}; + +-/* This function gets called to print an F77 array, we set up some +- stuff and then immediately call f77_print_array_1(). */ ++/* This function gets called to print a Fortran array. */ + + static void +-f77_print_array (struct type *type, const gdb_byte *valaddr, +- int embedded_offset, +- CORE_ADDR address, struct ui_file *stream, +- int recurse, +- const struct value *val, +- const struct value_print_options *options) ++fortran_print_array (struct type *type, CORE_ADDR address, ++ struct ui_file *stream, int recurse, ++ const struct value *val, ++ const struct value_print_options *options) + { +- int ndimensions; +- int elts = 0; +- +- ndimensions = calc_f77_array_dims (type); +- +- if (ndimensions > MAX_FORTRAN_DIMS || ndimensions < 0) +- error (_("\ +-Type node corrupt! F77 arrays cannot have %d subscripts (%d Max)"), +- ndimensions, MAX_FORTRAN_DIMS); +- +- f77_print_array_1 (1, ndimensions, type, valaddr, embedded_offset, +- address, stream, recurse, val, options, &elts); ++ fortran_array_walker p ++ (type, address, (struct value *) val, stream, recurse, options); ++ p.walk (); + } + + +@@ -236,12 +240,7 @@ f_value_print_inner (struct value *val, struct ui_file *stream, int recurse, + + case TYPE_CODE_ARRAY: + if (TYPE_TARGET_TYPE (type)->code () != TYPE_CODE_CHAR) +- { +- fprintf_filtered (stream, "("); +- f77_print_array (type, valaddr, 0, +- address, stream, recurse, val, options); +- fprintf_filtered (stream, ")"); +- } ++ fortran_print_array (type, address, stream, recurse, val, options); + else + { + struct type *ch_type = TYPE_TARGET_TYPE (type); +diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c +--- a/gdb/gdbtypes.c ++++ b/gdb/gdbtypes.c +@@ -39,6 +39,7 @@ + #include "dwarf2/loc.h" + #include "gdbcore.h" + #include "floatformat.h" ++#include "f-lang.h" + #include + + /* Initialize BADNESS constants. */ +@@ -2695,7 +2696,16 @@ resolve_dynamic_type_internal (struct type *type, + prop = TYPE_DATA_LOCATION (resolved_type); + if (prop != NULL + && dwarf2_evaluate_property (prop, NULL, addr_stack, &value)) +- prop->set_const_val (value); ++ { ++ /* Start of Fortran hack. See comment in f-lang.h for what is going ++ on here.*/ ++ if (current_language->la_language == language_fortran ++ && resolved_type->code () == TYPE_CODE_ARRAY) ++ value = fortran_adjust_dynamic_array_base_address_hack (resolved_type, ++ value); ++ /* End of Fortran hack. */ ++ prop->set_const_val (value); ++ } + + return resolved_type; + } +@@ -3600,9 +3610,11 @@ is_scalar_type_recursive (struct type *t) + LONGEST low_bound, high_bound; + struct type *elt_type = check_typedef (TYPE_TARGET_TYPE (t)); + +- get_discrete_bounds (t->index_type (), &low_bound, &high_bound); +- +- return high_bound == low_bound && is_scalar_type_recursive (elt_type); ++ if (get_discrete_bounds (t->index_type (), &low_bound, &high_bound)) ++ return (high_bound == low_bound ++ && is_scalar_type_recursive (elt_type)); ++ else ++ return 0; + } + /* Are we dealing with a struct with one element? */ + else if (t->code () == TYPE_CODE_STRUCT && t->num_fields () == 1) +diff --git a/gdb/testsuite/gdb.fortran/array-slices-bad.exp b/gdb/testsuite/gdb.fortran/array-slices-bad.exp +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.fortran/array-slices-bad.exp +@@ -0,0 +1,69 @@ ++# Copyright 2020 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++ ++# Test invalid element and slice array accesses. ++ ++if {[skip_fortran_tests]} { return -1 } ++ ++standard_testfile ".f90" ++load_lib fortran.exp ++ ++if {[prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \ ++ {debug f90}]} { ++ return -1 ++} ++ ++if ![fortran_runto_main] { ++ untested "could not run to main" ++ return -1 ++} ++ ++# gdb_breakpoint [gdb_get_line_number "Display Message Breakpoint"] ++gdb_breakpoint [gdb_get_line_number "First Breakpoint"] ++gdb_breakpoint [gdb_get_line_number "Second Breakpoint"] ++gdb_breakpoint [gdb_get_line_number "Final Breakpoint"] ++ ++gdb_continue_to_breakpoint "First Breakpoint" ++ ++# Access not yet allocated array. ++gdb_test "print other" " = " ++gdb_test "print other(0:4,2:3)" "array not allocated" ++gdb_test "print other(1,1)" "no such vector element \\(vector not allocated\\)" ++ ++# Access not yet associated pointer. ++gdb_test "print pointer2d" " = " ++gdb_test "print pointer2d(1:2,1:2)" "array not associated" ++gdb_test "print pointer2d(1,1)" "no such vector element \\(vector not associated\\)" ++ ++gdb_continue_to_breakpoint "Second Breakpoint" ++ ++# Accessing just outside the arrays. ++foreach name {array pointer2d other} { ++ gdb_test "print $name (0:,:)" "array subscript out of bounds" ++ gdb_test "print $name (:11,:)" "array subscript out of bounds" ++ gdb_test "print $name (:,0:)" "array subscript out of bounds" ++ gdb_test "print $name (:,:11)" "array subscript out of bounds" ++ ++ gdb_test "print $name (0,:)" "no such vector element" ++ gdb_test "print $name (11,:)" "no such vector element" ++ gdb_test "print $name (:,0)" "no such vector element" ++ gdb_test "print $name (:,11)" "no such vector element" ++} ++ ++# Stride in the wrong direction. ++gdb_test "print array (1:10:-1,:)" "incorrect stride and boundary combination" ++gdb_test "print array (:,1:10:-1)" "incorrect stride and boundary combination" ++gdb_test "print array (10:1:1,:)" "incorrect stride and boundary combination" ++gdb_test "print array (:,10:1:1)" "incorrect stride and boundary combination" +diff --git a/gdb/testsuite/gdb.fortran/array-slices-bad.f90 b/gdb/testsuite/gdb.fortran/array-slices-bad.f90 +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.fortran/array-slices-bad.f90 +@@ -0,0 +1,42 @@ ++! Copyright 2020 Free Software Foundation, Inc. ++! ++! This program is free software; you can redistribute it and/or modify ++! it under the terms of the GNU General Public License as published by ++! the Free Software Foundation; either version 3 of the License, or ++! (at your option) any later version. ++! ++! This program is distributed in the hope that it will be useful, ++! but WITHOUT ANY WARRANTY; without even the implied warranty of ++! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++! GNU General Public License for more details. ++! ++! You should have received a copy of the GNU General Public License ++! along with this program. If not, see . ++ ++! ++! Start of test program. ++! ++program test ++ ++ ! Declare variables used in this test. ++ integer, dimension (1:10,1:10) :: array ++ integer, allocatable :: other (:, :) ++ integer, dimension(:,:), pointer :: pointer2d => null() ++ integer, dimension(1:10,1:10), target :: tarray ++ ++ print *, "" ! First Breakpoint. ++ ++ ! Allocate or associate any variables as needed. ++ allocate (other (1:10, 1:10)) ++ pointer2d => tarray ++ array = 0 ++ ++ print *, "" ! Second Breakpoint. ++ ++ ! All done. Deallocate. ++ deallocate (other) ++ ++ ! GDB catches this final breakpoint to indicate the end of the test. ++ print *, "" ! Final Breakpoint. ++ ++end program test +diff --git a/gdb/testsuite/gdb.fortran/array-slices-sub-slices.exp b/gdb/testsuite/gdb.fortran/array-slices-sub-slices.exp +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.fortran/array-slices-sub-slices.exp +@@ -0,0 +1,111 @@ ++# Copyright 2020 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++ ++# Create a slice of an array, then take a slice of that slice. ++ ++if {[skip_fortran_tests]} { return -1 } ++ ++standard_testfile ".f90" ++load_lib fortran.exp ++ ++if {[prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \ ++ {debug f90}]} { ++ return -1 ++} ++ ++if ![fortran_runto_main] { ++ untested "could not run to main" ++ return -1 ++} ++ ++# gdb_breakpoint [gdb_get_line_number "Display Message Breakpoint"] ++gdb_breakpoint [gdb_get_line_number "Stop Here"] ++gdb_breakpoint [gdb_get_line_number "Final Breakpoint"] ++ ++# We're going to print some reasonably large arrays. ++gdb_test_no_output "set print elements unlimited" ++ ++gdb_continue_to_breakpoint "Stop Here" ++ ++# Print a slice, capture the convenience variable name created. ++set cmd "print array (1:10:2, 1:10:2)" ++gdb_test_multiple $cmd $cmd { ++ -re "\r\n\\\$(\\d+) = .*\r\n$gdb_prompt $" { ++ set varname "\$$expect_out(1,string)" ++ } ++} ++ ++# Now check that we can correctly extract all the elements from this ++# slice. ++for { set j 1 } { $j < 6 } { incr j } { ++ for { set i 1 } { $i < 6 } { incr i } { ++ set val [expr ((($i - 1) * 2) + (($j - 1) * 20)) + 1] ++ gdb_test "print ${varname} ($i,$j)" " = $val" ++ } ++} ++ ++# Now take a slice of the slice. ++gdb_test "print ${varname} (3:5, 3:5)" \ ++ " = \\(\\(45, 47, 49\\) \\(65, 67, 69\\) \\(85, 87, 89\\)\\)" ++ ++# Now take a different slice of a slice. ++set cmd "print ${varname} (1:5:2, 1:5:2)" ++gdb_test_multiple $cmd $cmd { ++ -re "\r\n\\\$(\\d+) = \\(\\(1, 5, 9\\) \\(41, 45, 49\\) \\(81, 85, 89\\)\\)\r\n$gdb_prompt $" { ++ set varname "\$$expect_out(1,string)" ++ pass $gdb_test_name ++ } ++} ++ ++# Now take a slice from the slice, of a slice! ++set cmd "print ${varname} (1:3:2, 1:3:2)" ++gdb_test_multiple $cmd $cmd { ++ -re "\r\n\\\$(\\d+) = \\(\\(1, 9\\) \\(81, 89\\)\\)\r\n$gdb_prompt $" { ++ set varname "\$$expect_out(1,string)" ++ pass $gdb_test_name ++ } ++} ++ ++# And again! ++set cmd "print ${varname} (1:2:2, 1:2:2)" ++gdb_test_multiple $cmd $cmd { ++ -re "\r\n\\\$(\\d+) = \\(\\(1\\)\\)\r\n$gdb_prompt $" { ++ set varname "\$$expect_out(1,string)" ++ pass $gdb_test_name ++ } ++} ++ ++# Test taking a slice with stride of a string. This isn't actually ++# supported within gfortran (at least), but naturally drops out of how ++# GDB models arrays and strings in a similar way, so we may as well ++# test that this is still working. ++gdb_test "print str (1:26:2)" " = 'acegikmoqsuwy'" ++gdb_test "print str (26:1:-1)" " = 'zyxwvutsrqponmlkjihgfedcba'" ++gdb_test "print str (26:1:-2)" " = 'zxvtrpnljhfdb'" ++ ++# Now test the memory requirements of taking a slice from an array. ++# The idea is that we shouldn't require more memory to extract a slice ++# than the size of the slice. ++# ++# This will only work if array repacking is turned on, otherwise GDB ++# will create the slice by generating a new type that sits over the ++# existing value in memory. ++gdb_test_no_output "set fortran repack-array-slices on" ++set element_size [get_integer_valueof "sizeof (array (1,1))" "unknown"] ++set slice_size [expr $element_size * 4] ++gdb_test_no_output "set max-value-size $slice_size" ++gdb_test "print array (1:2, 1:2)" "= \\(\\(1, 2\\) \\(11, 12\\)\\)" ++gdb_test "print array (2:3, 2:3)" "= \\(\\(12, 13\\) \\(22, 23\\)\\)" ++gdb_test "print array (2:5:2, 2:5:2)" "= \\(\\(12, 14\\) \\(32, 34\\)\\)" +diff --git a/gdb/testsuite/gdb.fortran/array-slices-sub-slices.f90 b/gdb/testsuite/gdb.fortran/array-slices-sub-slices.f90 +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.fortran/array-slices-sub-slices.f90 +@@ -0,0 +1,96 @@ ++! Copyright 2020 Free Software Foundation, Inc. ++! ++! This program is free software; you can redistribute it and/or modify ++! it under the terms of the GNU General Public License as published by ++! the Free Software Foundation; either version 3 of the License, or ++! (at your option) any later version. ++! ++! This program is distributed in the hope that it will be useful, ++! but WITHOUT ANY WARRANTY; without even the implied warranty of ++! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++! GNU General Public License for more details. ++! ++! You should have received a copy of the GNU General Public License ++! along with this program. If not, see . ++ ++! ++! Start of test program. ++! ++program test ++ integer, dimension (1:10,1:11) :: array ++ character (len=26) :: str = "abcdefghijklmnopqrstuvwxyz" ++ ++ call fill_array_2d (array) ++ ++ ! GDB catches this final breakpoint to indicate the end of the test. ++ print *, "" ! Stop Here ++ ++ print *, array ++ print *, str ++ ++ ! GDB catches this final breakpoint to indicate the end of the test. ++ print *, "" ! Final Breakpoint. ++ ++contains ++ ++ ! Fill a 1D array with a unique positive integer in each element. ++ subroutine fill_array_1d (array) ++ integer, dimension (:) :: array ++ integer :: counter ++ ++ counter = 1 ++ do j=LBOUND (array, 1), UBOUND (array, 1), 1 ++ array (j) = counter ++ counter = counter + 1 ++ end do ++ end subroutine fill_array_1d ++ ++ ! Fill a 2D array with a unique positive integer in each element. ++ subroutine fill_array_2d (array) ++ integer, dimension (:,:) :: array ++ integer :: counter ++ ++ counter = 1 ++ do i=LBOUND (array, 2), UBOUND (array, 2), 1 ++ do j=LBOUND (array, 1), UBOUND (array, 1), 1 ++ array (j,i) = counter ++ counter = counter + 1 ++ end do ++ end do ++ end subroutine fill_array_2d ++ ++ ! Fill a 3D array with a unique positive integer in each element. ++ subroutine fill_array_3d (array) ++ integer, dimension (:,:,:) :: array ++ integer :: counter ++ ++ counter = 1 ++ do i=LBOUND (array, 3), UBOUND (array, 3), 1 ++ do j=LBOUND (array, 2), UBOUND (array, 2), 1 ++ do k=LBOUND (array, 1), UBOUND (array, 1), 1 ++ array (k, j,i) = counter ++ counter = counter + 1 ++ end do ++ end do ++ end do ++ end subroutine fill_array_3d ++ ++ ! Fill a 4D array with a unique positive integer in each element. ++ subroutine fill_array_4d (array) ++ integer, dimension (:,:,:,:) :: array ++ integer :: counter ++ ++ counter = 1 ++ do i=LBOUND (array, 4), UBOUND (array, 4), 1 ++ do j=LBOUND (array, 3), UBOUND (array, 3), 1 ++ do k=LBOUND (array, 2), UBOUND (array, 2), 1 ++ do l=LBOUND (array, 1), UBOUND (array, 1), 1 ++ array (l, k, j,i) = counter ++ counter = counter + 1 ++ end do ++ end do ++ end do ++ end do ++ print *, "" ++ end subroutine fill_array_4d ++end program test +diff --git a/gdb/testsuite/gdb.fortran/array-slices.exp b/gdb/testsuite/gdb.fortran/array-slices.exp +--- a/gdb/testsuite/gdb.fortran/array-slices.exp ++++ b/gdb/testsuite/gdb.fortran/array-slices.exp +@@ -18,6 +18,21 @@ + # the subroutine. This should exercise GDB's ability to handle + # different strides for the different dimensions. + ++# Testing GDB's ability to print array (and string) slices, including ++# slices that make use of array strides. ++# ++# In the Fortran code various arrays of different ranks are filled ++# with data, and slices are passed to a series of show functions. ++# ++# In this test script we break in each of the show functions, print ++# the array slice that was passed in, and then move up the stack to ++# the parent frame and check GDB can manually extract the same slice. ++# ++# This test also checks that the size of the array slice passed to the ++# function (so as extracted and described by the compiler and the ++# debug information) matches the size of the slice manually extracted ++# by GDB. ++ + if {[skip_fortran_tests]} { return -1 } + + standard_testfile ".f90" +@@ -28,57 +43,224 @@ if {[prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \ + return -1 + } + +-if ![fortran_runto_main] { +- untested "could not run to main" +- return -1 ++# Takes the name of an array slice as used in the test source, and extracts ++# the base array name. For example: 'array (1,2)' becomes 'array'. ++proc array_slice_to_var { slice_str } { ++ regexp "^(?:\\s*\\()*(\[^( \t\]+)" $slice_str matchvar varname ++ return $varname + } + +-gdb_breakpoint "show" +-gdb_breakpoint [gdb_get_line_number "Final Breakpoint"] +- +-set array_contents \ +- [list \ +- " = \\(\\(1, 2, 3, 4, 5, 6, 7, 8, 9, 10\\) \\(11, 12, 13, 14, 15, 16, 17, 18, 19, 20\\) \\(21, 22, 23, 24, 25, 26, 27, 28, 29, 30\\) \\(31, 32, 33, 34, 35, 36, 37, 38, 39, 40\\) \\(41, 42, 43, 44, 45, 46, 47, 48, 49, 50\\) \\(51, 52, 53, 54, 55, 56, 57, 58, 59, 60\\) \\(61, 62, 63, 64, 65, 66, 67, 68, 69, 70\\) \\(71, 72, 73, 74, 75, 76, 77, 78, 79, 80\\) \\(81, 82, 83, 84, 85, 86, 87, 88, 89, 90\\) \\(91, 92, 93, 94, 95, 96, 97, 98, 99, 100\\)\\)" \ +- " = \\(\\(1, 2, 3, 4, 5\\) \\(11, 12, 13, 14, 15\\) \\(21, 22, 23, 24, 25\\) \\(31, 32, 33, 34, 35\\) \\(41, 42, 43, 44, 45\\)\\)" \ +- " = \\(\\(1, 3, 5, 7, 9\\) \\(21, 23, 25, 27, 29\\) \\(41, 43, 45, 47, 49\\) \\(61, 63, 65, 67, 69\\) \\(81, 83, 85, 87, 89\\)\\)" \ +- " = \\(\\(1, 4, 7, 10\\) \\(21, 24, 27, 30\\) \\(41, 44, 47, 50\\) \\(61, 64, 67, 70\\) \\(81, 84, 87, 90\\)\\)" \ +- " = \\(\\(1, 5, 9\\) \\(31, 35, 39\\) \\(61, 65, 69\\) \\(91, 95, 99\\)\\)" \ +- " = \\(\\(-26, -25, -24, -23, -22, -21, -20, -19, -18, -17\\) \\(-19, -18, -17, -16, -15, -14, -13, -12, -11, -10\\) \\(-12, -11, -10, -9, -8, -7, -6, -5, -4, -3\\) \\(-5, -4, -3, -2, -1, 0, 1, 2, 3, 4\\) \\(2, 3, 4, 5, 6, 7, 8, 9, 10, 11\\) \\(9, 10, 11, 12, 13, 14, 15, 16, 17, 18\\) \\(16, 17, 18, 19, 20, 21, 22, 23, 24, 25\\) \\(23, 24, 25, 26, 27, 28, 29, 30, 31, 32\\) \\(30, 31, 32, 33, 34, 35, 36, 37, 38, 39\\) \\(37, 38, 39, 40, 41, 42, 43, 44, 45, 46\\)\\)" \ +- " = \\(\\(-26, -25, -24, -23, -22, -21\\) \\(-19, -18, -17, -16, -15, -14\\) \\(-12, -11, -10, -9, -8, -7\\)\\)" \ +- " = \\(\\(-26, -24, -22, -20, -18\\) \\(-5, -3, -1, 1, 3\\) \\(16, 18, 20, 22, 24\\) \\(37, 39, 41, 43, 45\\)\\)" ] +- +-set message_strings \ +- [list \ +- " = 'array'" \ +- " = 'array \\(1:5,1:5\\)'" \ +- " = 'array \\(1:10:2,1:10:2\\)'" \ +- " = 'array \\(1:10:3,1:10:2\\)'" \ +- " = 'array \\(1:10:5,1:10:3\\)'" ] +- +-set i 0 +-foreach result $array_contents msg $message_strings { +- incr i +- with_test_prefix "test $i" { +- gdb_continue_to_breakpoint "show" +- gdb_test "p array" $result +- gdb_test "p message" "$msg" ++proc run_test { repack } { ++ global binfile gdb_prompt ++ ++ clean_restart ${binfile} ++ ++ if ![fortran_runto_main] { ++ untested "could not run to main" ++ return -1 + } +-} + +-gdb_continue_to_breakpoint "continue to Final Breakpoint" ++ gdb_test_no_output "set fortran repack-array-slices $repack" ++ ++ # gdb_breakpoint [gdb_get_line_number "Display Message Breakpoint"] ++ gdb_breakpoint [gdb_get_line_number "Display Element"] ++ gdb_breakpoint [gdb_get_line_number "Display String"] ++ gdb_breakpoint [gdb_get_line_number "Display Array Slice 1D"] ++ gdb_breakpoint [gdb_get_line_number "Display Array Slice 2D"] ++ gdb_breakpoint [gdb_get_line_number "Display Array Slice 3D"] ++ gdb_breakpoint [gdb_get_line_number "Display Array Slice 4D"] ++ gdb_breakpoint [gdb_get_line_number "Final Breakpoint"] ++ ++ # We're going to print some reasonably large arrays. ++ gdb_test_no_output "set print elements unlimited" ++ ++ set found_final_breakpoint false ++ ++ # We place a limit on the number of tests that can be run, just in ++ # case something goes wrong, and GDB gets stuck in an loop here. ++ set test_count 0 ++ while { $test_count < 500 } { ++ with_test_prefix "test $test_count" { ++ incr test_count ++ ++ set found_final_breakpoint false ++ set expected_result "" ++ set func_name "" ++ gdb_test_multiple "continue" "continue" { ++ -re ".*GDB = (\[^\r\n\]+)\r\n" { ++ set expected_result $expect_out(1,string) ++ exp_continue ++ } ++ -re "! Display Element" { ++ set func_name "show_elem" ++ exp_continue ++ } ++ -re "! Display String" { ++ set func_name "show_str" ++ exp_continue ++ } ++ -re "! Display Array Slice (.)D" { ++ set func_name "show_$expect_out(1,string)d" ++ exp_continue ++ } ++ -re "! Final Breakpoint" { ++ set found_final_breakpoint true ++ exp_continue ++ } ++ -re "$gdb_prompt $" { ++ # We're done. ++ } ++ } + +-# Next test that asking for an array with stride at the CLI gives an +-# error. +-clean_restart ${testfile} ++ if ($found_final_breakpoint) { ++ break ++ } + +-if ![fortran_runto_main] then { +- perror "couldn't run to main" +- continue ++ # We want to take a look at the line in the previous frame that ++ # called the current function. I couldn't find a better way of ++ # doing this than 'up', which will print the line, then 'down' ++ # again. ++ # ++ # I don't want to fill the log with passes for these up/down ++ # commands, so we don't report any. If something goes wrong then we ++ # should get a fail from gdb_test_multiple. ++ set array_slice_name "" ++ set unique_id "" ++ array unset replacement_vars ++ array set replacement_vars {} ++ gdb_test_multiple "up" "up" { ++ -re "\r\n\[0-9\]+\[ \t\]+call ${func_name} \\((\[^\r\n\]+)\\)\r\n$gdb_prompt $" { ++ set array_slice_name $expect_out(1,string) ++ } ++ -re "\r\n\[0-9\]+\[ \t\]+call ${func_name} \\((\[^\r\n\]+)\\)\[ \t\]+! VARS=(\[^ \t\r\n\]+)\r\n$gdb_prompt $" { ++ set array_slice_name $expect_out(1,string) ++ set unique_id $expect_out(2,string) ++ } ++ } ++ if {$unique_id != ""} { ++ set str "" ++ foreach v [split $unique_id ,] { ++ set val [get_integer_valueof "${v}" "??"\ ++ "get variable '$v' for '$array_slice_name'"] ++ set replacement_vars($v) $val ++ if {$str != ""} { ++ set str "Str," ++ } ++ set str "$str$v=$val" ++ } ++ set unique_id " $str" ++ } ++ gdb_test_multiple "down" "down" { ++ -re "\r\n$gdb_prompt $" { ++ # Don't issue a pass here. ++ } ++ } ++ ++ # Check we have all the information we need to successfully run one ++ # of these tests. ++ if { $expected_result == "" } { ++ perror "failed to extract expected results" ++ return 0 ++ } ++ if { $array_slice_name == "" } { ++ perror "failed to extract array slice name" ++ return 0 ++ } ++ ++ # Check GDB can correctly print the array slice that was passed into ++ # the current frame. ++ set pattern [string_to_regexp " = $expected_result"] ++ gdb_test "p array" "$pattern" \ ++ "check value of '$array_slice_name'$unique_id" ++ ++ # Get the size of the slice. ++ set size_in_show \ ++ [get_integer_valueof "sizeof (array)" "show_unknown" \ ++ "get sizeof '$array_slice_name'$unique_id in show"] ++ set addr_in_show \ ++ [get_hexadecimal_valueof "&array" "show_unknown" \ ++ "get address '$array_slice_name'$unique_id in show"] ++ ++ # Now move into the previous frame, and see if GDB can extract the ++ # array slice from the original parent object. Again, use of ++ # gdb_test_multiple to avoid filling the logs with unnecessary ++ # passes. ++ gdb_test_multiple "up" "up" { ++ -re "\r\n$gdb_prompt $" { ++ # Do nothing. ++ } ++ } ++ ++ # Print the array slice, this will force GDB to manually extract the ++ # slice from the parent array. ++ gdb_test "p $array_slice_name" "$pattern" \ ++ "check array slice '$array_slice_name'$unique_id can be extracted" ++ ++ # Get the size of the slice in the calling frame. ++ set size_in_parent \ ++ [get_integer_valueof "sizeof ($array_slice_name)" \ ++ "parent_unknown" \ ++ "get sizeof '$array_slice_name'$unique_id in parent"] ++ ++ # Figure out the start and end addresses of the full array in the ++ # parent frame. ++ set full_var_name [array_slice_to_var $array_slice_name] ++ set start_addr [get_hexadecimal_valueof "&${full_var_name}" \ ++ "start unknown"] ++ set end_addr [get_hexadecimal_valueof \ ++ "(&${full_var_name}) + sizeof (${full_var_name})" \ ++ "end unknown"] ++ ++ # The Fortran compiler can choose to either send a descriptor that ++ # describes the array slice to the subroutine, or it can repack the ++ # slice into an array section and send that. ++ # ++ # We find the address range of the original array in the parent, ++ # and the address of the slice in the show function, if the ++ # address of the slice (from show) is in the range of the original ++ # array then repacking has not occurred, otherwise, the slice is ++ # outside of the parent, and repacking must have occurred. ++ # ++ # The goal here is to compare the sizes of the slice in show with ++ # the size of the slice extracted by GDB. So we can only compare ++ # sizes when GDB's repacking setting matches the repacking ++ # behaviour we got from the compiler. ++ if { ($addr_in_show < $start_addr || $addr_in_show >= $end_addr) \ ++ == ($repack == "on") } { ++ gdb_assert {$size_in_show == $size_in_parent} \ ++ "check sizes match" ++ } elseif { $repack == "off" } { ++ # GDB's repacking is off (so slices are left unpacked), but ++ # the compiler did pack this one. As a result we can't ++ # compare the sizes between the compiler's slice and GDB's ++ # slice. ++ verbose -log "slice '$array_slice_name' was repacked, sizes can't be compared" ++ } else { ++ # Like the above, but the reverse, GDB's repacking is on, but ++ # the compiler didn't repack this slice. ++ verbose -log "slice '$array_slice_name' was not repacked, sizes can't be compared" ++ } ++ ++ # If the array name we just tested included variable names, then ++ # test again with all the variables expanded. ++ if {$unique_id != ""} { ++ foreach v [array names replacement_vars] { ++ set val $replacement_vars($v) ++ set array_slice_name \ ++ [regsub "\\y${v}\\y" $array_slice_name $val] ++ } ++ gdb_test "p $array_slice_name" "$pattern" \ ++ "check array slice '$array_slice_name'$unique_id can be extracted, with variables expanded" ++ } ++ } ++ } ++ ++ # Ensure we reached the final breakpoint. If more tests have been added ++ # to the test script, and this starts failing, then the safety 'while' ++ # loop above might need to be increased. ++ gdb_assert {$found_final_breakpoint} "ran all tests" + } + +-gdb_breakpoint "show" +-gdb_continue_to_breakpoint "show" +-gdb_test "up" ".*" +-gdb_test "p array (1:10:2, 1:10:2)" \ +- "Fortran array strides are not currently supported" \ +- "using array stride gives an error" ++foreach_with_prefix repack { on off } { ++ run_test $repack ++} +diff --git a/gdb/testsuite/gdb.fortran/array-slices.f90 b/gdb/testsuite/gdb.fortran/array-slices.f90 +--- a/gdb/testsuite/gdb.fortran/array-slices.f90 ++++ b/gdb/testsuite/gdb.fortran/array-slices.f90 +@@ -13,58 +13,368 @@ + ! You should have received a copy of the GNU General Public License + ! along with this program. If not, see . + +-subroutine show (message, array) +- character (len=*) :: message ++subroutine show_elem (array) ++ integer :: array ++ ++ print *, "" ++ print *, "Expected GDB Output:" ++ print *, "" ++ ++ write(*, fmt="(A)", advance="no") "GDB = " ++ write(*, fmt="(I0)", advance="no") array ++ write(*, fmt="(A)", advance="yes") "" ++ ++ print *, "" ! Display Element ++end subroutine show_elem ++ ++subroutine show_str (array) ++ character (len=*) :: array ++ ++ print *, "" ++ print *, "Expected GDB Output:" ++ print *, "" ++ write (*, fmt="(A)", advance="no") "GDB = '" ++ write (*, fmt="(A)", advance="no") array ++ write (*, fmt="(A)", advance="yes") "'" ++ ++ print *, "" ! Display String ++end subroutine show_str ++ ++subroutine show_1d (array) ++ integer, dimension (:) :: array ++ ++ print *, "Array Contents:" ++ print *, "" ++ ++ do i=LBOUND (array, 1), UBOUND (array, 1), 1 ++ write(*, fmt="(i4)", advance="no") array (i) ++ end do ++ ++ print *, "" ++ print *, "Expected GDB Output:" ++ print *, "" ++ ++ write(*, fmt="(A)", advance="no") "GDB = (" ++ do i=LBOUND (array, 1), UBOUND (array, 1), 1 ++ if (i > LBOUND (array, 1)) then ++ write(*, fmt="(A)", advance="no") ", " ++ end if ++ write(*, fmt="(I0)", advance="no") array (i) ++ end do ++ write(*, fmt="(A)", advance="no") ")" ++ ++ print *, "" ! Display Array Slice 1D ++end subroutine show_1d ++ ++subroutine show_2d (array) + integer, dimension (:,:) :: array + +- print *, message ++ print *, "Array Contents:" ++ print *, "" ++ + do i=LBOUND (array, 2), UBOUND (array, 2), 1 + do j=LBOUND (array, 1), UBOUND (array, 1), 1 + write(*, fmt="(i4)", advance="no") array (j, i) + end do + print *, "" +- end do +- print *, array +- print *, "" ++ end do + +-end subroutine show ++ print *, "" ++ print *, "Expected GDB Output:" ++ print *, "" + +-program test ++ write(*, fmt="(A)", advance="no") "GDB = (" ++ do i=LBOUND (array, 2), UBOUND (array, 2), 1 ++ if (i > LBOUND (array, 2)) then ++ write(*, fmt="(A)", advance="no") " " ++ end if ++ write(*, fmt="(A)", advance="no") "(" ++ do j=LBOUND (array, 1), UBOUND (array, 1), 1 ++ if (j > LBOUND (array, 1)) then ++ write(*, fmt="(A)", advance="no") ", " ++ end if ++ write(*, fmt="(I0)", advance="no") array (j, i) ++ end do ++ write(*, fmt="(A)", advance="no") ")" ++ end do ++ write(*, fmt="(A)", advance="yes") ")" ++ ++ print *, "" ! Display Array Slice 2D ++end subroutine show_2d ++ ++subroutine show_3d (array) ++ integer, dimension (:,:,:) :: array ++ ++ print *, "" ++ print *, "Expected GDB Output:" ++ print *, "" ++ ++ write(*, fmt="(A)", advance="no") "GDB = (" ++ do i=LBOUND (array, 3), UBOUND (array, 3), 1 ++ if (i > LBOUND (array, 3)) then ++ write(*, fmt="(A)", advance="no") " " ++ end if ++ write(*, fmt="(A)", advance="no") "(" ++ do j=LBOUND (array, 2), UBOUND (array, 2), 1 ++ if (j > LBOUND (array, 2)) then ++ write(*, fmt="(A)", advance="no") " " ++ end if ++ write(*, fmt="(A)", advance="no") "(" ++ do k=LBOUND (array, 1), UBOUND (array, 1), 1 ++ if (k > LBOUND (array, 1)) then ++ write(*, fmt="(A)", advance="no") ", " ++ end if ++ write(*, fmt="(I0)", advance="no") array (k, j, i) ++ end do ++ write(*, fmt="(A)", advance="no") ")" ++ end do ++ write(*, fmt="(A)", advance="no") ")" ++ end do ++ write(*, fmt="(A)", advance="yes") ")" ++ ++ print *, "" ! Display Array Slice 3D ++end subroutine show_3d ++ ++subroutine show_4d (array) ++ integer, dimension (:,:,:,:) :: array ++ ++ print *, "" ++ print *, "Expected GDB Output:" ++ print *, "" ++ ++ write(*, fmt="(A)", advance="no") "GDB = (" ++ do i=LBOUND (array, 4), UBOUND (array, 4), 1 ++ if (i > LBOUND (array, 4)) then ++ write(*, fmt="(A)", advance="no") " " ++ end if ++ write(*, fmt="(A)", advance="no") "(" ++ do j=LBOUND (array, 3), UBOUND (array, 3), 1 ++ if (j > LBOUND (array, 3)) then ++ write(*, fmt="(A)", advance="no") " " ++ end if ++ write(*, fmt="(A)", advance="no") "(" ++ ++ do k=LBOUND (array, 2), UBOUND (array, 2), 1 ++ if (k > LBOUND (array, 2)) then ++ write(*, fmt="(A)", advance="no") " " ++ end if ++ write(*, fmt="(A)", advance="no") "(" ++ do l=LBOUND (array, 1), UBOUND (array, 1), 1 ++ if (l > LBOUND (array, 1)) then ++ write(*, fmt="(A)", advance="no") ", " ++ end if ++ write(*, fmt="(I0)", advance="no") array (l, k, j, i) ++ end do ++ write(*, fmt="(A)", advance="no") ")" ++ end do ++ write(*, fmt="(A)", advance="no") ")" ++ end do ++ write(*, fmt="(A)", advance="no") ")" ++ end do ++ write(*, fmt="(A)", advance="yes") ")" ++ ++ print *, "" ! Display Array Slice 4D ++end subroutine show_4d + ++! ++! Start of test program. ++! ++program test + interface +- subroutine show (message, array) +- character (len=*) :: message ++ subroutine show_str (array) ++ character (len=*) :: array ++ end subroutine show_str ++ ++ subroutine show_1d (array) ++ integer, dimension (:) :: array ++ end subroutine show_1d ++ ++ subroutine show_2d (array) + integer, dimension(:,:) :: array +- end subroutine show ++ end subroutine show_2d ++ ++ subroutine show_3d (array) ++ integer, dimension(:,:,:) :: array ++ end subroutine show_3d ++ ++ subroutine show_4d (array) ++ integer, dimension(:,:,:,:) :: array ++ end subroutine show_4d + end interface + ++ ! Declare variables used in this test. ++ integer, dimension (-10:-1,-10:-2) :: neg_array + integer, dimension (1:10,1:10) :: array + integer, allocatable :: other (:, :) ++ character (len=26) :: str_1 = "abcdefghijklmnopqrstuvwxyz" ++ integer, dimension (-2:2,-2:2,-2:2) :: array3d ++ integer, dimension (-3:3,7:10,-3:3,-10:-7) :: array4d ++ integer, dimension (10:20) :: array1d ++ integer, dimension(:,:), pointer :: pointer2d => null() ++ integer, dimension(-1:9,-1:9), target :: tarray + ++ ! Allocate or associate any variables as needed. + allocate (other (-5:4, -2:7)) ++ pointer2d => tarray + +- do i=LBOUND (array, 2), UBOUND (array, 2), 1 +- do j=LBOUND (array, 1), UBOUND (array, 1), 1 +- array (j,i) = ((i - 1) * UBOUND (array, 2)) + j +- end do +- end do ++ ! Fill arrays with contents ready for testing. ++ call fill_array_1d (array1d) ++ ++ call fill_array_2d (neg_array) ++ call fill_array_2d (array) ++ call fill_array_2d (other) ++ call fill_array_2d (tarray) ++ ++ call fill_array_3d (array3d) ++ call fill_array_4d (array4d) ++ ++ ! The tests. Each call to a show_* function must have a unique set ++ ! of arguments as GDB uses the arguments are part of the test name ++ ! string, so duplicate arguments will result in duplicate test ++ ! names. ++ ! ++ ! If a show_* line ends with VARS=... where '...' is a comma ++ ! separated list of variable names, these variables are assumed to ++ ! be part of the call line, and will be expanded by the test script, ++ ! for example: ++ ! ++ ! do x=1,9,1 ++ ! do y=x,10,1 ++ ! call show_1d (some_array (x,y)) ! VARS=x,y ++ ! end do ++ ! end do ++ ! ++ ! In this example the test script will automatically expand 'x' and ++ ! 'y' in order to better test different aspects of GDB. Do take ++ ! care, the expansion is not very "smart", so try to avoid clashing ++ ! with other text on the line, in the example above, avoid variables ++ ! named 'some' or 'array', as these will likely clash with ++ ! 'some_array'. ++ call show_str (str_1) ++ call show_str (str_1 (1:20)) ++ call show_str (str_1 (10:20)) + +- do i=LBOUND (other, 2), UBOUND (other, 2), 1 +- do j=LBOUND (other, 1), UBOUND (other, 1), 1 +- other (j,i) = ((i - 1) * UBOUND (other, 2)) + j ++ call show_elem (array1d (11)) ++ call show_elem (pointer2d (2,3)) ++ ++ call show_1d (array1d) ++ call show_1d (array1d (13:17)) ++ call show_1d (array1d (17:13:-1)) ++ call show_1d (array (1:5,1)) ++ call show_1d (array4d (1,7,3,:)) ++ call show_1d (pointer2d (-1:3, 2)) ++ call show_1d (pointer2d (-1, 2:4)) ++ ++ ! Enclosing the array slice argument in (...) causess gfortran to ++ ! repack the array. ++ call show_1d ((array (1:5,1))) ++ ++ call show_2d (pointer2d) ++ call show_2d (array) ++ call show_2d (array (1:5,1:5)) ++ do i=1,10,2 ++ do j=1,10,3 ++ call show_2d (array (1:10:i,1:10:j)) ! VARS=i,j ++ call show_2d (array (10:1:-i,1:10:j)) ! VARS=i,j ++ call show_2d (array (10:1:-i,10:1:-j)) ! VARS=i,j ++ call show_2d (array (1:10:i,10:1:-j)) ! VARS=i,j + end do + end do ++ call show_2d (array (6:2:-1,3:9)) ++ call show_2d (array (1:10:2, 1:10:2)) ++ call show_2d (other) ++ call show_2d (other (-5:0, -2:0)) ++ call show_2d (other (-5:4:2, -2:7:3)) ++ call show_2d (neg_array) ++ call show_2d (neg_array (-10:-3,-8:-4:2)) ++ ++ ! Enclosing the array slice argument in (...) causess gfortran to ++ ! repack the array. ++ call show_2d ((array (1:10:3, 1:10:2))) ++ call show_2d ((neg_array (-10:-3,-8:-4:2))) + +- call show ("array", array) +- call show ("array (1:5,1:5)", array (1:5,1:5)) +- call show ("array (1:10:2,1:10:2)", array (1:10:2,1:10:2)) +- call show ("array (1:10:3,1:10:2)", array (1:10:3,1:10:2)) +- call show ("array (1:10:5,1:10:3)", array (1:10:4,1:10:3)) ++ call show_3d (array3d) ++ call show_3d (array3d(-1:1,-1:1,-1:1)) ++ call show_3d (array3d(1:-1:-1,1:-1:-1,1:-1:-1)) + +- call show ("other", other) +- call show ("other (-5:0, -2:0)", other (-5:0, -2:0)) +- call show ("other (-5:4:2, -2:7:3)", other (-5:4:2, -2:7:3)) ++ ! Enclosing the array slice argument in (...) causess gfortran to ++ ! repack the array. ++ call show_3d ((array3d(1:-1:-1,1:-1:-1,1:-1:-1))) + ++ call show_4d (array4d) ++ call show_4d (array4d (-3:0,10:7:-1,0:3,-7:-10:-1)) ++ call show_4d (array4d (3:0:-1, 10:7:-1, :, -7:-10:-1)) ++ ++ ! Enclosing the array slice argument in (...) causess gfortran to ++ ! repack the array. ++ call show_4d ((array4d (3:-2:-2, 10:7:-2, :, -7:-10:-1))) ++ ++ ! All done. Deallocate. + deallocate (other) ++ ++ ! GDB catches this final breakpoint to indicate the end of the test. + print *, "" ! Final Breakpoint. ++ ++contains ++ ++ ! Fill a 1D array with a unique positive integer in each element. ++ subroutine fill_array_1d (array) ++ integer, dimension (:) :: array ++ integer :: counter ++ ++ counter = 1 ++ do j=LBOUND (array, 1), UBOUND (array, 1), 1 ++ array (j) = counter ++ counter = counter + 1 ++ end do ++ end subroutine fill_array_1d ++ ++ ! Fill a 2D array with a unique positive integer in each element. ++ subroutine fill_array_2d (array) ++ integer, dimension (:,:) :: array ++ integer :: counter ++ ++ counter = 1 ++ do i=LBOUND (array, 2), UBOUND (array, 2), 1 ++ do j=LBOUND (array, 1), UBOUND (array, 1), 1 ++ array (j,i) = counter ++ counter = counter + 1 ++ end do ++ end do ++ end subroutine fill_array_2d ++ ++ ! Fill a 3D array with a unique positive integer in each element. ++ subroutine fill_array_3d (array) ++ integer, dimension (:,:,:) :: array ++ integer :: counter ++ ++ counter = 1 ++ do i=LBOUND (array, 3), UBOUND (array, 3), 1 ++ do j=LBOUND (array, 2), UBOUND (array, 2), 1 ++ do k=LBOUND (array, 1), UBOUND (array, 1), 1 ++ array (k, j,i) = counter ++ counter = counter + 1 ++ end do ++ end do ++ end do ++ end subroutine fill_array_3d ++ ++ ! Fill a 4D array with a unique positive integer in each element. ++ subroutine fill_array_4d (array) ++ integer, dimension (:,:,:,:) :: array ++ integer :: counter ++ ++ counter = 1 ++ do i=LBOUND (array, 4), UBOUND (array, 4), 1 ++ do j=LBOUND (array, 3), UBOUND (array, 3), 1 ++ do k=LBOUND (array, 2), UBOUND (array, 2), 1 ++ do l=LBOUND (array, 1), UBOUND (array, 1), 1 ++ array (l, k, j,i) = counter ++ counter = counter + 1 ++ end do ++ end do ++ end do ++ end do ++ print *, "" ++ end subroutine fill_array_4d + end program test +diff --git a/gdb/testsuite/gdb.fortran/vla-sizeof.exp b/gdb/testsuite/gdb.fortran/vla-sizeof.exp +--- a/gdb/testsuite/gdb.fortran/vla-sizeof.exp ++++ b/gdb/testsuite/gdb.fortran/vla-sizeof.exp +@@ -44,7 +44,7 @@ gdb_continue_to_breakpoint "vla1-allocated" + gdb_test "print sizeof(vla1)" " = 4000" "print sizeof allocated vla1" + gdb_test "print sizeof(vla1(3,2,1))" "4" \ + "print sizeof element from allocated vla1" +-gdb_test "print sizeof(vla1(3:4,2,1))" "800" \ ++gdb_test "print sizeof(vla1(3:4,2,1))" "8" \ + "print sizeof sliced vla1" + + # Try to access values in undefined pointer to VLA (dangling) +@@ -61,7 +61,7 @@ gdb_continue_to_breakpoint "pvla-associated" + gdb_test "print sizeof(pvla)" " = 4000" "print sizeof associated pvla" + gdb_test "print sizeof(pvla(3,2,1))" "4" \ + "print sizeof element from associated pvla" +-gdb_test "print sizeof(pvla(3:4,2,1))" "800" "print sizeof sliced pvla" ++gdb_test "print sizeof(pvla(3:4,2,1))" "8" "print sizeof sliced pvla" + + gdb_breakpoint [gdb_get_line_number "vla1-neg-bounds-v1"] + gdb_continue_to_breakpoint "vla1-neg-bounds-v1" diff --git a/SOURCES/gdb-rhbz1964167-fortran-array-strides-in-expressions.patch b/SOURCES/gdb-rhbz1964167-fortran-array-strides-in-expressions.patch new file mode 100644 index 0000000..c23ec34 --- /dev/null +++ b/SOURCES/gdb-rhbz1964167-fortran-array-strides-in-expressions.patch @@ -0,0 +1,193 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Kevin Buettner +Date: Mon, 24 May 2021 22:30:32 -0700 +Subject: gdb-rhbz1964167-fortran-array-strides-in-expressions.patch + +;; [fortran] Backport Andrew Burgess's commit which adds support +;; for array strides in expressions. + +gdb/fortran: add support for parsing array strides in expressions + +With this commit GDB now understands the syntax of Fortran array +strides, a user can type an expression including an array stride, but +they will only get an error informing them that array strides are not +supported. + +This alone is an improvement on what we had before in GDB, better to +give the user a helpful message that a particular feature is not +supported than to just claim a syntax error. + +Before: + + (gdb) p array (1:10:2, 2:10:2) + A syntax error in expression, near `:2, 2:10:2)'. + +Now: + + (gdb) p array (1:10:2, 2:10:2) + Fortran array strides are not currently supported + +Later commits will allow GDB to handle array strides correctly. + +gdb/ChangeLog: + + * expprint.c (dump_subexp_body_standard): Print RANGE_HAS_STRIDE. + * expression.h (enum range_type): Add RANGE_HAS_STRIDE. + * f-exp.y (arglist): Allow for a series of subranges. + (subrange): Add cases for subranges with strides. + * f-lang.c (value_f90_subarray): Catch use of array strides and + throw an error. + * parse.c (operator_length_standard): Handle RANGE_HAS_STRIDE. + +gdb/testsuite/ChangeLog: + + * gdb.fortran/array-slices.exp: Add a new test. + +diff --git a/gdb/expprint.c b/gdb/expprint.c +--- a/gdb/expprint.c ++++ b/gdb/expprint.c +@@ -1118,12 +1118,16 @@ dump_subexp_body_standard (struct expression *exp, + fputs_filtered ("..", stream); + if (!(range_flag & RANGE_HIGH_BOUND_DEFAULT)) + fputs_filtered ("EXP", stream); ++ if (range_flag & RANGE_HAS_STRIDE) ++ fputs_filtered (":EXP", stream); + fputs_filtered ("'", stream); + + if (!(range_flag & RANGE_LOW_BOUND_DEFAULT)) + elt = dump_subexp (exp, stream, elt); + if (!(range_flag & RANGE_HIGH_BOUND_DEFAULT)) + elt = dump_subexp (exp, stream, elt); ++ if (range_flag & RANGE_HAS_STRIDE) ++ elt = dump_subexp (exp, stream, elt); + } + break; + +diff --git a/gdb/expression.h b/gdb/expression.h +--- a/gdb/expression.h ++++ b/gdb/expression.h +@@ -199,6 +199,9 @@ enum range_flag : unsigned + + /* The high bound of this range is exclusive. */ + RANGE_HIGH_BOUND_EXCLUSIVE = 1 << 2, ++ ++ /* The range has a stride. */ ++ RANGE_HAS_STRIDE = 1 << 3, + }; + + DEF_ENUM_FLAGS_TYPE (enum range_flag, range_flags); +diff --git a/gdb/f-exp.y b/gdb/f-exp.y +--- a/gdb/f-exp.y ++++ b/gdb/f-exp.y +@@ -284,6 +284,10 @@ arglist : arglist ',' exp %prec ABOVE_COMMA + { pstate->arglist_len++; } + ; + ++arglist : arglist ',' subrange %prec ABOVE_COMMA ++ { pstate->arglist_len++; } ++ ; ++ + /* There are four sorts of subrange types in F90. */ + + subrange: exp ':' exp %prec ABOVE_COMMA +@@ -314,6 +318,38 @@ subrange: ':' %prec ABOVE_COMMA + write_exp_elt_opcode (pstate, OP_RANGE); } + ; + ++/* And each of the four subrange types can also have a stride. */ ++subrange: exp ':' exp ':' exp %prec ABOVE_COMMA ++ { write_exp_elt_opcode (pstate, OP_RANGE); ++ write_exp_elt_longcst (pstate, RANGE_HAS_STRIDE); ++ write_exp_elt_opcode (pstate, OP_RANGE); } ++ ; ++ ++subrange: exp ':' ':' exp %prec ABOVE_COMMA ++ { write_exp_elt_opcode (pstate, OP_RANGE); ++ write_exp_elt_longcst (pstate, ++ (RANGE_HIGH_BOUND_DEFAULT ++ | RANGE_HAS_STRIDE)); ++ write_exp_elt_opcode (pstate, OP_RANGE); } ++ ; ++ ++subrange: ':' exp ':' exp %prec ABOVE_COMMA ++ { write_exp_elt_opcode (pstate, OP_RANGE); ++ write_exp_elt_longcst (pstate, ++ (RANGE_LOW_BOUND_DEFAULT ++ | RANGE_HAS_STRIDE)); ++ write_exp_elt_opcode (pstate, OP_RANGE); } ++ ; ++ ++subrange: ':' ':' exp %prec ABOVE_COMMA ++ { write_exp_elt_opcode (pstate, OP_RANGE); ++ write_exp_elt_longcst (pstate, ++ (RANGE_LOW_BOUND_DEFAULT ++ | RANGE_HIGH_BOUND_DEFAULT ++ | RANGE_HAS_STRIDE)); ++ write_exp_elt_opcode (pstate, OP_RANGE); } ++ ; ++ + complexnum: exp ',' exp + { } + ; +diff --git a/gdb/f-lang.c b/gdb/f-lang.c +--- a/gdb/f-lang.c ++++ b/gdb/f-lang.c +@@ -124,7 +124,7 @@ value_f90_subarray (struct value *array, + struct expression *exp, int *pos, enum noside noside) + { + int pc = (*pos) + 1; +- LONGEST low_bound, high_bound; ++ LONGEST low_bound, high_bound, stride; + struct type *range = check_typedef (value_type (array)->index_type ()); + enum range_flag range_flag + = (enum range_flag) longest_to_int (exp->elts[pc].longconst); +@@ -141,6 +141,14 @@ value_f90_subarray (struct value *array, + else + high_bound = value_as_long (evaluate_subexp (nullptr, exp, pos, noside)); + ++ if (range_flag & RANGE_HAS_STRIDE) ++ stride = value_as_long (evaluate_subexp (nullptr, exp, pos, noside)); ++ else ++ stride = 1; ++ ++ if (stride != 1) ++ error (_("Fortran array strides are not currently supported")); ++ + return value_slice (array, low_bound, high_bound - low_bound + 1); + } + +diff --git a/gdb/parse.c b/gdb/parse.c +--- a/gdb/parse.c ++++ b/gdb/parse.c +@@ -924,6 +924,8 @@ operator_length_standard (const struct expression *expr, int endpos, + /* Assume the range has 2 arguments (low bound and high bound), then + reduce the argument count if any bounds are set to default. */ + args = 2; ++ if (range_flag & RANGE_HAS_STRIDE) ++ ++args; + if (range_flag & RANGE_LOW_BOUND_DEFAULT) + --args; + if (range_flag & RANGE_HIGH_BOUND_DEFAULT) +diff --git a/gdb/testsuite/gdb.fortran/array-slices.exp b/gdb/testsuite/gdb.fortran/array-slices.exp +--- a/gdb/testsuite/gdb.fortran/array-slices.exp ++++ b/gdb/testsuite/gdb.fortran/array-slices.exp +@@ -66,3 +66,19 @@ foreach result $array_contents msg $message_strings { + } + + gdb_continue_to_breakpoint "continue to Final Breakpoint" ++ ++# Next test that asking for an array with stride at the CLI gives an ++# error. ++clean_restart ${testfile} ++ ++if ![fortran_runto_main] then { ++ perror "couldn't run to main" ++ continue ++} ++ ++gdb_breakpoint "show" ++gdb_continue_to_breakpoint "show" ++gdb_test "up" ".*" ++gdb_test "p array (1:10:2, 1:10:2)" \ ++ "Fortran array strides are not currently supported" \ ++ "using array stride gives an error" diff --git a/SOURCES/gdb-rhbz1964167-fortran-clean-up-array-expression-evaluation.patch b/SOURCES/gdb-rhbz1964167-fortran-clean-up-array-expression-evaluation.patch new file mode 100644 index 0000000..7b62022 --- /dev/null +++ b/SOURCES/gdb-rhbz1964167-fortran-clean-up-array-expression-evaluation.patch @@ -0,0 +1,209 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Kevin Buettner +Date: Mon, 24 May 2021 16:53:22 -0700 +Subject: gdb-rhbz1964167-fortran-clean-up-array-expression-evaluation.patch + +;; [fortran] Backport Andrew Burgess's commit which cleans up +;; array/string expression evaluation. + +gdb/fortran: Clean up array/string expression evaluation + +This commit is a refactor of part of the Fortran array and string +handling code. + +The current code is split into two blocks, linked, weirdly, with a +goto. After this commit all the code is moved to its own function, +and arrays and strings are now handled using the same code; this will +be useful later when I want to add array stride support where strings +will want to be treated just like arrays, but is a good clean up even +without the array stride work, which is why I'm merging it now. + +For now the new function is added as a static within eval.c, even +though the function is Fortran only. A following commit will remove +some of the Fortran specific code from eval.c into one of the Fortran +specific files, including this new function. + +There should be no user visible changes after this commit. + +gdb/ChangeLog: + + * eval.c (fortran_value_subarray): New function, content is taken + from... + (evaluate_subexp_standard): ...here, in two places. Now arrays + and strings both call the new function. + (calc_f77_array_dims): Add header comment, handle strings. + +diff --git a/gdb/eval.c b/gdb/eval.c +--- a/gdb/eval.c ++++ b/gdb/eval.c +@@ -1260,6 +1260,67 @@ is_integral_or_integral_reference (struct type *type) + && is_integral_type (TYPE_TARGET_TYPE (type))); + } + ++/* Called from evaluate_subexp_standard to perform array indexing, and ++ sub-range extraction, for Fortran. As well as arrays this function ++ also handles strings as they can be treated like arrays of characters. ++ ARRAY is the array or string being accessed. EXP, POS, and NOSIDE are ++ as for evaluate_subexp_standard, and NARGS is the number of arguments ++ in this access (e.g. 'array (1,2,3)' would be NARGS 3). */ ++ ++static struct value * ++fortran_value_subarray (struct value *array, struct expression *exp, ++ int *pos, int nargs, enum noside noside) ++{ ++ if (exp->elts[*pos].opcode == OP_RANGE) ++ return value_f90_subarray (array, exp, pos, noside); ++ ++ if (noside == EVAL_SKIP) ++ { ++ skip_undetermined_arglist (nargs, exp, pos, noside); ++ /* Return the dummy value with the correct type. */ ++ return array; ++ } ++ ++ LONGEST subscript_array[MAX_FORTRAN_DIMS]; ++ int ndimensions = 1; ++ struct type *type = check_typedef (value_type (array)); ++ ++ if (nargs > MAX_FORTRAN_DIMS) ++ error (_("Too many subscripts for F77 (%d Max)"), MAX_FORTRAN_DIMS); ++ ++ ndimensions = calc_f77_array_dims (type); ++ ++ if (nargs != ndimensions) ++ error (_("Wrong number of subscripts")); ++ ++ gdb_assert (nargs > 0); ++ ++ /* Now that we know we have a legal array subscript expression let us ++ actually find out where this element exists in the array. */ ++ ++ /* Take array indices left to right. */ ++ for (int i = 0; i < nargs; i++) ++ { ++ /* Evaluate each subscript; it must be a legal integer in F77. */ ++ value *arg2 = evaluate_subexp_with_coercion (exp, pos, noside); ++ ++ /* Fill in the subscript array. */ ++ subscript_array[i] = value_as_long (arg2); ++ } ++ ++ /* Internal type of array is arranged right to left. */ ++ for (int i = nargs; i > 0; i--) ++ { ++ struct type *array_type = check_typedef (value_type (array)); ++ LONGEST index = subscript_array[i - 1]; ++ ++ array = value_subscripted_rvalue (array, index, ++ f77_get_lowerbound (array_type)); ++ } ++ ++ return array; ++} ++ + struct value * + evaluate_subexp_standard (struct type *expect_type, + struct expression *exp, int *pos, +@@ -1953,33 +2014,8 @@ evaluate_subexp_standard (struct type *expect_type, + switch (code) + { + case TYPE_CODE_ARRAY: +- if (exp->elts[*pos].opcode == OP_RANGE) +- return value_f90_subarray (arg1, exp, pos, noside); +- else +- { +- if (noside == EVAL_SKIP) +- { +- skip_undetermined_arglist (nargs, exp, pos, noside); +- /* Return the dummy value with the correct type. */ +- return arg1; +- } +- goto multi_f77_subscript; +- } +- + case TYPE_CODE_STRING: +- if (exp->elts[*pos].opcode == OP_RANGE) +- return value_f90_subarray (arg1, exp, pos, noside); +- else +- { +- if (noside == EVAL_SKIP) +- { +- skip_undetermined_arglist (nargs, exp, pos, noside); +- /* Return the dummy value with the correct type. */ +- return arg1; +- } +- arg2 = evaluate_subexp_with_coercion (exp, pos, noside); +- return value_subscript (arg1, value_as_long (arg2)); +- } ++ return fortran_value_subarray (arg1, exp, pos, nargs, noside); + + case TYPE_CODE_PTR: + case TYPE_CODE_FUNC: +@@ -2400,49 +2436,6 @@ evaluate_subexp_standard (struct type *expect_type, + } + return (arg1); + +- multi_f77_subscript: +- { +- LONGEST subscript_array[MAX_FORTRAN_DIMS]; +- int ndimensions = 1, i; +- struct value *array = arg1; +- +- if (nargs > MAX_FORTRAN_DIMS) +- error (_("Too many subscripts for F77 (%d Max)"), MAX_FORTRAN_DIMS); +- +- ndimensions = calc_f77_array_dims (type); +- +- if (nargs != ndimensions) +- error (_("Wrong number of subscripts")); +- +- gdb_assert (nargs > 0); +- +- /* Now that we know we have a legal array subscript expression +- let us actually find out where this element exists in the array. */ +- +- /* Take array indices left to right. */ +- for (i = 0; i < nargs; i++) +- { +- /* Evaluate each subscript; it must be a legal integer in F77. */ +- arg2 = evaluate_subexp_with_coercion (exp, pos, noside); +- +- /* Fill in the subscript array. */ +- +- subscript_array[i] = value_as_long (arg2); +- } +- +- /* Internal type of array is arranged right to left. */ +- for (i = nargs; i > 0; i--) +- { +- struct type *array_type = check_typedef (value_type (array)); +- LONGEST index = subscript_array[i - 1]; +- +- array = value_subscripted_rvalue (array, index, +- f77_get_lowerbound (array_type)); +- } +- +- return array; +- } +- + case BINOP_LOGICAL_AND: + arg1 = evaluate_subexp (nullptr, exp, pos, noside); + if (noside == EVAL_SKIP) +@@ -3354,12 +3347,17 @@ parse_and_eval_type (char *p, int length) + return expr->elts[1].type; + } + ++/* Return the number of dimensions for a Fortran array or string. */ ++ + int + calc_f77_array_dims (struct type *array_type) + { + int ndimen = 1; + struct type *tmp_type; + ++ if ((array_type->code () == TYPE_CODE_STRING)) ++ return 1; ++ + if ((array_type->code () != TYPE_CODE_ARRAY)) + error (_("Can't get dimensions for a non-array type")); + diff --git a/SOURCES/gdb-rhbz1964167-fortran-fix-type-format-mismatch-in-f-lang.c.patch b/SOURCES/gdb-rhbz1964167-fortran-fix-type-format-mismatch-in-f-lang.c.patch new file mode 100644 index 0000000..2cdb828 --- /dev/null +++ b/SOURCES/gdb-rhbz1964167-fortran-fix-type-format-mismatch-in-f-lang.c.patch @@ -0,0 +1,128 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Kevin Buettner +Date: Tue, 25 May 2021 17:34:57 -0700 +Subject: gdb-rhbz1964167-fortran-fix-type-format-mismatch-in-f-lang.c.patch + +;; [fortran] Backport Simon Marchi's commit which fixes a 32-bit build +;; problem in gdb/f-lang.c. + +gdb: fix format string warnings in f-lang.c + +I get a bunch of these warnings when compiling for i386 (32-bit): + + CXX f-lang.o + /home/simark/src/binutils-gdb/gdb/f-lang.c: In function 'value* fortran_value_subarray(value*, expression*, int*, int, noside)': + /home/simark/src/binutils-gdb/gdb/f-lang.c:453:48: error: format '%ld' expects argument of type 'long int', but argument 2 has type 'LONGEST' {aka 'long long int'} [-Werror=format=] + 453 | debug_printf ("| | |-> Low bound: %ld\n", lb); + | ~~^ ~~ + | | | + | | LONGEST {aka long long int} + | long int + | %lld + +Fix them by using plongest/pulongest. + +gdb/ChangeLog: + + * f-lang.c (fortran_value_subarray): Use plongest/pulongest. + +Change-Id: I666ead5593653d5a1a3dab2ffdc72942c928c7d2 + +diff --git a/gdb/f-lang.c b/gdb/f-lang.c +--- a/gdb/f-lang.c ++++ b/gdb/f-lang.c +@@ -463,21 +463,21 @@ fortran_value_subarray (struct value *array, struct expression *exp, + std::string str = type_to_string (dim_type); + debug_printf ("| |-> Type: %s\n", str.c_str ()); + debug_printf ("| |-> Array:\n"); +- debug_printf ("| | |-> Low bound: %ld\n", lb); +- debug_printf ("| | |-> High bound: %ld\n", ub); +- debug_printf ("| | |-> Bit stride: %ld\n", sd); +- debug_printf ("| | |-> Byte stride: %ld\n", sd / 8); +- debug_printf ("| | |-> Type size: %ld\n", +- TYPE_LENGTH (dim_type)); +- debug_printf ("| | '-> Target type size: %ld\n", +- TYPE_LENGTH (target_type)); ++ debug_printf ("| | |-> Low bound: %s\n", plongest (lb)); ++ debug_printf ("| | |-> High bound: %s\n", plongest (ub)); ++ debug_printf ("| | |-> Bit stride: %s\n", plongest (sd)); ++ debug_printf ("| | |-> Byte stride: %s\n", plongest (sd / 8)); ++ debug_printf ("| | |-> Type size: %s\n", ++ pulongest (TYPE_LENGTH (dim_type))); ++ debug_printf ("| | '-> Target type size: %s\n", ++ pulongest (TYPE_LENGTH (target_type))); + debug_printf ("| |-> Accessing:\n"); +- debug_printf ("| | |-> Low bound: %ld\n", +- low); +- debug_printf ("| | |-> High bound: %ld\n", +- high); +- debug_printf ("| | '-> Element stride: %ld\n", +- stride); ++ debug_printf ("| | |-> Low bound: %s\n", ++ plongest (low)); ++ debug_printf ("| | |-> High bound: %s\n", ++ plongest (high)); ++ debug_printf ("| | '-> Element stride: %s\n", ++ plongest (stride)); + } + + /* Check the user hasn't asked for something invalid. */ +@@ -519,13 +519,17 @@ fortran_value_subarray (struct value *array, struct expression *exp, + if (fortran_array_slicing_debug) + { + debug_printf ("| '-> Results:\n"); +- debug_printf ("| |-> Offset = %ld\n", offset); +- debug_printf ("| |-> Elements = %ld\n", e_count); +- debug_printf ("| |-> Low bound = %ld\n", new_low); +- debug_printf ("| |-> High bound = %ld\n", new_high); +- debug_printf ("| |-> Byte stride = %ld\n", new_stride); +- debug_printf ("| |-> Last element = %ld\n", last_elem); +- debug_printf ("| |-> Remainder = %ld\n", remainder); ++ debug_printf ("| |-> Offset = %s\n", plongest (offset)); ++ debug_printf ("| |-> Elements = %s\n", plongest (e_count)); ++ debug_printf ("| |-> Low bound = %s\n", plongest (new_low)); ++ debug_printf ("| |-> High bound = %s\n", ++ plongest (new_high)); ++ debug_printf ("| |-> Byte stride = %s\n", ++ plongest (new_stride)); ++ debug_printf ("| |-> Last element = %s\n", ++ plongest (last_elem)); ++ debug_printf ("| |-> Remainder = %s\n", ++ plongest (remainder)); + debug_printf ("| '-> Contiguous = %s\n", + (is_dim_contiguous ? "Yes" : "No")); + } +@@ -561,14 +565,16 @@ fortran_value_subarray (struct value *array, struct expression *exp, + std::string str = type_to_string (dim_type); + debug_printf ("| |-> Type: %s\n", str.c_str ()); + debug_printf ("| |-> Array:\n"); +- debug_printf ("| | |-> Low bound: %ld\n", lb); +- debug_printf ("| | |-> High bound: %ld\n", ub); +- debug_printf ("| | |-> Byte stride: %ld\n", sd); +- debug_printf ("| | |-> Type size: %ld\n", TYPE_LENGTH (dim_type)); +- debug_printf ("| | '-> Target type size: %ld\n", +- TYPE_LENGTH (target_type)); ++ debug_printf ("| | |-> Low bound: %s\n", plongest (lb)); ++ debug_printf ("| | |-> High bound: %s\n", plongest (ub)); ++ debug_printf ("| | |-> Byte stride: %s\n", plongest (sd)); ++ debug_printf ("| | |-> Type size: %s\n", ++ pulongest (TYPE_LENGTH (dim_type))); ++ debug_printf ("| | '-> Target type size: %s\n", ++ pulongest (TYPE_LENGTH (target_type))); + debug_printf ("| '-> Accessing:\n"); +- debug_printf ("| '-> Index: %ld\n", index); ++ debug_printf ("| '-> Index: %s\n", ++ plongest (index)); + } + + /* If the array has actual content then check the index is in +@@ -625,7 +631,8 @@ fortran_value_subarray (struct value *array, struct expression *exp, + debug_printf ("'-> Final result:\n"); + debug_printf (" |-> Type: %s\n", + type_to_string (array_slice_type).c_str ()); +- debug_printf (" |-> Total offset: %ld\n", total_offset); ++ debug_printf (" |-> Total offset: %s\n", ++ plongest (total_offset)); + debug_printf (" |-> Base address: %s\n", + core_addr_to_string (value_address (array))); + debug_printf (" '-> Contiguous = %s\n", diff --git a/SOURCES/gdb-rhbz1964167-fortran-range_type-to-range_flag.patch b/SOURCES/gdb-rhbz1964167-fortran-range_type-to-range_flag.patch new file mode 100644 index 0000000..fed239a --- /dev/null +++ b/SOURCES/gdb-rhbz1964167-fortran-range_type-to-range_flag.patch @@ -0,0 +1,224 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Kevin Buettner +Date: Mon, 24 May 2021 17:15:27 -0700 +Subject: gdb-rhbz1964167-fortran-range_type-to-range_flag.patch + +;; [fortran] Backport Andrew Burgess's commit which renames enum +;; range_type to enum range_flag. + +gdb: rename 'enum range_type' to 'enum range_flag' + +To avoid confusion with other parts of GDB relating to types and +ranges, rename this enum to make it clearer that it is a set of +individual flags rather than an enumeration of different types of +range. + +There should be no user visible changes after this commit. + +gdb/ChangeLog: + + * expprint.c (print_subexp_standard): Change enum range_type to + range_flag and rename variables to match. + (dump_subexp_body_standard): Likewise. + * expression.h (enum range_type): Rename to... + (enum range_flag): ...this. + (range_types): Rename to... + (range_flags): ...this. + * f-lang.c (value_f90_subarray): Change enum range_type to + range_flag and rename variables to match. + * parse.c (operator_length_standard): Likewise. + * rust-exp.y (rust_parser::convert_ast_to_expression): Change enum + range_type to range_flag. + * rust-lang.c (rust_evaluate_funcall): Likewise. + (rust_range): Likewise. + (rust_compute_range): Likewise. + (rust_subscript): Likewise. + +diff --git a/gdb/expprint.c b/gdb/expprint.c +--- a/gdb/expprint.c ++++ b/gdb/expprint.c +@@ -578,19 +578,19 @@ print_subexp_standard (struct expression *exp, int *pos, + + case OP_RANGE: + { +- enum range_type range_type; ++ enum range_flag range_flag; + +- range_type = (enum range_type) ++ range_flag = (enum range_flag) + longest_to_int (exp->elts[pc + 1].longconst); + *pos += 2; + +- if (range_type & RANGE_HIGH_BOUND_EXCLUSIVE) ++ if (range_flag & RANGE_HIGH_BOUND_EXCLUSIVE) + fputs_filtered ("EXCLUSIVE_", stream); + fputs_filtered ("RANGE(", stream); +- if (!(range_type & RANGE_LOW_BOUND_DEFAULT)) ++ if (!(range_flag & RANGE_LOW_BOUND_DEFAULT)) + print_subexp (exp, pos, stream, PREC_ABOVE_COMMA); + fputs_filtered ("..", stream); +- if (!(range_type & RANGE_HIGH_BOUND_DEFAULT)) ++ if (!(range_flag & RANGE_HIGH_BOUND_DEFAULT)) + print_subexp (exp, pos, stream, PREC_ABOVE_COMMA); + fputs_filtered (")", stream); + return; +@@ -1104,25 +1104,25 @@ dump_subexp_body_standard (struct expression *exp, + break; + case OP_RANGE: + { +- enum range_type range_type; ++ enum range_flag range_flag; + +- range_type = (enum range_type) ++ range_flag = (enum range_flag) + longest_to_int (exp->elts[elt].longconst); + elt += 2; + +- if (range_type & RANGE_HIGH_BOUND_EXCLUSIVE) ++ if (range_flag & RANGE_HIGH_BOUND_EXCLUSIVE) + fputs_filtered ("Exclusive", stream); + fputs_filtered ("Range '", stream); +- if (!(range_type & RANGE_LOW_BOUND_DEFAULT)) ++ if (!(range_flag & RANGE_LOW_BOUND_DEFAULT)) + fputs_filtered ("EXP", stream); + fputs_filtered ("..", stream); +- if (!(range_type & RANGE_HIGH_BOUND_DEFAULT)) ++ if (!(range_flag & RANGE_HIGH_BOUND_DEFAULT)) + fputs_filtered ("EXP", stream); + fputs_filtered ("'", stream); + +- if (!(range_type & RANGE_LOW_BOUND_DEFAULT)) ++ if (!(range_flag & RANGE_LOW_BOUND_DEFAULT)) + elt = dump_subexp (exp, stream, elt); +- if (!(range_type & RANGE_HIGH_BOUND_DEFAULT)) ++ if (!(range_flag & RANGE_HIGH_BOUND_DEFAULT)) + elt = dump_subexp (exp, stream, elt); + } + break; +diff --git a/gdb/expression.h b/gdb/expression.h +--- a/gdb/expression.h ++++ b/gdb/expression.h +@@ -185,7 +185,7 @@ extern void dump_prefix_expression (struct expression *, struct ui_file *); + or inclusive. So we have six sorts of subrange. This enumeration + type is to identify this. */ + +-enum range_type : unsigned ++enum range_flag : unsigned + { + /* This is a standard range. Both the lower and upper bounds are + defined, and the bounds are inclusive. */ +@@ -201,6 +201,6 @@ enum range_type : unsigned + RANGE_HIGH_BOUND_EXCLUSIVE = 1 << 2, + }; + +-DEF_ENUM_FLAGS_TYPE (enum range_type, range_types); ++DEF_ENUM_FLAGS_TYPE (enum range_flag, range_flags); + + #endif /* !defined (EXPRESSION_H) */ +diff --git a/gdb/f-lang.c b/gdb/f-lang.c +--- a/gdb/f-lang.c ++++ b/gdb/f-lang.c +@@ -126,17 +126,17 @@ value_f90_subarray (struct value *array, + int pc = (*pos) + 1; + LONGEST low_bound, high_bound; + struct type *range = check_typedef (value_type (array)->index_type ()); +- enum range_type range_type +- = (enum range_type) longest_to_int (exp->elts[pc].longconst); ++ enum range_flag range_flag ++ = (enum range_flag) longest_to_int (exp->elts[pc].longconst); + + *pos += 3; + +- if (range_type & RANGE_LOW_BOUND_DEFAULT) ++ if (range_flag & RANGE_LOW_BOUND_DEFAULT) + low_bound = range->bounds ()->low.const_val (); + else + low_bound = value_as_long (evaluate_subexp (nullptr, exp, pos, noside)); + +- if (range_type & RANGE_HIGH_BOUND_DEFAULT) ++ if (range_flag & RANGE_HIGH_BOUND_DEFAULT) + high_bound = range->bounds ()->high.const_val (); + else + high_bound = value_as_long (evaluate_subexp (nullptr, exp, pos, noside)); +diff --git a/gdb/parse.c b/gdb/parse.c +--- a/gdb/parse.c ++++ b/gdb/parse.c +@@ -774,7 +774,7 @@ operator_length_standard (const struct expression *expr, int endpos, + { + int oplen = 1; + int args = 0; +- enum range_type range_type; ++ enum range_flag range_flag; + int i; + + if (endpos < 1) +@@ -918,15 +918,15 @@ operator_length_standard (const struct expression *expr, int endpos, + + case OP_RANGE: + oplen = 3; +- range_type = (enum range_type) ++ range_flag = (enum range_flag) + longest_to_int (expr->elts[endpos - 2].longconst); + + /* Assume the range has 2 arguments (low bound and high bound), then + reduce the argument count if any bounds are set to default. */ + args = 2; +- if (range_type & RANGE_LOW_BOUND_DEFAULT) ++ if (range_flag & RANGE_LOW_BOUND_DEFAULT) + --args; +- if (range_type & RANGE_HIGH_BOUND_DEFAULT) ++ if (range_flag & RANGE_HIGH_BOUND_DEFAULT) + --args; + + break; +diff --git a/gdb/rust-exp.y b/gdb/rust-exp.y +--- a/gdb/rust-exp.y ++++ b/gdb/rust-exp.y +@@ -2492,7 +2492,7 @@ rust_parser::convert_ast_to_expression (const struct rust_op *operation, + + case OP_RANGE: + { +- enum range_type kind = (RANGE_HIGH_BOUND_DEFAULT ++ unsigned int kind = (RANGE_HIGH_BOUND_DEFAULT + | RANGE_LOW_BOUND_DEFAULT); + + if (operation->left.op != NULL) +diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c +--- a/gdb/rust-lang.c ++++ b/gdb/rust-lang.c +@@ -1070,7 +1070,6 @@ rust_evaluate_funcall (struct expression *exp, int *pos, enum noside noside) + static struct value * + rust_range (struct expression *exp, int *pos, enum noside noside) + { +- enum range_type kind; + struct value *low = NULL, *high = NULL; + struct value *addrval, *result; + CORE_ADDR addr; +@@ -1079,7 +1078,8 @@ rust_range (struct expression *exp, int *pos, enum noside noside) + struct type *temp_type; + const char *name; + +- kind = (enum range_type) longest_to_int (exp->elts[*pos + 1].longconst); ++ auto kind ++ = (enum range_flag) longest_to_int (exp->elts[*pos + 1].longconst); + *pos += 3; + + if (!(kind & RANGE_LOW_BOUND_DEFAULT)) +@@ -1169,7 +1169,7 @@ rust_range (struct expression *exp, int *pos, enum noside noside) + static void + rust_compute_range (struct type *type, struct value *range, + LONGEST *low, LONGEST *high, +- range_types *kind) ++ range_flags *kind) + { + int i; + +@@ -1209,7 +1209,7 @@ rust_subscript (struct expression *exp, int *pos, enum noside noside, + struct type *rhstype; + LONGEST low, high_bound; + /* Initialized to appease the compiler. */ +- range_types kind = RANGE_LOW_BOUND_DEFAULT | RANGE_HIGH_BOUND_DEFAULT; ++ range_flags kind = RANGE_LOW_BOUND_DEFAULT | RANGE_HIGH_BOUND_DEFAULT; + LONGEST high = 0; + int want_slice = 0; + diff --git a/SOURCES/gdb-rhbz1964167-fortran-whitespace_array.patch b/SOURCES/gdb-rhbz1964167-fortran-whitespace_array.patch new file mode 100644 index 0000000..9021559 --- /dev/null +++ b/SOURCES/gdb-rhbz1964167-fortran-whitespace_array.patch @@ -0,0 +1,137 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Kevin Buettner +Date: Mon, 24 May 2021 17:07:36 -0700 +Subject: gdb-rhbz1964167-fortran-whitespace_array.patch + +;; [fortran] Backport Andrew Burgess's commit which eliminates undesirable +;; whitespace when printing arrays. + +gdb/fortran: Change whitespace when printing arrays + +This commit makes the whitespace usage when printing Fortran arrays +more consistent, and more inline with how we print C arrays. + +Currently a 2 dimensional Fotran array is printed like this, I find +the marked whitespace unpleasant: + + (( 1, 2, 3) ( 4, 5, 6) ) + ^ ^ ^ + +After this commit the same array is printed like this: + + ((1, 2, 3) (4, 5, 6)) + +Which seems more inline with how we print C arrays, in the case of C +arrays we don't add extra whitespace before the first element. + +gdb/ChangeLog: + + * f-valprint.c (f77_print_array_1): Adjust printing of whitespace + for arrays. + +gdb/testsuite/ChangeLog: + + * gdb.fortran/array-slices.exp: Update expected results. + * gdb.fortran/class-allocatable-array.exp: Likewise. + * gdb.fortran/multi-dim.exp: Likewise. + * gdb.fortran/vla-type.exp: Likewise. + * gdb.mi/mi-vla-fortran.exp: Likewise. + +diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c +--- a/gdb/f-valprint.c ++++ b/gdb/f-valprint.c +@@ -137,14 +137,17 @@ f77_print_array_1 (int nss, int ndimensions, struct type *type, + (TYPE_TARGET_TYPE (type), value_contents_for_printing_const (val) + + offs, addr + offs); + +- fprintf_filtered (stream, "( "); ++ fprintf_filtered (stream, "("); + f77_print_array_1 (nss + 1, ndimensions, value_type (subarray), + value_contents_for_printing (subarray), + value_embedded_offset (subarray), + value_address (subarray), + stream, recurse, subarray, options, elts); + offs += byte_stride; +- fprintf_filtered (stream, ") "); ++ fprintf_filtered (stream, ")"); ++ ++ if (i < upperbound) ++ fprintf_filtered (stream, " "); + } + if (*elts >= options->print_max && i < upperbound) + fprintf_filtered (stream, "..."); +diff --git a/gdb/testsuite/gdb.fortran/array-slices.exp b/gdb/testsuite/gdb.fortran/array-slices.exp +--- a/gdb/testsuite/gdb.fortran/array-slices.exp ++++ b/gdb/testsuite/gdb.fortran/array-slices.exp +@@ -38,14 +38,14 @@ gdb_breakpoint [gdb_get_line_number "Final Breakpoint"] + + set array_contents \ + [list \ +- " = \\(\\( 1, 2, 3, 4, 5, 6, 7, 8, 9, 10\\) \\( 11, 12, 13, 14, 15, 16, 17, 18, 19, 20\\) \\( 21, 22, 23, 24, 25, 26, 27, 28, 29, 30\\) \\( 31, 32, 33, 34, 35, 36, 37, 38, 39, 40\\) \\( 41, 42, 43, 44, 45, 46, 47, 48, 49, 50\\) \\( 51, 52, 53, 54, 55, 56, 57, 58, 59, 60\\) \\( 61, 62, 63, 64, 65, 66, 67, 68, 69, 70\\) \\( 71, 72, 73, 74, 75, 76, 77, 78, 79, 80\\) \\( 81, 82, 83, 84, 85, 86, 87, 88, 89, 90\\) \\( 91, 92, 93, 94, 95, 96, 97, 98, 99, 100\\) \\)" \ +- " = \\(\\( 1, 2, 3, 4, 5\\) \\( 11, 12, 13, 14, 15\\) \\( 21, 22, 23, 24, 25\\) \\( 31, 32, 33, 34, 35\\) \\( 41, 42, 43, 44, 45\\) \\)" \ +- " = \\(\\( 1, 3, 5, 7, 9\\) \\( 21, 23, 25, 27, 29\\) \\( 41, 43, 45, 47, 49\\) \\( 61, 63, 65, 67, 69\\) \\( 81, 83, 85, 87, 89\\) \\)" \ +- " = \\(\\( 1, 4, 7, 10\\) \\( 21, 24, 27, 30\\) \\( 41, 44, 47, 50\\) \\( 61, 64, 67, 70\\) \\( 81, 84, 87, 90\\) \\)" \ +- " = \\(\\( 1, 5, 9\\) \\( 31, 35, 39\\) \\( 61, 65, 69\\) \\( 91, 95, 99\\) \\)" \ +- " = \\(\\( -26, -25, -24, -23, -22, -21, -20, -19, -18, -17\\) \\( -19, -18, -17, -16, -15, -14, -13, -12, -11, -10\\) \\( -12, -11, -10, -9, -8, -7, -6, -5, -4, -3\\) \\( -5, -4, -3, -2, -1, 0, 1, 2, 3, 4\\) \\( 2, 3, 4, 5, 6, 7, 8, 9, 10, 11\\) \\( 9, 10, 11, 12, 13, 14, 15, 16, 17, 18\\) \\( 16, 17, 18, 19, 20, 21, 22, 23, 24, 25\\) \\( 23, 24, 25, 26, 27, 28, 29, 30, 31, 32\\) \\( 30, 31, 32, 33, 34, 35, 36, 37, 38, 39\\) \\( 37, 38, 39, 40, 41, 42, 43, 44, 45, 46\\) \\)" \ +- " = \\(\\( -26, -25, -24, -23, -22, -21\\) \\( -19, -18, -17, -16, -15, -14\\) \\( -12, -11, -10, -9, -8, -7\\) \\)" \ +- " = \\(\\( -26, -24, -22, -20, -18\\) \\( -5, -3, -1, 1, 3\\) \\( 16, 18, 20, 22, 24\\) \\( 37, 39, 41, 43, 45\\) \\)" ] ++ " = \\(\\(1, 2, 3, 4, 5, 6, 7, 8, 9, 10\\) \\(11, 12, 13, 14, 15, 16, 17, 18, 19, 20\\) \\(21, 22, 23, 24, 25, 26, 27, 28, 29, 30\\) \\(31, 32, 33, 34, 35, 36, 37, 38, 39, 40\\) \\(41, 42, 43, 44, 45, 46, 47, 48, 49, 50\\) \\(51, 52, 53, 54, 55, 56, 57, 58, 59, 60\\) \\(61, 62, 63, 64, 65, 66, 67, 68, 69, 70\\) \\(71, 72, 73, 74, 75, 76, 77, 78, 79, 80\\) \\(81, 82, 83, 84, 85, 86, 87, 88, 89, 90\\) \\(91, 92, 93, 94, 95, 96, 97, 98, 99, 100\\)\\)" \ ++ " = \\(\\(1, 2, 3, 4, 5\\) \\(11, 12, 13, 14, 15\\) \\(21, 22, 23, 24, 25\\) \\(31, 32, 33, 34, 35\\) \\(41, 42, 43, 44, 45\\)\\)" \ ++ " = \\(\\(1, 3, 5, 7, 9\\) \\(21, 23, 25, 27, 29\\) \\(41, 43, 45, 47, 49\\) \\(61, 63, 65, 67, 69\\) \\(81, 83, 85, 87, 89\\)\\)" \ ++ " = \\(\\(1, 4, 7, 10\\) \\(21, 24, 27, 30\\) \\(41, 44, 47, 50\\) \\(61, 64, 67, 70\\) \\(81, 84, 87, 90\\)\\)" \ ++ " = \\(\\(1, 5, 9\\) \\(31, 35, 39\\) \\(61, 65, 69\\) \\(91, 95, 99\\)\\)" \ ++ " = \\(\\(-26, -25, -24, -23, -22, -21, -20, -19, -18, -17\\) \\(-19, -18, -17, -16, -15, -14, -13, -12, -11, -10\\) \\(-12, -11, -10, -9, -8, -7, -6, -5, -4, -3\\) \\(-5, -4, -3, -2, -1, 0, 1, 2, 3, 4\\) \\(2, 3, 4, 5, 6, 7, 8, 9, 10, 11\\) \\(9, 10, 11, 12, 13, 14, 15, 16, 17, 18\\) \\(16, 17, 18, 19, 20, 21, 22, 23, 24, 25\\) \\(23, 24, 25, 26, 27, 28, 29, 30, 31, 32\\) \\(30, 31, 32, 33, 34, 35, 36, 37, 38, 39\\) \\(37, 38, 39, 40, 41, 42, 43, 44, 45, 46\\)\\)" \ ++ " = \\(\\(-26, -25, -24, -23, -22, -21\\) \\(-19, -18, -17, -16, -15, -14\\) \\(-12, -11, -10, -9, -8, -7\\)\\)" \ ++ " = \\(\\(-26, -24, -22, -20, -18\\) \\(-5, -3, -1, 1, 3\\) \\(16, 18, 20, 22, 24\\) \\(37, 39, 41, 43, 45\\)\\)" ] + + set message_strings \ + [list \ +diff --git a/gdb/testsuite/gdb.fortran/class-allocatable-array.exp b/gdb/testsuite/gdb.fortran/class-allocatable-array.exp +--- a/gdb/testsuite/gdb.fortran/class-allocatable-array.exp ++++ b/gdb/testsuite/gdb.fortran/class-allocatable-array.exp +@@ -40,4 +40,4 @@ gdb_continue_to_breakpoint "Break Here" + # cetainly going to fail. + gdb_test "print this" " = \\( _data = \[^\r\n\]+, _vptr = \[^\r\n\]+\\)" + gdb_test "print this%_data" " = \\(PTR TO -> \\( Type test_type \\)\\) \[^\r\n\]+" +-gdb_test "print this%_data%b" " = \\(\\( 1, 2, 3\\) \\( 4, 5, 6\\) \\)" ++gdb_test "print this%_data%b" " = \\(\\(1, 2, 3\\) \\(4, 5, 6\\)\\)" +diff --git a/gdb/testsuite/gdb.fortran/multi-dim.exp b/gdb/testsuite/gdb.fortran/multi-dim.exp +--- a/gdb/testsuite/gdb.fortran/multi-dim.exp ++++ b/gdb/testsuite/gdb.fortran/multi-dim.exp +@@ -57,7 +57,7 @@ gdb_test "print foo(3,3,4)" \ + "print an invalid array index (3,3,4)" + + gdb_test "print foo" \ +- { = \(\( \( 10, 10\) \( 10, 10\) \( 10, 10\) \) \( \( 10, 10\) \( 10, 10\) \( 10, 10\) \) \( \( 10, 10\) \( 10, 10\) \( 10, 10\) \) \( \( 10, 10\) \( 10, 10\) \( 10, 20\) \) \)} \ ++ { = \(\(\(10, 10\) \(10, 10\) \(10, 10\)\) \(\(10, 10\) \(10, 10\) \(10, 10\)\) \(\(10, 10\) \(10, 10\) \(10, 10\)\) \(\(10, 10\) \(10, 10\) \(10, 20\)\)\)} \ + "print full contents of the array" + + gdb_breakpoint [gdb_get_line_number "break-variable"] +diff --git a/gdb/testsuite/gdb.fortran/vla-type.exp b/gdb/testsuite/gdb.fortran/vla-type.exp +--- a/gdb/testsuite/gdb.fortran/vla-type.exp ++++ b/gdb/testsuite/gdb.fortran/vla-type.exp +@@ -66,9 +66,9 @@ gdb_test "ptype twov" \ + "\\s+$int, allocatable :: ivla1\\\(5,12,99\\\)" \ + "\\s+$int, allocatable :: ivla2\\\(9,12\\\)" \ + "End Type two" ] +-gdb_test "print twov" " = \\\( ivla1 = \\\(\\\( \\\( 1, 1, 1, 1, 1\\\)\ +- \\\( 1, 1, 321, 1, 1\\\)\ +- \\\( 1, 1, 1, 1, 1\\\) .*" ++gdb_test "print twov" " = \\\( ivla1 = \\\(\\\(\\\(1, 1, 1, 1, 1\\\)\ ++ \\\(1, 1, 321, 1, 1\\\)\ ++ \\\(1, 1, 1, 1, 1\\\) .*" + + # Check type with attribute at beginn of type + gdb_breakpoint [gdb_get_line_number "threev-filled"] +diff --git a/gdb/testsuite/gdb.mi/mi-vla-fortran.exp b/gdb/testsuite/gdb.mi/mi-vla-fortran.exp +--- a/gdb/testsuite/gdb.mi/mi-vla-fortran.exp ++++ b/gdb/testsuite/gdb.mi/mi-vla-fortran.exp +@@ -180,7 +180,7 @@ mi_run_cmd + mi_expect_stop "breakpoint-hit" "vla" "" ".*vla.f90" "$bp_lineno" \ + { "" "disp=\"del\"" } "run to breakpoint at line $bp_lineno" + mi_gdb_test "590-data-evaluate-expression pvla2" \ +- "590\\^done,value=\"\\(\\( 2, 2, 2, 2, 2\\) \\( 2, 2, 2, 2, 2\\) \\)\"" \ ++ "590\\^done,value=\"\\(\\(2, 2, 2, 2, 2\\) \\(2, 2, 2, 2, 2\\)\\)\"" \ + "evaluate associated vla" + + mi_create_varobj_checked pvla2_associated pvla2 \ diff --git a/SOURCES/gdb-rhbz1964167-move-fortran-expr-handling.patch b/SOURCES/gdb-rhbz1964167-move-fortran-expr-handling.patch new file mode 100644 index 0000000..b921684 --- /dev/null +++ b/SOURCES/gdb-rhbz1964167-move-fortran-expr-handling.patch @@ -0,0 +1,787 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Kevin Buettner +Date: Mon, 24 May 2021 17:00:17 -0700 +Subject: gdb-rhbz1964167-move-fortran-expr-handling.patch + +;; [fortran] Backport Andrew Burgess's commit which moves Fortran +;; expression handling to f-lang.c. + +gdb/fortran: Move Fortran expression handling into f-lang.c + +The Fortran specific OP_F77_UNDETERMINED_ARGLIST is currently handled +in the generic expression handling code. There's no reason why this +should be the case, so this commit moves handling of this into Fortran +specific files. + +There should be no user visible changes after this commit. + +gdb/ChangeLog: + + * eval.c: Remove 'f-lang.h' include. + (value_f90_subarray): Moved to f-lang.c. + (eval_call): Renamed to... + (evaluate_subexp_do_call): ...this, is no longer static, header + comment moved into header file. + (evaluate_funcall): Update call to eval_call. + (skip_undetermined_arglist): Moved to f-lang.c. + (fortran_value_subarray): Likewise. + (evaluate_subexp_standard): OP_F77_UNDETERMINED_ARGLIST handling + moved to evaluate_subexp_f. + (calc_f77_array_dims): Moved to f-lang.c + * expprint.c (print_subexp_funcall): New function. + (print_subexp_standard): OP_F77_UNDETERMINED_ARGLIST handling + moved to print_subexp_f, OP_FUNCALL uses new function. + (dump_subexp_body_funcall): New function. + (dump_subexp_body_standard): OP_F77_UNDETERMINED_ARGLIST handling + moved to dump_subexp_f, OP_FUNCALL uses new function. + * expression.h (evaluate_subexp_do_call): Declare. + * f-lang.c (value_f90_subarray): Moved from eval.c. + (skip_undetermined_arglist): Likewise. + (calc_f77_array_dims): Likewise. + (fortran_value_subarray): Likewise. + (evaluate_subexp_f): Add OP_F77_UNDETERMINED_ARGLIST support. + (operator_length_f): Likewise. + (print_subexp_f): Likewise. + (dump_subexp_body_f): Likewise. + * fortran-operator.def (OP_F77_UNDETERMINED_ARGLIST): Move + declaration of this operation to here. + * parse.c (operator_length_standard): OP_F77_UNDETERMINED_ARGLIST + support moved to operator_length_f. + * parser-defs.h (dump_subexp_body_funcall): Declare. + (print_subexp_funcall): Declare. + * std-operator.def (OP_F77_UNDETERMINED_ARGLIST): Moved to + fortran-operator.def. + +diff --git a/gdb/eval.c b/gdb/eval.c +--- a/gdb/eval.c ++++ b/gdb/eval.c +@@ -26,7 +26,6 @@ + #include "frame.h" + #include "gdbthread.h" + #include "language.h" /* For CAST_IS_CONVERSION. */ +-#include "f-lang.h" /* For array bound stuff. */ + #include "cp-abi.h" + #include "infcall.h" + #include "objc-lang.h" +@@ -371,32 +370,6 @@ init_array_element (struct value *array, struct value *element, + return index; + } + +-static struct value * +-value_f90_subarray (struct value *array, +- struct expression *exp, int *pos, enum noside noside) +-{ +- int pc = (*pos) + 1; +- LONGEST low_bound, high_bound; +- struct type *range = check_typedef (value_type (array)->index_type ()); +- enum range_type range_type +- = (enum range_type) longest_to_int (exp->elts[pc].longconst); +- +- *pos += 3; +- +- if (range_type == LOW_BOUND_DEFAULT || range_type == BOTH_BOUND_DEFAULT) +- low_bound = range->bounds ()->low.const_val (); +- else +- low_bound = value_as_long (evaluate_subexp (nullptr, exp, pos, noside)); +- +- if (range_type == HIGH_BOUND_DEFAULT || range_type == BOTH_BOUND_DEFAULT) +- high_bound = range->bounds ()->high.const_val (); +- else +- high_bound = value_as_long (evaluate_subexp (nullptr, exp, pos, noside)); +- +- return value_slice (array, low_bound, high_bound - low_bound + 1); +-} +- +- + /* Promote value ARG1 as appropriate before performing a unary operation + on this argument. + If the result is not appropriate for any particular language then it +@@ -749,17 +722,13 @@ eval_skip_value (expression *exp) + return value_from_longest (builtin_type (exp->gdbarch)->builtin_int, 1); + } + +-/* Evaluate a function call. The function to be called is in +- ARGVEC[0] and the arguments passed to the function are in +- ARGVEC[1..NARGS]. FUNCTION_NAME is the name of the function, if +- known. DEFAULT_RETURN_TYPE is used as the function's return type +- if the return type is unknown. */ ++/* See expression.h. */ + +-static value * +-eval_call (expression *exp, enum noside noside, +- int nargs, value **argvec, +- const char *function_name, +- type *default_return_type) ++value * ++evaluate_subexp_do_call (expression *exp, enum noside noside, ++ int nargs, value **argvec, ++ const char *function_name, ++ type *default_return_type) + { + if (argvec[0] == NULL) + error (_("Cannot evaluate function -- may be inlined")); +@@ -1230,20 +1199,8 @@ evaluate_funcall (type *expect_type, expression *exp, int *pos, + /* Nothing to be done; argvec already correctly set up. */ + } + +- return eval_call (exp, noside, nargs, argvec, var_func_name, expect_type); +-} +- +-/* Helper for skipping all the arguments in an undetermined argument list. +- This function was designed for use in the OP_F77_UNDETERMINED_ARGLIST +- case of evaluate_subexp_standard as multiple, but not all, code paths +- require a generic skip. */ +- +-static void +-skip_undetermined_arglist (int nargs, struct expression *exp, int *pos, +- enum noside noside) +-{ +- for (int i = 0; i < nargs; ++i) +- evaluate_subexp (nullptr, exp, pos, noside); ++ return evaluate_subexp_do_call (exp, noside, nargs, argvec, ++ var_func_name, expect_type); + } + + /* Return true if type is integral or reference to integral */ +@@ -1260,67 +1217,6 @@ is_integral_or_integral_reference (struct type *type) + && is_integral_type (TYPE_TARGET_TYPE (type))); + } + +-/* Called from evaluate_subexp_standard to perform array indexing, and +- sub-range extraction, for Fortran. As well as arrays this function +- also handles strings as they can be treated like arrays of characters. +- ARRAY is the array or string being accessed. EXP, POS, and NOSIDE are +- as for evaluate_subexp_standard, and NARGS is the number of arguments +- in this access (e.g. 'array (1,2,3)' would be NARGS 3). */ +- +-static struct value * +-fortran_value_subarray (struct value *array, struct expression *exp, +- int *pos, int nargs, enum noside noside) +-{ +- if (exp->elts[*pos].opcode == OP_RANGE) +- return value_f90_subarray (array, exp, pos, noside); +- +- if (noside == EVAL_SKIP) +- { +- skip_undetermined_arglist (nargs, exp, pos, noside); +- /* Return the dummy value with the correct type. */ +- return array; +- } +- +- LONGEST subscript_array[MAX_FORTRAN_DIMS]; +- int ndimensions = 1; +- struct type *type = check_typedef (value_type (array)); +- +- if (nargs > MAX_FORTRAN_DIMS) +- error (_("Too many subscripts for F77 (%d Max)"), MAX_FORTRAN_DIMS); +- +- ndimensions = calc_f77_array_dims (type); +- +- if (nargs != ndimensions) +- error (_("Wrong number of subscripts")); +- +- gdb_assert (nargs > 0); +- +- /* Now that we know we have a legal array subscript expression let us +- actually find out where this element exists in the array. */ +- +- /* Take array indices left to right. */ +- for (int i = 0; i < nargs; i++) +- { +- /* Evaluate each subscript; it must be a legal integer in F77. */ +- value *arg2 = evaluate_subexp_with_coercion (exp, pos, noside); +- +- /* Fill in the subscript array. */ +- subscript_array[i] = value_as_long (arg2); +- } +- +- /* Internal type of array is arranged right to left. */ +- for (int i = nargs; i > 0; i--) +- { +- struct type *array_type = check_typedef (value_type (array)); +- LONGEST index = subscript_array[i - 1]; +- +- array = value_subscripted_rvalue (array, index, +- f77_get_lowerbound (array_type)); +- } +- +- return array; +-} +- + struct value * + evaluate_subexp_standard (struct type *expect_type, + struct expression *exp, int *pos, +@@ -1335,7 +1231,6 @@ evaluate_subexp_standard (struct type *expect_type, + struct type *type; + int nargs; + struct value **argvec; +- int code; + int ix; + long mem_offset; + struct type **arg_types; +@@ -1976,84 +1871,6 @@ evaluate_subexp_standard (struct type *expect_type, + case OP_FUNCALL: + return evaluate_funcall (expect_type, exp, pos, noside); + +- case OP_F77_UNDETERMINED_ARGLIST: +- +- /* Remember that in F77, functions, substring ops and +- array subscript operations cannot be disambiguated +- at parse time. We have made all array subscript operations, +- substring operations as well as function calls come here +- and we now have to discover what the heck this thing actually was. +- If it is a function, we process just as if we got an OP_FUNCALL. */ +- +- nargs = longest_to_int (exp->elts[pc + 1].longconst); +- (*pos) += 2; +- +- /* First determine the type code we are dealing with. */ +- arg1 = evaluate_subexp (nullptr, exp, pos, noside); +- type = check_typedef (value_type (arg1)); +- code = type->code (); +- +- if (code == TYPE_CODE_PTR) +- { +- /* Fortran always passes variable to subroutines as pointer. +- So we need to look into its target type to see if it is +- array, string or function. If it is, we need to switch +- to the target value the original one points to. */ +- struct type *target_type = check_typedef (TYPE_TARGET_TYPE (type)); +- +- if (target_type->code () == TYPE_CODE_ARRAY +- || target_type->code () == TYPE_CODE_STRING +- || target_type->code () == TYPE_CODE_FUNC) +- { +- arg1 = value_ind (arg1); +- type = check_typedef (value_type (arg1)); +- code = type->code (); +- } +- } +- +- switch (code) +- { +- case TYPE_CODE_ARRAY: +- case TYPE_CODE_STRING: +- return fortran_value_subarray (arg1, exp, pos, nargs, noside); +- +- case TYPE_CODE_PTR: +- case TYPE_CODE_FUNC: +- case TYPE_CODE_INTERNAL_FUNCTION: +- /* It's a function call. */ +- /* Allocate arg vector, including space for the function to be +- called in argvec[0] and a terminating NULL. */ +- argvec = (struct value **) +- alloca (sizeof (struct value *) * (nargs + 2)); +- argvec[0] = arg1; +- tem = 1; +- for (; tem <= nargs; tem++) +- { +- argvec[tem] = evaluate_subexp_with_coercion (exp, pos, noside); +- /* Arguments in Fortran are passed by address. Coerce the +- arguments here rather than in value_arg_coerce as otherwise +- the call to malloc to place the non-lvalue parameters in +- target memory is hit by this Fortran specific logic. This +- results in malloc being called with a pointer to an integer +- followed by an attempt to malloc the arguments to malloc in +- target memory. Infinite recursion ensues. */ +- if (code == TYPE_CODE_PTR || code == TYPE_CODE_FUNC) +- { +- bool is_artificial +- = TYPE_FIELD_ARTIFICIAL (value_type (arg1), tem - 1); +- argvec[tem] = fortran_argument_convert (argvec[tem], +- is_artificial); +- } +- } +- argvec[tem] = 0; /* signal end of arglist */ +- if (noside == EVAL_SKIP) +- return eval_skip_value (exp); +- return eval_call (exp, noside, nargs, argvec, NULL, expect_type); +- +- default: +- error (_("Cannot perform substring on this type")); +- } +- + case OP_COMPLEX: + /* We have a complex number, There should be 2 floating + point numbers that compose it. */ +@@ -3346,27 +3163,3 @@ parse_and_eval_type (char *p, int length) + error (_("Internal error in eval_type.")); + return expr->elts[1].type; + } +- +-/* Return the number of dimensions for a Fortran array or string. */ +- +-int +-calc_f77_array_dims (struct type *array_type) +-{ +- int ndimen = 1; +- struct type *tmp_type; +- +- if ((array_type->code () == TYPE_CODE_STRING)) +- return 1; +- +- if ((array_type->code () != TYPE_CODE_ARRAY)) +- error (_("Can't get dimensions for a non-array type")); +- +- tmp_type = array_type; +- +- while ((tmp_type = TYPE_TARGET_TYPE (tmp_type))) +- { +- if (tmp_type->code () == TYPE_CODE_ARRAY) +- ++ndimen; +- } +- return ndimen; +-} +diff --git a/gdb/expprint.c b/gdb/expprint.c +--- a/gdb/expprint.c ++++ b/gdb/expprint.c +@@ -53,6 +53,25 @@ print_subexp (struct expression *exp, int *pos, + exp->language_defn->la_exp_desc->print_subexp (exp, pos, stream, prec); + } + ++/* See parser-defs.h. */ ++ ++void ++print_subexp_funcall (struct expression *exp, int *pos, ++ struct ui_file *stream) ++{ ++ (*pos) += 2; ++ unsigned nargs = longest_to_int (exp->elts[*pos].longconst); ++ print_subexp (exp, pos, stream, PREC_SUFFIX); ++ fputs_filtered (" (", stream); ++ for (unsigned tem = 0; tem < nargs; tem++) ++ { ++ if (tem != 0) ++ fputs_filtered (", ", stream); ++ print_subexp (exp, pos, stream, PREC_ABOVE_COMMA); ++ } ++ fputs_filtered (")", stream); ++} ++ + /* Standard implementation of print_subexp for use in language_defn + vectors. */ + void +@@ -187,18 +206,7 @@ print_subexp_standard (struct expression *exp, int *pos, + return; + + case OP_FUNCALL: +- case OP_F77_UNDETERMINED_ARGLIST: +- (*pos) += 2; +- nargs = longest_to_int (exp->elts[pc + 1].longconst); +- print_subexp (exp, pos, stream, PREC_SUFFIX); +- fputs_filtered (" (", stream); +- for (tem = 0; tem < nargs; tem++) +- { +- if (tem != 0) +- fputs_filtered (", ", stream); +- print_subexp (exp, pos, stream, PREC_ABOVE_COMMA); +- } +- fputs_filtered (")", stream); ++ print_subexp_funcall (exp, pos, stream); + return; + + case OP_NAME: +@@ -796,6 +804,22 @@ dump_subexp_body (struct expression *exp, struct ui_file *stream, int elt) + return exp->language_defn->la_exp_desc->dump_subexp_body (exp, stream, elt); + } + ++/* See parser-defs.h. */ ++ ++int ++dump_subexp_body_funcall (struct expression *exp, ++ struct ui_file *stream, int elt) ++{ ++ int nargs = longest_to_int (exp->elts[elt].longconst); ++ fprintf_filtered (stream, "Number of args: %d", nargs); ++ elt += 2; ++ ++ for (int i = 1; i <= nargs + 1; i++) ++ elt = dump_subexp (exp, stream, elt); ++ ++ return elt; ++} ++ + /* Default value for subexp_body in exp_descriptor vector. */ + + int +@@ -931,18 +955,7 @@ dump_subexp_body_standard (struct expression *exp, + elt += 2; + break; + case OP_FUNCALL: +- case OP_F77_UNDETERMINED_ARGLIST: +- { +- int i, nargs; +- +- nargs = longest_to_int (exp->elts[elt].longconst); +- +- fprintf_filtered (stream, "Number of args: %d", nargs); +- elt += 2; +- +- for (i = 1; i <= nargs + 1; i++) +- elt = dump_subexp (exp, stream, elt); +- } ++ elt = dump_subexp_body_funcall (exp, stream, elt); + break; + case OP_ARRAY: + { +diff --git a/gdb/expression.h b/gdb/expression.h +--- a/gdb/expression.h ++++ b/gdb/expression.h +@@ -155,6 +155,18 @@ enum noside + extern struct value *evaluate_subexp_standard + (struct type *, struct expression *, int *, enum noside); + ++/* Evaluate a function call. The function to be called is in ARGVEC[0] and ++ the arguments passed to the function are in ARGVEC[1..NARGS]. ++ FUNCTION_NAME is the name of the function, if known. ++ DEFAULT_RETURN_TYPE is used as the function's return type if the return ++ type is unknown. */ ++ ++extern struct value *evaluate_subexp_do_call (expression *exp, ++ enum noside noside, ++ int nargs, value **argvec, ++ const char *function_name, ++ type *default_return_type); ++ + /* From expprint.c */ + + extern void print_expression (struct expression *, struct ui_file *); +diff --git a/gdb/f-lang.c b/gdb/f-lang.c +--- a/gdb/f-lang.c ++++ b/gdb/f-lang.c +@@ -114,6 +114,134 @@ enum f_primitive_types { + nr_f_primitive_types + }; + ++/* Called from fortran_value_subarray to take a slice of an array or a ++ string. ARRAY is the array or string to be accessed. EXP, POS, and ++ NOSIDE are as for evaluate_subexp_standard. Return a value that is a ++ slice of the array. */ ++ ++static struct value * ++value_f90_subarray (struct value *array, ++ struct expression *exp, int *pos, enum noside noside) ++{ ++ int pc = (*pos) + 1; ++ LONGEST low_bound, high_bound; ++ struct type *range = check_typedef (value_type (array)->index_type ()); ++ enum range_type range_type ++ = (enum range_type) longest_to_int (exp->elts[pc].longconst); ++ ++ *pos += 3; ++ ++ if (range_type == LOW_BOUND_DEFAULT || range_type == BOTH_BOUND_DEFAULT) ++ low_bound = range->bounds ()->low.const_val (); ++ else ++ low_bound = value_as_long (evaluate_subexp (nullptr, exp, pos, noside)); ++ ++ if (range_type == HIGH_BOUND_DEFAULT || range_type == BOTH_BOUND_DEFAULT) ++ high_bound = range->bounds ()->high.const_val (); ++ else ++ high_bound = value_as_long (evaluate_subexp (nullptr, exp, pos, noside)); ++ ++ return value_slice (array, low_bound, high_bound - low_bound + 1); ++} ++ ++/* Helper for skipping all the arguments in an undetermined argument list. ++ This function was designed for use in the OP_F77_UNDETERMINED_ARGLIST ++ case of evaluate_subexp_standard as multiple, but not all, code paths ++ require a generic skip. */ ++ ++static void ++skip_undetermined_arglist (int nargs, struct expression *exp, int *pos, ++ enum noside noside) ++{ ++ for (int i = 0; i < nargs; ++i) ++ evaluate_subexp (nullptr, exp, pos, noside); ++} ++ ++/* Return the number of dimensions for a Fortran array or string. */ ++ ++int ++calc_f77_array_dims (struct type *array_type) ++{ ++ int ndimen = 1; ++ struct type *tmp_type; ++ ++ if ((array_type->code () == TYPE_CODE_STRING)) ++ return 1; ++ ++ if ((array_type->code () != TYPE_CODE_ARRAY)) ++ error (_("Can't get dimensions for a non-array type")); ++ ++ tmp_type = array_type; ++ ++ while ((tmp_type = TYPE_TARGET_TYPE (tmp_type))) ++ { ++ if (tmp_type->code () == TYPE_CODE_ARRAY) ++ ++ndimen; ++ } ++ return ndimen; ++} ++ ++/* Called from evaluate_subexp_standard to perform array indexing, and ++ sub-range extraction, for Fortran. As well as arrays this function ++ also handles strings as they can be treated like arrays of characters. ++ ARRAY is the array or string being accessed. EXP, POS, and NOSIDE are ++ as for evaluate_subexp_standard, and NARGS is the number of arguments ++ in this access (e.g. 'array (1,2,3)' would be NARGS 3). */ ++ ++static struct value * ++fortran_value_subarray (struct value *array, struct expression *exp, ++ int *pos, int nargs, enum noside noside) ++{ ++ if (exp->elts[*pos].opcode == OP_RANGE) ++ return value_f90_subarray (array, exp, pos, noside); ++ ++ if (noside == EVAL_SKIP) ++ { ++ skip_undetermined_arglist (nargs, exp, pos, noside); ++ /* Return the dummy value with the correct type. */ ++ return array; ++ } ++ ++ LONGEST subscript_array[MAX_FORTRAN_DIMS]; ++ int ndimensions = 1; ++ struct type *type = check_typedef (value_type (array)); ++ ++ if (nargs > MAX_FORTRAN_DIMS) ++ error (_("Too many subscripts for F77 (%d Max)"), MAX_FORTRAN_DIMS); ++ ++ ndimensions = calc_f77_array_dims (type); ++ ++ if (nargs != ndimensions) ++ error (_("Wrong number of subscripts")); ++ ++ gdb_assert (nargs > 0); ++ ++ /* Now that we know we have a legal array subscript expression let us ++ actually find out where this element exists in the array. */ ++ ++ /* Take array indices left to right. */ ++ for (int i = 0; i < nargs; i++) ++ { ++ /* Evaluate each subscript; it must be a legal integer in F77. */ ++ value *arg2 = evaluate_subexp_with_coercion (exp, pos, noside); ++ ++ /* Fill in the subscript array. */ ++ subscript_array[i] = value_as_long (arg2); ++ } ++ ++ /* Internal type of array is arranged right to left. */ ++ for (int i = nargs; i > 0; i--) ++ { ++ struct type *array_type = check_typedef (value_type (array)); ++ LONGEST index = subscript_array[i - 1]; ++ ++ array = value_subscripted_rvalue (array, index, ++ f77_get_lowerbound (array_type)); ++ } ++ ++ return array; ++} ++ + /* Special expression evaluation cases for Fortran. */ + + static struct value * +@@ -285,6 +413,87 @@ evaluate_subexp_f (struct type *expect_type, struct expression *exp, + TYPE_LENGTH (type)); + return value_from_longest (builtin_type (exp->gdbarch)->builtin_int, + TYPE_LENGTH (TYPE_TARGET_TYPE (type))); ++ ++ ++ case OP_F77_UNDETERMINED_ARGLIST: ++ /* Remember that in F77, functions, substring ops and array subscript ++ operations cannot be disambiguated at parse time. We have made ++ all array subscript operations, substring operations as well as ++ function calls come here and we now have to discover what the heck ++ this thing actually was. If it is a function, we process just as ++ if we got an OP_FUNCALL. */ ++ int nargs = longest_to_int (exp->elts[pc + 1].longconst); ++ (*pos) += 2; ++ ++ /* First determine the type code we are dealing with. */ ++ arg1 = evaluate_subexp (nullptr, exp, pos, noside); ++ type = check_typedef (value_type (arg1)); ++ enum type_code code = type->code (); ++ ++ if (code == TYPE_CODE_PTR) ++ { ++ /* Fortran always passes variable to subroutines as pointer. ++ So we need to look into its target type to see if it is ++ array, string or function. If it is, we need to switch ++ to the target value the original one points to. */ ++ struct type *target_type = check_typedef (TYPE_TARGET_TYPE (type)); ++ ++ if (target_type->code () == TYPE_CODE_ARRAY ++ || target_type->code () == TYPE_CODE_STRING ++ || target_type->code () == TYPE_CODE_FUNC) ++ { ++ arg1 = value_ind (arg1); ++ type = check_typedef (value_type (arg1)); ++ code = type->code (); ++ } ++ } ++ ++ switch (code) ++ { ++ case TYPE_CODE_ARRAY: ++ case TYPE_CODE_STRING: ++ return fortran_value_subarray (arg1, exp, pos, nargs, noside); ++ ++ case TYPE_CODE_PTR: ++ case TYPE_CODE_FUNC: ++ case TYPE_CODE_INTERNAL_FUNCTION: ++ { ++ /* It's a function call. Allocate arg vector, including ++ space for the function to be called in argvec[0] and a ++ termination NULL. */ ++ struct value **argvec = (struct value **) ++ alloca (sizeof (struct value *) * (nargs + 2)); ++ argvec[0] = arg1; ++ int tem = 1; ++ for (; tem <= nargs; tem++) ++ { ++ argvec[tem] = evaluate_subexp_with_coercion (exp, pos, noside); ++ /* Arguments in Fortran are passed by address. Coerce the ++ arguments here rather than in value_arg_coerce as ++ otherwise the call to malloc to place the non-lvalue ++ parameters in target memory is hit by this Fortran ++ specific logic. This results in malloc being called ++ with a pointer to an integer followed by an attempt to ++ malloc the arguments to malloc in target memory. ++ Infinite recursion ensues. */ ++ if (code == TYPE_CODE_PTR || code == TYPE_CODE_FUNC) ++ { ++ bool is_artificial ++ = TYPE_FIELD_ARTIFICIAL (value_type (arg1), tem - 1); ++ argvec[tem] = fortran_argument_convert (argvec[tem], ++ is_artificial); ++ } ++ } ++ argvec[tem] = 0; /* signal end of arglist */ ++ if (noside == EVAL_SKIP) ++ return eval_skip_value (exp); ++ return evaluate_subexp_do_call (exp, noside, nargs, argvec, NULL, ++ expect_type); ++ } ++ ++ default: ++ error (_("Cannot perform substring on this type")); ++ } + } + + /* Should be unreachable. */ +@@ -318,6 +527,11 @@ operator_length_f (const struct expression *exp, int pc, int *oplenp, + oplen = 1; + args = 2; + break; ++ ++ case OP_F77_UNDETERMINED_ARGLIST: ++ oplen = 3; ++ args = 1 + longest_to_int (exp->elts[pc - 2].longconst); ++ break; + } + + *oplenp = oplen; +@@ -390,6 +604,10 @@ print_subexp_f (struct expression *exp, int *pos, + case BINOP_FORTRAN_MODULO: + print_binop_subexp_f (exp, pos, stream, prec, "MODULO"); + return; ++ ++ case OP_F77_UNDETERMINED_ARGLIST: ++ print_subexp_funcall (exp, pos, stream); ++ return; + } + } + +@@ -432,6 +650,9 @@ dump_subexp_body_f (struct expression *exp, + case BINOP_FORTRAN_MODULO: + operator_length_f (exp, (elt + 1), &oplen, &nargs); + break; ++ ++ case OP_F77_UNDETERMINED_ARGLIST: ++ return dump_subexp_body_funcall (exp, stream, elt); + } + + elt += oplen; +diff --git a/gdb/fortran-operator.def b/gdb/fortran-operator.def +--- a/gdb/fortran-operator.def ++++ b/gdb/fortran-operator.def +@@ -17,6 +17,14 @@ + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + ++/* This is EXACTLY like OP_FUNCALL but is semantically different. ++ In F77, array subscript expressions, substring expressions and ++ function calls are all exactly the same syntactically. They ++ may only be disambiguated at runtime. Thus this operator, ++ which indicates that we have found something of the form ++ ( ). */ ++OP (OP_F77_UNDETERMINED_ARGLIST) ++ + /* Single operand builtins. */ + OP (UNOP_FORTRAN_KIND) + OP (UNOP_FORTRAN_FLOOR) +diff --git a/gdb/parse.c b/gdb/parse.c +--- a/gdb/parse.c ++++ b/gdb/parse.c +@@ -817,7 +817,6 @@ operator_length_standard (const struct expression *expr, int endpos, + break; + + case OP_FUNCALL: +- case OP_F77_UNDETERMINED_ARGLIST: + oplen = 3; + args = 1 + longest_to_int (expr->elts[endpos - 2].longconst); + break; +diff --git a/gdb/parser-defs.h b/gdb/parser-defs.h +--- a/gdb/parser-defs.h ++++ b/gdb/parser-defs.h +@@ -338,6 +338,13 @@ extern int dump_subexp (struct expression *, struct ui_file *, int); + extern int dump_subexp_body_standard (struct expression *, + struct ui_file *, int); + ++/* Dump (to STREAM) a function call like expression at position ELT in the ++ expression array EXP. Return a new value for ELT just after the ++ function call expression. */ ++ ++extern int dump_subexp_body_funcall (struct expression *exp, ++ struct ui_file *stream, int elt); ++ + extern void operator_length (const struct expression *, int, int *, int *); + + extern void operator_length_standard (const struct expression *, int, int *, +@@ -440,6 +447,15 @@ extern void print_subexp (struct expression *, int *, struct ui_file *, + extern void print_subexp_standard (struct expression *, int *, + struct ui_file *, enum precedence); + ++/* Print a function call like expression to STREAM. This is called as a ++ helper function by which point the expression node identifying this as a ++ function call has already been stripped off and POS should point to the ++ number of function call arguments. EXP is the object containing the ++ list of expression elements. */ ++ ++extern void print_subexp_funcall (struct expression *exp, int *pos, ++ struct ui_file *stream); ++ + /* Function used to avoid direct calls to fprintf + in the code generated by the bison parser. */ + +diff --git a/gdb/std-operator.def b/gdb/std-operator.def +--- a/gdb/std-operator.def ++++ b/gdb/std-operator.def +@@ -168,14 +168,6 @@ OP (OP_FUNCALL) + pointer. This is an Objective C message. */ + OP (OP_OBJC_MSGCALL) + +-/* This is EXACTLY like OP_FUNCALL but is semantically different. +- In F77, array subscript expressions, substring expressions and +- function calls are all exactly the same syntactically. They +- may only be disambiguated at runtime. Thus this operator, +- which indicates that we have found something of the form +- ( ). */ +-OP (OP_F77_UNDETERMINED_ARGLIST) +- + /* OP_COMPLEX takes a type in the following element, followed by another + OP_COMPLEX, making three exp_elements. It is followed by two double + args, and converts them into a complex number of the given type. */ diff --git a/SOURCES/gdb-rhbz1971095-libthread_db-update-1of5.patch b/SOURCES/gdb-rhbz1971095-libthread_db-update-1of5.patch new file mode 100644 index 0000000..4da253d --- /dev/null +++ b/SOURCES/gdb-rhbz1971095-libthread_db-update-1of5.patch @@ -0,0 +1,306 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Simon Marchi +Date: Tue, 8 Jun 2021 16:50:53 -0400 +Subject: gdb-rhbz1971095-libthread_db-update-1of5.patch + +;; Backport "gdb: try to load libthread_db only after reading all +;; shared libraries when attaching / handling a fork child" +;; (Simon Marchi, RH BZ 1971095) + +When trying to attach to a pthread process on a Linux system with glibc 2.33, +we get: + + $ ./gdb -q -nx --data-directory=data-directory -p 1472010 + Attaching to process 1472010 + [New LWP 1472013] + [New LWP 1472014] + [New LWP 1472015] + Error while reading shared library symbols for /usr/lib/libpthread.so.0: + Cannot find user-level thread for LWP 1472015: generic error + 0x00007ffff6d3637f in poll () from /usr/lib/libc.so.6 + (gdb) + +When attaching to a process (or handling a fork child, an operation very +similar to attaching), GDB reads the shared library list from the +process. For each shared library (if "set auto-solib-add" is on), it +reads its symbols and calls the "new_objfile" observable. + +The libthread-db code monitors this observable, and if it sees an +objfile named somewhat like "libpthread.so" go by, it tries to load +libthread_db.so in the GDB process itself. libthread_db knows how to +navigate libpthread's data structures to get information about the +existing threads. + +To locate these data structures, libthread_db calls ps_pglobal_lookup +(implemented in proc-service.c), passing in a symbol name and expecting +an address in return. + +Before glibc 2.33, libthread_db always asked for symbols found in +libpthread. There was no ordering problem: since we were always trying +to load libthread_db in reaction to processing libpthread (and reading +in its symbols) and libthread_db only asked symbols from libpthread, the +requested symbols could always be found. Starting with glibc 2.33, +libthread_db now asks for a symbol name that can be found in +/lib/ld-linux-x86-64.so.2 (_rtld_global). And the ordering in which GDB +reads the shared libraries from the inferior when attaching is +unfortunate, in that libpthread is processed before ld-linux. So when +loading libthread_db in reaction to processing libpthread, and +libthread_db requests the symbol that is from ld-linux, GDB is not yet +able to supply it. + +That problematic symbol lookup happens in the thread_from_lwp function, +when we call td_ta_map_lwp2thr_p, and an exception is thrown at this +point: + + #0 0x00007ffff6681012 in __cxxabiv1::__cxa_throw (obj=0x60e000006100, tinfo=0x555560033b50 , dest=0x55555d9404bc ) at /build/gcc/src/gcc/libstdc++-v3/libsupc++/eh_throw.cc:78 + #1 0x000055555e5d3734 in throw_it(return_reason, errors, const char *, typedef __va_list_tag __va_list_tag *) (reason=RETURN_ERROR, error=GENERIC_ERROR, fmt=0x55555f0c5360 "Cannot find user-level thread for LWP %ld: %s", ap=0x7fffffffaae0) at /home/simark/src/binutils-gdb/gdbsupport/common-exceptions.cc:200 + #2 0x000055555e5d37d4 in throw_verror (error=GENERIC_ERROR, fmt=0x55555f0c5360 "Cannot find user-level thread for LWP %ld: %s", ap=0x7fffffffaae0) at /home/simark/src/binutils-gdb/gdbsupport/common-exceptions.cc:208 + #3 0x000055555e0b0ed2 in verror (string=0x55555f0c5360 "Cannot find user-level thread for LWP %ld: %s", args=0x7fffffffaae0) at /home/simark/src/binutils-gdb/gdb/utils.c:171 + #4 0x000055555e5e898a in error (fmt=0x55555f0c5360 "Cannot find user-level thread for LWP %ld: %s") at /home/simark/src/binutils-gdb/gdbsupport/errors.cc:43 + #5 0x000055555d06b4bc in thread_from_lwp (stopped=0x617000035d80, ptid=...) at /home/simark/src/binutils-gdb/gdb/linux-thread-db.c:418 + #6 0x000055555d07040d in try_thread_db_load_1 (info=0x60c000011140) at /home/simark/src/binutils-gdb/gdb/linux-thread-db.c:912 + #7 0x000055555d071103 in try_thread_db_load (library=0x55555f0c62a0 "libthread_db.so.1", check_auto_load_safe=false) at /home/simark/src/binutils-gdb/gdb/linux-thread-db.c:1014 + #8 0x000055555d072168 in try_thread_db_load_from_sdir () at /home/simark/src/binutils-gdb/gdb/linux-thread-db.c:1091 + #9 0x000055555d072d1c in thread_db_load_search () at /home/simark/src/binutils-gdb/gdb/linux-thread-db.c:1146 + #10 0x000055555d07365c in thread_db_load () at /home/simark/src/binutils-gdb/gdb/linux-thread-db.c:1203 + #11 0x000055555d07373e in check_for_thread_db () at /home/simark/src/binutils-gdb/gdb/linux-thread-db.c:1246 + #12 0x000055555d0738ab in thread_db_new_objfile (objfile=0x61300000c0c0) at /home/simark/src/binutils-gdb/gdb/linux-thread-db.c:1275 + #13 0x000055555bd10740 in std::__invoke_impl (__f=@0x616000068d88: 0x55555d073745 ) at /usr/include/c++/10.2.0/bits/invoke.h:60 + #14 0x000055555bd02096 in std::__invoke_r (__fn=@0x616000068d88: 0x55555d073745 ) at /usr/include/c++/10.2.0/bits/invoke.h:153 + #15 0x000055555bce0392 in std::_Function_handler::_M_invoke(std::_Any_data const&, objfile*&&) (__functor=..., __args#0=@0x7fffffffb4a0: 0x61300000c0c0) at /usr/include/c++/10.2.0/bits/std_function.h:291 + #16 0x000055555d3595c0 in std::function::operator()(objfile*) const (this=0x616000068d88, __args#0=0x61300000c0c0) at /usr/include/c++/10.2.0/bits/std_function.h:622 + #17 0x000055555d356b7f in gdb::observers::observable::notify (this=0x555566727020 , args#0=0x61300000c0c0) at /home/simark/src/binutils-gdb/gdb/../gdbsupport/observable.h:106 + #18 0x000055555da3f228 in symbol_file_add_with_addrs (abfd=0x61200001ccc0, name=0x6190000d9090 "/usr/lib/libpthread.so.0", add_flags=..., addrs=0x7fffffffbc10, flags=..., parent=0x0) at /home/simark/src/binutils-gdb/gdb/symfile.c:1131 + #19 0x000055555da3f763 in symbol_file_add_from_bfd (abfd=0x61200001ccc0, name=0x6190000d9090 "/usr/lib/libpthread.so.0", add_flags=, addrs=0x7fffffffbc10, flags=, parent=0x0) at /home/simark/src/binutils-gdb/gdb/symfile.c:1167 + #20 0x000055555d95f9fa in solib_read_symbols (so=0x6190000d8e80, flags=...) at /home/simark/src/binutils-gdb/gdb/solib.c:681 + #21 0x000055555d96233d in solib_add (pattern=0x0, from_tty=0, readsyms=1) at /home/simark/src/binutils-gdb/gdb/solib.c:987 + #22 0x000055555d93646e in enable_break (info=0x608000008f20, from_tty=0) at /home/simark/src/binutils-gdb/gdb/solib-svr4.c:2238 + #23 0x000055555d93cfc0 in svr4_solib_create_inferior_hook (from_tty=0) at /home/simark/src/binutils-gdb/gdb/solib-svr4.c:3049 + #24 0x000055555d96610d in solib_create_inferior_hook (from_tty=0) at /home/simark/src/binutils-gdb/gdb/solib.c:1195 + #25 0x000055555cdee318 in post_create_inferior (from_tty=0) at /home/simark/src/binutils-gdb/gdb/infcmd.c:318 + #26 0x000055555ce00e6e in setup_inferior (from_tty=0) at /home/simark/src/binutils-gdb/gdb/infcmd.c:2439 + #27 0x000055555ce59c34 in handle_one (event=...) at /home/simark/src/binutils-gdb/gdb/infrun.c:4887 + #28 0x000055555ce5cd00 in stop_all_threads () at /home/simark/src/binutils-gdb/gdb/infrun.c:5064 + #29 0x000055555ce7f0da in stop_waiting (ecs=0x7fffffffd170) at /home/simark/src/binutils-gdb/gdb/infrun.c:8006 + #30 0x000055555ce67f5c in handle_signal_stop (ecs=0x7fffffffd170) at /home/simark/src/binutils-gdb/gdb/infrun.c:6062 + #31 0x000055555ce63653 in handle_inferior_event (ecs=0x7fffffffd170) at /home/simark/src/binutils-gdb/gdb/infrun.c:5727 + #32 0x000055555ce4f297 in fetch_inferior_event () at /home/simark/src/binutils-gdb/gdb/infrun.c:4105 + #33 0x000055555cdbe3bf in inferior_event_handler (event_type=INF_REG_EVENT) at /home/simark/src/binutils-gdb/gdb/inf-loop.c:42 + #34 0x000055555d018047 in handle_target_event (error=0, client_data=0x0) at /home/simark/src/binutils-gdb/gdb/linux-nat.c:4060 + #35 0x000055555e5ea77e in handle_file_event (file_ptr=0x60600008b1c0, ready_mask=1) at /home/simark/src/binutils-gdb/gdbsupport/event-loop.cc:575 + #36 0x000055555e5eb09c in gdb_wait_for_event (block=0) at /home/simark/src/binutils-gdb/gdbsupport/event-loop.cc:701 + #37 0x000055555e5e8d19 in gdb_do_one_event () at /home/simark/src/binutils-gdb/gdbsupport/event-loop.cc:212 + #38 0x000055555dd6e0d4 in wait_sync_command_done () at /home/simark/src/binutils-gdb/gdb/top.c:528 + #39 0x000055555dd6e372 in maybe_wait_sync_command_done (was_sync=0) at /home/simark/src/binutils-gdb/gdb/top.c:545 + #40 0x000055555d0ec7c8 in catch_command_errors (command=0x55555ce01bb8 , arg=0x7fffffffe28d "1472010", from_tty=1, do_bp_actions=false) at /home/simark/src/binutils-gdb/gdb/main.c:452 + #41 0x000055555d0f03ad in captured_main_1 (context=0x7fffffffdd10) at /home/simark/src/binutils-gdb/gdb/main.c:1149 + #42 0x000055555d0f1239 in captured_main (data=0x7fffffffdd10) at /home/simark/src/binutils-gdb/gdb/main.c:1232 + #43 0x000055555d0f1315 in gdb_main (args=0x7fffffffdd10) at /home/simark/src/binutils-gdb/gdb/main.c:1257 + #44 0x000055555bb70cf9 in main (argc=7, argv=0x7fffffffde88) at /home/simark/src/binutils-gdb/gdb/gdb.c:32 + +The exception is caught here: + + #0 __cxxabiv1::__cxa_begin_catch (exc_obj_in=0x60e0000060e0) at /build/gcc/src/gcc/libstdc++-v3/libsupc++/eh_catch.cc:84 + #1 0x000055555d95fded in solib_read_symbols (so=0x6190000d8e80, flags=...) at /home/simark/src/binutils-gdb/gdb/solib.c:689 + #2 0x000055555d96233d in solib_add (pattern=0x0, from_tty=0, readsyms=1) at /home/simark/src/binutils-gdb/gdb/solib.c:987 + #3 0x000055555d93646e in enable_break (info=0x608000008f20, from_tty=0) at /home/simark/src/binutils-gdb/gdb/solib-svr4.c:2238 + #4 0x000055555d93cfc0 in svr4_solib_create_inferior_hook (from_tty=0) at /home/simark/src/binutils-gdb/gdb/solib-svr4.c:3049 + #5 0x000055555d96610d in solib_create_inferior_hook (from_tty=0) at /home/simark/src/binutils-gdb/gdb/solib.c:1195 + #6 0x000055555cdee318 in post_create_inferior (from_tty=0) at /home/simark/src/binutils-gdb/gdb/infcmd.c:318 + #7 0x000055555ce00e6e in setup_inferior (from_tty=0) at /home/simark/src/binutils-gdb/gdb/infcmd.c:2439 + #8 0x000055555ce59c34 in handle_one (event=...) at /home/simark/src/binutils-gdb/gdb/infrun.c:4887 + #9 0x000055555ce5cd00 in stop_all_threads () at /home/simark/src/binutils-gdb/gdb/infrun.c:5064 + #10 0x000055555ce7f0da in stop_waiting (ecs=0x7fffffffd170) at /home/simark/src/binutils-gdb/gdb/infrun.c:8006 + #11 0x000055555ce67f5c in handle_signal_stop (ecs=0x7fffffffd170) at /home/simark/src/binutils-gdb/gdb/infrun.c:6062 + #12 0x000055555ce63653 in handle_inferior_event (ecs=0x7fffffffd170) at /home/simark/src/binutils-gdb/gdb/infrun.c:5727 + #13 0x000055555ce4f297 in fetch_inferior_event () at /home/simark/src/binutils-gdb/gdb/infrun.c:4105 + #14 0x000055555cdbe3bf in inferior_event_handler (event_type=INF_REG_EVENT) at /home/simark/src/binutils-gdb/gdb/inf-loop.c:42 + #15 0x000055555d018047 in handle_target_event (error=0, client_data=0x0) at /home/simark/src/binutils-gdb/gdb/linux-nat.c:4060 + #16 0x000055555e5ea77e in handle_file_event (file_ptr=0x60600008b1c0, ready_mask=1) at /home/simark/src/binutils-gdb/gdbsupport/event-loop.cc:575 + #17 0x000055555e5eb09c in gdb_wait_for_event (block=0) at /home/simark/src/binutils-gdb/gdbsupport/event-loop.cc:701 + #18 0x000055555e5e8d19 in gdb_do_one_event () at /home/simark/src/binutils-gdb/gdbsupport/event-loop.cc:212 + #19 0x000055555dd6e0d4 in wait_sync_command_done () at /home/simark/src/binutils-gdb/gdb/top.c:528 + #20 0x000055555dd6e372 in maybe_wait_sync_command_done (was_sync=0) at /home/simark/src/binutils-gdb/gdb/top.c:545 + #21 0x000055555d0ec7c8 in catch_command_errors (command=0x55555ce01bb8 , arg=0x7fffffffe28d "1472010", from_tty=1, do_bp_actions=false) at /home/simark/src/binutils-gdb/gdb/main.c:452 + #22 0x000055555d0f03ad in captured_main_1 (context=0x7fffffffdd10) at /home/simark/src/binutils-gdb/gdb/main.c:1149 + #23 0x000055555d0f1239 in captured_main (data=0x7fffffffdd10) at /home/simark/src/binutils-gdb/gdb/main.c:1232 + #24 0x000055555d0f1315 in gdb_main (args=0x7fffffffdd10) at /home/simark/src/binutils-gdb/gdb/main.c:1257 + #25 0x000055555bb70cf9 in main (argc=7, argv=0x7fffffffde88) at /home/simark/src/binutils-gdb/gdb/gdb.c:32 + +Catching the exception at this point means that the thread_db_info +object for this inferior will be left in place, despite the failure to +load libthread_db. This means that there won't be further attempts at +loading libthread_db, because thread_db_load will think that +libthread_db is already loaded for this inferior and will always exit +early. To fix this, add a try/catch around calling try_thread_db_load_1 +in try_thread_db_load, such that if some exception is thrown while +trying to load libthread_db, we reset / delete the thread_db_info for +that inferior. That alone makes attach work fine again, because +check_for_thread_db is called again in the thread_db_inferior_created +observer (that happens after we learned about all shared libraries and +their symbols), and libthread_db is successfully loaded then. + +When attaching, I think that the inferior_created observer is a good +place to try to load libthread_db: it is called once everything has +stabilized, when we learned about all shared libraries. + +The only problem then is that when we first try (and fail) to load +libthread_db, in reaction to learning about libpthread, we show this +warning: + + warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available. + +This is misleading, because we do succeed in loading it later. So when +attaching, I think we shouldn't try to load libthread_db in reaction to +the new_objfile events, we should wait until we have learned about all +shared libraries (using the inferior_created observable). To do so, add +an `in_initial_library_scan` flag to struct inferior. This flag is used +to postpone loading libthread_db if we are attaching or handling a fork +child. + +When debugging remotely with GDBserver, the same problem happens, except +that the qSymbol mechanism (allowing the remote side to ask GDB for +symbols values) is involved. The fix there is the same idea, we make +GDB wait until all shared libraries and their symbols are known before +sending out a qSymbol packet. This way, we never present the remote +side a state where libpthread.so's symbols are known but ld-linux's +symbols aren't. + +gdb/ChangeLog: + + * inferior.h (class inferior) : New. + * infcmd.c (post_create_inferior): Set in_initial_library_scan. + * infrun.c (follow_fork_inferior): Likewise. + * linux-thread-db.c (try_thread_db_load): Catch exception thrown + by try_thread_db_load_1 + (thread_db_load): Return early if in_initial_library_scan is + set. + * remote.c (remote_new_objfile): Return early if + in_initial_library_scan is set. + +Change-Id: I7a279836cfbb2b362b4fde11b196b4aab82f5efb + +diff --git a/gdb/infcmd.c b/gdb/infcmd.c +--- a/gdb/infcmd.c ++++ b/gdb/infcmd.c +@@ -313,6 +313,10 @@ post_create_inferior (struct target_ops *target, int from_tty) + const unsigned solib_add_generation + = current_program_space->solib_add_generation; + ++ scoped_restore restore_in_initial_library_scan ++ = make_scoped_restore (¤t_inferior ()->in_initial_library_scan, ++ true); ++ + /* Create the hooks to handle shared library load and unload + events. */ + solib_create_inferior_hook (from_tty); +diff --git a/gdb/inferior.h b/gdb/inferior.h +--- a/gdb/inferior.h ++++ b/gdb/inferior.h +@@ -511,6 +511,10 @@ class inferior : public refcounted_object + architecture/description. */ + bool needs_setup = false; + ++ /* True when we are reading the library list of the inferior during an ++ attach or handling a fork child. */ ++ bool in_initial_library_scan = false; ++ + /* Private data used by the target vector implementation. */ + std::unique_ptr priv; + +diff --git a/gdb/infrun.c b/gdb/infrun.c +--- a/gdb/infrun.c ++++ b/gdb/infrun.c +@@ -540,6 +540,9 @@ holding the child stopped. Try \"set detach-on-fork\" or \ + breakpoint. If a "cloned-VM" event was propagated + better throughout the core, this wouldn't be + required. */ ++ scoped_restore restore_in_initial_library_scan ++ = make_scoped_restore (&child_inf->in_initial_library_scan, ++ true); + solib_create_inferior_hook (0); + } + } +@@ -675,6 +678,8 @@ holding the child stopped. Try \"set detach-on-fork\" or \ + shared libraries, and install the solib event breakpoint. + If a "cloned-VM" event was propagated better throughout + the core, this wouldn't be required. */ ++ scoped_restore restore_in_initial_library_scan ++ = make_scoped_restore (&child_inf->in_initial_library_scan, true); + solib_create_inferior_hook (0); + } + +diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c +--- a/gdb/linux-thread-db.c ++++ b/gdb/linux-thread-db.c +@@ -1012,8 +1012,17 @@ try_thread_db_load (const char *library, bool check_auto_load_safe) + if (strchr (library, '/') != NULL) + info->filename = gdb_realpath (library).release (); + +- if (try_thread_db_load_1 (info)) +- return true; ++ try ++ { ++ if (try_thread_db_load_1 (info)) ++ return true; ++ } ++ catch (const gdb_exception_error &except) ++ { ++ if (libthread_db_debug) ++ exception_fprintf (gdb_stdlog, except, ++ "Warning: While trying to load libthread_db: "); ++ } + + /* This library "refused" to work on current inferior. */ + delete_thread_db_info (current_inferior ()->process_target (), +@@ -1184,10 +1193,15 @@ has_libpthread (void) + static bool + thread_db_load (void) + { +- struct thread_db_info *info; ++ inferior *inf = current_inferior (); + +- info = get_thread_db_info (current_inferior ()->process_target (), +- inferior_ptid.pid ()); ++ /* When attaching / handling fork child, don't try loading libthread_db ++ until we know about all shared libraries. */ ++ if (inf->in_initial_library_scan) ++ return false; ++ ++ thread_db_info *info = get_thread_db_info (inf->process_target (), ++ inferior_ptid.pid ()); + + if (info != NULL) + return true; +diff --git a/gdb/remote.c b/gdb/remote.c +--- a/gdb/remote.c ++++ b/gdb/remote.c +@@ -14299,8 +14299,26 @@ remote_new_objfile (struct objfile *objfile) + { + remote_target *remote = get_current_remote_target (); + +- if (remote != NULL) /* Have a remote connection. */ +- remote->remote_check_symbols (); ++ /* First, check whether the current inferior's process target is a remote ++ target. */ ++ if (remote == nullptr) ++ return; ++ ++ /* When we are attaching or handling a fork child and the shared library ++ subsystem reads the list of loaded libraries, we receive new objfile ++ events in between each found library. The libraries are read in an ++ undefined order, so if we gave the remote side a chance to look up ++ symbols between each objfile, we might give it an inconsistent picture ++ of the inferior. It could appear that a library A appears loaded but ++ a library B does not, even though library A requires library B. That ++ would present a state that couldn't normally exist in the inferior. ++ ++ So, skip these events, we'll give the remote a chance to look up symbols ++ once all the loaded libraries and their symbols are known to GDB. */ ++ if (current_inferior ()->in_initial_library_scan) ++ return; ++ ++ remote->remote_check_symbols (); + } + + /* Pull all the tracepoints defined on the target and create local diff --git a/SOURCES/gdb-rhbz1971095-libthread_db-update-2of5.patch b/SOURCES/gdb-rhbz1971095-libthread_db-update-2of5.patch new file mode 100644 index 0000000..70d826f --- /dev/null +++ b/SOURCES/gdb-rhbz1971095-libthread_db-update-2of5.patch @@ -0,0 +1,148 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Kevin Buettner +Date: Wed, 9 Jun 2021 18:07:45 -0700 +Subject: gdb-rhbz1971095-libthread_db-update-2of5.patch + +;; Backport "libthread_db initialization changes related to upcoming +;; glibc-2.34" +;; (Kevin Buettner, RH BZ 19710950 + +This commit makes some adjustments to accomodate the upcoming +glibc-2.34 release. Beginning with glibc-2.34, functionality formerly +contained in libpthread has been moved to libc. For the time being, +libpthread.so still exists in the file system, but it won't show up in +ldd output and therefore won't be able to trigger initialization of +libthread_db related code. E.g... + +Fedora 34 / glibc-2.33.9000: + +[kev@f34-2 gdb]$ ldd testsuite/outputs/gdb.threads/tls/tls + linux-vdso.so.1 (0x00007ffcf94fa000) + libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007ff0ba9af000) + libm.so.6 => /lib64/libm.so.6 (0x00007ff0ba8d4000) + libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007ff0ba8b9000) + libc.so.6 => /lib64/libc.so.6 (0x00007ff0ba6c6000) + /lib64/ld-linux-x86-64.so.2 (0x00007ff0babf0000) + +Fedora 34 / glibc-2.33: + +[kev@f34-1 gdb]$ ldd testsuite/outputs/gdb.threads/tls/tls + linux-vdso.so.1 (0x00007fff32dc0000) + libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f815f6de000) + libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007f815f4bf000) + libm.so.6 => /lib64/libm.so.6 (0x00007f815f37b000) + libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f815f360000) + libc.so.6 => /lib64/libc.so.6 (0x00007f815f191000) + /lib64/ld-linux-x86-64.so.2 (0x00007f815f721000) + +Note that libpthread is missing from the ldd output for the +glibc-2.33.9000 machine. + +This means that (unless we happen to think of some entirely different +mechanism), we'll now need to potentially match "libc" in addition to +"libpthread" as libraries which might be thread libraries. This +accounts for the change made in solib.c. Note that the new code +attempts to match "/libc." via strstr(). That trailing dot (".") +avoids inadvertently matching libraries such as libcrypt (and +all the other many libraries which begin with "libc"). + +To avoid attempts to load libthread_db when encountering older +versions of libc, we now attempt to find "pthread_create" (which is a +symbol that we'd expect to be in any pthread library) in the +associated objfile. This accounts for the changes in +linux-thread-db.c. + +I think that other small adjustments will need to be made elsewhere +too. I've been working through regressions on my glibc-2.33.9000 +machine; I've fixed some fairly "obvious" changes in the testsuite +(which are in other commits). For the rest, it's not yet clear to me +whether the handful of remaining failures represent a problem in glibc +or gdb. I'm still investigating, however, I'll note that these are +problems that I only see on my glibc-2.33.9000 machine. + +gdb/ChangeLog: + + * solib.c (libpthread_name_p): Match "libc" in addition + to "libpthread". + * linux-thread-db.c (libpthread_objfile_p): New function. + (libpthread_name_p): Adjust preexisting callers to use + libpthread_objfile_p(). + +diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c +--- a/gdb/linux-thread-db.c ++++ b/gdb/linux-thread-db.c +@@ -800,6 +800,24 @@ check_thread_db (struct thread_db_info *info, bool log_progress) + return test_passed; + } + ++/* Predicate which tests whether objfile OBJ refers to the library ++ containing pthread related symbols. Historically, this library has ++ been named in such a way that looking for "libpthread" in the name ++ was sufficient to identify it. As of glibc-2.34, the C library ++ (libc) contains the thread library symbols. Therefore we check ++ that the name matches a possible thread library, but we also check ++ that it contains at least one of the symbols (pthread_create) that ++ we'd expect to find in the thread library. */ ++ ++static bool ++libpthread_objfile_p (objfile *obj) ++{ ++ return (libpthread_name_p (objfile_name (obj)) ++ && lookup_minimal_symbol ("pthread_create", ++ NULL, ++ obj).minsym != NULL); ++} ++ + /* Attempt to initialize dlopen()ed libthread_db, described by INFO. + Return true on success. + Failure could happen if libthread_db does not have symbols we expect, +@@ -1072,7 +1090,7 @@ try_thread_db_load_from_pdir (const char *subdir) + return false; + + for (objfile *obj : current_program_space->objfiles ()) +- if (libpthread_name_p (objfile_name (obj))) ++ if (libpthread_objfile_p (obj)) + { + if (try_thread_db_load_from_pdir_1 (obj, subdir)) + return true; +@@ -1181,7 +1199,7 @@ static bool + has_libpthread (void) + { + for (objfile *obj : current_program_space->objfiles ()) +- if (libpthread_name_p (objfile_name (obj))) ++ if (libpthread_objfile_p (obj)) + return true; + + return false; +@@ -1295,7 +1313,7 @@ thread_db_new_objfile (struct objfile *objfile) + of the list of shared libraries to load, and in an app of several + thousand shared libraries, this can otherwise be painful. */ + && ((objfile->flags & OBJF_MAINLINE) != 0 +- || libpthread_name_p (objfile_name (objfile)))) ++ || libpthread_objfile_p (objfile))) + check_for_thread_db (); + } + +diff --git a/gdb/solib.c b/gdb/solib.c +--- a/gdb/solib.c ++++ b/gdb/solib.c +@@ -906,12 +906,17 @@ Do you need \"set solib-search-path\" or \"set sysroot\"?"), + + Uses a fairly simplistic heuristic approach where we check + the file name against "/libpthread". This can lead to false +- positives, but this should be good enough in practice. */ ++ positives, but this should be good enough in practice. ++ ++ As of glibc-2.34, functions formerly residing in libpthread have ++ been moved to libc, so "/libc." needs to be checked too. (Matching ++ the "." will avoid matching libraries such as libcrypt.) */ + + bool + libpthread_name_p (const char *name) + { +- return (strstr (name, "/libpthread") != NULL); ++ return (strstr (name, "/libpthread") != NULL ++ || strstr (name, "/libc.") != NULL ); + } + + /* Return non-zero if SO is the libpthread shared library. */ diff --git a/SOURCES/gdb-rhbz1971095-libthread_db-update-3of5.patch b/SOURCES/gdb-rhbz1971095-libthread_db-update-3of5.patch new file mode 100644 index 0000000..a07e2fd --- /dev/null +++ b/SOURCES/gdb-rhbz1971095-libthread_db-update-3of5.patch @@ -0,0 +1,71 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Kevin Buettner +Date: Wed, 9 Jun 2021 18:56:23 -0700 +Subject: gdb-rhbz1971095-libthread_db-update-3of5.patch + +;; Backport "testsuite/glib-2.34: Match/consume optional libthread_db +;; related output" +;; (Kevin Buettner, RH BZ 19710950 + +When using glibc-2.34, we now see messages related to the loading of +the thread library for non-thread programs. E.g. for the test case, +gdb.base/execl-update-breakpoints.exp, we will see the following when +starting the program: + +(gdb) break -qualified main +Breakpoint 1 at 0x100118c: file /ironwood1/sourceware-git/f34-2-glibc244_fix/bld/../../worktree-glibc244_fix/gdb/testsuite/gdb.base/execl-update-breakpoints.c, line 34. +(gdb) run +Starting program: [...]/execl-update-breakpoints1 +[Thread debugging using libthread_db enabled] +Using host libthread_db library "/lib64/libthread_db.so.1". + +The two lines of output related to libthread_db are new; we didn't see +these in the past. This is a side effect of libc now containing the +pthread API - we can no longer tell whether the program is +multi-threaded by simply looking for libpthread.so. That said, I +think that we now want to load libthread_db anyway since it's used to +resolve TLS variables; i.e. we need it for correctly determining the +value of errno. + +This commit adds the necessary regular expressions to match this +(optional) additional output in the two tests which were failing +without it. + +gdb/testsuite/ChangeLog: + + * gdb.base/execl-update-breakpoints.exp: Add regular + expression for optionally matching output related to + libthread_db. + * gdb.base/fork-print-inferior-events.exp: Likewise. + +diff --git a/gdb/testsuite/gdb.base/execl-update-breakpoints.exp b/gdb/testsuite/gdb.base/execl-update-breakpoints.exp +--- a/gdb/testsuite/gdb.base/execl-update-breakpoints.exp ++++ b/gdb/testsuite/gdb.base/execl-update-breakpoints.exp +@@ -132,6 +132,7 @@ proc test { always_inserted } { + "Continuing\\.\r\n" \ + "${not_nl} is executing new program: ${not_nl}\r\n" \ + "(Reading ${not_nl} from remote target\\.\\.\\.\r\n)*" \ ++ "(?:.Thread debugging using .*? enabled.\r\nUsing .*? library .*?\\.\r\n)?" \ + "\r\n" \ + "Breakpoint 1, main.*$gdb_prompt $" + set message "continue across exec" +diff --git a/gdb/testsuite/gdb.base/fork-print-inferior-events.exp b/gdb/testsuite/gdb.base/fork-print-inferior-events.exp +--- a/gdb/testsuite/gdb.base/fork-print-inferior-events.exp ++++ b/gdb/testsuite/gdb.base/fork-print-inferior-events.exp +@@ -59,6 +59,7 @@ set detach_child_re "${reading_re}\\\[Detaching after fork from child .*\\\]\r\n + set detach_parent_re "${reading_re}\\\[Detaching after fork from parent .*\\\]\r\n" + set new_inf_re "${reading_re}\\\[New inferior $decimal \\(.*\\)\\\]\r\n" + set inf_detached_re "${reading_re}\\\[Inferior $decimal \\(.*\\) detached\\\]\r\n" ++set thread_db_re "(?:\\\[Thread debugging using .*? enabled\\\]\r\nUsing .*? library .*?\\.\r\n)?" + + set expected_output [list \ + "${attach_child_re}${new_inf_re}${detach_parent_re}${inf_detached_re}" \ +@@ -84,7 +85,7 @@ foreach_with_prefix print_inferior_events { "on" "off" } { + set output [lindex $expected_output $i] + # Always add the "Starting program..." string so that we + # match exactly the lines we want. +- set output "Starting program: $binfile\\s*\r\n${output}${exited_normally_re}" ++ set output "Starting program: $binfile\\s*\r\n${thread_db_re}${output}${thread_db_re}${exited_normally_re}" + set i [expr $i + 1] + gdb_test "run" $output + } diff --git a/SOURCES/gdb-rhbz1971095-libthread_db-update-4of5.patch b/SOURCES/gdb-rhbz1971095-libthread_db-update-4of5.patch new file mode 100644 index 0000000..ab91469 --- /dev/null +++ b/SOURCES/gdb-rhbz1971095-libthread_db-update-4of5.patch @@ -0,0 +1,88 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Kevin Buettner +Date: Wed, 9 Jun 2021 19:31:18 -0700 +Subject: gdb-rhbz1971095-libthread_db-update-4of5.patch + +;; Backport "print-symbol-loading.exp: Allow libc symbols to be already loaded" +;; (Kevin Buettner, RH BZ 1971095) + +One consequence of changing libpthread_name_p() in solib.c to (also) +match libc is that the symbols for libc will now be loaded by +solib_add() in solib.c. I think this is mostly harmless because +we'll likely want these symbols to be loaded anyway, but it did cause +two failures in gdb.base/print-symbol-loading.exp. + +Specifically... + +1) + +sharedlibrary .* +(gdb) PASS: gdb.base/print-symbol-loading.exp: shlib off: load shared-lib + +now looks like this: + +sharedlibrary .* +Symbols already loaded for /lib64/libc.so.6 +(gdb) PASS: gdb.base/print-symbol-loading.exp: shlib off: load shared-lib + +2) + +sharedlibrary .* +Loading symbols for shared libraries: .* +(gdb) PASS: gdb.base/print-symbol-loading.exp: shlib brief: load shared-lib + +now looks like this: + +sharedlibrary .* +Loading symbols for shared libraries: .* +Symbols already loaded for /lib64/libc.so.6 +(gdb) PASS: gdb.base/print-symbol-loading.exp: shlib brief: load shared-lib + +Fixing case #2 ended up being easier than #1. #1 had been using +gdb_test_no_output to correctly match this no-output case. I +ended up replacing it with gdb_test_multiple, matching the exact +expected output for each of the two now acceptable cases. + +For case #2, I simply added an optional non-capturing group +for the potential new output. + +gdb/testsuite/ChangeLog: + + * gdb.base/print-symbol-loading.exp (proc test_load_shlib): + Allow "Symbols already loaded for..." messages. + +diff --git a/gdb/testsuite/gdb.base/print-symbol-loading.exp b/gdb/testsuite/gdb.base/print-symbol-loading.exp +--- a/gdb/testsuite/gdb.base/print-symbol-loading.exp ++++ b/gdb/testsuite/gdb.base/print-symbol-loading.exp +@@ -96,6 +96,7 @@ test_load_core full + + proc test_load_shlib { print_symbol_loading } { + global binfile ++ global gdb_prompt + with_test_prefix "shlib ${print_symbol_loading}" { + clean_restart ${binfile} + gdb_test_no_output "set auto-solib-add off" +@@ -106,12 +107,20 @@ proc test_load_shlib { print_symbol_loading } { + set test_name "load shared-lib" + switch ${print_symbol_loading} { + "off" { +- gdb_test_no_output "sharedlibrary .*" \ +- ${test_name} ++ set cmd "sharedlibrary .*" ++ set cmd_regex [string_to_regexp $cmd] ++ gdb_test_multiple $cmd $test_name { ++ -re "^$cmd_regex\r\n$gdb_prompt $" { ++ pass $test_name ++ } ++ -re "^$cmd_regex\r\nSymbols already loaded for\[^\r\n\]*\\/libc\\.\[^\r\n\]*\r\n$gdb_prompt $" { ++ pass $test_name ++ } ++ } + } + "brief" { + gdb_test "sharedlibrary .*" \ +- "Loading symbols for shared libraries: \\.\\*" \ ++ "Loading symbols for shared libraries: \\.\\*.*?(?:Symbols already loaded for .*?libc)?" \ + ${test_name} + } + "full" { diff --git a/SOURCES/gdb-rhbz1971095-libthread_db-update-5of5.patch b/SOURCES/gdb-rhbz1971095-libthread_db-update-5of5.patch new file mode 100644 index 0000000..d5cd92c --- /dev/null +++ b/SOURCES/gdb-rhbz1971095-libthread_db-update-5of5.patch @@ -0,0 +1,85 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Kevin Buettner +Date: Wed, 9 Jun 2021 19:52:08 -0700 +Subject: gdb-rhbz1971095-libthread_db-update-5of5.patch + +;; Backport "mi-sym-info.exp: Increase timeout for 114-symbol-info-functions" +;; (Kevin Buettner, RH BZ 1971095) + +Loading libc.so's symbols increased the amount of time needed for +114-symbol-info-function to fetch symbols, causing a timeout during my +testing. I enclosed the entire block with a "with_timeout_factor 4", +which fixes the problem for me. (Using 2 also fixed it for me, but it +might not be enough when running this test on slower machines.) + +gdb/testsuite/ChangeLog: + + * gdb.mi/mi-sym-info.exp (114-symbol-info-function test): Increase + timeout. + +diff --git a/gdb/testsuite/gdb.mi/mi-sym-info.exp b/gdb/testsuite/gdb.mi/mi-sym-info.exp +--- a/gdb/testsuite/gdb.mi/mi-sym-info.exp ++++ b/gdb/testsuite/gdb.mi/mi-sym-info.exp +@@ -122,33 +122,35 @@ gdb_test_multiple $cmd $testname -prompt "${mi_gdb_prompt}$" { + # (from the symbol table). There's often so much output output from + # this command that we overflow expect's buffers, avoid this by + # fetching the output piece by piece. +-set testname "List all functions" +-set cmd "114-symbol-info-functions --include-nondebug" +-set state 0 +-gdb_test_multiple $cmd ${testname} -prompt "${mi_gdb_prompt}$" { +- -re "114\\^done,symbols=\{" { +- if { $state == 0 } { set state 1 } +- exp_continue +- } +- -re "debug=\\\[${symtab_re}" { +- if { $state == 1 } { set state 2 } +- exp_continue +- } +- -re ",${symtab_re}" { +- exp_continue +- } +- -re "\\\],nondebug=\\\[" { +- if { $state == 2 } { set state 3 } +- exp_continue +- } +- -re "\{address=${qstr},name=${qstr}\}," { +- exp_continue +- } +- -re "\{address=${qstr},name=${qstr}\}\\\]\}\r\n${mi_gdb_prompt}$" { +- if { $state == 3 } { +- pass $gdb_test_name +- } else { +- fail $gdb_test_name ++with_timeout_factor 4 { ++ set testname "List all functions" ++ set cmd "114-symbol-info-functions --include-nondebug" ++ set state 0 ++ gdb_test_multiple $cmd ${testname} -prompt "${mi_gdb_prompt}$" { ++ -re "114\\^done,symbols=\{" { ++ if { $state == 0 } { set state 1 } ++ exp_continue ++ } ++ -re "debug=\\\[${symtab_re}" { ++ if { $state == 1 } { set state 2 } ++ exp_continue ++ } ++ -re ",${symtab_re}" { ++ exp_continue ++ } ++ -re "\\\],nondebug=\\\[" { ++ if { $state == 2 } { set state 3 } ++ exp_continue ++ } ++ -re "\{address=${qstr},name=${qstr}\}," { ++ exp_continue ++ } ++ -re "\{address=${qstr},name=${qstr}\}\\\]\}\r\n${mi_gdb_prompt}$" { ++ if { $state == 3 } { ++ pass $gdb_test_name ++ } else { ++ fail $gdb_test_name ++ } + } + } + } diff --git a/SOURCES/gdb-rhbz2012819-ibmz-update-1of5.patch b/SOURCES/gdb-rhbz2012819-ibmz-update-1of5.patch new file mode 100644 index 0000000..7e36aaa --- /dev/null +++ b/SOURCES/gdb-rhbz2012819-ibmz-update-1of5.patch @@ -0,0 +1,99 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Andreas Krebbel +Date: Thu, 3 Dec 2020 16:31:15 +0100 +Subject: gdb-rhbz2012819-ibmz-update-1of5.patch + +;; IBM Z: Add support for HLASM extended mnemonics +;; (Andreas Krebbel, RHBZ 2012819) + +Add extended mnemonics used in the HLASM assembler. All of them are +just aliases for instructions we already support and help when +assembling code which was written for the HLASM assembler. + +The HLASM mnemonics are documented here: +https://www.ibm.com/support/knowledgecenter/SSENW6_1.6.0/com.ibm.hlasm.v1r6.asm/asmr1023.pdf + +See the 'Branching with extended mnemonic codes' chapter. + +objdump will still print the existing mnemonics with the exception of +relative nop branches (i.e. conditional branches with an empty +condition code mask). Now we have jnop and jgnop which will be used +by objdump when possible. + +The same change have been applied to the LLVM assembler: +https://reviews.llvm.org/D92185 + +opcodes/ + + * s390-opc.txt: Add extended mnemonics. + +gas/ + + * testsuite/gas/s390/esa-g5.s: Test new extended mnemonics. + * testsuite/gas/s390/esa-g5.d: Likewise. + * testsuite/gas/s390/esa-z900.s: Likewise. + * testsuite/gas/s390/esa-z900.d: Likewise. + * testsuite/gas/s390/zarch-z900.s: Likewise. + * testsuite/gas/s390/zarch-z900.d: Likewise. + +ld/ + + * testsuite/ld-s390/tlsbin_64.dd: The newly added jgnop mnemonic + replaces long relative branches with empty condition code mask. + +diff --git a/opcodes/s390-opc.txt b/opcodes/s390-opc.txt +--- a/opcodes/s390-opc.txt ++++ b/opcodes/s390-opc.txt +@@ -246,10 +246,14 @@ d7 xc SS_L0RDRD "exclusive OR" g5 esa,zarch + f8 zap SS_LLRDRD "zero and add" g5 esa,zarch + a70a ahi RI_RI "add halfword immediate" g5 esa,zarch + 84 brxh RSI_RRP "branch relative on index high" g5 esa,zarch ++84 jxh RSI_RRP "branch relative on index high" g5 esa,zarch + 85 brxle RSI_RRP "branch relative on index low or equal" g5 esa,zarch ++85 jxle RSI_RRP "branch relative on index low or equal" g5 esa,zarch + a705 bras RI_RP "branch relative and save" g5 esa,zarch ++a705 jas RI_RP "branch relative and save" g5 esa,zarch + a704 brc RI_UP "branch relative on condition" g5 esa,zarch + a706 brct RI_RP "branch relative on count" g5 esa,zarch ++a706 jct RI_RP "branch relative on count" g5 esa,zarch + b241 cksm RRE_RR "checksum" g5 esa,zarch + a70e chi RI_RI "compare halfword immediate" g5 esa,zarch + a9 clcle RS_RRRD "compare logical long extended" g5 esa,zarch +@@ -268,8 +272,11 @@ a701 tml RI_RU "test under mask low" g5 esa,zarch + 4700 nop RX_0RRD "no operation" g5 esa,zarch optparm + 4700 b*8 RX_0RRD "conditional branch" g5 esa,zarch + 47f0 b RX_0RRD "unconditional branch" g5 esa,zarch ++a704 jnop RI_0P "nop jump" g5 esa,zarch + a704 j*8 RI_0P "conditional jump" g5 esa,zarch ++a704 br*8 RI_0P "conditional jump" g5 esa,zarch + a7f4 j RI_0P "unconditional jump" g5 esa,zarch ++a7f4 bru RI_0P "unconditional jump" g5 esa,zarch + b34a axbr RRE_FEFE "add extended bfp" g5 esa,zarch + b31a adbr RRE_FF "add long bfp" g5 esa,zarch + ed000000001a adb RXE_FRRD "add long bfp" g5 esa,zarch +@@ -437,7 +444,9 @@ e3000000001b slgf RXE_RRRD "subtract logical 64<32" z900 zarch + e3000000000c msg RXE_RRRD "multiply single 64" z900 zarch + e3000000001c msgf RXE_RRRD "multiply single 64<32" z900 zarch + ec0000000044 brxhg RIE_RRP "branch relative on index high 64" z900 zarch ++ec0000000044 jxhg RIE_RRP "branch relative on index high 64" z900 zarch + ec0000000045 brxlg RIE_RRP "branch relative on index low or equal 64" z900 zarch ++ec0000000045 jxleg RIE_RRP "branch relative on index low or equal 64" z900 zarch + eb0000000044 bxhg RSE_RRRD "branch on index high 64" z900 zarch + eb0000000045 bxleg RSE_RRRD "branch on index low or equal 64" z900 zarch + eb000000000c srlg RSE_RRRD "shift right single logical 64" z900 zarch +@@ -462,10 +471,15 @@ eb0000000080 icmh RSE_RURD "insert characters under mask high" z900 zarch + a702 tmhh RI_RU "test under mask high high" z900 zarch + a703 tmhl RI_RU "test under mask high low" z900 zarch + c004 brcl RIL_UP "branch relative on condition long" z900 esa,zarch ++c004 jgnop RIL_0P "nop jump long" z900 esa,zarch + c004 jg*8 RIL_0P "conditional jump long" z900 esa,zarch ++c004 br*8l RIL_0P "conditional jump long" z900 esa,zarch + c0f4 jg RIL_0P "unconditional jump long" z900 esa,zarch ++c0f4 brul RIL_0P "unconditional jump long" z900 esa,zarch + c005 brasl RIL_RP "branch relative and save long" z900 esa,zarch ++c005 jasl RIL_RP "branch relative and save long" z900 esa,zarch + a707 brctg RI_RP "branch relative on count 64" z900 zarch ++a707 jctg RI_RP "branch relative on count 64" z900 zarch + a709 lghi RI_RI "load halfword immediate 64" z900 zarch + a70b aghi RI_RI "add halfword immediate 64" z900 zarch + a70d mghi RI_RI "multiply halfword immediate 64" z900 zarch diff --git a/SOURCES/gdb-rhbz2012819-ibmz-update-2of5.patch b/SOURCES/gdb-rhbz2012819-ibmz-update-2of5.patch new file mode 100644 index 0000000..27b4165 --- /dev/null +++ b/SOURCES/gdb-rhbz2012819-ibmz-update-2of5.patch @@ -0,0 +1,113 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Andreas Krebbel +Date: Fri, 4 Dec 2020 09:00:43 +0100 +Subject: gdb-rhbz2012819-ibmz-update-2of5.patch + +;; IBM Z: Add risbgz and risbgnz extended mnemonics +;; (Andreas Krebbel, RHBZ 2012819) + +These two extended mnemonics are documented in the Principles of +Operations manual but currently not supported by Binutils. They +provide aliases for already supported instructions with the zero flag +being set. The flag otherwise is mingled into one of the immediate +operands what makes asm code much harder to read. + +opcodes/ + + * s390-opc.txt: Add risbgz and risbgnz. + * s390-opc.c (U6_26): New operand type. + (INSTR_RIE_RRUUU2, MASK_RIE_RRUUU2): New instruction format and + mask. + +gas/ + + * testsuite/gas/s390/zarch-z10.s: Add tests for risbgz. + * testsuite/gas/s390/zarch-z10.d: Add regexp for risbgz. + * testsuite/gas/s390/zarch-zEC12.s: Add tests for risbgnz. + * testsuite/gas/s390/zarch-zEC12.d: Add regexp for risbgnz. + +diff --git a/opcodes/s390-opc.c b/opcodes/s390-opc.c +--- a/opcodes/s390-opc.c ++++ b/opcodes/s390-opc.c +@@ -218,32 +218,34 @@ const struct s390_operand s390_operands[] = + { 8, 8, 0 }, + #define U8_16 68 /* 8 bit unsigned value starting at 16 */ + { 8, 16, 0 }, +-#define U8_24 69 /* 8 bit unsigned value starting at 24 */ ++#define U6_26 69 /* 6 bit unsigned value starting at 26 */ ++ { 6, 26, 0 }, ++#define U8_24 70 /* 8 bit unsigned value starting at 24 */ + { 8, 24, 0 }, +-#define U8_28 70 /* 8 bit unsigned value starting at 28 */ ++#define U8_28 71 /* 8 bit unsigned value starting at 28 */ + { 8, 28, 0 }, +-#define U8_32 71 /* 8 bit unsigned value starting at 32 */ ++#define U8_32 72 /* 8 bit unsigned value starting at 32 */ + { 8, 32, 0 }, +-#define U12_16 72 /* 12 bit unsigned value starting at 16 */ ++#define U12_16 73 /* 12 bit unsigned value starting at 16 */ + { 12, 16, 0 }, +-#define U16_16 73 /* 16 bit unsigned value starting at 16 */ ++#define U16_16 74 /* 16 bit unsigned value starting at 16 */ + { 16, 16, 0 }, +-#define U16_32 74 /* 16 bit unsigned value starting at 32 */ ++#define U16_32 75 /* 16 bit unsigned value starting at 32 */ + { 16, 32, 0 }, +-#define U32_16 75 /* 32 bit unsigned value starting at 16 */ ++#define U32_16 76 /* 32 bit unsigned value starting at 16 */ + { 32, 16, 0 }, + + /* PC-relative address operands. */ + +-#define J12_12 76 /* 12 bit PC relative offset at 12 */ ++#define J12_12 77 /* 12 bit PC relative offset at 12 */ + { 12, 12, S390_OPERAND_PCREL }, +-#define J16_16 77 /* 16 bit PC relative offset at 16 */ ++#define J16_16 78 /* 16 bit PC relative offset at 16 */ + { 16, 16, S390_OPERAND_PCREL }, +-#define J16_32 78 /* 16 bit PC relative offset at 32 */ ++#define J16_32 79 /* 16 bit PC relative offset at 32 */ + { 16, 32, S390_OPERAND_PCREL }, +-#define J24_24 79 /* 24 bit PC relative offset at 24 */ ++#define J24_24 80 /* 24 bit PC relative offset at 24 */ + { 24, 24, S390_OPERAND_PCREL }, +-#define J32_16 80 /* 32 bit PC relative offset at 16 */ ++#define J32_16 81 /* 32 bit PC relative offset at 16 */ + { 32, 16, S390_OPERAND_PCREL }, + + }; +@@ -313,6 +315,7 @@ const struct s390_operand s390_operands[] = + #define INSTR_RIE_R0U0 6, { R_8,U16_16,0,0,0,0 } /* e.g. clfitne */ + #define INSTR_RIE_RUI0 6, { R_8,I16_16,U4_12,0,0,0 } /* e.g. lochi */ + #define INSTR_RIE_RRUUU 6, { R_8,R_12,U8_16,U8_24,U8_32,0 } /* e.g. rnsbg */ ++#define INSTR_RIE_RRUUU2 6, { R_8,R_12,U8_16,U6_26,U8_32,0 } /* e.g. rnsbg */ + #define INSTR_RIL_0P 6, { J32_16,0,0,0,0 } /* e.g. jg */ + #define INSTR_RIL_RP 6, { R_8,J32_16,0,0,0,0 } /* e.g. brasl */ + #define INSTR_RIL_UP 6, { U4_8,J32_16,0,0,0,0 } /* e.g. brcl */ +@@ -534,6 +537,7 @@ const struct s390_operand s390_operands[] = + #define MASK_RIE_R0U0 { 0xff, 0x0f, 0x00, 0x00, 0xff, 0xff } + #define MASK_RIE_RUI0 { 0xff, 0x00, 0x00, 0x00, 0xff, 0xff } + #define MASK_RIE_RRUUU { 0xff, 0x00, 0x00, 0x00, 0x00, 0xff } ++#define MASK_RIE_RRUUU2 { 0xff, 0x00, 0x00, 0xc0, 0x00, 0xff } + #define MASK_RIL_0P { 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 } + #define MASK_RIL_RP { 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00 } + #define MASK_RIL_UP { 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00 } +diff --git a/opcodes/s390-opc.txt b/opcodes/s390-opc.txt +--- a/opcodes/s390-opc.txt ++++ b/opcodes/s390-opc.txt +@@ -970,6 +970,7 @@ ec0000000054 rnsbg RIE_RRUUU "rotate then and selected bits" z10 zarch + ec0000000057 rxsbg RIE_RRUUU "rotate then exclusive or selected bits" z10 zarch + ec0000000056 rosbg RIE_RRUUU "rotate then or selected bits" z10 zarch + ec0000000055 risbg RIE_RRUUU "rotate then insert selected bits" z10 zarch ++ec0000800055 risbgz RIE_RRUUU2 "rotate then insert selected bits and zero remaining bits" z10 zarch + c40f strl RIL_RP "store relative long (32)" z10 zarch + c40b stgrl RIL_RP "store relative long (64)" z10 zarch + c407 sthrl RIL_RP "store halfword relative long" z10 zarch +@@ -1153,6 +1154,7 @@ eb0000000023 clt$12 RSY_R0RD "compare logical and trap 32 bit reg-mem" zEC12 zar + eb000000002b clgt RSY_RURD "compare logical and trap 64 bit reg-mem" zEC12 zarch + eb000000002b clgt$12 RSY_R0RD "compare logical and trap 64 bit reg-mem" zEC12 zarch + ec0000000059 risbgn RIE_RRUUU "rotate then insert selected bits nocc" zEC12 zarch ++ec0000800059 risbgnz RIE_RRUUU2 "rotate then insert selected bits and zero remaining bits nocc" zEC12 zarch + ed00000000aa cdzt RSL_LRDFU "convert from zoned long" zEC12 zarch + ed00000000ab cxzt RSL_LRDFEU "convert from zoned extended" zEC12 zarch + ed00000000a8 czdt RSL_LRDFU "convert to zoned long" zEC12 zarch diff --git a/SOURCES/gdb-rhbz2012819-ibmz-update-3of5.patch b/SOURCES/gdb-rhbz2012819-ibmz-update-3of5.patch new file mode 100644 index 0000000..715aac7 --- /dev/null +++ b/SOURCES/gdb-rhbz2012819-ibmz-update-3of5.patch @@ -0,0 +1,84 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Andreas Krebbel +Date: Mon, 15 Feb 2021 14:20:00 +0100 +Subject: gdb-rhbz2012819-ibmz-update-3of5.patch + +;; IBM Z: Implement instruction set extensions +;; (Andreas Krebbel, RHBZ 2012819) + +opcodes/ + + * s390-mkopc.c (main): Accept arch14 as cpu string. + * s390-opc.txt: Add new arch14 instructions. + +include/ + + * opcode/s390.h (enum s390_opcode_cpu_val): Add + S390_OPCODE_ARCH14. + +gas/ + + * config/tc-s390.c (s390_parse_cpu): New entry for arch14. + * doc/c-s390.texi: Document arch14 march option. + * testsuite/gas/s390/s390.exp: Run the arch14 related tests. + * testsuite/gas/s390/zarch-arch14.d: New test. + * testsuite/gas/s390/zarch-arch14.s: New test. + +diff --git a/include/opcode/s390.h b/include/opcode/s390.h +--- a/include/opcode/s390.h ++++ b/include/opcode/s390.h +@@ -44,6 +44,7 @@ enum s390_opcode_cpu_val + S390_OPCODE_Z13, + S390_OPCODE_ARCH12, + S390_OPCODE_ARCH13, ++ S390_OPCODE_ARCH14, + S390_OPCODE_MAXCPU + }; + +diff --git a/opcodes/s390-mkopc.c b/opcodes/s390-mkopc.c +--- a/opcodes/s390-mkopc.c ++++ b/opcodes/s390-mkopc.c +@@ -381,6 +381,8 @@ main (void) + else if (strcmp (cpu_string, "z15") == 0 + || strcmp (cpu_string, "arch13") == 0) + min_cpu = S390_OPCODE_ARCH13; ++ else if (strcmp (cpu_string, "arch14") == 0) ++ min_cpu = S390_OPCODE_ARCH14; + else { + fprintf (stderr, "Couldn't parse cpu string %s\n", cpu_string); + exit (1); +diff --git a/opcodes/s390-opc.txt b/opcodes/s390-opc.txt +--- a/opcodes/s390-opc.txt ++++ b/opcodes/s390-opc.txt +@@ -2016,3 +2016,31 @@ e60000000052 vcvbg VRR_RV0UU "vector convert to binary 64 bit" arch13 zarch optp + # Message Security Assist Extension 9 + + b93a kdsa RRE_RR "compute digital signature authentication" arch13 zarch ++ ++ ++# arch14 instructions ++ ++e60000000074 vschp VRR_VVV0U0U " " arch14 zarch ++e60000002074 vschsp VRR_VVV0U0 " " arch14 zarch ++e60000003074 vschdp VRR_VVV0U0 " " arch14 zarch ++e60000004074 vschxp VRR_VVV0U0 " " arch14 zarch ++e6000000007c vscshp VRR_VVV " " arch14 zarch ++e6000000007d vcsph VRR_VVV0U0 " " arch14 zarch ++e60000000051 vclzdp VRR_VV0U2 " " arch14 zarch ++e60000000070 vpkzr VRI_VVV0UU2 " " arch14 zarch ++e60000000072 vsrpr VRI_VVV0UU2 " " arch14 zarch ++e60000000054 vupkzh VRR_VV0U2 " " arch14 zarch ++e6000000005c vupkzl VRR_VV0U2 " " arch14 zarch ++ ++b93b nnpa RRE_00 " " arch14 zarch ++e60000000056 vclfnh VRR_VV0UU2 " " arch14 zarch ++e6000000005e vclfnl VRR_VV0UU2 " " arch14 zarch ++e60000000075 vcrnf VRR_VVV0UU " " arch14 zarch ++e6000000005d vcfn VRR_VV0UU2 " " arch14 zarch ++e60000000055 vcnf VRR_VV0UU2 " " arch14 zarch ++ ++b98B rdp RRF_RURR2 " " arch14 zarch optparm ++ ++eb0000000071 lpswey SIY_URD " " arch14 zarch ++b200 lbear S_RD " " arch14 zarch ++b201 stbear S_RD " " arch14 zarch diff --git a/SOURCES/gdb-rhbz2012819-ibmz-update-4of5.patch b/SOURCES/gdb-rhbz2012819-ibmz-update-4of5.patch new file mode 100644 index 0000000..fc79839 --- /dev/null +++ b/SOURCES/gdb-rhbz2012819-ibmz-update-4of5.patch @@ -0,0 +1,50 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Andreas Krebbel +Date: Wed, 4 Aug 2021 16:51:36 +0200 +Subject: gdb-rhbz2012819-ibmz-update-4of5.patch + +;; IBM Z: Remove lpswey parameter +;; (Andreas Krebbel, RH BZ 2012819) + +opcodes/ + * s390-opc.c (INSTR_SIY_RD): New instruction format. + (MASK_SIY_RD): New instruction mask. + * s390-opc.txt: Change instruction format of lpswey to SIY_RD. + +gas/ + * testsuite/gas/s390/zarch-arch14.d: Remove last operand of + lpswey. + * testsuite/gas/s390/zarch-arch14.s: Likewise. + +(cherry picked from commit a164bbda300d1da6f97bfa14ba7fa22475e61d17) + +diff --git a/opcodes/s390-opc.c b/opcodes/s390-opc.c +--- a/opcodes/s390-opc.c ++++ b/opcodes/s390-opc.c +@@ -442,6 +442,7 @@ const struct s390_operand s390_operands[] = + #define INSTR_RX_URRD 4, { U4_8,D_20,X_12,B_16,0,0 } /* e.g. bc */ + #define INSTR_SI_RD 4, { D_20,B_16,0,0,0,0 } /* e.g. lpsw */ + #define INSTR_SI_URD 4, { D_20,B_16,U8_8,0,0,0 } /* e.g. cli */ ++#define INSTR_SIY_RD 6, { D20_20,B_16,0,0,0,0 } /* e.g. lpswey*/ + #define INSTR_SIY_URD 6, { D20_20,B_16,U8_8,0,0,0 } /* e.g. tmy */ + #define INSTR_SIY_IRD 6, { D20_20,B_16,I8_8,0,0,0 } /* e.g. asi */ + #define INSTR_SIL_RDI 6, { D_20,B_16,I16_32,0,0,0 } /* e.g. chhsi */ +@@ -664,6 +665,7 @@ const struct s390_operand s390_operands[] = + #define MASK_RX_URRD { 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 } + #define MASK_SI_RD { 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 } + #define MASK_SI_URD { 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 } ++#define MASK_SIY_RD { 0xff, 0xff, 0x00, 0x00, 0x00, 0xff } + #define MASK_SIY_URD { 0xff, 0x00, 0x00, 0x00, 0x00, 0xff } + #define MASK_SIY_IRD { 0xff, 0x00, 0x00, 0x00, 0x00, 0xff } + #define MASK_SIL_RDI { 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 } +diff --git a/opcodes/s390-opc.txt b/opcodes/s390-opc.txt +--- a/opcodes/s390-opc.txt ++++ b/opcodes/s390-opc.txt +@@ -2041,6 +2041,6 @@ e60000000055 vcnf VRR_VV0UU2 " " arch14 zarch + + b98B rdp RRF_RURR2 " " arch14 zarch optparm + +-eb0000000071 lpswey SIY_URD " " arch14 zarch ++eb0000000071 lpswey SIY_RD " " arch14 zarch + b200 lbear S_RD " " arch14 zarch + b201 stbear S_RD " " arch14 zarch diff --git a/SOURCES/gdb-rhbz2012819-ibmz-update-5of5.patch b/SOURCES/gdb-rhbz2012819-ibmz-update-5of5.patch new file mode 100644 index 0000000..e4a3ae7 --- /dev/null +++ b/SOURCES/gdb-rhbz2012819-ibmz-update-5of5.patch @@ -0,0 +1,28 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Andreas Krebbel +Date: Wed, 7 Jul 2021 14:05:00 +0200 +Subject: gdb-rhbz2012819-ibmz-update-5of5.patch + +;; IBM Z: Add another arch14 instruction +;; (Andreas Krebbel, RHBZ 2012819) + +opcodes/ + + * opcodes/s390-opc.txt: Add qpaci. + +gas/ + + * testsuite/gas/s390/zarch-arch14.d: Add qpaci. + * testsuite/gas/s390/zarch-arch14.s: Add qpaci. + +(cherry picked from commit e4cc3b47ec2c4bdb1892db7e9759f90576742f31) + +diff --git a/opcodes/s390-opc.txt b/opcodes/s390-opc.txt +--- a/opcodes/s390-opc.txt ++++ b/opcodes/s390-opc.txt +@@ -2044,3 +2044,5 @@ b98B rdp RRF_RURR2 " " arch14 zarch optparm + eb0000000071 lpswey SIY_RD " " arch14 zarch + b200 lbear S_RD " " arch14 zarch + b201 stbear S_RD " " arch14 zarch ++ ++b28f qpaci S_RD " " arch14 zarch diff --git a/SOURCES/gdb-rhbz2086761-unknown-cfa-rule.patch b/SOURCES/gdb-rhbz2086761-unknown-cfa-rule.patch new file mode 100644 index 0000000..8dd23fb --- /dev/null +++ b/SOURCES/gdb-rhbz2086761-unknown-cfa-rule.patch @@ -0,0 +1,54 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Keith Seitz +Date: Tue, 24 May 2022 07:39:17 -0700 +Subject: gdb-rhbz2086761-unknown-cfa-rule.patch + +;; Backport "fix logic of find_comp_unit and set_comp_unit" +;; (Simon Marchi, RHBZ 2086761) + +The logic in find_comp_unit and set_comp_unit is reversed. When the BFD +requires relocation, we want to put the comp_unit structure in the +map where the comp_unit objects are not shared, that is the one indexed +by objfile. If the BFD does not require relocation, then, we can share +a single comp_unit structure for all users of that BFD, so we want to +put it in the BFD-indexed map. The comments on top of +dwarf2_frame_bfd_data and dwarf2_frame_objfile_data make that clear. + +Fix it by swapping the two in find_comp_unit and set_comp_unit. + +I don't have a test for this, because I don't see how to write one in a +reasonable amount of time. + +gdb/ChangeLog: + + PR gdb/26876 + * dwarf2/frame.c (find_comp_unit, set_comp_unit): Reverse use of + dwarf2_frame_bfd_data and dwarf2_frame_objfile_data. + +diff --git a/gdb/dwarf2/frame.c b/gdb/dwarf2/frame.c +--- a/gdb/dwarf2/frame.c ++++ b/gdb/dwarf2/frame.c +@@ -1640,8 +1640,9 @@ find_comp_unit (struct objfile *objfile) + { + bfd *abfd = objfile->obfd; + if (gdb_bfd_requires_relocations (abfd)) +- return dwarf2_frame_bfd_data.get (abfd); +- return dwarf2_frame_objfile_data.get (objfile); ++ return dwarf2_frame_objfile_data.get (objfile); ++ ++ return dwarf2_frame_bfd_data.get (abfd); + } + + /* Store the comp_unit on OBJFILE, or the corresponding BFD, as +@@ -1652,8 +1653,9 @@ set_comp_unit (struct objfile *objfile, struct comp_unit *unit) + { + bfd *abfd = objfile->obfd; + if (gdb_bfd_requires_relocations (abfd)) +- return dwarf2_frame_bfd_data.set (abfd, unit); +- return dwarf2_frame_objfile_data.set (objfile, unit); ++ return dwarf2_frame_objfile_data.set (objfile, unit); ++ ++ return dwarf2_frame_bfd_data.set (abfd, unit); + } + + /* Find the FDE for *PC. Return a pointer to the FDE, and store the diff --git a/SOURCES/gdb-rhbz2155439-assert-failure-copy_type.patch b/SOURCES/gdb-rhbz2155439-assert-failure-copy_type.patch new file mode 100644 index 0000000..554d477 --- /dev/null +++ b/SOURCES/gdb-rhbz2155439-assert-failure-copy_type.patch @@ -0,0 +1,73 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Bruno Larsen +Date: Wed, 22 Mar 2023 15:48:00 +0100 +Subject: gdb-rhbz2155439-assert-failure-copy_type.patch + +;; Backport "Fix assertion failure in copy_type" +;; (Tom Tromey, RHBZ2155439) + +PR exp/20630 points out a simple way to cause an assertion failure in +copy_type -- but this was found in the wild a few times as well. + +copy_type only works for objfile-owned types, but there isn't a deep +reason for this. This patch fixes the bug by updating copy_type to +work for any sort of type. + +Better would perhaps be to finally implement type GC, but I still +haven't attempted this. + +Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=20630 + +diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c +--- a/gdb/gdbtypes.c ++++ b/gdb/gdbtypes.c +@@ -5504,27 +5504,24 @@ copy_type_recursive (struct objfile *objfile, + } + + /* Make a copy of the given TYPE, except that the pointer & reference +- types are not preserved. +- +- This function assumes that the given type has an associated objfile. +- This objfile is used to allocate the new type. */ ++ types are not preserved. */ + + struct type * + copy_type (const struct type *type) + { +- struct type *new_type; +- +- gdb_assert (TYPE_OBJFILE_OWNED (type)); +- +- new_type = alloc_type_copy (type); ++ struct type *new_type = alloc_type_copy (type); + TYPE_INSTANCE_FLAGS (new_type) = TYPE_INSTANCE_FLAGS (type); + TYPE_LENGTH (new_type) = TYPE_LENGTH (type); + memcpy (TYPE_MAIN_TYPE (new_type), TYPE_MAIN_TYPE (type), + sizeof (struct main_type)); + if (type->main_type->dyn_prop_list != NULL) +- new_type->main_type->dyn_prop_list +- = copy_dynamic_prop_list (&TYPE_OBJFILE (type) -> objfile_obstack, +- type->main_type->dyn_prop_list); ++ { ++ struct obstack *storage = (TYPE_OBJFILE_OWNED (type) ++ ? &TYPE_OBJFILE (type)->objfile_obstack ++ : gdbarch_obstack (TYPE_OWNER (type).gdbarch)); ++ new_type->main_type->dyn_prop_list ++ = copy_dynamic_prop_list (storage, type->main_type->dyn_prop_list); ++ } + + return new_type; + } +diff --git a/gdb/testsuite/gdb.base/printcmds.exp b/gdb/testsuite/gdb.base/printcmds.exp +--- a/gdb/testsuite/gdb.base/printcmds.exp ++++ b/gdb/testsuite/gdb.base/printcmds.exp +@@ -733,6 +733,9 @@ proc test_print_array_constants {} { + gdb_test_escape_braces "print {{0,1,2},{3,4,5}}" " = {{0, 1, 2}, {3, 4, 5}}" + gdb_test "print {4,5,6}\[2\]" " = 6" + gdb_test "print *&{4,5,6}\[1\]" "Attempt to take address of value not located in memory." ++ ++ # This used to cause a crash. ++ gdb_test "print {unsigned char[]}{65}" " = 65 'A'" + } + + proc test_print_enums {} { diff --git a/SOURCES/gdb-rhbz947564-findvar-assertion-frame-failed-testcase.patch b/SOURCES/gdb-rhbz947564-findvar-assertion-frame-failed-testcase.patch new file mode 100644 index 0000000..0df5ee5 --- /dev/null +++ b/SOURCES/gdb-rhbz947564-findvar-assertion-frame-failed-testcase.patch @@ -0,0 +1,147 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +Date: Fri, 27 Oct 2017 21:07:50 +0200 +Subject: gdb-rhbz947564-findvar-assertion-frame-failed-testcase.patch + +;; Import regression test for `gdb/findvar.c:417: internal-error: +;; read_var_value: Assertion `frame' failed.' (RH BZ 947564) from RHEL 6.5. +;;=fedoratest + +diff --git a/gdb/testsuite/gdb.threads/tls-rhbz947564.cc b/gdb/testsuite/gdb.threads/tls-rhbz947564.cc +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.threads/tls-rhbz947564.cc +@@ -0,0 +1,53 @@ ++#include ++#include ++ ++class x ++ { ++ public: ++ int n; ++ ++ x() : n(0) {} ++ }; ++ ++class y ++ { ++ public: ++ int v; ++ ++ y() : v(0) {} ++ static __thread x *xp; ++ }; ++ ++__thread x *y::xp; ++ ++static void ++foo (y *yp) ++{ ++ yp->v = 1; /* foo_marker */ ++} ++ ++static void * ++bar (void *unused) ++{ ++ x xinst; ++ y::xp= &xinst; ++ ++ y yy; ++ foo(&yy); ++ ++ return NULL; ++} ++ ++int ++main(int argc, char *argv[]) ++{ ++ pthread_t t[2]; ++ ++ pthread_create (&t[0], NULL, bar, NULL); ++ pthread_create (&t[1], NULL, bar, NULL); ++ ++ pthread_join (t[0], NULL); ++ pthread_join (t[1], NULL); ++ ++ return 0; ++} +diff --git a/gdb/testsuite/gdb.threads/tls-rhbz947564.exp b/gdb/testsuite/gdb.threads/tls-rhbz947564.exp +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.threads/tls-rhbz947564.exp +@@ -0,0 +1,75 @@ ++# Copyright (C) 2013 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 . */ ++ ++set testfile tls-rhbz947564 ++set srcfile ${testfile}.cc ++set binfile [standard_output_file ${testfile}] ++ ++if [istarget "*-*-linux"] then { ++ set target_cflags "-D_MIT_POSIX_THREADS" ++} else { ++ set target_cflags "" ++} ++ ++if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list c++ debug]] != "" } { ++ return -1 ++} ++ ++gdb_exit ++gdb_start ++gdb_reinitialize_dir $srcdir/$subdir ++ ++gdb_load ${binfile} ++ ++if { ![runto_main] } { ++ fail "Can't run to function main" ++ return 0 ++} ++ ++gdb_breakpoint "foo" ++gdb_continue_to_breakpoint "foo" ".* foo_marker .*" ++ ++proc get_xp_val {try} { ++ global expect_out ++ global gdb_prompt ++ global hex ++ ++ set xp_val "" ++ gdb_test_multiple "print *yp" "print yp value" { ++ -re { = \{v = 0, static xp = (0x[0-9a-f]+)\}.* } { ++ pass "print $try value of *yp" ++ set xp_val $expect_out(1,string) ++ } ++ -re "$gdb_prompt $" { ++ fail "print $try value of *yp" ++ } ++ timeout { ++ fail "print $try value of *yp (timeout)" ++ } ++ } ++ return $xp_val ++} ++ ++set first_run [get_xp_val "first"] ++ ++gdb_test "continue" "Breakpoint \[0-9\]+, foo \\\(yp=$hex\\\) at.*" ++ ++set second_run [get_xp_val "second"] ++ ++if { $first_run != $second_run } { ++ pass "different values for TLS variable" ++} else { ++ fail "different values for TLS variable" ++} diff --git a/SOURCES/gdb-rhel-7328-fix-fortran-28801.patch b/SOURCES/gdb-rhel-7328-fix-fortran-28801.patch new file mode 100644 index 0000000..d724494 --- /dev/null +++ b/SOURCES/gdb-rhel-7328-fix-fortran-28801.patch @@ -0,0 +1,259 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Tom Tromey +Date: Thu, 24 Feb 2022 09:01:42 -0700 +Subject: gdb-rhel-7328-fix-fortran-28801.patch + +;; Backport: Fix crash in Fortran code +;; (Tom Tromey, RHEL-7328) + +PR fortran/28801 points out a gdb crash that can be provoked by +certain Fortran code. The bug is that f77_get_upperbound assumes the +property is either a constant or undefined, but in this case it is +PROP_LOCEXPR. + +This patch fixes the crash by making this function (and the +lower-bound one as well) do the correct check before calling +'const_val'. + +Thanks to Andrew for writing the test case. + +Co-authored-by: Andrew Burgess +Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28801 + +diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c +--- a/gdb/f-valprint.c ++++ b/gdb/f-valprint.c +@@ -47,7 +47,7 @@ int f77_array_offset_tbl[MAX_FORTRAN_DIMS + 1][2]; + LONGEST + f77_get_lowerbound (struct type *type) + { +- if (type->bounds ()->low.kind () == PROP_UNDEFINED) ++ if (type->bounds ()->low.kind () != PROP_CONST) + error (_("Lower bound may not be '*' in F77")); + + return type->bounds ()->low.const_val (); +@@ -56,7 +56,7 @@ f77_get_lowerbound (struct type *type) + LONGEST + f77_get_upperbound (struct type *type) + { +- if (type->bounds ()->high.kind () == PROP_UNDEFINED) ++ if (type->bounds ()->high.kind () != PROP_CONST) + { + /* We have an assumed size array on our hands. Assume that + upper_bound == lower_bound so that we show at least 1 element. +diff --git a/gdb/testsuite/gdb.dwarf2/fortran-var-string.c b/gdb/testsuite/gdb.dwarf2/fortran-var-string.c +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.dwarf2/fortran-var-string.c +@@ -0,0 +1,31 @@ ++/* Copyright 2022 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 . */ ++ ++/* In the generated DWARF, we'll pretend that ARG is a string with dynamic ++ length. */ ++int ++main_helper (void *arg) ++{ ++ asm ("main_helper_label: .globl main_helper_label"); ++ return 0; ++} ++ ++int ++main (void) ++{ ++ asm ("main_label: .globl main_label"); ++ main_helper (0); ++ return 0; ++} +diff --git a/gdb/testsuite/gdb.dwarf2/fortran-var-string.exp b/gdb/testsuite/gdb.dwarf2/fortran-var-string.exp +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.dwarf2/fortran-var-string.exp +@@ -0,0 +1,175 @@ ++# Copyright 2022 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 . ++load_lib dwarf.exp ++ ++# This test can only be run on targets which support DWARF-2 and use gas. ++if {![dwarf2_support]} { ++ return 0 ++} ++ ++standard_testfile .c -dw.S ++ ++# We need to know the size of integer and address types in order ++# to write some of the debugging info we'd like to generate. ++# ++# For that, we ask GDB by debugging our dynarr-ptr.c program. ++# Any program would do, but since we already have dynarr-ptr.c ++# specifically for this testcase, might as well use that. ++ ++if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } { ++ return -1 ++} ++ ++# Make some DWARF for the test. ++set asm_file [standard_output_file $srcfile2] ++Dwarf::assemble $asm_file { ++ set int_size [get_sizeof "int" 4] ++ ++ get_func_info main ++ get_func_info main_helper ++ ++ cu {} { ++ DW_TAG_compile_unit { ++ {DW_AT_language @DW_LANG_Fortran90} ++ {DW_AT_name fortran-var-string.f90} ++ {DW_AT_comp_dir /tmp} ++ } { ++ declare_labels integer_label string_label array_lb_label \ ++ array_ub_label ++ ++ DW_TAG_subprogram { ++ {name main} ++ {low_pc $main_helper_start addr} ++ {high_pc $main_helper_len data8} ++ {DW_AT_type :$integer_label} ++ {DW_AT_decl_file 1 data1} ++ {DW_AT_decl_line 1 data1} ++ } ++ ++ DW_TAG_subprogram { ++ {name test_1_func} ++ {low_pc $main_start addr} ++ {high_pc $main_len data8} ++ {DW_AT_type :$integer_label} ++ {DW_AT_decl_file 1 data1} ++ {DW_AT_decl_line 2 data1} ++ } { ++ formal_parameter { ++ {name arg1} ++ {type :$string_label} ++ } ++ } ++ ++ DW_TAG_subprogram { ++ {name test_2_func} ++ {low_pc $main_start addr} ++ {high_pc $main_len data8} ++ {DW_AT_type :$integer_label} ++ {DW_AT_decl_file 1 data1} ++ {DW_AT_decl_line 3 data1} ++ } { ++ formal_parameter { ++ {name arg1} ++ {type :$array_ub_label} ++ } ++ } ++ ++ DW_TAG_subprogram { ++ {name test_3_func} ++ {low_pc $main_start addr} ++ {high_pc $main_len data8} ++ {DW_AT_type :$integer_label} ++ {DW_AT_decl_file 1 data1} ++ {DW_AT_decl_line 4 data1} ++ } { ++ formal_parameter { ++ {name arg1} ++ {type :$array_lb_label} ++ } ++ } ++ ++ integer_label: DW_TAG_base_type { ++ {DW_AT_byte_size $int_size DW_FORM_sdata} ++ {DW_AT_encoding @DW_ATE_signed} ++ {DW_AT_name integer} ++ } ++ ++ string_label: DW_TAG_string_type { ++ {DW_AT_byte_size $int_size DW_FORM_sdata} ++ {DW_AT_name .str.arg} ++ {DW_AT_string_length {} DW_FORM_block1} ++ } ++ ++ array_lb_label: DW_TAG_array_type { ++ {DW_AT_ordering 1 data1} ++ {DW_AT_type :$integer_label} ++ } { ++ DW_TAG_subrange_type { ++ {DW_AT_lower_bound {} DW_FORM_block1} ++ {DW_AT_upper_bound 10 DW_FORM_data1} ++ } ++ } ++ ++ array_ub_label: DW_TAG_array_type { ++ {DW_AT_ordering 1 data1} ++ {DW_AT_type :$integer_label} ++ } { ++ DW_TAG_subrange_type { ++ {DW_AT_upper_bound {} DW_FORM_block1} ++ } ++ } ++ } ++ } ++} ++ ++# Now that we've generated the DWARF debugging info, rebuild our ++# program using our debug info instead of the info generated by ++# the compiler. ++ ++if { [prepare_for_testing "failed to prepare" ${testfile} \ ++ [list $srcfile $asm_file] {nodebug}] } { ++ return -1 ++} ++ ++if ![runto_main] { ++ return -1 ++} ++ ++gdb_test_no_output "set language fortran" ++ ++gdb_test "info functions test_1_func" \ ++ "2:\\s+integer test_1_func\\(character\\*\\(\\*\\)\\);" ++ ++# We print `1` here as the bound because GDB treats this as an assumed ++# size array, and just reports the lower bound value for the upper ++# bound. ++# ++# We might, in the future, decide that there's a better way we could ++# tell the user about the type of this array argument, when that ++# happens it's OK to change the expected results here. ++gdb_test "info functions test_2_func" \ ++ "3:\\s+integer test_2_func\\(integer \\(1\\)\\);" ++ ++# It's not completely clear that this error is correct here. Why ++# can't the lower bound be a dynamic expression? ++# ++# This test was initially added to guard against the case where GDB ++# was crashing if/when it saw this situation. ++# ++# If later on, GDB's handling of array types with a dynamic loewr ++# bound changes, then it is possible that the expected result here ++# should change. ++gdb_test "info functions test_3_func" \ ++ "4:\\s+Lower bound may not be '\\*' in F77" diff --git a/SOURCES/gdb-rhel5.9-testcase-xlf-var-inside-mod.patch b/SOURCES/gdb-rhel5.9-testcase-xlf-var-inside-mod.patch new file mode 100644 index 0000000..b130d1f --- /dev/null +++ b/SOURCES/gdb-rhel5.9-testcase-xlf-var-inside-mod.patch @@ -0,0 +1,731 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +Date: Fri, 27 Oct 2017 21:07:50 +0200 +Subject: gdb-rhel5.9-testcase-xlf-var-inside-mod.patch + +;; Include testcase for `Unable to see a variable inside a module (XLF)' (BZ 823789). +;;=fedoratest + +diff --git a/gdb/testsuite/gdb.fortran/xlf-variable.S b/gdb/testsuite/gdb.fortran/xlf-variable.S +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.fortran/xlf-variable.S +@@ -0,0 +1,638 @@ ++/* 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 . */ ++ ++/* This file has been generated from the file named `xlf-variable.f', which ++ should be present in this directory. The command used to generate this ++ file was: ++ ++ xlf -qnoopt -g9 -S xlf-variable.f -o xlf-variable.S ++ ++ After issuing this command, you must hand-edit this file and remove the ++ mentions for `_xlfExit', since it is only present in XLF-specific ++ libraries. You must also make sure to remove the file named `mod1.mod' ++ which will be created in the compilation directory. ++ ++ In order to generated this file, the following XLF package was used: ++ ++ xlf.14.1.0.0.linux.eval.tar.gz ++ ++ These instructions may be different for different versions of the XLF ++ compiler. */ ++ ++.set r0,0; .set SP,1; .set RTOC,2; .set r3,3; .set r4,4 ++.set r5,5; .set r6,6; .set r7,7; .set r8,8; .set r9,9 ++.set r10,10; .set r11,11; .set r12,12; .set r13,13; .set r14,14 ++.set r15,15; .set r16,16; .set r17,17; .set r18,18; .set r19,19 ++.set r20,20; .set r21,21; .set r22,22; .set r23,23; .set r24,24 ++.set r25,25; .set r26,26; .set r27,27; .set r28,28; .set r29,29 ++.set r30,30; .set r31,31 ++.set fp0,0; .set fp1,1; .set fp2,2; .set fp3,3; .set fp4,4 ++.set fp5,5; .set fp6,6; .set fp7,7; .set fp8,8; .set fp9,9 ++.set fp10,10; .set fp11,11; .set fp12,12; .set fp13,13; .set fp14,14 ++.set fp15,15; .set fp16,16; .set fp17,17; .set fp18,18; .set fp19,19 ++.set fp20,20; .set fp21,21; .set fp22,22; .set fp23,23; .set fp24,24 ++.set fp25,25; .set fp26,26; .set fp27,27; .set fp28,28; .set fp29,29 ++.set fp30,30; .set fp31,31 ++.set v0,0; .set v1,1; .set v2,2; .set v3,3; .set v4,4 ++.set v5,5; .set v6,6; .set v7,7; .set v8,8; .set v9,9 ++.set v10,10; .set v11,11; .set v12,12; .set v13,13; .set v14,14 ++.set v15,15; .set v16,16; .set v17,17; .set v18,18; .set v19,19 ++.set v20,20; .set v21,21; .set v22,22; .set v23,23; .set v24,24 ++.set v25,25; .set v26,26; .set v27,27; .set v28,28; .set v29,29 ++.set v30,30; .set v31,31 ++.set q0,0; .set q1,1; .set q2,2; .set q3,3; .set q4,4 ++.set q5,5; .set q6,6; .set q7,7; .set q8,8; .set q9,9 ++.set q10,10; .set q11,11; .set q12,12; .set q13,13; .set q14,14 ++.set q15,15; .set q16,16; .set q17,17; .set q18,18; .set q19,19 ++.set q20,20; .set q21,21; .set q22,22; .set q23,23; .set q24,24 ++.set q25,25; .set q26,26; .set q27,27; .set q28,28; .set q29,29 ++.set q30,30; .set q31,31 ++.set MQ,0; .set XER,1; .set FROM_RTCU,4; .set FROM_RTCL,5; .set FROM_DEC,6 ++.set LR,8; .set CTR,9; .set TID,17; .set DSISR,18; .set DAR,19; .set TO_RTCU,20 ++.set TO_RTCL,21; .set TO_DEC,22; .set SDR_0,24; .set SDR_1,25; .set SRR_0,26 ++.set SRR_1,27 ++.set BO_dCTR_NZERO_AND_NOT,0; .set BO_dCTR_NZERO_AND_NOT_1,1 ++.set BO_dCTR_ZERO_AND_NOT,2; .set BO_dCTR_ZERO_AND_NOT_1,3 ++.set BO_IF_NOT,4; .set BO_IF_NOT_1,5; .set BO_IF_NOT_2,6 ++.set BO_IF_NOT_3,7; .set BO_dCTR_NZERO_AND,8; .set BO_dCTR_NZERO_AND_1,9 ++.set BO_dCTR_ZERO_AND,10; .set BO_dCTR_ZERO_AND_1,11; .set BO_IF,12 ++.set BO_IF_1,13; .set BO_IF_2,14; .set BO_IF_3,15; .set BO_dCTR_NZERO,16 ++.set BO_dCTR_NZERO_1,17; .set BO_dCTR_ZERO,18; .set BO_dCTR_ZERO_1,19 ++.set BO_ALWAYS,20; .set BO_ALWAYS_1,21; .set BO_ALWAYS_2,22 ++.set BO_ALWAYS_3,23; .set BO_dCTR_NZERO_8,24; .set BO_dCTR_NZERO_9,25 ++.set BO_dCTR_ZERO_8,26; .set BO_dCTR_ZERO_9,27; .set BO_ALWAYS_8,28 ++.set BO_ALWAYS_9,29; .set BO_ALWAYS_10,30; .set BO_ALWAYS_11,31 ++.set CR0_LT,0; .set CR0_GT,1; .set CR0_EQ,2; .set CR0_SO,3 ++.set CR1_FX,4; .set CR1_FEX,5; .set CR1_VX,6; .set CR1_OX,7 ++.set CR2_LT,8; .set CR2_GT,9; .set CR2_EQ,10; .set CR2_SO,11 ++.set CR3_LT,12; .set CR3_GT,13; .set CR3_EQ,14; .set CR3_SO,15 ++.set CR4_LT,16; .set CR4_GT,17; .set CR4_EQ,18; .set CR4_SO,19 ++.set CR5_LT,20; .set CR5_GT,21; .set CR5_EQ,22; .set CR5_SO,23 ++.set CR6_LT,24; .set CR6_GT,25; .set CR6_EQ,26; .set CR6_SO,27 ++.set CR7_LT,28; .set CR7_GT,29; .set CR7_EQ,30; .set CR7_SO,31 ++.set TO_LT,16; .set TO_GT,8; .set TO_EQ,4; .set TO_LLT,2; .set TO_LGT,1 ++ ++ .file "xlf-variable.f" ++ .globl __mod1_NMOD_____mod1 ++ .type __mod1_NMOD_____mod1,@function ++ .size __mod1_NMOD_____mod1,32 ++ .globl main ++ .type main,@function ++ .size main,68 ++ .globl __mod1_NMOD_sub1 ++ .type __mod1_NMOD_sub1,@function ++ .size __mod1_NMOD_sub1,136 ++ .globl _main ++ .type _main,@function ++ .size _main,68 ++ ++ .section ".text" ++ .align 7 ++.LC.text: ++__mod1_NMOD_____mod1: ++ stwu SP,-32(SP) ++ stw r31,28(SP) ++ or r31,SP,SP ++ b $+0x4 ++ addi r11,r31,32 ++ lwz r31,-4(r11) ++ or SP,r11,r11 ++ bclr BO_ALWAYS,CR0_LT ++.LC.text32: ++ ++__mod1_NMOD_sub1: ++ stwu SP,-32(SP) ++ stw r31,28(SP) ++ stw r30,24(SP) ++ or r31,SP,SP ++ addis r30,r0,.const_dr@ha ++ addi r30,r30,.const_dr@l ++ addis r3,r0,__N_mod1@ha ++ addi r3,r3,__N_mod1@l ++ addi r0,r0,1 ++ stb r0,4(r3) ++ addi r4,r0,14 ++ stb r4,5(r3) ++ stb r0,7(r3) ++ addis r5,r0,__N__mod1@ha ++ addi r5,r5,__N__mod1@l ++ stw r5,0(r3) ++ lbz r5,6(r3) ++ rlwinm r5,r5,0,25,25 ++ ori r5,r5,0x0040 ++ stb r5,6(r3) ++ lwz r5,0(r3) ++ lfs fp0,0(r30) ++ stfs fp0,0(r5) ++ stb r0,4(r3) ++ stb r4,5(r3) ++ addi r4,r0,0 ++ stb r4,6(r3) ++ stb r0,7(r3) ++ b $+0x4 ++ addi r11,r31,32 ++ lwz r30,-8(r11) ++ lwz r31,-4(r11) ++ or SP,r11,r11 ++ bclr BO_ALWAYS,CR0_LT ++.LC.text168: ++ .long 0 ++ .skip 0x54 ++.LC.text256: ++ ++main: ++_main: ++ mfspr r0,LR ++ stwu SP,-32(SP) ++ stw r31,28(SP) ++ stw r0,36(SP) ++ or r31,SP,SP ++ bl __mod1_NMOD_sub1 ++ addi r3,r0,0 ++.LC.text288: ++ ++ tw TO_EQ,r14,r14 ++ addi r3,r0,0 ++ b $+0x4 ++ addi r11,r31,32 ++ lwz r31,-4(r11) ++ lwz r0,4(r11) ++ mtspr LR,r0 ++ or SP,r11,r11 ++ bclr BO_ALWAYS,CR0_LT ++.LC.text324: ++ ++ ++ .section ".rodata","a" ++ .align 2 ++.LC.rodata: ++ .type .const_dr,@object ++ .size .const_dr,4 ++.const_dr: ++ .long 0x40400000 ++ ++ .section ".eh_frame","wa" ++ .align 2 ++.LC.eh_frame: ++ .long 0x0000000c ++ .long 0x00000000 ++ .long 0x0100047c ++ .long 0x410c0100 ++ .long 0x0000001c ++ .long 0x00000014 ++ .long .LC.text ++ .long 0x00000020 ++ .long 0x410e2041 ++ .long 0x9f01410d ++ .long 0x1f410a42 ++ .long 0xdf420b00 ++ .long 0x00000020 ++ .long 0x00000034 ++ .long .LC.text32 ++ .long 0x00000088 ++ .long 0x410e2041 ++ .long 0x9f01419e ++ .long 0x02410d1f ++ .long 0x590a42de ++ .long 0x41df420b ++ .long 0x0000000c ++ .long 0x00000000 ++ .long 0x0100047c ++ .long 0x410c0100 ++ .long 0x00000020 ++ .long 0x00000014 ++ .long .LC.text256 ++ .long 0x00000044 ++ .long 0x420e2041 ++ .long 0x9f014111 ++ .long 0x417f410d ++ .long 0x1f460a42 ++ .long 0xdf440b00 ++ ++ .section ".data","wa" ++ .align 4 ++.LC.data: ++ .globl __N_mod1 ++ .type __N_mod1,@object ++ .size __N_mod1,8 ++__N_mod1: ++ .long 0x00000000 ++ .long 0x01000001 ++ ++ .section ".except.1","wa" ++ .align 1 ++.LC.except.1: ++ .long .LC.text288 ++ .byte 0x01 ++ .byte 0x09 ++ ++ .ident "Fri Jun 15 16:35:45 2012 .IBM XL Fortran for Linux, V14.1 (5765-J05, 5725-C75) Version 14.01.0000.0000.Fri Jun 15 16:35:45 2012 .IBM XL Fortran for Linux, V14.1 (5765-J05, 5725-C75) Version 14.01.0000.0000." ++ ++ .section ".debug_aranges" ++ .align 0 ++.LC.debug_aranges: ++ .long 0x0000001c ++ .byte 0x00 ++ .byte 0x02 ++ .long .LC.debug_info ++ .long 0x04000000 ++ .byte 0x00 ++ .byte 0x00 ++ .long .LC.text ++ .long 0x000000a8 ++ .long 0x00000000 ++ .long 0x00000000 ++ .long 0x0000001c ++ .byte 0x00 ++ .byte 0x02 ++ .long .LC.debug_info273 ++ .long 0x04000000 ++ .byte 0x00 ++ .byte 0x00 ++ .long .LC.text256 ++ .long 0x00000044 ++ .long 0x00000000 ++ .long 0x00000000 ++ ++ .section ".debug_pubnames" ++ .align 0 ++.LC.debug_pubnames: ++ .long 0x0000002f ++ .byte 0x00 ++ .byte 0x02 ++ .long .LC.debug_info ++ .long 0x00000111 ++ .long 0x000000dc ++ .long 0x79000000 ++ .long 0x00ec7a00 ++ .long 0x000000fc ++ .long 0x5f5f6d6f ++ .long 0x64315f4e ++ .long 0x4d4f445f ++ .long 0x73756231 ++ .long 0x00000000 ++ .long 0x00000000 ++ .byte 0x18 ++ .byte 0x00 ++ .byte 0x02 ++ .long .LC.debug_info273 ++ .long 0x00000127 ++ .long 0x0000010f ++ .long 0x5f6d6169 ++ .long 0x6e000000 ++ .byte 0x00 ++ .byte 0x00 ++ ++ .section ".debug_info" ++ .align 0 ++.LC.debug_info: ++ .long 0x0000010d ++ .byte 0x00 ++ .byte 0x02 ++ .long .LC.debug_abbrev ++ .long 0x0401786c ++ .long 0x662d7661 ++ .long 0x72696162 ++ .long 0x6c652e66 ++ .byte 0x00 ++ .long .LC.debug_line ++ .long .LC.text ++ .long .LC.text168 ++ .long 0x082f726f ++ .long 0x6f742f73 ++ .long 0x65726769 ++ .long 0x6f646a2f ++ .long 0x6764622d ++ .long 0x372e302e ++ .long 0x312d3432 ++ .long 0x2e656c35 ++ .long 0x2f676462 ++ .long 0x2d372e30 ++ .long 0x2e312f67 ++ .long 0x64622f74 ++ .long 0x65737473 ++ .long 0x75697465 ++ .long 0x2f676462 ++ .long 0x2e666f72 ++ .long 0x7472616e ++ .long 0x0049424d ++ .long 0x20584c20 ++ .long 0x466f7274 ++ .long 0x72616e20 ++ .long 0x666f7220 ++ .long 0x4c696e75 ++ .long 0x782c2056 ++ .long 0x31342e31 ++ .long 0x20283537 ++ .long 0x36352d4a ++ .long 0x30352c20 ++ .long 0x35373235 ++ .long 0x2d433735 ++ .long 0x29205665 ++ .long 0x7273696f ++ .long 0x6e203134 ++ .long 0x2e30312e ++ .long 0x30303030 ++ .long 0x2e303030 ++ .long 0x30000249 ++ .long 0x4e544547 ++ .long 0x45520004 ++ .long 0x05030005 ++ .long 0x02524541 ++ .long 0x4c000404 ++ .long 0x04050000 ++ .long 0x0000c706 ++ .long 0x6d6f6431 ++ .long 0x00070503 ++ .long __N_mod1 ++ .long 0x79000100 ++ .long 0x01000000 ++ .long 0xd0070503 ++ .long __N__mod1 ++ .long 0x7a000100 ++ .long 0x01000000 ++ .long 0xc7087375 ++ .byte 0x62 ++ .byte 0x31 ++ .byte 0x00 ++ .long .LC.text32 ++ .long .LC.text168 ++ .long 0x01180101 ++ .byte 0x6f ++ .byte 0x00 ++ .byte 0x00 ++.LC.debug_info273: ++ .long 0x00000123 ++ .byte 0x00 ++ .byte 0x02 ++ .long .LC.debug_abbrev97 ++ .long 0x0401786c ++ .long 0x662d7661 ++ .long 0x72696162 ++ .long 0x6c652e66 ++ .byte 0x00 ++ .long .LC.debug_line98 ++ .long .LC.text256 ++ .long .LC.text324 ++ .long 0x082f726f ++ .long 0x6f742f73 ++ .long 0x65726769 ++ .long 0x6f646a2f ++ .long 0x6764622d ++ .long 0x372e302e ++ .long 0x312d3432 ++ .long 0x2e656c35 ++ .long 0x2f676462 ++ .long 0x2d372e30 ++ .long 0x2e312f67 ++ .long 0x64622f74 ++ .long 0x65737473 ++ .long 0x75697465 ++ .long 0x2f676462 ++ .long 0x2e666f72 ++ .long 0x7472616e ++ .long 0x0049424d ++ .long 0x20584c20 ++ .long 0x466f7274 ++ .long 0x72616e20 ++ .long 0x666f7220 ++ .long 0x4c696e75 ++ .long 0x782c2056 ++ .long 0x31342e31 ++ .long 0x20283537 ++ .long 0x36352d4a ++ .long 0x30352c20 ++ .long 0x35373235 ++ .long 0x2d433735 ++ .long 0x29205665 ++ .long 0x7273696f ++ .long 0x6e203134 ++ .long 0x2e30312e ++ .long 0x30303030 ++ .long 0x2e303030 ++ .long 0x30000249 ++ .long 0x4e544547 ++ .long 0x45520004 ++ .long 0x05030005 ++ .long 0x02524541 ++ .long 0x4c000404 ++ .long 0x04000000 ++ .long 0xb9050000 ++ .long 0x0000c706 ++ .long 0x000000f4 ++ .long 0x26264e26 ++ .long 0x6d6f6431 ++ .long 0x00080779 ++ .long 0x00022300 ++ .long 0x000000d4 ++ .long 0x00060000 ++ .long 0x010f2626 ++ .long 0x4e26266d ++ .long 0x6f643100 ++ .long 0x04077a00 ++ .long 0x02230000 ++ .long 0x0000c700 ++ .long 0x085f6d61 ++ .byte 0x69 ++ .byte 0x6e ++ .byte 0x00 ++ .long .LC.text256 ++ .long .LC.text324 ++ .long 0x0201016f ++ .long 0x000000b9 ++ .byte 0x00 ++ ++ .section ".debug_abbrev" ++ .align 0 ++.LC.debug_abbrev: ++ .long 0x01110103 ++ .long 0x08100611 ++ .long 0x01120113 ++ .long 0x0b1b0825 ++ .long 0x08000002 ++ .long 0x24000308 ++ .long 0x0b0b3e0b ++ .long 0x00000324 ++ .long 0x000b0b3e ++ .long 0x0b000004 ++ .long 0x15000000 ++ .long 0x050f0033 ++ .long 0x0b491300 ++ .long 0x00061e01 ++ .long 0x03080000 ++ .long 0x07340002 ++ .long 0x0a03083a ++ .long 0x0b3b0b3f ++ .long 0x0c491300 ++ .long 0x00082e00 ++ .long 0x03081101 ++ .long 0x12013a0b ++ .long 0x3b0b3f0c ++ .long 0x400a0000 ++ .byte 0x00 ++.LC.debug_abbrev97: ++ .long 0x01110103 ++ .long 0x08100611 ++ .long 0x01120113 ++ .long 0x0b1b0825 ++ .long 0x08000002 ++ .long 0x24000308 ++ .long 0x0b0b3e0b ++ .long 0x00000324 ++ .long 0x000b0b3e ++ .long 0x0b000004 ++ .long 0x15004913 ++ .long 0x0000050f ++ .long 0x00330b49 ++ .long 0x13000006 ++ .long 0x13010113 ++ .long 0x03080b0b ++ .long 0x0000070d ++ .long 0x00030838 ++ .long 0x0a491300 ++ .long 0x00082e00 ++ .long 0x03081101 ++ .long 0x1201360b ++ .long 0x3f0c400a ++ .long 0x49130000 ++ .byte 0x00 ++ ++ .section ".debug_line" ++ .align 0 ++.LC.debug_line: ++ .long 0x0000005e ++ .long 0x00020000 ++ .long 0x00220101 ++ .long 0x9cdc0a00 ++ .long 0x01010101 ++ .long 0x00000001 ++ .long 0x00786c66 ++ .long 0x2d766172 ++ .long 0x6961626c ++ .long 0x652e6600 ++ .long 0x00000000 ++ .long 0x04010005 ++ .byte 0x02 ++ .long .LC.text ++ .long 0x03130109 ++ .long 0x000c0309 ++ .long 0x01090014 ++ .long 0x037b0109 ++ .long 0x00180301 ++ .long 0x01090038 ++ .long 0x03010109 ++ .long 0x000c0301 ++ .long 0x01090014 ++ .long 0x03010109 ++ .long 0x00180001 ++ .byte 0x01 ++.LC.debug_line98: ++ .long 0x00000046 ++ .long 0x00020000 ++ .long 0x00220101 ++ .long 0x9cdc0a00 ++ .long 0x01010101 ++ .long 0x00000001 ++ .long 0x00786c66 ++ .long 0x2d766172 ++ .long 0x6961626c ++ .long 0x652e6600 ++ .long 0x00000000 ++ .long 0x04010005 ++ .byte 0x02 ++ .long .LC.text256 ++ .long 0x031f0109 ++ .long 0x00140300 ++ .long 0x01090004 ++ .long 0x03010109 ++ .long 0x002c0001 ++ .byte 0x01 ++ ++ .section ".debug_frame" ++ .align 0 ++.LC.debug_frame: ++ .long 0x0000000c ++ .long 0xffffffff ++ .long 0x0100047c ++ .long 0x410c0100 ++ .long 0x0000001c ++ .long .LC.debug_frame ++ .long .LC.text ++ .long 0x00000020 ++ .long 0x410e2041 ++ .long 0x9f01410d ++ .long 0x1f410a42 ++ .long 0xdf420b00 ++ .long 0x00000020 ++ .long .LC.debug_frame ++ .long .LC.text32 ++ .long 0x00000088 ++ .long 0x410e2041 ++ .long 0x9f01419e ++ .long 0x02410d1f ++ .long 0x590a42de ++ .long 0x41df420b ++.LC.debug_frame84: ++ .long 0x0000000c ++ .long 0xffffffff ++ .long 0x0100047c ++ .long 0x410c0100 ++ .long 0x00000020 ++ .long .LC.debug_frame84 ++ .long .LC.text256 ++ .long 0x00000044 ++ .long 0x420e2041 ++ .long 0x9f014111 ++ .long 0x417f410d ++ .long 0x1f460a42 ++ .long 0xdf440b00 ++ ++ .section ".debug_pubtypes" ++ .align 0 ++.LC.debug_pubtypes: ++ .long 0x00000023 ++ .byte 0x00 ++ .byte 0x02 ++ .long .LC.debug_info ++ .long 0x00000111 ++ .long 0x000000b9 ++ .long 0x494e5445 ++ .long 0x47455200 ++ .long 0x000000c7 ++ .long 0x5245414c ++ .long 0x00000000 ++ .long 0x00000000 ++ .byte 0x3e ++ .byte 0x00 ++ .byte 0x02 ++ .long .LC.debug_info273 ++ .long 0x00000127 ++ .long 0x000000b9 ++ .long 0x494e5445 ++ .long 0x47455200 ++ .long 0x000000c7 ++ .long 0x5245414c ++ .long 0x00000000 ++ .long 0xda26264e ++ .long 0x266d6f64 ++ .long 0x31000000 ++ .long 0x00f42626 ++ .long 0x4e26266d ++ .long 0x6f643100 ++ .long 0x00000000 ++ ++ .comm __N__mod1,4,16 +diff --git a/gdb/testsuite/gdb.fortran/xlf-variable.exp b/gdb/testsuite/gdb.fortran/xlf-variable.exp +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.fortran/xlf-variable.exp +@@ -0,0 +1,37 @@ ++# 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 . ++ ++# This test can only be run on PPC64 machines. ++ ++if { ![istarget powerpc64-*] || ![is_ilp32_target] } { ++ return -1 ++} ++ ++set testfile "xlf-variable" ++set srcfile ${testfile}.S ++ ++if { [prepare_for_testing $testfile.exp $testfile $srcfile] } { ++ return -1 ++} ++ ++if { ![runto_main] } { ++ return -1 ++} ++ ++gdb_test "step" ".*y => z.*" "y => z" ++gdb_test "step" ".*y = 3\.0.*" "y = 3.0" ++gdb_test "step" ".*nullify \\(y\\).*" "nullify (y)" ++gdb_test "print z" "= 3" "z = 3" ++gdb_test "ptype z" "= REAL" "z is REAL" +diff --git a/gdb/testsuite/gdb.fortran/xlf-variable.f b/gdb/testsuite/gdb.fortran/xlf-variable.f +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.fortran/xlf-variable.f +@@ -0,0 +1,33 @@ ++c Copyright 2012 Free Software Foundation, Inc. ++c ++c This program is free software; you can redistribute it and/or modify ++c it under the terms of the GNU General Public License as published by ++c the Free Software Foundation; either version 3 of the License, or ++c (at your option) any later version. ++c ++c This program is distributed in the hope that it will be useful, ++c but WITHOUT ANY WARRANTY; without even the implied warranty of ++c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++c GNU General Public License for more details. ++c ++c You should have received a copy of the GNU General Public License ++c along with this program. If not, see . ++ ++c This file is the Fortran source file for xlf-variable.f. ++c It was used to generate the assembly output called xlf-variable.S, ++c which was generated using IBM's XLF compiler. ++ ++ module mod1 ++ real, pointer :: y ++ real, target :: z ++ contains ++ subroutine sub1 ++ y => z ++ y = 3.0 ++ nullify (y) ++ end subroutine ++ end module ++ ++ use mod1 ++ call sub1 ++ end diff --git a/SOURCES/gdb-runtest-pie-override.patch b/SOURCES/gdb-runtest-pie-override.patch new file mode 100644 index 0000000..25c2bb8 --- /dev/null +++ b/SOURCES/gdb-runtest-pie-override.patch @@ -0,0 +1,49 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +Date: Fri, 27 Oct 2017 21:07:50 +0200 +Subject: gdb-runtest-pie-override.patch + +;; Hack for proper PIE run of the testsuite. +;;=fedoratest + +make check//unix/-fPIE/-pie RUNTESTFLAGS=solib-display.exp + +gcc -fpic -c -fPIE -pie -o x.o x.c +/usr/lib/gcc/x86_64-redhat-linux/4.6.1/../../../../lib64/Scrt1.o: In function `_start': +(.text+0x20): undefined reference to `main' + +=> Change the order for overrides. + +One has to also use -fPIC rather than -fPIE, -fPIC is stronger. + +The correct way would be: +make check//unix RUNTESTFLAGS='CC_FOR_TARGET=gcc\ -fPIC\ -pie CXX_FOR_TARGET=g++\ -fPIC\ -pie solib-display.exp' + +But there is a problem with testsuite.unix non-unique subdir name and also +a problem with make -j parallelization of the testsuite. + +diff --git a/gdb/testsuite/lib/future.exp b/gdb/testsuite/lib/future.exp +--- a/gdb/testsuite/lib/future.exp ++++ b/gdb/testsuite/lib/future.exp +@@ -197,6 +197,10 @@ proc gdb_default_target_compile_1 {source destfile type options} { + set ldflags "" + set dest [target_info name] + ++ if {[board_info $dest exists multilib_flags]} { ++ append add_flags " [board_info $dest multilib_flags]" ++ } ++ + if {[info exists CFLAGS_FOR_TARGET]} { + append add_flags " $CFLAGS_FOR_TARGET" + } +@@ -531,10 +535,6 @@ proc gdb_default_target_compile_1 {source destfile type options} { + } + } + +- if {[board_info $dest exists multilib_flags]} { +- append add_flags " [board_info $dest multilib_flags]" +- } +- + verbose "doing compile" + + set sources "" diff --git a/SOURCES/gdb-simultaneous-step-resume-breakpoint-test.patch b/SOURCES/gdb-simultaneous-step-resume-breakpoint-test.patch new file mode 100644 index 0000000..5e1315b --- /dev/null +++ b/SOURCES/gdb-simultaneous-step-resume-breakpoint-test.patch @@ -0,0 +1,162 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +Date: Fri, 27 Oct 2017 21:07:50 +0200 +Subject: gdb-simultaneous-step-resume-breakpoint-test.patch + +;; New test for step-resume breakpoint placed in multiple threads at once. +;;=fedoratest + +diff --git a/gdb/testsuite/gdb.threads/simultaneous-step-resume-breakpoint.c b/gdb/testsuite/gdb.threads/simultaneous-step-resume-breakpoint.c +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.threads/simultaneous-step-resume-breakpoint.c +@@ -0,0 +1,79 @@ ++/* Copyright 2009 Free Software Foundation, Inc. ++ ++ Written by Fred Fish of Cygnus Support ++ Contributed by Cygnus Support ++ ++ 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 . */ ++ ++/* Test multiple threads stepping into a .debug_line-less function with ++ a breakpoint placed on its return-to-caller point. */ ++ ++#include ++#include ++#include ++#include ++#include ++ ++#define THREADS 3 ++ ++static void * ++func (void *unused) ++{ ++ int i; ++ ++ errno = 0; ++ i = 0xdeadf00d; ++ i = sleep (THREADS); /* sleep-call */ ++ if (errno != 0) /* sleep-after */ ++ perror ("sleep"); ++ ++ /* The GDB bug with forgotten step-resume breakpoint could leave stale ++ breakpoint on the I assignment making it a nop. */ ++ if (i == 0xdeadf00d) ++ assert (0); ++ ++ assert (i == 0); ++ ++ pthread_exit (NULL); ++} ++ ++int ++main (void) ++{ ++ pthread_t threads[THREADS]; ++ int threadi; ++ ++ for (threadi = 0; threadi < THREADS; threadi++) ++ { ++ int i; ++ ++ i = pthread_create (&threads[threadi], NULL, func, NULL); ++ assert (i == 0); ++ ++ i = sleep (1); ++ assert (i == 0); ++ } ++ ++ for (threadi = 0; threadi < THREADS; threadi++) ++ { ++ int i; ++ ++ i = pthread_join (threads[threadi], NULL); ++ assert (i == 0); ++ } ++ ++ return 0; /* final-exit */ ++} +diff --git a/gdb/testsuite/gdb.threads/simultaneous-step-resume-breakpoint.exp b/gdb/testsuite/gdb.threads/simultaneous-step-resume-breakpoint.exp +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.threads/simultaneous-step-resume-breakpoint.exp +@@ -0,0 +1,65 @@ ++# Copyright (C) 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 . */ ++ ++# Test multiple threads stepping into a .debug_line-less function with ++# a breakpoint placed on its return-to-caller point. ++ ++set testfile simultaneous-step-resume-breakpoint ++set srcfile ${testfile}.c ++set binfile [standard_output_file ${testfile}] ++ ++if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { ++ return -1 ++} ++ ++gdb_exit ++gdb_start ++gdb_reinitialize_dir $srcdir/$subdir ++ ++# Ensure we have no debuginfo for the `sleep' call itself (=for libc). ++gdb_test "set debug-file-directory /DoesNotExist" ++ ++gdb_load ${binfile} ++if ![runto_main] { ++ return -1 ++} ++ ++# Red Hat vendor patch does set it to "step" by default. ++gdb_test "set scheduler-locking off" ++ ++gdb_breakpoint [gdb_get_line_number "final-exit"] ++ ++gdb_breakpoint [gdb_get_line_number "sleep-call"] ++gdb_continue_to_breakpoint "sleep-call" ++ ++gdb_test "step" "sleep-call.*" "step thread 1" ++gdb_test "step" "sleep-call.*" "step thread 2" ++gdb_test "step" "sleep-after.*" "step thread 3" ++ ++set test "first continue" ++gdb_test_multiple "continue" $test { ++ -re "final-exit.*$gdb_prompt $" { ++ # gdb-7.0. ++ pass $test ++ return ++ } ++ -re "sleep-after.*$gdb_prompt $" { ++ # Fedora/RHEL branch. ++ pass $test ++ } ++} ++ ++gdb_test "continue" "sleep-after.*" "second continue" ++gdb_test "continue" "final-exit.*" "third continue" diff --git a/SOURCES/gdb-test-bt-cfi-without-die.patch b/SOURCES/gdb-test-bt-cfi-without-die.patch new file mode 100644 index 0000000..6167c14 --- /dev/null +++ b/SOURCES/gdb-test-bt-cfi-without-die.patch @@ -0,0 +1,214 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +Date: Fri, 27 Oct 2017 21:07:50 +0200 +Subject: gdb-test-bt-cfi-without-die.patch + +;; [delayed-symfile] Test a backtrace regression on CFIs without DIE (BZ 614604). +;;=fedoratest + +http://sourceware.org/ml/archer/2010-q3/msg00028.html + +On Wed, 25 Feb 2009 00:14:29 +0100, Jan Kratochvil wrote: +> commit 6a37c2b9962258ecf9299cc34a650e64a06acaa5 +> +> There was a regression on gdb.base/savedregs.exp. +> +> quick_addrmap/require_partial_symbols should be used even for the unwind debug +> info checking as its load has been also delayed by this branch. +[...] +> --- a/gdb/dwarf2-frame.c +> +++ b/gdb/dwarf2-frame.c +[...] +> @@ -1499,6 +1500,14 @@ dwarf2_frame_find_fde (CORE_ADDR *pc) +> struct dwarf2_fde *fde; +> CORE_ADDR offset; +> +> + if (objfile->quick_addrmap) +> + { +> + if (!addrmap_find (objfile->quick_addrmap, *pc)) +> + continue; +> + } +> + /* FIXME: Read-in only .debug_frame/.eh_frame without .debug_info? */ +> + require_partial_symbols (objfile); +> + + +but this has caused a different regression (as discussed in the confcall). + +QUICK_ADDRMAP is built only from .debug_aranges. But we can have existing +built .debug_aranges for CUs in OBJFILE but still some CUs do not need to have +DWARF at all while they can feature CFIs (.eh_frame or .debug_frame). +It has been described by Daniel Jacobowitz at: + Re: [2/4] RFC: check psymtabs_addrmap before reading FDEs + http://sourceware.org/ml/gdb-patches/2010-07/msg00012.html + +Sorry for this regression by me (in that fix of a different regression). + +Fixed it the "slow way" as this branch is now obsoleted by .gdb-index. + +No regressions on {x86_64,x86_64-m32,i686}-fedora13-linux-gnu. + +Checked-in. + +Thanks, +Jan + +eb8df8566acc1ed963e3e9b77c13b9c2c3db03fb + +Test CFI is parsed even for range (function) not described by any DIE. + +https://bugzilla.redhat.com/show_bug.cgi?id=614028 + +gdb/ + * dwarf2-frame.c (dwarf2_frame_find_fde): Remove the + OBJFILE->QUICK_ADDRMAP check. New comment why. + +gdb/testsuite/ + * gdb.base/cfi-without-die.exp, gdb.base/cfi-without-die-main.c, + gdb.base/cfi-without-die-caller.c: New files. + +diff --git a/gdb/testsuite/gdb.base/cfi-without-die-caller.c b/gdb/testsuite/gdb.base/cfi-without-die-caller.c +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.base/cfi-without-die-caller.c +@@ -0,0 +1,28 @@ ++/* This testcase is part of GDB, the GNU debugger. ++ ++ Copyright 2005, 2007, 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 . */ ++ ++typedef int (*callback_t) (void); ++ ++int ++caller (callback_t callback) ++{ ++ /* Ensure some frame content to push away the return address. */ ++ volatile const long one = 1; ++ ++ /* Modify the return value to prevent any tail-call optimization. */ ++ return (*callback) () - one; ++} +diff --git a/gdb/testsuite/gdb.base/cfi-without-die-main.c b/gdb/testsuite/gdb.base/cfi-without-die-main.c +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.base/cfi-without-die-main.c +@@ -0,0 +1,32 @@ ++/* This testcase is part of GDB, the GNU debugger. ++ ++ Copyright 2005, 2007, 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 . */ ++ ++typedef int (*callback_t) (void); ++ ++extern int caller (callback_t callback); ++ ++int ++callback (void) ++{ ++ return 1; ++} ++ ++int ++main (void) ++{ ++ return caller (callback); ++} +diff --git a/gdb/testsuite/gdb.base/cfi-without-die.exp b/gdb/testsuite/gdb.base/cfi-without-die.exp +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.base/cfi-without-die.exp +@@ -0,0 +1,71 @@ ++# 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 . ++ ++# Test CFI is parsed even for range (function) not described by any DIE. ++ ++set testfile cfi-without-die ++set srcmainfile ${testfile}-main.c ++set srccallerfile ${testfile}-caller.c ++set executable ${testfile} ++set objmainfile [standard_output_file ${testfile}-main.o] ++set objcallerfile [standard_output_file ${testfile}-caller.o] ++set binfile [standard_output_file ${executable}] ++ ++if { [gdb_compile "${srcdir}/${subdir}/${srccallerfile}" ${objcallerfile} \ ++ object [list {additional_flags=-fomit-frame-pointer -fno-unwind-tables -fno-asynchronous-unwind-tables}]] != "" ++ || [gdb_compile "${srcdir}/${subdir}/${srcmainfile}" ${objmainfile} object {debug}] != "" ++ || [gdb_compile "${objmainfile} ${objcallerfile}" ${binfile} executable {}] != "" } { ++ untested ${testfile}.exp ++ return -1 ++} ++ ++clean_restart $executable ++ ++if ![runto callback] then { ++ fail "verify unwinding: Can't run to callback" ++ return 0 ++} ++set test "verify unwinding breaks without CFI" ++gdb_test_multiple "bt" $test { ++ -re " in \[?\]\[?\] .*\r\n$gdb_prompt $" { ++ # It may backtrace through some random frames even to main(). ++ pass $test ++ } ++ -re " in main .*\r\n$gdb_prompt $" { ++ fail $test ++ } ++ -re "\r\n$gdb_prompt $" { ++ pass $test ++ } ++} ++ ++if { [gdb_compile "${srcdir}/${subdir}/${srccallerfile}" ${objcallerfile} \ ++ object [list {additional_flags=-fomit-frame-pointer -funwind-tables -fasynchronous-unwind-tables}]] != "" ++ || [gdb_compile "${srcdir}/${subdir}/${srcmainfile}" ${objmainfile} object {debug}] != "" ++ || [gdb_compile "${objmainfile} ${objcallerfile}" ${binfile} executable {}] != "" } { ++ untested ${testfile}.exp ++ return -1 ++} ++ ++clean_restart $executable ++ ++if ![runto callback] then { ++ fail "test CFI without DIEs: Can't run to callback" ++ return 0 ++} ++# #0 callback () at ... ++# #1 0x00000000004004e9 in caller () ++# #2 0x00000000004004cd in main () at ... ++gdb_test "bt" "#0 +callback \[^\r\n\]+\r\n#1 \[^\r\n\]+ in caller \[^\r\n\]+\r\n#2 \[^\r\n\]+ in main \[^\r\n\]+" "verify unwindin works for CFI without DIEs" diff --git a/SOURCES/gdb-test-dw2-aranges.patch b/SOURCES/gdb-test-dw2-aranges.patch new file mode 100644 index 0000000..458e8ba --- /dev/null +++ b/SOURCES/gdb-test-dw2-aranges.patch @@ -0,0 +1,220 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +Date: Fri, 27 Oct 2017 21:07:50 +0200 +Subject: gdb-test-dw2-aranges.patch + +;; [archer-tromey-delayed-symfile] New test gdb.dwarf2/dw2-aranges.exp. +;;=fedoratest + +[archer-tromey-delayed-symfile] + +commit 77fa7778a37b0d28a7e4e5235f074a10ecf1815d +Author: Jan Kratochvil +Date: Sat Aug 15 15:05:54 2009 +0200 + + Test for "handle incorrect aranges". + + readelf: + Contents of the .debug_aranges section: + + Length: 8 + Version: 2 + Offset into .debug_info: 0x0 + Pointer Size: 0 + Segment Size: 0 + + Address Length + Floating point exception + + * gdb.dwarf2/dw2-aranges.exp, gdb.dwarf2/dw2-aranges.S: New files. + +diff --git a/gdb/testsuite/gdb.dwarf2/dw2-aranges.S b/gdb/testsuite/gdb.dwarf2/dw2-aranges.S +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.dwarf2/dw2-aranges.S +@@ -0,0 +1,140 @@ ++/* This testcase is part of GDB, the GNU debugger. ++ ++ Copyright 2004, 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 . */ ++ ++/* Test .debug_aranges containing zero address_size. */ ++ ++/* Dummy function to provide debug information for. */ ++ ++ .text ++.Lbegin_text1: ++ .globl main ++ .type main, %function ++main: ++.Lbegin_main: ++ .int 0 ++.Lend_main: ++ .size main, .-main ++.Lend_text1: ++ ++/* Debug information */ ++ ++ .section .debug_info ++.Lcu1_begin: ++ /* CU header */ ++ .4byte .Lcu1_end - .Lcu1_start /* Length of Compilation Unit */ ++.Lcu1_start: ++ .2byte 2 /* DWARF Version */ ++ .4byte .Labbrev1_begin /* Offset into abbrev section */ ++ .byte 4 /* Pointer size */ ++ ++ /* CU die */ ++ .uleb128 1 /* Abbrev: DW_TAG_compile_unit */ ++ .4byte .Lend_text1 /* DW_AT_high_pc */ ++ .4byte .Lbegin_text1 /* DW_AT_low_pc */ ++ .ascii "file1.txt\0" /* DW_AT_name */ ++ .ascii "GNU C 3.3.3\0" /* DW_AT_producer */ ++ .byte 1 /* DW_AT_language (C) */ ++ ++ /* main */ ++ .uleb128 2 /* Abbrev: DW_TAG_subprogram */ ++ .byte 1 /* DW_AT_external */ ++ .byte 1 /* DW_AT_decl_file */ ++ .byte 2 /* DW_AT_decl_line */ ++ .ascii "main\0" /* DW_AT_name */ ++ .4byte .Ltype_int-.Lcu1_begin /* DW_AT_type */ ++ .4byte .Lbegin_main /* DW_AT_low_pc */ ++ .4byte .Lend_main /* DW_AT_high_pc */ ++ .byte 1 /* DW_AT_frame_base: length */ ++ .byte 0x55 /* DW_AT_frame_base: DW_OP_reg5 */ ++ ++.Ltype_int: ++ .uleb128 3 /* Abbrev: DW_TAG_base_type */ ++ .ascii "int\0" /* DW_AT_name */ ++ .byte 4 /* DW_AT_byte_size */ ++ .byte 5 /* DW_AT_encoding */ ++ ++ .byte 0 /* End of children of CU */ ++ ++.Lcu1_end: ++ ++/* Abbrev table */ ++ .section .debug_abbrev ++.Labbrev1_begin: ++ .uleb128 1 /* Abbrev code */ ++ .uleb128 0x11 /* DW_TAG_compile_unit */ ++ .byte 1 /* has_children */ ++ .uleb128 0x12 /* DW_AT_high_pc */ ++ .uleb128 0x1 /* DW_FORM_addr */ ++ .uleb128 0x11 /* DW_AT_low_pc */ ++ .uleb128 0x1 /* DW_FORM_addr */ ++ .uleb128 0x3 /* DW_AT_name */ ++ .uleb128 0x8 /* DW_FORM_string */ ++ .uleb128 0x25 /* DW_AT_producer */ ++ .uleb128 0x8 /* DW_FORM_string */ ++ .uleb128 0x13 /* DW_AT_language */ ++ .uleb128 0xb /* DW_FORM_data1 */ ++ .byte 0x0 /* Terminator */ ++ .byte 0x0 /* Terminator */ ++ ++ .uleb128 2 /* Abbrev code */ ++ .uleb128 0x2e /* DW_TAG_subprogram */ ++ .byte 0 /* has_children */ ++ .uleb128 0x3f /* DW_AT_external */ ++ .uleb128 0xc /* DW_FORM_flag */ ++ .uleb128 0x3a /* DW_AT_decl_file */ ++ .uleb128 0xb /* DW_FORM_data1 */ ++ .uleb128 0x3b /* DW_AT_decl_line */ ++ .uleb128 0xb /* DW_FORM_data1 */ ++ .uleb128 0x3 /* DW_AT_name */ ++ .uleb128 0x8 /* DW_FORM_string */ ++ .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 0xa /* DW_FORM_block1 */ ++ .byte 0x0 /* Terminator */ ++ .byte 0x0 /* Terminator */ ++ ++ .uleb128 3 /* Abbrev code */ ++ .uleb128 0x24 /* DW_TAG_base_type */ ++ .byte 0 /* has_children */ ++ .uleb128 0x3 /* DW_AT_name */ ++ .uleb128 0x8 /* DW_FORM_string */ ++ .uleb128 0xb /* DW_AT_byte_size */ ++ .uleb128 0xb /* DW_FORM_data1 */ ++ .uleb128 0x3e /* DW_AT_encoding */ ++ .uleb128 0xb /* DW_FORM_data1 */ ++ .byte 0x0 /* Terminator */ ++ .byte 0x0 /* Terminator */ ++ ++ .byte 0x0 /* Terminator */ ++ .byte 0x0 /* Terminator */ ++ ++/* aranges table */ ++ .section .debug_aranges ++ .long .Laranges_end - 1f ++1: ++ .2byte 2 /* aranges Version */ ++ .4byte .Lcu1_begin - .debug_info /* Offset into .debug_info section */ ++ /* The GDB crasher is this zero value. */ ++ .byte 0 /* aranges address_size */ ++ .byte 0 /* aranges segment_size */ ++ ++.Laranges_end: +diff --git a/gdb/testsuite/gdb.dwarf2/dw2-aranges.exp b/gdb/testsuite/gdb.dwarf2/dw2-aranges.exp +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.dwarf2/dw2-aranges.exp +@@ -0,0 +1,40 @@ ++# Copyright 2004, 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 . ++ ++# Test .debug_aranges containing zero address_size. ++ ++# 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 ++} ++ ++set testfile "dw2-aranges" ++set srcfile ${testfile}.S ++set binfile [standard_output_file ${testfile}] ++ ++if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {nodebug}] != "" } { ++ return -1 ++} ++ ++clean_restart $testfile ++ ++# Failed gdb_load would abort the testcase execution earlier. ++pass "file loaded" diff --git a/SOURCES/gdb-test-expr-cumulative-archer.patch b/SOURCES/gdb-test-expr-cumulative-archer.patch new file mode 100644 index 0000000..28a903d --- /dev/null +++ b/SOURCES/gdb-test-expr-cumulative-archer.patch @@ -0,0 +1,223 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +Date: Fri, 27 Oct 2017 21:07:50 +0200 +Subject: gdb-test-expr-cumulative-archer.patch + +;; [archer-keiths-expr-cumulative+upstream] Import C++ testcases. +;;=fedoratest + +archer archer-keiths-expr-cumulative +b5a7497340b24199f0c7ba7fdf0d54d4df44d6bc + +diff --git a/gdb/testsuite/gdb.cp/namespace-nested-imports.cc b/gdb/testsuite/gdb.cp/namespace-nested-imports.cc +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.cp/namespace-nested-imports.cc +@@ -0,0 +1,36 @@ ++namespace A ++{ ++ namespace B ++ { ++ int ab = 11; ++ } ++} ++ ++namespace C ++{ ++ namespace D ++ { ++ using namespace A::B; ++ ++ int ++ second() ++ { ++ ab; ++ return 0; ++ } ++ } ++ ++ int ++ first() ++ { ++ //ab; ++ return D::second(); ++ } ++} ++ ++int ++main() ++{ ++ //ab; ++ return C::first(); ++} +diff --git a/gdb/testsuite/gdb.cp/namespace-nested-imports.exp b/gdb/testsuite/gdb.cp/namespace-nested-imports.exp +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.cp/namespace-nested-imports.exp +@@ -0,0 +1,50 @@ ++# 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 . ++ ++set testfile namespace-nested-imports ++set srcfile ${testfile}.cc ++set binfile [standard_output_file ${testfile}] ++if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } { ++ 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] then { ++ perror "couldn't run to breakpoint main" ++ continue ++} ++ ++gdb_test "print ab" "No symbol .* in current context." ++ ++############################################ ++gdb_breakpoint C::first ++gdb_continue_to_breakpoint "C::first" ++ ++gdb_test "print ab" "No symbol .* in current context." ++gdb_test "print C::D::ab" "= 11" ++ ++############################################ ++gdb_breakpoint C::D::second ++gdb_continue_to_breakpoint "C::D::second" ++ ++gdb_test "print ab" "= 11" +diff --git a/gdb/testsuite/gdb.cp/namespace-no-imports.cc b/gdb/testsuite/gdb.cp/namespace-no-imports.cc +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.cp/namespace-no-imports.cc +@@ -0,0 +1,37 @@ ++ ++namespace A ++{ ++ int _a = 11; ++ ++ namespace B{ ++ ++ int ab = 22; ++ ++ namespace C{ ++ ++ int abc = 33; ++ ++ int second(){ ++ return 0; ++ } ++ ++ } ++ ++ int first(){ ++ _a; ++ ab; ++ C::abc; ++ return C::second(); ++ } ++ } ++} ++ ++ ++int ++main() ++{ ++ A::_a; ++ A::B::ab; ++ A::B::C::abc; ++ return A::B::first(); ++} +diff --git a/gdb/testsuite/gdb.cp/namespace-no-imports.exp b/gdb/testsuite/gdb.cp/namespace-no-imports.exp +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.cp/namespace-no-imports.exp +@@ -0,0 +1,69 @@ ++# 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 . ++ ++set testfile namespace-no-imports ++set srcfile ${testfile}.cc ++set binfile [standard_output_file ${testfile}] ++if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } { ++ 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] then { ++ perror "couldn't run to breakpoint main" ++ continue ++} ++ ++gdb_test "print A::_a" "= 11" ++gdb_test "print A::B::ab" "= 22" ++gdb_test "print A::B::C::abc" "= 33" ++ ++gdb_test "print _a" "No symbol .* in current context." ++gdb_test "print ab" "No symbol .* in current context." ++gdb_test "print abc" "No symbol .* in current context." ++ ++############################################ ++gdb_breakpoint A::B::first ++gdb_continue_to_breakpoint "A::B::first" ++ ++gdb_test "print A::_a" "= 11" ++gdb_test "print A::B::ab" "= 22" ++gdb_test "print A::B::C::abc" "= 33" ++ ++gdb_test "print _a" "= 11" ++gdb_test "print ab" "= 22" ++gdb_test "print C::abc" "= 33" ++ ++gdb_test "print abc" "No symbol .* in current context." ++ ++############################################ ++gdb_breakpoint A::B::C::second ++gdb_continue_to_breakpoint "A::B::C::second" ++ ++gdb_test "print A::_a" "= 11" ++gdb_test "print A::B::ab" "= 22" ++gdb_test "print A::B::C::abc" "= 33" ++ ++gdb_test "print _a" "= 11" ++gdb_test "print ab" "= 22" ++gdb_test "print abc" "= 33" diff --git a/SOURCES/gdb-test-ivy-bridge.patch b/SOURCES/gdb-test-ivy-bridge.patch new file mode 100644 index 0000000..ed82789 --- /dev/null +++ b/SOURCES/gdb-test-ivy-bridge.patch @@ -0,0 +1,468 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +Date: Fri, 27 Oct 2017 21:07:50 +0200 +Subject: gdb-test-ivy-bridge.patch + +;; Test GDB opcodes/ disassembly of Intel Ivy Bridge instructions (BZ 696890). +;;=fedoratest + +diff --git a/gdb/testsuite/gdb.arch/amd64-ivy-bridge.S b/gdb/testsuite/gdb.arch/amd64-ivy-bridge.S +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.arch/amd64-ivy-bridge.S +@@ -0,0 +1,98 @@ ++/* Copyright 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 . ++ ++ This file is part of the gdb testsuite. */ ++ ++ .globl _start ++_start: .text ++ ++/* gas/i386/x86-64-rdrnd.s */ ++ .att_syntax prefix ++ rdrand %bx ++ rdrand %ebx ++ rdrand %rbx ++ rdrand %r8w ++ rdrand %r8d ++ rdrand %r8 ++ ++ .intel_syntax noprefix ++ rdrand bx ++ rdrand ebx ++ rdrand rbx ++ rdrand r8w ++ rdrand r8d ++ rdrand r8 ++ ++/* gas/i386/x86-64-f16c.s */ ++ .att_syntax prefix ++ vcvtph2ps %xmm4,%ymm4 ++ vcvtph2ps (%r8),%ymm8 ++ vcvtph2ps %xmm4,%xmm6 ++ vcvtph2ps (%rcx),%xmm4 ++ vcvtps2ph $0x2,%ymm4,%xmm4 ++ vcvtps2ph $0x2,%ymm8,(%r8) ++ vcvtps2ph $0x2,%xmm4,%xmm4 ++ vcvtps2ph $0x2,%xmm4,(%rcx) ++ ++ .intel_syntax noprefix ++ vcvtph2ps ymm4,xmm4 ++ vcvtph2ps ymm8,XMMWORD PTR [r8] ++ vcvtph2ps ymm4,[rcx] ++ vcvtph2ps xmm6,xmm4 ++ vcvtph2ps xmm4,QWORD PTR [rcx] ++ vcvtph2ps xmm4,[rcx] ++ vcvtps2ph xmm4,ymm4,0x2 ++ vcvtps2ph XMMWORD PTR [rcx],ymm4,0x2 ++ vcvtps2ph [rcx],ymm4,0x2 ++ vcvtps2ph xmm4,xmm4,0x2 ++ vcvtps2ph QWORD PTR [r8],xmm8,0x2 ++ vcvtps2ph [rcx],xmm4,0x2 ++ ++/* gas/i386/x86-64-fsgs.s */ ++ .att_syntax prefix ++ rdfsbase %ebx ++ rdfsbase %rbx ++ rdfsbase %r8d ++ rdfsbase %r8 ++ rdgsbase %ebx ++ rdgsbase %rbx ++ rdgsbase %r8d ++ rdgsbase %r8 ++ wrfsbase %ebx ++ wrfsbase %rbx ++ wrfsbase %r8d ++ wrfsbase %r8 ++ wrgsbase %ebx ++ wrgsbase %rbx ++ wrgsbase %r8d ++ wrgsbase %r8 ++ ++ .intel_syntax noprefix ++ rdfsbase ebx ++ rdfsbase rbx ++ rdfsbase r8d ++ rdfsbase r8 ++ rdgsbase ebx ++ rdgsbase rbx ++ rdgsbase r8d ++ rdgsbase r8 ++ wrfsbase ebx ++ wrfsbase rbx ++ wrfsbase r8d ++ wrfsbase r8 ++ wrgsbase ebx ++ wrgsbase rbx ++ wrgsbase r8d ++ wrgsbase r8 +diff --git a/gdb/testsuite/gdb.arch/amd64-ivy-bridge.exp b/gdb/testsuite/gdb.arch/amd64-ivy-bridge.exp +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.arch/amd64-ivy-bridge.exp +@@ -0,0 +1,170 @@ ++# Copyright 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 . ++ ++if {![istarget "x86_64-*-*"]} then { ++ return ++} ++ ++set testfile amd64-ivy-bridge ++set test compilation ++if [prepare_for_testing ${testfile}.exp ${testfile}.x ${testfile}.S [list debug "additional_flags=-m64 -nostdlib"]] { ++ unsupported $test ++ return -1 ++} ++pass $test ++ ++gdb_test_no_output "set disassembly-flavor att" ++# gas/i386/x86-64-rdrnd.d ++# gas/i386/x86-64-f16c.d ++# gas/i386/x86-64-fsgs.d ++gdb_test "disassemble/r _start" "\r ++Dump of assembler code for function _start:\r ++\[^\r\n\]+:\t66 0f c7 f3\t\( \)?rdrand %bx\r ++\[^\r\n\]+:\t0f c7 f3\t\( \)?rdrand %ebx\r ++\[^\r\n\]+:\t48 0f c7 f3\t\( \)?rdrand %rbx\r ++\[^\r\n\]+:\t66 41 0f c7 f0\t\( \)?rdrand %r8w\r ++\[^\r\n\]+:\t41 0f c7 f0\t\( \)?rdrand %r8d\r ++\[^\r\n\]+:\t49 0f c7 f0\t\( \)?rdrand %r8\r ++\[^\r\n\]+:\t66 0f c7 f3\t\( \)?rdrand %bx\r ++\[^\r\n\]+:\t0f c7 f3\t\( \)?rdrand %ebx\r ++\[^\r\n\]+:\t48 0f c7 f3\t\( \)?rdrand %rbx\r ++\[^\r\n\]+:\t66 41 0f c7 f0\t\( \)?rdrand %r8w\r ++\[^\r\n\]+:\t41 0f c7 f0\t\( \)?rdrand %r8d\r ++\[^\r\n\]+:\t49 0f c7 f0\t\( \)?rdrand %r8\r ++\[^\r\n\]+:\tc4 e2 7d 13 e4\t\( \)?vcvtph2ps %xmm4,%ymm4\r ++\[^\r\n\]+:\tc4 42 7d 13 00\t\( \)?vcvtph2ps \\(%r8\\),%ymm8\r ++\[^\r\n\]+:\tc4 e2 79 13 f4\t\( \)?vcvtph2ps %xmm4,%xmm6\r ++\[^\r\n\]+:\tc4 e2 79 13 21\t\( \)?vcvtph2ps \\(%rcx\\),%xmm4\r ++\[^\r\n\]+:\tc4 e3 7d 1d e4 02\t\( \)?vcvtps2ph \\\$0x2,%ymm4,%xmm4\r ++\[^\r\n\]+:\tc4 43 7d 1d 00 02\t\( \)?vcvtps2ph \\\$0x2,%ymm8,\\(%r8\\)\r ++\[^\r\n\]+:\tc4 e3 79 1d e4 02\t\( \)?vcvtps2ph \\\$0x2,%xmm4,%xmm4\r ++\[^\r\n\]+:\tc4 e3 79 1d 21 02\t\( \)?vcvtps2ph \\\$0x2,%xmm4,\\(%rcx\\)\r ++\[^\r\n\]+:\tc4 e2 7d 13 e4\t\( \)?vcvtph2ps %xmm4,%ymm4\r ++\[^\r\n\]+:\tc4 42 7d 13 00\t\( \)?vcvtph2ps \\(%r8\\),%ymm8\r ++\[^\r\n\]+:\tc4 e2 7d 13 21\t\( \)?vcvtph2ps \\(%rcx\\),%ymm4\r ++\[^\r\n\]+:\tc4 e2 79 13 f4\t\( \)?vcvtph2ps %xmm4,%xmm6\r ++\[^\r\n\]+:\tc4 e2 79 13 21\t\( \)?vcvtph2ps \\(%rcx\\),%xmm4\r ++\[^\r\n\]+:\tc4 e2 79 13 21\t\( \)?vcvtph2ps \\(%rcx\\),%xmm4\r ++\[^\r\n\]+:\tc4 e3 7d 1d e4 02\t\( \)?vcvtps2ph \\\$0x2,%ymm4,%xmm4\r ++\[^\r\n\]+:\tc4 e3 7d 1d 21 02\t\( \)?vcvtps2ph \\\$0x2,%ymm4,\\(%rcx\\)\r ++\[^\r\n\]+:\tc4 e3 7d 1d 21 02\t\( \)?vcvtps2ph \\\$0x2,%ymm4,\\(%rcx\\)\r ++\[^\r\n\]+:\tc4 e3 79 1d e4 02\t\( \)?vcvtps2ph \\\$0x2,%xmm4,%xmm4\r ++\[^\r\n\]+:\tc4 43 79 1d 00 02\t\( \)?vcvtps2ph \\\$0x2,%xmm8,\\(%r8\\)\r ++\[^\r\n\]+:\tc4 e3 79 1d 21 02\t\( \)?vcvtps2ph \\\$0x2,%xmm4,\\(%rcx\\)\r ++\[^\r\n\]+:\tf3 0f ae c3\t\( \)?rdfsbase %ebx\r ++\[^\r\n\]+:\tf3 48 0f ae c3\t\( \)?rdfsbase %rbx\r ++\[^\r\n\]+:\tf3 41 0f ae c0\t\( \)?rdfsbase %r8d\r ++\[^\r\n\]+:\tf3 49 0f ae c0\t\( \)?rdfsbase %r8\r ++\[^\r\n\]+:\tf3 0f ae cb\t\( \)?rdgsbase %ebx\r ++\[^\r\n\]+:\tf3 48 0f ae cb\t\( \)?rdgsbase %rbx\r ++\[^\r\n\]+:\tf3 41 0f ae c8\t\( \)?rdgsbase %r8d\r ++\[^\r\n\]+:\tf3 49 0f ae c8\t\( \)?rdgsbase %r8\r ++\[^\r\n\]+:\tf3 0f ae d3\t\( \)?wrfsbase %ebx\r ++\[^\r\n\]+:\tf3 48 0f ae d3\t\( \)?wrfsbase %rbx\r ++\[^\r\n\]+:\tf3 41 0f ae d0\t\( \)?wrfsbase %r8d\r ++\[^\r\n\]+:\tf3 49 0f ae d0\t\( \)?wrfsbase %r8\r ++\[^\r\n\]+:\tf3 0f ae db\t\( \)?wrgsbase %ebx\r ++\[^\r\n\]+:\tf3 48 0f ae db\t\( \)?wrgsbase %rbx\r ++\[^\r\n\]+:\tf3 41 0f ae d8\t\( \)?wrgsbase %r8d\r ++\[^\r\n\]+:\tf3 49 0f ae d8\t\( \)?wrgsbase %r8\r ++\[^\r\n\]+:\tf3 0f ae c3\t\( \)?rdfsbase %ebx\r ++\[^\r\n\]+:\tf3 48 0f ae c3\t\( \)?rdfsbase %rbx\r ++\[^\r\n\]+:\tf3 41 0f ae c0\t\( \)?rdfsbase %r8d\r ++\[^\r\n\]+:\tf3 49 0f ae c0\t\( \)?rdfsbase %r8\r ++\[^\r\n\]+:\tf3 0f ae cb\t\( \)?rdgsbase %ebx\r ++\[^\r\n\]+:\tf3 48 0f ae cb\t\( \)?rdgsbase %rbx\r ++\[^\r\n\]+:\tf3 41 0f ae c8\t\( \)?rdgsbase %r8d\r ++\[^\r\n\]+:\tf3 49 0f ae c8\t\( \)?rdgsbase %r8\r ++\[^\r\n\]+:\tf3 0f ae d3\t\( \)?wrfsbase %ebx\r ++\[^\r\n\]+:\tf3 48 0f ae d3\t\( \)?wrfsbase %rbx\r ++\[^\r\n\]+:\tf3 41 0f ae d0\t\( \)?wrfsbase %r8d\r ++\[^\r\n\]+:\tf3 49 0f ae d0\t\( \)?wrfsbase %r8\r ++\[^\r\n\]+:\tf3 0f ae db\t\( \)?wrgsbase %ebx\r ++\[^\r\n\]+:\tf3 48 0f ae db\t\( \)?wrgsbase %rbx\r ++\[^\r\n\]+:\tf3 41 0f ae d8\t\( \)?wrgsbase %r8d\r ++\[^\r\n\]+:\tf3 49 0f ae d8\t\( \)?wrgsbase %r8\r ++End of assembler dump\\." "att" ++ ++gdb_test_no_output "set disassembly-flavor intel" ++# gas/i386/x86-64-rdrnd-intel.d ++# gas/i386/x86-64-f16c-intel.d ++# gas/i386/x86-64-fsgs-intel.d ++gdb_test "disassemble/r _start" "\r ++Dump of assembler code for function _start:\r ++\[^\r\n\]+:\t66 0f c7 f3\t\( \)?rdrand bx\r ++\[^\r\n\]+:\t0f c7 f3\t\( \)?rdrand ebx\r ++\[^\r\n\]+:\t48 0f c7 f3\t\( \)?rdrand rbx\r ++\[^\r\n\]+:\t66 41 0f c7 f0\t\( \)?rdrand r8w\r ++\[^\r\n\]+:\t41 0f c7 f0\t\( \)?rdrand r8d\r ++\[^\r\n\]+:\t49 0f c7 f0\t\( \)?rdrand r8\r ++\[^\r\n\]+:\t66 0f c7 f3\t\( \)?rdrand bx\r ++\[^\r\n\]+:\t0f c7 f3\t\( \)?rdrand ebx\r ++\[^\r\n\]+:\t48 0f c7 f3\t\( \)?rdrand rbx\r ++\[^\r\n\]+:\t66 41 0f c7 f0\t\( \)?rdrand r8w\r ++\[^\r\n\]+:\t41 0f c7 f0\t\( \)?rdrand r8d\r ++\[^\r\n\]+:\t49 0f c7 f0\t\( \)?rdrand r8\r ++\[^\r\n\]+:\tc4 e2 7d 13 e4\t\( \)?vcvtph2ps ymm4,xmm4\r ++\[^\r\n\]+:\tc4 42 7d 13 00\t\( \)?vcvtph2ps ymm8,XMMWORD PTR \\\[r8\\\]\r ++\[^\r\n\]+:\tc4 e2 79 13 f4\t\( \)?vcvtph2ps xmm6,xmm4\r ++\[^\r\n\]+:\tc4 e2 79 13 21\t\( \)?vcvtph2ps xmm4,QWORD PTR \\\[rcx\\\]\r ++\[^\r\n\]+:\tc4 e3 7d 1d e4 02\t\( \)?vcvtps2ph xmm4,ymm4,0x2\r ++\[^\r\n\]+:\tc4 43 7d 1d 00 02\t\( \)?vcvtps2ph XMMWORD PTR \\\[r8\\\],ymm8,0x2\r ++\[^\r\n\]+:\tc4 e3 79 1d e4 02\t\( \)?vcvtps2ph xmm4,xmm4,0x2\r ++\[^\r\n\]+:\tc4 e3 79 1d 21 02\t\( \)?vcvtps2ph QWORD PTR \\\[rcx\\\],xmm4,0x2\r ++\[^\r\n\]+:\tc4 e2 7d 13 e4\t\( \)?vcvtph2ps ymm4,xmm4\r ++\[^\r\n\]+:\tc4 42 7d 13 00\t\( \)?vcvtph2ps ymm8,XMMWORD PTR \\\[r8\\\]\r ++\[^\r\n\]+:\tc4 e2 7d 13 21\t\( \)?vcvtph2ps ymm4,XMMWORD PTR \\\[rcx\\\]\r ++\[^\r\n\]+:\tc4 e2 79 13 f4\t\( \)?vcvtph2ps xmm6,xmm4\r ++\[^\r\n\]+:\tc4 e2 79 13 21\t\( \)?vcvtph2ps xmm4,QWORD PTR \\\[rcx\\\]\r ++\[^\r\n\]+:\tc4 e2 79 13 21\t\( \)?vcvtph2ps xmm4,QWORD PTR \\\[rcx\\\]\r ++\[^\r\n\]+:\tc4 e3 7d 1d e4 02\t\( \)?vcvtps2ph xmm4,ymm4,0x2\r ++\[^\r\n\]+:\tc4 e3 7d 1d 21 02\t\( \)?vcvtps2ph XMMWORD PTR \\\[rcx\\\],ymm4,0x2\r ++\[^\r\n\]+:\tc4 e3 7d 1d 21 02\t\( \)?vcvtps2ph XMMWORD PTR \\\[rcx\\\],ymm4,0x2\r ++\[^\r\n\]+:\tc4 e3 79 1d e4 02\t\( \)?vcvtps2ph xmm4,xmm4,0x2\r ++\[^\r\n\]+:\tc4 43 79 1d 00 02\t\( \)?vcvtps2ph QWORD PTR \\\[r8\\\],xmm8,0x2\r ++\[^\r\n\]+:\tc4 e3 79 1d 21 02\t\( \)?vcvtps2ph QWORD PTR \\\[rcx\\\],xmm4,0x2\r ++\[^\r\n\]+:\tf3 0f ae c3\t\( \)?rdfsbase ebx\r ++\[^\r\n\]+:\tf3 48 0f ae c3\t\( \)?rdfsbase rbx\r ++\[^\r\n\]+:\tf3 41 0f ae c0\t\( \)?rdfsbase r8d\r ++\[^\r\n\]+:\tf3 49 0f ae c0\t\( \)?rdfsbase r8\r ++\[^\r\n\]+:\tf3 0f ae cb\t\( \)?rdgsbase ebx\r ++\[^\r\n\]+:\tf3 48 0f ae cb\t\( \)?rdgsbase rbx\r ++\[^\r\n\]+:\tf3 41 0f ae c8\t\( \)?rdgsbase r8d\r ++\[^\r\n\]+:\tf3 49 0f ae c8\t\( \)?rdgsbase r8\r ++\[^\r\n\]+:\tf3 0f ae d3\t\( \)?wrfsbase ebx\r ++\[^\r\n\]+:\tf3 48 0f ae d3\t\( \)?wrfsbase rbx\r ++\[^\r\n\]+:\tf3 41 0f ae d0\t\( \)?wrfsbase r8d\r ++\[^\r\n\]+:\tf3 49 0f ae d0\t\( \)?wrfsbase r8\r ++\[^\r\n\]+:\tf3 0f ae db\t\( \)?wrgsbase ebx\r ++\[^\r\n\]+:\tf3 48 0f ae db\t\( \)?wrgsbase rbx\r ++\[^\r\n\]+:\tf3 41 0f ae d8\t\( \)?wrgsbase r8d\r ++\[^\r\n\]+:\tf3 49 0f ae d8\t\( \)?wrgsbase r8\r ++\[^\r\n\]+:\tf3 0f ae c3\t\( \)?rdfsbase ebx\r ++\[^\r\n\]+:\tf3 48 0f ae c3\t\( \)?rdfsbase rbx\r ++\[^\r\n\]+:\tf3 41 0f ae c0\t\( \)?rdfsbase r8d\r ++\[^\r\n\]+:\tf3 49 0f ae c0\t\( \)?rdfsbase r8\r ++\[^\r\n\]+:\tf3 0f ae cb\t\( \)?rdgsbase ebx\r ++\[^\r\n\]+:\tf3 48 0f ae cb\t\( \)?rdgsbase rbx\r ++\[^\r\n\]+:\tf3 41 0f ae c8\t\( \)?rdgsbase r8d\r ++\[^\r\n\]+:\tf3 49 0f ae c8\t\( \)?rdgsbase r8\r ++\[^\r\n\]+:\tf3 0f ae d3\t\( \)?wrfsbase ebx\r ++\[^\r\n\]+:\tf3 48 0f ae d3\t\( \)?wrfsbase rbx\r ++\[^\r\n\]+:\tf3 41 0f ae d0\t\( \)?wrfsbase r8d\r ++\[^\r\n\]+:\tf3 49 0f ae d0\t\( \)?wrfsbase r8\r ++\[^\r\n\]+:\tf3 0f ae db\t\( \)?wrgsbase ebx\r ++\[^\r\n\]+:\tf3 48 0f ae db\t\( \)?wrgsbase rbx\r ++\[^\r\n\]+:\tf3 41 0f ae d8\t\( \)?wrgsbase r8d\r ++\[^\r\n\]+:\tf3 49 0f ae d8\t\( \)?wrgsbase r8\r ++End of assembler dump\\." "intel" +diff --git a/gdb/testsuite/gdb.arch/i386-ivy-bridge.S b/gdb/testsuite/gdb.arch/i386-ivy-bridge.S +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.arch/i386-ivy-bridge.S +@@ -0,0 +1,66 @@ ++/* Copyright 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 . ++ ++ This file is part of the gdb testsuite. */ ++ ++ .globl _start ++_start: .text ++ ++/* gas/i386/rdrnd.s */ ++ .att_syntax prefix ++ rdrand %bx ++ rdrand %ebx ++ ++ .intel_syntax noprefix ++ rdrand bx ++ rdrand ebx ++ ++/* gas/i386/f16c.s */ ++ .att_syntax prefix ++ vcvtph2ps %xmm4,%ymm4 ++ vcvtph2ps (%ecx),%ymm4 ++ vcvtph2ps %xmm4,%xmm6 ++ vcvtph2ps (%ecx),%xmm4 ++ vcvtps2ph $0x2,%ymm4,%xmm4 ++ vcvtps2ph $0x2,%ymm4,(%ecx) ++ vcvtps2ph $0x2,%xmm4,%xmm4 ++ vcvtps2ph $0x2,%xmm4,(%ecx) ++ ++ .intel_syntax noprefix ++ vcvtph2ps ymm4,xmm4 ++ vcvtph2ps ymm4,XMMWORD PTR [ecx] ++ vcvtph2ps ymm4,[ecx] ++ vcvtph2ps xmm6,xmm4 ++ vcvtph2ps xmm4,QWORD PTR [ecx] ++ vcvtph2ps xmm4,[ecx] ++ vcvtps2ph xmm4,ymm4,0x2 ++ vcvtps2ph XMMWORD PTR [ecx],ymm4,0x2 ++ vcvtps2ph [ecx],ymm4,0x2 ++ vcvtps2ph xmm4,xmm4,0x2 ++ vcvtps2ph QWORD PTR [ecx],xmm4,0x2 ++ vcvtps2ph [ecx],xmm4,0x2 ++ ++/* gas/i386/fsgs.s */ ++ .att_syntax prefix ++ rdfsbase %ebx ++ rdgsbase %ebx ++ wrfsbase %ebx ++ wrgsbase %ebx ++ ++ .intel_syntax noprefix ++ rdfsbase ebx ++ rdgsbase ebx ++ wrfsbase ebx ++ wrgsbase ebx +diff --git a/gdb/testsuite/gdb.arch/i386-ivy-bridge.exp b/gdb/testsuite/gdb.arch/i386-ivy-bridge.exp +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.arch/i386-ivy-bridge.exp +@@ -0,0 +1,106 @@ ++# Copyright 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 . ++ ++if {![istarget "x86_64-*-*"] && ![istarget "i?86-*-*"]} then { ++ return ++} ++ ++set testfile i386-ivy-bridge ++set test compilation ++if [prepare_for_testing ${testfile}.exp ${testfile}.x ${testfile}.S [list debug "additional_flags=-m32 -nostdlib"]] { ++ fail $test ++ return -1 ++} ++pass $test ++ ++gdb_test_no_output "set disassembly-flavor att" ++# gas/i386/rdrnd.d ++# gas/i386/f16c.d ++# gas/i386/fsgs.d ++gdb_test "disassemble/r _start" "\r ++Dump of assembler code for function _start:\r ++\[^\r\n\]+:\t66 0f c7 f3\t\( \)?rdrand %bx\r ++\[^\r\n\]+:\t0f c7 f3\t\( \)?rdrand %ebx\r ++\[^\r\n\]+:\t66 0f c7 f3\t\( \)?rdrand %bx\r ++\[^\r\n\]+:\t0f c7 f3\t\( \)?rdrand %ebx\r ++\[^\r\n\]+:\tc4 e2 7d 13 e4\t\( \)?vcvtph2ps %xmm4,%ymm4\r ++\[^\r\n\]+:\tc4 e2 7d 13 21\t\( \)?vcvtph2ps \\(%ecx\\),%ymm4\r ++\[^\r\n\]+:\tc4 e2 79 13 f4\t\( \)?vcvtph2ps %xmm4,%xmm6\r ++\[^\r\n\]+:\tc4 e2 79 13 21\t\( \)?vcvtph2ps \\(%ecx\\),%xmm4\r ++\[^\r\n\]+:\tc4 e3 7d 1d e4 02\t\( \)?vcvtps2ph \\\$0x2,%ymm4,%xmm4\r ++\[^\r\n\]+:\tc4 e3 7d 1d 21 02\t\( \)?vcvtps2ph \\\$0x2,%ymm4,\\(%ecx\\)\r ++\[^\r\n\]+:\tc4 e3 79 1d e4 02\t\( \)?vcvtps2ph \\\$0x2,%xmm4,%xmm4\r ++\[^\r\n\]+:\tc4 e3 79 1d 21 02\t\( \)?vcvtps2ph \\\$0x2,%xmm4,\\(%ecx\\)\r ++\[^\r\n\]+:\tc4 e2 7d 13 e4\t\( \)?vcvtph2ps %xmm4,%ymm4\r ++\[^\r\n\]+:\tc4 e2 7d 13 21\t\( \)?vcvtph2ps \\(%ecx\\),%ymm4\r ++\[^\r\n\]+:\tc4 e2 7d 13 21\t\( \)?vcvtph2ps \\(%ecx\\),%ymm4\r ++\[^\r\n\]+:\tc4 e2 79 13 f4\t\( \)?vcvtph2ps %xmm4,%xmm6\r ++\[^\r\n\]+:\tc4 e2 79 13 21\t\( \)?vcvtph2ps \\(%ecx\\),%xmm4\r ++\[^\r\n\]+:\tc4 e2 79 13 21\t\( \)?vcvtph2ps \\(%ecx\\),%xmm4\r ++\[^\r\n\]+:\tc4 e3 7d 1d e4 02\t\( \)?vcvtps2ph \\\$0x2,%ymm4,%xmm4\r ++\[^\r\n\]+:\tc4 e3 7d 1d 21 02\t\( \)?vcvtps2ph \\\$0x2,%ymm4,\\(%ecx\\)\r ++\[^\r\n\]+:\tc4 e3 7d 1d 21 02\t\( \)?vcvtps2ph \\\$0x2,%ymm4,\\(%ecx\\)\r ++\[^\r\n\]+:\tc4 e3 79 1d e4 02\t\( \)?vcvtps2ph \\\$0x2,%xmm4,%xmm4\r ++\[^\r\n\]+:\tc4 e3 79 1d 21 02\t\( \)?vcvtps2ph \\\$0x2,%xmm4,\\(%ecx\\)\r ++\[^\r\n\]+:\tc4 e3 79 1d 21 02\t\( \)?vcvtps2ph \\\$0x2,%xmm4,\\(%ecx\\)\r ++\[^\r\n\]+:\tf3 0f ae c3\t\( \)?rdfsbase %ebx\r ++\[^\r\n\]+:\tf3 0f ae cb\t\( \)?rdgsbase %ebx\r ++\[^\r\n\]+:\tf3 0f ae d3\t\( \)?wrfsbase %ebx\r ++\[^\r\n\]+:\tf3 0f ae db\t\( \)?wrgsbase %ebx\r ++\[^\r\n\]+:\tf3 0f ae c3\t\( \)?rdfsbase %ebx\r ++\[^\r\n\]+:\tf3 0f ae cb\t\( \)?rdgsbase %ebx\r ++\[^\r\n\]+:\tf3 0f ae d3\t\( \)?wrfsbase %ebx\r ++\[^\r\n\]+:\tf3 0f ae db\t\( \)?wrgsbase %ebx\r ++End of assembler dump\\." "att" ++ ++gdb_test_no_output "set disassembly-flavor intel" ++# gas/i386/rdrnd-intel.d ++# gas/i386/f16c-intel.d ++# gas/i386/fsgs-intel.d ++gdb_test "disassemble/r _start" "\r ++Dump of assembler code for function _start:\r ++\[^\r\n\]+:\t66 0f c7 f3\t\( \)?rdrand bx\r ++\[^\r\n\]+:\t0f c7 f3\t\( \)?rdrand ebx\r ++\[^\r\n\]+:\t66 0f c7 f3\t\( \)?rdrand bx\r ++\[^\r\n\]+:\t0f c7 f3\t\( \)?rdrand ebx\r ++\[^\r\n\]+:\tc4 e2 7d 13 e4\t\( \)?vcvtph2ps ymm4,xmm4\r ++\[^\r\n\]+:\tc4 e2 7d 13 21\t\( \)?vcvtph2ps ymm4,XMMWORD PTR \\\[ecx\\\]\r ++\[^\r\n\]+:\tc4 e2 79 13 f4\t\( \)?vcvtph2ps xmm6,xmm4\r ++\[^\r\n\]+:\tc4 e2 79 13 21\t\( \)?vcvtph2ps xmm4,QWORD PTR \\\[ecx\\\]\r ++\[^\r\n\]+:\tc4 e3 7d 1d e4 02\t\( \)?vcvtps2ph xmm4,ymm4,0x2\r ++\[^\r\n\]+:\tc4 e3 7d 1d 21 02\t\( \)?vcvtps2ph XMMWORD PTR \\\[ecx\\\],ymm4,0x2\r ++\[^\r\n\]+:\tc4 e3 79 1d e4 02\t\( \)?vcvtps2ph xmm4,xmm4,0x2\r ++\[^\r\n\]+:\tc4 e3 79 1d 21 02\t\( \)?vcvtps2ph QWORD PTR \\\[ecx\\\],xmm4,0x2\r ++\[^\r\n\]+:\tc4 e2 7d 13 e4\t\( \)?vcvtph2ps ymm4,xmm4\r ++\[^\r\n\]+:\tc4 e2 7d 13 21\t\( \)?vcvtph2ps ymm4,XMMWORD PTR \\\[ecx\\\]\r ++\[^\r\n\]+:\tc4 e2 7d 13 21\t\( \)?vcvtph2ps ymm4,XMMWORD PTR \\\[ecx\\\]\r ++\[^\r\n\]+:\tc4 e2 79 13 f4\t\( \)?vcvtph2ps xmm6,xmm4\r ++\[^\r\n\]+:\tc4 e2 79 13 21\t\( \)?vcvtph2ps xmm4,QWORD PTR \\\[ecx\\\]\r ++\[^\r\n\]+:\tc4 e2 79 13 21\t\( \)?vcvtph2ps xmm4,QWORD PTR \\\[ecx\\\]\r ++\[^\r\n\]+:\tc4 e3 7d 1d e4 02\t\( \)?vcvtps2ph xmm4,ymm4,0x2\r ++\[^\r\n\]+:\tc4 e3 7d 1d 21 02\t\( \)?vcvtps2ph XMMWORD PTR \\\[ecx\\\],ymm4,0x2\r ++\[^\r\n\]+:\tc4 e3 7d 1d 21 02\t\( \)?vcvtps2ph XMMWORD PTR \\\[ecx\\\],ymm4,0x2\r ++\[^\r\n\]+:\tc4 e3 79 1d e4 02\t\( \)?vcvtps2ph xmm4,xmm4,0x2\r ++\[^\r\n\]+:\tc4 e3 79 1d 21 02\t\( \)?vcvtps2ph QWORD PTR \\\[ecx\\\],xmm4,0x2\r ++\[^\r\n\]+:\tc4 e3 79 1d 21 02\t\( \)?vcvtps2ph QWORD PTR \\\[ecx\\\],xmm4,0x2\r ++\[^\r\n\]+:\tf3 0f ae c3\t\( \)?rdfsbase ebx\r ++\[^\r\n\]+:\tf3 0f ae cb\t\( \)?rdgsbase ebx\r ++\[^\r\n\]+:\tf3 0f ae d3\t\( \)?wrfsbase ebx\r ++\[^\r\n\]+:\tf3 0f ae db\t\( \)?wrgsbase ebx\r ++\[^\r\n\]+:\tf3 0f ae c3\t\( \)?rdfsbase ebx\r ++\[^\r\n\]+:\tf3 0f ae cb\t\( \)?rdgsbase ebx\r ++\[^\r\n\]+:\tf3 0f ae d3\t\( \)?wrfsbase ebx\r ++\[^\r\n\]+:\tf3 0f ae db\t\( \)?wrgsbase ebx\r ++End of assembler dump\\." "intel" diff --git a/SOURCES/gdb-test-pid0-core.patch b/SOURCES/gdb-test-pid0-core.patch new file mode 100644 index 0000000..fea4def --- /dev/null +++ b/SOURCES/gdb-test-pid0-core.patch @@ -0,0 +1,92 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +Date: Fri, 27 Oct 2017 21:07:50 +0200 +Subject: gdb-test-pid0-core.patch + +;; New test gdb.arch/x86_64-pid0-core.exp for kernel PID 0 cores (BZ 611435). +;;=fedoratest + +https://bugzilla.redhat.com/show_bug.cgi?id=611435 + +Fix: +Re: [RFA]corelow.c: Add tid to add_to_thread_list +http://sourceware.org/ml/gdb-patches/2010-08/msg00085.html +http://sourceware.org/ml/gdb-cvs/2010-08/msg00026.html +2e5bcfdef1ec3883d48c3f87a4be5c0dff25e17e + +diff --git a/gdb/testsuite/gdb.arch/x86_64-pid0-core.core.bz2.uu b/gdb/testsuite/gdb.arch/x86_64-pid0-core.core.bz2.uu +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.arch/x86_64-pid0-core.core.bz2.uu +@@ -0,0 +1,20 @@ ++begin 600 x86_64-pid0-core.core.bz2 ++M0EIH.3%!629362,CA>P!$/'_____^*#EZ-A!SP36P&_:G0#=14``04A&8,'U ++M2*9`>$$)P`*RN"#*;#4R()IJ8C$TT&FC3$&@`T`#:C1H8C0T,@,FC,D"4T2! ++M"/2CU'B90]31ZAD#U`&AZF@/4:``!HT&F@!H<`#0-`-#0``#3$-&F@```#0R ++M``#")2FD]2>4]0TTT-!HTT--,0,"#$`R!I@AD`#1H,3&GZT.4TO$#H40/`0C ++M2$IRXS,<55!8T,&&,R.Z441"?J9I%G6GUA2!.[]Z"C5S[&19,%VS7E6[3"60 ++M@`-*2G)QEQ(;?0Y<=MK]/U?Q)LB%+F37TJ9BI*46)H'*Z@V"`"$"P7]&XZ:JE0E<*:#1M$P3G]>VCI)(A!O$64`5$4`E$$-.``7&(09`8HO`B6K!Q^& ++M562%N)2+0@*HB@%D@5$%!*0!L1&0D4D6\:-$A`)`+<6D82PP*H(J(H!?F;0$ ++M%PXB7N!2D4!44`W7"ADEQM6O9TBO5,_]1) ++M($Q2))#),UE,QQK)E$,3D\W.>!4)QO8A_@^Z_SXS4;Q8=HV6[:&$@2$@$R29IBW)K%3"O` ++M9^Y0YJ&BXY1U2HTZ5)2H-V\_(.DZHWE+C#WS($(!I"3CUH2#(+(OWUV"*<<9 ++MJ%A!J[%O.P&V%GI.`L7<1@0>,^1F\MY=V5UT,&NOG%7TTZ[03!@BHB@&)P` ++` ++end +diff --git a/gdb/testsuite/gdb.arch/x86_64-pid0-core.exp b/gdb/testsuite/gdb.arch/x86_64-pid0-core.exp +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.arch/x86_64-pid0-core.exp +@@ -0,0 +1,46 @@ ++# 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 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. ++ ++# Some kernel core files have PID 0 - for the idle task. ++ ++if ![istarget "x86_64-*-*"] { ++ verbose "Skipping x86_64-pid0-core test." ++ return ++} ++ ++set testfile "x86_64-pid0-core" ++set corebz2uufile ${srcdir}/${subdir}/${testfile}.core.bz2.uu ++set corefile [standard_output_file ${testfile}.core] ++ ++if {[catch "system \"uudecode -o - ${corebz2uufile} | bzip2 -dc >${corefile}\""] != 0} { ++ untested "failed uudecode or bzip2" ++ return -1 ++} ++file stat ${corefile} corestat ++if {$corestat(size) != 8798208} { ++ untested "uudecode or bzip2 produce invalid result" ++ return -1 ++} ++ ++gdb_exit ++gdb_start ++gdb_reinitialize_dir $srcdir/$subdir ++ ++# Former crash was: ++# thread.c:884: internal-error: switch_to_thread: Assertion `inf != NULL' failed. ++gdb_test "core-file ${corefile}" "Program terminated with signal (11|SIGSEGV), Segmentation fault\\.\r\n.*" diff --git a/SOURCES/gdb-testsuite26997-fix-array-slices-m32.patch b/SOURCES/gdb-testsuite26997-fix-array-slices-m32.patch new file mode 100644 index 0000000..478001b --- /dev/null +++ b/SOURCES/gdb-testsuite26997-fix-array-slices-m32.patch @@ -0,0 +1,68 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Keith Seitz +Date: Thu, 10 Jun 2021 11:08:25 -0700 +Subject: gdb-testsuite26997-fix-array-slices-m32.patch + +;; Backport "Fix gdb.fortran/array-slices.exp with -m32" +;; (Tom de Vres) + + commit 10f92414d6d4a5f8eb8cbb2bf39ca86c1f9c1da5 + Author: Tom de Vries + Date: Fri Jan 15 12:14:45 2021 +0100 + + [gdb/testsuite] Fix gdb.fortran/array-slices.exp with -m32 + + When running test-case gdb.fortran/array-slices.exp with target board + unix/-m32, we run into: + ... + (gdb) print /x &array4d^M + $69 = 0xffffb620^M + (gdb) print /x (&array4d) + sizeof (array4d)^M + $70 = 0x95c620^M + (gdb) FAIL: gdb.fortran/array-slices.exp: repack=on: test 9: check sizes match + ... + The expressions calculate the start and end of an array, but the calculation + of the end expression has an unexpected result (given that it lies before the + start of the array). By printing "sizeof (array4d)" as a separate + expression: + ... + (gdb) print /x sizeof (array4d) + $1 = 0xc40 + ... + it becomes clear we expected to get 0xffffb620 + 0xc40 == 0xffffc260 instead. + + The problem is that using the '&' returns a pointer type: + ... + (gdb) p &array4d + $5 = (PTR TO -> ( integer(kind=4) (-3:3,7:10,-3:3,-10:-7) )) 0xffffbe00 + ... + which has the consequence that the addition is done as pointer arithmetic. + + Fix this by using the result of "print /x &array4d" instead of &array4d in the + addition. + + Tested on x86_64-linux. + + gdb/testsuite/ChangeLog: + + 2021-01-15 Tom de Vries + + PR testsuite/26997 + * gdb.fortran/array-slices.exp (run_test): Avoid pointer arithmetic + when adding sizeof. + +diff --git a/gdb/testsuite/gdb.fortran/array-slices.exp b/gdb/testsuite/gdb.fortran/array-slices.exp +--- a/gdb/testsuite/gdb.fortran/array-slices.exp ++++ b/gdb/testsuite/gdb.fortran/array-slices.exp +@@ -208,8 +208,9 @@ proc run_test { repack } { + set start_addr [get_hexadecimal_valueof "&${full_var_name}" \ + "start unknown"] + set end_addr [get_hexadecimal_valueof \ +- "(&${full_var_name}) + sizeof (${full_var_name})" \ +- "end unknown"] ++ "$start_addr + sizeof (${full_var_name})" \ ++ "end unknown" \ ++ "get end address of ${full_var_name}"] + + # The Fortran compiler can choose to either send a descriptor that + # describes the array slice to the subroutine, or it can repack the diff --git a/SOURCES/gdbinit b/SOURCES/gdbinit new file mode 100644 index 0000000..b59fb0d --- /dev/null +++ b/SOURCES/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/SOURCES/gdbtui b/SOURCES/gdbtui new file mode 100755 index 0000000..88f9d55 --- /dev/null +++ b/SOURCES/gdbtui @@ -0,0 +1,2 @@ +#! /bin/sh +exec gdb -tui "$@" diff --git a/SOURCES/libiberty-infinite-recursion-fix-1-of-3.patch b/SOURCES/libiberty-infinite-recursion-fix-1-of-3.patch new file mode 100644 index 0000000..0800f98 --- /dev/null +++ b/SOURCES/libiberty-infinite-recursion-fix-1-of-3.patch @@ -0,0 +1,119 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Nick Clifton +Date: Mon, 31 Jan 2022 14:28:42 +0000 +Subject: libiberty-infinite-recursion-fix-1-of-3.patch + +;; Backport "libiberty: Fix infinite recursion in rust demangler." +;; (Nick Clifton) + +libiberty/ + PR demangler/98886 + PR demangler/99935 + * rust-demangle.c (struct rust_demangler): Add a recursion + counter. + (demangle_path): Increment/decrement the recursion counter upon + entry and exit. Fail if the counter exceeds a fixed limit. + (demangle_type): Likewise. + (rust_demangle_callback): Initialise the recursion counter, + disabling if requested by the option flags. + +diff --git a/libiberty/rust-demangle.c b/libiberty/rust-demangle.c +--- a/libiberty/rust-demangle.c ++++ b/libiberty/rust-demangle.c +@@ -74,6 +74,12 @@ struct rust_demangler + /* Rust mangling version, with legacy mangling being -1. */ + int version; + ++ /* Recursion depth. */ ++ unsigned int recursion; ++ /* Maximum number of times demangle_path may be called recursively. */ ++#define RUST_MAX_RECURSION_COUNT 1024 ++#define RUST_NO_RECURSION_LIMIT ((unsigned int) -1) ++ + uint64_t bound_lifetime_depth; + }; + +@@ -671,6 +677,15 @@ demangle_path (struct rust_demangler *rdm, int in_value) + if (rdm->errored) + return; + ++ if (rdm->recursion != RUST_NO_RECURSION_LIMIT) ++ { ++ ++ rdm->recursion; ++ if (rdm->recursion > RUST_MAX_RECURSION_COUNT) ++ /* FIXME: There ought to be a way to report ++ that the recursion limit has been reached. */ ++ goto fail_return; ++ } ++ + switch (tag = next (rdm)) + { + case 'C': +@@ -688,10 +703,7 @@ demangle_path (struct rust_demangler *rdm, int in_value) + case 'N': + ns = next (rdm); + if (!ISLOWER (ns) && !ISUPPER (ns)) +- { +- rdm->errored = 1; +- return; +- } ++ goto fail_return; + + demangle_path (rdm, in_value); + +@@ -776,9 +788,15 @@ demangle_path (struct rust_demangler *rdm, int in_value) + } + break; + default: +- rdm->errored = 1; +- return; ++ goto fail_return; + } ++ goto pass_return; ++ ++ fail_return: ++ rdm->errored = 1; ++ pass_return: ++ if (rdm->recursion != RUST_NO_RECURSION_LIMIT) ++ -- rdm->recursion; + } + + static void +@@ -870,6 +888,19 @@ demangle_type (struct rust_demangler *rdm) + return; + } + ++ if (rdm->recursion != RUST_NO_RECURSION_LIMIT) ++ { ++ ++ rdm->recursion; ++ if (rdm->recursion > RUST_MAX_RECURSION_COUNT) ++ /* FIXME: There ought to be a way to report ++ that the recursion limit has been reached. */ ++ { ++ rdm->errored = 1; ++ -- rdm->recursion; ++ return; ++ } ++ } ++ + switch (tag) + { + case 'R': +@@ -1030,6 +1061,9 @@ demangle_type (struct rust_demangler *rdm) + rdm->next--; + demangle_path (rdm, 0); + } ++ ++ if (rdm->recursion != RUST_NO_RECURSION_LIMIT) ++ -- rdm->recursion; + } + + /* A trait in a trait object may have some "existential projections" +@@ -1317,6 +1351,7 @@ rust_demangle_callback (const char *mangled, int options, + rdm.skipping_printing = 0; + rdm.verbose = (options & DMGL_VERBOSE) != 0; + rdm.version = 0; ++ rdm.recursion = (options & DMGL_NO_RECURSE_LIMIT) ? RUST_NO_RECURSION_LIMIT : 0; + rdm.bound_lifetime_depth = 0; + + /* Rust symbols always start with _R (v0) or _ZN (legacy). */ diff --git a/SOURCES/libiberty-infinite-recursion-fix-2-of-3.patch b/SOURCES/libiberty-infinite-recursion-fix-2-of-3.patch new file mode 100644 index 0000000..e7dc83d --- /dev/null +++ b/SOURCES/libiberty-infinite-recursion-fix-2-of-3.patch @@ -0,0 +1,85 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Nick Clifton +Date: Fri, 1 Jul 2022 15:58:52 +0100 +Subject: libiberty-infinite-recursion-fix-2-of-3.patch + +;; Backport Add a recursion limit to the demangle_const function in the Rust demangler. +;; (Nick Clifton, RHEL-4234) + +libiberty/ + PR demangler/105039 + * rust-demangle.c (demangle_const): Add recursion limit. + +diff --git a/libiberty/rust-demangle.c b/libiberty/rust-demangle.c +--- a/libiberty/rust-demangle.c ++++ b/libiberty/rust-demangle.c +@@ -126,7 +126,7 @@ parse_integer_62 (struct rust_demangler *rdm) + return 0; + + x = 0; +- while (!eat (rdm, '_')) ++ while (!eat (rdm, '_') && !rdm->errored) + { + c = next (rdm); + x *= 62; +@@ -1148,6 +1148,15 @@ demangle_const (struct rust_demangler *rdm) + if (rdm->errored) + return; + ++ if (rdm->recursion != RUST_NO_RECURSION_LIMIT) ++ { ++ ++ rdm->recursion; ++ if (rdm->recursion > RUST_MAX_RECURSION_COUNT) ++ /* FIXME: There ought to be a way to report ++ that the recursion limit has been reached. */ ++ goto fail_return; ++ } ++ + if (eat (rdm, 'B')) + { + backref = parse_integer_62 (rdm); +@@ -1158,7 +1167,7 @@ demangle_const (struct rust_demangler *rdm) + demangle_const (rdm); + rdm->next = old_next; + } +- return; ++ goto pass_return; + } + + ty_tag = next (rdm); +@@ -1167,7 +1176,7 @@ demangle_const (struct rust_demangler *rdm) + /* Placeholder. */ + case 'p': + PRINT ("_"); +- return; ++ goto pass_return; + + /* Unsigned integer types. */ + case 'h': +@@ -1200,18 +1209,20 @@ demangle_const (struct rust_demangler *rdm) + break; + + default: +- rdm->errored = 1; +- return; ++ goto fail_return; + } + +- if (rdm->errored) +- return; +- +- if (rdm->verbose) ++ if (!rdm->errored && rdm->verbose) + { + PRINT (": "); + PRINT (basic_type (ty_tag)); + } ++ ++ fail_return: ++ rdm->errored = 1; ++ pass_return: ++ if (rdm->recursion != RUST_NO_RECURSION_LIMIT) ++ -- rdm->recursion; + } + + static void diff --git a/SOURCES/libiberty-infinite-recursion-fix-3-of-3.patch b/SOURCES/libiberty-infinite-recursion-fix-3-of-3.patch new file mode 100644 index 0000000..73d9c49 --- /dev/null +++ b/SOURCES/libiberty-infinite-recursion-fix-3-of-3.patch @@ -0,0 +1,23 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Nick Clifton +Date: Mon, 4 Jul 2022 16:31:18 +0100 +Subject: libiberty-infinite-recursion-fix-3-of-3.patch + +;; Backport Fix typo in recent code to add stack recursion limit to the Rust demangler. +;; (Nick Clifton) + +libiberty + * rust-demangle.c (demangle_const): Add a missing goto pass_return + at the end of the function. + +diff --git a/libiberty/rust-demangle.c b/libiberty/rust-demangle.c +--- a/libiberty/rust-demangle.c ++++ b/libiberty/rust-demangle.c +@@ -1217,6 +1217,7 @@ demangle_const (struct rust_demangler *rdm) + PRINT (": "); + PRINT (basic_type (ty_tag)); + } ++ goto pass_return; + + fail_return: + rdm->errored = 1; diff --git a/SOURCES/libiberty-rhbz-2132600-prevent-buffer-overflow.patch b/SOURCES/libiberty-rhbz-2132600-prevent-buffer-overflow.patch new file mode 100644 index 0000000..a0f5076 --- /dev/null +++ b/SOURCES/libiberty-rhbz-2132600-prevent-buffer-overflow.patch @@ -0,0 +1,27 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Lu=C3=ADs=20Ferreira?= +Date: Thu, 23 Sep 2021 11:33:47 -0400 +Subject: libiberty-rhbz-2132600-prevent-buffer-overflow.patch +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +;; Backport libiberty: prevent buffer overflow when decoding user input +;; (Luís Ferreira, RHBZ2132600) + +libiberty/ + * d-demangle.c (dlang_symbol_backref): Ensure strlen of + string is less than length computed by dlang_number. + +diff --git a/libiberty/d-demangle.c b/libiberty/d-demangle.c +--- a/libiberty/d-demangle.c ++++ b/libiberty/d-demangle.c +@@ -380,7 +380,7 @@ dlang_symbol_backref (string *decl, const char *mangled, + + /* Must point to a simple identifier. */ + backref = dlang_number (backref, &len); +- if (backref == NULL) ++ if (backref == NULL || strlen (backref) < len) + return NULL; + + backref = dlang_lname (decl, backref, len); diff --git a/SOURCES/testing-custom-inputrc.patch b/SOURCES/testing-custom-inputrc.patch new file mode 100644 index 0000000..c95f7d1 --- /dev/null +++ b/SOURCES/testing-custom-inputrc.patch @@ -0,0 +1,52 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Keith Seitz +Date: Tue, 23 Mar 2021 09:32:37 -0700 +Subject: testing-custom-inputrc.patch + +;; Backport "Disable bracketed paste mode in GDB tests" +;; (Tom Tromey) + + commit 1af4c9c4209c3478224f18dfb79dc09567b96705 + Author: Tom Tromey + Date: Sat Jan 23 08:52:45 2021 -0700 + + Disable bracketed paste mode in GDB tests + + I have a patch to import GNU readline 8.1 into GDB. However, when + running the tests, there were a number of failures due to "bracketed + paste mode". This is a terminal feature that readline 8.1 enables by + default. + + The simplest way to work around this was to always make a ".inputrc" + for GDB tests that will tell readline to disable brackted paste mode. + + gdb/testsuite/ChangeLog + 2021-01-23 Tom Tromey + + * lib/gdb.exp (default_gdb_init): Set INPUTRC to a cached file. + +diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp +--- a/gdb/testsuite/lib/gdb.exp ++++ b/gdb/testsuite/lib/gdb.exp +@@ -5135,13 +5135,14 @@ proc default_gdb_init { test_file_name } { + setenv LC_CTYPE C + setenv LANG C + +- # 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. +- setenv INPUTRC "/dev/null" ++ # Don't let a .inputrc file or an existing setting of INPUTRC mess ++ # up the test results. Certain tests (style tests and TUI tests) ++ # want to set the terminal to a non-"dumb" value, and for those we ++ # want to disable bracketed paste mode. Versions of Readline ++ # before 8.0 will not understand this and will issue a warning. ++ # We tried using a $if to guard it, but Readline 8.1 had a bug in ++ # its version-comparison code that prevented this for working. ++ setenv INPUTRC [cached_file inputrc "set enable-bracketed-paste off"] + + # This disables style output, which would interfere with many + # tests. diff --git a/SOURCES/v1.5-libipt-static.patch b/SOURCES/v1.5-libipt-static.patch new file mode 100644 index 0000000..69e1d1a --- /dev/null +++ b/SOURCES/v1.5-libipt-static.patch @@ -0,0 +1,13 @@ +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/gdb.spec b/SPECS/gdb.spec new file mode 100644 index 0000000..f307aa6 --- /dev/null +++ b/SPECS/gdb.spec @@ -0,0 +1,5932 @@ +# rpmbuild parameters: +# --with testsuite: Run the testsuite (biarch if possible). Default is without. +# --with buildisa: Use %%{?_isa} for BuildRequires +# --with asan: gcc -fsanitize=address +# --without python: No python support. +# --with profile: gcc -fprofile-generate / -fprofile-use: Before better +# workload gets run it decreases the general performance now. +# --define 'scl somepkgname': Independent packages by scl-utils-build. + +# Turn off the brp-python-bytecompile automagic +%global _python_bytecompile_extra 0 + +# Disable LTO until upstream fixes GDB's ODR woes. +#%define _lto_cflags %{nil} + +%{?scl:%scl_package gdb} +%{!?scl: + %global pkg_name %{name} + %global _root_prefix %{_prefix} + %global _root_datadir %{_datadir} + %global _root_libdir %{_libdir} +} + +# If we're on Fedora or RHEL 9+, we will build the gdb-minimal package. +%if 0%{?fedora} || 0%{?rhel} > 8 +%global _build_minimal 1 +%endif + +Name: %{?scl_prefix}gdb + +# Freeze it when GDB gets branched +%global snapsrc 20200208 +# See timestamp of source gnulib installed into gnulib/ . +%global snapgnulib 20200630 +%global tarname gdb-%{version} +Version: 10.2 + +# The release always contains a leading reserved number, start it at 1. +# `upstream' is not a part of `name' to stay fully rpm dependencies compatible for the testing. +Release: 13%{?dist} + +License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and LGPLv3+ and BSD and Public Domain and GFDL +# Do not provide URL for snapshots as the file lasts there only for 2 days. +# ftp://sourceware.org/pub/gdb/releases/FIXME{tarname}.tar.xz +#Source: %{tarname}.tar.xz +Source: ftp://sourceware.org/pub/gdb/releases/%{tarname}.tar.xz +URL: https://gnu.org/software/gdb/ + +# For our convenience +%global gdb_src %{tarname} +%global gdb_build build-%{_target_platform} +%if 0%{?_build_minimal} +%global gdb_build_minimal %{gdb_build}-minimal +%endif # 0%{?_build_minimal} + +# error: Installed (but unpackaged) file(s) found: /usr/lib/debug/usr/bin/gdb-gdb.py +# https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/message/PBOJDOFMWTRV3ZOKNV5HN7IBX5EPHDHF/ +%undefine _debuginfo_subpackages + +# For DTS RHEL<=7 GDB it is better to use none than a Requires dependency. +%if 0%{!?rhel:1} || 0%{?rhel} > 7 +%if 0%{!?el9:1} +Recommends: %{?scl_prefix}gcc-gdb-plugin%{?_isa} +%endif +Recommends: dnf-command(debuginfo-install) +%endif + +%if 0%{!?scl:1} +# when manpages were moved from -headless to main +# https://bugzilla.redhat.com/show_bug.cgi?id=1402554 +# theoretically should not be required due to versioned dependeny +# below, but it cannot hurt either -- rdieter +Conflicts: gdb-headless < 7.12-29 + +Summary: A stub package for GNU source-level debugger +Requires: gdb-headless%{?_isa} = %{version}-%{release} + +%description +'gdb' package is only a stub to install gcc-gdb-plugin for 'compile' commands. +See package 'gdb-headless'. + +%package headless +%endif + +Summary: A GNU source-level debugger for C, C++, Fortran, Go and other languages + +# Make sure we get rid of the old package gdb64, now that we have unified +# support for 32-64 bits in one single 64-bit gdb. +%ifarch ppc64 +Obsoletes: gdb64 < 5.3.91 +%endif + +%ifarch %{arm} +%global have_inproctrace 0 +%else +%global have_inproctrace 1 +%endif + +# gdb-add-index cannot be run even for SCL package on RHEL<=6. +%if 0%{!?rhel:1} || 0%{?rhel} > 6 +# eu-strip: -g recognizes .gdb_index as a debugging section. (#631997) +Conflicts: elfutils < 0.149 +%endif + +# https://fedorahosted.org/fpc/ticket/43 https://fedorahosted.org/fpc/ticket/109 +Provides: bundled(libiberty) = %{snapsrc} +Provides: bundled(gnulib) = %{snapgnulib} +# The libraries in the top-level directory (libbfd, libopcodes, +# libctf) are covered by the "bundled(binutils)" below. See ticket +# #109, as mentioned above. +Provides: bundled(binutils) = %{snapsrc} +# https://fedorahosted.org/fpc/ticket/130 +Provides: bundled(md5-gcc) = %{snapsrc} + +# https://fedoraproject.org/wiki/Packaging:Guidelines#BuildRequires_and_.25.7B_isa.7D +%if 0%{?_with_buildisa:1} || 0%{?_with_testsuite:1} +%global buildisa %{?_isa} +%else +%global buildisa %{nil} +%endif + +%if 0%{!?rhel:1} || 0%{?rhel} > 7 +# https://bugzilla.redhat.com/show_bug.cgi?id=1209492 +Recommends: default-yama-scope +%endif + +%if 0%{?el6:1} +%global librpmver 1 +%else +# FIXME: %elif does not work. +%if 0%{?el7:1} +%global librpmver 3 +%else +%if 0%{?fedora} >= 27 || 0%{?rhel} > 7 +%global librpmver 8 +%else +%global librpmver 7 +%endif +%if 0%{?fedora} >= 31 || 0%{?rhel} >= 9 +%global librpmver 9 +%endif +%endif +%endif +%if 0%{?__isa_bits} == 64 +%global librpmname librpm.so.%{librpmver}()(64bit) +%else +%global librpmname librpm.so.%{librpmver} +%endif +BuildRequires: rpm-libs%{buildisa} +%if 0%{?_with_buildisa:1} +BuildRequires: %{librpmname} +%endif +%if 0%{!?rhel:1} || 0%{?rhel} > 7 +Recommends: %{librpmname} +%endif + +%if 0%{?el6:1} +# GDB C++11 requires devtoolset gcc. +BuildRequires: %{?scl_prefix}gcc-c++ +%endif + +BuildRequires: autoconf + +# GDB patches have the format `gdb--bz-.patch'. +# They should be created using patch level 1: diff -up ./gdb (or gdb-6.3/gdb). + +#= +#push=Should be pushed upstream. +#fedora=Should stay as a Fedora patch. +#fedoratest=Keep it in Fedora only as a regression test safety. + +# Cleanup any leftover testsuite processes as it may stuck mock(1) builds. +#=push+jan +Source2: gdb-orphanripper.c + +# Man page for gstack(1). +#=push+jan +Source3: gdb-gstack.man + +# /etc/gdbinit (from Debian but with Fedora compliant location). +#=fedora +Source4: gdbinit + +# libstdc++ pretty printers from GCC SVN. +%global libstdcxxpython gdb-libstdc++-v3-python-8.1.1-20180626 +#=fedora +Source5: %{libstdcxxpython}.tar.xz + +# Provide gdbtui for RHEL-5 and RHEL-6 as it is removed upstream (BZ 797664). +#=fedora +Source6: gdbtui + +# libipt: Intel Processor Trace Decoder Library +%global libipt_version 2.0.4 +#=fedora +Source7: v%{libipt_version}.tar.gz +#=fedora +Patch1142: v1.5-libipt-static.patch + +# Include the auto-generated file containing the "Patch:" directives. +# See README.local-patches for more details. +Patch9998: _gdb.spec.Patch.include +Patch9999: _gdb.spec.patch.include +%include %{PATCH9998} + +%if 0%{!?rhel:1} || 0%{?rhel} > 6 +# RL_STATE_FEDORA_GDB would not be found for: +# Patch642: gdb-readline62-ask-more-rh.patch +# --with-system-readline +BuildRequires: readline-devel%{buildisa} >= 6.2-4 +%endif # 0%{!?rhel:1} || 0%{?rhel} > 6 + +BuildRequires: gcc-c++ ncurses-devel%{buildisa} texinfo gettext flex bison +BuildRequires: expat-devel%{buildisa} +%if 0%{!?rhel:1} || 0%{?rhel} > 6 +BuildRequires: xz-devel%{buildisa} +%endif +# dlopen() no longer makes rpm-libsFIXME{?_isa} (it's .so) a mandatory dependency. +BuildRequires: rpm-devel%{buildisa} +BuildRequires: zlib-devel%{buildisa} libselinux-devel%{buildisa} +%if 0%{!?_without_python:1} +%if 0%{?rhel:1} && 0%{?rhel} <= 7 +BuildRequires: python-devel%{buildisa} +%else +%global __python %{__python3} +BuildRequires: python3-devel%{buildisa} +%endif +%if 0%{?rhel:1} && 0%{?rhel} <= 7 +# Temporarily before python files get moved to libstdc++.rpm +# libstdc++%{bits_other} is not present in Koji, the .spec script generating +# gdb/python/libstdcxx/ also does not depend on the %{bits_other} files. +BuildRequires: libstdc++%{buildisa} +%endif # 0%{?rhel:1} && 0%{?rhel} <= 7 +%endif # 0%{!?_without_python:1} +# gdb-doc in PDF, see: https://bugzilla.redhat.com/show_bug.cgi?id=919891#c10 +BuildRequires: texinfo-tex +%if 0%{!?rhel:1} || 0%{?rhel} > 6 +BuildRequires: texlive-collection-latexrecommended +%endif +# Permit rebuilding *.[0-9] files even if they are distributed in gdb-*.tar: +BuildRequires: /usr/bin/pod2man +%if 0%{!?rhel:1} || 0%{?rhel} > 7 +BuildRequires: libbabeltrace-devel%{buildisa} +%if 0%{?rhel} < 9 +BuildRequires: guile-devel%{buildisa} +%endif +%endif +%global have_libipt 0 +%if 0%{!?rhel:1} || 0%{?rhel} > 7 || (0%{?rhel} == 7 && 0%{?scl:1}) +%ifarch %{ix86} x86_64 +%global have_libipt 1 +%if 0%{?el7:1} && 0%{?scl:1} +BuildRequires: cmake +%else +BuildRequires: libipt-devel%{buildisa} +%endif +%endif +%endif +%if 0%{!?rhel:1} || 0%{?rhel} > 6 +# See https://bugzilla.redhat.com/show_bug.cgi?id=1593280 +# DTS RHEL-6 has mpfr-2 while GDB requires mpfr-3 on RHEL-7, RHEL-8, and +# Fedora < 32, and mpfr-4 on Fedora 32+ and RHEL-9+. +BuildRequires: mpfr-devel%{buildisa} +%endif +BuildRequires: source-highlight-devel +%if 0%{!?rhel:1} +BuildRequires: xxhash-devel +%endif +BuildRequires: elfutils-debuginfod-client-devel + +%if 0%{?_with_testsuite:1} + +# Ensure the devel libraries are installed for both multilib arches. +%global bits_local %{?_isa} +%global bits_other %{?_isa} +%ifarch s390x +%if 0%{!?rhel:1} || 0%{?rhel} < 8 +%global bits_other (%{__isa_name}-32) +%endif +%else #!s390x +%ifarch ppc +%global bits_other (%{__isa_name}-64) +%else #!ppc +%ifarch sparc64 ppc64 s390x x86_64 +%global bits_other (%{__isa_name}-32) +%endif #sparc64 ppc64 s390x x86_64 +%endif #!ppc +%endif #!s390x + +BuildRequires: sharutils dejagnu +# gcc-objc++ is not covered by the GDB testsuite. +BuildRequires: gcc gcc-c++ gcc-gfortran +%if 0%{!?rhel:1} || 0%{?rhel} < 8 +BuildRequires: gcc-objc +%endif +%if 0%{!?rhel:1} || 0%{?rhel} > 7 +%if 0%{!?el9:1} +BuildRequires: gcc-gdb-plugin%{?_isa} +%endif +%endif +%if 0%{?rhel:1} && 0%{?rhel} < 7 +BuildRequires: gcc-java libgcj%{bits_local} libgcj%{bits_other} +# for gcc-java linkage: +BuildRequires: zlib-devel%{bits_local} zlib-devel%{bits_other} +%endif +# Exception for RHEL<=7 +%ifarch aarch64 +%if 0%{!?rhel:1} +BuildRequires: gcc-go +BuildRequires: libgo-devel%{bits_local} libgo-devel%{bits_other} +%endif +%else +%if 0%{!?rhel:1} || 0%{?rhel} == 7 +BuildRequires: gcc-go +BuildRequires: libgo-devel%{bits_local} libgo-devel%{bits_other} +%endif +%endif +# archer-sergiodj-stap-patch-split +BuildRequires: systemtap-sdt-devel +%if 0%{?rhel:1} && 0%{?rhel} <= 7 +# Copied from prelink-0.4.2-3.fc13. +# Prelink is not yet ported to ppc64le. +%ifarch %{ix86} alpha sparc sparcv9 sparc64 s390 s390x x86_64 ppc ppc64 +# Prelink is broken on sparcv9/sparc64. +%ifnarch sparc sparcv9 sparc64 +BuildRequires: prelink +%endif +%endif +%endif +%if 0%{!?rhel:1} || 0%{?rhel} > 7 +BuildRequires: opencl-headers ocl-icd-devel%{bits_local} ocl-icd-devel%{bits_other} +%endif +%if 0%{!?rhel:1} +# Fedora arm+ppc64le do not yet have fpc built. +%ifnarch %{arm} ppc64le +BuildRequires: fpc +%endif +%endif +# Copied from: gcc-6.2.1-1.fc26 +# Exception for RHEL<=7 +%ifarch s390x +%if 0%{!?rhel:1} +BuildRequires: gcc-gnat +BuildRequires: libgnat%{bits_local} libgnat%{bits_other} +%endif +%else +%ifarch %{ix86} x86_64 ia64 ppc %{power64} alpha s390x %{arm} aarch64 +%if 0%{!?rhel:1} +BuildRequires: gcc-gnat +BuildRequires: libgnat%{bits_local} libgnat%{bits_other} +%endif +%endif +%endif +BuildRequires: glibc-devel%{bits_local} glibc-devel%{bits_other} +BuildRequires: libgcc%{bits_local} libgcc%{bits_other} +BuildRequires: libgfortran%{bits_local} libgfortran%{bits_other} +# libstdc++-devel of matching bits is required only for g++ -static. +BuildRequires: libstdc++%{bits_local} libstdc++%{bits_other} +%if 0%{!?rhel:1} || 0%{?rhel} > 6 +%ifarch %{ix86} x86_64 +BuildRequires: libquadmath%{bits_local} libquadmath%{bits_other} +%endif +%endif +BuildRequires: glibc-static%{bits_local} +# multilib glibc-static is open Bug 488472: +#BuildRequires: glibc-static%{bits_other} +# Exception for RHEL<=7 +%ifarch s390x +BuildRequires: valgrind%{bits_local} +%if 0%{!?rhel:1} || 0%{?rhel} > 7 +BuildRequires: valgrind%{bits_local} valgrind%{bits_other} +%endif +%else +BuildRequires: valgrind%{bits_local} valgrind%{bits_other} +%endif +%if 0%{!?rhel:1} || 0%{?rhel} > 6 +BuildRequires: xz +%endif +%if 0%{!?rhel:1} || 0%{?rhel} > 7 +BuildRequires: rust +%endif + +BuildRequires: %{?scl_prefix}elfutils-debuginfod +%endif # 0%{?_with_testsuite:1} +BuildRequires: make + +%{?scl:Requires:%scl_runtime} + +# FIXME: The text needs to be duplicated to prevent 2 empty heading lines. +%if 0%{!?scl:1} +%description headless +GDB, the GNU debugger, allows you to debug programs written in C, C++, +Java, and other languages, by executing them in a controlled fashion +and printing their data. +%else +%description +GDB, the GNU debugger, allows you to debug programs written in C, C++, +Java, and other languages, by executing them in a controlled fashion +and printing their data. +%endif + +%if 0%{?_build_minimal} +%package minimal +Summary: A GNU source-level debugger for C, C++, Fortran, Go and other languages (minimal version) +# gdb-add-index is shared with gdb-headless and it must be from same version +Conflicts: %{name}-headless < %{version}-%{release} +Conflicts: %{name}-headless > %{version}-%{release} + +%description minimal +GDB, the GNU debugger, allows you to debug programs written in C, C++, +Java, and other languages, by executing them in a controlled fashion +and printing their data. + +This package provides a minimal version of GDB, tailored to be used by +the Fedora buildroot. It should probably not be used by end users. +%endif # 0%{?_build_minimal} + +%package gdbserver +Summary: A standalone server for GDB (the GNU source-level debugger) + +%description gdbserver +GDB, the GNU debugger, allows you to debug programs written in C, C++, +Java, and other languages, by executing them in a controlled fashion +and printing their data. + +This package provides a program that allows you to run GDB on a different +machine than the one which is running the program being debugged. + +%package doc +Summary: Documentation for GDB (the GNU source-level debugger) +License: GFDL +BuildArch: noarch +%if 0%{?scl:1} +# As of F-28, packages won't need to call /sbin/install-info by hand +# anymore. We make an exception for DTS here. +# https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/MP2QVJZBOJZEOQO2G7UB2HLXKXYPF2G5/ +Requires(post): /sbin/install-info +Requires(preun): /sbin/install-info +%endif + +%description doc +GDB, the GNU debugger, allows you to debug programs written in C, C++, +Java, and other languages, by executing them in a controlled fashion +and printing their data. + +This package provides INFO, HTML and PDF user manual for GDB. + +%prep +%setup -q -n %{gdb_src} + +%if 0%{?rhel:1} && 0%{?rhel} <= 7 +# libstdc++ pretty printers. +tar xJf %{SOURCE5} +%endif # 0%{?rhel:1} && 0%{?rhel} <= 7 + +%if 0%{have_libipt} && 0%{?el7:1} && 0%{?scl:1} +tar xzf %{SOURCE7} +( + cd libipt-%{libipt_version} +%patch1142 -p1 +) +%endif + +# Files have `# ' statements breaking VPATH / find-debuginfo.sh . +(cd gdb;rm -fv $(perl -pe 's/\\\n/ /' gdb/version.in << _FOO +%if 0%{!?rhel:1} +Fedora %{version}-%{release} +%else # !0%{!?rhel:1} +Red Hat Enterprise Linux %{version}-%{release} +%endif # !0%{!?rhel:1} +_FOO + +# Remove the info and other generated files added by the FSF release +# process. +rm -f libdecnumber/gstdint.h +rm -f bfd/doc/*.info +rm -f bfd/doc/*.info-* +rm -f gdb/doc/*.info +rm -f gdb/doc/*.info-* + +%if 0%{!?rhel:1} || 0%{?rhel} > 6 +# RL_STATE_FEDORA_GDB would not be found for: +# Patch642: gdb-readline62-ask-more-rh.patch +# --with-system-readline +mv -f readline/readline/doc readline-doc +rm -rf readline/readline/* +mv -f readline-doc readline/readline/doc +%endif # 0%{!?rhel:1} || 0%{?rhel} > 6 + +rm -rf zlib texinfo + +%build +rm -rf %{buildroot} + +test -e %{_root_libdir}/librpm.so.%{librpmver} + +%if 0%{?el6:1} +# GDB C++11 requires devtoolset gcc. +%{?scl:PATH=%{_bindir}${PATH:+:${PATH}}} +%endif + +# A set of common GDB configure flags, which are used for both minimal +# and non-minimal compilations. +COMMON_GDB_CONFIGURE_FLAGS="\ + --prefix=%{_prefix} \ + --libdir=%{_libdir} \ + --sysconfdir=%{_sysconfdir} \ + --mandir=%{_mandir} \ + --infodir=%{_infodir} \ + --with-gdb-datadir=%{_datadir}/gdb \ + --enable-gdb-build-warnings=,-Wno-unused \ + --enable-build-with-cxx \ +%ifnarch %{ix86} alpha ppc s390 s390x x86_64 ppc64 ppc64le sparc sparcv9 sparc64 %{arm} aarch64 + --disable-werror \ +%else + --enable-werror \ +%endif + --with-separate-debug-dir=/usr/lib/debug \ + --disable-sim \ + --disable-rpath \ + --without-stage1-ldflags \ + --disable-libmcheck \ +%if 0%{!?rhel:1} || 0%{?rhel} > 6 + --with-system-readline \ +%else + --without-system-readline \ +%endif + --without-libunwind \ +%ifarch sparc sparcv9 sparc64 + --without-mmap \ +%endif + --enable-64-bit-bfd \ +%if 0%{!?rhel:1} || 0%{?rhel} > 6 + --with-mpfr \ +%else + --without-mpfr \ +%endif + --with-system-zlib \ +%if 0%{!?rhel:1} || 0%{?rhel} > 6 + --with-lzma \ +%else + --without-lzma \ +%endif + --with-debuginfod \ +%if 0%{?rhel:1} + --disable-libctf +%endif +" + +# Identify the build directory with the version of gdb as well as the +# architecture, to allow for mutliple versions to be installed and +# built. +# Initially we're in the %{gdb_src} directory. + +for fprofile in %{?_with_profile:-fprofile} "" +do + +# We will first build the minimal version of GDB. +%if 0%{?_build_minimal} +mkdir %{gdb_build_minimal}$fprofile +cd %{gdb_build_minimal}$fprofile + +# The configure flags we will use when building gdb-minimal. +GDB_MINIMAL_CONFIGURE_FLAGS="\ + --without-babeltrace \ + --without-expat \ + --disable-tui \ + --without-python \ + --without-guile \ + --disable-inprocess-agent \ + --without-intel-pt \ + --disable-unit-tests \ + --disable-source-highlight" + +export CFLAGS="$RPM_OPT_FLAGS %{?_with_asan:-fsanitize=address}" +export LDFLAGS="%{?__global_ldflags} %{?_with_asan:-fsanitize=address}" + +export CXXFLAGS="$CFLAGS" + +# --htmldir and --pdfdir are not used as they are used from %{gdb_build}. +../configure \ + ${COMMON_GDB_CONFIGURE_FLAGS} \ + ${GDB_MINIMAL_CONFIGURE_FLAGS} \ + --with-auto-load-dir='$debugdir:$datadir/auto-load%{?scl::%{_root_datadir}/gdb/auto-load}' \ + --with-auto-load-safe-path='$debugdir:$datadir/auto-load%{?scl::%{_root_datadir}/gdb/auto-load}' \ +%ifarch sparc sparcv9 + sparc-%{_vendor}-%{_target_os}%{?_gnu} +%else + --enable-targets=s390-linux-gnu,powerpc-linux-gnu,arm-linux-gnu,aarch64-linux-gnu \ + %{_target_platform} +%endif + +# Prepare gdb/config.h first. +%make_build CFLAGS="$CFLAGS $FPROFILE_CFLAGS" LDFLAGS="$LDFLAGS $FPROFILE_CFLAGS" V=1 maybe-configure-gdb +perl -i.relocatable -pe 's/^(D\[".*_RELOCATABLE"\]=" )1(")$/${1}0$2/' gdb/config.status + +%make_build CFLAGS="$CFLAGS $FPROFILE_CFLAGS" LDFLAGS="$LDFLAGS $FPROFILE_CFLAGS" V=1 + +cd .. +%endif # 0%{?_build_minimal} + +# Now we build the full GDB. +mkdir %{gdb_build}$fprofile +cd %{gdb_build}$fprofile + +export CFLAGS="$RPM_OPT_FLAGS %{?_with_asan:-fsanitize=address}" +export LDFLAGS="%{?__global_ldflags} %{?_with_asan:-fsanitize=address}" + +%if 0%{!?rhel:1} || 0%{?rhel} > 7 +CFLAGS="$CFLAGS -DDNF_DEBUGINFO_INSTALL" +%endif + +# Patch833: gdb-6.6-buildid-locate-rpm-scl.patch +%if 0%{?el6:1} && 0%{?scl:1} +CFLAGS="$CFLAGS -DGDB_INDEX_VERIFY_VENDOR" +%endif + +# [dts+el7] [x86*] Bundle linux_perf.h for libipt (RH BZ 1256513). +%if %{have_libipt} && 0%{?el7:1} && 0%{?scl:1} +CFLAGS="$CFLAGS -DPERF_ATTR_SIZE_VER5_BUNDLE" +%endif + +# Patch642: gdb-readline62-ask-more-rh.patch +%if 0%{?rhel} == 7 +CFLAGS="$CFLAGS -DNEED_RL_STATE_FEDORA_GDB" +%else +# FIXME: Why not just: ! grep -w ... +if grep -w RL_STATE_FEDORA_GDB %{_includedir}/readline/readline.h;then false;fi +%endif + +# Patch337: gdb-6.8-attach-signalled-detach-stopped.patch +# Patch331: gdb-6.8-quit-never-aborts.patch +%if 0%{?rhel:1} && 0%{?rhel} <= 6 +CFLAGS="$CFLAGS -DNEED_DETACH_SIGSTOP" +%endif + +%if 0%{have_libipt} && 0%{?el7:1} && 0%{?scl:1} +( + mkdir libipt-%{libipt_version}-root + mkdir libipt-%{libipt_version}-build + cd libipt-%{libipt_version}-build + # -DPTUNIT:BOOL=ON has no effect on ctest. + %cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo \ + -DPTUNIT:BOOL=OFF \ + -DDEVBUILD:BOOL=ON \ + -DBUILD_SHARED_LIBS=OFF \ + ../../libipt-%{libipt_version} + make VERBOSE=1 %{?_smp_mflags} + ctest -V %{?_smp_mflags} + make install DESTDIR=../libipt-%{libipt_version}-root +) +# There is also: --with-libipt-prefix +CFLAGS="$CFLAGS -I$PWD/libipt-%{libipt_version}-root%{_includedir}" +LDFLAGS="$LDFLAGS -L$PWD/libipt-%{libipt_version}-root%{_libdir}" +%endif + +export CXXFLAGS="$CFLAGS" + +# The configure flags we will use when building the full GDB. +GDB_FULL_CONFIGURE_FLAGS="\ + --with-system-gdbinit=%{_sysconfdir}/gdbinit \ +%if 0%{!?rhel:1} || 0%{?rhel} > 7 + --with-babeltrace \ +%else + --without-babeltrace \ +%endif + --with-expat \ +$(: ppc64 host build crashes on ppc variant of libexpat.so ) \ + --without-libexpat-prefix \ + --enable-tui \ +%if 0%{!?_without_python:1} + --with-python=%{__python} \ +%else + --without-python \ +%endif +%if 0%{!?rhel:1} || 0%{?rhel} == 8 + --with-guile \ +%else + --without-guile \ +%endif +%if %{have_inproctrace} + --enable-inprocess-agent \ +%else + --disable-inprocess-agent \ +%endif +%if %{have_libipt} + --with-intel-pt \ +%else + --without-intel-pt \ +%endif +%if 0%{!?rhel:1} + --with-xxhash \ +%endif + --with-rpm=librpm.so.%{librpmver} \ + --enable-unit-tests" + +# --htmldir and --pdfdir are not used as they are used from %{gdb_build}. +../configure \ + ${COMMON_GDB_CONFIGURE_FLAGS} \ + ${GDB_FULL_CONFIGURE_FLAGS} \ + --with-auto-load-dir='$debugdir:$datadir/auto-load%{?scl::%{_root_datadir}/gdb/auto-load}' \ + --with-auto-load-safe-path='$debugdir:$datadir/auto-load%{?scl::%{_root_datadir}/gdb/auto-load}' \ +%ifarch sparc sparcv9 + sparc-%{_vendor}-%{_target_os}%{?_gnu} +%else + --enable-targets=s390-linux-gnu,powerpc-linux-gnu,arm-linux-gnu,aarch64-linux-gnu \ + %{_target_platform} +%endif + +if [ -z "%{!?_with_profile:no}" ] +then + # Run all the configure tests being incompatible with $FPROFILE_CFLAGS. + %make_build configure-host configure-target + %make_build clean + + # Workaround -fprofile-use: + # linux-x86-low.c:2225: Error: symbol `start_i386_goto' is already defined + %make_build -C gdb/gdbserver linux-x86-low.o +fi + +# Global CFLAGS would fail on: +# conftest.c:1:1: error: coverage mismatch for function 'main' while reading counter 'arcs' +if [ "$fprofile" = "-fprofile" ] +then + FPROFILE_CFLAGS='-fprofile-generate' +elif [ -z "%{!?_with_profile:no}" ] +then + FPROFILE_CFLAGS='-fprofile-use' + # We cannot use -fprofile-dir as the bare filenames clash. + (cd ../${builddir}-fprofile; + # It was 333 on x86_64. + test $(find -name "*.gcda"|wc -l) -gt 300 + find -name "*.gcda" | while read -r i + do + ln $i ../${builddir}/$i + done + ) +else + FPROFILE_CFLAGS="" +fi + +# Prepare gdb/config.h first. +%make_build CFLAGS="$CFLAGS $FPROFILE_CFLAGS" LDFLAGS="$LDFLAGS $FPROFILE_CFLAGS" V=1 maybe-configure-gdb +perl -i.relocatable -pe 's/^(D\[".*_RELOCATABLE"\]=" )1(")$/${1}0$2/' gdb/config.status + +%make_build CFLAGS="$CFLAGS $FPROFILE_CFLAGS" LDFLAGS="$LDFLAGS $FPROFILE_CFLAGS" V=1 + +! grep '_RELOCATABLE.*1' gdb/config.h + +if [ "$fprofile" = "-fprofile" ] +then + cd gdb + cp -p gdb gdb-withindex + PATH="$PWD:$PATH" sh ../../gdb/gdb-add-index $PWD/gdb-withindex + ./gdb -nx -ex q ./gdb-withindex + ./gdb -nx -readnow -ex q ./gdb-withindex + cd .. +fi + +cd .. + +done # fprofile + +cd %{gdb_build} + +%make_build \ + -C gdb/doc {gdb,annotate}{.info,/index.html,.pdf} MAKEHTMLFLAGS=--no-split MAKEINFOFLAGS=--no-split V=1 + +# Copy the /gdb/NEWS file to the directory above it. +cp $RPM_BUILD_DIR/%{gdb_src}/gdb/NEWS $RPM_BUILD_DIR/%{gdb_src} + +%check +# Initially we're in the %{gdb_src} directory. +cd %{gdb_build} + +# We always run the unittests. +(cd gdb; make run GDBFLAGS='-batch -ex "maintenance selftest"') + +%if 0%{!?_with_testsuite:1} +echo ====================TESTSUITE DISABLED========================= +%else +echo ====================TESTING========================= +cd gdb +gcc -o ./orphanripper %{SOURCE2} -Wall -lutil -ggdb2 +# Need to use a single --ignore option, second use overrides first. +# No `%{?_smp_mflags}' here as it may race. +# WARNING: can't generate a core file - core tests suppressed - check ulimit +# "readline-overflow.exp" - Testcase is broken, functionality is OK. +( + # ULIMIT required for `gdb.base/auxv.exp'. + ulimit -H -c + ulimit -c unlimited || : + + # Setup $CHECK as `check//unix/' or `check//unix/-m64' for explicit bitsize. + # Never use two different bitsizes as it fails on ppc64. + echo 'int main (void) { return 0; }' >biarch.c + CHECK="" + for BI in -m64 -m32 -m31 "" + do + # Do not use size-less options if any of the sizes works. + # On ia64 there is no -m64 flag while we must not leave a bare `check' here + # as it would switch over some testing scripts to the backward compatibility + # mode: when `make check' was executed from inside the testsuite/ directory. + if [ -z "$BI" -a -n "$CHECK" ];then + continue + fi + # Do not use $RPM_OPT_FLAGS as the other non-size options will not be used + # in the real run of the testsuite. + if ! gcc $BI -o biarch biarch.c + then + continue + fi + CHECK="$CHECK check//unix/$BI check//native-gdbserver/$BI check//native-extended-gdbserver/$BI" + done + # Do not try -m64 inferiors for -m32 GDB as it cannot handle inferiors larger + # than itself. + # s390 -m31 still uses the standard ELF32 binary format. + gcc $RPM_OPT_FLAGS -o biarch biarch.c + RPM_SIZE="$(file ./biarch|sed -n 's/^.*: ELF \(32\|64\)-bit .*$/\1/p')" + if [ "$RPM_SIZE" != "64" ] + then + CHECK="$(echo " $CHECK "|sed 's#check//unix/-m64 check//native-gdbserver/-m64 check//native-extended-gdbserver/-m64# #')" + fi + + # Disable some problematic testcases. + # RUNTESTFLAGS='--ignore ...' is not used below as it gets separated by the + # `check//...' target spawn and too much escaping there would be dense. + for test in \ + gdb.base/readline-overflow.exp \ + gdb.base/bigcore.exp \ + ; do + mv -f ../../gdb/testsuite/$test ../gdb/testsuite/$test-DISABLED || : + done + + # Run all the scheduled testsuite runs also in the PIE mode. + # See also: gdb-runtest-pie-override.exp + ###CHECK="$(echo $CHECK|sed 's#check//unix/[^ ]*#& &/-fPIC/-pie#g')" + + ./orphanripper %make_build -k $CHECK || : +) +for t in sum log +do + for file in testsuite*/gdb.$t + do + suffix="${file#testsuite}" + suffix="${suffix%/gdb.$t}" + ln $file gdb-%{_target_platform}$suffix.$t || : + done +done +# `tar | bzip2 | uuencode' may have some piping problems in Brew. +tar cjf gdb-%{_target_platform}.tar.bz2 gdb-%{_target_platform}*.{sum,log} +uuencode gdb-%{_target_platform}.tar.bz2 gdb-%{_target_platform}.tar.bz2 +cd ../.. +echo ====================TESTING END===================== +%endif + +%install +# Initially we're in the %{gdb_src} directory. +%if 0%{?_build_minimal} +cd %{gdb_build_minimal} +rm -rf $RPM_BUILD_ROOT + +%make_install %{?_smp_mflags} + +# Delete everything except the 'gdb' binary, and then rename it to +# 'gdb.minimal'. +rm -rfv $RPM_BUILD_ROOT%{_prefix}/{include,lib*,share} +rm -fv $RPM_BUILD_ROOT%{_bindir}/{gcore,gdbserver,gstack,gdb-add-index} +mv $RPM_BUILD_ROOT%{_bindir}/gdb $RPM_BUILD_ROOT%{_bindir}/gdb.minimal + +cd .. +%endif # 0%{?_build_minimal} + +# Install the full build. + +cd %{gdb_build} + +# We must remove the $RPM_BUILD_ROOT directory ourselves if we're not +# building gdb-minimal. +%if 0%{!?_build_minimal} +rm -rf $RPM_BUILD_ROOT +%endif # 0%{!?_build_minimal} + +%if 0%{?el6:1} +# GDB C++11 requires devtoolset gcc. +%{?scl:PATH=%{_bindir}${PATH:+:${PATH}}} +%endif + +%make_install %{?_smp_mflags} + +%if 0%{!?scl:1} +mkdir -p $RPM_BUILD_ROOT%{_prefix}/libexec +mv -f $RPM_BUILD_ROOT%{_bindir}/gdb $RPM_BUILD_ROOT%{_prefix}/libexec/gdb +%if 0%{?rhel:1} && 0%{?rhel} <= 6 +# RHEL-6: ln: invalid option -- 'r': https://bugzilla.redhat.com/show_bug.cgi?id=1384947 +# RHEL-6 also does not have: /usr/bin/realpath +ln -s $( + perl -le 'sub x{$_=$_[0];s{/+}{/}g;s{/$}{};return split "/";}@a=x shift;@b=x shift;while($a[0] eq $b[0]){shift @a;shift @b;}print join "/",map("..",@a),@b;' \ + $RPM_BUILD_ROOT%{_bindir} $RPM_BUILD_ROOT%{_prefix}/libexec/gdb +) $RPM_BUILD_ROOT%{_bindir}/gdb +%else +ln -s -r $RPM_BUILD_ROOT%{_prefix}/libexec/gdb $RPM_BUILD_ROOT%{_bindir}/gdb +%endif +%endif + +# Provide gdbtui for RHEL-5 and RHEL-6 as it is removed upstream (BZ 797664). +%if 0%{?rhel:1} && 0%{?rhel} <= 6 +test ! -e $RPM_BUILD_ROOT%{_prefix}/bin/gdbtui +install -m 755 %{SOURCE6} $RPM_BUILD_ROOT%{_prefix}/bin/gdbtui +ln -sf gdb.1 $RPM_BUILD_ROOT%{_mandir}/man1/gdbtui.1 +%endif # 0%{?rhel:1} && 0%{?rhel} <= 6 + +mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/gdbinit.d +touch -r %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/gdbinit.d +sed 's#%%{_sysconfdir}#%{_sysconfdir}#g' <%{SOURCE4} >$RPM_BUILD_ROOT%{_sysconfdir}/gdbinit +touch -r %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/gdbinit + +for i in `find $RPM_BUILD_ROOT%{_datadir}/gdb/python/gdb -name "*.py"` +do + # Files could be also patched getting the current time. + touch -r $RPM_BUILD_DIR/%{gdb_src}/gdb/ChangeLog $i +done + +%if 0%{?_enable_debug_packages:1} && 0%{!?_without_python:1} +mkdir -p $RPM_BUILD_ROOT/usr/lib/debug%{_bindir} +cp -p ./gdb/gdb-gdb.py $RPM_BUILD_ROOT/usr/lib/debug%{_bindir}/ +for pyo in "" "-O";do + # RHEL-5: AttributeError: 'module' object has no attribute 'compile_file' + %{__python} $pyo -c 'import compileall, re, sys; sys.exit (not compileall.compile_dir("'"$RPM_BUILD_ROOT/usr/lib/debug%{_bindir}"'", 1, "'"/usr/lib/debug%{_bindir}"'"))' +done +%endif # 0%{?_enable_debug_packages:1} && 0%{!?_without_python:1} + +# Compile python files +%if 0%{!?_without_python:1} +%py_byte_compile %{__python3} %{buildroot}%{_datadir}/gdb/python/gdb +%endif + +%if 0%{!?_without_python:1} +%if 0%{!?rhel:1} || 0%{?rhel} > 6 +# BZ 999645: /usr/share/gdb/auto-load/ needs filesystem symlinks +for i in $(echo bin lib $(basename %{_libdir}) sbin|tr ' ' '\n'|sort -u);do + # mkdir to satisfy dangling symlinks build check. + mkdir -p $RPM_BUILD_ROOT%{_datadir}/gdb/auto-load/%{_root_prefix}/$i + ln -s $(echo %{_root_prefix}|sed 's#^/*##')/$i \ + $RPM_BUILD_ROOT%{_datadir}/gdb/auto-load/$i +done +%endif # 0%{!?rhel:1} || 0%{?rhel} > 6 +%if 0%{?rhel:1} && 0%{?rhel} <= 7 +# Temporarily now: +for LIB in $(echo lib $(basename %{_libdir})|tr ' ' '\n'|sort -u);do + LIBPATH="$RPM_BUILD_ROOT%{_datadir}/gdb/auto-load%{_root_prefix}/$LIB" + mkdir -p $LIBPATH + # basename is being run only for the native (non-biarch) file. + sed -e 's,@pythondir@,%{_datadir}/gdb/python,' \ + -e 's,@toolexeclibdir@,%{_root_prefix}/'"$LIB," \ + < $RPM_BUILD_DIR/%{gdb_src}/%{libstdcxxpython}/hook.in \ + > $LIBPATH/$(basename %{_root_prefix}/%{_lib}/libstdc++.so.6.*)-gdb.py + # Test the filename 'libstdc++.so.6.*' has matched. + test -f $LIBPATH/libstdc++.so.6.[0-9]*-gdb.py +done +test ! -e $RPM_BUILD_ROOT%{_datadir}/gdb/python/libstdcxx +cp -a $RPM_BUILD_DIR/%{gdb_src}/%{libstdcxxpython}/libstdcxx \ + $RPM_BUILD_ROOT%{_datadir}/gdb/python/libstdcxx +%endif # 0%{?rhel:1} && 0%{?rhel} <= 7 +for i in `find $RPM_BUILD_ROOT%{_datadir}/gdb -name "*.py"`; do + # Files are installed by install(1) not preserving the timestamps. + touch -r $RPM_BUILD_DIR/%{gdb_src}/gdb/ChangeLog $i +done +%endif # 0%{!?_without_python:1} + +# gdb-add-index cannot be run even for SCL package on RHEL<=6. +%if 0%{?rhel:1} && 0%{?rhel} <= 6 +rm -f $RPM_BUILD_ROOT%{_bindir}/gdb-add-index +rm -f $RPM_BUILD_ROOT%{_mandir}/*/gdb-add-index.1* +%endif + +# Remove the files that are part of a gdb build but that are owned and +# provided by other packages. +# These are part of binutils + +rm -rf $RPM_BUILD_ROOT%{_datadir}/locale/ +rm -f $RPM_BUILD_ROOT%{_infodir}/bfd* +rm -f $RPM_BUILD_ROOT%{_infodir}/standard* +rm -f $RPM_BUILD_ROOT%{_infodir}/configure* +# Just exclude the header files in the top directory, and don't exclude +# the gdb/ directory, as it contains jit-reader.h. +rm -rf $RPM_BUILD_ROOT%{_includedir}/*.h +rm -rf $RPM_BUILD_ROOT/%{_libdir}/lib{bfd*,opcodes*,iberty*,ctf*} + +# pstack obsoletion + +cp -p %{SOURCE3} $RPM_BUILD_ROOT%{_mandir}/man1/gstack.1 +ln -s gstack.1 $RPM_BUILD_ROOT%{_mandir}/man1/pstack.1 +ln -s gstack $RPM_BUILD_ROOT%{_bindir}/pstack + +# Packaged GDB is not a cross-target one. +(cd $RPM_BUILD_ROOT%{_datadir}/gdb/syscalls + rm -f mips*.xml +%ifnarch sparc sparcv9 sparc64 + rm -f sparc*.xml +%endif +%ifnarch x86_64 + rm -f amd64-linux.xml +%endif +%ifnarch %{ix86} x86_64 + rm -f i386-linux.xml +%endif +) + +# Documentation only for development. +rm -f $RPM_BUILD_ROOT%{_infodir}/gdbint* +rm -f $RPM_BUILD_ROOT%{_infodir}/stabs* + +# Delete this too because the dir file will be updated at rpm install time. +# We don't want a gdb specific one overwriting the system wide one. + +rm -f $RPM_BUILD_ROOT%{_infodir}/dir + +%if 0%{?rhel:1} && 0%{?rhel} <= 7 +# /usr/share/gdb/guile/ gets installed even --without-guile +# https://sourceware.org/bugzilla/show_bug.cgi?id=17105 +rm -rf $RPM_BUILD_ROOT%{_datadir}/gdb/guile +%endif + +# These files are unrelated to Fedora Linux. +rm -f $RPM_BUILD_ROOT%{_datadir}/gdb/system-gdbinit/elinos.py +rm -f $RPM_BUILD_ROOT%{_datadir}/gdb/system-gdbinit/wrs-linux.py +rmdir $RPM_BUILD_ROOT%{_datadir}/gdb/system-gdbinit + +%files +# File must begin with "/": {GFDL,COPYING3,COPYING,COPYING.LIB,COPYING3.LIB} +%if 0%{!?el6:1} +%license COPYING3 COPYING COPYING.LIB COPYING3.LIB +%else +%doc COPYING3 COPYING COPYING.LIB COPYING3.LIB +%endif +%doc README NEWS +%{_bindir}/gdb +%{_bindir}/gcore +%{_mandir}/*/gcore.1* +%{_bindir}/gstack +%{_mandir}/*/gstack.1* +%{_bindir}/pstack +%{_mandir}/*/pstack.1* +# Provide gdb/jit-reader.h so that users are able to write their own GDB JIT +# plugins. +%{_includedir}/gdb +%if 0%{!?scl:1} +%files headless +%{_prefix}/libexec/gdb +%endif +%config(noreplace) %{_sysconfdir}/gdbinit +%{_mandir}/*/gdb.1* +%{_sysconfdir}/gdbinit.d +%{_mandir}/*/gdbinit.5* +# gdb-add-index cannot be run even for SCL package on RHEL<=6. +%if 0%{!?rhel:1} || 0%{?rhel} > 6 +%{_bindir}/gdb-add-index +%{_mandir}/*/gdb-add-index.1* +%endif +# Provide gdbtui for RHEL-5 and RHEL-6 as it is removed upstream (BZ 797664). +%if 0%{?rhel:1} && 0%{?rhel} <= 6 +%{_bindir}/gdbtui +%{_mandir}/*/gdbtui.1* +%endif # 0%{?rhel:1} && 0%{?rhel} <= 6 +%{_datadir}/gdb + +# don't include the files in include, they are part of binutils + +%if 0%{?_build_minimal} +%files minimal +%{_bindir}/gdb.minimal +%{_bindir}/gdb-add-index +%endif # 0%{?_build_minimal} + +%ifnarch sparc sparcv9 +%files gdbserver +%{_bindir}/gdbserver +%{_mandir}/*/gdbserver.1* +%if %{have_inproctrace} +%{_libdir}/libinproctrace.so +%endif # %{have_inproctrace} +%endif + +%if 0%{!?_without_python:1} +# [rhel] Do not migrate /usr/share/gdb/auto-load/ with symlinks on RHELs. +%if 0%{!?rhel:1} +%pre +for i in $(echo bin lib $(basename %{_libdir}) sbin|tr ' ' '\n'|sort -u);do + src="%{_datadir}/gdb/auto-load/$i" + dst="%{_datadir}/gdb/auto-load/%{_root_prefix}/$i" + if test -d $src -a ! -L $src;then + if ! rmdir 2>/dev/null $src;then + mv -n $src/* $dst/ + rmdir $src + fi + fi +done +%endif # 0%{!?rhel:1} +%endif # 0%{!?_without_python:1} + +%files doc +%doc %{gdb_build}/gdb/doc/{gdb,annotate}.{html,pdf} +%{_infodir}/annotate.info* +%{_infodir}/gdb.info* + +%if 0%{?scl:1} +# As of F-28, packages won't need to call /sbin/install-info by hand +# anymore. We make an exception for DTS here. +# https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/MP2QVJZBOJZEOQO2G7UB2HLXKXYPF2G5/ + +%post doc +# This step is part of the installation of the RPM. Not to be confused +# with the 'make install ' of the build (rpmbuild) process. + +# For --excludedocs: +if [ -e %{_infodir}/gdb.info.gz ] +then + /sbin/install-info --info-dir=%{_infodir} %{_infodir}/annotate.info.gz || : + /sbin/install-info --info-dir=%{_infodir} %{_infodir}/gdb.info.gz || : +fi + +%preun doc +if [ $1 = 0 ] +then + # For --excludedocs: + if [ -e %{_infodir}/gdb.info.gz ] + then + /sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/annotate.info.gz || : + /sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/gdb.info.gz || : + fi +fi +%endif + +%changelog +* Wed Dec 13 2023 Keith Seitz - 10.2-13.el9 +- Backport patches for "Fix undefined behaviour dereferencing empty string" + (Magne Hov et al, RHEL-17631) + +* Tue Oct 3 2023 Guinevere Larsen - 10.2-12.el9 +- Backport "libiberty: Fix infinite recursion in rust demangler." + (Nick Clifton) +- Backport Add a recursion limit to the demangle_const function in the Rust demangler. + (Nick Clifton, RHEL-4234) +- Backport Fix typo in recent code to add stack recursion limit to the Rust demangler. + (Nick Clifton) + +* Tue Oct 3 2023 Guinevere Larsen +- Backport "Fix crash in Fortran code" + (Tom Tromey, RHEL-7328) + +* Wed Mar 29 2023 Bruno Larsen - 10.2-11.el9 +- Backport "libiberty: prevent buffer overflow when decoding user input" + (Luís Ferreira, RHBZ2132600) + +* Mon Mar 27 2023 Bruno Larsen +- Backport "[gdb/breakpoint] Fix assert in jit_event_handler" + (Tom de Vries, RHBZ 2130624) + +* Thu Mar 23 2023 Bruno Larsen +- Bakport "Fix assertion failure in copy_type" + (Tom Tromey, RHBZ 2155439) +- Bakport "[gdb/testsuite] Fix PR20630 regression test in gdb.base/printcmds.exp" + (Tom de Vries) + +* Tue May 24 2022 Keith Seitz - 10.2-10.el9 +- Backport "fix logic of find_comp_unit and set_comp_unit" + (Simon Marchi, RHBZ 2086761) + +* Mon Apr 11 2022 Bruno Larsen +- Backport Add Power 10 PLT instruction patterns + (Carl Love, RHBZ 1870017) + +* Mon Nov 1 2021 Keith Seitz - 10.2-9.el9 +- Backport IBM arch14 updates. + (Andreas Krebbel, RHBZ 2012819) + +* Mon Aug 09 2021 Mohan Boddu - 10.2-8.el9 +- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags + Related: rhbz#1991688 + +* Wed Jul 28 2021 Keith Seitz - 10.2-7.el9 +- Disable compile feature on RHEL9; remove gcc-gdb-plugin requirements. + +* Mon Jun 28 2021 Keith Seitz - 10.2-6.el9 +- Backport "PowerPC remove 512 bytes region limit if 2nd DAWR is available" + (Rogerio Alves, RHBZ 1870029) +- Backport patches for "Support prefixed instructions in GDB" + (Will Schmidt and Luis Machado, RHBZ 1870031) + +* Fri Jun 25 2021 Keith Seitz - 10.2-5.el9 +- Backport five patches to support glibc 2.34 with merged libpthread. + (Simon Marchi and Kevin Buettner, RH BZ 1971095) + +* Thu Jun 10 2021 Keith Seitz - 10.2-4.el8 +- Backport "Fix gdb.fortran/array-slices.exp with -m32" + (Tom de Vries, testsuite/269970) +- Backport "adjust gdb.python/flexible-array-member.exp expected pattern" + (Simon Marchi) + +* Fri Jun 4 2021 Keith Seitz - 10.2-3.el8 +- Backport "Exclude debuginfo files from 'outside ELF segments' warning". + (Keith Seitz, RH BZ 1898252) +- Backport "Correct recording of 'store on condition' insns" + (Andreas Arnez, RH BZ 1903375) + +* Thu May 27 2021 Keith Seitz - 10.2-2 +- Backport "Correct recording of 'store on condition' insns" + (Andreas Arnaz, RH BZ 1903375) +- Backport "Exclude debuginfo files from 'outside ELF segments' warning". + (Keith Seitz, RH BZ 1898252) +- Backport "Fix crash when expanding partial symtab..." + (Tom Tromey. gdb/27743) + +* Tue May 25 2021 Kevin Buettner - 10.2-1 +- Rebase to FSF GDB 10.2. +- Drop gdb-6.3-test-pie-20050107.patch. +- Drop gdb-6.3-test-self-20050110.patch. +- Drop gdb-6.5-bz218379-ppc-solib-trampoline-test.patch. +- Drop gdb-6.6-buildid-locate-core-as-arg.patch. +- Drop gdb-6.8-quit-never-aborts.patch. +- Drop gdb-archer-pie-addons-keep-disabled.patch. +- Drop gdb-archer-pie-addons.patch. +- Drop gdb-archer-vla-tests.patch. +- Drop gdb-archer.patch. +- Drop gdb-attach-fail-reasons-5of5.patch. +- Drop gdb-btrobust.patch. +- Drop gdb-bz1219747-attach-kills.patch. +- Drop gdb-bz533176-fortran-omp-step.patch. +- Drop gdb-dts-rhel6-python-compat.patch. +- Drop gdb-gnat-dwarf-crash-3of3.patch. +- Drop gdb-jit-reader-multilib.patch. +- Drop gdb-moribund-utrace-workaround.patch. +- Drop gdb-rhbz1930528-fix-gnulib-build-error.patch. +- Drop gdb-rhbz1932645-aarch64-ptrace-header-order.patch. +- Drop gdb-vla-intel-fix-print-char-array.patch. +- Drop gdb-vla-intel-fortran-strides.patch. +- Drop gdb-vla-intel-stringbt-fix.patch. +- Drop gdb-vla-intel-tests.patch. +- Drop process_psymtab_comp_unit-type-unit.patch. +- Drop gdb-testsuite-readline63-sigint-revert.patch. +- Drop gdb-config.patch. +- Add following upstream patches for Fortran stride / slice support: + gdb-rhbz1964167-convert-enum-range_type.patch + gdb-rhbz1964167-fortran-array-slices-at-prompt.patch + gdb-rhbz1964167-fortran-array-strides-in-expressions.patch + gdb-rhbz1964167-fortran-clean-up-array-expression-evaluation.patch + gdb-rhbz1964167-fortran-range_type-to-range_flag.patch + gdb-rhbz1964167-fortran-whitespace_array.patch + gdb-rhbz1964167-move-fortran-expr-handling.patch + +* Wed Mar 31 2021 Keith Seitz - 10.1-14 +- Backport "Save/restore file offset while reading notes in core file" + (Keith Seitz, RHBZ 1931344) + +* Tue Mar 30 2021 Jonathan Wakely - 10.1-13 +- Rebuilt for removed libstdc++ symbol (#1937698) + +* Tue Mar 23 2021 Kevin Buettner +- Remove spec file workaround for RHBZ 1912913. + +* Fri Mar 19 2021 Kevin Buettner - 10.1-12 +- Fix potential hang during gdbserver testing (RHBZ 1941080, Kevin Buettner). + +* Thu Mar 18 2021 Keith Seitz - 10.1-11 +- Disable libctf on RHEL (RHBZ 1935517). + +* Thu Mar 11 2021 Kevin Buettner - 10.1-10 +- Update libipt to version 2.0.4. + +* Fri Mar 05 2021 Kevin Buettner - 10.1-9 +- Backport patches which fix frame_id_p assertion failure (RHBZ 1909902, + Pedro Alves). + +* Fri Mar 5 2021 Jan Kratochvil - 10.1-8 +- Drop gdb-vla-intel-fortran-vla-strings.patch as it was still regressing the + testsuite. + +* Thu Mar 4 2021 Jan Kratochvil +- Fix gdb-vla-intel-fortran-vla-strings.patch to no longer modify cached + inferior types. + +* Thu Mar 4 2021 Jan Kratochvil +- Align gdb-vla-intel-fortran-vla-strings.patch more to upstream + fixing whitespaces in Fortran types printing. + +* Thu Mar 4 2021 Jan Kratochvil +- Reapply 10.1-8 after it has been accidentally reverted by 10.1-7. + +* Wed Feb 24 2021 Kevin Buettner - 10.1-7 +- Fix aarch64 build problem (RHBZ 1932645, Kevin Buettner). + +* Fri Feb 19 2021 Jan Kratochvil +- Fix gdb-vla-intel-fortran-vla-strings.patch for compatiblity with GraalVM. + +* Thu Feb 18 2021 Kevin Buettner +- Fix gnulib related build problem (RHBZ 1930528, Kevin Buettner). + +* Wed Feb 17 2021 Kevin Buettner +- Fix libstdc++ assert when performing tab completion; build must be made + with -D_GLIBCXX_DEBUG flag in order to trigger assert (RHBZ 1912985, + Kevin Buettner). + +* Wed Feb 17 2021 Keith Seitz - 10.1-6 +- NVR bump to disable guile support. + +* Thu Feb 11 2021 Keith Seitz +- Disable Guile support for RHEL9+. + +* Tue Jan 26 2021 Stephen Gallagher - 10.1-5 +- Build gdb-minimal for ELN + +* Tue Jan 26 2021 Fedora Release Engineering +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + +* Sat Jan 23 2021 Kevin Buettner +- Add -Wno-stringop-overread to CFLAGS to work around gcc + bug (RH BZ 1912913) + +* Tue Jan 12 2021 Keith Seitz - 10.1-3 +- Disable xxhash support for RHEL. + +* Wed Dec 09 2020 Kevin Buettner - 10.1-2 +- Fix off-by-one error in ada_fold_name. (RHBZ 1905996, Kevin Buettner) + +* Wed Nov 04 2020 Kevin Buettner - 10.1-1 +- Rebase to FSF GDB 10.1. +- Bump 'snapgnulib' date. +- Drop gdb-rhbz1818011-bfd-gcc10-error.patch. +- Drop gdb-rhbz1822715-fix-python-deprecation.patch. +- Drop gdb-rhbz1829702-fix-python39.patch. +- Drop gdb-rhbz1838777-debuginfod.patch. +- Drop gdb-rhbz1844458-use-fputX_unfiltered.patch. +- Drop gdb-rhbz1869484-deleted-working-directory. +- Adjust build-id related patches. +- Ajust VLA patches. + +* Mon Nov 2 2020 Kevin Buettner - 9.2-8 +- Backport patches fixing abort when working directory is deleted. + (RHBZ 1869484, Sergio Durigan Junior) + +* Mon Nov 2 2020 Keith Seitz - 9.2-7 +- Fix missing debuginfo messages. (RH BZ 1887025) + +* Mon Aug 10 2020 Keith Seitz +- Disable LTO until upstream sorts out ODR problems. + +* Tue Aug 04 2020 Keith Seitz +- Update libipt to v2.0.2. + +* Sat Aug 01 2020 Fedora Release Engineering +- Second attempt - Rebuilt for + https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Mon Jul 27 2020 Fedora Release Engineering +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Wed Jul 22 2020 Tom Stellard +- Use make macros +- https://fedoraproject.org/wiki/Changes/UseMakeBuildInstallMacro + +* Mon Jul 20 2020 Jeff Law - 9.2-3 +- Fix broken configure tests compromised by LTO +- Add BuildRequires: autoconf + +* Wed Jun 17 2020 Keith Seitz - 9.2-2 +- Backport debuginfod support. + +* Tue Jun 9 2020 Keith Seitz - 9.2-1 +- Rebase to FSF GDB 9.2. +- Add explicit python bytecode compilation. +- Change included files to patches to quell error from rpminspect. +- Fix attach-32.exp from gdb-6.3-inferior-notification-20050721.patch. + +* Fri Jun 5 2020 Keith Seitz - 9.1-8 +- Add patch for Python 3.9 and re-enable python. +- Update generate-*.sh to include stgit support. + +* Thu May 21 2020 Miro Hrončok - 9.1-7 +- Disable Python support to workaround problems with Python 3.9 (RHBZ 1829702) + +* Thu Apr 16 2020 Kevin Buettner - 9.1-6 +- Fix build breakage of gdb/python/python.c due to use of deprecated + Python function (RHBZ 1822715, Kevin Buettner) + +* Wed Apr 08 2020 Kevin Buettner - 9.1-5 +- Fix build breakage when compiling bfd/elf.c with gcc 10. (RHBZ 1818011, + H.J. Lu) + +* Mon Mar 2 2020 Sergio Durigan Junior - 9.1-4 +- Add '--without-guile' to GDB_MINIMAL_CONFIGURE_FLAGS. + +* Thu Feb 13 2020 Sergio Durigan Junior - 9.1-3 +- Fix 'Recursive call to 'missing_rpm_list_print' when pagination is + on and missing RPM list is big' (RHBZ 1801974, Sergio Durigan + Junior). + +* Mon Feb 10 2020 Sergio Durigan Junior - 9.1-2 +- Enable libxxhash during build. + +* Sat Feb 8 2020 Sergio Durigan Junior - 9.1-1 +- Rebase to FSF GDB 9.1. + +* Tue Feb 4 2020 Dan Čermák - 9.0.90.20200203-5 +- Re-enable guile support. + +* Mon Feb 3 2020 Sergio Durigan Junior - 9.0.90.20200203-4 +- Rebase to FSF GDB 9.0.90.20200203 (9.1pre). +- Bump 'snapgnulib' date. +- Update URL to 'https'. +- Adjust build-id patchset. +- Adjust VLA patchset. +- Drop 'gdb-6.8-bz436037-reg-no-longer-active.patch'. +- Drop 'gdb-6.6-scheduler_locking-step-is-default.patch'. + +* Tue Jan 28 2020 Fedora Release Engineering +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + +* Tue Nov 19 2019 Sergio Durigan Junior - 9.0.50.20191119-2 +- Rebase to FSF GDB 9.0.50.20191119 (9.1pre). +- Drop 'gdb-readline62-ask-more-rh.patch'. +- Drop 'gdb-6.5-bz216711-clone-is-outermost.patch'. +- Adjust 'gdb-archer-pie-addons-keep-disabled.patch'. + +* Fri Oct 18 2019 Sergio Durigan Junior - 9.0.50.20191018-1 +- Rebase to FSF GDB 9.0.50.20191018 (9.1pre). +- Expand comment on "bundled(binutils)". +- Remove libctf's files from RPM_BUILD_ROOT. + +* Wed Oct 9 2019 Jerry James - 8.3.50.20190924-28 +- Rebuild for mpfr 4 + +* Wed Sep 25 2019 Sergio Durigan Junior - 8.3.50.20190924-27 +- Rebase to FSF GDB 8.3.50.20190924 (8.4pre). +- Update 'gdb-6.6-buildid-locate.patch'. + +* Sat Aug 24 2019 Sergio Durigan Junior - 8.3.50.20190824-26 +- Rebase to FSF GDB 8.3.50.20190824 (8.4pre). +- Update 'v1.5-libipt-static.patch'. + +* Wed Aug 21 2019 Miro Hrončok +- Rebuilt for Python 3.8 + +* Sun Aug 18 2019 Sergio Durigan Junior - 8.3.50.20190816-24 +- Update bundled libipt copy to v2.0.1. + +* Fri Aug 16 2019 Sergio Durigan Junior - 8.3.50.20190816-23 +- Rebase to FSF GDB 8.3.50.20190816 (8.4pre). +- Drop 'gdb-testsuite-readline63-sigint.patch'. +- Cleanup 'gdb-archer.patch' and remove several things, like the '-P' feature. + +* Wed Aug 14 2019 Miro Hrončok +- Rebuilt for Python 3.8 + +* Fri Aug 2 2019 Sergio Durigan Junior - 8.3.50.20190802-21 +- Rebase to FSF GDB 8.3.50.20190802 (8.4pre). + +* Thu Jul 25 2019 Fedora Release Engineering +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + +* Tue Jul 2 2019 Sergio Durigan Junior - 8.3.50.20190702-19 +- Rebase to FSF GDB 8.3.50.20190702 (8.4pre). +- Remove gdb-bz568248-oom-is-error.patch. + +* Tue Jun 25 2019 Sergio Durigan Junior - 8.3.50.20190625-18 +- Rebase to FSF GDB 8.3.50.20190625 (8.4pre). + +* Fri Jun 21 2019 Sergio Durigan Junior - 8.3.50.20190610-17 +- Rebuild for librpm9 (RH BZ 1720305). + +* Mon Jun 10 2019 Sergio Durigan Junior - 8.3.50.20190610-16 +- Rebase to FSF GDB 8.3.50.20190610 (8.4pre). + +* Sat Jun 1 2019 Sergio Durigan Junior - 8.3.50.20190601-15 +- Rebase to FSF GDB 8.3.50.20190601 (8.4pre). + +* Tue May 28 2019 Sergio Durigan Junior - 8.3.50.20190528-14 +- Rebase to FSF GDB 8.3.50.20190528 (8.4pre). + +* Fri May 17 2019 Sergio Durigan Junior - 8.3.50.20190517-13 +- Rebase to FSF GDB 8.3.50.20190517 (8.4pre). + +* Fri May 10 2019 Sergio Durigan Junior - 8.3.50.20190510-12 +- Rebase to FSF GDB 8.3.50.20190510 (8.4pre). + +* Wed May 1 2019 Sergio Durigan Junior - 8.3.50.20190501-11 +- Rebase to FSF GDB 8.3.50.20190501 (8.4pre). +- Adjust VLA testcases. +- Fix "gcore does not support COREFILTER_ELF_HEADERS" (RH BZ 1371380, + Sergio Durigan Junior). + +* Mon Apr 29 2019 Sergio Durigan Junior - 8.3.50.20190425-10 +- Share '/usr/bin/gdb-add-index' between gdb-minimal and gdb-headless + (Igor Gnatenko, RHBZ 1695015). + +* Mon Apr 29 2019 Sergio Durigan Junior - 8.3.50.20190425-9 +- Provide 'gdb-minimal' package, specific for the buildroot (RHBZ 1695015). +- Adjust 'gdb-libexec-add-index.patch' for the gdb-minimal case. + +* Thu Apr 25 2019 Sergio Durigan Junior - 8.3.50.20190425-8 +- Rebase to FSF GDB 8.3.50.20190425 (8.4pre), and fix build breakage. + +* Wed Apr 24 2019 Sergio Durigan Junior - 8.3.50.20190424-7 +- Rebase to FSF GDB 8.3.50.20190424 (8.4pre). + +* Fri Apr 12 2019 Sergio Durigan Junior - 8.3.50.20190412-6 +- Remove 'gdb-x86_64-i386-syscall-restart.patch'. + +* Fri Apr 12 2019 Sergio Durigan Junior - 8.3.50.20190412-5 +- Rebase to FSF GDB 8.3.50.20190412 (8.4pre). +- Adjust 'gdb-6.3-rh-testversion-20041202.patch'. +- Remove 'gdb-follow-child-stale-parent.patch'. +- Remove 'gdb-rhbz795424-bitpos-20of25.patch'. +- Remove 'gdb-rhbz795424-bitpos-21of25.patch'. +- Remove 'gdb-rhbz795424-bitpos-22of25.patch'. +- Remove 'gdb-rhbz795424-bitpos-23of25.patch'. +- Remove 'gdb-rhbz795424-bitpos-25of25.patch'. +- Remove 'gdb-rhbz795424-bitpos-25of25-test.patch'. +- Remove 'gdb-rhbz795424-bitpos-arrayview.patch'. +- Remove 'gdb-rhbz795424-bitpos-lazyvalue.patch'. +- Remove 'gdb-bz541866-rwatch-before-run.patch'. + +* Fri Mar 29 2019 Sergio Durigan Junior - 8.3.50.20190321-4 +- Fix 'gdb-8.3.50.20190321-3.fc31.x86_64: crashing' (by fixing + gdb-6.6-buildid-locate-rpm.patch) (RH BZ 1694091). + +* Thu Mar 21 2019 Sergio Durigan Junior - 8.3.50.20190321-3 +- Rebase to FSF GDB 8.3.50.20190321 (8.4pre). +- Remove gdb-temporary-fix-arm-build-error.patch. +- Fix "GDB crashes when using Python xmethods" (RH BZ 1690120). + +* Tue Mar 19 2019 Sergio Durigan Junior - 8.3.50.20190319-2 +- Rebase to FSF GDB 8.3.50.20190319 (8.4pre). +- Temporarily add gdb-temporary-fix-arm-build-error.patch. + +* Mon Mar 4 2019 Sergio Durigan Junior - 8.3.50.20190304-1 +- Rebase to FSF GDB 8.3.50.20190304 (8.4pre). +- Rewrite gdb-6.6-buildid-locate.patch. +- Remove gdb-python-gil.patch. + +* Fri Feb 22 2019 Sergio Durigan Junior - 8.2.50.20190222-19 +- Rebase to FSF GDB 8.2.50.20190222 (8.3pre). + +* Tue Feb 19 2019 Sergio Durigan Junior - 8.2.50.20190219-18 +- Rebase to FSF GDB 8.2.50.20190219 (8.3pre). +- BuildRequire on 'source-highlight-devel' and enable styled output. + +* Sun Feb 17 2019 Igor Gnatenko - 8.2.50.20190120-17 +- Disable temporarily guile support + +* Sun Feb 17 2019 Igor Gnatenko - 8.2.50.20190120-16 +- Rebuild for readline 8.0 + +* Tue Feb 5 2019 Sergio Durigan Junior - 8.2.50.20190120-15 +- Remove libmpx dependency when using '--with testsuite', since GCC9 + has dropped support for it. + +* Thu Jan 31 2019 Fedora Release Engineering +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Mon Jan 21 2019 Sergio Durigan Junior - 8.2.50.20190120-13.fc30 +- Rebase to FSF GDB 8.2.50.20190120 (8.3pre). +- Fix 'gdb does crash randomly on loading symbols or setting a breakpoint' + (RHBZ 1638798, Keith Seitz). + +* Thu Dec 20 2018 Sergio Durigan Junior - 8.2.50.20181220-12.fc30 +- Rebase to FSF GDB 8.2.50.20181220 (8.3pre). + +* Tue Dec 11 2018 Sergio Durigan Junior - 8.2.50.20181130-11.fc30 +- Update gdb-6.3-gstack-20050411.patch (Pedro Alves). +- Update gdb-archer-next-over-throw-cxx-exec.patch (Pedro Alves). +- Update gdb-glibc-strstr-workaround.patch (Pedro Alves). + +* Fri Nov 30 2018 Sergio Durigan Junior - 8.2.50.20181130-10.fc30 +- Rebase to FSF GDB 8.2.50.20181130 (8.3pre). + +* Tue Nov 20 2018 Sergio Durigan Junior - 8.2.50.20181114-9.fc30 +- Declare _python_bytecompile_extra. +- Fix typo on gdb-x86_64-i386-syscall-restart.patch. + +* Wed Nov 14 2018 Sergio Durigan Junior - 8.2.50.20181114-8.fc30 +- Rebase to FSF GDB 8.2.50.20181114 (8.3pre). +- Drop gdb-6.3-ppc64syscall-20040622.patch. +- Drop gdb-6.3-ppc64displaysymbol-20041124.patch. +- Drop gdb-6.8-watchpoint-conditionals-test.patch. + +* Thu Oct 18 2018 Sergio Durigan Junior - 8.2.50.20181016-7.fc30 +- Use "--enable-unit-tests" flag when compiling GDB. + +* Tue Oct 16 2018 Sergio Durigan Junior - 8.2.50.20181016-6.fc30 +- Rebase to FSF GDB 8.2.50.20181016 (8.3pre). +- Enable and always run the unittests when building the package. + +* Wed Oct 10 2018 Sergio Durigan Junior - 8.2.50.20181010-5.fc30 +- Rebase to FSF GDB 8.2.50.20181010 (8.3pre). +- Remove 'gdb-6.8-sparc64-silence-memcpy-check.patch'. +- Remove 'gdb-7.2.50-sparc-add-workaround-to-broken-debug-files.patch'. + +* Sat Oct 6 2018 Sergio Durigan Junior - 8.2.50.20181006-4.fc30 +- Rebase to FSF GDB 8.2.50.20181006 (8.3pre). + +* Thu Oct 4 2018 Jan Kratochvil - 8.2.50.20180917-3.fc30 +- Fix annobin complaints (RH BZ 1630564): + --without-stage1-ldflags: Disable static libstdc++ and libgcc linking. + --disable-libmcheck: That is a distro-level decision, not package decision. + +* Wed Sep 19 2018 Sergio Durigan Junior - 8.2.50.20180917-2.fc30 +- Remove 'gdb-6.5-bz203661-emit-relocs.patch'. +- Update changelog entry for last release. + +* Mon Sep 17 2018 Sergio Durigan Junior - 8.2.50.20180917-1.fc30 +- Rebase to FSF GDB 8.2.50.20180917 (8.3pre). +- Add 'gdb-rhbz795424-bitpos-arrayview.patch'. +- Remove 'gdb-rhbz881849-ipv6-1of3.patch'. +- Remove 'gdb-rhbz881849-ipv6-2of3.patch'. +- Remove 'gdb-rhbz881849-ipv6-3of3.patch'. +- Remove 'gdb-rhbz1187581-power8-regs-1of7.patch'. +- Remove 'gdb-rhbz1187581-power8-regs-2of7.patch'. +- Remove 'gdb-rhbz1187581-power8-regs-3of7.patch'. +- Remove 'gdb-rhbz1187581-power8-regs-4of7.patch'. +- Remove 'gdb-rhbz1187581-power8-regs-5of7.patch'. +- Remove 'gdb-rhbz1187581-power8-regs-6of7.patch'. +- Remove 'gdb-rhbz1187581-power8-regs-7of7.patch'. + +* Tue Aug 21 2018 Sergio Durigan Junior - 8.1.90.20180727-45.fc30 +- Enable verbose output when running "make". + +* Thu Aug 9 2018 Jan Kratochvil - 8.1.90.20180727-44.fc29 +- Add GDB support to access/display POWER8 registers (IBM, RH BZ 1187581). + +* Thu Aug 9 2018 Sergio Durigan Junior - 8.1.90.20180727-43.fc29 +- Reenable libipt. + +* Wed Aug 8 2018 Sergio Durigan Junior - 8.1.90.20180727-42.fc29 +- Again, temporarily disable libipt (needed to upgrade libipt to 2.0). + +* Wed Aug 8 2018 Sergio Durigan Junior - 8.1.90.20180727-41.fc29 +- Reenable libipt. +- Rebuild due to new libipt release. +- Adjust bundled libipt; remove unnecessary patch. +- Sync IPv6 patch with F-28 GDB. + +* Wed Aug 8 2018 Sergio Durigan Junior - 8.1.90.20180727-40.fc29 +- Temporarily disable libipt (needed to upgrade libipt to 2.0). + +* Wed Aug 8 2018 Jan Kratochvil - 8.1.90.20180727-39.fc29 +- [dts] Fix build by removing a patch for already removed pahole.py . +- [dts rhel6] Fix build by updating gdb-gnat-dwarf-crash-3of3.patch . + +* Mon Jul 30 2018 Sergio Durigan Junior - 8.1.90.20180727-38.fc29 +- Recompile to fix RH BZ 1609504 (due to RH BZ 1609577). + +* Sat Jul 28 2018 Sergio Durigan Junior - 8.1.90.20180727-37.fc29 +- Rebase to FSF GDB 8.1.90.20180727 (8.2pre). + +* Wed Jul 25 2018 Sergio Durigan Junior - 8.1.90.20180724-36.fc29 +- Rebase to FSF GDB 8.1.90.20180724 (8.2pre). + +* Sat Jul 14 2018 Sergio Durigan Junior - 8.1.90.20180714-35.fc29 +- Rebase to FSF GDB 8.1.90.20180714 (8.2pre). +- Backport IPv6 patch (RH BZ 881849, Sergio Durigan Junior). + +* Fri Jul 13 2018 Fedora Release Engineering +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + +* Thu Jul 12 2018 Jan Kratochvil - 8.1.90.20180708-33.fc29 +- [dts] [rhel6] Do not use mpfr as rhel6 has mpfr-2 while GDB requires mpfr-3. + +* Thu Jul 12 2018 Jan Kratochvil - 8.1.90.20180708-32.fc29 +- Remove as no longer needed: + Workaround gcc-8.0: -Wno-error=cast-function-type,stringop-truncation + +* Thu Jul 12 2018 Jan Kratochvil - 8.1.90.20180708-31.fc29 +- [dts] Upgrade libstdc++-v3-python to 8.1.1-20180626. + +* Thu Jul 12 2018 Sergio Durigan Junior - 8.1.90.20180708-30.fc29 +- Rebuild due to GCC ABI change. + +* Sun Jul 8 2018 Sergio Durigan Junior - 8.1.90.20180708-29.fc29 +- Rebase to FSF GDB 8.1.90.20180708 (8.2pre). + +* Wed Jul 4 2018 Sergio Durigan Junior - 8.1.50.20180704-28.fc29 +- Rebase to FSF GDB 8.1.50.20180704 (8.2pre). +- Remove defattr directives from specfile. + +* Mon Jul 02 2018 Miro Hrončok +- Rebuilt for Python 3.7 + +* Fri Jun 29 2018 Sergio Durigan Junior - 8.1.50.20180629-26.fc29 +- Rebase to FSF GDB 8.1.50.20180629 (8.2pre). +- Remove pahole.py. +- Adjust handling of gdb-gdb.py. + +* Sun Jun 24 2018 Sergio Durigan Junior - 8.1.50.20180624-25.fc29 +- Rebase to FSF GDB 8.1.50.20180624 (8.2pre). + +* Wed Jun 20 2018 Sergio Durigan Junior - 8.1.50.20180618-24.fc29 +- Add BuildRequires: mpfr-devel (RH BZ 1593280). + +* Mon Jun 18 2018 Sergio Durigan Junior - 8.1.50.20180618-23.fc29 +- Rebase to FSF GDB 8.1.50.20180618 (8.2pre). + +* Mon Jun 18 2018 Sergio Durigan Junior - 8.1.50.20180613-22.fc29 +- Do not run /sbin/install-info when installing the documentation + (except for DTS). + +* Wed Jun 13 2018 Sergio Durigan Junior - 8.1.50.20180613-21.fc29 +- Rebase to FSF GDB 8.1.50.20180613 (8.2pre). + +* Wed Jun 13 2018 Miro Hrončok +- Rebuilt for Python 3.7 + +* Wed Jun 13 2018 Miro Hrončok +- Bootstrap for Python 3.7 + +* Fri Jun 8 2018 Sergio Durigan Junior - 8.1.50.20180605-18.fc29 +- Fix Python 3.7 breakage (RH BZ 1577396). + +* Tue Jun 5 2018 Sergio Durigan Junior - 8.1.50.20180605-17.fc29 +- Rebase to FSF GDB 8.1.50.20180605 (8.2pre). + +* Sat Jun 2 2018 Sergio Durigan Junior - 8.1.50.20180522-16.fc29 +- Rebase to FSF GDB 8.1.50.20180529 (8.2pre). + +* Wed May 30 2018 Sergio Durigan Junior - 8.1.50.20180522-15.fc28 +- Rebase to FSF GDB 8.1.50.20180522 (8.2pre). + +* Mon Apr 2 2018 Jan Kratochvil - 8.1-14.fc28 +- Revert 'Fix PDF build on Rawhide/F-29', rm -rf texinfo/ (from RH BZ 1562580). + +* Sat Mar 31 2018 Jan Kratochvil - 8.1-13.fc28 +- Fix PDF build on Rawhide/F-29. + +* Fri Mar 23 2018 Jan Kratochvil - 8.1-12.fc28 +- Add test: [s390x] Backport arch12 instructions decoding (RH BZ 1553104). + +* Sat Mar 3 2018 Jan Kratochvil - 8.1-11.fc28 +- Add: BuildRequires: gcc-c++ + https://fedoraproject.org/wiki/Packaging:C_and_C%2B%2B#BuildRequires_and_Requires + +* Tue Feb 20 2018 Rex Dieter - 8.1-10.fc28 +- rebuild (guile) + +* Sat Feb 17 2018 Jan Kratochvil - 8.1-9.fc28 +- [testsuite] Revert disable of BuildRequires: gcc-go (for RH BZ 1541639). + +* Fri Feb 09 2018 Igor Gnatenko - 8.1-8.fc28 +- Escape macros in %%changelog + +* Wed Feb 07 2018 Fedora Release Engineering - 8.1-7.fc28 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Tue Feb 6 2018 Jan Kratochvil - 8.1-6.fc28 +- Fix .spec build compatibility with <=F-27 and <=RHEL-7. +- [testsuite] Temporarily disable BuildRequires: gcc-go (for RH BZ 1541639). + +* Sun Feb 4 2018 Jan Kratochvil - 8.1-5.fc28 +- Workaround gcc-8.0: -Wno-error=cast-function-type,stringop-truncation +- Fix ppc64 stwux encoding as found by gcc-8.0 -Werror=tautological-compare. + +* Sun Feb 4 2018 Jan Kratochvil - 8.1-4.fc28 +- Fix -D_GLIBCXX_DEBUG gdb-add-index regression (RH BZ 1540559). + +* Wed Jan 31 2018 Sergio Durigan Junior - 8.1-3.fc26 +- Rebase to FSF GDB 8.1. + +* Fri Jan 19 2018 Sergio Durigan Junior - 8.0.90.20180109-2.fc26 +- Remove gdb-6.3-rh-dummykfail-20041202.patch (RH BZ 1535228). +- Remove gdb-glibc-vdso-workaround.patch (RH BZ 1535244). + +* Wed Jan 10 2018 Sergio Durigan Junior - 8.0.90.20180109-1.fc26 +- Rebase to pre-FSF GDB 8.1 (8.1.90.20180109). + +* Sat Dec 16 2017 Sergio Durigan Junior - 8.0.50.20171204-35.fc26 +- Rebase to FSF GDB 8.0.50.20171213 (8.1pre). + +* Sun Dec 10 2017 Sergio Durigan Junior - 8.0.50.20171204-34.fc26 +- chmod +x on the generate-*.sh script.s +- Remove references to gdb-8.0.1 from 'sources' and '.gitignore'. +- Regenerate first line of the patches (remove commit hash). +- Fix empty Source line. + +* Thu Dec 7 2017 Sergio Durigan Junior - 8.0.50.20171204-33.fc26 +- Rebase to FSF GDB 8.0.50.20171204 (8.1pre). +- Implemented new method for dealing with local patches. + +* Mon Dec 4 2017 Sergio Durigan Junior - 8.0.1-32.fc26 +- Convert all the patches to 'git-am' format. + +* Sat Dec 2 2017 Jan Kratochvil - 8.0.1-31.fc26 +- [testsuite] Fix BuildRequires for non-x86* arches. + +* Fri Oct 27 2017 Jan Kratochvil - 8.0.1-30.fc26 +- Use inlined func name for printing breakpoints (RH BZ 1228556, Keith Seitz). + +* Sat Oct 7 2017 Jan Kratochvil - 8.0.1-29.fc26 +- [s390x] Backport arch14 guarded-storage register support (RH BZ 1498758). + +* Thu Sep 28 2017 Jan Kratochvil - 8.0.1-28.fc26 +- Performance fix of gcore to use --readnever (for RH BZ 1493675). + +* Tue Sep 26 2017 Troy Dawson - 8.0.1-27.fc26 +- Cleanup spec file conditionals + +* Tue Sep 12 2017 Jan Kratochvil - 8.0.1-26.fc26 +- Rebase to FSF GDB 8.0.1 (8.0 stable branch). + +* Wed Aug 30 2017 Jan Kratochvil - 8.0-25.fc26 +- [rhel6] Fix T-stopping of processes after their detachment (RH BZ 1486223). + +* Thu Aug 24 2017 Jan Kratochvil - 8.0-24.fc26 +- Backport DWARF-5 and breakpoint fixes from upstream stable branch 8.0. + +* Sat Aug 19 2017 Jan Kratochvil - 8.0-23.fc26 +- [s390x] Backport arch12 support and other s390x fixes (RH BZ 1420304). + +* Fri Aug 18 2017 Jan Kratochvil - 8.0-22.fc26 +- Backport a fix for clang && -gsplit-dwarf debuggees (RH BZ 1482892). + +* Sun Aug 13 2017 Jan Kratochvil - 8.0-21.fc26 +- Fix compatibility with F-27 debuginfo packaging. +- Fix compatibility with F-27 librpm version 8. + +* Thu Aug 3 2017 Jan Kratochvil - 8.0-20.fc26 +- Two fixes from upstream stable branch 8.0. + +* Wed Aug 2 2017 Fedora Release Engineering - 8.0-19.fc26 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild + +* Wed Jul 26 2017 Fedora Release Engineering - 8.0-18.fc26 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Mon Jun 12 2017 Jan Kratochvil - 8.0-17.fc26 +- [rhel6 dts] Use devtoolset gcc for GDB being now in C++11. + +* Sat Jun 10 2017 Jan Kratochvil - 8.0-16.fc26 +- [dts] Upgrade libstdc++-v3-python to 7.1.1-20170526. + +* Fri Jun 9 2017 Jan Kratochvil - 8.0-15.fc26 +- [rhel dts libipt] Fix#2 [-Werror=implicit-fallthrough=] with gcc-7.1.1. + +* Fri Jun 9 2017 Jan Kratochvil - 8.0-14.fc26 +- [rhel dts libipt] Fix [-Werror=implicit-fallthrough=] with gcc-7.1.1. + +* Fri Jun 9 2017 Jan Kratochvil - 8.0-13.fc26 +- Rebase to FSF GDB 8.0 final. +- [rhel7 dts] Rebase bundled libipt to 1.6.1. + +* Sat May 20 2017 Jan Kratochvil - 7.99.90.20170420-12.fc26 +- Move 'dnf-command(debuginfo-install)' gdb-headless -> gdb (RH BZ 1452335). + +* Mon May 15 2017 Fedora Release Engineering - 7.99.90.20170420-11.fc26 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_27_Mass_Rebuild + +* Mon May 8 2017 Jan Kratochvil - 7.99.90.20170420-10.fc26 +- [.spec] Update patches categorization. + +* Fri Apr 21 2017 Jan Kratochvil - 7.99.90.20170420-9.fc26 +- [ppc*] Fix gdb.arch/powerpc-power7.exp testcase regression (RH BZ 1440044). + +* Fri Apr 21 2017 Jan Kratochvil - 7.99.90.20170420-8.fc26 +- Rebase to FSF GDB 7.99.90.20170420 (pre-8.0 stable branch). + +* Wed Apr 19 2017 Jan Kratochvil - 7.12.50.20170309-7.fc26 +- Fix reported gdb-vla-intel-stringbt-fix.patch regression (SuSE). +- Remove gcc-7 compilation compatibility hack. + +* Fri Mar 10 2017 Jan Kratochvil - 7.12.50.20170309-6.fc26 +- [testsuite] [ppc*,s390*] Do not FAIL rhbz1261564-aarch64-watchpoint.exp + (RH BZ 1352563). + +* Thu Mar 9 2017 Jan Kratochvil - 7.12.50.20170309-5.fc26 +- Rebase to pre-7.13 FSF GDB trunk. + +* Thu Mar 2 2017 Jan Kratochvil - 7.12.50.20170226-4.fc26 +- Fix gdb-vla-intel-fortran-strides.patch rebase regression. + +* Tue Feb 28 2017 Jan Kratochvil - 7.12.50.20170226-3.fc26 +- Fix gdb.arch/amd64-entry-value-paramref.exp rebase regression. + +* Tue Feb 28 2017 Jan Kratochvil - 7.12.50.20170226-2.fc26 +- [testsuite] [rhel] Fix py-gil-mthread.exp for Python 2 compat (RH BZ 1427487). + +* Mon Feb 27 2017 Jan Kratochvil - 7.12.50.20170226-1.fc26 +- Rebase to pre-7.13 FSF GDB trunk. +- Dropped gdb-6.7-bz426600-DW_TAG_interface_type-test.patch as GCJ is no more. + +* Fri Feb 24 2017 Jan Kratochvil - 7.12.1-47.fc26 +- New testcase for: Fix -completion crash (Gary Benson, RH BZ 1398387). +- [testsuite] Use more standard_output_file. + +* Wed Feb 15 2017 Jan Kratochvil - 7.12.1-46.fc26 +- Fix -completion crash (Gary Benson, RH BZ 1398387). + +* Tue Feb 14 2017 Jan Kratochvil - 7.12.1-45.fc26 +- Release bump. + +* Sun Feb 12 2017 Jan Kratochvil - 7.12.1-44.fc26 +- [dts] Upgrade libstdc++-v3-python to 6.3.1-20170212. + +* Wed Feb 8 2017 Jan Kratochvil - 7.12.1-43.fc26 +- Fix build compatibility with gcc-7. + +* Wed Feb 8 2017 Stephen Gallagher - 7.12.1-42.fc26 +- Add missing %%license macro + +* Sat Jan 21 2017 Jan Kratochvil - 7.12.1-41.fc26 +- Rebase to released FSF GDB 7.12.1. + +* Tue Jan 17 2017 Jan Kratochvil - 7.12-40.fc26 +- Enable libinproctrace.so on all archs except arm32. + +* Thu Jan 12 2017 Jan Kratochvil - 7.12-39.fc26 +- Fix gdb-readline62-ask-more-rh.patch for Rawhide readline-7.0. + +* Thu Jan 12 2017 Igor Gnatenko - 7.12-38.fc26 +- Rebuild for readline 7.x + +* Thu Jan 12 2017 Jan Kratochvil - 7.12-37.fc25 +- [rhel6] Fix missing /usr/bin/realpath. + +* Wed Jan 11 2017 Jan Kratochvil - 7.12-36.fc25 +- Update from FSF GDB 7.12 stable branch to snapshot: gdb-7.12.0.20170111 + +* Sun Jan 8 2017 Jan Kratochvil - 7.12-35.fc25 +- Fix Python backtraces for 32-bit inferiors (Tom Tromey, RH BZ 1411094). + +* Fri Jan 6 2017 Jan Kratochvil - 7.12-34.fc25 +- Fix gdb-add-index for 444 *.debug files. + +* Mon Jan 02 2017 Rex Dieter - 7.12-33.fc25 +- fix logic of prior Conflicts + +* Mon Jan 02 2017 Rex Dieter - 7.12-32.fc25 +- Conflicts: gdb-headless < 7.12-29 (#1402554) + +* Fri Dec 09 2016 Charalampos Stratakis - 7.12-31.fc25 +- Python 3.6 rebuild: Rebuild with python3 support. + +* Fri Dec 09 2016 Charalampos Stratakis - 7.12-30.fc25 +- Python 3.6 rebuild: Rebuild without python3 support. + +* Mon Oct 31 2016 Jan Kratochvil - 7.12-29.fc25 +- Fix gdb-headless /usr/bin/ executables (BZ 1390251). + +* Mon Oct 24 2016 Jan Kratochvil - 7.12-28.fc25 +- Fix testcase: gdb.base/gdb-rhbz1156192-recursive-dlopen.exp + +* Sun Oct 23 2016 Jan Kratochvil - 7.12-27.fc25 +- More work on missing testcases present in rhel6 GDB; some still FAIL. + +* Thu Oct 20 2016 Jan Kratochvil - 7.12-26.fc25 +- Add missing testcases present in rhel6 GDB; some still FAIL. + +* Fri Oct 14 2016 Jan Kratochvil - 7.12-25.fc25 +- [rhel6] Fix .spec without devtoolset-6-build installed (RH BZ 1384947). + +* Wed Oct 12 2016 Jan Kratochvil - 7.12-24.fc25 +- Fix TLS (such as 'errno') regression. + +* Wed Oct 12 2016 Jan Kratochvil - 7.12-23.fc25 +- [testsuite] Various testsuite fixes. +- [aarch64] Fix gdb.cp/nextoverthrow.exp regression (Yao Qi). + +* Fri Oct 7 2016 Jan Kratochvil - 7.12-22.fc25 +- Fix .spec build: error: Macro %%buildisa has empty body + +* Fri Oct 7 2016 Jan Kratochvil - 7.12-21.fc25 +- Rebase to FSF GDB 7.12. + +* Thu Oct 6 2016 Jan Kratochvil - 7.12-0.20.20161006.fc25 +- Rebase to FSF GDB 7.11.90.20161006 (pre-7.12 branch snapshot). + +* Thu Sep 29 2016 Jan Kratochvil - 7.12-0.19.20160929.fc25 +- Rebase to FSF GDB 7.11.90.20160929 (pre-7.12 branch snapshot). + - Fixes GDB crashes on inf. function call scripts (RH BZ 1378147, Pedro Alves). + +* Wed Sep 28 2016 Jan Kratochvil - 7.12-0.18.20160928.fc25 +- Fix attachment of JIT-debug-enabled inf. (7.11.1 regression, RH BZ 1375553). +- Rebase to FSF GDB 7.11.90.20160928 (pre-7.12 branch snapshot). + +* Wed Sep 14 2016 Jan Kratochvil - 7.12-0.17.20160907.fc25 +- Fix description empty lines. + +* Wed Sep 14 2016 Jan Kratochvil - 7.12-0.16.20160907.fc25 +- Provide gdb-headless package (RH BZ 1195005). + +* Mon Sep 12 2016 Jan Kratochvil - 7.12-0.15.20160907.fc25 +- [testsuite] More testsuite fixes. + +* Mon Sep 12 2016 Jan Kratochvil - 7.12-0.14.20160907.fc25 +- Various mostly testsuite compatibility and regression fixes. + +* Wed Sep 7 2016 Jan Kratochvil - 7.12-0.13.20160907.fc25 +- Rebase to FSF GDB 7.11.90.20160907 (pre-7.12 branch snapshot). +- Rebase Intel VLA patchset. + +* Wed Sep 7 2016 Jan Kratochvil - 7.12-0.12.20160904.fc25 +- [rhel6+7] Fix compatibility of bison <3.1 and gcc >=6. + +* Sun Sep 4 2016 Jan Kratochvil - 7.12-0.11.20160904.fc25 +- Release bump for a mistaken build. + +* Sun Sep 4 2016 Jan Kratochvil - 7.12-0.10.20160904.fc25 +- Fix libipt bundling in 7.12. + +* Sun Sep 4 2016 Jan Kratochvil - 7.12-0.9.20160904.fc25 +- Rebase to FSF GDB 7.11.90.20160904 (pre-7.12 branch snapshot). +- Make Version tag 7.12; but it is still a pre-release. + +* Mon Aug 29 2016 Jan Kratochvil - 7.11.90.20160829-8.fc25 +- Rebase to FSF GDB 7.11.90.20160829 (pre-7.12 branch snapshot). + +* Fri Aug 26 2016 Jan Kratochvil - 7.11.90.20160807-7.fc25 +- Fix Intel VLA patchset regression: dynamic.exp: p varw filled + +* Tue Aug 23 2016 Jan Kratochvil - 7.11.90.20160807-6.fc25 +- Merge Fedora packaging changes from Fedora 24 gdb-7.11.1-83.fc24: + +* Tue Aug 23 2016 Jan Kratochvil - 7.11.1-83.fc24 +- [dts+el7] [x86*] Bundle libipt - fix#3 its initialization (RH BZ 1256513). + +* Tue Aug 23 2016 Jan Kratochvil - 7.11.1-82.fc24 +- [dts+el7] [x86*] Bundle libipt - fix#2 its initialization (RH BZ 1256513). + +* Tue Aug 23 2016 Jan Kratochvil - 7.11.1-81.fc24 +- [dts+el7] [x86*] Bundle libipt - fix its initialization (RH BZ 1256513). + +* Mon Aug 22 2016 Jan Kratochvil - 7.11.1-80.fc24 +- [dts] Upgrade libstdc++-v3-python to 6.1.1-20160817. + +* Fri Aug 19 2016 Jan Kratochvil - 7.11.1-79.fc24 +- [dts+el7] [x86*] Bundle linux_perf.h for libipt (RH BZ 1256513). + +* Wed Aug 17 2016 Jan Kratochvil - 7.11.1-78.fc24 +- [dts+el7] [x86*] Bundle libipt (RH BZ 1256513). + +* Sun Aug 7 2016 Jan Kratochvil - 7.11.90.20160807-5.fc25 +- Rebase to FSF GDB 7.11.90.20160807 (pre-7.12 branch snapshot). + +* Sun Jul 31 2016 Jan Kratochvil - 7.11.50.20160721-4.fc25 +- Testcase for: Load strictly build-id-checked core files only if no executable + is specified (Jan Kratochvil, RH BZ 1339862). + +* Thu Jul 28 2016 Jan Kratochvil - 7.11.50.20160721-3.fc25 +- Do not apply RHEL-6 patches on non-RHEL-6 even for testsuite. + +* Thu Jul 21 2016 Jan Kratochvil - 7.11.50.20160721-2.fc25 +- Rebase to FSF GDB 7.11.50.20160721 (pre-7.12 trunk snapshot). + +* Sun Jul 17 2016 Jan Kratochvil - 7.11.50.20160716-1.fc25 +- Rebase to FSF GDB 7.11.50.20160716 (pre-7.12 trunk snapshot). + +* Mon Jun 27 2016 Jan Kratochvil - 7.11.1-76.fc24 +- Test 'info type-printers' Python error (RH BZ 1350436). + +* Mon Jun 6 2016 Jan Kratochvil - 7.11.1-75.fc24 +- Rebase to released FSF GDB 7.11.1. + +* Mon May 30 2016 Jan Kratochvil - 7.11-74.fc24 +- Import bare DW_TAG_lexical_block (RH BZ 1325396). + +* Tue May 3 2016 Jan Kratochvil - 7.11-73.fc24 +- Fix compilation error by upstream symfile.c fix. + +* Tue May 3 2016 Jan Kratochvil - 7.11-72.fc24 +- Fix messages suggesting more recent RHEL gdbserver (RH BZ 1321114). + +* Wed Apr 27 2016 Jan Kratochvil - 7.11-71.fc24 +- Import upstream 7.11 branch stable fixes. + +* Sat Apr 23 2016 Jan Kratochvil - 7.11-70.fc24 +- New test for Python "Cannot locate object file for block" (for RH BZ 1325795). + +* Tue Apr 12 2016 Jan Kratochvil - 7.11-69.fc24 +- Never kill PID on: gdb exec PID (Jan Kratochvil, RH BZ 1219747). + +* Fri Apr 8 2016 Jan Kratochvil - 7.11-68.fc24 +- [--with testsuite] Add two more BuildRequires. + +* Fri Apr 8 2016 Jan Kratochvil - 7.11-67.fc24 +- [testsuite] Fix several false FAILs. + +* Wed Apr 6 2016 Jan Kratochvil - 7.11-66.fc24 +- Import upstream 7.11 branch stable fixes. + +* Wed Apr 6 2016 Jan Kratochvil - 7.11-65.fc24 +- Add messages suggesting more recent RHEL gdbserver (RH BZ 1321114). + +* Wed Apr 6 2016 Jan Kratochvil - 7.11-64.fc24 +- Fix non-stop gdb -p : internal error (Pedro Alves, RH BZ 1318049). + +* Sat Mar 19 2016 Jan Kratochvil - 7.11-63.fc24 +- .spec cleanup: Drop strict-aliasing GCC bug workaround (from RH BZ 1315191). + +* Fri Mar 18 2016 Jan Kratochvil - 7.11-62.fc24 +- .spec cleanup: Drop SCL obsoletes of devtoolset-1.1*: *-1.0* + +* Thu Mar 17 2016 Jan Kratochvil - 7.11-61.fc24 +- Add message suggesting gdbserver for non-matching PID namespaces. + +* Tue Mar 15 2016 Jan Kratochvil - 7.11-60.fc24 +- New Fedora GDB testfile: rhbz1261564-aarch64-watchpoint.exp +- Backport gdb-7.11 stable branch PR gdb/19676 fix (Pedro Alves). + +* Tue Mar 8 2016 Jan Kratochvil - 7.11-59.fc24 +- Fix strict-aliasing rules compilation error (RH BZ 1315191). + +* Fri Feb 26 2016 Jan Kratochvil - 7.11-58.fc24 +- Rebase VLA (Fortran dynamic arrays) strides (multi-dim. subarrays) from Intel. + +* Thu Feb 25 2016 Jan Kratochvil - 7.11-57.fc24 +- Release bump only. + +* Wed Feb 24 2016 Jan Kratochvil - 7.11-56.fc24 +- Release bump only. + +* Wed Feb 24 2016 Jan Kratochvil - 7.11-55.fc24 +- Rebase to released FSF GDB 7.11. + +* Tue Feb 16 2016 Jan Kratochvil - 7.10.90.20160216-54.fc24 +- Rebase to FSF GDB 7.10.90.20160216 (pre-7.11 branch snapshot). + +* Tue Feb 16 2016 Jan Kratochvil - 7.10.90.20160211-53.fc24 +- Drop gdb-testsuite-subdirs-revert.patch. + +* Sat Feb 13 2016 Jan Kratochvil - 7.10.90.20160211-52.fc24 +- Rebase to FSF GDB 7.10.90.20160211 (pre-7.11 branch snapshot). + +* Wed Feb 03 2016 Fedora Release Engineering - 7.10.50.20160131-51.fc24 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + +* Sun Jan 31 2016 Jan Kratochvil - 7.10.50.20160131-50.fc24 +- Rebase to FSF GDB 7.10.50.20160131 (trunk snapshot). + +* Sun Jan 31 2016 Jan Kratochvil - 7.10.50.20160121-49.fc24 +- Fix another false gcc6 compilation warning (Mark Wielaard). + +* Sun Jan 31 2016 Jan Kratochvil - 7.10.50.20160121-48.fc24 +- Fix false gcc6 compilation warning for: bfd/elf64-s390.c + +* Sun Jan 31 2016 Jan Kratochvil - 7.10.50.20160121-47.fc24 +- [testsuite] Fix false selftest.exp FAIL from system readline-6.3+ (Patrick Palka). + +* Fri Jan 22 2016 Jan Kratochvil - 7.10.50.20160121-46.fc24 +- Fix gdb.gdb/selftest.exp false FAIL. + +* Fri Jan 22 2016 Jan Kratochvil - 7.10.50.20160121-45.fc24 +- Rebase to FSF GDB 7.10.50.20160121 (trunk snapshot). + +* Wed Jan 20 2016 Jan Kratochvil - 7.10.50.20160106-44.fc24 +- Suppress librpm non-absolute filename warnings for /^remote:/ filenames. + +* Sat Jan 16 2016 Jan Kratochvil - 7.10.50.20160106-43.fc24 +- Test clflushopt instruction decode (for RH BZ 1262471). + +* Sat Jan 9 2016 Jan Kratochvil - 7.10.50.20160106-42.fc24 +- Simplify .spec: Remove conditional revert of: gdb-pahole-python2.patch + +* Sat Jan 9 2016 Jan Kratochvil - 7.10.50.20160106-41.fc24 +- Simplify .spec: Remove conditional revert of: gdb-6.8-attach-signalled-detach-stopped.patch +- Simplify .spec: Remove conditional revert of: gdb-6.8-quit-never-aborts.patch + +* Sat Jan 9 2016 Jan Kratochvil - 7.10.50.20160106-40.fc24 +- Merge gdb-rhel5-compat.patch into: gdb-6.8-attach-signalled-detach-stopped.patch + +* Sat Jan 9 2016 Jan Kratochvil - 7.10.50.20160106-39.fc24 +- Simplify .spec: Remove conditional revert of: gdb-readline62-ask-more-rh.patch + +* Sat Jan 9 2016 Jan Kratochvil - 7.10.50.20160106-38.fc24 +- Simplify .spec: Remove conditional revert of: gdb-6.6-buildid-locate-rpm-scl.patch + +* Sat Jan 9 2016 Jan Kratochvil - 7.10.50.20160106-37.fc24 +- Simplify .spec: Remove conditional revert of: gdb-dts-rhel6-python-compat.patch + +* Sat Jan 9 2016 Jan Kratochvil - 7.10.50.20160106-36.fc24 +- VLA (Fortran dynamic arrays) strides (multi-dimensional subarrays) from Intel. + +* Fri Jan 8 2016 Jan Kratochvil - 7.10.50.20160106-35.fc24 +- Fix false FAILs on too long base directory. + +* Fri Jan 8 2016 Jan Kratochvil - 7.10.50.20160106-34.fc24 +- Rebase to FSF GDB 7.10.50.20160106 (trunk snapshot). + +* Sat Nov 14 2015 Jan Kratochvil - 7.10.50.20151113-33.fc24 +- Rebase to FSF GDB 7.10.50.20151113 (trunk snapshot). +- [testsuite] BuildRequire libmpx for --with testsuite. +- Force libncursesw over libncurses to match the includes (RH BZ 1270534). + +* Thu Nov 12 2015 Fedora Release Engineering - 7.10.50.20151027-32.fc24 +- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5 + +* Sun Nov 8 2015 Jan Kratochvil - 7.10.50.20151027-31.fc24 +- [aarch64] Fix build regression (RH BZ 1278902, bugreport by Peter Robinson). + +* Tue Nov 3 2015 Jan Kratochvil - 7.10.50.20151027-30.fc24 +- Rebase to FSF GDB 7.10.50.20151027 (trunk snapshot). + +* Mon Oct 12 2015 Jan Kratochvil - 7.10-29.fc23 +- Fix internal error on DW_OP_bregx(-1) (RH BZ 1270564). + +* Mon Sep 28 2015 Jan Kratochvil - 7.10-28.fc23 +- Add --with buildisa, remove %%{?_isa} from BuildRequires by default: + https://github.com/msimacek/koschei/issues/54 + +* Thu Sep 24 2015 Jan Kratochvil - 7.10-27.fc23 +- [rhel6,rhel7] Keep pahole.py and make it Python2 compatible. + +* Wed Sep 23 2015 Jan Kratochvil - 7.10-26.fc23 +- [rhel7] Provide libstdc++-v3-python with C++11 even on RHEL-7 (RH BZ 1239290). +- Do not provide libstdc++-v3-python lib64 files on 32-bit archs. +- [rhel6,rhel7] Delete pahole.py on Python2 systems. + +* Wed Sep 23 2015 Robert Kuska - 7.10-25.fc23 +- Python3.5 Rebuild: Rebuild wit python3 support + +* Wed Sep 23 2015 Robert Kuska - 7.10-24.fc23 +- Python3.5 Rebuild: Rebuild without python3 support + +* Fri Sep 18 2015 Jan Kratochvil - 7.10-23.fc23 +- Fix the pahole command breakage due to its Python3 port (RH BZ 1264532). + +* Sun Sep 13 2015 Jan Kratochvil - 7.10-22.fc23 +- Fix gstack to use gdb from $PATH (bugreport by Frank Hirtz, RH BZ 1262589). + +* Fri Sep 11 2015 Jan Kratochvil - 7.10-21.fc23 +- [testsuite] Fix gcc-gdb-plugin and gcc-go BuildRequires for --with testsuite. + +* Thu Sep 10 2015 Jan Kratochvil - 7.10-20.fc23 +- [ppc64le] Use skip_entrypoint for skip_trampoline_code (RH BZ 1260558). + +* Thu Sep 10 2015 Jan Kratochvil - 7.10-19.fc23 +- Add changelog entry and fix librpm dependency broken by Peter Robinson. + +* Thu Sep 3 2015 Jan Kratochvil - 7.10-18.fc23 +- Enable libipt (Intel Processor Trace Decoder Library). + +* Wed Sep 2 2015 Sergio Durigan Junior - 7.10-17.fc23 +- Fix 'Make the probes-based dynamic linker interface more robust to + errors' (Sergio Durigan Junior, RH BZ 1259132). + +* Tue Sep 1 2015 Jan Kratochvil - 7.10-16.fc23 +- [RHEL] Fix librpm Recommends compatibility. + +* Sat Aug 29 2015 Jan Kratochvil - 7.10-15.fc23 +- Rebase to FSF GDB 7.10 final. + +* Sat Aug 22 2015 Jan Kratochvil - 7.10-14.fc23 +- Re-enable --with testsuite BuildRequires: prelink for RHELs. + +* Sat Aug 22 2015 Jan Kratochvil - 7.10-13.fc23 +- Rebase to FSF GDB 7.9.90.20150822 (7.10 branch snapshot). +- Remove --with testsuite BuildRequires: prelink (prelink is orphaned in F-23+). + +* Thu Aug 6 2015 Sergio Durigan Junior - 7.9.90.20150717-12.fc23 +- Add "Recommends: default-yama-scope" (for RH BZ 1209492). + +* Thu Aug 6 2015 Jan Kratochvil - 7.9.90.20150717-11.fc23 +- Fix librpm version for f23. + +* Sun Aug 2 2015 Jan Kratochvil - 7.9.90.20150717-10.fc23 +- Fix unpackaged d-exp.c source for the debuginfo rpm. +- Fix librpm version dependency Koji build failure (for RH BZ 1249325). + +* Sun Aug 2 2015 Jan Kratochvil - 7.9.90.20150717-9.fc23 +- Fix librpm version dependency (for RH BZ 1249325, from Igor Gnatenko). + +* Sat Aug 1 2015 Jan Kratochvil - 7.9.90.20150717-8.fc23 +- Fix librpm version 3->7 for Rawhide + (RH BZ 1249325, bugreport by Zbigniew Jędrzejewski-Szmek). +- Fix yum vs. dnf message suggestion for Rawhide + (RH BZ 1249326, bugreport by Zbigniew Jędrzejewski-Szmek). + +* Fri Jul 17 2015 Jan Kratochvil - 7.9.90.20150717-7.fc23 +- Rebase to FSF GDB 7.9.90.20150717 (7.10 branch snapshot). + +* Fri Jul 10 2015 Jan Kratochvil - 7.9.90.20150709-6.fc23 +- Rebase to FSF GDB 7.9.90.20150709 (7.10 branch snapshot). + +* Tue Jul 7 2015 Jan Kratochvil - 7.9.50.20150531-5.fc23 +- Upgrade libstdc++-v3-python to r225521 (RH BZ 1239290). + +* Thu Jul 2 2015 Jan Kratochvil - 7.9.50.20150531-4.fc23 +- [RHEL] Use Python2, disable Guile. + +* Fri Jun 26 2015 Jan Kratochvil - 7.9.50.20150531-3.fc23 +- Fix 'info type-printers' Python error (Clem Dickey, RH BZ 1085576). + +* Tue Jun 16 2015 Jan Kratochvil - 7.9.50.20150531-2.fc23 +- Fix enum e e 'Attempt to use a type name as an expr.' (Keith Seitz, PR 16253). + +* Sun May 31 2015 Jan Kratochvil - 7.9.50.20150531-1.fc23 +- Rebase to FSF GDB 7.9.50.20150531 (pre-7.10 trunk snapshot). + +* Fri May 15 2015 Jan Kratochvil - 7.9.1-14.fc22 +- Fix ignored Requires for gdb-doc (RH BZ 1221814). + +* Thu May 14 2015 Jan Kratochvil - 7.9.1-13.fc22 +- Change 'Recommends: dnf-plugins-core' to 'dnf-command(debuginfo-install)'. + +* Wed May 13 2015 Jan Kratochvil - 7.9.1-12.fc22 +- Rebase to FSF GDB 7.9.1 (7.9 stable branch). +- Add 'Recommends: dnf-plugins-core' for 'dnf debuginfo-install'. + +* Thu Apr 2 2015 Jan Kratochvil - 7.9-11.fc22 +- Suggest s/debuginfo-install/dnf debuginfo-install/ (BZ 1208650, Omair Majid). + +* Sun Feb 22 2015 Jan Kratochvil - 7.9-10.fc22 +- Rebase to the final 7.9 release. + +* Sun Feb 22 2015 Jan Kratochvil - 7.8.90.20150202-9.fc22 +- Change Require->Recommends for gcc-gdb-plugin (RH BZ 1195005). + +* Sat Feb 21 2015 Till Maas - 7.8.90.20150214-8 +- Rebuilt for Fedora 23 Change + https://fedoraproject.org/wiki/Changes/Harden_all_packages_with_position-independent_code + +* Mon Feb 16 2015 Jan Kratochvil - 7.8.90.20150214-7.fc22 +- Switch Python 2->3 (RH BZ 1014549). + +* Sat Feb 14 2015 Jan Kratochvil - 7.8.90.20150214-6.fc22 +- Rebase to 7.9-branch snapshot 7.8.90.20150214. + +* Wed Feb 11 2015 Jan Kratochvil - 7.8.90.20150202-5.fc22 +- Enable guile support. + +* Wed Feb 11 2015 Jan Kratochvil - 7.8.90.20150202-4.fc22 +- Fix gcc5 compilation errors (RH BZ 1190649). + +* Mon Feb 9 2015 Jan Kratochvil - 7.8.90.20150202-3.fc22 +- Require gcc-gdb-plugin. + +* Mon Feb 2 2015 Jan Kratochvil - 7.8.90.20150202-2.fc22 +- Rebase to 7.9-branch snapshot 7.8.90.20150202. +- Temporarily disable dg-extract-results.py to fix gdb.sum sorting. + +* Thu Jan 8 2015 Jan Kratochvil - 7.8.50.20150108-1.fc22 +- Rebase to pre-7.9 snapshot 7.8.50.20150108. +- Fix jit-reader.h for multi-lib. + +* Sun Dec 28 2014 Jan Kratochvil - 7.8.1-36.fc21 +- Rebase to 7.8.1.20141228 for a performance fix (PR binutils/17677). + +* Sat Dec 13 2014 Jan Kratochvil - 7.8.1-35.fc21 +- Fix resolve_dynamic_struct: Assertion `TYPE_NFIELDS (type) > 0' (PR 17642). + +* Sat Nov 22 2014 Jan Kratochvil - 7.8.1-34.fc21 +- [ppc64] Fix compatibility of Fedora errno workaround (for RH BZ 1166549). + +* Fri Nov 21 2014 Jan Kratochvil - 7.8.1-33.fc21 +- Fix regression accessing errno from a core file (RH BZ 1166549). + +* Thu Nov 20 2014 Sergio Durigan Junior - 7.8.1-32.fc21 +- Fix 'Unowned dir /usr/include/gdb/' (RH BZ 1164991). + +* Sat Nov 15 2014 Jan Kratochvil - 7.8.1-31.fc21 +- Fix '[RFE] please add add-auto-load-scripts-directory command' (RH + BZ 1163339, Jan Kratochvil). + +* Thu Oct 30 2014 Jan Kratochvil - 7.8.1-30.fc21 +- Rebase to FSF GDB 7.8.1. + +* Mon Oct 27 2014 Jan Kratochvil - 7.8-29.fc21 +- Backport vDSO regression. +- Revert the makeinfo workaround from 7.8-27.fc21. +- Further 1.75x improvement of the interactive symbols lookup (Doug Evans). + +* Mon Oct 20 2014 Jan Kratochvil - 7.8-28.fc21 +- Accelerate interactive symbols lookup 15x. + +* Sun Oct 19 2014 Jan Kratochvil - 7.8-27.fc21 +- Workaround makeinfo F-22 Bug 1154436. + +* Sun Oct 19 2014 Jan Kratochvil - 7.8-26.fc21 +- Import 5 upstream gdb-7.8 branch fixes (async fix by Pedro Alves). + +* Fri Oct 03 2014 Sergio Durigan Junior - 7.8-25.fc21 +- Fix 'Slow gstack performance' (RH BZ 1103894, Jan Kratochvil). + +* Fri Oct 3 2014 Jan Kratochvil - 7.8-24.fc21 +- Fix "save breakpoints" for signal catchpoints and disabled breakpoints + (BZ 1146170, Miroslav Franc). + +* Mon Sep 15 2014 Sergio Durigan Junior - 7.8-23.fc21 +- Install gdb/jit-reader.h on include directory (BZ 1141968). + +* Sun Sep 14 2014 Jan Kratochvil - 7.8-22.fc21 +- [testsuite] Fix runaway gdb.base/attach processes. + +* Sun Sep 7 2014 Jan Kratochvil - 7.8-21.fc21 +- Fix GDB SIGTT* Stopped when using the PID argument (BZ 1136704, Pedro Alves). + +* Wed Aug 20 2014 Jan Kratochvil - 7.8-20.fc21 +- Fix babeltrace errors (Yao Qi). +- Fix crash on Python frame filters with unreadable arg (BZ 1126177). + +* Sat Aug 16 2014 Fedora Release Engineering - 7.8-19 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild + +* Thu Aug 14 2014 Jan Kratochvil - 7.8-18.fc21 +- [rhel] Adjust the previous patch for compilation on older GCCs. + +* Wed Aug 13 2014 Jan Kratochvil - 7.8-17.fc21 +- Fix Python GIL with gdb.execute("continue") (Phil Muldoon, BZ 1116957). + +* Mon Aug 4 2014 Jan Kratochvil - 7.8-16.fc21 +- Enable babeltrace compile-time feature. + +* Sat Aug 2 2014 Jan Kratochvil - 7.8-15.fc21 +- Rebase to FSF GDB 7.8. +- Display Fortran strings in backtraces. + +* Thu Jul 24 2014 Jan Kratochvil - 7.8-14.fc21 +- Rebase to FSF GDB 7.7.91.20140724 (pre-7.8 snapshot). +- Import TUI regression fix (Pedro Alves, BZ 1123003). + +* Tue Jul 22 2014 Jan Kratochvil - 7.8-13.fc21 +- Bump the package version number to final 7.8; still using 7.7.91.20140721.tar. + +* Tue Jul 22 2014 Jan Kratochvil - 7.7.91.20140721-12.fc21 +- Rebase to FSF GDB 7.7.91.20140721 (pre-7.8 snapshot). +- Rebase the Intel VLA patchset. +- New fix of the optimized-out entry data values crash (BZ 1111910). +- [testsuite] Fix paginate-*.exp race for "read1". + +* Fri Jul 11 2014 Jan Kratochvil - 7.7.90.20140711-11.fc21 +- Fix regression#2 of the optimized-out entry data values fix (of BZ 1111910). +- Rebase to FSF GDB 7.7.90.20140711 (pre-7.8 snapshot). +- [testsuite] Disable --with testsuite PIE testing, it has too many false FAILs. + +* Wed Jul 9 2014 Jan Kratochvil - 7.7.90.20140627-10.fc21 +- Fix regression of the optimized-out entry data values fix (of BZ 1111910). + +* Tue Jul 8 2014 Jan Kratochvil - 7.7.90.20140627-9.fc21 +- Rebase the Intel VLA patchset. +- Python completion w/overriden completer (Sergio Durigan Junior, BZ 1075199). +- Remove %%{_bindir}/mono-gdb.py workaround of mono BZ 815501. + +* Tue Jul 1 2014 Jan Kratochvil - 7.7.90.20140627-8.fc21 +- Do not remove %%{_datadir}/gdb/syscalls/ppc*.xml as it is secondary target. +- Remove: %%{_datadir}/gdb/guile +- Remove: %%{_datadir}/gdb/system-gdbinit + +* Mon Jun 30 2014 Jan Kratochvil - 7.7.90.20140627-7.fc21 +- Fix crash on optimized-out entry data values (BZ 1111910). + +* Fri Jun 27 2014 Jan Kratochvil - 7.7.90.20140627-6.fc21 +- Rebase to FSF GDB 7.7.90.20140627 (pre-7.8 snapshot). + +* Fri Jun 27 2014 Jan Kratochvil - 7.7.90.20140613-5.fc21 +- Continue backtrace even if a frame filter throws an exception (Phil Muldoon). + +* Tue Jun 24 2014 Jan Kratochvil - 7.7.90.20140613-4.fc21 +- [aarch64] Fix compilation error. + +* Fri Jun 20 2014 Jan Kratochvil - 7.7.90.20140613-3.fc21 +- Fix --with-system-readline with readline-6.3 patch 5. + - Use --enable-werror again. + +* Thu Jun 19 2014 Jan Kratochvil - 7.7.90.20140613-2.fc21 +- Temporarily use --disable-werror for readline-6.3's deprecated 'VFunction'. + +* Thu Jun 19 2014 Jan Kratochvil - 7.7.90.20140613-1.fc21 +- Rebase to FSF GDB 7.7.90.20140613 (pre-7.8 snapshot). + +* Sat Jun 07 2014 Fedora Release Engineering - 7.7.1-21 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild + +* Tue Jun 3 2014 Jan Kratochvil - 7.7.1-20.fc21 +- Fix#2 /usr/share/gdb/system-gdbinit/ timestamps causing non-matching *.py[oc]. + +* Tue Jun 3 2014 Jan Kratochvil - 7.7.1-19.fc21 +- Fix /usr/share/gdb/auto-load/ (safely) dangling symlinks. +- Fix /usr/share/gdb/system-gdbinit/ timestamps causing non-matching *.py[oc]. + +* Tue Jun 3 2014 Jan Kratochvil - 7.7.1-18.fc21 +- [ppc64le testsuite] Add comments about prelink+valgrind not yet ported. + +* Fri May 30 2014 Jan Kratochvil - 7.7.1-17.fc21 +- [arm*,aarch64] Turn on --enable-werror, fix aarch64 for it. + +* Fri May 30 2014 Jan Kratochvil - 7.7.1-16.fc21 +- [aarch64] Fix signal frame unwinding (BZ 1086894, upstream). + +* Mon May 26 2014 Jan Kratochvil - 7.7.1-15.fc21 +- [testsuite] Drop BuildRequires: gcc-java+libgcj on Fedora (no longer in F21+). + +* Fri May 16 2014 Jan Kratochvil - 7.7.1-14.fc21 +- [rhel5] Drop the RHEL-5 support - simplify this .spec file. + +* Wed May 14 2014 Jan Kratochvil - 7.7.1-13.fc21 +- [s390*] Import upstream fix for 64->32 debugging. + +* Mon May 12 2014 Jan Kratochvil - 7.7.1-12.fc21 +- [s390*] Fix compilation error. + +* Fri May 9 2014 Jan Kratochvil - 7.7.1-11.fc21 +- [ppc*] Import ppc64le support (BZ 1096303, Ulrich Weigand). + +* Tue May 6 2014 Jan Kratochvil - 7.7.1-10.fc21 +- Rebase to FSF GDB 7.7.1. + +* Mon May 5 2014 Sergio Durigan Junior - 7.7-9.fc21 +- Improve testcase message for RH BZ 981154. + +* Mon May 5 2014 Jan Kratochvil - 7.7-8.fc21 +- Fix TLS access for -static -pthread (BZ 1080660). + +* Mon May 5 2014 Jan Kratochvil - 7.7-7.fc21 +- Add GFDL License to the main package (man pages are generated from .texinfo). + +* Thu Apr 24 2014 Sergio Durigan Junior - 7.7-6.fc21 +- Fix build failures for GCC 4.9 (Nick Clifton). + +* Thu Apr 24 2014 Sergio Durigan Junior - 7.7-5.fc21 +- Fix 'gdb gives highly misleading error when debuginfo pkg is present, + but not corresponding binary pkg' (RH BZ 981154). + +* Mon Feb 24 2014 Jan Kratochvil - 7.7-4.fc21 +- Fix crash of -readnow /usr/lib/debug/usr/bin/gnatbind.debug (BZ 1069211). + +* Sun Feb 23 2014 Jan Kratochvil - 7.7-3.fc21 +- [rhel6] DTS backward Python compatibility API (BZ 1020004, Phil Muldoon). +- [rhel6] Do not install its man page if gdb-add-index is not installed. +- [rhel] Do not migrate /usr/share/gdb/auto-load/ with symlinks on RHELs. +- Fix gdb-7.7 auto-load from /usr/share/gdb/auto-load/ regression. + +* Sun Feb 9 2014 Jan Kratochvil - 7.7-2.fc21 +- [rhel] Fix rebase build regression on RHEL systems (Tobias Burnus). + +* Fri Feb 7 2014 Jan Kratochvil - 7.7-1.fc21 +- Rebase to FSF GDB 7.7. +- New rpmbuild option: --with asan + +* Thu Jan 23 2014 Jan Kratochvil - 7.6.50.20140119-20.fc20 +- [s390*,ppc*] Enable secondary targets s390* and ppc* (BZ 1056259). + +* Sun Jan 19 2014 Jan Kratochvil - 7.6.50.20140119-19.fc20 +- Backport several gdb-7.6.x stable branch fixes (BZ 1055155). + +* Wed Dec 25 2013 Jan Kratochvil - 7.6.50.20130731-18.fc20 +- [aarch64] Backport two breakpoint/watchpoint fixes. + +* Mon Nov 18 2013 Jan Kratochvil - 7.6.50.20130731-17.fc20 +- [rhel7] [--with testsuite] Remove gcc-java&co. BuildRequires. + +* Sat Nov 9 2013 Jan Kratochvil - 7.6.50.20130731-16.fc20 +- Fix explicit Class:: inside class scope (BZ 874817, Keith Seitz). + +* Tue Nov 5 2013 Jan Kratochvil - 7.6.50.20130731-15.fc20 +- [aarch64] Backport two fixes (BZ 1026484). + +* Sun Nov 3 2013 Jan Kratochvil - 7.6.50.20130731-14.fc20 +- Fix %%{_bindir}gdb-add-index to also use -iex 'set auto-load no'. + +* Wed Oct 30 2013 Jan Kratochvil - 7.6.50.20130731-13.fc20 +- [rhel5] Fix /etc/gdbinit compatibility with python-2.4. + +* Mon Sep 30 2013 Sergio Durigan Junior - 7.6.50.20130731-12.fc20 +- Fix the case when GDB leaks memory because value_struct_elt does not call + check_typedef. (Doug Evans, BZ 15695, filed as RH BZ 1013453). + +* Wed Sep 25 2013 Jan Kratochvil - 7.6.50.20130731-11.fc20 +- Enable arm-linux-gnu and aarch64-linux-gnu targets on all archs (BZ 1011647). + +* Mon Sep 9 2013 Jan Kratochvil - 7.6.50.20130731-10.fc20 +- Fix the version string to be GNU standards compliant (BZ 1004949). + +* Fri Aug 30 2013 Jan Kratochvil - 7.6.50.20130731-9.fc20 +- Load /etc/gdbinit.d/*.{gdb,py} files automatically (BZ 981520). + +* Fri Aug 30 2013 Jan Kratochvil - 7.6.50.20130731-8.fc20 +- New %%pre to fix failed upgrade of the previous commit (BZ 999645). +- Fix false warnings of new %%pre during future upgrades (BZ 999645). + +* Wed Aug 28 2013 Jan Kratochvil - 7.6.50.20130731-7.fc20 +- Fix /usr/share/gdb/auto-load/ need of filesystem symlinks (BZ 999645). + It needs: yum remove gdb-heap; yum reinstall gdb; yum install gdb-heap + +* Thu Aug 8 2013 Jan Kratochvil - 7.6.50.20130731-6.fc20 +- [rhel5] tps-srpmtest does not set %%{rhel} (BZ 1002198, Miroslav Franc). + +* Thu Aug 8 2013 Jan Kratochvil - 7.6.50.20130731-5.fc20 +- Simplify BuildRequires by texlive-collection-latexrecommended (see BZ 919891). + +* Tue Aug 6 2013 Jan Kratochvil - 7.6.50.20130731-4.fc20 +- Revert the texlive-collection-latexrecommended change (see BZ 919891). + +* Tue Aug 6 2013 Jan Kratochvil - 7.6.50.20130731-3.fc20 +- Simplify BuildRequires by texlive-collection-latexrecommended (see BZ 919891). +- Fix crash on 'enable count' (Simon Marchi, BZ 993118). + +* Fri Aug 2 2013 Jan Kratochvil - 7.6.50.20130731-2.fc20 +- Drop ia64 patches and .spec support. + +* Fri Aug 2 2013 Jan Kratochvil - 7.6.50.20130731-1.fc20 +- Rebase to FSF GDB 7.6.50.20130731 (snapshot between 7.6 and future 7.7). + +* Mon Jul 29 2013 Jan Kratochvil - 7.6-36.fc20 +- Remove %%{gdb_docdir}, rebuild for unversioned docdirs (for BZ 986871). + +* Wed Jul 24 2013 Jan Kratochvil - 7.6-35.fc20 +- [ppc] Support Power8 CPU (IBM, BZ 731875). + +* Wed Jul 17 2013 Jan Kratochvil - 7.6-34.fc20 +- Remove --disablerepo='*' from BZ 554152 as it conflicts with BZ 981154. + +* Wed Jul 17 2013 Jan Kratochvil - 7.6-33.fc20 +- Fix yum install command output when the binary RPM is missing (BZ 981154). +- Fix the changlog entry formatting for 6.3.0.0-0.1. + +* Mon Jun 10 2013 Jan Kratochvil - 7.6-32.fc19 +- [scl] Disable Python frame filters on scl. +- Update libraries opening performance fix from upstream. +- Fix C++ lookups performance regression (Doug Evans, BZ 972677). + +* Tue May 28 2013 Jan Kratochvil - 7.6-31.fc19 +- [ppc] Backport hardware watchpoints fix (Edjunior Machado, BZ 967915). + +* Tue May 21 2013 Jan Kratochvil - 7.6-30.fc19 +- Backported Python frame filters (Phil Muldoon). +- Backported breakpoint conditions crash fix (Sergio Durigan Junior). + +* Sun May 19 2013 Jan Kratochvil - 7.6-29.fc19 +- Fix performance regression opening many libraries (Gary Benson, BZ 965106). + +* Thu May 9 2013 Jan Kratochvil - 7.6-28.fc19 +- Fix needless expansion of non-gdbindex symtabs (Doug Evans). + +* Mon May 6 2013 Jan Kratochvil - 7.6-27.fc19 +- [testsuite] [RHEL-5] Fix gdb-orphanripper.c runtime error. + +* Fri May 3 2013 Jan Kratochvil - 7.6-26.fc19 +- Fix gcore for vDSO (on ppc64). + +* Sat Apr 27 2013 Jan Kratochvil - 7.6-25.fc19 +- Fix false "Unknown error 512" on x32 (H.J. Lu, BZ 956883). + +* Fri Apr 26 2013 Jan Kratochvil - 7.6-24.fc19 +- Rebase to FSF GDB 7.6. + +* Wed Apr 24 2013 Jan Kratochvil - 7.5.91.20130423-23.fc19 +- Fix man page BuildRequires (for BZ 881892). + +* Tue Apr 23 2013 Jan Kratochvil - 7.5.91.20130423-22.fc19 +- [spec] Fix virtual bundles after GDB has been branched. + +* Tue Apr 23 2013 Jan Kratochvil - 7.5.91.20130423-21.fc19 +- Rebase to FSF GDB 7.5.91.20130423 (pre-7.6 snapshot). + +* Mon Apr 22 2013 Jan Kratochvil - 7.5.91.20130407-20.fc19 +- [SCL] Skip deprecated .gdb_index warning for Red Hat built files (BZ 953585). + +* Mon Apr 22 2013 Sergio Durigan Junior - 7.5.91.20130407-19.fc19 +- [RHEL-6] Regression test for RH BZ 947564. + +* Thu Apr 11 2013 Jan Kratochvil - 7.5.91.20130407-18.fc19 +- Provide man page for gcore.1 and gdb-add-index.1 (BZ 881892). + +* Sun Apr 7 2013 Jan Kratochvil - 7.5.91.20130407-17.fc19 +- [RHEL-5] Fix noarch doc build. + +* Sun Apr 7 2013 Jan Kratochvil - 7.5.91.20130407-16.fc19 +- Rebase to FSF GDB 7.5.91.20130407 (pre-7.6 snapshot). +- [SCL] Remove BuildRequires of gcc-go on SCL (Miroslav Franc, BZ 948982). +- Provide man page for gdbinit.5 (BZ 881892), document gdb -p in man (BZ 659000). + +* Tue Apr 2 2013 Jan Kratochvil - 7.5.91.20130402-15.fc19 +- Rebase to FSF GDB 7.5.91.20130402 (pre-7.6 snapshot). + +* Sat Mar 23 2013 Jan Kratochvil - 7.5.91.20130323-14.fc19 +- Rebase to FSF GDB 7.5.91.20130310 (pre-7.6 snapshot). +- Fix crash regression from the dlopen of libpthread.so fix (BZ 911712). + +* Mon Mar 11 2013 Jan Kratochvil - 7.5.50.20130310-13.fc19 +- [RHEL-5] Import build regression fix. + +* Sun Mar 10 2013 Jan Kratochvil - 7.5.50.20130310-12.fc19 +- Add workaround of PDF gdb-doc build (filed as RH BZ 919891). + +* Sun Mar 10 2013 Jan Kratochvil - 7.5.50.20130310-11.fc19 +- Re-enable (again) PDF in gdb-doc after texinfo RH BZ 876710 has been fixed. + +* Sun Mar 10 2013 Jan Kratochvil - 7.5.50.20130310-10.fc19 +- Rebase to FSF GDB 7.5.50.20130310 (pre-7.6 snapshot). +- Fix various entry-values sub-optimal results. + +* Mon Feb 25 2013 Jan Kratochvil - 7.5.50.20130215-9.fc19 +- testsuite: Fix gdb.arch/powerpc-power6.exp testcase (IBM, RH BZ 890900). + +* Tue Feb 19 2013 Jan Kratochvil - 7.5.50.20130215-8.fc19 +- Temporarily disable PDF in gdb-doc for still unavailable texinfo RH BZ 876710. + +* Mon Feb 18 2013 Jan Kratochvil - 7.5.50.20130215-7.fc19 +- Rebase to FSF GDB 7.5.50.20130215 (pre-7.6 snapshot). + +* Fri Feb 8 2013 Jan Kratochvil - 7.5.50.20130118-6.fc19 +- Re-enable PDF in gdb-doc after texinfo RH BZ 876710 has been fixed. + +* Mon Feb 4 2013 Jan Kratochvil - 7.5.50.20130118-5.fc19 +- Release bump only. + +* Fri Feb 1 2013 Jan Kratochvil - 7.5.50.20130118-4.fc19 +- Fix assert crashes with minidebuginfo (BZ 903522). + +* Fri Jan 25 2013 Jan Kratochvil - 7.5.50.20130118-3.fc19 +- Release bump only. + +* Mon Jan 21 2013 Jan Kratochvil - 7.5.50.20130118-2.fc19 +- [RHEL] Reintroduce gdb-6.8-quit-never-aborts.patch. + +* Sat Jan 19 2013 Jan Kratochvil - 7.5.50.20130118-1.fc19 +- Rebase to FSF GDB 7.5.50.20130118 (pre-7.6 snapshot). + +* Sun Jan 13 2013 Jan Kratochvil - 7.5.1-35.fc18 +- [testsuite] Fix gdb-orphanripper.c lockup on F-17 (/dev/pts/* glibc chown). + +* Tue Jan 8 2013 Jan Kratochvil - 7.5.1-34.fc18 +- Update dlopen to support map_failed probe of glibc (Gary Benson, BZ 886516). + +* Thu Jan 3 2013 Jan Kratochvil - 7.5.1-33.fc18 +- [ppc*] Fix PowerPC disassembly regression (Alan Modra, Edjunior Machado). + +* Thu Dec 13 2012 Jan Kratochvil - 7.5.1-32.fc18 +- 'dwz -m' parsing fix (Tom Tromey). + +* Mon Dec 3 2012 Jan Kratochvil - 7.5.1-31.fc18 +- Fix DW_OP_GNU_implicit_pointer offset bug (Tom Tromey). + +* Sun Dec 2 2012 Jan Kratochvil - 7.5.1-30.fc18 +- Temporarily disable PDF in gdb-doc before texinfo RH BZ 876710 gets fixed. + +* Thu Nov 29 2012 Jan Kratochvil - 7.5.1-29.fc18 +- Provide Source URL when it is a release. + +* Thu Nov 29 2012 Jan Kratochvil - 7.5.1-28.fc18 +- Fix (unsplit) split info doc. + +* Thu Nov 29 2012 Jan Kratochvil - 7.5.1-27.fc18 +- Rebase to FSF GDB 7.5.1 (7.5 stable branch). + +* Fri Nov 9 2012 Jan Kratochvil - 7.5.0.20120926-26.fc18 +- Fix `GDB cannot access struct member whose offset is larger than 256MB' + (RH BZ 871066). + +* Fri Oct 5 2012 Jan Kratochvil - 7.5.0.20120926-25.fc18 +- entry values: Fix resolving in inlined frames. + +* Thu Sep 27 2012 Jan Kratochvil - 7.5.0.20120926-24.fc18 +- Permit passing pointers as address number even for C++ methods (Keith Seitz). + +* Thu Sep 27 2012 Jan Kratochvil - 7.5.0.20120926-23.fc18 +- Fix crash printing classes (BZ 849357, Tom Tromey). + +* Wed Sep 26 2012 Jan Kratochvil - 7.5.0.20120926-22.fc18 +- Fix .spec 'bundled' Provides for the stable branch rebase. + +* Wed Sep 26 2012 Jan Kratochvil - 7.5.0.20120926-21.fc18 +- [ppc32] Fix stepping over symbol-less code crash regression (BZ 860696). +- Rebase to FSF GDB 7.5.0.20120926 (7.5 stable branch). + - Remove the .spec Source keyword URL as not valid now. + +* Fri Sep 14 2012 Jan Kratochvil - 7.5-20.fc18 +- [RHEL-6] Disable no longer valid workaround of man pages .gz suffix. + +* Sat Aug 18 2012 Jan Kratochvil - 7.5-19.fc18 +- Rebase to FSF GDB 7.5. +- Update dlopen to support two variants of glibc (Gary Benson, BZ 669432). + +* Fri Aug 17 2012 Jan Kratochvil - 7.4.91.20120801-18.fc18 +- Drop Source URL for snapshots. +- Separate %%{snapgnulib} from %%{snap}. +- Fix %%{libstdcxxpython} to be %%{name}-prefixed. +- Fix debug info for go-exp.y and go-exp.c. +- Include RHEL-5 compatible %%{buildroot} cleanup. +- Use %%__global_ldflags. + +* Wed Aug 1 2012 Jan Kratochvil - 7.4.91.20120801-17.fc18 +- Rebase to FSF GDB 7.4.91.20120801. +- [dwz] Rebase it from FSF GDB HEAD. + +* Thu Jul 19 2012 Fedora Release Engineering - 7.4.50.20120714-16.fc18 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Mon Jul 16 2012 Jan Kratochvil - 7.4.50.20120714-15.fc18 +- [devtoolset] Include Obsoletes of devtoolset-1.0-* by devtoolset-1.1-*. + +* Sun Jul 15 2012 Jan Kratochvil - 7.4.50.20120714-14.fc18 +- Rebase to FSF GDB 7.4.50.20120714. + - Fix entryval feature crash on some .debug files optimized by dwz (BZ 839596). +- Fix another stale frame_info * (PR 11914, like PR 13866). + +* Fri Jul 6 2012 Jan Kratochvil - 7.4.50.20120703-13.fc18 +- [RHEL] Disable MiniDebugInfo F-18 feature on RHEL <= 6 (BZ 834068). + +* Fri Jul 6 2012 Jan Kratochvil - 7.4.50.20120703-12.fc18 +- Fix .spec metadata for the MiniDebugInfo F-18 feature (BZ 834068). + +* Fri Jul 6 2012 Jan Kratochvil - 7.4.50.20120703-11.fc18 +- [archer-tromey-dwz-multifile-rebase] Fix DWARF files reading (Tom Tromey). + +* Fri Jul 6 2012 Jan Kratochvil - 7.4.50.20120703-10.fc18 +- Fix build-id-core-loads internal error (BZ 837870). + +* Thu Jul 5 2012 Jan Kratochvil - 7.4.50.20120703-9.fc18 +- Implement MiniDebugInfo F-18 Feature consumer (Alexander Larsson, BZ 834068). + +* Tue Jul 3 2012 Jan Kratochvil - 7.4.50.20120703-8.fc18 +- Rebase to FSF GDB 7.4.50.20120703. +- [archer-tromey-dwz-multifile-rebase] Merge new branch (Tom Tromey). +- [arm] <--with testsuite>: Disable fpc BuildRequires as it is not yet built. +- Revert function returning pointer fix (PR 9514) regressing Fedora errno patch. + +* Thu Jun 21 2012 Sergio Durigan Junior - 7.4.50.20120603-7.fc18 +- Include testcase for BZ 818343. + +* Tue Jun 19 2012 Jan Kratochvil - 7.4.50.20120603-6.fc18 +- Fix regression of undisplayed missing shared libraries caused by a fix for: + GNU/Linux core open: Can't read pathname for load map: Input/output error. + +* Sun Jun 17 2012 Sergio Durigan Junior - 7.4.50.20120603-5.fc18 +- Include testcase for BZ 823789. + +* Thu Jun 14 2012 Jan Kratochvil - 7.4.50.20120603-4.fc18 +- Support DW_OP_GNU_parameter_ref for -O2 -g inferiors (BZ 827375). + +* Wed Jun 6 2012 Jan Kratochvil - 7.4.50.20120603-3.fc18 +- Disable -lmcheck in the development builds. +- Fix assertion on some files as glibc-2.15.90-8.fc18 (Doug Evans). + +* Sun Jun 3 2012 Jan Kratochvil - 7.4.50.20120603-2.fc18 +- Fix Release. +- Make yum --enablerepo compatible with at least mock-1.1.21-1.fc16 Rawhide cfg. + +* Sun Jun 3 2012 Jan Kratochvil - 7.4.50.20120602-1.fc18 +- Rebase to FSF GDB 7.4.50.20120602. +- [testsuite] BuildRequire gcc-go. +- Drop printing 2D C++ vectors as matrices which no longer worked (BZ 562763). +- Fix dejagnu-1.5-4.fc17 compatibility for Go (for BZ 635651). +- Use librpm.so.3 for rpm-4.10.0 in Fedora 18. +- Revert recent breakage of UNIX objfiles order for symbols lookup. + +* Sat Jun 2 2012 Jan Kratochvil - 7.4.50.20120120-48.fc17 +- [ppc] Fix hardware watchpoints on PowerPC (BZ 827600, Edjunior Machado). + +* Mon May 28 2012 Jan Kratochvil - 7.4.50.20120120-47.fc17 +- Workaround PR libc/14166 for inferior calls of strstr. + +* Mon May 14 2012 Jan Kratochvil - 7.4.50.20120120-46.fc17 +- [RHEL5] Workaround doc build race. + +* Mon May 14 2012 Jan Kratochvil - 7.4.50.20120120-45.fc17 +- Rename "set auto-load" patchset variable $ddir to $datadir. + +* Wed May 9 2012 Jan Kratochvil - 7.4.50.20120120-44.fc17 +- Fix in "set auto-load" patchset for SCL scripts inheritance (BZ 815910). + +* Wed Apr 25 2012 Jan Kratochvil - 7.4.50.20120120-43.fc17 +- [RHEL5] Workaround kernel for detaching SIGSTOPped processes (BZ 809382). + +* Tue Apr 24 2012 Jan Kratochvil - 7.4.50.20120120-42.fc17 +- Update "set auto-load" patchset and the --with-auto-load-safe-path setting. +- [RHEL] Disable gdb-add-index even on RHEL-6 as RHEL-6.0 had too old elfutils. + +* Wed Apr 18 2012 Jan Kratochvil - 7.4.50.20120120-41.fc17 +- [RHEL] Fix --with-auto-load-safe-path systems prior to /usr move. + +* Wed Apr 18 2012 Jan Kratochvil - 7.4.50.20120120-40.fc17 +- Security fix for loading untrusted inferiors, see "set auto-load" (BZ 756117). + +* Fri Apr 13 2012 Jan Kratochvil - 7.4.50.20120120-39.fc17 +- [RHEL7] Fix/remove readline-devel BuildRequires redundant distro suffic .fc17. + +* Wed Apr 4 2012 Jan Kratochvil - 7.4.50.20120120-38.fc17 +- Workaround crashes from stale frame_info pointer (BZ 804256). + +* Wed Apr 4 2012 Jan Kratochvil - 7.4.50.20120120-37.fc17 +- testsuite: Fix break-interp.exp expections for updated glibc (BZ 752834). + +* Wed Apr 4 2012 Jan Kratochvil - 7.4.50.20120120-36.fc17 +- [RHEL5,RHEL6] Reintroduce fix attaching to stopped processes. + +* Fri Mar 30 2012 Jan Kratochvil - 7.4.50.20120120-35.fc17 +- Fix performance regressions with .gdb_index (Tom Tromey, BZ 805274). + +* Fri Mar 30 2012 Jan Kratochvil - 7.4.50.20120120-34.fc17 +- Fixup %%{_datadir}/gdb timestamps for multilib conflicts on RHELs. + +* Mon Mar 26 2012 Jan Kratochvil - 7.4.50.20120120-33.fc17 +- [vla] Fix regression on no type for subrange from IBM XLF Fortran (BZ 806920). + +* Sat Mar 17 2012 Jan Kratochvil - 7.4.50.20120120-32.fc17 +- Fix loading of core files without build-ids but with build-ids in executables. + +* Fri Mar 9 2012 Jan Kratochvil - 7.4.50.20120120-31.fc17 +- Fix an implied regression by the inferior calls fix below (BZ 799531). + +* Fri Mar 9 2012 Jan Kratochvil - 7.4.50.20120120-30.fc17 +- Fix SELinux deny_ptrace .spec build rules (BZ 786878). + +* Tue Mar 6 2012 Jan Kratochvil - 7.4.50.20120120-29.fc17 +- Fix inferior calls, particularly uncaught thrown exceptions (BZ 799531). +- Fix DWARF DIEs CU vs. section relative offsets (Joel Brobecker, me). + +* Tue Mar 6 2012 Jan Kratochvil - 7.4.50.20120120-28.fc17 +- Print reasons for failed attach/spawn incl. SELinux deny_ptrace (BZ 786878). + +* Sun Mar 4 2012 Jan Kratochvil - 7.4.50.20120120-27.fc17 +- [rhel5] Fix up the previous commit (BZ 799318). + +* Sun Mar 4 2012 Jan Kratochvil - 7.4.50.20120120-26.fc17 +- [rhel5] Fix up the previous commit (BZ 799318). + +* Sun Mar 4 2012 Jan Kratochvil - 7.4.50.20120120-25.fc17 +- [rhel5] Workaround rpmbuild to make the doc subpkg noarch again (BZ 799318). + +* Fri Mar 2 2012 Jan Kratochvil - 7.4.50.20120120-24.fc17 +- [vla] Fix crash for dynamic.exp with gcc-gfortran-4.1.2-51.el5.x86_64. +- Reintroduce RHEL-5 glibc workaround for bt-clone-stop.exp. +- testsuite: Update/fix rh634108-solib_address.exp for the upstreamed API. + +* Wed Feb 29 2012 Jan Kratochvil - 7.4.50.20120120-23.fc17 +- Add kernel vDSO workaround (`no loadable ...') on RHEL-5 (kernel BZ 765875). +- Fix skipping of prologues on RHEL-5 gcc-4.1 -O2 -g code (BZ 797889). +- Fix breakpoint warning during 'next' over exit() (Tom Tromey, BZ 797892). + +* Tue Feb 28 2012 Jan Kratochvil - 7.4.50.20120120-22.fc17 +- testsuite: Fix gdb.base/macscp.exp ccache workaround in SCL mode. +- Adjust the RHEL/F version string automatically (BZ 797651, BZ 797646). +- Provide gdbtui for RHEL-5 and RHEL-6 as it is removed upstream (BZ 797664). + +* Fri Feb 24 2012 Jan Kratochvil - 7.4.50.20120120-21.fc17 +- testsuite: Do not use gcc44/gfortran44 on RHEL-5 if in SCL mode. + +* Wed Feb 22 2012 Jan Kratochvil - 7.4.50.20120120-20.fc17 +- Fix libinproctrace.so build on RHEL-5 i386 (disable it on RHEL-5). + +* Wed Feb 22 2012 Jan Kratochvil - 7.4.50.20120120-19.fc17 +- Implement SCL (scl-utils-build) macros. + +* Tue Feb 21 2012 Jan Kratochvil - 7.4.50.20120120-18.fc17 +- Fix debuginfo gdb-gdb.py build without redhat-rpm-config and on RHEL-5. +- Provide precompiled variants of gdb-gdb.py. + +* Mon Feb 13 2012 Jan Kratochvil - 7.4.50.20120120-17.fc17 +- gstack: Turn off --readnever (suggested by Oliver Henshaw). + +* Fri Feb 10 2012 Jan Kratochvil - 7.4.50.20120120-16.fc17 +- [RHELs] Drop simulation of legacy behavior - new GDB should behave as new GDB. + +* Fri Feb 10 2012 Jan Kratochvil - 7.4.50.20120120-15.fc17 +- Simplify %%setup .spec rule. + +* Fri Feb 10 2012 Jan Kratochvil - 7.4.50.20120120-14.fc17 +- Drop --with upstream .spec rules. + +* Fri Feb 10 2012 Jan Kratochvil - 7.4.50.20120120-13.fc17 +- Drop --with debug .spec rules. + +* Thu Feb 9 2012 Jan Kratochvil - 7.4.50.20120120-12.fc17 +- Improve performance for C++ symbols expansion (Tom Tromey, BZ 787487). +- Install also gdb-gdb.py pretty printers. + +* Thu Feb 9 2012 Jan Kratochvil - 7.4.50.20120120-11.fc17 +- Fix possible NULL crash in find_charset_names (Tom Tromey, BZ 786091). +- [ppc*] Fix build failure due to GCC aliasing warning (BZ 786504). + +* Sat Jan 21 2012 Jan Kratochvil - 7.4.50.20120120-10.fc17 +- Rebase to FSF GDB 7.4.50.20120120. +- Drop the g77 .spec provisioning as it has been fixed in FSF GDB. + +* Thu Jan 19 2012 Jan Kratochvil - 7.4.50.20120103-9.fc17 +- Enable smaller %%{_bindir}/gdb in future by no longer using -rdynamic. +- Make --enablerepo to use '*-debug*' for RHEL compatibility (BZ 781571). +- On older RHELs make readline bundled again (BZ 701131). +- Fix build compatibility with RHEL-5 due to false noarch build. + +* Wed Jan 11 2012 Jan Kratochvil - 7.4.50.20120103-8.fc17 +- Disable unexpected GDB directories relocatability. + +* Wed Jan 11 2012 Jan Kratochvil - 7.4.50.20120103-7.fc17 +- Fix BuildRequires for RHEL compatibility (BZ 701131). + +* Wed Jan 11 2012 Jan Kratochvil - 7.4.50.20120103-6.fc17 +- Provide %%snap timestamp for: Provides: bundled(librarypackage) +- Replace %%define by %%global. +- Replace Java in Summary with Fortran (only GCC-compiled Java is supported). +- Unbundle readline-6.2 with a workaround of skipped "ask" (BZ 701131). +- Work around readline-6.2 incompatibility not asking for --more-- (BZ 701131). + +* Sat Jan 7 2012 Jan Kratochvil - 7.4.50.20120103-5.fc17 +- Mark %%{_sysconfdir}/gdbinit as %%config(noreplace). +- Add appropriate: Provides: bundled(librarypackage). +- Remove excessive explicit Requires: librarypackage. + +* Thu Jan 5 2012 Jan Kratochvil - 7.4.50.20120103-4.fc17 +- Fix linking on non-x86* (such as s390*) after libgdb.a removal. + +* Wed Jan 4 2012 Jan Kratochvil - 7.4.50.20120103-3.fc17 +- Reinclude gdb-dlopen-stap-probe.patch (missing in Fedora glibc - BZ 752476). + +* Tue Jan 3 2012 Jan Kratochvil - 7.4.50.20120103-2.fc17 +- Fix SystemTap support regression on i686 (Sergio Durigan Junior). + +* Tue Jan 3 2012 Jan Kratochvil - 7.4.50.20120103-1.fc17 +- Rebase to FSF GDB 7.4.50.20120103. + +* Mon Nov 28 2011 Jan Kratochvil - 7.3.50.20110722-11.fc17 +- No longer build bundled libstdc++ pretty printers on RHELs >= 7. + +* Sat Nov 5 2011 Sergio Durigan Junior - 7.3.50.20110722-10.fc16 +- Backport fix for crash in cp_scan_for_anonymous_namespace + (Aleksandar Ristovski, BZ 750341). + +* Fri Oct 14 2011 Jan Kratochvil - 7.3.50.20110722-9.fc16 +- Backport `info os processes' crash fix - for Eclipse (Pedro Alves, BZ 746294). + +* Tue Oct 11 2011 Jan Kratochvil - 7.3.50.20110722-8.fc16 +- Fix PIE testsuite run; new lib/future.exp hack and use -fPIC instead of -fPIE. + +* Mon Sep 26 2011 Jan Kratochvil - 7.3.50.20110722-7.fc16 +- [vla] Fix VLA arrays displayed in `bt full' (BZ 738482). +- Fix DW_OP_GNU_implicit_pointer for DWARF32 v3+ on 64-bit arches. +- Fix internal error on some optimized-out values. + +* Tue Aug 16 2011 Jan Kratochvil - 7.3.50.20110722-6.fc16 +- Python command/function auto-loading (Phil Muldoon, BZ 730976). +- Work around PR libc/13097 "linux-vdso.so.1" warning message. +- [TUI] Fix stepi on stripped code. +- Add BuildRequires: systemtap-sdt-devel for archer-sergiodj-stap-patch-split. + +* Wed Aug 10 2011 Jan Kratochvil - 7.3.50.20110722-5.fc16 +- Fix dlopen of libpthread.so, patched glibc required (Gary Benson, BZ 669432). + +* Tue Aug 9 2011 Jan Kratochvil - 7.3.50.20110722-4.fc16 +- Improve GDB performance on inferior dlopen calls (Gary Benson, BZ 698001). +- [python] Fix crash when pretty printer fails (Phil Muldoon, BZ 712715). +- Fix crash on invalid C++ mangled names (BZ 729283). + +* Fri Jul 29 2011 Jan Kratochvil - 7.3.50.20110722-3.fc16 +- Fix regression from VLA merge affecting -O0 -g watchpoints. + +* Fri Jul 29 2011 Jan Kratochvil - 7.3.50.20110722-2.fc16 +- Include gcc -g3 .debug_macro implementation by Tom Tromey. + +* Sat Jul 23 2011 Jan Kratochvil - 7.3.50.20110722-1.fc16 +- Rebase to FSF GDB 7.3.50.20110722. +- Improve gcc-4.6 stdarg false prologue end workaround (GDB PR 12435 + GCC PR 47471). + +* Sun Jul 3 2011 Jan Kratochvil - 7.2.90.20110703-40.fc15 +- Rebase to FSF GDB 7.2.90.20110703 (which is a 7.3 pre-release). + - Adjust the `print errno' patch due to the DW_AT_linkage_name following again. + +* Fri Jun 24 2011 Jan Kratochvil - 7.2.90.20110525-39.fc15 +- Fix install-info for the gdb-doc subpackage (BZ 715228). + +* Wed May 25 2011 Jan Kratochvil - 7.2.90.20110525-38.fc15 +- Rebase to FSF GDB 7.2.90.20110525 (which is a 7.3 pre-release). +- [stap] Fix double free (Sergio Durigan Junior). + +* Tue May 3 2011 Jan Kratochvil - 7.2.90.20110429-37.fc15 +- Search also for . files in /usr/lib/debug/.build-id (BZ 641377). + +* Mon May 2 2011 Jan Kratochvil - 7.2.90.20110429-36.fc15 +- Bundle readline-6.2 with a workaround of skipped "ask" (BZ 701131). + - Use --without-system-readline, disable Requires and BuildRequires of readline. + - Drop gdb-6.5-readline-long-line-crash.patch and gdb-readline-6.0-signal.patch. + +* Fri Apr 29 2011 Jan Kratochvil - 7.2.90.20110429-35.fc15 +- Rebase to FSF GDB 7.2.90.20110429 (which is a 7.3 pre-release). +- Fix -O2 -g breakpoints internal error + prologue skipping (BZ 612253). +- Fix case insensitive symbols for Fortran by iFort (BZ 645773). +- Fix physname-related CU expansion issue for C++ (PR 12708). +- Fix Python access to inlined frames (BZ 694824). + +* Mon Apr 11 2011 Jan Kratochvil - 7.2.90.20110411-34.fc15 +- Rebase to FSF GDB 7.2.90.20110411 (which is a 7.3 pre-release). +- Include the proper fix for anonymous struct typedefs (Tom Tromey, BZ 672230). + +* Wed Mar 30 2011 Fabio M. Di Nitto - 7.2.50.20110328-33.fc15 +- Cleanup spec file to add sparc|sparcv9|sparc64. +- Add sparc specific workarounds to toolchain badness: + - disable mmap in bdf/ via --without-mmap configure option. + - add patch to not build mmap support on sparc for gdb/. + - gdb code is NOT at fault, but we need a working gdb while we sort out + the toolchain and rebuild all packages. this workaround is NOT for upstream. + +* Tue Mar 29 2011 Jan Kratochvil - 7.2.50.20110328-32.fc15 +- Fix occasional crash on `print errno' with no -pthread and no -g3 (BZ 690908). + +* Mon Mar 28 2011 Jan Kratochvil - 7.2.50.20110328-31.fc15 +- Rebase to FSF GDB 7.2.50.20110328 (which is a 7.3 pre-release). +- Bundle %%{libstdcxxpython}.tar.bz2 unconditionally - for rebulds on RHELs. + +* Sun Mar 20 2011 Jan Kratochvil - 7.2.50.20110320-30.fc15 +- Fix threading internal error on corrupted memory (BZ 677654). +- Fix i386 rwatch+awatch before run (BZ 688788, on top of BZ 541866). + +* Sun Mar 20 2011 Jan Kratochvil - 7.2.50.20110320-29.fc15 +- Rebase to FSF GDB 7.2.50.20110320 (which is a 7.3 pre-release). +- Merge archer-sergiodj-stap, the SystemTap probes breakpoints feature. + - [stap] Fix -O2 warnings. +- Fix Ada support crash on uninitialized gdbarch. + +* Sat Mar 5 2011 Jan Kratochvil - 7.2.50.20110305-28.fc15 +- Rebase to FSF GDB 7.2.50.20110305 (which is a 7.3 pre-release). + +* Fri Feb 25 2011 Jan Kratochvil - 7.2.50.20110222-27.fc15 +- Include doc also in the PDF form; new BuildRequires: texinfo-tex. + +* Wed Feb 23 2011 Jan Kratochvil - 7.2.50.20110222-26.fc15 +- Rebase to FSF GDB 7.2.50.20110222 (which is a 7.3 pre-release). +- Fix attach/core-load of {,un}prelinked i386 libs (bugreport by Michal Toman). + +* Mon Feb 21 2011 Jan Kratochvil - 7.2.50.20110218-25.fc15 +- Drop %%{_datadir}/gdb/syscalls/* for unsupported arches. + +* Fri Feb 18 2011 Jan Kratochvil - 7.2.50.20110218-24.fc15 +- Rebase to FSF GDB 7.2.50.20110218 (which is a 7.3 pre-release). +- [vla] Fox Fortran vector slices for allocated arrays (for BZ 609782). + +* Tue Feb 15 2011 Jan Kratochvil - 7.2.50.20110213-23.fc15 +- Move the GFDL License to gdb-doc. + +* Tue Feb 15 2011 Jan Kratochvil - 7.2.50.20110213-22.fc15 +- Fix gdb-doc Group to be Documentation, also provide it as noarch. + +* Tue Feb 15 2011 Jan Kratochvil - 7.2.50.20110213-21.fc15 +- Drop non-user (gdbint) and obsolete (stabs) documentation. +- Install also HTML files besides the INFO file. +- Create new subpackage gdb-doc for both INFO and HTML files. + +* Sun Feb 13 2011 Jan Kratochvil - 7.2.50.20110213-20.fc15 +- Rebase to FSF GDB 7.2.50.20110213 (which is a 7.3 pre-release). +- Fix occasionall unfound source lines (affecting at least glibc debugging). +- Fix const/volatile qualifiers of C++ types (PR c++/12328). +- Be backward compatible for --rebuild with <=fc14 librpm.so.1. + +* Tue Feb 08 2011 Fedora Release Engineering - 7.2.50.20110206-19.fc15 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + +* Sun Feb 6 2011 Jan Kratochvil - 7.2.50.20110206-18.fc15 +- Fix regressions on C++ names resolving (PR 11734, PR 12273, Keith Seitz). + +* Sun Feb 6 2011 Jan Kratochvil - 7.2.50.20110206-17.fc15 +- Rebase to FSF GDB 7.2.50.20110206 (which is a 7.3 pre-release). + +* Thu Jan 27 2011 Jan Kratochvil - 7.2.50.20110125-16.fc15 +- Fix Python new-backtrace command (BZ 672235, Phil Muldoon). + +* Wed Jan 26 2011 Jan Kratochvil - 7.2.50.20110125-15.fc15 +- Temporary fix of F15 gcc-4.6 child DIEs of DW_TAG_typedef (BZ 672230). +- Workaround gcc-4.6 stdarg false prologue end (GDB PR 12435 + GCC PR 47471). + +* Tue Jan 25 2011 Jan Kratochvil - 7.2.50.20110125-14.fc15 +- Rebase to FSF GDB 7.2.50.20110125 (which is a 7.3 pre-release). +- Fix discontiguous address ranges in .gdb_index - v3->v4 (BZ 672281). +- Fix DWARF-3+ DW_AT_accessibility default assumption for F15 gcc-4.6. + +* Thu Jan 20 2011 Jan Kratochvil - 7.2.50.20110117-13.fc15 +- Use librpm.so.2 for rpm-4.9.0 in Fedora 15. + +* Mon Jan 17 2011 Jan Kratochvil - 7.2.50.20110117-12.fc15 +- Use %%{?dist} for sanity checking tools compliance (suggested by Petr Muller). + +* Mon Jan 17 2011 Jan Kratochvil - 7.2.50.20110117-11.fc15 +- Rebase to FSF GDB 7.2.50.20110117 (which is a 7.3 pre-release). +- Fix callback-mode readline-6.0 regression for CTRL-C (for RHEL-6.0). + - Fix occasional NULL dereference of the readline-6.0 workaround (BZ 575516). + +* Sat Jan 15 2011 Jan Kratochvil - 7.2.50.20110107-10.fc15 +- [delayed-symfile] Test a backtrace regression on CFIs without DIE (BZ 614604). +- [archer-tromey-delayed-symfile] New test gdb.dwarf2/dw2-aranges.exp. +- [archer-keiths-expr-cumulative+upstream] Import C++ testcases. + - testsuite: Fix gdb-test-expr-cumulative-archer.patch compatibility. + +* Fri Jan 7 2011 Jan Kratochvil - 7.2.50.20110107-9.fc15 +- Remove --with-pythondir as no longer valid. +- Provide %%{_bindir}gdb-add-index even on RHEL-5. +- Provide again libstdc++ pretty printers for any RHEL. + +* Fri Jan 7 2011 Jan Kratochvil - 7.2.50.20110107-8.fc15 +- Rebase to FSF GDB 7.2.50.20110107 (which is a 7.3 pre-release). +- Import archer-tromey-python (BZ 666177, branch update by Phil Muldoon). + +* Tue Jan 4 2011 Jan Kratochvil - 7.2.50.20110104-7.fc15 +- Rebase to FSF GDB 7.2.50.20110104 (which is a 7.3 pre-release). +- New testcase py-prettyprint.exp:print hint_error (for BZ 611569, BZ 629236). +- New test gdb.arch/x86_64-pid0-core.exp for kernel PID 0 cores (BZ 611435). + +* Sat Jan 1 2011 Jan Kratochvil - 7.2.50.20101231-6.fc15 +- Fix --with-system-readline doc build upstream regression. + +* Sat Jan 1 2011 Jan Kratochvil - 7.2.50.20101231-5.fc15 +- Rebase to FSF GDB 7.2.50.20101231 (which is a 7.3 pre-release). +- Remove gdb-6.3-bt-past-zero-20051201.patch, gdb-archer-ada.patch and + gdb-6.3-framepczero-20040927.patch already removed from .spec before. +- Remove gdb-6.5-dwarf-stack-overflow.patch, upstreamed (Tom Tromey). +- Remove gdb-6.6-bz225783-gdb-debuginfo-paths.patch, upstreamed (Tom Tromey). +- Remove gdb-6.6-readline-system.patch, reimplemented upstream (Tom Tromey). +- Remove gdb-bz642879-elfread-sigint-stale.patch, upstreamed (Jan Kratochvil). +- Remove gdb-next-over-throw.patch, upstreamed (Tom Tromey). + +* Mon Dec 27 2010 Jan Kratochvil - 7.2.50.20101117-4.fc15 +- Provide stub %%{_sysconfdir}/gdbinit (BZ 651232). + +* Mon Dec 27 2010 Jan Kratochvil - 7.2.50.20101117-3.fc15 +- Fix ppc* compilation of PRPSINFO in the core files (BZ 662995, for BZ 254229). +- Fix (disable) non-x86* compilation of libinproctrace.so (for BZ 662995). + +* Thu Nov 18 2010 Jan Kratochvil - 7.2.50.20101117-2.fc15 +- Drop gdb-6.8-glibc-headers-compat.patch: GNU/Linux irrelevant (Tom Tromey). +- Drop gdb-6.3-terminal-fix-20050214.patch: The bug is not reproducible. +- Drop gdb-6.7-kernel-headers-compat.patch: kernel-headers seem to be fixed. +- Drop gdb-archer-ada.patch: No longer needed for Ada (Keith Seitz). +- New PR backtrace/12237, drop gdb-6.3-framepczero-20040927.patch + gdb-6.3-bt-past-zero-20051201.patch as they already had no effect. +- Drop gdb-6.8-gcc35998-ada-memory-trash.patch as a different fix is upstream. +- Drop gdb-6.3-inheritance-20050324.patch: the call is redundent (Tom Tromey). +- Drop gdb-6.3-large-core-20051206.patch: obsoleted by MAX_COPY_BYTES. + +* Thu Nov 18 2010 Jan Kratochvil - 7.2.50.20101117-1.fc15 +- Rebase to FSF GDB 7.2.50.20101117 (which is a 7.3 pre-release). + +* Sun Nov 7 2010 Jan Kratochvil - 7.2-25.fc14 +- iFort compat. - case insensitive DWARF not in lowercase (BZ 645773). + +* Thu Oct 14 2010 Jan Kratochvil - 7.2-24.fc14 +- Add gdb.spec comments on the *.patch files upstream merge status. + +* Thu Oct 14 2010 Jan Kratochvil - 7.2-23.fc14 +- Workaround librpm BZ 643031 due to its unexpected exit() calls (BZ 642879). +- Fix crash on CTRL-C while reading an ELF symbol file (BZ 642879). + +* Tue Oct 12 2010 Jan Kratochvil - 7.2-22.fc14 +- testsuite: Provide missing lib/gdb-python.exp (for BZ 639089). + +* Tue Oct 12 2010 Jan Kratochvil - 7.2-21.fc14 +- Fix python stale error state, also fix its save/restore (BZ 639089). +- Fix inferior exec of new PIE x86_64 (BZ 638979). + +* Tue Oct 12 2010 Jan Kratochvil - 7.2-20.fc14 +- Fixup Release for 20.fc14. + +* Tue Oct 12 2010 Jan Kratochvil - 7.2-19.fc14 +- Use .gdb_index v3 to fix excessive resources rqmnts (BZ 640634, Tom Tromey). + +* Wed Oct 6 2010 Jan Kratochvil - 7.2-18.fc14 +- Fix false warning: non-absolute filename: (BZ 640648). + +* Thu Sep 30 2010 Jan Kratochvil - 7.2-17.fc14 +- New Conflicts: elfutils < 0.149 due to the .gdb_index .debug support. + +* Wed Sep 29 2010 Jan Kratochvil - 7.2-16.fc14 +- [ifunc] Fix crash on deleting watchpoint of an autovariable (BZ 637770). + +* Mon Sep 27 2010 Jan Kratochvil - 7.2-15.fc14 +- Revert the -O0 switch formerly to workaround GCC BZ 634757 (cmove bug). +- Remove no longer used BuildRequires: libstdc++. +- Remove commented out python libstdc++ .spec code. + +* Sat Sep 25 2010 Jan Kratochvil - 7.2-14.fc14 +- Fixup %%{_datadir}/gdb/python/gdb timestamps for multilib conflicts. + +* Sat Sep 25 2010 Jan Kratochvil - 7.2-13.fc14 +- Fix .gdb_index for big-endian hosts (Tom Tromey). + +* Sat Sep 25 2010 Jan Kratochvil - 7.2-12.fc14 +- Fix lost siginfo_t in linux-nat (BZ 592031). + +* Sat Sep 25 2010 Jan Kratochvil - 7.2-11.fc14 +- Fix infinite loop crash on self-referencing class (BZ 627432). + +* Thu Sep 23 2010 Jan Kratochvil - 7.2-10.fc14 +- gcore/-Wl,-z,relro: Always write out all the pages until kernel gets a fix. + +* Wed Sep 22 2010 Jan Kratochvil - 7.2-9.fc14 +- Fix gcore writer for -Wl,-z,relro (PR corefiles/11804). + +* Wed Sep 22 2010 Jan Kratochvil - 7.2-8.fc14 +- Enable python by default even in Brew and on all the arches (BZ 609157). + +* Wed Sep 22 2010 Jan Kratochvil - 7.2-7.fc14 +- python: load *-gdb.py for shlibs during attach (BZ 634660). +- Fix double free crash during overload resolution (PR 12028, Sami Wagiaalla). + +* Sat Sep 18 2010 Jan Kratochvil - 7.2-6.fc14 +- Fix python gdb.solib_address (BZ 634108, fix by Phil Muldoon). +- Temporarily build with -O0 to workaround GCC BZ 634757 (cmove bug). + +* Tue Sep 14 2010 Jan Kratochvil - 7.2-5.fc14 +- Fix Ada regression when any .gdb_index library is present. + +* Sat Sep 11 2010 Jan Kratochvil - 7.2-4.fc14 +- Fix symbol lookup misses methods of current class (BZ 631158, Sami Wagiaalla). +- Fix python gdb.execute-to_string redirection (BZ 627506, with Paul Bolle). + +* Wed Sep 8 2010 Jan Kratochvil - 7.2-3.fc14 +- Do not crash on broken separate debuginfo due to old elfutils (BZ 631575). + +* Sat Sep 04 2010 Dennis Gilmore - 7.2-2.fc14 +- libinproctrace doesnt exist on sparc arches + +* Fri Sep 3 2010 Jan Kratochvil - 7.2-1.fc14 +- Formal update to the final FSF GDB release. + +* Tue Aug 24 2010 Dan Horák - 7.1.90.20100806-12.fc14 +- libinproctrace doesn't exist on s390(x) + +* Thu Aug 19 2010 Jan Kratochvil - 7.1.90.20100806-11.fc14 +- Fix crash on MI variable calling inferior function (BZ 610986). + +* Tue Aug 10 2010 Jan Kratochvil - 7.1.90.20100806-10.fc14 +- Fix /usr/bin/gdb-add-index missing -nx for gdb. +- New option --with profile (disabled by default - missing workload, BZ 615603). + +* Sat Aug 7 2010 Jan Kratochvil - 7.1.90.20100806-9.fc14 +- Fix python gdb.execute to_string pagination (BZ 620930). + +* Fri Aug 6 2010 Jan Kratochvil - 7.1.90.20100806-8.fc14 +- Out of memory is just an error, not fatal (uninitialized VLS vars, BZ 568248). + +* Fri Aug 6 2010 Jan Kratochvil - 7.1.90.20100806-7.fc14 +- Fix gcore from very small terminal windows (BZ 555076). +- Fix false `filesystem' debuginfo rpm request (BZ 599598). + +* Wed Jul 28 2010 Mamoru Tasaka - 7.1.90.20100721-6.fc14 +- Rebuild against python 2.7 + +* Thu Jul 22 2010 Jan Kratochvil - 7.1.90.20100721-5.fc14 +- Fix /usr/bin/gdb-add-index $d -> $dir typo. + +* Thu Jul 22 2010 Jan Kratochvil - 7.1.90.20100721-4.fc14 +- Import archer-tromey-python. +- Import archer-tromey-optional-psymtab (as present in FSF GDB post-7.2). + - Provide /usr/bin/gdb-add-index for rpm-build (Tom Tromey). + +* Thu Jul 22 2010 David Malcolm - 7.1.90.20100721-3.fc14 +- Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild + +* Wed Jul 21 2010 Jan Kratochvil - 7.1.90.20100721-2.fc14 +- Fix prelinked executables with sepdebug and copy relocations (BZ 614659). + +* Wed Jul 21 2010 Jan Kratochvil - 7.1.90.20100721-1.fc14 +- Rebase to FSF GDB 7.1.90.20100721 (which is 7.2 pre-release). + +* Tue Jul 13 2010 Jan Kratochvil - 7.1-29.fc14 +- Disable temporarily Python files before the new rebase is done (BZ 613710). + +* Sun Jul 11 2010 Jan Kratochvil - 7.1-28.fc14 +- Rebuild for Fedora 14. + +* Wed Jun 30 2010 Jan Kratochvil - 7.1-28.fc13 +- Print 2D C++ vectors as matrices (BZ 562763, sourceware10659, Chris Moller). + +* Wed Jun 30 2010 Jan Kratochvil - 7.1-27.fc13 +- Fix obstack corruptions on C++ (BZ 606185, Chris Moller, Jan Kratochvil). +- Improve support for typedefs in classes (BZ 602314). +- Fix `set print object on' for some non-dynamic classes (BZ 606660). + +* Wed Jun 9 2010 Jan Kratochvil - 7.1-26.fc13 +- Backport DWARF-4 support (BZ 601887, Tom Tromey). + +* Wed Jun 9 2010 Jan Kratochvil - 7.1-25.fc13 +- Fix ADL anonymous type crash (BZ 600746, Sami Wagiaalla). + +* Tue Jun 1 2010 Jan Kratochvil - 7.1-24.fc13 +- Fix crash on /proc/PID/stat race during inferior exit (BZ 596751). +- testsuite: gdb.threads/watchthreads-reorder.exp kernel-2.6.33 compat. fix. + +* Sun May 30 2010 Jan Kratochvil - 7.1-23.fc13 +- Fix and support DW_OP_*piece (Tom Tromey, BZ 589467). +- Fix follow-exec for C++ programs (bugreported by Martin Stransky). + +* Mon May 24 2010 Jan Kratochvil - 7.1-22.fc13 +- Remove core file when starting a process (BZ 594560). +- Fix lock up on loops in the solib chain (BZ 593926). +- Import fix of TUI layout internal error (BZ 595475). + +* Sun May 16 2010 Jan Kratochvil - 7.1-21.fc13 +- Make gdb-6.8-bz254229-gcore-prpsinfo.patch RHEL-5 /usr/bin/patch compatible + (bugreported by Jonas Maebe). + +* Thu May 13 2010 Jan Kratochvil - 7.1-20.fc13 +- Fix crash on VLA bound referencing an optimized-out variable (BZ 591879). +- Re-enable the BZ 575292 and BZ 585445 C++ fix using an updated patch. + +* Wed May 12 2010 Jan Kratochvil - 7.1-19.fc13 +- Backport -completion bug on anonymous structure fields (BZ 590648). +- testsuite: Fix gdb.base/vla-overflow.exp FAILing on s390x (BZ 590635). +- Workaround non-stop moribund locations exploited by kernel utrace (BZ 590623). + +* Thu Apr 29 2010 Jan Kratochvil - 7.1-18.fc13 +- Make _Unwind_DebugHook independent from step-resume breakpoint (Tom Tromey). + +* Tue Apr 27 2010 Jan Kratochvil - 7.1-17.fc13 +- Fail gracefully if the _Unwind_DebugHook arg. is optimized out (Tom Tromey). + +* Tue Apr 27 2010 Jan Kratochvil - 7.1-16.fc13 +- Temporarily workaround the crash of BZ 575292 as there was now BZ 585445. + +* Mon Apr 26 2010 Jan Kratochvil - 7.1-15.fc13 +- Fix crash when using GNU IFUNC call from breakpoint condition. +- Avoid internal error by disabling the previous BZ 575292 fix (BZ 585445). + +* Thu Apr 22 2010 Jan Kratochvil - 7.1-14.fc13 +- Fix crash on C++ types in some debug info files (BZ 575292, Keith Seitz). +- Pretty printers not well documented (BZ 570635, Tom Tromey, Jan Kratochvil). + +* Fri Apr 16 2010 Jan Kratochvil - 7.1-13.fc13 +- archer-jankratochvil-fedora13 commit: 39998c496988faaa1509cc6ab76b5c4777659bf4 +- [vla] Fix boundaries for arrays on -O2 -g (support bound-ref->var->loclist). +- [vla] Fix copy_type_recursive for unavailable variables (Joost van der Sluis). + +* Sun Apr 11 2010 Jan Kratochvil - 7.1-12.fc13 +- Fix crash on trying to load invalid executable (BZ 581215). + +* Thu Apr 8 2010 Jan Kratochvil - 7.1-11.fc13 +- testsuite: Fix gdb.base/gstack.exp also for ppc64 inferiors (for BZ 579793). + +* Thu Apr 8 2010 Jan Kratochvil - 7.1-10.fc13 +- Fix s390 --with testsuite Buildrequiers to be (s390-32) (BZ 580347, Cai Qian). + +* Wed Apr 7 2010 Jan Kratochvil - 7.1-9.fc13 +- Fix gstack to print even the frame #0. New gdb.base/gstack.exp. (BZ 579793) +- Merge gdb-6.3-gstack-without-path-20060414.p* into gdb-6.3-gstack-20050411.p*, + no real code change. + +* Mon Apr 5 2010 Jan Kratochvil - 7.1-8.fc13 +- Fix breakpoint at *_start (BZ 162775, bugreport by John Reiser). + +* Sat Apr 3 2010 Jan Kratochvil - 7.1-7.fc13 +- Fix ppc build of the AVX registers support (for BZ 578250). + +* Sat Apr 3 2010 Jan Kratochvil - 7.1-6.fc13 +- Support AVX registers (BZ 578250). + +* Sat Apr 3 2010 Jan Kratochvil - 7.1-5.fc13 +- Fix dangling displays in separate debuginfo (BZ 574483). + +* Wed Mar 31 2010 Jan Kratochvil - 7.1-4.fc13 +- Remove gdb-readline-6.0-signal.patch with a bug causing crash while no longer + required with F-13 readline-6.1 (BZ 575516) + +* Mon Mar 29 2010 Jan Kratochvil - 7.1-3.fc13 +- [expr-cumulative] using-directive: Fix memory leak (Sami Wagiaalla). + +* Mon Mar 29 2010 Jan Kratochvil - 7.1-2.fc13 +- Drop obsoleted `gdb-archer-pie-0315-breakpoint_address_match.patch'. +- Do not consider memory error on reading _r_debug->r_map as fatal (BZ 576742). + - PIE: Attach binary even after re-prelinked underneath. + - PIE: Attach binary even after ld.so re-prelinked underneath. + - PIE: Fix occasional error attaching i686 binary (BZ 576742). +- testsuite: Fix unstable results of gdb.base/prelink.exp. + +* Thu Mar 25 2010 Jan Kratochvil - 7.1-1.fc13 +- Update to new FSF GDB release. + +* Mon Mar 15 2010 Jan Kratochvil - 7.0.90.20100312-24.fc13 +- Drop gdb-6.5-bz218379-ppc-solib-trampoline-fix.patch having false symbols + resolving (related to BZ 573277). + +* Fri Mar 12 2010 Jan Kratochvil - 7.0.90.20100312-23.fc13 +- Update to new FSF GDB snapshot. +- Fix double-free on std::terminate handler (Tom Tromey, BZ 562975). + +* Wed Mar 10 2010 Jan Kratochvil - 7.0.90.20100306-22.fc13 +- Another License update. + +* Wed Mar 10 2010 Jan Kratochvil - 7.0.90.20100306-21.fc13 +- Update License for all the licenses contained in .src.rpm. + +* Mon Mar 8 2010 Jan Kratochvil - 7.0.90.20100306-20.fc13 +- Remove unapplied: gdb-6.8-inlining-addon.patch gdb-6.8-inlining-by-name.patch + +* Mon Mar 8 2010 Jan Kratochvil - 7.0.90.20100306-19.fc13 +- Include also %%doc COPYING3 (review by Petr Machata). +- Remove URL for Source (review by Matej Cepl). + +* Sun Mar 7 2010 Jan Kratochvil - 7.0.90.20100306-18.fc13 +- archer-jankratochvil-fedora13 commit: 59c35a31f0981a0f0b884b32c91ae6325b2126cd + +* Sun Feb 28 2010 Jan Kratochvil - 7.0.50.20100203-17.fc13 +- Fix false warning: section .gnu.liblist not found in ... +- Fix crash on stale addrinfo->sectindex (more sensitive due to the PIE patch). + +* Fri Feb 26 2010 Jan Kratochvil - 7.0.50.20100203-16.fc13 +- Fix ia64 part of the bt-clone-stop.exp fix. +- Fix gdb.ada/* regressions (Keith Seitz). +- Remove false gdb_assert on $sp underflow. + +* Mon Feb 8 2010 Jan Kratochvil - 7.0.50.20100203-15.fc13 +- Fix i386+x86_64 rwatch+awatch before run, regression against 6.8 (BZ 541866). + +* Wed Feb 3 2010 Jan Kratochvil - 7.0.50.20100203-14.fc13 +- Rediff gdb-6.8-bz254229-gcore-prpsinfo.patch for older patch(1) compatibility. + +* Wed Feb 3 2010 Jan Kratochvil - 7.0.50.20100203-13.fc13 +- archer-jankratochvil-fedora13 commit: 59c35a31f0981a0f0b884b32c91ae6325b2126cd +- Fortran: Fix regression on setting breakpoint at toplevel symbols (BZ 559291; + David Moore, Intel). + +* Mon Feb 1 2010 Jan Kratochvil - 7.0.50.20100128-12.fc13 +- archer-jankratochvil-fedora13 commit: 5a573e8b26a2f0a6947d4c0249e43e5456610860 +- Remove ExcludeArch on ia64 as it is now fixed up. + +* Sun Jan 31 2010 Jan Kratochvil - 7.0.50.20100128-11.fc13 +- Fix failed gdb_assert due to the PIE patchset (BZ 559414). + +* Thu Jan 28 2010 Jan Kratochvil - 7.0.50.20100128-10.fc13 +- Upgrade to the FSF GDB snapshot: 7.0.50.20100128 +- archer-jankratochvil-fedora13 commit: 39c5a8b75fad3acd7204903db5dee025055a4594 + - Fix a regression on "AAA::ALPHA" test due to a merge from FSF GDB. +- Fix a regression of previous release due to false identification as core file. +- Move ifunc .patch into the GIT-managed archer-jankratochvil-fedora13 branch. +- Update gdb.pie/corefile.exp from 2007-01-26 FSF GDB commit by Andreas Schwab. + +* Mon Jan 25 2010 Jan Kratochvil - 7.0.50.20100121-9.fc13 +- Enable loading a core file just as a single argument to /usr/bin/gdb. + +* Sun Jan 24 2010 Jan Kratochvil - 7.0.50.20100121-8.fc13 +- testsuite: Fix gdb.arch/i386-bp_permanent.exp regression + +* Sun Jan 24 2010 Jan Kratochvil - 7.0.50.20100121-7.fc13 +- Update gdb.arch/powerpc-power7.exp for current binutils HEAD. + +* Fri Jan 22 2010 Jan Kratochvil - 7.0.50.20100121-6.fc13 +- Disable addon (finish) due to inline-cmds.exp: up from outer_inline2 assert. +- Fix gdb.arch/powerpc-power7.exp compatibility. + +* Fri Jan 22 2010 Jan Kratochvil - 7.0.50.20100121-5.fc13 +- Disable break-by-name on inlined functions due to a regression on parameters + of inlined functions falsely (BZ 556975 Comment 8). + +* Fri Jan 22 2010 Jan Kratochvil - 7.0.50.20100121-4.fc13 +- Adjust BuildRequires for RHELs, add ExcludeArch on ia64. +- Disable one PIE-introduced assertion on RHELs. + +* Thu Jan 21 2010 Jan Kratochvil - 7.0.50.20100121-3.fc13 +- Revert FSF GDB gdbserver tracepoints as incomplete now. + +* Thu Jan 21 2010 Jan Kratochvil - 7.0.50.20100121-2.fc13 +- archer-jankratochvil-fedora13 commit: 21e418c04290aa5d2e75543d31fe3fe5d70d6d41 +- [expr-cumulative] Fix "break expr if (cond)" regression. + +* Thu Jan 21 2010 Jan Kratochvil - 7.0.50.20100121-1.fc13 +- Upgrade to the FSF GDB snapshot: 7.0.50.20100121 +- archer-jankratochvil-fedora13 commit: ccde1530479cc966374351038057b9dda90aa251 +- [expr-cumulative] Archer branch is now included. + +* Tue Jan 19 2010 Jan Kratochvil - 7.0.50.20100118-2.fc13 +- Fix false PASS->FAIL of gdb.arch/i386-biarch-core.exp. + +* Tue Jan 19 2010 Jan Kratochvil - 7.0.50.20100118-1.fc13 +- Upgrade to the FSF GDB snapshot: 7.0.50.20100118 +- Upgrade libstdc++-v3-python to r155978 (Phil Muldoon). + +* Sat Jan 16 2010 Jan Kratochvil - 7.0.50.20100116-1.fc13 +- Upgrade to the FSF GDB snapshot: 7.0.50.20100116 +- archer-jankratochvil-fedora13 commit: 81810a20b2d2c3bf18e151de3cddfc96445b3c46 +- [expr-cumulative] Archer branch is missing in this release. +- Update rpm.org#76 workaround for rpm-4.8 using librpm.so.1. +- Dissect archer-jankratochvil-misc into Patch403...Patch408. +- Some regressions exist in this release. + +* Tue Jan 12 2010 Jan Kratochvil - 7.0.1-25.fc12 +- non-librpm missing debuginfo yumcommand now prints also --disablerepo='*' + to save some bandwidth by yum (Robin Green, BZ 554152). + +* Sun Jan 10 2010 Jan Kratochvil - 7.0.1-24.fc12 +- testsuite: BuildRequires also valgrind. + +* Fri Jan 8 2010 Jan Kratochvil - 7.0.1-23.fc12 +- Workaround missing libstdc++%%{bits_other} in Koji. + +* Fri Jan 8 2010 Jan Kratochvil - 7.0.1-22.fc12 +- Comply with new package review: + - Fix .spec Source as this is not a snapshot now. + - Convert all spaces to tabs. + - Fix missing %%defattr at %%files for gdbserver. + - Replace all hardcoded-library-path by variants of %%{_isa}. +- Include %%{_isa} for appropriate Requires and BuildRequires. + +* Thu Jan 7 2010 Jan Kratochvil - 7.0.1-21.fc12 +- [vla] Fix regression on fields of structs in internal vars (BZ 553338). +- archer-jankratochvil-fedora12 commit: 6e73988f653ba986e8742f208f17ec084292cbd5 + +* Thu Jan 7 2010 Jan Kratochvil - 7.0.1-20.fc12 +- Fix crash reading broken stabs (it377671). + +* Sun Jan 3 2010 Jan Kratochvil - 7.0.1-19.fc12 +- testsuite: Fixup false FAILs for gdb.cp/constructortest.exp. + +* Sat Jan 2 2010 Jan Kratochvil - 7.0.1-18.fc12 +- Fix regression of gdb-7.0 (from 6.8) crashing on typedefed bitfields. +- Fix related_breakpoint stale ref crash. + +* Fri Jan 1 2010 Jan Kratochvil - 7.0.1-17.fc12 +- Formal upgrade to the FSF GDB release gdb-7.0.1. + - Fix regression of gdb-7.0.1 not preserving typedef of a field. + +* Fri Jan 1 2010 Jan Kratochvil - 7.0-16.fc12 +- More RHEL-5 compatibility updates. + - Disable the build-id support by default. + - Bundle back gdbserver to the base gdb package. + - Remove bundled pstack. + - Drop the BuildRequires of rpm-devel. + +* Fri Jan 1 2010 Jan Kratochvil - 7.0-15.fc12 +- Fix error on a sw watchpoint active at function epilogue (hit on s390x). +- testsuite: Fix false MI "unknown output after running" regression. +- testsuite: Update ia64-sigtramp.exp for recent GDB. +- Implement bt-clone-stop.exp fix also for ia64. +- testsuite: Upstream condbreak.exp results stability fix (Daniel Jacobowitz). + +* Thu Dec 24 2009 Jan Kratochvil - 7.0-14.fc12 +- testsuite: Fix constructortest.exp and expand-sals.exp for gcc-4.4.2-20.fc12. + +* Mon Dec 21 2009 Jan Kratochvil - 7.0-13.fc12 +- [pie] Fix a race in testcase gdb.base/valgrind-db-attach.exp. +- Fix regression by python on ia64 due to stale current frame. +- Disable python iff RHEL-5 && (Brew || ppc64). + +* Mon Dec 21 2009 Jan Kratochvil - 7.0-12.fc12 +- Workaround build on native ppc64 host. +- More RHEL-5 compatibility updates. + - Disable warning messages new for gdb-6.8+ for RHEL-5 backward compatibility. + - Workaround RHEL-5 kernels for detaching SIGSTOPped processes (BZ 498595). + - Serialize the testsuite output to keep the order for regression checks. + - Re-enable python for all non-ppc* arches. + - More gcc44 stack exceptions when running the testsuite on RHEL-5. +- Fix backward compatibility with G++ 4.1 namespaces "::". +- Fix regression on re-setting the single ppc watchpoint slot. +- Update snapshot of FSF gdb-7.0.x branch. + - Backport fix of dcache invalidation locking up GDB on ppc64 targets. + +* Fri Dec 18 2009 Jan Kratochvil - 7.0-11.fc12 +- [pie] Fix general ppc64 regression due to a function descriptors bug. +- [pie] Fix also keeping breakpoints disabled in PIE mode. +- Import upstream -completion crash fix. +- Drop some unused patches from the repository. +- More RHEL-5 build compatibility updates. + - Use gfortran44 when running the testsuite on RHEL-5. + - Disable python there due to insufficient ppc multilib. +- Fix orphanripper hangs and thus enable it again. + +* Mon Dec 14 2009 Jan Kratochvil - 7.0-10.fc12 +- Make gdb-6.3-rh-testversion-20041202.patch to accept both RHEL and Fedora GDB. +- Adjust BuildRequires for Fedora-12, RHEL-6 and RHEL-5 builds. +- [vla] Fix compatibility of dynamic arrays with iFort (BZ 514287). +- Fix stepping through OMP parallel Fortran sections (BZ 533176). +- New fix of bp conditionals [bp_location-accel] regression (BZ 538626). + +* Mon Dec 7 2009 Jan Kratochvil - 7.0-9.fc12 +- Replace the PIE (Position Indepdent Executable) support patch by a new one. +- Drop gdb-6.3-nonthreaded-wp-20050117.patch as fuzzy + redundant. +- Fix callback-mode readline-6.0 regression for CTRL-C. +- Fix syscall restarts for amd64->i386 biarch. +- Various testsuite results stability fixes. +- Fix crash on reading stabs on 64bit (BZ 537837). +- archer-jankratochvil-fedora12 commit: 16276c1aad1366b92e687c72cab30192280e1906 +- archer-jankratochvil-pie-fedora12 ct: 2ae60b5156d43aabfe5757940eaf7b4370fb05d2 + +* Thu Dec 3 2009 Jan Kratochvil - 7.0-8.fc12 +- Fix slowness/hang when printing some variables (Sami Wagiaalla, BZ 541093). +- archer-jankratochvil-fedora12 commit: 6817a81cd411acc9579f04dcc105e9bce72859ff + +* Wed Nov 25 2009 Jan Kratochvil - 7.0-7.fc12 +- Support GNU IFUNCs - indirect functions (BZ 539590). +- Fix bp conditionals [bp_location-accel] regression (Phil Muldoon, BZ 538626). +- Fix missed breakpoint location [bp_location-accel] regression (upstream). + +* Fri Oct 30 2009 Jan Kratochvil - 7.0-6 +- Fix missing zlib-devel BuildRequires to support compressed DWARF sections. +- Include post-7.0 FSF GDB fixes. + +* Fri Oct 23 2009 Jan Kratochvil - 7.0-5 +- Make the package buildable on RHEL-5/CentOS-5 (without librpm there). +- archer-jankratochvil-fedora12 commit: 5b73ea6a0f74e63db3b504792fc1d37f548bdf5c + +* Fri Oct 23 2009 Jan Kratochvil - 7.0-4 +- Fix rpm --excludedocs (BZ 515998). + +* Thu Oct 22 2009 Jan Kratochvil - 7.0-3 +- Support multiple directories for `set debug-file-directory' (BZ 528668). + +* Mon Oct 19 2009 Jan Kratochvil - 7.0-2 +- Sync the .spec with RHEL/CentOS without EPEL, do not BuildRequires: fpc there. + +* Wed Oct 7 2009 Jan Kratochvil - 7.0-1 +- Formal upgrade to the final FSF GDB release gdb-7.0. +- Fix GNU/Linux core open: Can't read pathname for load map: Input/output error. +- archer-jankratochvil-fedora12 commit: ce4ead356654b951a49ca78d81ebfff95e758bf5 + +* Wed Sep 30 2009 Jan Kratochvil - 6.8.91.20090930-2 +- Bump release. + +* Wed Sep 30 2009 Jan Kratochvil - 6.8.91.20090930-1 +- Fix broken python "help()" command "modules" (BZ 526552). +- Upgrade to the FSF GDB gdb-7.0 snapshot: 6.8.91.20090930 +- archer-jankratochvil-fedora12 commit: 7cb860f03e2437c97239334ebe240d06f45723e0 + +* Sun Sep 27 2009 Jan Kratochvil - 6.8.91.20090925-3 +- New test for step-resume breakpoint placed in multiple threads at once. + +* Fri Sep 25 2009 Jan Kratochvil - 6.8.91.20090925-2 +- Fix buildid-loading libs w/matching name but different build-id (BZ 524572). + +* Fri Sep 25 2009 Jan Kratochvil - 6.8.91.20090925-1 +- Upgrade to the FSF GDB gdb-7.0 snapshot: 6.8.91.20090925 +- archer-jankratochvil-fedora12 commit: 4338ea85c798007c32594032f602db9fd230eba9 + - [python] Don't directly reference self.frame (Tom Tromey). + - [expr] Updates from branch (Keith Seitz). + +* Mon Sep 21 2009 Jan Kratochvil - 6.8.91.20090921-1 +- Upgrade to the FSF GDB gdb-7.0 snapshot: 6.8.91.20090921 +- archer-jankratochvil-fedora12 commit: 0d5c38dd89050c0ee1cf049656f177c170d675d4 + - [expr] Check has_stack_frames before calling find_pc_line (Sami Wagiaalla). + +* Thu Sep 17 2009 Jan Kratochvil - 6.8.91.20090917-2 +- Include bundled libstdc++ python; it will be in libstdc++-devel since gcc-4.5. + +* Thu Sep 17 2009 Jan Kratochvil - 6.8.91.20090917-1 +- Upgrade to the FSF GDB gdb-7.0 branch and snapshot: 6.8.91.20090917 +- archer-jankratochvil-fedora12 commit: 16f3f01cc2cbc15283462eaabdfcde92cf42cdc6 +- Drop the qsort_cmp workaround as resolved in FSF GDB now (BZ 515434). + +* Thu Sep 10 2009 Jan Kratochvil - 6.8.50.20090910-1 +- Upgrade to the FSF GDB gdb-6.8.50 snapshot: 6.8.50.20090910 +- archer-jankratochvil-fedora12 commit: 941eb487a42933e442cb4d11344cda96ecb8a04d + - [next-over-throw] Fix exceptions thrown during next (Tom Tromey). + - [bp_location-accel] Do not (much) slow down on 500+ breakpoints (me). + +* Thu Sep 3 2009 Jan Kratochvil - 6.8.50.20090818-8 +- archer-jankratochvil-fedora12 commit: a081d2f12945e9468edd5f4341d3e945bd0fefe9 + - [expr] Fix too slow lookups in large C++ programs (Sami Wagiaalla). + - [python] Fix varobj changed values reporting (GDB PR 10584, Tom Tromey). + +* Tue Sep 1 2009 Jan Kratochvil - 6.8.50.20090818-7 +- archer-jankratochvil-fedora12 commit: d25596676e8811b03f8c9aba6bbd04ebaa9ff5db + - [call-frame-cfa] Fix parsing CFA-relative frames (BZ 516627, Tom Tromey). + - [vla] variable length Fortran strings for -O -g code (part of BZ 508406, me). + - [python] varobj + general fixes (Tom Tromey). + +* Fri Aug 28 2009 Jan Kratochvil - 6.8.50.20090818-6 +- Real upstream fixup of qsort_cmp (BZ 515434). +- Revert bitfields regression (BZ 520129). + +* Tue Aug 25 2009 Jan Kratochvil - 6.8.50.20090818-5 +- Temporarily disable assertion checks crashing in qsort_cmp (BZ 515434). + +* Wed Aug 19 2009 Jan Kratochvil - 6.8.50.20090818-4 +- Fixup "bad type" internal error, import from FSF GDB. +- archer-jankratochvil-fedora12 commit: 2ba2bc451eb832182ef84c3934115de7a329da7c + +* Tue Aug 18 2009 Jan Kratochvil - 6.8.50.20090818-3 +- archer-jankratochvil-fedora12 commit: 850e3cb38a25cb7fdfa4cef667626ffbde51bcac +- Fix the hardware watchpoints. + +* Tue Aug 18 2009 Jan Kratochvil - 6.8.50.20090818-2 +- Fix patch fuzz 0. + +* Tue Aug 18 2009 Jan Kratochvil - 6.8.50.20090818-1 +- Upgrade to the FSF GDB gdb-6.8.50 snapshot: 6.8.50.20090818 +- archer-jankratochvil-fedora12 commit: 5e0d1cc74f119391a2c3ae25ef5749fc28674f06 + +* Wed Aug 12 2009 Jan Kratochvil - 6.8.50.20090811-4 +- Fix minor regressions introduced by the rebase from F-11 (6.8.50.20090302). + +* Tue Aug 11 2009 Jan Kratochvil - 6.8.50.20090811-3 +- archer-jankratochvil-fedora12 commit: 2888fafe63889757c6fd27ccc2f25661d43fd1a4 +- Drop archer-jankratochvil-vla VAROBJ invalidate/revalidate split to fix + regressions against FSF GDB HEAD. + +* Tue Aug 11 2009 Jan Kratochvil - 6.8.50.20090811-2 +- archer-jankratochvil-fedora12 commit: 93f5e942bdcdcc376ece452c309bedabae71def9 +- Fix "can't compute CFA for this frame" (by Tom Tromey, BZ 516627). + +* Tue Aug 11 2009 Jan Kratochvil - 6.8.50.20090811-1 +- Support constant DW_AT_data_member_location by GCC PR debug/40659 (BZ 515377). +- Fix .spec URL. +- archer-jankratochvil-fedora12 commit: 81de3c6abae4f7e3738aa9bcc0ab2f8725cce252 + +* Mon Aug 10 2009 Jan Kratochvil - 6.8.50.20090810-2 +- Upgrade to the FSF GDB gdb-6.8.50 snapshot: 6.8.50.20090810 +- archer-jankratochvil-fedora12 commit: 93ec16e6f5000dd64d433d86674e820ed0f35b72 + +* Tue Aug 4 2009 Jan Kratochvil - 6.8.50.20090803-2 +- Drop the bundled libstdc++ python - it should be packaged on its own now. + +* Tue Aug 4 2009 Jan Kratochvil - 6.8.50.20090803-1 +- Upgrade to the FSF GDB gdb-6.8.50 snapshot: 6.8.50.20090803 +- archer-jankratochvil-fedora12 commit: 0222cb1f4ddd1eda32965e464cb60b1e44e110b2 + +* Fri Jul 31 2009 Jan Kratochvil - 6.8.50.20090302-42 +- Release bump only. + +* Fri Jul 31 2009 Jan Kratochvil - 6.8.50.20090302-41 +- Fix compatibility of --with-system-readline and readline-6.0+. +- Temporarily disabled orphanripper on Fedora 12. + +* Fri Jul 24 2009 Fedora Release Engineering - 6.8.50.20090302-40 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + +* Mon Jul 6 2009 Jan Kratochvil - 6.8.50.20090302-39 +- testsuite: Fix multiple runs in parallel on a single host. +- testsuite: Remove the rpmbuild option: --with parallel +- testsuite: Run the testsuite with default rpm _smp_mflags. + +* Mon Jul 6 2009 Jan Kratochvil - 6.8.50.20090302-38 +- Archer update to the snapshot: 17bfc0488f54aeeb7a9e20ef3caa7e31e8e985fb +- Archer backport: de9c5190034b84b0a5fb4b98b05b304cda187700 + - [vla] Fix a crash regression on constant DW_AT_data_member_location. + +* Mon Jun 29 2009 Jan Kratochvil - 6.8.50.20090302-37 +- Replace the fix of cloned-TIDs with no pthread from upstream (BZ 471819). +- Fix a parallel testsuite runs incompatibility in gdb.base/gcore-shmid0.exp. + +* Mon Jun 29 2009 Jan Kratochvil - 6.8.50.20090302-36 +- Fix GDB crash on cloned-TIDs with no associated pthread (BZ 471819). +- Workaround rpm.org#76 rpm-devel requirement for debuginfo names (BZ 508193). + +* Mon Jun 22 2009 Jan Kratochvil - 6.8.50.20090302-35 +- Accelerate sorting blocks on reading a file (found on WebKit) (BZ 507267). + +* Mon Jun 22 2009 Jan Kratochvil - 6.8.50.20090302-34 +- Fix backtraces from core files with the executable found+loaded via build-id. + - Due to F-11 GCC no longer needlessly duplicating .eh_frame as .debug_frame. + +* Tue Jun 16 2009 Jan Kratochvil - 6.8.50.20090302-33 +- Archer update to the snapshot: 05c402a02716177c4ddd272a6e312cbd2908ed68 +- Archer backport: 05c402a02716177c4ddd272a6e312cbd2908ed68 + - Remove the [archer-pmuldoon-exception-rewind-master] branch. + - Include this functionality as a FSF GDB accepted patchset. + +* Mon Jun 15 2009 Jan Kratochvil - 6.8.50.20090302-32 +- Fix crash on pending breakpoints with PIE (position-indep.-exec.) (BZ 505943). + +* Fri Jun 12 2009 Jan Kratochvil - 6.8.50.20090302-31 +- Fix an occasional crash during printing of missing debuginfo rpms (BZ 505401). + +* Fri Jun 12 2009 Jan Kratochvil - 6.8.50.20090302-30 +- Implement DW_OP_call_frame_cfa (for recent GCC). + +* Thu Jun 11 2009 Jan Kratochvil - 6.8.50.20090302-29 +- Archer update to the snapshot: 30c13da4efe18f43ee34aa4b29bc86e1a53de548 +- Archer backport: 30c13da4efe18f43ee34aa4b29bc86e1a53de548 + - Fix dereferencing unbound C arrays (BZ 505163). + +* Wed Jun 10 2009 Jan Kratochvil - 6.8.50.20090302-28 +- Archer update to the snapshot: 000db8b7bfef8581ef099ccca8689cfddfea1be8 +- Archer backport: b8d3bea36b137effc929e02c4dadf73716cb330b + - Ignore explicit die representing global scope '::' (gcc 4.1 bug). +- Archer backport: c2d5c4a39b10994d86d8f2f90dfed769e8f216f3 + - Fix parsing DW_AT_const_value using DW_FORM_string +- Archer backport: 8d9ab68fc0955c9de6320bec2821a21e3244600d + + db41e11ae0a3aec7120ad6ce86450d838af74dd6 + - Fix Fortran modules/namespaces parsing (but no change was visible in F11). +- Archer backport: 000db8b7bfef8581ef099ccca8689cfddfea1be8 + - Fix "some Python error when displaying some C++ objects" (BZ 504356). +- testsuite: Support new rpmbuild option: --with parallel +- testsuite: gdb-orphanripper.c: Fix uninitialized `termios.c_line'. +- Fix crashes due to (missing) varobj revalidation, for VLA (for BZ 377541). +- Archer backport: 58dcda94ac5d6398f47382505e9d3d9d866d79bf + + f3de7bbd655337fe6705aeaafcc970deff3dd5d5 + - Implement Fortran modules namespaces (BZ 466118). +- Fix crash in the charset support. + +* Thu Apr 30 2009 Jan Kratochvil - 6.8.50.20090302-27 +- Fix race in the ia64 testcase `gdb-6.3-rh-testlibunwind-20041202.patch'. + +* Mon Apr 27 2009 Jan Kratochvil - 6.8.50.20090302-26 +- Support a new rpmbuild option: --without python + +* Mon Apr 27 2009 Jan Kratochvil - 6.8.50.20090302-25 +- The Koji build failures may have been by forgotten check-in of the Patch360. + +* Mon Apr 27 2009 Jan Kratochvil - 6.8.50.20090302-24 +- Another new Koji build fix attempt now by: BuildPreReq: python + +* Mon Apr 27 2009 Jan Kratochvil - 6.8.50.20090302-23 +- Fix BuildRequires for new Koji. + +* Mon Apr 27 2009 Jan Kratochvil - 6.8.50.20090302-22 +- Fix pstack/gstack cutting very long lines (BZ 497849). + +* Sun Apr 19 2009 Jan Kratochvil - 6.8.50.20090302-21 +- New test for parsing elf64-i386 files for kdump PAE vmcore dumps (BZ 457187). + +* Thu Apr 16 2009 Jan Kratochvil - 6.8.50.20090302-20 +- Fix crash in the charset support. + +* Wed Apr 15 2009 Jan Kratochvil - 6.8.50.20090302-19 +- Fix crash on pretty-printer reading uninitialized std::string (BZ 495781). + +* Mon Apr 13 2009 Jan Kratochvil - 6.8.50.20090302-18 +- Archer update to the snapshot: d1fee5066408a09423621d1ebc64e6d3e248ed08 +- Archer backport: 4854339f75bdaf4b228fc35579bddbb2a1fecdc1 + - Fix Python FrameIterator. + +* Mon Apr 13 2009 Jan Kratochvil - 6.8.50.20090302-17 +- Archer update to the snapshot: 7c250ce99c90cf6097e2ec55ea0f205830979cee +- Archer backport: c14d9ab7eef43281b2052c885f89d2db96fb5f8e + - Revert a change regressing: gdb.objc/basicclass.exp +- Archer backport: ebd649b96e61a1fb481801b65d827bca998c6633 + + 1f080e897996d60ab7fde20423e2947512115667 + + 1948198702b51b31d79793fc49434b529b4e245f + + e107fb9687bb1e7f74170aa3d19c4a8f6edbb10f + + 1e012c996e121cb35053d239a46bd5dc65b0ce60 + - Update the Python API from upstream. +- Archer backport: d3c83ad5ec9f7672b87af9ad29279f459e53da11 + - Fix a Python branch crash. + +* Mon Apr 13 2009 Dennis Gilmore - 6.8.50.20090302-16 +- enable gdbserver package on sparc64 + +* Sun Apr 5 2009 Jan Kratochvil - 6.8.50.20090302-15 +- Archer update to the snapshot: 7c7c77576669d17ad5072daa47ea3a4fd954483d +- Archer backport: 7c7c77576669d17ad5072daa47ea3a4fd954483d (Peter Bergner) + - Disassemble Power7 instructions right in the default/only -Many GDB mode. + +* Sun Apr 5 2009 Jan Kratochvil - 6.8.50.20090302-14 +- Archer update to the snapshot: f6273d446ff87e50976600ba3f71b88d61043e20 +- Archer backport: f6273d446ff87e50976600ba3f71b88d61043e20 + - Use pretty-printers to print base classes inside a derived class. + +* Mon Mar 30 2009 Jan Kratochvil - 6.8.50.20090302-13 +- Archer update to the snapshot: d144a3633454046aaeae3e2c369c271834431d36 +- Archer backport: a2c49b7640ebe7ce1376902d48d5bbbee600996b + - Fixup compilation older GCCs. +- Archer backport: fe48224ce1bd22f37a7fa6d111d54c1a340392bf + - KFAIL 4 cases of: gdb.arch/powerpc-power7.exp +- Archer backport: d144a3633454046aaeae3e2c369c271834431d36 + - Fix C local extern variables (requires gcc-4.4.0-0.30). + +* Fri Mar 27 2009 Jan Kratochvil - 6.8.50.20090302-12 +- Archer update to the snapshot: 837d9879980148af05eae540d92caeb7200f1813 +- Archer backport: 8340d06295c8db80c544503458305197891e0348 + - Fixes [master] regression for Eclipse CDT testsuite. +- Archer backport: 16328456d5740917ade0a49bcecc14c4564b9a99 + - Fixes #2 [expr] compatibility with gcc-4.4 on gdb.cp/namespace-using.exp. +- Rebase [expr] on the Keith Seitz's sync with FSF GDB fixing the former merge. + +* Sun Mar 22 2009 Jan Kratochvil - 6.8.50.20090302-11 +- Archer update to the snapshot: e734ed95d296a3342d4147873c4641cea6c4d7fe +- Archer backport: 1e1d73cda98b1adda884b80e07c7b4929c175628 + - Fixes [expr] compatibility with gcc-4.4 on gdb.cp/namespace-using.exp. + +* Sun Mar 15 2009 Jan Kratochvil - 6.8.50.20090302-10 +- Archer update to the snapshot: 935f217d3367a642374bc56c6b146d376fc3edab +- Archer backport: 281278326412f9d6a3fabb8adc1d419fd7ddc7d7 + - Fix [expr] crash reading invalid DWARF C++ symbol "" (BZ 490319). + +* Thu Mar 12 2009 Jan Kratochvil - 6.8.50.20090302-9 +- Archer backport: aafe933b497eee8cfab736a10bae1a90d4bceb18 + - [python] Remove duplicate target-wide-charset parameter + +* Mon Mar 9 2009 Jan Kratochvil - 6.8.50.20090302-8 +- Archer update to the snapshot: a99e30d08ade4a2df0f943b036cd653bcd12b04d +- Fixes internal error on breaking at a multi-locations C++ caller (BZ 488572). + +* Mon Mar 9 2009 Jan Kratochvil - 6.8.50.20090302-7 +- Archer update to the snapshot: ec29855686f2a78d90ebcc63765681249bbbe808 +- Temporarily place libstdc++ pretty printers in this gdb.rpm. + +* Sat Mar 7 2009 Jan Kratochvil - 6.8.50.20090302-6 +- Archer update to the snapshot: 543fb2154d3bd551344b990b911be5c6cc703504 + - Fixes [delayed-symfile] excessive `(no debugging symbols found)' messages. + +* Sat Mar 7 2009 Jan Kratochvil - 6.8.50.20090302-5 +- Improve `gdb-6.6-buildid-locate-rpm.patch' by dlopen() (+pkg-config compat.). + +* Sat Mar 7 2009 Jan Kratochvil - 6.8.50.20090302-4 +- Split `gdb-6.6-buildid-locate.patch' to `gdb-6.6-buildid-locate-rpm.patch'. + +* Sat Mar 7 2009 Jan Kratochvil - 6.8.50.20090302-3 +- Archer update to the snapshot: 6cf16c0711e844094ab694b3d929f7bd30b49f61 +- Fix crash on the inlined functions support. +- Fix crash from the PIE support, its varobj_refresh() was called only before + varobj_invalidate() which is sufficient. +- Fix BuildRequires for the `--with testsuite' runs. +- Use the newly introduced `--with-pythondir' option. +- Remove libstdcxx [python] pretty printers (as included in libstdc++ rpm now). + +* Fri Mar 06 2009 Jesse Keating - 6.8.50.20090302-2 +- Rebuild for new rpm libs + +* Mon Mar 2 2009 Jan Kratochvil - 6.8.50.20090302-1 +- Include the Archer Project: http://sourceware.org/gdb/wiki/ProjectArcher + snapshot: 8cc3753a9aad85bf53bef54c04334c60d16cb251 + * [python] Python scripting support: http://sourceware.org/gdb/wiki/PythonGdb + * [catch-syscall] Trap and display syscalls. + * [delayed-symfile] Improve startup performance by lazily read psymtabs. + * [exception-rewind] Fix fatal C++ exceptions in an inferior function call. + * [expr] Expressions, single-quote elimination, C++ input canonicalization. + * [using-directive] C++ namespaces. + * [vla] C variable length arrays / DW_FORM_block / Fortran dynamic arrays. + * [misc] Fix debuginfoless `return' (BZ 365111), fix command-line macros for + expected GCC (BZ 479914), new testcase for valgrind (for BZ 483262), + implement `info common' for Fortran, fix Fortran logical-kind=8 (BZ 465310), + fix static variable in C++ constructors (BZ 445912), fix power7 (BZ 485319). +- Upgrade to the FSF GDB gdb-6.8.50 snapshot. +- Fix parsing elf64-i386 files for kdump PAE vmcore dumps (BZ 457187). + - Turn on 64-bit BFD support, globally enable AC_SYS_LARGEFILE. + +* Tue Feb 24 2009 Fedora Release Engineering - 6.8.50.20090210-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild + +* Wed Feb 11 2009 Jan Kratochvil - 6.8.50.20090210-1 +- Upgrade to the FSF GDB gdb-6.8.50 snapshot. + +* Wed Feb 11 2009 Jan Kratochvil - 6.8.50.20090209-1 +- Upgrade to the FSF GDB gdb-6.8.50 snapshot. + +* Mon Feb 9 2009 Jan Kratochvil - 6.8.50.20081214-2 +- Fix crash / implement `finish' into inlined functions (BZ 479781). +- Drop the gdb.threads/attach-into-signal.exp change as obsolete. + +* Sun Dec 14 2008 Jan Kratochvil - 6.8.50.20081214-1 +- Upgrade to the upstream gdb-6.8.50 snapshot. + +* Mon Dec 1 2008 Jan Kratochvil - 6.8-33 +- Make `--with testsuite' BuildRequires properly conditional. + +* Mon Dec 1 2008 Stepan Kasal - 6.8-32 +- Remove trivial BuildRequires, use rpm macros in a few remaining places. + +* Tue Nov 18 2008 Jan Kratochvil - 6.8-31 +- Enable ia64 hardware watchpoints if created before starting inferior. + +* Sun Nov 9 2008 Jan Kratochvil - 6.8-30 +- Fix a race in the testcase `gdb.threads/step-thread-exit.exp'. + +* Sun Nov 9 2008 Jan Kratochvil - 6.8-29 +- Fix more the variable-length-arrays support (BZ 468266, feature BZ 377541). +- Integrate the `bt full' protection (for BZ 466901) into the VLA patch. + +* Thu Nov 6 2008 Jan Kratochvil - 6.8-28 +- Fix the "never terminate `bt full'" patch false GCC warning / build error. + +* Thu Nov 6 2008 Jan Kratochvil - 6.8-27 +- Fix resolving of variables at locations lists in prelinked libs (BZ 466901), + bugreported by Michal Babej. +- Never terminate `bt full' on a problem of variable resolving (for BZ 466901). + +* Thu Nov 6 2008 Jan Kratochvil - 6.8-26 +- Fix more the variable-length-arrays support (BZ 468266, feature BZ 377541). +- Fix the watchpoints conditionals. +- Fix on PPC spurious SIGTRAPs on active watchpoints. +- Fix occasional stepping lockup on many threads, seen on ia64. + +* Mon Nov 3 2008 Jan Kratochvil - 6.8-25 +- Fix the variable-length-arrays support (BZ 468266, feature BZ 377541). +- Fix the debuginfo-install suggestions for missing base packages (BZ 467901), + also update the rpm/yum code to no longer require _RPM_4_4_COMPAT. + +* Tue Sep 2 2008 Jan Kratochvil - 6.8-24 +- Fix PIE patch regression for loading binaries from valgrind (BZ 460319). + +* Thu Aug 28 2008 Jan Kratochvil - 6.8-23 +- Fix attaching to stopped processes, based on the upstream version now. + - Just kernel-2.6.25 neither upstream nor utrace work with it; 2.6.9 works. +- Fix occasional crash on a removed watchpoint. +- Fix false testcase FAILs for `gdb.pie/break.exp'. +- Fix a false warning (+a testcase FAIL) on s390x watchpoints. +- Fix a false FAIL on s390x `gdb.base/dump.exp'. + +* Wed Aug 27 2008 Jan Kratochvil - 6.8-22 +- Remove `gdb-6.3-nonthreaded-wp-20050117.patch' as obsoleted + regressing now. +- Make the GDB quit processing non-abortable to cleanup everything properly. +- Support DW_TAG_constant for Fortran in recent Fedora/RH GCCs. +- Fix crash on DW_TAG_module for Fortran in recent Fedora/RH GCCs. +- Readd resolving of bare names of constructors and destructors. +- Include various vendor testcases: + - Leftover zombie process (BZ 243845). + - Multithreaded watchpoints (`gdb.threads/watchthreads2.exp'). + - PIE testcases (`gdb.pie/*'). + - C++ contructors/destructors (`gdb.cp/constructortest.exp'). + +* Sat Aug 23 2008 Jan Kratochvil - 6.8-21 +- Fix MI debuginfo print on reloaded exec, found by Denys Vlasenko (BZ 459414). +- Extend the Fortran dynamic variables patch also for dynamic Fortran strings. + +* Wed Aug 13 2008 Jan Kratochvil - 6.8-20 +- Temporarily disable attaching to a stopped process (BZ 453688) + - To be reintroduced after a fix of the kernel BZ 454404. + +* Mon Aug 4 2008 Jan Kratochvil - 6.8-19 +- Fix `errno' printing on nonthreaded non-g3 inferiors (TLS minsym is absolute). + +* Fri Aug 1 2008 Jan Kratochvil - 6.8-18 +- Fix powerpc recent secure PLTs handling (shared library calls) (BZ 452960). +- Fix the testsuite .spec runner to run biarch also on ppc. +- Reenable testcases threadcrash.exp, chng-syms.exp, checkpoint.exp (BZ 207002). +- Fix PRPSINFO in the core files dumped by gcore (BZ 254229), reformatted patch + from Denys Vlasenko. +- Fix register assignments with no GDB stack frames, Denys Vlasenko (BZ 436037). + +* Mon Jul 14 2008 Jan Kratochvil - 6.8-17 +- Refresh the patchset with fuzz 0 (for new rpmbuild). + +* Mon Jul 14 2008 Jan Kratochvil - 6.8-16 +- Rebuild with the new rpm-4.5.90 in the buildroot. + +* Sat Jul 12 2008 Jan Kratochvil - 6.8-15 +- Temporary rpm-4.5.90 compatibility workaround by Panu Matilainen. +- Fix a regression in the constant watchpoints fix, found by Daniel Jacobowitz. +- Fix the prelink testcase for false FAILs on i386. + +* Tue Jul 8 2008 Jan Kratochvil - 6.8-14 +- Fix crash due to calling an inferior function right after a watchpoint stop. + +* Thu Jul 3 2008 Jan Kratochvil - 6.8-13 +- Support transparent debugging of inlined functions for an optimized code. + +* Fri Jun 20 2008 Jan Kratochvil - 6.8-12 +- Remove the gdb/gdbtui binaries duplicity. + +* Tue Jun 17 2008 Jan Kratochvil - 6.8-11 +- Fix the testsuite run for ia64 (where no -m64 is present). +- Test a crash on libraries missing the .text section. +- Protect development in the build tree by automatic Makefile dependencies. +- Refuse creating watchpoints of an address value, suggested by Martin Stransky. +- Disable randomization (such as by setarch -R), suggested by Jakub Jelinek. +- Fix compatibility with recent glibc headers. + +* Sun Jun 1 2008 Jan Kratochvil - 6.8-10 +- Fix crash on a watchpoint update on an inferior stop. +- Fix the s390x part of the hardware watchpoints after a fork. + +* Thu May 22 2008 Jan Kratochvil - 6.8-9 +- Fix memory trashing on binaries from GNAT/Ada (workaround GCC PR 35998). + +* Thu May 15 2008 Tom "spot" Callaway - 6.8-8 +- Silence memcpy check which returns false positive (sparc64) + +* Thu May 15 2008 Tom "spot" Callaway - 6.8-7 +- patch from DaveM for sparc/sparc64 +- touch up spec to enable sparcv9/sparc64 + +* Sat May 3 2008 Jan Kratochvil - 6.8-6 +- Fix gdb.base/gcore-shmid0.exp to be unresolved on recent kernels. +- Make the testsuite results of dfp-test.exp more stable. + +* Sun Apr 27 2008 Jan Kratochvil - 6.8-5 +- Remove the kernel VDSO workaround (`no loadable ...') (kernel BZ 312011). + +* Wed Apr 23 2008 Jan Kratochvil - 6.8-4 +- Backport fix on various forms of threads tracking across exec() (BZ 442765). +- Testsuite: Include more biarch libraries on %%{multilib_64_archs}. +- Disable the build-id warnings for the testsuite run as they cause some FAILs. +- Fix PIE support for 32bit inferiors on 64bit debugger. +- Fix trashing memory on one ada/gnat testcase. +- Make the testsuite results on ada more stable. + +* Wed Apr 16 2008 Jan Kratochvil - 6.8-3 +- Fix ia64 compilation errors (Yi Zhan, BZ 442684). +- Fix build on non-standard rpm-devel includes (Robert Scheck, BZ 442449). +- Do not run the PIE mode for the testsuite during `--with upstream'. +- Fix test of the crash on a sw watchpoint condition getting out of the scope. + +* Fri Apr 11 2008 Jan Kratochvil - 6.8-2 +- Fix a regression due to PIE of reloading a changed exec file (BZ 433410). +- Include also biarch libgcc on %%{multilib_64_archs} for the testsuite. +- Cosmetic fix of a testcase sanity breakpoint setting (part of BZ 233852). +- New test of hiding unexpected breakpoints on intentional step commands. +- New test of GCORE for shmid 0 shared memory mappings. +- New test of a crash on `focus cmd', `focus prev' commands. +- Fix a minor test race of the hardware watchpoints after the fork call. +- Test crash on a sw watchpoint condition getting out of the scope. + +* Fri Mar 28 2008 Jan Kratochvil - 6.8-1 +- Upgrade to the latest upstream final release gdb-6.8. + +* Mon Mar 10 2008 Jan Kratochvil - 6.7.50.20080227-3 +- build-id warnings integrated more with rpm and the lists of the warnings got + replaced usually by a single-line `debuginfo-install' advice. + - FIXME: Testsuite needs an update for the new pre-prompt messages. +- Fix the `--with upstream' compilation - gstack/pstack are now omitted. + +* Tue Mar 4 2008 Jan Kratochvil - 6.7.50.20080227-2 +- Drop the unused `ChangeLog.RedHat' file stubs. +- New rpm option `--with upstream' to drop the Fedora patches for testing. +- Drop some no longer valid .spec file comments. +- Include the Fortran dynamic arrays entry for changelog of 6.7.50.20080227-1. + +* Mon Mar 3 2008 Jan Kratochvil - 6.7.50.20080227-1 +- Upgrade to the upstream gdb-6.8 prerelease. +- Cleanup the leftover `.orig' files during %%prep. +- Add expat-devel check by the configure script (for the other-arch builds). +- `--with testsuite' now also BuildRequires: fpc +- Backport fix of a segfault + PIE regression since 6.7.1 on PIE executables. +- Update the printed GDB version string to be Fedora specific. +- Fix/implement the Fortran dynamic arrays support (BZ 377541). + +* Sat Mar 1 2008 Jan Kratochvil - 6.7.1-16 +- Run the full testsuite also in the `-fPIE -pie' mode. + +* Mon Feb 25 2008 Jan Kratochvil - 6.7.1-15 +- New --with parameters `testsuite' and `debug'. + - Testsuite is now run during the build only on explicit `--with testsuite'. +- Testsuite now possibly produces two outputs for the two GDB target arches. + +* Thu Feb 21 2008 Jan Kratochvil - 6.7.1-14 +- Rename `set debug build-id' as `set build-id-verbose', former level 1 moved + to level 2, default value is now 1, use `set build-id-verbose 0' now to + disable the missing separate debug filenames messages (BZ 432164). + +* Wed Feb 20 2008 Jan Kratochvil - 6.7.1-13 +- ia64 build fixes from Doug Chapman (BZ 428882). +- gdbserver separated into an extra package (BZ 405791). +- pstack obsoleted by included gstack (BZ 197020). +- Fix #include on kernel-headers-2.6.25-0.40.rc1.git2.fc9.x86_64. +- Drop the PowerPC simulator as no longer being compatible with Fedora binaries. + +* Thu Feb 7 2008 Jan Kratochvil - 6.7.1-12 +- build-id debug messages print now the library names unconditionally. + +* Thu Jan 24 2008 Jan Kratochvil - 6.7.1-11 +- Improve the text UI messages for the build-id debug files locating. + - Require now the rpm libraries. +- Fix false `(no debugging symbols found)' on `-readnever' runs. +- Extend the testcase `gdb.arch/powerpc-prologue.exp' for ppc64. + +* Sat Jan 12 2008 Jan Kratochvil - 6.7.1-10 +- Compilation fixup (-9 was never released). + +* Sat Jan 12 2008 Jan Kratochvil - 6.7.1-9 +- Fix also threaded inferiors for hardware watchpoints after the fork call. +- Test debugging statically linked threaded inferiors (BZ 239652). + - It requires recent glibc to work in this case properly. +- Testcase cleanup fixup of the gcore memory and time requirements of 6.7.1-8. + +* Thu Jan 10 2008 Jan Kratochvil - 6.7.1-8 +- Fix detaching from a threaded formerly stopped process with non-primary + thread currently active (general BZ 233852). + - Enable back again the testcases named `attachstop.exp' (no such exist now). + - Rename the testcase `gdb.threads/attachstop' to `gdb.threads/attachstop-mt'. +- Test ia64 memory leaks of the code using libunwind. +- Testcase delay increase (for BZ 247354). +- Test gcore memory and time requirements for large inferiors. + +* Mon Jan 7 2008 Jan Kratochvil - 6.7.1-7 +- Backport the gcc-4.3 compatibility -Werror fixes. +- Fix documentation on hardware watchpoints wrt multiple threads. +- Rename the patch file for BZ 235197 from its former name 234468. +- Fix the vendora testcase `attach-32.exp' affecting the other tests results. +- Support DW_TAG_interface_type the same way as DW_TAG_class_type (BZ 426600). + +* Mon Dec 10 2007 Jan Kratochvil - 6.7.1-6 +- Testsuite fixes for more stable/comparable results. + +* Sat Nov 24 2007 Jan Kratochvil - 6.7.1-5 +- Reduce the excessive gcc-* packages dependencies outside of mock/koji. + +* Fri Nov 16 2007 Jan Kratochvil - 6.7.1-4 +- Fix `errno' resolving across separate debuginfo files. +- Fix segfault on no file loaded, `set debug solib 1', `info sharedlibrary'. +- Extend the testsuite run for all the languages if %%{dist} is defined. +- Support gdb.fortran/ tests by substituting the g77 compiler by gfortran. + +* Sun Nov 4 2007 Jan Kratochvil - 6.7.1-3 +- Fix `errno' resolving on recent glibc with broken DW_AT_MIPS_linkage_name. +- Imported new test for 6.7 PPC hiding of call-volatile parameter register. + +* Sat Nov 3 2007 Jan Kratochvil - 6.7.1-2 +- Backport `Breakpoints at multiple locations' patch primarily for C++. + +* Thu Nov 1 2007 Jan Kratochvil - 6.7.1-1 +- Upgrade to GDB 6.7.1. Drop redundant patches, forward-port remaining ones. + +* Thu Nov 1 2007 Jan Kratochvil - 6.7-1 +- Upgrade to GDB 6.7. Drop redundant patches, forward-port remaining ones. +- Fix rereading of the main executable on its change. + +* Fri Oct 19 2007 Jan Kratochvil - 6.6-37 +- Fix hiding unexpected breakpoints on intentional step/next commands. +- Fix s390 compilation warning/failure due to a wrongly sized type-cast. + +* Sun Oct 14 2007 Jan Kratochvil - 6.6-36 +- Fix hardware watchpoints after inferior forks-off some process. + +* Sat Oct 13 2007 Jan Kratochvil - 6.6-35 +- Fix non-threaded watchpoints CTRL-C regression on `set follow child'. + +* Fri Oct 12 2007 Jan Kratochvil - 6.6-34 +- Fix gdbserver for threaded applications and recent glibc (BZ 328021). + +* Tue Oct 9 2007 Jan Kratochvil - 6.6-33 +- Fix debug load for sparse assembler files (such as vDSO32 for i386-on-x86_64). + +* Mon Oct 8 2007 Jan Kratochvil - 6.6-32 +- Set the breakpoints always to all the ctors/dtors variants (BZ 301701). +- Fix a TUI visual corruption due to the build-id warnings (BZ 320061). +- Fixed the kernel i386-on-x86_64 VDSO loading (producing `Lowest section in'). + +* Fri Oct 5 2007 Jan Kratochvil - 6.6-31 +- Fix address changes of the ctors/dtors breakpoints w/multiple PCs (BZ 301701). +- Delete an info doc file on `rpmbuild -bp' later rebuilt during `rpmbuild -bc'. + +* Tue Sep 25 2007 Jan Kratochvil - 6.6-30 +- Fix re-setting of the ctors/dtors breakpoints with multiple PCs (BZ 301701). +- Avoid one useless user question in the core files locator (build-id). + +* Sun Sep 23 2007 Jan Kratochvil - 6.6-29 +- Fixed the kernel VDSO loading (`warning: no loadable sections found in ...'). +- Fix the testcase for pending signals (from BZ 233852). + +* Sat Sep 22 2007 Jan Kratochvil - 6.6-28 +- Support also the `$allocate' and `$delete' ctor/dtor variants (BZ 301701). +- Fix the build compatibility with texinfo >= 4.10. +- Fix the testcase for pending signals (from BZ 233852). + +* Sun Sep 16 2007 Jan Kratochvil - 6.6-27 +- Fix attaching to stopped processes and/or pending signals. + +* Tue Aug 28 2007 Jan Kratochvil - 6.6-26 +- New fast verification whether the .debug file matches its peer (build-id). +- New locating of the matching binaries from the pure core file (build-id). + +* Fri Aug 17 2007 Jan Kratochvil - 6.6-25 +- Fixed excessive RPATH (related to BZ 228891). + +* Wed Aug 8 2007 Jan Kratochvil - 6.6-24 +- Fixed compatibility with the Rawhide glibc open(2) syscall sanity checking. +- Update the core_dump_elf_headers=1 compatibility code to the upstream variant. + +* Mon Aug 6 2007 Jan Kratochvil - 6.6-23 +- Update PPC unwinding patches to their upstream variants (BZ 140532). + +* Wed Jul 25 2007 Jesse Keating - 6.6-22 +- Rebuild for RH #249435 + +* Mon Jul 23 2007 Jan Kratochvil - 6.6-21 +- Fixed compatibility with Rawhide kernel fs.binfmt_elf.core_dump_elf_headers=1. +- .spec file updates to mostly pass RPMLINT - Fedora merge review (BZ 225783). +- Fixed testcase of the exit of a thread group leader (of BZ 247354). +- Cleanup any leftover testsuite processes as it may stuck mock(1) builds. + +* Sun Jul 8 2007 Jan Kratochvil - 6.6-20 +- Do not hang on exit of a thread group leader (BZ 247354). +- New test for upstream fix of VDSO decoding while attaching to an i386 process. +- Fixed BZ # 232014 -> 232015. + +* Thu Jul 5 2007 Jan Kratochvil - 6.6-19 +- Link with libreadline provided by the operating system. + +* Tue Jun 26 2007 Jan Kratochvil - 6.6-18 +- Fix PPC software watchpoints active while stepping atomic instr. (BZ 237572). + +* Thu Jun 21 2007 Jan Kratochvil - 6.6-17 +- Support for stepping over PPC atomic instruction sequences (BZ 237572). +- `set scheduler-locking step' is no longer enforced but it is now default. + +* Wed Jun 20 2007 Jan Kratochvil - 6.6-16 +- Fix attaching a stopped process on expected + upstream kernels (BZ 233852). + - Fix attaching during a pending signal being delivered. + +* Thu Jun 7 2007 Jan Kratochvil - 6.6-15 +- Testcase update to cover PPC Power6/DFP instructions disassembly (BZ 230000). +- Disable some known timeouting/failing testcases to reduce the build time. +- Fix crash on missing filenames debug info (BZ 242155). + +* Sat Apr 28 2007 Jan Kratochvil - 6.6-14 +- Fixup for the PPC Power6/DFP instructions disassembly (BZ 230000). +- New testcase for the GCORE buffer overflow (for BZ 238285, formerly 235753). + +* Wed Apr 25 2007 Jan Kratochvil - 6.6-13 +- Fix `gcore' command for 32bit PPC inferiors on 64bit PPC hosts (BZ 232015). + +* Wed Apr 25 2007 Jan Kratochvil - 6.6-12 +- Enable PowerPC to print 128-bit long double variables (BZ 237872). +- New testcase for gcore of 32bit inferiors on 64bit hosts. + +* Tue Apr 24 2007 Jan Kratochvil - 6.6-11 +- Package review, analysed by Ralf Corsepius (BZ 225783). + - Fix prelink(8) testcase for non-root $PATH missing `/usr/sbin' (BZ 225783). + - Fix debugging GDB itself - the compiled in source files paths (BZ 225783). + - Fix harmless GCORE stack buffer overflow, by _FORTIFY_SOURCE=2 (BZ 238285). + - Fix XML support - the build was missing `expat-devel'. + - Updated the `info' files handling by the spec file. + - Building now with the standard Fedora code protections - _FORTIFY_SOURCE=2. + - Use multiple CPUs for the build (%%{?_smp_mflags}). + - Separate testsuite run to its %%check section. + - Fix (remove) non-ASCII spec file characters. + - Remove system tools versions dumping - already present in mock build logs. + +* Sun Apr 22 2007 Jan Kratochvil - 6.6-10 +- Notify user of a child forked process being detached (BZ 235197). + +* Sun Apr 22 2007 Jan Kratochvil - 6.6-9 +- Allow running `/usr/bin/gcore' with provided but inaccessible tty (BZ 229517). +- Fix testcase for watchpoints in threads (for BZ 237096). +- BuildRequires now `libunwind-devel' instead of the former `libunwind'. +- Use the runtime libunwind .so.7, it requires now >= 0.99-0.1.frysk20070405cvs. + +* Sat Mar 24 2007 Jan Kratochvil - 6.6-8 +- Use definition of an empty structure as it is not an opaque type (BZ 233716). +- Fixed the gdb.base/attachstop.exp testcase false 2 FAILs. + +* Thu Mar 15 2007 Jan Kratochvil - 6.6-7 +- Suggest SELinux permissions problem; no assertion failure anymore (BZ 232371). + +* Wed Mar 14 2007 Jan Kratochvil - 6.6-6 +- Fix occasional dwarf2_read_address: Corrupted DWARF expression (BZ 232353). + +* Mon Mar 12 2007 Jan Kratochvil - 6.6-5 +- Temporary support for shared libraries >2GB on 64bit hosts. (BZ 231832) + +* Sun Feb 25 2007 Jan Kratochvil - 6.6-4 +- Backport + testcase for PPC Power6/DFP instructions disassembly (BZ 230000). + +* Mon Feb 5 2007 Jan Kratochvil - 6.6-3 +- Fix a race during attaching to dying threads; backport (BZ 209445). +- Testcase of unwinding has now marked its unsolvable cases (for BZ 140532). + +* Fri Jan 26 2007 Jan Kratochvil - 6.6-2 +- Backported post gdb-6.6 release PPC `show endian' fixup. +- Fix displaying of numeric char arrays as strings (BZ 224128). +- Simplified patches by merging upstream accepted ones into a single file. + +* Sat Jan 20 2007 Jan Kratochvil - 6.6-1 +- Upgrade to GDB 6.6. Drop redundant patches, forward-port remaining ones. +- Backported post gdb-6.6 release ia64 unwinding fixups. +- Testcase for exec() from threaded program (BZ 202689). + +* Mon Jan 15 2007 Jan Kratochvil - 6.5-27 +- Fix the testsuite results broken in 6.5-26, stop invalid testsuite runs. + +* Sat Jan 13 2007 Jan Kratochvil - 6.5-26 +- Fix unwinding of non-debug (.eh_frame) PPC code, Andreas Schwab (BZ 140532). +- Fix unwinding of debug (.debug_frame) PPC code, workaround GCC (BZ 140532). +- Fix missing testsuite .log output of testcases using get_compiler_info(). + +* Fri Jan 12 2007 Jan Kratochvil - 6.5-25 +- Fix unwinding of non-CFI (w/o debuginfo) PPC code by recent GCC (BZ 140532). + +* Thu Jan 11 2007 Jan Kratochvil - 6.5-24 +- Backport readline history for input mode commands like `command' (BZ 215816). + +* Tue Jan 9 2007 Jan Kratochvil - 6.5-23 +- Find symbols properly at their original (included) file (BZ 109921). +- Remove the stuck mock(1) builds disfunctional workaround (-> mock BZ 221351). + +* Sat Dec 30 2006 Jan Kratochvil - 6.5-22 +- Fix unwinding crash on older gcj(1) code (extended CFI support) (BZ 165025). +- Include testcase for the readline history of input mode commands (BZ 215816). + +* Sat Dec 23 2006 Jan Kratochvil - 6.5-21 +- Try to reduce sideeffects of skipping ppc .so libs trampolines (BZ 218379). +- Fix lockup on trampoline vs. its function lookup; unreproducible (BZ 218379). + +* Tue Dec 19 2006 Jan Kratochvil - 6.5-20 +- Fix bogus 0x0 unwind of the thread's topmost function clone(3) (BZ 216711). +- Testcase for readline segfault on excessively long hand-typed lines. + +* Tue Dec 12 2006 Jan Kratochvil - 6.5-19 +- Fix attachment also to a threaded stopped process (BZ 219118). +- Cleanup any leftover testsuite processes as it may stuck mock(1) builds. + +* Sat Nov 25 2006 Jan Kratochvil - 6.5-18 +- Fix readline history for input mode commands like `command' (BZ 215816). + +* Thu Nov 16 2006 Jan Kratochvil - 6.5-17 +- Bugfix testcase typo of gdb-6.5-16. + +* Thu Nov 16 2006 Jan Kratochvil - 6.5-16 +- Provide testcase for accessing the last address space byte. + +* Thu Nov 9 2006 Jan Kratochvil - 6.5-15 +- Fix readline segfault on excessively long hand-typed lines. + +* Thu Nov 2 2006 Jan Kratochvil - 6.5-14 +- Fix "??" resolving of symbols from (non-prelinked) debuginfo packages. +- Fix "??" resolving of symbols from overlapping functions (nanosleep(3)). +- Also disable testcase "checkpoint.exp" for a possible kernel Bug 207002. +- Provided (disabled during build) threading testsuite from BEA. + +* Sat Oct 14 2006 Jan Kratochvil - 6.5-13 +- Fix deadlock accessing last address space byte; for corrupted backtraces. + +* Sun Oct 8 2006 Jan Kratochvil - 6.5-12 +- Disabled IPv6 until its user visible syntax gets stable upstream. + +* Sun Oct 1 2006 Jan Kratochvil - 6.5-11 +- No longer disassemble invalid i386 opcodes of movQ/movA (BZ 172034). +- Simplify the IPv6 patch for gdbserver (BZ 198365). +- Suggest fixing your target architecture for gdbserver(1) (BZ 190810). +- Fix dereferencing registers for 32bit inferiors on 64bit hosts (BZ 181390). +- Fix `gcore' command for 32bit inferiors on 64bit hosts. + +* Wed Sep 27 2006 Jan Kratochvil - 6.5-10 +- Support IPv6 for gdbserver (BZ 198365). +- Temporarily disable testcase "chng-syms.exp" for a possible kernel Bug 207002. + +* Thu Sep 21 2006 Jan Kratochvil - 6.5-9 +- Fix crash on C++ symbol failing to be demangled (BZ 206813). +- Fix attach to stopped process, supersede `gdb-6.3-attach-stop-20051011.patch'. +- Fix TLS symbols resolving for objects with separate .debug file (-debuginfo). +- Fix TLS symbols resolving for shared libraries with a relative pathname. +- Support TLS symbols (+`errno' suggestion if no pthread is found) (BZ 185337). + +* Mon Sep 11 2006 Jan Kratochvil - 6.5-8 +- Fix gdb printf command argument using "%%p" (BZ 205551). + +* Mon Sep 4 2006 Alexandre Oliva - 6.5-7 +- Fix bug in patch for CVE-2006-4146. (BZ 203873, BZ 203880) + +* Thu Aug 24 2006 Alexandre Oliva - 6.5-6 +- Avoid overflows and underflows in dwarf expression computation stack. +(BZ 203873) + +* Thu Aug 24 2006 Alexandre Oliva - 6.5-5 +- Backport support for i386 nop memory instructions. +- Fix debuginfo addresses resolving for --emit-relocs Linux kernels +(BZ 203661, from Jan Kratochvil, like the remaining changes). +- Bugfix segv on the source display by ^X 1 (fixes Patch130, BZ +200048). +- Do not step into the PPC solib trampolines (BZ 200533). +- Fix exec() from threaded program, partial CVS backport (BZ 182116). +- Fix occasional failure to load shared libraries (BZ 146810). +- Bugfix object names completion (fixes Patch116, BZ 193763). +- Avoid crash of 'info threads' if stale threads exist (BZ 195429). +- Handle corrupted or missing location list information (BZ 196439). + +* Thu Jul 13 2006 Alexandre Oliva - 6.5-3 +- Add missing definition of multilib_64_archs for glibc-devel buildreqs. +- Backport support for .gnu.hash sections. + +* Wed Jul 12 2006 Alexandre Oliva - 6.5-2 +- BuildReq sharutils, prelink and, on multilib systems, 32-bit glibc-devel. +- Drop obsolete attach-stop patch. +- Fix testcases in threaded-watchpoints2 and step-thread-exit patches. +- Re-enable attach-pie.exp, asm-source.exp and sigstep.exp tests. + +* Tue Jul 11 2006 Alexandre Oliva - 6.5-1 +- Upgrade to GDB 6.5. Drop redundant patches, forward-port remaining +ones. Re-enable ada and objc testsuites. + +* Thu Jun 15 2006 Alexandre Oliva - 6.3.0.0-1.132 +- Require flex and bison at build time. +- Additional patch for BZ 175083, to cope with waitpid setting status +even when returning zero. + +* Wed May 31 2006 Alexandre Oliva - 6.3.0.0-1.131 +- Require gettext at build time. (BZ193366) + +* Sat May 27 2006 Alexandre Oliva - 6.3.0.0-1.130 +- Rewrite patch for BZ 175270, BZ 175083 so as to catch the exception +earlier. +- Remove too-fragile testcases from patches for CFA value and "S" +augmentation. + +* Wed May 17 2006 Alexandre Oliva - 6.3.0.0-1.129 +- Add not-automatically-generated file to fopen64 patch (BZ 191948). + +* Fri Apr 14 2006 Alexandre Oliva - 6.3.0.0-1.128 +- Avoid race conditions caused by exceptions messing with signal masks. +(BZ 175270, BZ 175083, maybe BZ 172938). +- Hardcode /bin and /usr/bin paths into gstack (BZ 179829, BZ 190548). +- Build in a subdir of the source tree instead of in a sibling directory. +- Switch to versioning scheme that uses the same base revision number +for all OSes, and uses a suffix to tell the builds apart and ensure +upgradability. + +* Thu Apr 13 2006 Stepan Kasal - 6.3.0.0-1.127 +- Bump up release number. + +* Thu Apr 13 2006 Stepan Kasal - 6.3.0.0-1.123 +- Use fopen64 where available. Fixes BZ 178796, BZ 190547. +- Use bigger numbers than int. Fixes BZ 171783, BZ 179096. + +* Wed Mar 8 2006 Alexandre Oliva - 6.3.0.0-1.122 +- Bump up release number. + +* Wed Mar 8 2006 Alexandre Oliva - 6.3.0.0-1.119 +- Fix regression in PIE debugging (BZ 133944) (re?)introduced by the +prelink fix (BZ 175075, BZ 190545). Improve testcase for the prelink +fix. +- Revert dwarf2 frame identifier change. + +* Tue Mar 7 2006 Alexandre Oliva - 6.3.0.0-1.118 +- Bump up release number. + +* Tue Mar 7 2006 Alexandre Oliva - 6.3.0.0-1.115 +- Change dwarf2 frame identifiers to use the actual PC instead of the +function's entry point. +- Fix FSF and GDB contact addresses in new testcases. +- Do not try to compile x86_64-only CFA testcase on 32-bit x86. +- Change prelink test to issue untested instead of warning message if +system libraries are not prelinked. + +* Fri Mar 3 2006 Alexandre Oliva - 6.3.0.0-1.114 +- Bump up release number. + +* Fri Mar 3 2006 Alexandre Oliva - 6.3.0.0-1.111 +- Add support for "S" augmentation for signal stack frames. +- Add support for CFA value expressions and encodings. +- Various improvements to the prelink test. + +* Thu Feb 23 2006 Alexandre Oliva - 6.3.0.0-1.110 +- Bump up release number. + +* Thu Feb 23 2006 Alexandre Oliva - 6.3.0.0-1.107 +- Enable gdb to debug core files and executables with mismatched +prelink base addresses. Fixes BZ 175075, BZ 190545. + +* Tue Feb 14 2006 Alexandre Oliva - 6.3.0.0-1.106 +- Bump up release number. + +* Tue Feb 14 2006 Alexandre Oliva - 6.3.0.0-1.103 +- Adjust type-punning patch to include fix not needed upstream. + +* Tue Feb 14 2006 Alexandre Oliva - 6.3.0.0-1.102 +- Bump up release number. + +* Tue Feb 14 2006 Alexandre Oliva - 6.3.0.0-1.99 +- Use type-punning warning fixes as accepted upstream. + +* Fri Feb 10 2006 Jesse Keating - 6.3.0.0-1.98.2 +- bump again for double-long bug on ppc(64) + +* Tue Feb 07 2006 Jesse Keating - 6.3.0.0-1.98.1 +- rebuilt for new gcc4.1 snapshot and glibc changes + +* Mon Jan 16 2006 Alexandre Oliva - 6.3.0.0-1.98 +- Bump up release number. + +* Mon Dec 19 2005 Alexandre Oliva - 6.3.0.0-1.94 +- Fix type-punning warnings issued by GCC 4.1. + +* Fri Dec 16 2005 Jesse Keating +- rebuilt for new gcj + +* Thu Dec 01 2005 Jeff Johnston - 6.3.0.0-1.93 +- Bump up release number. + +* Thu Dec 01 2005 Jeff Johnston - 6.3.0.0-1.90 +- Add option to allow backtracing past zero pc value. +- Bugzilla 170275 + +* Tue Nov 15 2005 Jeff Johnston - 6.3.0.0-1.89 +- Bump up release number. + +* Tue Nov 15 2005 Jeff Johnston - 6.3.0.0-1.86 +- Fix ia64 user-specified SIGILL handling error. +- Bugzilla 165038. + +* Tue Oct 18 2005 Jeff Johnston - 6.3.0.0-1.85 +- Bump up release number. + +* Tue Oct 18 2005 Jeff Johnston - 6.3.0.0-1.82 +- Modify attach patch to add missing fclose. +- Bugzilla 166712 + +* Tue Oct 11 2005 Jeff Johnston - 6.3.0.0-1.81 +- Bump up release number. + +* Tue Oct 11 2005 Jeff Johnston - 6.3.0.0-1.78 +- Support gdb attaching to a stopped process. + +* Thu Sep 29 2005 Jeff Johnston - 6.3.0.0-1.77 +- Bump up release number. + +* Thu Sep 29 2005 Jeff Johnston - 6.3.0.0-1.74 +- Fix up DSO read logic when process is attached. + +* Mon Sep 26 2005 Jeff Johnston - 6.3.0.0-1.73 +- Bump up release number. + +* Mon Sep 26 2005 Jeff Johnston - 6.3.0.0-1.70 +- Fix frame pointer calculation for ia64 sigtramp frame. + +* Thu Sep 22 2005 Jeff Johnston - 6.3.0.0-1.69 +- Bump up release number. + +* Thu Sep 22 2005 Jeff Johnston - 6.3.0.0-1.66 +- Remove extraneous xfree. + +* Wed Sep 07 2005 Jeff Johnston - 6.3.0.0-1.65 +- Bump up release number. + +* Wed Sep 07 2005 Jeff Johnston - 6.3.0.0-1.62 +- Readd readnever option + +* Wed Jul 27 2005 Jeff Johnston - 6.3.0.0-1.61 +- Bump up release number. + +* Tue Jul 26 2005 Jeff Johnston - 6.3.0.0-1.57 +- Bump up release number. + +* Tue Jul 26 2005 Jeff Johnston - 6.3.0.0-1.54 +- Add testcase to verify printing of inherited members +- Bugzilla 146835 + +* Mon Jul 25 2005 Jeff Johnston - 6.3.0.0-1.53 +- Bump up release number. + +* Mon Jul 25 2005 Jeff Johnston - 6.3.0.0-1.50 +- Fix bug with info frame and cursor address on ia64. +- Add testcase to verify pseudo-registers calculated for ia64 sigtramp. +- Bugzilla 160339 + +* Fri Jul 22 2005 Jeff Johnston - 6.3.0.0-1.49 +- Bump up release number. + +* Fri Jul 22 2005 Jeff Johnston - 6.3.0.0-1.46 +- Fix attaching to 32-bit processes on 64-bit systems. +- Bugzilla 160254 + +* Thu Jul 14 2005 Jeff Johnston - 6.3.0.0-1.45 +- Bump up release number. + +* Thu Jul 14 2005 Jeff Johnston - 6.3.0.0-1.42 +- Add work-around to make ia64 gcore work faster. +- Bugzilla 147436 + +* Thu Jul 14 2005 Jeff Johnston - 6.3.0.0-1.41 +- Bump up release number. + +* Mon Jul 11 2005 Jeff Johnston - 6.3.0.0-1.38 +- Fix backtracing across sigaltstack for ia64 +- Bugzilla 151741 + +* Fri Jul 08 2005 Jeff Johnston - 6.3.0.0-1.37 +- Bump up release number. + +* Fri Jul 08 2005 Jeff Johnston - 6.3.0.0-1.35 +- Build pseudo-registers properly for sigtramp frame. +- Bugzilla 160339 + +* Fri Jul 08 2005 Jeff Johnston - 6.3.0.0-1.34 +- Bump up release number. + +* Thu Jul 07 2005 Jeff Johnston - 6.3.0.0-1.31 +- Modify security errata to include additional bfd robustness updates +- Bugzilla 158680 + +* Fri Jun 10 2005 Jeff Johnston - 6.3.0.0-1.30 +- Bump up release number. + +* Fri Jun 10 2005 Jeff Johnston - 6.3.0.0-1.28 +- Security errata for bfd and .gdbinit file usage +- Bugzilla 158680 + +* Wed May 18 2005 Jeff Johnston - 6.3.0.0-1.24 +- Bump up release number. + +* Wed May 18 2005 Jeff Johnston - 6.3.0.0-1.23 +- Bump up release number. + +* Wed May 18 2005 Jeff Johnston - 6.3.0.0-1.22 +- Specify SA_RESTART for linux-nat.c handlers and use my_waitpid + which handles EINTR. + +* Tue May 03 2005 Jeff Johnston - 6.3.0.0-1.21 +- Bump up release number. + +* Tue May 03 2005 Jeff Johnston - 6.3.0.0-1.20 +- Bump up release number. + +* Tue May 03 2005 Jeff Johnston - 6.3.0.0-1.19 +- Fix for partial die in cache error +- Bugzilla 137904 + +* Wed Apr 27 2005 Jeff Johnston - 6.3.0.0-1.18 +- Bump up release number. + +* Wed Apr 27 2005 Jeff Johnston - 6.3.0.0-1.17 +- Bump up release number. + +* Wed Apr 27 2005 Jeff Johnston - 6.3.0.0-1.16 +- Update ia64 sigtramp support to use libunwind and fix top-level + rse register reads to also use libunwind. +- Bugzilla 151741 + +* Thu Apr 21 2005 Jeff Johnston - 6.3.0.0-1.15 +- Bump up release number. + +* Thu Apr 21 2005 Jeff Johnston - 6.3.0.0-1.14 +- Bump up release number. + +* Thu Apr 21 2005 Jeff Johnston - 6.3.0.0-1.13 +- Do not issue warning message for gcore under ia64 +- Bugzilla 146416 + +* Mon Apr 11 2005 Andrew Cagney - 6.3.0.0-1.12 +- Update gstack patch, handle systems that lack /proc//tasks. + +* Fri Apr 8 2005 Andrew Cagney - 6.3.0.0-1.11 +- Replace patch warning about DW_OP_piece with a patch that implements + the DW_OP_piece read path. + +* Sat Apr 2 2005 Andrew Cagney - 6.3.0.0-1.10 +- Print a warning when the separate debug info's CRC doen't match; + test. + +* Wed Mar 30 2005 Jeff Johnston - 6.3.0.0-1.9 +- Bump up release number. + +* Wed Mar 30 2005 Jeff Johnston - 6.3.0.0-1.7 +- Add proper vsyscall page support for ia64. + +* Thu Mar 24 2005 Jeff Johnston - 6.3.0.0-1.6 +- Bump up release number. + +* Thu Mar 24 2005 Jeff Johnston - 6.3.0.0-1.4 +- Fix printing of inherited members of C++ classes. +- Fix for Bugzilla 146835. + +* Tue Mar 22 2005 Jeff Johnston - 6.3.0.0-1.3 +- Bump up release number. + +* Thu Mar 17 2005 Jeff Johnston - 6.3.0.0-1.1 +- Remove warnings that cause errors when compiled with gcc4 and -Werror. + +* Wed Mar 16 2005 Elliot Lee +- rebuilt + +* Fri Mar 04 2005 Jeff Johnston - 6.3.0.0-0.37 +- Bump up release number. + +* Thu Mar 03 2005 Jeff Johnston - 6.3.0.0-0.35 +- Add follow-fork fix from mainline sources. + +* Thu Mar 03 2005 Jeff Johnston - 6.3.0.0-0.34 +- Bump up release number. + +* Mon Feb 28 2005 Jeff Johnston - 6.3.0.0-0.32 +- Modify debug register handling for x86, x86-64 to be thread-specific. +- Modify threaded watchpoint code for x86, x86-64 to properly insert + and remove watchpoints on all threads. + +* Tue Feb 22 2005 Andrew Cagney - 6.3.0.0-0.31 +- Bump version number. + +* Tue Feb 22 2005 Andrew Cagney - 6.3.0.0-0.30 +- Bump version number. + +* Tue Feb 22 2005 Andrew Cagney - 6.3.0.0-0.29 +- Modify gdb-6.3-dwattype0-20050201.patch to check for a zero address + and not zero unsnd. Fix BE 32- vs 64-bit problem. + +* Mon Feb 21 2005 Andrew Cagney - 6.3.0.0-0.28 +- Back port patch adding symfile-mem.o to all GNU/Linux builds. + Fix BZ 146087. + +* Wed Feb 16 2005 Jeff Johnston - 6.3.0.0-0.27 +- Bump up release number. + +* Wed Feb 16 2005 Jeff Johnston - 6.3.0.0-0.26 +- Fix unload.exp testcase. + +* Mon Feb 14 2005 Jeff Johnston - 6.3.0.0-0.25 +- Bump up release number. + +* Mon Feb 14 2005 Jeff Johnston - 6.3.0.0-0.24 +- Fix gdb to always grab the terminal before a readline call. +- Bugzilla 147880 + +* Fri Feb 11 2005 Jeff Johnston - 6.3.0.0-0.23 +- Bump up release number. + +* Fri Feb 11 2005 Jeff Johnston - 6.3.0.0-0.21 +- Fix gdb to handle stepping over the end of an exiting thread. +- Bugzilla 146848 + +* Thu Feb 10 2005 Jeff Johnston - 6.3.0.0-0.20 +- Bump up release number. + +* Tue Feb 08 2005 Jeff Johnston - 6.3.0.0-0.18 +- Modify previous gcore patch to not use linux_proc_xfer_memory even + for main thread. + +* Mon Feb 07 2005 Jeff Johnston - 6.3.0.0-0.17 +- Modify previous gcore patch to only apply to ia64. + +* Fri Feb 04 2005 Jeff Johnston - 6.3.0.0-0.16 +- Fix gcore to work properly for threaded applications +- Bugzilla 145309, 145092 + +* Fri Feb 04 2005 Jeff Johnston - 6.3.0.0-0.15 +- Tolerate DW_AT_type referencing <0> and instead of generating an + error, treat as unknown type. +- Bugzilla 144852. + +* Thu Feb 3 2005 Andrew Cagney - 6.3.0.0-0.14 +- Separate out test patches. + +* Thu Jan 27 2005 Jeff Johnston - 6.3.0.0-0.13 +- Fix to allow ia64 gdb to backtrace from syscalls in a corefile. +- Bugzilla 145092. + +* Wed Jan 26 2005 Jeff Johnston - 6.3.0.0-0.12 +- Fix to support examining files even when the executable moves +- Bugzilla 142122 + +* Wed Jan 26 2005 Andrew Cagney - 6.3.0.0-0.11 +- gdb-6.3-ppcdotsyms-20050126.patch: Backport BFD changes for reading + synthetic symbols. Rewrite code reading elf minimal symbols so that + it includes synthetics. + +* Fri Jan 21 2005 Jeff Johnston - 6.3.0.0-0.10 +- Fix to prevent resetting unwind kernel table size to invalid value + when debugging a core file +- Bugzilla 145309 + +* Fri Jan 21 2005 Andrew Cagney - 6.3.0.0-0.9 +- When single stepping handle both back-to-back and nested signals. +- Disable .symbol patch, results in BFD errors. + +* Fri Jan 21 2005 Jeff Johnston - 6.3.0.0-0.8 +- Support listing both in-charge and not-in-charge dtors when + just the dtor name is given. +- Add new test case for newly added ctor/dtor functionality. + +* Thu Jan 20 2005 Jeff Johnston - 6.3.0.0-0.7 +- Fix to allow breaking by line in both the in-charge and + not-in-charge ctor/dtor. +- Bugzilla 117826 + +* Thu Jan 20 2005 Andrew Cagney - 6.3.0.0-0.6 +- Rebuild. + +* Thu Jan 20 2005 Andrew Cagney - 6.3.0.0-0.5 +- Use bfd_get_synthetic_symtab to read in any synthetic symbols + such as 64-bit PPC's ".symbol"s. + +* Tue Jan 18 2005 Jeff Johnston - 6.3.0.0-0.4 +- Modify non-threaded watchpoint patch to use new observer. + +* Mon Jan 17 2005 Jeff Johnston - 6.3.0.0-0.3 +- Fix for non-threaded watchpoints. + +* Mon Jan 17 2005 Andrew Cagney - 6.3.0.0-0.2 +- Enable PPC CFI, remove merged ppc patches. + +* Wed Jan 12 2005 Elena Zannoni - 6.3.0.0-0.1 +- commit co-authors Andrew Cagney and + Jeff Johnston . +- Various fixes to complete the import and merge. + +* Wed Dec 01 2004 Andrew Cagney - 6.3.0.0 +- Import GDB 6.3, get building, add all patches. + +* Tue Nov 30 2004 Jeff Johnston - 1.200400607.63 +- When removing breakpoints, continue removing breakpoints even if an + error occurs on the list. + +* Sun Nov 28 2004 Andrew Cagney - 1.200400607.62 +- Bump version for RHEL4 build. + +* Wed Nov 24 2004 Andrew Cagney - 1.200400607.61 +- For PPC-64, fix search for a symbol (wasn't specifying the section). + +* Wed Nov 24 2004 Andrew Cagney - 1.200400607.60 +- For PPC-64, do not set malloc name to ".malloc"; no longer needed. +- For all, only define kfail when not already defined. + +* Wed Nov 24 2004 Andrew Cagney - 1.200400607.59 +- Bump version. + +* Wed Nov 24 2004 Andrew Cagney - 1.200400607.58 +- Add rs6000 reggroups; fixes problem of PS register being trashed + causing mysterious branch breakpoints. + +* Tue Nov 23 2004 Andrew Cagney - 1.200400607.57 +- Backport i386 prolog parser - better backtraces out of semop(). +- Add option --readnever to suppress the reading of symbolic debug + information. +- Add script gstack.sh, installed as gstack. + Bugzilla 136584, 137121 +- Add missing files gdb.pie/attach2.c, gdb.pie/break1.c and + gdb.pie/Makefile.in along with testsuite/configure stuff for pie. + +* Tue Nov 23 2004 Andrew Cagney - 1.200400607.57 +- Backport i386 prolog parser - better backtraces out of semop(). +- Add option --readnever to suppress the reading of symbolic debug + information. +- Add script gstack.sh, installed as gstack. + Bugzilla 136584, 137121 + +* Mon Nov 22 2004 Jeff Johnston - 1.200400607.56 +- Bump up release number. + +* Mon Nov 22 2004 Jeff Johnston - 1.200400607.55 +- Multiple ia64 backtrace fixes. Bugzilla 125157 + +* Thu Nov 11 2004 Elena Zannoni - 1.200400607.54 +- Bump up release number + +* Thu Nov 11 2004 Elena Zannoni - 1.200400607.51 +- Modify configure line to not use absolute paths. This was + creating problems with makeinfo/texinfo. +- Get rid of makeinfo hack. +Bugzilla 135633 + +* Tue Nov 09 2004 Jeff Johnston - 1.200400607.50 +- Bump up release number + +* Tue Nov 09 2004 Jeff Johnston - 1.200400607.49 +- Bump up release number + +* Tue Nov 09 2004 Jeff Johnston - 1.200400607.48 +- Expose $base, $allocate constructors and $delete, $base destructors + for breakpoints. + +* Tue Nov 09 2004 Andrew Cagney - 1.200400607.47 +- Enable PPC CFI. + +* Mon Nov 08 2004 Jeff Johnston - 1.200400607.46 +- Bump up release number + +* Mon Nov 08 2004 Jeff Johnston - 1.200400607.45 +- Bump up release number + +* Fri Nov 05 2004 Jeff Johnston - 1.200400607.44 +- Allow macros to continue past a backtrace error + +* Tue Oct 26 2004 Andrew Cagney - 1.200400607.43 +- Hack around broken PT_FPSCR defined in headers. +- Import latest s390 fixes. +- Disable sigstep.exp - s390 has problems. +- Use PC's symtab when looking for a symbol. +- Work around DW_OP_piece. + +* Fri Oct 22 2004 Andrew Cagney - 1.200400607.42 +- For 64-bit PPC, convert _dl_debug_state descriptor into a code address. +- Fix --ignore option. + +* Sun Oct 10 2004 Andrew Cagney - 1.200400607.40 +- Disable attach-pie.exp test, hangs on amd64 without auxv. +- Move pie tests to pie. + +* Sun Oct 10 2004 Andrew Cagney - 1.200400607.39 +- Fix comment bug in sigstep.exp. + +* Thu Oct 07 2004 Jeff Johnston - 1.200400607.38 +- Do not invalidate cached thread info when resuming threads. +- Bump up release number. + +* Fri Oct 01 2004 Jeff Johnston - 1.200400607.35 +- Fix S/390 watchpoint support to work better under threading. + +* Fri Oct 01 2004 Jeff Johnston - 1.200400607.34 +- Fix thread_db_get_lwp to handle 2nd format ptids. + +* Mon Sep 27 2004 Andrew Cagney - 1.200400607.33 +- Don't unwind past a zero PC (when normal frames). + +* Mon Sep 27 2004 Jeff Johnston - 1.200400607.32 +- Add threaded watchpoint support for x86, x86-64, and ia64. + +* Mon Sep 27 2004 Andrew Cagney - 1.200400607.31 +- Instead of deleting bigcore.exp, use runtest --ignore. + +* Thu Sep 23 2004 Andrew Cagney - 1.200400607.30 +- Merge in mainline testsuite up to 2004-09-23, pick up sig*.exp tests. + Merge in mainline infrun.c, pick up all infrun.c fixes. + Generate bigcore's corefile from the running inferior. + Limit bigcore's corefile to max file-size. + +* Thu Sep 02 2004 Jeff Johnston - 1.200400607.29 +- Fix low-level lin-lwp code to wait specifically for any stepping + LWP (bugzilla 130896) + +* Tue Aug 31 2004 Jeff Johnston - 1.200400607.28 +- Add test case for bugzilla 128618 fix. + +* Mon Aug 30 2004 Jeff Johnston - 1.200400607.27 +- Add support for breakpoints in manually loaded/unloaded shared libs. + (bugzilla 128618) + +* Mon Aug 30 2004 Jeff Johnston - 1.200400607.26 +- Add java inferior call support. + +* Mon Aug 30 2004 Andrew Cagney - 1.200400607.25 +- Convert "main" the function descriptor, into an address. + +* Mon Aug 30 2004 Andrew Cagney - 1.200400607.24 +- Fix single-stepping when a signal is pending, was exiting program. + -- needs kernel fix so that ptrace(PT_STEP,SIG) doesn't do a PT_CONT. + -- sigstep.exp tests pass with this fix applied. + +* Mon Aug 30 2004 Elena Zannoni - 1.200400607.23 +- Delete some part of gdb-6.1post-test-rh.patch, to avoid confusing + gdb when testing itself, and loading separate debug info. + +* Fri Aug 13 2004 Jeff Johnston - 1.200400607.22 +- Check in gdb mainline fix for applications calling clone directly. + +* Tue Aug 10 2004 Jeff Johnston - 1.200400607.21 +- Alter libunwind frame code to allow using libunwind 0.97 and up. + +* Tue Aug 03 2004 Jeff Johnston - 1.200400607.20 +- Fix the ia64 libunwind test to match current output. + +* Fri Jul 30 2004 Elena Zannoni - 1.200400607.19 +- Fix the tests where gdb debugs itself, as to not copy + the executable to xgdb. + +* Mon Jul 26 2004 Elena Zannoni - 1.200400607.18 +- Add Pie patches back in. + +* Fri Jul 16 2004 Andrew Cagney - 1.200400607.17 +- Fix stepping over a no-debug shared-library function. +- Fix patch vsyscall patch name. + +* Thu Jul 8 2004 Jeff Johnston - 1.200400607.16 +- Update thread code with fix from gdb HEAD + +* Wed Jul 7 2004 Andrew Cagney - 1.200400607.15 +- disable vsyscall +- import Bob's crasher fix +- disable bigcore.exp + +* Mon Jul 5 2004 Andrew Cagney - 1.200400607.14 +- Make large corefiles work on systems that require O_LARGEFILE. + +* Tue Jun 29 2004 Elena Zannoni - 1.200400607.13 +- Fix BuildRequires for libunwind on ia64. + +* Mon Jun 28 2004 Andrew Cagney - 1.200400607.12 +- Import wild frame ID patch. Stops GDB incorrectly matching invalid + frame IDs. +- Disable bigcore on ia64 and amd64. + +* Fri Jun 25 2004 Andrew Cagney - 1.200400607.11 +- Fix testsuite to kill attach process (from corrinna/mainline). +- Fix build problems with vsyscall patch. + +* Fri Jun 25 2004 Andrew Cagney - 1.200400607.10 +- Fix annotate test messages. +- Recognize VSYSCALL pages. + +* Thu Jun 24 2004 Jeff Johnston - 1.200400607.9 +- Fix ia64 watchpoint support. + +* Wed Jun 23 2004 Andrew Cagney - 1.200400607.8 +- Do not xfail signals on i387, convert KFAIL to FAIL and not XFAIL. + +* Wed Jun 23 2004 Andrew Cagney - 1.200400607.7 +- Fix to ppc64 unwinder - handle glibcs function within syscall + function hack. +- Update sigbpt.exp, ena-dis-br.exp observer.exp signull.exp, + step-test.exp and sizeof.exp, so that test names are architecture + clean. +- Disable bigcore.exp on PowerPC 64. + +* Tue Jun 22 2004 Andrew Cagney - 1.200400607.6 +- Merge in mainline testsuite changes up to 2004-06-21. +- Re-implement 32 and 64-bit PPC signal trampolines. +- Check i386 and amd64 signal trampolines before dwarf2. +- Allow tramp-frame when there is a symbol. +- Test interaction between single-step, breakpoint and signal. +- ABI: Fix PPC64 function parameters, sizeof long-double, and enum + return values. + +* Mon Jun 21 2004 Elena Zannoni - 1.200400607.5 +- Fix sed line for gz info files. + +* Mon Jun 21 2004 Andrew Cagney - 1.200400607.4 +- Tar/uuencode both the .sum and .log test results. + +* Tue Jun 15 2004 Elena Zannoni - 0.200400607.3 +- Remove installation of mmalloc, and its info files. +- Add hack to deal with differring info files generated by makeinfo. +- Restore release number convention. + +* Tue Jun 15 2004 Elliot Lee +- rebuilt + +* Thu Jun 10 2004 Elena Zannoni - 0.200400607.2 +- Fix Requires and BuildRequires for libunwind dependencies. +- Add patch to silence gcc3.4 warnings. + +* Wed Jun 09 2004 Elena Zannoni - 0.200400607.1 +- New import: revamp everything. Remove all patches for now. +- Update the Requires and BuildRequires sections. +- Removed stupid Ada testcases (there is no ada support in gdb yet). + +* Mon May 10 2004 Elena Zannoni - 0.20040223.20 +- Disable PIE again. +- obsolete gdb64 only if on ppc64. + +* Mon May 03 2004 Jeff Johnston - 0.20040223.19 +- Add -u parameter to build ChangeLog patch. + +* Mon May 03 2004 Jeff Johnston - 0.20040223.18 +- Update thread fix made for .6 release to FSF version. + +* Thu Apr 22 2004 Elena Zannoni - 0.20040223.17 +- Disable PIE again. + +* Thu Apr 22 2004 Jeff Johnston - 0.20040223.16 +- Bump version number. + +* Wed Apr 21 2004 Jeff Johnston - 0.20040223.15 +- fix ia64 info frame command +- also fix ia64 tdep file for which elf header file to include + +* Tue Mar 30 2004 Elena Zannoni - 0.20040223.14 +- re-enable pie. + +* Tue Mar 30 2004 Elena Zannoni - 0.20040223.13 +- Fix testsuite glitches. + +* Wed Mar 24 2004 Elena Zannoni - 0.20040223.12 +- Fix typo. + +* Wed Mar 24 2004 Elena Zannoni - 0.20040223.11 +- Make gdb compile w/o warnings with gcc-3.4. +- Reenable PIE support code. + +* Tue Mar 23 2004 Elena Zannoni - 0.20040223.10 +- Bump version number + +* Tue Mar 23 2004 Elena Zannoni - 0.20040223.9 +- temporarily disable PIE support. +- Add section to obsolete gdb64 package. + +* Sun Mar 21 2004 Elena Zannoni - 0.20040223.8 +- Add support for debugging of PIE executables. + +* Tue Mar 09 2004 Elena Zannoni - 0.20040223.7 +- Bump version number. + +* Mon Mar 08 2004 Jeff Johnston - 0.20040223.6 +- Fix thread support to recognize new threads even when they reuse + tids of expired threads. Also ensure that terminal is held by gdb + while determining if a thread-create event has occurred. + +* Mon Mar 08 2004 Andrew Cagney - 0.20040223.5 +- Sync with 6.1 branch; eliminate all amd64 patches; + add more robust 32x64 PPC64 patches. + +* Tue Mar 02 2004 Elliot Lee +- rebuilt + +* Tue Mar 2 2004 Andrew Cagney - 0.20040223.4 +- 32x64 fixes that work with threads, replaced old + non-thread 32x64 patch, add nat patch. + +* Wed Feb 25 2004 Elena Zannoni - 0.20040223.3 +- Add patch for x86_64 in 32 bit mode. + +* Wed Feb 25 2004 Elena Zannoni - 0.20040223.2 +- Remove ppc64 hacks. +- Refresh some patches. + +* Wed Feb 25 2004 Elena Zannoni - 0.20040223.1 +- Import new gdb snapshot from mainline FSF. +- Update patch list. + +* Tue Feb 17 2004 Jeff Johnston - 1.20031117.8 +- Switch ia64-tdep.c to use new abi used by libunwind-0.95 and up. +- Fix gate area specification for ia64-linux-tdep.c. +- Fix long double support for ia64. + +* Fri Feb 13 2004 Elliot Lee +- rebuilt + +* Thu Jan 08 2004 Elena Zannoni - 0.20031117.7 +- Add fixes for ppc32 support on ppc64 platform, from Andrew Cagney. + +* Tue Jan 06 2004 Elena Zannoni - 0.20031117.6 +- Add patch to have unique binary names in the testsuite. +- Disable s390/s390x pthread.exp test (FIXME) +- Don't install any info files for the ppc platform. Let's take them + from the ppc64 one (or we get install conflicts). +- Remove generated info files from the source tree. They are generated + as part of the FSF snapshot process. + +* Mon Nov 24 2003 Elena Zannoni - 0.20031117.5 +- Add patches from old rpm for i386 support on x86_64. +- Add build dependency on libunwind for ia64. + +* Fri Nov 21 2003 Jeremy Katz - 0.20031117.4 +- more rpm tricks to get the gdb64 package happier + +* Thu Nov 20 2003 Elena Zannoni - 0.20031117.3 +- Add sick and twisted workaround for ppc64 architecture. + +* Wed Nov 19 2003 Elena Zannoni - 0.20031117.2 +- Fix typo in libunwind test. + +* Tue Nov 18 2003 Elena Zannoni - 0.20031117.1 +- Import new gdb snapshot from mainline FSF. +- Fix some testfiles. +- Add fixes for gcore, and patch for libunwind support on ia64. +- Add tests to see what versions of gcc, binutils, glibc and kernel we + are running with. + +* Wed Oct 15 2003 Elena Zannoni - 0.20030710.41 +- Bump up version number. + +* Wed Sep 24 2003 Elena Zannoni - 0.20030710.40 +- Fix problem with gcore and single threaded programs. (bugzilla 103531) + +* Mon Sep 22 2003 Jeff Johnston - 0.20030710.39 +- Fix call to quit_target from quit_force. + +* Sun Sep 21 2003 Andrew Cagney - 0.20030710.38 +- Fix PPC64 push dummy call. +- Re-fix PPC64 return value (had wrong / old patch). + +* Sat Sep 20 2003 Andrew Cagney - 0.20030710.37 +- Fix PPC32 return values. + +* Sat Sep 20 2003 Andrew Cagney - 0.20030710.36 +- Rewrite ppc64 retun value methods so that they (hopefully) +match the SysV spec. +- Enable ppc64 testsuite. + +* Thu Sep 18 2003 Andrew Cagney - 0.20030710.35 +- Hack around problem "break main" vs "break .main" when there is +only a minimal ppc64 symbol table. The former is a function descriptor +and not where you want the breakpoint to go. Only convert descriptors +to pointers when the address is in the ".opd" section. + +* Wed Sep 17 2003 Andrew Cagney - 0.20030710.34 +- Fix ppc32 push_dummy_call. + +* Tue Sep 16 2003 Andrew Cagney - 0.20030710.33 +- Pack gdb.sum and gdb.log using uuencode and bzip. + +* Tue Sep 16 2003 Jeff Johnston - 0.20030710.32 +- Catch errors when quitting so exit of gdb still occurs. + +* Mon Sep 15 2003 Andrew Cagney - 0.20030710.31 +- Fix ppc32 use_struct_convention. + +* Thu Sep 11 2003 Andrew Cagney - 0.20030710.30 +- Mods to dwarf2-frame.c to work around a lack of GCC/CFI info. + +* Thu Sep 11 2003 Elena Zannoni - 0.20030710.29 +- Bump up version number. + +* Wed Sep 10 2003 Elena Zannoni - 0.20030710.28 +- Fix a core dump with MI. +- Add new ChangeLog patch for mi changes. + +* Thu Sep 04 2003 Elena Zannoni - 0.20030710.27 +- Change the name of the package to gdb64 in ppc64 case. + +* Tue Aug 26 2003 Elena Zannoni - 0.20030710.26 +- Add testcase for separate debug info. + +* Tue Aug 26 2003 Andrew Cagney - 0.20030710.25 +- fix i386 on x86-64 TLS +- add "base-aug2003" suffix to older x86i386 patch + +* Tue Aug 26 2003 Andrew Cagney - 0.20030710.24 +- skip the ppc64 and x86-64 frame redzone. + +* Fri Aug 22 2003 Elena Zannoni - 0.20030710.23 +- Relax one testcase in selftest.exp a bit. +- Accept different output as well in thread bt (platform dependent). +- Enable testsuite run for ia64, ppc, s390 and s390x. They are in + reasonably good shape. + +* Thu Aug 21 2003 Jeff Johnston - 0.20030710.22 +- Multiple ia64 fixes. +- Fix ia64 printing of function pointers. +- Fix ia64 prologue examination to ignore predicated insns if we + haven't found the return address yet. +- Skip dump.exp testcase for ia64 + +* Thu Aug 21 2003 Elena Zannoni - 0.20030710.21 +- Bump release number. + +* Wed Aug 20 2003 Elena Zannoni - 0.20030710.20 +- Relax pattern in annota2.exp test. + +* Wed Aug 20 2003 Elena Zannoni - 0.20030710.19 +- rename gdb binary to gdb64 for ppc64 platform. + +* Tue Aug 19 2003 Jeff Johnston - 0.20030710.18 +- Fix ia64 pc unwinding to include psr slot. + +* Mon Aug 18 2003 Elena Zannoni - 0.20030710.17 +- Fix info installation for annotate.texi. (Bugzilla 102521) + +* Fri Aug 15 2003 Elena Zannoni - 0.20030710.16 +- revamp tls tests a bit. +- Handle new output from gdb in relocate.exp + +* Wed Aug 13 2003 Elena Zannoni - 0.20030710.15 +- Fix problem for processing of separate debug info files. + +* Wed Aug 13 2003 Jeff Johnston - 0.20030710.14 +- add ia64.inc file for testing ia64 in gdb.asm testsuite + +* Fri Aug 8 2003 Andrew Cagney - 0.20030710.13 +- print the libthread_db library path, print when threads are enabled + +* Thu Aug 7 2003 Andrew Cagney - 0.20030710.12 +- "cat" the test log into the build log + +* Wed Aug 06 2003 Jeff Johnston - 0.20030710.11 +- modernize ia64 gdb to use new frame model +- remove/replace deprecated interfaces used by ia64 gdb + +* Wed Aug 06 2003 Andrew Cagney - 0.20030710.10 +- Sync to gdb-5.3.90-sync-20030806.patch. + +* Tue Jul 29 2003 Andrew Cagney - 0.20030710.9 +- add x86-64 i386 fixes + +* Tue Jul 29 2003 Elena Zannoni - 0.20030710.8 +- Fix some tests by xfailing the correct target triplet for RedHat. +- Remove include of config.h from pthreads.c testcases. + +* Mon Jul 28 2003 Elena Zannoni - 0.20030710.7 +- Fix some test failures, by escaping correctly. + +* Thu Jul 24 2003 Elena Zannoni - 0.20030710.6 +- Remove one testcase that is redundant. + +* Wed Jul 23 2003 Elena Zannoni - 0.20030710.5 +- Bump up release number. + +* Wed Jul 23 2003 Elena Zannoni - 0.20030710.4 +- Bring in sync with current head of gdb-6 branch. +- Remove linespec patch, because included in the new sync patch. + +* Fri Jul 18 2003 Elena Zannoni - 0.20030710.3 +- Add patch to avoid gdb segfault with bad debug info. +- Change location of build tree to avoid conflicts with older versions + possibly installed. + +* Thu Jul 17 2003 Elena Zannoni - 0.20030710.2 +- Add patch to synchronize the current snapshot with the gdb-6 branch head. +- Remove some patches that are includd in such diff. +- Enable tests on AMD64 as well. + +* Fri Jul 11 2003 Elena Zannoni - 0.20030710.1 +- Import new gdb snapshot. +- Revamp gdb.spec. Get rid of patches that apply to older versions. +- Add patches for ppc64 support, kfail and make gdb more robust in copingi + with bad debug info. + +* Wed Jul 02 2003 Jeff Johnston - 1.20021129.39 +- Fix bug with ia64 checking of hardware breakpoints. + +* Mon Jun 30 2003 Elena Zannoni - 1.20021129.38 +- Add necessary function for NPTL support on x86-64. + +* Wed Jun 04 2003 Elliot Lee +- rebuilt + +* Wed Jun 04 2003 Elena Zannoni - 0.20021129.37 +* Tue Jun 03 2003 Elena Zannoni - 0.20021129.36 +- Enable warnings for x86_64, not x86-64. +- Fix warnings from infptrace.c and dwarfread.c. +- Print error message only when reading separate debug info really + doesn't work (jimb@redhat.com). + +* Fri May 23 2003 Elena Zannoni - 0.20021129.35 +- Fixes for fetching and storing access registers on s390x (jimb@redhat.com). + Bugzilla 91455. + +* Wed May 21 2003 Jeff Johnston - 0.20021129.34 +- Do not generate error on detach failure. Bugzilla 90900. + +* Thu May 8 2003 Elena Zannoni - 0.20021129.33 +- New tests for asm on s390x (jimb@redhat.com). Bugzilla 90503. +- Fixes for prologue analysis on s390x (jimb@redhat.com). Bugzilla 90506. +- bfd fix for 64-bit platforms (jimb@redhat.com). +- Disable ppc64 builds until we have a port. + +* Thu May 1 2003 Jeff Johnston - 0.20021129.32 +- Add ia64 support to the float.exp testcase. + +* Thu May 1 2003 Elena Zannoni - 0.20021129.31 +- Clean up the tls tests some more. +- Fix problem with non US-eng locale. Bugzilla bug 88823. + +* Wed Apr 30 2003 Jeff Johnston - 0.20021129.30 +- Fix ia64 prologue skipping. +- Fix ia64 line table. +- Fix setting of prev_pc in infrun.c. + +* Mon Mar 31 2003 Elena Zannoni - 0.20021129.29 +- Include the gcore script, as gdb_gcore.sh and install it in + /usr/bin as gcore. +- One more disassembly fix for core files. Added to + gdb-5.3post-disasm-mar2003.patch. Bugzilla 87677. +- Enable build warnings for x86-64. + +* Mon Mar 31 2003 Elena Zannoni - 0.20021129.28 +- Fix Java strings printing. +- Fix memory corruption in disassembly code. Bugzilla 85644. +- Testsuite fixes (jimb@redhat.com). Bugzilla 85457. +- Fixes for s390 stack handling (jimb@redhat.com). Bugzilla 85039. +- Fixes for s390 struct return (jimb@redhat.com). + +* Wed Mar 26 2003 Elena Zannoni - 0.20021129.27 +- Fixes for disassembly of code in threaded applications. Bugzilla 87495. +- Fixes for s390 prologue analysis. (jimb@redhat.com). + Bugzilla bugs 85251, 85214. + +* Thu Mar 20 2003 Elena Zannoni - 0.20021129.26 +- Fix inferior function calls with void return on x86-64. Bugzilla bug 83197. +- Fix for upstream PR/699. +- Fix some problems with gdb-5.3post-thrtst-feb2003.patch. + +* Wed Mar 19 2003 Jeff Johnston - 0.20021129.25 +- Fix for thread-db.c: check_event() - Bugzilla bug 86231. + +* Fri Mar 14 2003 Elena Zannoni - 0.20021129.24 +- Fix some problems with inferior function calls on x86-64. + +* Fri Mar 07 2003 Elena Zannoni - 0.20021129.23 +- testsuite patches. Bugzilla 85215 85028 85335. + +* Thu Mar 06 2003 Elena Zannoni - 0.20021129.22 +- Fix testsuite problems related to having '+' in the directory name. + Bugzilla 85031. + +* Mon Mar 03 2003 Elena Zannoni - 0.20021129.21 +- Fix a few inferior function call problems. + +* Mon Mar 03 2003 Elena Zannoni - 0.20021129.20 +- Split the changelog patches in two. Cleanup messy patch section. + +* Thu Feb 27 2003 Jeff Johnston - 0.20021129.19 +- Perform run-time check for tkill syscall in lin-lwp.c. + +* Mon Feb 24 2003 Elena Zannoni - 0.20021129.18 +- Update copyright year printed in version. + +* Mon Feb 24 2003 Elena Zannoni - 0.20021129.17 +- Refresh build. + +* Mon Feb 24 2003 Elena Zannoni - 0.20021129.16 +- Add some testsuite cleanups, to avoid spurious test failures. + +* Fri Feb 21 2003 Jeff Johnston - 0.20021129.15 +- Add patch to handle thread exiting when LD_ASSUME_KERNEL=2.4.1 which + fixes Bugzilla bug 84217. + +* Fri Feb 21 2003 Elena Zannoni - 0.20021129.14 +- New patch to fix disassembly on s390. Bugzilla bug 84286. +- New patch for attach/ptrace fix. Bugzilla bug 84220. +- Reenable tests for x86. + +* Thu Feb 20 2003 Jeff Johnston - 0.20021129.13 +- Add patch for mixed stabs with dwarf2 - bugzilla bug 84253. + +* Wed Feb 12 2003 Elena Zannoni - 0.20021129.12 +- Disable tests also for x86. + +* Tue Feb 11 2003 Elena Zannoni - 0.20021129.11 +- Add patch for mi threads tests. +- Add patch for dwarf2 debug_ranges section. +- Add patch for detach bug. + +* Mon Feb 10 2003 Elena Zannoni - 0.20021129.10 +- Add patch for testsuite auto answering internal error queries. +- Add new TLS tests. +- Add cleanup patches for thread tests. + +* Mon Feb 03 2003 Elena Zannoni - 0.20021129.9 +- Add new patch for thread support. Apply on all arches. +- Do not apply old patches, but leave them around for now. +- Add new patch for dwarf2 debug info reading. +- Add new patch for dwarf2 cfi engine cleanup. +- Add new patch for uiout problems. +- Add new patch for s390 build. +- Disable tests on all platforms but x86. + +* Mon Jan 27 2003 Elena Zannoni - 0.20021129.8 +- Move all the changelog entries to a single patch. +- Add tests to the args patch. +- Add new patch for until command fix (bugzilla Bug 19890). +- s390 and s390x can be built with -Werror. +- Run make check for s390 and s390x too. +- Include an updated version of the thread nptl patch (still WIP). + +* Wed Jan 15 2003 Phil Knirsch - 0.20021129.7 +- Apply the 2nd misc patch for s390 and s390x, too. + +* Tue Jan 14 2003 Elena Zannoni - 0.20021129.6 +- Add patches for NPTL support, to be applied on i386 only. + (this is still WIP) +- Split old misc patch in two parts. +- Temporarily disable testsuite run on alpha. + +* Sun Jan 12 2003 Elena Zannoni - 0.20021129.5 +- Add patch for --args with zero-length arguments. Fix for bug 79833. + +* Tue Dec 17 2002 Elliot Lee - 0.20021129.4 +- The define directive to rpm is significant even if the line it is + in happens to start with a '#' character. Fixed. + +* Fri Dec 13 2002 Elena Zannoni - 0.20021129.3 +- Merge previous patches for warnings into a single one. +- Add changelogs to patches. +- Add, but don't use, a macro to avoid stripping. + +* Fri Dec 6 2002 Elena Zannoni +- Add patch to allow debugging of executables with debug info stored + in separate files. +- Add patch for Makefile dependencies and disable warnings for + building thread-db.c. +- Re-enable building with -Werror for alpha, ia64, ppc. + +* Mon Dec 2 2002 Elena Zannoni +- Don't pass to gdb an empty build warnings flag, or that will disable warnings + completely. We want to build using gdb's standard warnings instead. + +* Mon Dec 2 2002 Elena Zannoni +- Don't do testing for x86_64. + +* Sun Dec 1 2002 Elena Zannoni +- x86_64 doesn't build with Werror yet. +- Add patch for alpha. +- Alpha doesn't build with -Werror either. +- Add patch for ia64. +- Add patch for ppc. +- Drop ia64 from -Werror list. +- Drop ppc from -Werror list. + +* Sun Dec 1 2002 Elena Zannoni +- Add dejagnu to the build requirements. +- Enable make check. +- Add enable-gdb-build-warnings to the configure flags. + +* Fri Nov 29 2002 Elena Zannoni +- Import new upstream sources. +- Change version and release strings. +- Upgrade patches. +- Build gdb/gdbserver as well. +- Define and use 'cvsdate'. +- Do %%setup specifying the source directory name. +- Don't cd up one dir before removing tcl and friends. +- Change the configure command to allow for the new source tree name. +- Ditto for the copy of NEWS. +- Add some comments. + +* Mon Nov 25 2002 Elena Zannoni 5.2.1-5 +General revamp. +- Add patch for gdb/doc/Makefile.in. Part of fix for bug 77615. +- Add patch for mmalloc/Makefile.in. Part of fix for bug 77615. +- Change string printed in version.in to -rh. +- Move the deletion of dejagnu, expect, tcl to the prep section, + from the build section. +- Add build directory housekeeping to build section. +- Use macros for configure parameters. +- Do the build in a separate directory. +- Prepare for testing, but not enable it yet. +- Correctly copy the NEWS file to the top level directory, for the doc + section to find it. +- Cd to build directory before doing install. +- Use makeinstall macro, w/o options. +- Remove workaround for broken gdb info files. Part of fix for bug 77615. +- Remove share/locale directory, it is in binutils. +- Remove info/dir file. +- Clarify meaning of post-install section. +- Add gdbint info files to post-install, pre-uninstall and files sections. + Part of fix for bugs 77615, 76423. +- Add libmmalloc.a to package. + +* Fri Aug 23 2002 Florian La Roche +- added mainframe patch from developerworks + +* Wed Aug 21 2002 Trond Eivind Glomsrod 5.2.1-3 +- Add changelogs to the previous patch + +* Wed Aug 14 2002 Trond Eivind Glomsrod 5.2.1-2 +- Add some patches from Elena Zannoni + +* Tue Jul 23 2002 Trond Eivind Glomsrod 5.2.1-1 +- 5.2.1 + +* Mon Jul 22 2002 Florian La Roche +- compile on mainframe + +* Mon Jul 8 2002 Trond Eivind Glomsrod 5.2-3 +- Rebuild + +* Tue May 7 2002 Trond Eivind Glomsrod 5.2-2 +- Rebuild + +* Mon Apr 29 2002 Trond Eivind Glomsrod 5.2-1 +- 5.2 + +* Mon Apr 29 2002 Trond Eivind Glomsrod 5.1.92-1 +- 5.1.92. Hopefully identical to 5.2 final + +* Mon Apr 22 2002 Trond Eivind Glomsrod 5.1.91-1 +- 5.1.91. 5.2 expected in a week + +* Thu Mar 28 2002 Trond Eivind Glomsrod 5.1.90CVS-5 +- Update to current + +* Thu Mar 28 2002 Trond Eivind Glomsrod 5.1.90CVS-4 +- Update to current + +* Thu Mar 28 2002 Trond Eivind Glomsrod 5.1.90CVS-3 +- Update to current + +* Wed Mar 20 2002 Trond Eivind Glomsrod 5.1.90CVS-2 +- Update to current + +* Wed Mar 13 2002 Trond Eivind Glomsrod 5.1.90CVS-1 +- Update to current 5.2 branch + +* Thu Jan 24 2002 Trond Eivind Glomsrod 5.1.1-1 +- 5.1.1 +- add URL + +* Wed Jan 09 2002 Tim Powers +- automated rebuild + +* Mon Dec 10 2001 Trond Eivind Glomsrod 5.1-2 +- Fix some thread+fpu problems + +* Mon Nov 26 2001 Trond Eivind Glomsrod 5.1-1 +- 5.1 + +* Mon Nov 19 2001 Trond Eivind Glomsrod 5.0.94-0.71 +- 5.0.94. Almost there.... + +* Mon Nov 12 2001 Trond Eivind Glomsrod 5.0.93-2 +- Add patch from jakub@redhat.com to improve handling of DWARF + +* Mon Nov 12 2001 Trond Eivind Glomsrod 5.0.93-1 +- 5.0.93 +- handle missing info pages in post/pre scripts + +* Wed Oct 31 2001 Trond Eivind Glomsrod 5.0.92-1 +- 5.0.92 + +* Fri Oct 26 2001 Trond Eivind Glomsrod 5.0.91rh-1 +- New snapshot +- Use the 5.0.91 versioning from the snapshot + +* Wed Oct 17 2001 Trond Eivind Glomsrod 5.0rh-17 +- New snapshot + +* Thu Sep 27 2001 Trond Eivind Glomsrod +- New snapshot + +* Wed Sep 12 2001 Trond Eivind Glomsrod 5.0rh-16 +- New snapshot + +* Mon Aug 13 2001 Trond Eivind Glomsrod 5.0rh-15 +- Don't buildrequire compat-glibc (#51690) + +* Thu Aug 9 2001 Trond Eivind Glomsrod +- New snapshot, from the stable branch eventually leading to gdb 5.1 + +* Mon Jul 30 2001 Trond Eivind Glomsrod +- s/Copyright/License/ +- Add texinfo to BuildRequires + +* Mon Jun 25 2001 Trond Eivind Glomsrod +- New snapshot + +* Fri Jun 15 2001 Trond Eivind Glomsrod +- New snapshot +- Add ncurses-devel to buildprereq +- Remove perl from buildprereq, as gdb changed the way + version strings are generated + +* Thu Jun 14 2001 Trond Eivind Glomsrod +- New snapshot + +* Wed May 16 2001 Trond Eivind Glomsrod +- New snapshot - this had thread fixes for curing #39070 +- New way of specifying version + +* Tue May 1 2001 Trond Eivind Glomsrod +- New tarball +- Kevin's patch is now part of gdb + +* Mon Apr 9 2001 Trond Eivind Glomsrod +- Add patch from kevinb@redhat.com to fix floating point + thread + problem (#24310) +- remove old workarounds +- new snapshot + +* Thu Apr 5 2001 Trond Eivind Glomsrod +- New snapshot + +* Sat Mar 17 2001 Bill Nottingham +- on ia64, there are no old headers :) + +* Fri Mar 16 2001 Trond Eivind Glomsrod +- build with old headers, new compiler + +* Fri Mar 16 2001 Trond Eivind Glomsrod +- new snapshot + +* Mon Feb 26 2001 Trond Eivind Glomsrod +- new snapshot which should fix some more IA64 problems (#29151) +- remove IA64 patch, it's now integrated + +* Wed Feb 21 2001 Trond Eivind Glomsrod +- add IA64 and Alpha patches from Kevin Buettner +- use perl instead of patch for fixing the version string + +* Tue Feb 20 2001 Trond Eivind Glomsrod +- don't use kgcc anymore +- mark it as our own version +- new snapshot + +* Mon Jan 22 2001 Bernhard Rosenkraenzer +- Link with ncurses 5.x even though we're using kgcc. + No need to drag in requirements on ncurses4 (Bug #24445) + +* Fri Jan 19 2001 Trond Eivind Glomsrod +- new snapshot + +* Wed Dec 20 2000 Trond Eivind Glomsrod +- new snapshot + +* Mon Dec 04 2000 Trond Eivind Glomsrod +- new snapshot +- new alpha patch - it now compiles everywhere. Finally. + +* Fri Dec 01 2000 Trond Eivind Glomsrod +- new snapshot + +* Mon Nov 20 2000 Trond Eivind Glomsrod +- new CVS snapshot +- disable the patches +- don't use %%configure, as it confuses the autoconf script +- enable SPARC, disable Alpha + + +* Wed Aug 09 2000 Trond Eivind Glomsrod +- added patch from GDB team for C++ symbol handling + +* Tue Jul 25 2000 Trond Eivind Glomsrod +- upgrade to CVS snapshot +- excludearch SPARC, build on IA61 + +* Wed Jul 19 2000 Trond Eivind Glomsrod +- rebuild + +* Thu Jul 13 2000 Prospector +- automatic rebuild + +* Sun Jul 02 2000 Trond Eivind Glomsrod +- rebuild + +* Thu Jun 08 2000 Trond Eivind Glomsrod +- use %%configure, %%makeinstall, %%{_infodir}, %%{_mandir}, + and %%{_tmppath} +- the install scripts for info are broken(they don't care about + you specify in the installstep), work around that. +- don't build for IA64 + +* Mon May 22 2000 Trond Eivind Glomsrod +- upgraded to 5.0 - dump all patches. Reapply later if needed. +- added the NEWS file to the %%doc files +- don't delete files which doesn't get installed (readline, texinfo) +- let build system handle stripping and gzipping +- don't delete libmmalloc +- apply patch from jakub@redhat.com to make it build on SPARC + +* Fri Apr 28 2000 Matt Wilson +- rebuilt against new ncurses + +* Tue Mar 7 2000 Jeff Johnson +- rebuild for sparc baud rates > 38400. + +* Tue Feb 8 2000 Jakub Jelinek +- fix core file handling on i386 with glibc 2.1.3 headers + +* Fri Jan 14 2000 Jakub Jelinek +- fix reading registers from core on sparc. +- hack around build problems on i386 with glibc 2.1.3 headers + +* Thu Oct 7 1999 Jim Kingdon +- List files to install in /usr/info specifically (so we don't pick up +things like info.info from GDB snapshots). + +* Thu Oct 7 1999 Jim Kingdon +- Update GDB to 19991004 snapshot. This eliminates the need for the +sigtramp, sparc, xref, and threads patches. Update sparcmin patch. + +* Mon Aug 23 1999 Jim Kingdon +- Omit readline manpage. + +* Sat Aug 7 1999 Jim Kingdon +- Remove H.J. Lu's patches (they had been commented out). +- Add sigtramp patch (from gdb.cygnus.com) and threads patch (adapted +from code fusion CD-ROM). + +* Wed Apr 14 1999 Jeff Johnson +- merge H.J. Lu's patches into 4.18. + +* Mon Apr 05 1999 Cristian Gafton +- updated the kern22 patch with stuff from davem + +* Thu Apr 1 1999 Jeff Johnson +- sparc with 2.2 kernels no longer uses sunos ptrace (davem) + +* Sun Mar 21 1999 Cristian Gafton +- auto rebuild in the new build environment (release 3) + +* Mon Mar 8 1999 Jeff Johnson +- Sparc fiddles for Red Hat 6.0.