diff --git a/.gdb.metadata b/.gdb.metadata new file mode 100644 index 0000000..a2c398e --- /dev/null +++ b/.gdb.metadata @@ -0,0 +1,3 @@ +1ad1d2c6f0141b37bbe32b8add91b5691ecc6412 gdb-libstdc++-v3-python-8.1.1-20180626.tar.xz +4f38f7c24d523b6923f22404b7dee4152a00d0d4 gdb-14.2.tar.xz +fc22d7dfb0c4c686d7dfde9da2aa5b41c475899e v2.0.5.tar.gz diff --git a/.gitignore b/.gitignore index 7c43d2a..17a5208 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ /gdb-libstdc++-v3-python-8.1.1-20180626.tar.xz /gdb-10.2.tar.xz /v2.0.4.tar.gz +/gdb-14.2.tar.xz +/v2.0.5.tar.gz diff --git a/_gdb.spec.Patch.include b/_gdb.spec.Patch.include index 8198b37..f1c921d 100644 --- a/_gdb.spec.Patch.include +++ b/_gdb.spec.Patch.include @@ -1,5 +1,4 @@ -# Match the Fedora's version info. -#=fedora +# Check distro name is included in the version output. Patch001: gdb-6.3-rh-testversion-20041202.patch # Add a wrapper script to GDB that implements pstack using the @@ -7,606 +6,228 @@ Patch001: gdb-6.3-rh-testversion-20041202.patch #=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 +Patch003: 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. +# Test sideeffects of skipping ppc .so libs trampolines (BZ 218379). #=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 +Patch004: gdb-6.5-bz218379-ppc-solib-trampoline-test.patch # Allow running `/usr/bin/gcore' with provided but inaccessible tty (BZ 229517). #=fedoratest -Patch018: gdb-6.6-bz229517-gcore-without-terminal.patch +Patch005: 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 +Patch006: 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 +Patch007: 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 +Patch008: 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 +Patch009: 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 +Patch010: 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 +Patch011: 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 +Patch012: gdb-6.6-buildid-locate-rpm.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 +Patch013: gdb-6.7-ppc-clobbered-registers-O2-test.patch # Test gcore memory and time requirements for large inferiors. #=fedoratest -Patch031: gdb-6.5-gcore-buffer-limit-test.patch +Patch014: 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 +Patch015: gdb-6.3-mapping-zero-inode-test.patch # Test a crash on libraries missing the .text section. #=fedoratest -Patch035: gdb-6.5-section-num-fixup-test.patch +Patch016: 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 +Patch017: 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 +Patch018: 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 +Patch019: gdb-core-open-vdso-warning.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 +Patch020: gdb-archer-next-over-throw-cxx-exec.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 +Patch021: 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 +Patch022: 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 +Patch023: gdb-bz634108-solib_address.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 +Patch024: gdb-test-dw2-aranges.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 +Patch025: gdb-glibc-strstr-workaround.patch # Testcase for `Setting solib-absolute-prefix breaks vDSO' (BZ 818343). #=fedoratest -Patch056: gdb-rhbz-818343-set-solib-absolute-prefix-testcase.patch +Patch026: 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 +Patch027: 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 +Patch028: 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 +Patch029: gdb-6.6-buildid-locate-misleading-warning-missing-debuginfo-rhbz981154.patch # Testcase for '[SAP] Recursive dlopen causes SAP HANA installer to # crash.' (RH BZ 1156192). #=fedoratest -Patch061: gdb-rhbz1156192-recursive-dlopen-test.patch +Patch030: 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 +Patch031: gdb-rhbz1149205-catch-syscall-after-fork-test.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 +Patch032: 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 +Patch033: gdb-fedora-libncursesw.patch # [aarch64] Fix hardware watchpoints (RH BZ 1261564). #=fedoratest -Patch069: gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch +Patch034: 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 +Patch035: gdb-container-rh-pkg.patch # [dts+el7] [x86*] Bundle linux_perf.h for libipt (RH BZ 1256513). #=fedora -Patch072: gdb-linux_perf-bundle.patch +Patch036: gdb-linux_perf-bundle.patch -# Fix gdb-headless /usr/bin/ executables (BZ 1390251). +# Update gdb-add-index.sh such that, when the GDB environment +# variable is not set, the script is smarter than just looking for +# 'gdb' in the $PATH. # -# Also, make /usr/bin/gdb.minimal be the default GDB used, if it's -# present. For rationale, see: +# The actual search order is now: /usr/bin/gdb.minimal, gdb (in the +# $PATH), then /usr/libexec/gdb. +# +# For the rationale of looking for gdb.minimal see: # # https://fedoraproject.org/wiki/Changes/Minimal_GDB_in_buildroot +# #=fedora -Patch073: gdb-libexec-add-index.patch +Patch037: gdb-add-index.patch -# New testcase for: Fix -completion crash (Gary Benson, RH BZ 1398387). -#=fedoratest -Patch074: gdb-rhbz1398387-tab-crash-test.patch +# Back-port upstream commit 1f0fab7ff86 as part of a fix for +# non-deterministic gdb-index generation (RH BZ 2232086). +Patch038: gdb-rhbz2232086-refactor-selftest-support.patch -# [s390x] Backport arch12 instructions decoding (RH BZ 1553104). -# =fedoratest -Patch075: gdb-rhbz1553104-s390x-arch12-test.patch +# Back-port upstream commit aa19bc1d259 as part of a fix for +# non-deterministic gdb-index generation (RH BZ 2232086). +Patch039: gdb-rhbz-2232086-reduce-size-of-gdb-index.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 +# Back-port upstream commit acc117b57f7 as part of a fix for +# non-deterministic gdb-index generation (RH BZ 2232086). +Patch040: gdb-rhbz-2232086-cpp-ify-mapped-symtab.patch -# Backport fix for libstdc++ assert when performing tab completion -# (RH BZ 1912985). -Patch077: gdb-rhbz1912985-libstdc++-assert.patch +# Back-port upstream commit aff250145af as part of a fix for +# non-deterministic gdb-index generation (RH BZ 2232086). +Patch041: gdb-rhbz-2232086-generate-gdb-index-consistently.patch -# Backport fix for frame_id_p assertion failure (RH BZ 1909902). -Patch078: gdb-rhbz1909902-frame_id_p-assert-1.patch +# Back-port upstream commit 3644f41dc80 as part of a fix for +# non-deterministic gdb-index generation (RH BZ 2232086). +Patch042: gdb-rhbz-2232086-generate-dwarf-5-index-consistently.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 +Patch043: gdb-rhbz2250652-gdbpy_gil.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 +Patch044: gdb-rhbz2250652-avoid-PyOS_ReadlineTState.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 +Patch045: gdb-ftbs-swapped-calloc-args.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 - -# Backport "Fix GDB internal error by using text (instead of data) -# section offset" -# (Kevin Buettner, RHEL-107399) -Patch125: gdb-rhel-17399-sect_index_data-not-initialized.patch +# Backport upstream workaround for GCC 14 problem which cause assertion +# failures in GDB. +Patch046: gdb-rhbz2261580-intrusive_list-assertion-fix.patch # Backport "gdb: s390: Add arch14 record/replay support" -# (Andreas Arnez, RHEL-10550) -Patch126: gdb-rhel-10550-add-arch14-record.patch +# (Andreas Arnez, RHEL-36225) +Patch047: gdb-rhel-36225-add-arch14-record.patch -# Backport "x86: Add an x86_xsave_layout structure to -# handle variable XSAVE layouts." -# (John Baldwin, RHEL-10464) -Patch127: gdb-rhel-10464-xsave-update-1of21.patch +# Backport "PowerPC: Add support for Power11 options" +# (Peter Bergner, RHEL-36518) +Patch048: gdb-rhel-36518-add-power11-support.patch -# Backport "gdb: Store an x86_xsave_layout in i386_gdbarch_tdep." -# (John Baldwin, RHEL-10464) -Patch128: gdb-rhel-10464-xsave-update-2of21.patch +# Update x86 disassembler +Patch049: gdb-rhel-36527-apx-disasm.patch -# Backport "core: Support fetching x86 XSAVE layout from architectures." -# (John Baldwin, RHEL-10464) -Patch129: gdb-rhel-10464-xsave-update-3of21.patch +#Revert "gdb: remove unnecessary parameter wait_ptid from do_target_wait" +#(Andrew Burgess, RHEL-13298) +Patch050: gdb-rhel-13298-inferior-funcall-bp-condition-1-of-5.patch -# Backport "nat/x86--cpuid.h: Add x86_cpuid_count wrapper around -# __get_cpuid_count." -# (John Baldwin, RHEL-10464) -Patch130: gdb-rhel-10464-xsave-update-4of21.patch +#gdb: fix b/p conditions with infcalls in multi-threaded inferiors +#(Andrew Burgess, RHEL-13298) +Patch051: gdb-rhel-13298-inferior-funcall-bp-condition-2-of-5.patch -# Backport "x86 nat: Add helper functions to save the XSAVE layout for -# the host." -# (John Baldwin, RHEL-10464) -Patch131: gdb-rhel-10464-xsave-update-5of21.patch +#gdb: add timeouts for inferior function calls +#(Andrew Burgess, RHEL-13298) +Patch052: gdb-rhel-13298-inferior-funcall-bp-condition-3-of-5.patch -# Backport "gdb: Update x86 Linux architectures to support XSAVE layouts." -# (John Baldwin, RHEL-10464) -Patch132: gdb-rhel-10464-xsave-update-6of21.patch +#gdb: introduce unwind-on-timeout setting +#(Andrew Burgess, RHEL-13298) +Patch053: gdb-rhel-13298-inferior-funcall-bp-condition-4-of-5.patch -# Backport "gdb: Support XSAVE layouts for the current host in the Linux -# x86 targets." -# (John Baldwin, RHEL-10464) -Patch133: gdb-rhel-10464-xsave-update-7of21.patch +#gdb: rename unwindonsignal to unwind-on-signal +#(Andrew Burgess, RHEL-13298) +Patch054: gdb-rhel-13298-inferior-funcall-bp-condition-5-of-5.patch -# Backport "gdb: Use x86_xstate_layout to parse the XSAVE extended state area." -# (John Baldwin, RHEL-10464) -Patch134: gdb-rhel-10464-xsave-update-8of21.patch - -# Backport "gdbserver: Add a function to set the XSAVE mask and size." -# (John Baldwin, RHEL-10464) -Patch135: gdb-rhel-10464-xsave-update-9of21.patch - -# Backport "x86: Remove X86_XSTATE_SIZE and related constants." -# (John Baldwin, RHEL-10464) -Patch136: gdb-rhel-10464-xsave-update-10of21.patch - -# Backport "[gdb/tdep] Fix avx512 -m32 support in gdbserver" -# (Tom de Vries, RHEL-10464) -Patch137: gdb-rhel-10464-xsave-update-11of21.patch - -# Backport "gdbserver: Use x86_xstate_layout to parse the XSAVE extended -# state area." -# (Aleksandar Paunovic, RHEL-10464) -Patch138: gdb-rhel-10464-xsave-update-12of21.patch - -# Backport "gdbserver: Simplify handling of ZMM registers." -# (John Baldwin, RHEL-10464) -Patch139: gdb-rhel-10464-xsave-update-13of21.patch - -# Backport "gdbserver: Refactor the legacy region within the xsave struct" -# (Aleksandar Paunovic, RHEL-10464) -Patch140: gdb-rhel-10464-xsave-update-14of21.patch - -# Backport "gdbserver: Fix style of struct declarations in i387-fp.cc" -# (John Baldwin, RHEL-10464) -Patch141: gdb-rhel-10464-xsave-update-15of21.patch - -# Backport "nat/x86-cpuid.h: Remove non-x86 fallbacks" -# (John Baldwin, RHEL-10464) -Patch142: gdb-rhel-10464-xsave-update-16of21.patch - -# Backport "i386: Use a fallback XSAVE layout for remote targets" -# (John Baldwin, RHEL-10464) -Patch143: gdb-rhel-10464-xsave-update-17of21.patch - -# Backport "gdbserver: i387_cache_to_xsave: fix copy dest of zmm registers" -# (Simon Marchi, RHEL-10464) -Patch144: gdb-rhel-10464-xsave-update-18of21.patch - -# Backport "bfd/binutils: support for gdb target descriptions in the core file" -# (Andrew Burgess, RHEL-10464) -Patch145: gdb-rhel-10464-xsave-update-19of21.patch - -# Backport "gdb: write target description into core file" -# (Andrew Burgess, RHEL-10464) -Patch146: gdb-rhel-10464-xsave-update-20of21.patch - -# Backport "gdb/corefile: write NT_GDB_TDESC based on signalled thread" -# (Andrew Burgess, RHEL-10464) -Patch147: gdb-rhel-10464-xsave-update-21of21.patch +#gdb/unwinders: better support for $pc not saved +#(Andrew Burgess, RHEL-19390) +Patch055: gdb-rhel-19390-pc-not-saved.patch diff --git a/_gdb.spec.patch.include b/_gdb.spec.patch.include index 17fefd4..cb3143d 100644 --- a/_gdb.spec.patch.include +++ b/_gdb.spec.patch.include @@ -53,95 +53,3 @@ %patch053 -p1 %patch054 -p1 %patch055 -p1 -%patch056 -p1 -%patch057 -p1 -%patch058 -p1 -%patch059 -p1 -%patch060 -p1 -%patch061 -p1 -%patch062 -p1 -%patch063 -p1 -%patch064 -p1 -%patch065 -p1 -%patch066 -p1 -%patch067 -p1 -%patch068 -p1 -%patch069 -p1 -%patch070 -p1 -%patch071 -p1 -%patch072 -p1 -%patch073 -p1 -%patch074 -p1 -%patch075 -p1 -%patch076 -p1 -%patch077 -p1 -%patch078 -p1 -%patch079 -p1 -%patch080 -p1 -%patch081 -p1 -%patch082 -p1 -%patch083 -p1 -%patch084 -p1 -%patch085 -p1 -%patch086 -p1 -%patch087 -p1 -%patch088 -p1 -%patch089 -p1 -%patch090 -p1 -%patch091 -p1 -%patch092 -p1 -%patch093 -p1 -%patch094 -p1 -%patch095 -p1 -%patch096 -p1 -%patch097 -p1 -%patch098 -p1 -%patch099 -p1 -%patch100 -p1 -%patch101 -p1 -%patch102 -p1 -%patch103 -p1 -%patch104 -p1 -%patch105 -p1 -%patch106 -p1 -%patch107 -p1 -%patch108 -p1 -%patch109 -p1 -%patch110 -p1 -%patch111 -p1 -%patch112 -p1 -%patch113 -p1 -%patch114 -p1 -%patch115 -p1 -%patch116 -p1 -%patch117 -p1 -%patch118 -p1 -%patch119 -p1 -%patch120 -p1 -%patch121 -p1 -%patch122 -p1 -%patch123 -p1 -%patch124 -p1 -%patch125 -p1 -%patch126 -p1 -%patch127 -p1 -%patch128 -p1 -%patch129 -p1 -%patch130 -p1 -%patch131 -p1 -%patch132 -p1 -%patch133 -p1 -%patch134 -p1 -%patch135 -p1 -%patch136 -p1 -%patch137 -p1 -%patch138 -p1 -%patch139 -p1 -%patch140 -p1 -%patch141 -p1 -%patch142 -p1 -%patch143 -p1 -%patch144 -p1 -%patch145 -p1 -%patch146 -p1 -%patch147 -p1 diff --git a/_git_upstream_commit b/_git_upstream_commit index 02c1a0f..b70cde9 100644 --- a/_git_upstream_commit +++ b/_git_upstream_commit @@ -1 +1 @@ -ce35d7163e779b1321058b22f005c70ce1524b25 +02c10eaecb63e5dbb99cbfdd1c5385e53ed031ff diff --git a/_patch_order b/_patch_order index 7289fa3..fc8f938 100644 --- a/_patch_order +++ b/_patch_order @@ -1,20 +1,7 @@ gdb-6.3-rh-testversion-20041202.patch gdb-6.3-gstack-20050411.patch -gdb-6.3-test-dtorfix-20050121.patch -gdb-6.3-test-movedir-20050125.patch -gdb-6.3-threaded-watchpoints2-20050225.patch -gdb-6.3-inferior-notification-20050721.patch -gdb-6.3-inheritancetest-20050726.patch gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch -gdb-6.5-sharedlibrary-path.patch -gdb-6.5-BEA-testsuite.patch -gdb-6.5-last-address-space-byte-test.patch -gdb-6.5-readline-long-line-crash-test.patch -gdb-6.5-bz218379-solib-trampoline-lookup-lock-fix.patch -gdb-6.5-bz109921-DW_AT_decl_file-test.patch -gdb-6.3-bz140532-ppc-unwinding-test.patch -gdb-6.3-bz202689-exec-from-pthread-test.patch -gdb-6.6-bz230000-power6-disassembly-test.patch +gdb-6.5-bz218379-ppc-solib-trampoline-test.patch gdb-6.6-bz229517-gcore-without-terminal.patch gdb-6.6-testsuite-timeouts.patch gdb-6.6-bz237572-ppc-atomic-sequence-test.patch @@ -23,125 +10,46 @@ gdb-6.5-bz243845-stale-testing-zombie-test.patch gdb-6.6-buildid-locate.patch gdb-6.6-buildid-locate-solib-missing-ids.patch gdb-6.6-buildid-locate-rpm.patch -gdb-6.7-charsign-test.patch gdb-6.7-ppc-clobbered-registers-O2-test.patch -gdb-6.7-testsuite-stable-results.patch -gdb-6.5-ia64-libunwind-leak-test.patch -gdb-6.5-missed-trap-on-step-test.patch gdb-6.5-gcore-buffer-limit-test.patch gdb-6.3-mapping-zero-inode-test.patch -gdb-6.3-focus-cmd-prev-test.patch -gdb-6.8-bz442765-threaded-exec-test.patch gdb-6.5-section-num-fixup-test.patch gdb-6.8-bz466901-backtrace-full-prelinked.patch gdb-simultaneous-step-resume-breakpoint-test.patch gdb-core-open-vdso-warning.patch -gdb-ccache-workaround.patch -gdb-lineno-makeup-test.patch -gdb-ppc-power7-test.patch gdb-archer-next-over-throw-cxx-exec.patch -gdb-bz601887-dwarf4-rh-test.patch gdb-6.6-buildid-locate-rpm-librpm-workaround.patch gdb-test-bt-cfi-without-die.patch gdb-bz634108-solib_address.patch -gdb-test-pid0-core.patch gdb-test-dw2-aranges.patch -gdb-test-expr-cumulative-archer.patch -gdb-physname-pr11734-test.patch -gdb-physname-pr12273-test.patch -gdb-test-ivy-bridge.patch -gdb-runtest-pie-override.patch gdb-glibc-strstr-workaround.patch -gdb-rhel5.9-testcase-xlf-var-inside-mod.patch gdb-rhbz-818343-set-solib-absolute-prefix-testcase.patch gdb-rhbz947564-findvar-assertion-frame-failed-testcase.patch gdb-rhbz1007614-memleak-infpy_read_memory-test.patch gdb-6.6-buildid-locate-misleading-warning-missing-debuginfo-rhbz981154.patch -gdb-fortran-frame-string.patch gdb-rhbz1156192-recursive-dlopen-test.patch gdb-rhbz1149205-catch-syscall-after-fork-test.patch -gdb-rhbz1186476-internal-error-unqualified-name-re-set-test.patch -gdb-rhbz1350436-type-printers-error.patch gdb-rhbz1084404-ppc64-s390x-wrong-prologue-skip-O2-g-3of3.patch gdb-fedora-libncursesw.patch -gdb-opcodes-clflushopt-test.patch -gdb-6.6-buildid-locate-rpm-scl.patch gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch gdb-container-rh-pkg.patch -gdb-rhbz1325795-framefilters-test.patch gdb-linux_perf-bundle.patch -gdb-libexec-add-index.patch -gdb-rhbz1398387-tab-crash-test.patch -gdb-rhbz1553104-s390x-arch12-test.patch -gdb-rhbz1905996-fix-off-by-one-error-in-ada_fold_name.patch -gdb-rhbz1912985-libstdc++-assert.patch -gdb-rhbz1909902-frame_id_p-assert-1.patch -gdb-rhbz1909902-frame_id_p-assert-2.patch -gdb-rhbz1941080-fix-gdbserver-hang.patch -testing-custom-inputrc.patch -gdb-rhbz1931344-bfd_seek-elf_read_notes.patch -gdb-rhbz1964167-fortran-clean-up-array-expression-evaluation.patch -gdb-rhbz1964167-move-fortran-expr-handling.patch -gdb-rhbz1964167-fortran-whitespace_array.patch -gdb-rhbz1964167-convert-enum-range_type.patch -gdb-rhbz1964167-fortran-range_type-to-range_flag.patch -gdb-rhbz1964167-fortran-array-strides-in-expressions.patch -gdb-rhbz1964167-fortran-array-slices-at-prompt.patch -gdb-rhbz1964167-fortran-fix-type-format-mismatch-in-f-lang.c.patch -gdb-rhbz1898252-loadable-section-outside-ELF-segments.patch -gdb-rhbz1903375-s390x-store-on-condition.patch -gdb-gdb27743-psymtab-imported-unit.patch -gdb-dont-overwrite-fsgsbase-m32.patch -gdb-testsuite26997-fix-array-slices-m32.patch -gdb-flexible-array-member-expected-pattern.patch -gdb-rhbz1971095-libthread_db-update-1of5.patch -gdb-rhbz1971095-libthread_db-update-2of5.patch -gdb-rhbz1971095-libthread_db-update-3of5.patch -gdb-rhbz1971095-libthread_db-update-4of5.patch -gdb-rhbz1971095-libthread_db-update-5of5.patch -gdb-rhbz1870029-powerpc-remove-region-limit-dawr.patch -gdb-rhbz1870031-p10-prefixed-insn-1of3.patch -gdb-rhbz1870031-p10-prefixed-insn-2of3.patch -gdb-rhbz1870031-p10-prefixed-insn-3of3.patch -gdb-rhbz2012819-ibmz-update-1of5.patch -gdb-rhbz2012819-ibmz-update-2of5.patch -gdb-rhbz2012819-ibmz-update-3of5.patch -gdb-rhbz2012819-ibmz-update-4of5.patch -gdb-rhbz2012819-ibmz-update-5of5.patch -gdb-rhbz1870017-p10-plt-prologue-skipping.patch -gdb-rhbz2086761-unknown-cfa-rule.patch -gdb-rhbz2155439-assert-failure-copy_type.patch -gdb-fix-gdb.base-printcmds-s390x-regressions.patch -gdb-rhbz-2130624-assert_in_jit_event_handler.patch -libiberty-rhbz-2132600-prevent-buffer-overflow.patch -gdb-rhel-7328-fix-fortran-28801.patch -libiberty-infinite-recursion-fix-1-of-3.patch -libiberty-infinite-recursion-fix-2-of-3.patch -libiberty-infinite-recursion-fix-3-of-3.patch -gdb-find_and_open_source-empty-string-ub-1of4.patch -gdb-find_and_open_source-empty-string-ub-2of4.patch -gdb-find_and_open_source-empty-string-ub-3of4.patch -gdb-find_and_open_source-empty-string-ub-4of4.patch -gdb-rhel-17399-sect_index_data-not-initialized.patch -gdb-rhel-10550-add-arch14-record.patch -gdb-rhel-10464-xsave-update-1of21.patch -gdb-rhel-10464-xsave-update-2of21.patch -gdb-rhel-10464-xsave-update-3of21.patch -gdb-rhel-10464-xsave-update-4of21.patch -gdb-rhel-10464-xsave-update-5of21.patch -gdb-rhel-10464-xsave-update-6of21.patch -gdb-rhel-10464-xsave-update-7of21.patch -gdb-rhel-10464-xsave-update-8of21.patch -gdb-rhel-10464-xsave-update-9of21.patch -gdb-rhel-10464-xsave-update-10of21.patch -gdb-rhel-10464-xsave-update-11of21.patch -gdb-rhel-10464-xsave-update-12of21.patch -gdb-rhel-10464-xsave-update-13of21.patch -gdb-rhel-10464-xsave-update-14of21.patch -gdb-rhel-10464-xsave-update-15of21.patch -gdb-rhel-10464-xsave-update-16of21.patch -gdb-rhel-10464-xsave-update-17of21.patch -gdb-rhel-10464-xsave-update-18of21.patch -gdb-rhel-10464-xsave-update-19of21.patch -gdb-rhel-10464-xsave-update-20of21.patch -gdb-rhel-10464-xsave-update-21of21.patch +gdb-add-index.patch +gdb-rhbz2232086-refactor-selftest-support.patch +gdb-rhbz-2232086-reduce-size-of-gdb-index.patch +gdb-rhbz-2232086-cpp-ify-mapped-symtab.patch +gdb-rhbz-2232086-generate-gdb-index-consistently.patch +gdb-rhbz-2232086-generate-dwarf-5-index-consistently.patch +gdb-rhbz2250652-gdbpy_gil.patch +gdb-rhbz2250652-avoid-PyOS_ReadlineTState.patch +gdb-ftbs-swapped-calloc-args.patch +gdb-rhbz2261580-intrusive_list-assertion-fix.patch +gdb-rhel-36225-add-arch14-record.patch +gdb-rhel-36518-add-power11-support.patch +gdb-rhel-36527-apx-disasm.patch +gdb-rhel-13298-inferior-funcall-bp-condition-1-of-5.patch +gdb-rhel-13298-inferior-funcall-bp-condition-2-of-5.patch +gdb-rhel-13298-inferior-funcall-bp-condition-3-of-5.patch +gdb-rhel-13298-inferior-funcall-bp-condition-4-of-5.patch +gdb-rhel-13298-inferior-funcall-bp-condition-5-of-5.patch +gdb-rhel-19390-pc-not-saved.patch diff --git a/gdb-6.3-bz140532-ppc-unwinding-test.patch b/gdb-6.3-bz140532-ppc-unwinding-test.patch deleted file mode 100644 index 2e38a26..0000000 --- a/gdb-6.3-bz140532-ppc-unwinding-test.patch +++ /dev/null @@ -1,320 +0,0 @@ -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/gdb-6.3-bz202689-exec-from-pthread-test.patch b/gdb-6.3-bz202689-exec-from-pthread-test.patch deleted file mode 100644 index 74684dd..0000000 --- a/gdb-6.3-bz202689-exec-from-pthread-test.patch +++ /dev/null @@ -1,109 +0,0 @@ -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/gdb-6.3-focus-cmd-prev-test.patch b/gdb-6.3-focus-cmd-prev-test.patch deleted file mode 100644 index 27c85f1..0000000 --- a/gdb-6.3-focus-cmd-prev-test.patch +++ /dev/null @@ -1,53 +0,0 @@ -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/gdb-6.3-gstack-20050411.patch b/gdb-6.3-gstack-20050411.patch index 35c2de1..01e8ffa 100644 --- a/gdb-6.3-gstack-20050411.patch +++ b/gdb-6.3-gstack-20050411.patch @@ -16,7 +16,7 @@ Subject: gdb-6.3-gstack-20050411.patch 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 +@@ -2035,7 +2035,7 @@ info install-info clean-info dvi pdf install-pdf html install-html: force install: all @$(MAKE) $(FLAGS_TO_PASS) install-only @@ -25,7 +25,7 @@ diff --git a/gdb/Makefile.in b/gdb/Makefile.in transformed_name=`t='$(program_transform_name)'; \ echo gdb | sed -e "$$t"` ; \ if test "x$$transformed_name" = x; then \ -@@ -1775,7 +1775,25 @@ install-guile: +@@ -2085,7 +2085,25 @@ install-guile: install-python: $(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(GDB_DATADIR)/python/gdb @@ -52,8 +52,8 @@ diff --git a/gdb/Makefile.in b/gdb/Makefile.in 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 +@@ -2116,6 +2134,18 @@ uninstall: force $(CONFIG_UNINSTALL) + rm -f $(DESTDIR)$(bindir)/$$transformed_name @$(MAKE) DO=uninstall "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do +.PHONY: uninstall-gstack diff --git a/gdb-6.3-inferior-notification-20050721.patch b/gdb-6.3-inferior-notification-20050721.patch deleted file mode 100644 index 894ef79..0000000 --- a/gdb-6.3-inferior-notification-20050721.patch +++ /dev/null @@ -1,324 +0,0 @@ -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/gdb-6.3-inheritancetest-20050726.patch b/gdb-6.3-inheritancetest-20050726.patch deleted file mode 100644 index 6e12c82..0000000 --- a/gdb-6.3-inheritancetest-20050726.patch +++ /dev/null @@ -1,160 +0,0 @@ -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/gdb-6.3-rh-testversion-20041202.patch b/gdb-6.3-rh-testversion-20041202.patch index 7b0ed45..59132bf 100644 --- a/gdb-6.3-rh-testversion-20041202.patch +++ b/gdb-6.3-rh-testversion-20041202.patch @@ -1,38 +1,34 @@ From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Elena Zannoni +From: Andrew Burgess Date: Fri, 27 Oct 2017 21:07:50 +0200 Subject: gdb-6.3-rh-testversion-20041202.patch -;; Match the Fedora's version info. -;;=fedora +;; Check distro name is included in the version output. -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/gdb/testsuite/gdb.base/fedora-version.exp b/gdb/testsuite/gdb.base/fedora-version.exp +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.base/fedora-version.exp +@@ -0,0 +1,22 @@ ++# Copyright 2023 Free Software Foundation, Inc. ++ ++# This program is free software; you can 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 with a fresh gdb ++clean_restart ++ ++# Check the version string contains either the Fedora or RHEL distro ++# name, and that the version number looks roughly correct in format. ++gdb_test "show version" \ ++ "GNU gdb \\((Fedora Linux|Red Hat Enterprise Linux)\\) \[0-9\]+\\.\[0-9\]+-\[0-9\]+.*" diff --git a/gdb-6.3-test-dtorfix-20050121.patch b/gdb-6.3-test-dtorfix-20050121.patch deleted file mode 100644 index 01c0d56..0000000 --- a/gdb-6.3-test-dtorfix-20050121.patch +++ /dev/null @@ -1,247 +0,0 @@ -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/gdb-6.3-test-movedir-20050125.patch b/gdb-6.3-test-movedir-20050125.patch deleted file mode 100644 index 31fbc60..0000000 --- a/gdb-6.3-test-movedir-20050125.patch +++ /dev/null @@ -1,101 +0,0 @@ -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/gdb-6.3-threaded-watchpoints2-20050225.patch b/gdb-6.3-threaded-watchpoints2-20050225.patch deleted file mode 100644 index 42b5260..0000000 --- a/gdb-6.3-threaded-watchpoints2-20050225.patch +++ /dev/null @@ -1,253 +0,0 @@ -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/gdb-6.5-BEA-testsuite.patch b/gdb-6.5-BEA-testsuite.patch deleted file mode 100644 index a15cec2..0000000 --- a/gdb-6.5-BEA-testsuite.patch +++ /dev/null @@ -1,938 +0,0 @@ -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/gdb-6.5-bz109921-DW_AT_decl_file-test.patch b/gdb-6.5-bz109921-DW_AT_decl_file-test.patch deleted file mode 100644 index 8d03e3f..0000000 --- a/gdb-6.5-bz109921-DW_AT_decl_file-test.patch +++ /dev/null @@ -1,134 +0,0 @@ -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/gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch b/gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch index 5cdf65f..ab64f7f 100644 --- a/gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch +++ b/gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch @@ -44,17 +44,18 @@ glibc-debuginfo-2.7-2.x86_64: /usr/lib/debug/lib64/libc.so.6.debug: 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) +@@ -1308,6 +1308,11 @@ process_print_command_args (const char *args, value_print_options *print_opts, if (exp != nullptr && *exp) { + /* '*((int *(*) (void)) __errno_location) ()' is incompatible with + function descriptors. */ -+ if (target_has_execution && strcmp (exp, "errno") == 0) ++ if (target_has_execution () && strcmp (exp, "errno") == 0) + exp = "*(*(int *(*)(void)) __errno_location) ()"; - expression_up expr = parse_expression (exp); - val = evaluate_expression (expr.get ()); - } ++ + /* This setting allows large arrays to be printed by limiting the + number of elements that are loaded into GDB's memory; we only + need to load as many array elements as we plan to print. */ diff --git a/gdb/testsuite/gdb.dwarf2/dw2-errno.c b/gdb/testsuite/gdb.dwarf2/dw2-errno.c new file mode 100644 --- /dev/null diff --git a/gdb-6.5-missed-trap-on-step-test.patch b/gdb-6.5-bz218379-ppc-solib-trampoline-test.patch similarity index 61% rename from gdb-6.5-missed-trap-on-step-test.patch rename to gdb-6.5-bz218379-ppc-solib-trampoline-test.patch index 0ad8ad1..db4229d 100644 --- a/gdb-6.5-missed-trap-on-step-test.patch +++ b/gdb-6.5-bz218379-ppc-solib-trampoline-test.patch @@ -1,22 +1,21 @@ 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 +Subject: gdb-6.5-bz218379-ppc-solib-trampoline-test.patch -;; Test hiding unexpected breakpoints on intentional step commands. +;; Test sideeffects of skipping ppc .so libs trampolines (BZ 218379). ;;=fedoratest -Fix has been committed to: - gdb-6.6-scheduler_locking-step-sw-watchpoints2.patch +https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=218379 -diff --git a/gdb/testsuite/gdb.base/watchpoint-during-step.c b/gdb/testsuite/gdb.base/watchpoint-during-step.c +diff --git a/gdb/testsuite/gdb.base/step-over-trampoline.c b/gdb/testsuite/gdb.base/step-over-trampoline.c new file mode 100644 --- /dev/null -+++ b/gdb/testsuite/gdb.base/watchpoint-during-step.c -@@ -0,0 +1,30 @@ ++++ b/gdb/testsuite/gdb.base/step-over-trampoline.c +@@ -0,0 +1,28 @@ +/* This testcase is part of GDB, the GNU debugger. + -+ Copyright 2007 Free Software Foundation, Inc. ++ 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 @@ -35,21 +34,19 @@ new file mode 100644 + Please email any bugs, comments, and/or additions to this file to: + bug-gdb@prep.ai.mit.edu */ + -+static int var; ++#include + -+int main() ++int main (void) +{ -+ var = 1; -+ var = 2; -+ var = 3; -+ return 0; ++ puts ("hello world"); ++ return 0; +} -diff --git a/gdb/testsuite/gdb.base/watchpoint-during-step.exp b/gdb/testsuite/gdb.base/watchpoint-during-step.exp +diff --git a/gdb/testsuite/gdb.base/step-over-trampoline.exp b/gdb/testsuite/gdb.base/step-over-trampoline.exp new file mode 100644 --- /dev/null -+++ b/gdb/testsuite/gdb.base/watchpoint-during-step.exp -@@ -0,0 +1,44 @@ -+# Copyright 2007 Free Software Foundation, Inc. ++++ b/gdb/testsuite/gdb.base/step-over-trampoline.exp +@@ -0,0 +1,59 @@ ++# 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 @@ -65,7 +62,16 @@ new file mode 100644 +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + -+set testfile watchpoint-during-step ++if {[use_gdb_stub]} { ++ untested "skipping test because of use_gdb_stub" ++ return -1 ++} ++ ++if $tracelevel then { ++ strace $tracelevel ++} ++ ++set testfile step-over-trampoline +set srcfile ${testfile}.c +set binfile [standard_output_file ${testfile}] +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { @@ -80,16 +86,22 @@ new file mode 100644 +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + -+runto_main ++# For C programs, "start" should stop in main(). + -+gdb_breakpoint [gdb_get_line_number "var = 2"] -+gdb_continue_to_breakpoint "Find the first var set" ++gdb_test "start" \ ++ "main \\(\\) at .*$srcfile.*" \ ++ "start" + -+gdb_test "step" ".*var = 3;" "Step to the next var set" ++# main () at hello2.c:5 ++# 5 puts("hello world\n"); ++# (gdb) next ++# 0x100007e0 in call___do_global_ctors_aux () + -+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" ++gdb_test_multiple "next" "invalid `next' output" { ++ -re "\nhello world.*return 0;.*" { ++ pass "stepped over" ++ } ++ -re " in call___do_global_ctors_aux \\(\\).*" { ++ fail "stepped into trampoline" ++ } ++} diff --git a/gdb-6.5-bz218379-solib-trampoline-lookup-lock-fix.patch b/gdb-6.5-bz218379-solib-trampoline-lookup-lock-fix.patch deleted file mode 100644 index 54c1a1e..0000000 --- a/gdb-6.5-bz218379-solib-trampoline-lookup-lock-fix.patch +++ /dev/null @@ -1,27 +0,0 @@ -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/gdb-6.5-ia64-libunwind-leak-test.patch b/gdb-6.5-ia64-libunwind-leak-test.patch deleted file mode 100644 index 6efdca9..0000000 --- a/gdb-6.5-ia64-libunwind-leak-test.patch +++ /dev/null @@ -1,135 +0,0 @@ -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/gdb-6.5-last-address-space-byte-test.patch b/gdb-6.5-last-address-space-byte-test.patch deleted file mode 100644 index e99d811..0000000 --- a/gdb-6.5-last-address-space-byte-test.patch +++ /dev/null @@ -1,62 +0,0 @@ -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/gdb-6.5-readline-long-line-crash-test.patch b/gdb-6.5-readline-long-line-crash-test.patch deleted file mode 100644 index 087f916..0000000 --- a/gdb-6.5-readline-long-line-crash-test.patch +++ /dev/null @@ -1,111 +0,0 @@ -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/gdb-6.5-sharedlibrary-path.patch b/gdb-6.5-sharedlibrary-path.patch deleted file mode 100644 index 360e5d3..0000000 --- a/gdb-6.5-sharedlibrary-path.patch +++ /dev/null @@ -1,193 +0,0 @@ -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/gdb-6.6-buildid-locate-rpm-librpm-workaround.patch b/gdb-6.6-buildid-locate-rpm-librpm-workaround.patch index c86ec6b..2b862a0 100644 --- a/gdb-6.6-buildid-locate-rpm-librpm-workaround.patch +++ b/gdb-6.6-buildid-locate-rpm-librpm-workaround.patch @@ -6,29 +6,6 @@ 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 diff --git a/gdb-6.6-buildid-locate-rpm-scl.patch b/gdb-6.6-buildid-locate-rpm-scl.patch deleted file mode 100644 index 81056cc..0000000 --- a/gdb-6.6-buildid-locate-rpm-scl.patch +++ /dev/null @@ -1,128 +0,0 @@ -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/gdb-6.6-buildid-locate-rpm.patch b/gdb-6.6-buildid-locate-rpm.patch index bf783da..f38fdd5 100644 --- a/gdb-6.6-buildid-locate-rpm.patch +++ b/gdb-6.6-buildid-locate-rpm.patch @@ -1,6 +1,6 @@ From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 +From: Kevin Buettner +Date: Wed, 22 Feb 2023 22:30:40 -0700 Subject: gdb-6.6-buildid-locate-rpm.patch ;;=push+jan @@ -235,458 +235,41 @@ diff --git a/gdb/aclocal.m4 b/gdb/aclocal.m4 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; - } +@@ -780,10 +780,10 @@ missing_rpm_enlist_1 (const char *filename, int verify_vendor) + static rpmts (*rpmtsCreate_p) (void); + extern rpmts rpmtsFree(rpmts ts); + static rpmts (*rpmtsFree_p) (rpmts ts); +- extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag, ++ extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmDbiTagVal rpmtag, + const void * keyp, size_t keylen); + static rpmdbMatchIterator (*rpmtsInitIterator_p) (const rpmts ts, +- rpmTag rpmtag, ++ rpmDbiTagVal rpmtag, + const void *keyp, + size_t keylen); + #else /* !DLOPEN_LIBRPM */ +@@ -838,7 +838,7 @@ missing_rpm_enlist_1 (const char *filename, int verify_vendor) + && (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")))) ++ && (rpmtsInitIterator_p = (rpmdbMatchIterator (*) (const rpmts ts, rpmDbiTagVal rpmtag, const void *keyp, size_t keylen)) dlsym (h, "rpmtsInitIterator")))) + { + warning (_("Opened library \"%s\" is incompatible (%s), " + "missing debuginfos notifications will not be displayed"), +@@ -926,7 +926,7 @@ missing_rpm_enlist_1 (const char *filename, int verify_vendor) -+#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. */ + /* 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); ++ mi_debuginfo = rpmtsInitIterator_p (ts, (rpmDbiTagVal) RPMDBI_LABEL, debuginfo, 0); + xfree (debuginfo); + if (mi_debuginfo) + { diff --git a/gdb/config.in b/gdb/config.in --- a/gdb/config.in +++ b/gdb/config.in -@@ -39,6 +39,9 @@ +@@ -42,6 +42,9 @@ /* Handle .ctf type-info sections */ #undef ENABLE_LIBCTF @@ -696,9 +279,9 @@ diff --git a/gdb/config.in b/gdb/config.in /* 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 +@@ -265,6 +268,9 @@ + /* Define to 1 if you have the `m' library (-lm). */ + #undef HAVE_LIBM +/* Define if librpm library is being used. */ +#undef HAVE_LIBRPM @@ -709,9 +292,9 @@ diff --git a/gdb/config.in b/gdb/config.in 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 +@@ -778,6 +778,11 @@ AMD_DBGAPI_CFLAGS + ENABLE_BFD_64_BIT_FALSE + ENABLE_BFD_64_BIT_TRUE subdirs +RPM_LIBS +RPM_CFLAGS @@ -721,25 +304,25 @@ diff --git a/gdb/configure b/gdb/configure GDB_DATADIR DEBUGDIR MAKEINFO_EXTRA_FLAGS -@@ -873,6 +878,7 @@ with_gdb_datadir +@@ -911,6 +916,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 + with_amd_dbgapi +@@ -988,6 +994,8 @@ AMD_DBGAPI_CFLAGS + AMD_DBGAPI_LIBS DEBUGINFOD_CFLAGS DEBUGINFOD_LIBS +RPM_CFLAGS +RPM_LIBS YACC YFLAGS - XMKMF' -@@ -1621,6 +1629,8 @@ Optional Packages: - do not restrict auto-loaded files locations + ZSTD_CFLAGS +@@ -1679,6 +1687,8 @@ Optional Packages: + --with-amd-dbgapi support for the amd-dbgapi target (yes / no / auto) --with-debuginfod Enable debuginfo lookups with debuginfod (auto/yes/no) + --with-rpm query rpm database for missing debuginfos (yes/no, @@ -747,7 +330,7 @@ diff --git a/gdb/configure b/gdb/configure --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: +@@ -1759,6 +1769,8 @@ Some influential environment variables: C compiler flags for DEBUGINFOD, overriding pkg-config DEBUGINFOD_LIBS linker flags for DEBUGINFOD, overriding pkg-config @@ -756,7 +339,7 @@ diff --git a/gdb/configure b/gdb/configure 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 +@@ -18039,6 +18051,495 @@ _ACEOF { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_auto_load_safe_path" >&5 $as_echo "$with_auto_load_safe_path" >&6; } @@ -820,6 +403,7 @@ diff --git a/gdb/configure b/gdb/configure +#include +#include +#include ++#include + +int +main () @@ -936,7 +520,7 @@ diff --git a/gdb/configure b/gdb/configure +extern Header rpmdbNextIterator(rpmdbMatchIterator mi); +extern rpmts rpmtsCreate(void); +extern rpmts rpmtsFree(rpmts ts); -+extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag, ++extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmDbiTagVal rpmtag, + const void * keyp, size_t keylen); + +int @@ -1198,7 +782,7 @@ diff --git a/gdb/configure b/gdb/configure +extern Header rpmdbNextIterator(rpmdbMatchIterator mi); +extern rpmts rpmtsCreate(void); +extern rpmts rpmtsFree(rpmts ts); -+extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag, ++extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmDbiTagVal rpmtag, + const void * keyp, size_t keylen); + +int @@ -1254,7 +838,7 @@ diff --git a/gdb/configure b/gdb/configure 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, +@@ -173,6 +173,200 @@ AC_DEFINE_DIR(AUTO_LOAD_SAFE_PATH, escape_dir, [Directories safe to hold auto-loaded files.]) AC_MSG_RESULT([$with_auto_load_safe_path]) @@ -1304,6 +888,7 @@ diff --git a/gdb/configure.ac b/gdb/configure.ac +#include +#include +#include ++#include + ]], [[ + void *h; + const char *const *rpmverp; @@ -1398,7 +983,7 @@ diff --git a/gdb/configure.ac b/gdb/configure.ac +extern Header rpmdbNextIterator(rpmdbMatchIterator mi); +extern rpmts rpmtsCreate(void); +extern rpmts rpmtsFree(rpmts ts); -+extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag, ++extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmDbiTagVal rpmtag, + const void * keyp, size_t keylen); + ]]), [ + LIBRPM_COMPAT=true @@ -1457,15 +1042,15 @@ diff --git a/gdb/configure.ac b/gdb/configure.ac 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" +@@ -43,6 +43,7 @@ #include "async-event.h" + #include "bt-utils.h" + #include "pager.h" +#include "symfile.h" /* readline include files. */ #include "readline/readline.h" -@@ -364,6 +365,8 @@ display_gdb_prompt (const char *new_prompt) +@@ -404,6 +405,8 @@ display_gdb_prompt (const char *new_prompt) /* Reset the nesting depth used when trace-commands is set. */ reset_command_nest_depth (); @@ -1474,7 +1059,7 @@ diff --git a/gdb/event-top.c b/gdb/event-top.c /* 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) +@@ -788,7 +791,10 @@ command_line_handler (gdb::unique_xmalloc_ptr &&rl) command_handler (cmd); if (ui->prompt_state != PROMPTED) @@ -1489,11 +1074,11 @@ diff --git a/gdb/event-top.c b/gdb/event-top.c 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); +@@ -367,6 +367,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 */ + /* From minidebug.c. */ diff --git a/gdb-6.6-buildid-locate-solib-missing-ids.patch b/gdb-6.6-buildid-locate-solib-missing-ids.patch index f1f5e83..e9ec7b5 100644 --- a/gdb-6.6-buildid-locate-solib-missing-ids.patch +++ b/gdb-6.6-buildid-locate-solib-missing-ids.patch @@ -14,7 +14,7 @@ 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, +@@ -1320,14 +1320,28 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm, } { @@ -38,13 +38,14 @@ diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c + 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) ++ if (current_program_space->symfile_object_file != NULL ++ && (current_program_space->symfile_object_file->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, +@@ -1342,23 +1356,7 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm, xfree (name); } else @@ -60,8 +61,8 @@ diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c - instead) if the on-disk files no longer match the - running program version. */ - -- if (symfile_objfile != NULL -- && (symfile_objfile->flags +- if (current_program_space->symfile_object_file != NULL +- && (current_program_space->symfile_object_file->flags - & OBJF_BUILD_ID_CORE_LOADED) != 0) - newobj->so_name[0] = 0; - } diff --git a/gdb-6.6-buildid-locate.patch b/gdb-6.6-buildid-locate.patch index f606793..1350051 100644 --- a/gdb-6.6-buildid-locate.patch +++ b/gdb-6.6-buildid-locate.patch @@ -9,7 +9,7 @@ Subject: gdb-6.6-buildid-locate.patch 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 * +@@ -110,7 +110,7 @@ static inline char * bfd_strdup (const char *str) { size_t len = strlen (str) + 1; @@ -21,7 +21,7 @@ diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h 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 * +@@ -116,7 +116,7 @@ static inline char * bfd_strdup (const char *str) { size_t len = strlen (str) + 1; @@ -33,7 +33,7 @@ diff --git a/bfd/libbfd.h b/bfd/libbfd.h 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 @@ +@@ -24,14 +24,72 @@ #include "gdbsupport/gdb_vecs.h" #include "symfile.h" #include "objfiles.h" @@ -46,6 +46,8 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c +#include "gdb_bfd.h" +#include "gdbcmd.h" #include "gdbcore.h" + #include "cli/cli-style.h" ++#include "inferior.h" +#include "objfiles.h" +#include "observable.h" +#include "symfile.h" @@ -58,8 +60,8 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c +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); ++ gdb_printf (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. */ @@ -103,9 +105,9 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c -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) + /* Dynamic objfiles such as ones created by JIT reader API + have no underlying bfd structure (that is, objfile->obfd +@@ -50,6 +108,348 @@ build_id_bfd_get (bfd *abfd) return NULL; } @@ -454,7 +456,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c /* See build-id.h. */ int -@@ -51,7 +450,7 @@ build_id_verify (bfd *abfd, size_t check_len, const bfd_byte *check) +@@ -58,7 +458,7 @@ build_id_verify (bfd *abfd, size_t check_len, const bfd_byte *check) const struct bfd_build_id *found; int retval = 0; @@ -463,14 +465,15 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c 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) +@@ -73,63 +473,166 @@ 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; ++ char buf[PATH_MAX + 1], *retval; ++ gdb::unique_xmalloc_ptr target; + ssize_t got; + + if (level > 10) @@ -482,7 +485,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c + buf[got] = '\0'; + + if (IS_ABSOLUTE_PATH (buf)) -+ target = xstrdup (buf); ++ target = make_unique_xstrdup (buf); + else + { + const std::string dir (ldirname (symlink)); @@ -496,8 +499,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c + "%s", dir.c_str(), buf); + } + -+ retval = link_resolve (target, level + 1); -+ xfree (target); ++ retval = link_resolve (target.get (), level + 1); + return retval; +} + @@ -516,42 +518,49 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c + if (separate_debug_file_debug) { -- printf_unfiltered (_(" Trying %s..."), link.c_str ()); -+ printf_unfiltered (_(" Trying %s..."), orig_link.c_str ()); - gdb_flush (gdb_stdout); +- gdb_printf (gdb_stdlog, _(" Trying %s..."), link.c_str ()); +- gdb_flush (gdb_stdlog); ++ gdb_printf (gdb_stdlog, _(" 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) +- gdb::unique_xmalloc_ptr filename_holder; +- const char *filename = nullptr; +- if (startswith (link, TARGET_SYSROOT_PREFIX)) +- filename = link.c_str (); +- else if (access (link.c_str (), F_OK) == 0) + for (unsigned seqno = 0;; seqno++) { -- if (separate_debug_file_debug) -- printf_unfiltered (_(" no, unable to compute real path\n")); +- filename_holder.reset (lrealpath (link.c_str ())); +- filename = filename_holder.get (); +- } + std::string link = orig_link; -- return {}; -- } +- if (filename == NULL) +- { +- if (separate_debug_file_debug) +- gdb_printf (gdb_stdlog, +- _(" no, unable to compute real path\n")); + 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. */ -+ + +- return {}; +- } + 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); +- gdb_bfd_ref_ptr debug_bfd = gdb_bfd_open (filename, gnutarget); + ret_link = link; - if (debug_bfd == NULL) - { - if (separate_debug_file_debug) -- printf_unfiltered (_(" no, unable to open.\n")); +- gdb_printf (gdb_stdlog, _(" no, unable to open.\n")); + struct stat statbuf_trash; + + /* `access' automatically dereferences LINK. */ @@ -562,35 +571,42 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c + } + + /* 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 ())); ++ gdb::unique_xmalloc_ptr filename_holder; ++ const char *filename = nullptr; ++ if (startswith (link, TARGET_SYSROOT_PREFIX)) ++ filename = link.c_str (); ++ else if (access (link.c_str (), F_OK) == 0) ++ { ++ filename_holder.reset (lrealpath (link.c_str ())); ++ filename = filename_holder.get (); ++ } + + if (filename == NULL) + { + if (separate_debug_file_debug) -+ printf_unfiltered (_(" no, unable to compute real path\n")); ++ gdb_printf (gdb_stdlog, ++ _(" 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 {}; ++ gdb_bfd_ref_ptr debug_bfd = gdb_bfd_open (filename, gnutarget); ++ + if (debug_bfd == NULL) + { + if (separate_debug_file_debug) -+ printf_unfiltered (_(" no, unable to open.\n")); -+ ++ gdb_printf (gdb_stdlog, _(" no, unable to open.\n")); + +- return {}; + 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")); ++ gdb_printf (gdb_stdlog, ++ _(" no, build-id does not match.\n")); + + continue; + } @@ -605,17 +621,16 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c + if (ret_bfd != NULL) { if (separate_debug_file_debug) -- printf_unfiltered (_(" no, build-id does not match.\n")); -- -- return {}; -+ printf_unfiltered (_(" yes!\n")); +- gdb_printf (gdb_stdlog, _(" no, build-id does not match.\n")); ++ gdb_printf (gdb_stdlog, _(" 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; -+ + +- return {}; + /* 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 */ @@ -632,7 +647,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c } - if (separate_debug_file_debug) -- printf_unfiltered (_(" yes!\n")); +- gdb_printf (gdb_stdlog, _(" yes!\n")); + if (link_return != NULL) + { + if (ret_bfd != NULL) @@ -650,7 +665,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c } /* 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, +@@ -138,7 +641,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, @@ -659,7 +674,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c { /* 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, +@@ -161,16 +664,17 @@ build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id, if (size > 0) { size--; @@ -680,17 +695,16 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c 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) +@@ -181,7 +685,7 @@ build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id, + if (!gdb_sysroot.empty ()) { 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); ++ debug_bfd = build_id_to_debug_bfd_1 (link, build_id_len, build_id, NULL); 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, +@@ -190,31 +694,663 @@ build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id, return {}; } @@ -708,8 +722,448 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c + return result; +} + ++void debug_flush_missing (void); ++ ++#ifdef HAVE_LIBRPM ++ ++#include ++#include ++#include ++#include ++#ifdef DLOPEN_LIBRPM ++#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. */ ++ ++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 ++#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; ++ 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) ++ { ++#ifndef GDB_INDEX_VERIFY_VENDOR ++ for (;;) ++#else ++ if (!verify_vendor) for (;;) ++#endif ++ { ++ 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++; ++ } ++#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); ++ } ++ ++ rpmtsFree_p (ts); ++ ++ 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) ++{ ++ 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. ++ ++ Note: kevinb/2023-02-22: The code below used to call ++ puts_unfiltered() and printf_unfiltered(), but calls to these ++ functions have been replaced by calls to gdb_printf(). The call ++ chain shown above (probably) used to be the case at one time and ++ hopefully something similar is still the case now that ++ gdb_printf() is being used instead. */ ++ missing_rpm_list_entries = 0; ++ ++ gdb_printf (_("Missing separate debuginfos, use: %s"), ++#ifdef DNF_DEBUGINFO_INSTALL ++ "dnf " ++#endif ++ "debuginfo-install"); ++ for (const char *el : array) ++ { ++ gdb_printf (" %s", el); ++ } ++ gdb_printf ("\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 @@ -763,11 +1217,17 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c + /* 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) ++debug_print_executable_changed (struct program_space *pspace, bool reload_p) +{ ++#ifdef HAVE_LIBRPM ++ missing_rpm_change (); ++#endif + missing_filepair_change (); +} + @@ -834,14 +1294,43 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c + + *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. */ ++ ++ gdb_printf (gdb_stdlog, ++ _("Missing separate debuginfo for %s.\n"), binary); ++ if (debug != NULL) ++ { ++ if (access (debug, F_OK) == 0) { ++ gdb_printf (gdb_stdlog, _("Try: %s %s\n"), ++#ifdef DNF_DEBUGINFO_INSTALL ++ "dnf" ++#else ++ "yum" ++#endif ++ " --enablerepo='*debug*' install", debug); ++ } else ++ gdb_printf (gdb_stdlog, _("The debuginfo package for this file is probably broken.\n")); ++ } ++ } +} + /* See build-id.h. */ @@ -870,27 +1359,29 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c /* 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) + find_separate_debug_file_by_buildid (struct objfile *objfile, +- deferred_warnings *warnings) ++ deferred_warnings *warnings, ++ gdb::unique_xmalloc_ptr *build_id_filename_return) { const struct bfd_build_id *build_id; -- build_id = build_id_bfd_get (objfile->obfd); +- build_id = build_id_bfd_get (objfile->obfd.get ()); + if (build_id_filename_return) + *build_id_filename_return = NULL; + -+ build_id = build_id_bfd_shdr_get (objfile->obfd); ++ build_id = build_id_bfd_shdr_get (objfile->obfd.get ()); if (build_id != NULL) { if (separate_debug_file_debug) - printf_unfiltered (_("\nLooking for separate debug info (build-id) for " - "%s\n"), objfile_name (objfile)); +@@ -222,8 +1358,21 @@ find_separate_debug_file_by_buildid (struct objfile *objfile, + _("\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->data, + (!build_id_filename_return ? NULL : &build_id_filename_cstr))); + if (build_id_filename_return) + { @@ -906,15 +1397,15 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c /* 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) +@@ -243,3 +1392,22 @@ find_separate_debug_file_by_buildid (struct objfile *objfile, return std::string (); } + -+extern void _initialize_build_id (void); ++void _initialize_build_id (); + +void -+_initialize_build_id (void) ++_initialize_build_id () +{ + add_setshow_zinteger_cmd ("build-id-verbose", no_class, &build_id_verbose, + _("\ @@ -926,7 +1417,8 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c + show_build_id_verbose, + &setlist, &showlist); + -+ gdb::observers::executable_changed.attach (debug_print_executable_changed); ++ gdb::observers::executable_changed.attach (debug_print_executable_changed, ++ "build-id"); +} diff --git a/gdb/build-id.h b/gdb/build-id.h --- a/gdb/build-id.h @@ -944,13 +1436,13 @@ diff --git a/gdb/build-id.h b/gdb/build-id.h /* 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, +@@ -38,14 +39,19 @@ 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); ++ char **link_return = NULL); + +extern char *build_id_to_filename (const struct bfd_build_id *build_id, + char **link_return); @@ -966,35 +1458,35 @@ diff --git a/gdb/build-id.h b/gdb/build-id.h /* 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. */ +@@ -58,7 +64,8 @@ extern gdb_bfd_ref_ptr build_id_to_exec_bfd (size_t build_id_len, + will be printed. */ --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); + extern std::string find_separate_debug_file_by_buildid +- (struct objfile *objfile, deferred_warnings *warnings); ++ (struct objfile *objfile, deferred_warnings *warnings, ++ 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)) +@@ -729,7 +729,7 @@ coff_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags) { -- std::string debugfile = find_separate_debug_file_by_buildid (objfile); -+ std::string debugfile = find_separate_debug_file_by_buildid (objfile, -+ NULL); + deferred_warnings warnings; + std::string debugfile +- = find_separate_debug_file_by_buildid (objfile, &warnings); ++ = find_separate_debug_file_by_buildid (objfile, &warnings, NULL); if (debugfile.empty ()) - debugfile = find_separate_debug_file_by_debuglink (objfile); + debugfile 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 "frame.h" +#include "auxv.h" +#include "build-id.h" +#include "elf/common.h" @@ -1002,7 +1494,7 @@ diff --git a/gdb/corelow.c b/gdb/corelow.c #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) +@@ -380,6 +384,8 @@ add_to_thread_list (asection *asect, asection *reg_sect, inferior *inf) switch_to_thread (thr); /* Yes, make it current. */ } @@ -1011,7 +1503,7 @@ diff --git a/gdb/corelow.c b/gdb/corelow.c /* 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) +@@ -563,12 +569,14 @@ rename_vmcore_idle_reg_sections (bfd *abfd, inferior *inf) static void locate_exec_from_corefile_build_id (bfd *abfd, int from_tty) { @@ -1026,21 +1518,23 @@ diff --git a/gdb/corelow.c b/gdb/corelow.c + = build_id_to_exec_bfd (build_id->size, build_id->data, + &build_id_filename); - if (execbfd != nullptr) + if (execbfd == nullptr) { +@@ -596,7 +604,12 @@ locate_exec_from_corefile_build_id (bfd *abfd, int from_tty) 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; ++ if (current_program_space->symfile_object_file != NULL) ++ current_program_space->symfile_object_file->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, +@@ -1506,4 +1519,11 @@ _initialize_corelow () + maintenance_print_core_file_backed_mappings, _("Print core file's file-backed mappings."), &maintenanceprintlist); + @@ -1054,7 +1548,7 @@ diff --git a/gdb/corelow.c b/gdb/corelow.c 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. +@@ -22296,6 +22296,27 @@ information files. @end table @@ -1085,16 +1579,16 @@ diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo 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) +@@ -96,7 +96,7 @@ index_cache_store_context::index_cache_store_context (const index_cache &ic, 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); +- const bfd_build_id *build_id = build_id_bfd_get (per_bfd->obfd); ++ const bfd_build_id *build_id = build_id_bfd_shdr_get (per_bfd->obfd); if (build_id == nullptr) { - if (debug_index_cache) -@@ -113,7 +113,8 @@ index_cache::store (dwarf2_per_objfile *per_objfile) + index_cache_debug ("objfile %s has no build id", +@@ -111,7 +111,8 @@ index_cache_store_context::index_cache_store_context (const index_cache &ic, if (dwz != nullptr) { @@ -1107,25 +1601,16 @@ diff --git a/gdb/dwarf2/index-cache.c b/gdb/dwarf2/index-cache.c 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) +@@ -3355,7 +3355,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); +- const bfd_build_id *build_id = build_id_bfd_get (obj->obfd.get ()); ++ const bfd_build_id *build_id = build_id_bfd_shdr_get (obj->obfd.get ()); if (build_id == nullptr) return {}; -@@ -6002,7 +6002,7 @@ get_gdb_index_contents_from_cache (objfile *obj, dwarf2_per_bfd *dwarf2_per_bfd) +@@ -3368,7 +3368,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) { @@ -1137,50 +1622,52 @@ diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c 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) +@@ -1220,8 +1220,10 @@ elf_symfile_read_dwarf2 (struct objfile *objfile, { -- std::string debugfile = find_separate_debug_file_by_buildid (objfile); + deferred_warnings warnings; + + gdb::unique_xmalloc_ptr build_id_filename; -+ std::string debugfile -+ = find_separate_debug_file_by_buildid (objfile, &build_id_filename); + std::string debugfile +- = find_separate_debug_file_by_buildid (objfile, &warnings); ++ = find_separate_debug_file_by_buildid (objfile, &warnings, ++ &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 + debugfile = find_separate_debug_file_by_debuglink (objfile, &warnings); +@@ -1239,7 +1241,7 @@ elf_symfile_read_dwarf2 (struct objfile *objfile, { 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); + const struct bfd_build_id *build_id +- = build_id_bfd_get (objfile->obfd.get ()); ++ = build_id_bfd_shdr_get (objfile->obfd.get ()); + const char *filename = bfd_get_filename (objfile->obfd.get ()); if (build_id != nullptr) - { -@@ -1338,6 +1340,10 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags) +@@ -1265,6 +1267,11 @@ elf_symfile_read_dwarf2 (struct objfile *objfile, has_dwarf2 = true; } } + /* Check if any separate debug info has been extracted out. */ -+ else if (bfd_get_section_by_name (objfile->obfd, ".gnu_debuglink") ++ else if (bfd_get_section_by_name (objfile->obfd.get (), ++ ".gnu_debuglink") + != NULL) + debug_print_missing (objfile_name (objfile), build_id_filename.get ()); } } - } + /* If all the methods to collect the debuginfo failed, print the 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 (); +@@ -237,7 +237,7 @@ validate_exec_file (int from_tty) 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); + const bfd_build_id *exec_file_build_id +- = build_id_bfd_get (current_program_space->exec_bfd ()); ++ = build_id_bfd_shdr_get (current_program_space->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) +@@ -250,7 +250,7 @@ validate_exec_file (int from_tty) if (abfd != nullptr) { const bfd_build_id *target_exec_file_build_id @@ -1192,8 +1679,8 @@ diff --git a/gdb/exec.c b/gdb/exec.c 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; +@@ -884,6 +884,10 @@ struct objfile + bool object_format_has_copy_relocs = false; }; +/* This file was loaded according to the BUILD_ID_CORE_LOADS rules. */ @@ -1206,36 +1693,36 @@ diff --git a/gdb/objfiles.h b/gdb/objfiles.h 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) +@@ -158,7 +158,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); +- build_id = build_id_bfd_get (objfile->obfd.get ()); ++ build_id = build_id_bfd_shdr_get (objfile->obfd.get ()); } 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)) +@@ -629,7 +629,7 @@ gdbpy_lookup_objfile (PyObject *self, PyObject *args, PyObject *kw) + if (obfd == nullptr) + return 0; + +- const bfd_build_id *obfd_build_id = build_id_bfd_get (obfd); ++ const bfd_build_id *obfd_build_id = build_id_bfd_shdr_get (obfd); + if (obfd_build_id == nullptr) + return 0; + 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 @@ +@@ -44,6 +44,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, + #include + +@@ -1318,9 +1319,51 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm, continue; } @@ -1277,8 +1764,8 @@ diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c + instead) if the on-disk files no longer match the + running program version. */ + -+ if (symfile_objfile != NULL -+ && (symfile_objfile->flags ++ if (current_program_space->symfile_object_file != NULL ++ && (current_program_space->symfile_object_file->flags + & OBJF_BUILD_ID_CORE_LOADED) != 0) + newobj->so_name[0] = 0; + } @@ -1293,21 +1780,21 @@ diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c 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; +@@ -1167,7 +1167,7 @@ open_source_file (struct symtab *s) } -- 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); + const struct bfd_build_id *build_id +- = build_id_bfd_get (ofp->obfd.get ()); ++ = build_id_bfd_shdr_get (ofp->obfd.get ()); /* 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); +@@ -357,12 +357,18 @@ bool expand_symtabs_matching + void map_symbol_filenames (gdb::function_view fun, + bool need_fullname); + /* Target-agnostic function to load the sections of an executable into memory. @@ -1321,13 +1808,13 @@ diff --git a/gdb/symfile.h b/gdb/symfile.h +extern void debug_print_missing (const char *binary, const char *debug); +#define BUILD_ID_MAIN_EXECUTABLE_FILENAME _("the main executable file") + - /* From dwarf2read.c */ + /* From minidebug.c. */ - /* Names for a dwarf2 debugging section. The field NORMAL is the normal + extern gdb_bfd_ref_ptr find_separate_debug_file_in_section (struct objfile *); 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 { +@@ -347,3 +347,33 @@ gdb_test_multiple "core-file $corefile" $test { pass $test } } @@ -1364,7 +1851,7 @@ diff --git a/gdb/testsuite/gdb.base/corefile.exp b/gdb/testsuite/gdb.base/corefi 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 { } { +@@ -179,7 +179,8 @@ proc test_empty_history_filename { } { global env global gdb_prompt @@ -1388,7 +1875,17 @@ diff --git a/gdb/testsuite/gdb.base/new-ui-pending-input.exp b/gdb/testsuite/gdb 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 { } { +@@ -226,7 +226,8 @@ if ![info exists INTERNAL_GDBFLAGS] { + "-nx" \ + "-q" \ + {-iex "set height 0"} \ +- {-iex "set width 0"}]] ++ {-iex "set width 0"} \ ++ {-iex "set build-id-verbose 0"}]] + + # If DEBUGINFOD_URLS is set, gdb will try to download sources and + # debug info for f.i. system libraries. Prevent this. +@@ -2434,6 +2435,17 @@ proc default_gdb_start { } { } } @@ -1409,7 +1906,7 @@ diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp 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 } { +@@ -321,6 +321,16 @@ proc default_mi_gdb_start { { flags {} } } { warning "Couldn't set the width to 0." } } diff --git a/gdb-6.6-bz230000-power6-disassembly-test.patch b/gdb-6.6-bz230000-power6-disassembly-test.patch deleted file mode 100644 index 2b36147..0000000 --- a/gdb-6.6-bz230000-power6-disassembly-test.patch +++ /dev/null @@ -1,94 +0,0 @@ -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/gdb-6.6-testsuite-timeouts.patch b/gdb-6.6-testsuite-timeouts.patch index a896313..9a31a5b 100644 --- a/gdb-6.6-testsuite-timeouts.patch +++ b/gdb-6.6-testsuite-timeouts.patch @@ -9,7 +9,7 @@ Subject: gdb-6.6-testsuite-timeouts.patch 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 +@@ -37,6 +37,8 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb clean_restart ${binfile} @@ -21,7 +21,7 @@ diff --git a/gdb/testsuite/gdb.base/annota1.exp b/gdb/testsuite/gdb.base/annota1 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 +@@ -36,6 +36,8 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb clean_restart ${binfile} diff --git a/gdb-6.7-charsign-test.patch b/gdb-6.7-charsign-test.patch deleted file mode 100644 index 1a66390..0000000 --- a/gdb-6.7-charsign-test.patch +++ /dev/null @@ -1,130 +0,0 @@ -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/gdb-6.7-testsuite-stable-results.patch b/gdb-6.7-testsuite-stable-results.patch deleted file mode 100644 index 0eca1a7..0000000 --- a/gdb-6.7-testsuite-stable-results.patch +++ /dev/null @@ -1,104 +0,0 @@ -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/gdb-6.8-bz442765-threaded-exec-test.patch b/gdb-6.8-bz442765-threaded-exec-test.patch deleted file mode 100644 index 90685c7..0000000 --- a/gdb-6.8-bz442765-threaded-exec-test.patch +++ /dev/null @@ -1,181 +0,0 @@ -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/gdb-add-index.patch b/gdb-add-index.patch new file mode 100644 index 0000000..5039172 --- /dev/null +++ b/gdb-add-index.patch @@ -0,0 +1,77 @@ +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-add-index.patch + +;; Update gdb-add-index.sh such that, when the GDB environment +;; variable is not set, the script is smarter than just looking for +;; 'gdb' in the $PATH. +;; +;; The actual search order is now: /usr/bin/gdb.minimal, gdb (in the +;; $PATH), then /usr/libexec/gdb. +;; +;; For the rationale of looking for gdb.minimal 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 +@@ -16,14 +16,52 @@ + # You should have received a copy of the GNU General Public License + # along with this program. If not, see . + +-# This program assumes gdb and objcopy are in $PATH. +-# If not, or you want others, pass the following in the environment +-GDB=${GDB:=gdb} ++# This program assumes objcopy and readelf are in $PATH. If not, or ++# you want others, pass the following in the environment + OBJCOPY=${OBJCOPY:=objcopy} + READELF=${READELF:=readelf} + + myname="${0##*/}" + ++# For GDB itself we need to be a little smarter. If GDB is set in the ++# environment then we will use that. But if GDB is not set in the ++# environment then we have a couple of options that we need to check ++# through. ++# ++# Our default choice is for /usr/bin/gdb.minimal. For an explanation ++# of why this is chosen, check out: ++# https://bugzilla.redhat.com/show_bug.cgi?id=1695015 ++# https://fedoraproject.org/wiki/Changes/Minimal_GDB_in_buildroot ++# ++# If gdb.minimal is not found then we look for a 'gdb' executable on ++# the path. ++# ++# And finally, we check for /usr/libexec/gdb. ++# ++# If none of those result in a useable GDB then we give an error and ++# exit. ++if test -z "$GDB"; then ++ for possible_gdb in /usr/bin/gdb.minimal gdb /usr/libexec/gdb; do ++ if ! which "$possible_gdb" >/dev/null 2>&1; then ++ continue ++ fi ++ ++ possible_gdb=$(which "$possible_gdb") ++ ++ if ! test -x "$possible_gdb"; then ++ continue ++ fi ++ ++ GDB="$possible_gdb" ++ break ++ done ++ ++ if test -z "$GDB"; then ++ echo "$myname: Failed to find a useable GDB binary" 1>&2 ++ exit 1 ++ fi ++fi ++ + dwarf5="" + if [ "$1" = "-dwarf-5" ]; then + dwarf5="$1" diff --git a/gdb-bz601887-dwarf4-rh-test.patch b/gdb-bz601887-dwarf4-rh-test.patch deleted file mode 100644 index 966c986..0000000 --- a/gdb-bz601887-dwarf4-rh-test.patch +++ /dev/null @@ -1,254 +0,0 @@ -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/gdb-ccache-workaround.patch b/gdb-ccache-workaround.patch deleted file mode 100644 index 60bc5cc..0000000 --- a/gdb-ccache-workaround.patch +++ /dev/null @@ -1,26 +0,0 @@ -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/gdb-container-rh-pkg.patch b/gdb-container-rh-pkg.patch index 04a7f3c..7107e5d 100644 --- a/gdb-container-rh-pkg.patch +++ b/gdb-container-rh-pkg.patch @@ -9,10 +9,10 @@ Subject: gdb-container-rh-pkg.patch 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) +@@ -14742,7 +14742,17 @@ remote_target::pid_to_exec_file (int pid) char *annex = NULL; - if (packet_support (PACKET_qXfer_exec_file) != PACKET_ENABLE) + if (m_features.packet_support (PACKET_qXfer_exec_file) != PACKET_ENABLE) - return NULL; + { + warning (_("Remote gdbserver does not support determining executable " diff --git a/gdb-core-open-vdso-warning.patch b/gdb-core-open-vdso-warning.patch index f58d8be..fdd06fb 100644 --- a/gdb-core-open-vdso-warning.patch +++ b/gdb-core-open-vdso-warning.patch @@ -19,24 +19,22 @@ 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" +@@ -27,6 +27,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" \ + if { [gdb_compile_shlib ${srcfile_lib} ${binfile_lib} $lib_flags] != "" + || [gdb_compile ${srcfile} ${binfile} executable $bin_flags] != "" } { +@@ -61,4 +62,28 @@ 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 @@ -49,10 +47,12 @@ diff --git a/gdb/testsuite/gdb.base/solib-symbol.exp b/gdb/testsuite/gdb.base/so + 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" ++ + gdb_exit diff --git a/gdb-dont-overwrite-fsgsbase-m32.patch b/gdb-dont-overwrite-fsgsbase-m32.patch deleted file mode 100644 index ee9ad49..0000000 --- a/gdb-dont-overwrite-fsgsbase-m32.patch +++ /dev/null @@ -1,139 +0,0 @@ -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/gdb-fedora-libncursesw.patch b/gdb-fedora-libncursesw.patch index 7c620fb..1bb640d 100644 --- a/gdb-fedora-libncursesw.patch +++ b/gdb-fedora-libncursesw.patch @@ -12,7 +12,269 @@ 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 +@@ -780,9 +780,6 @@ ENABLE_BFD_64_BIT_TRUE + subdirs + RPM_LIBS + RPM_CFLAGS +-PKG_CONFIG_LIBDIR +-PKG_CONFIG_PATH +-PKG_CONFIG + GDB_DATADIR + DEBUGDIR + MAKEINFO_EXTRA_FLAGS +@@ -990,12 +987,12 @@ PKG_CONFIG_PATH + PKG_CONFIG_LIBDIR + MAKEINFO + MAKEINFOFLAGS ++RPM_CFLAGS ++RPM_LIBS + AMD_DBGAPI_CFLAGS + AMD_DBGAPI_LIBS + DEBUGINFOD_CFLAGS + DEBUGINFOD_LIBS +-RPM_CFLAGS +-RPM_LIBS + YACC + YFLAGS + ZSTD_CFLAGS +@@ -1684,11 +1681,11 @@ Optional Packages: + [--with-auto-load-dir] + --without-auto-load-safe-path + do not restrict auto-loaded files locations ++ --with-rpm query rpm database for missing debuginfos (yes/no, ++ def. auto=librpm.so) + --with-amd-dbgapi support for the amd-dbgapi target (yes / no / auto) + --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 +@@ -1761,6 +1758,8 @@ Some influential environment variables: + MAKEINFO Parent configure detects if it is of sufficient version. + MAKEINFOFLAGS + Parameters for MAKEINFO. ++ RPM_CFLAGS C compiler flags for RPM, overriding pkg-config ++ RPM_LIBS linker flags for RPM, overriding pkg-config + AMD_DBGAPI_CFLAGS + C compiler flags for AMD_DBGAPI, overriding pkg-config + AMD_DBGAPI_LIBS +@@ -1769,8 +1768,6 @@ 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'. +@@ -11495,7 +11492,7 @@ else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +-#line 11486 "configure" ++#line 11495 "configure" + #include "confdefs.h" + + #if HAVE_DLFCN_H +@@ -11601,7 +11598,7 @@ else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +-#line 11592 "configure" ++#line 11601 "configure" + #include "confdefs.h" + + #if HAVE_DLFCN_H +@@ -18102,8 +18099,8 @@ $as_echo_n "checking specific librpm version... " >&6; } + 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; } ++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. */ +@@ -18275,132 +18272,12 @@ $as_echo "#define HAVE_LIBRPM 1" >>confdefs.h + $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 ++ 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; } ++{ $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" +@@ -18437,6 +18314,30 @@ fi + pkg_failed=untried + fi + ++if test $pkg_failed = no; then ++ pkg_save_LDFLAGS="$LDFLAGS" ++ LDFLAGS="$LDFLAGS $pkg_cv_RPM_LIBS" ++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext ++/* end confdefs.h. */ ++ ++int ++main () ++{ ++ ++ ; ++ return 0; ++} ++_ACEOF ++if ac_fn_c_try_link "$LINENO"; then : ++ ++else ++ pkg_failed=yes ++fi ++rm -f core conftest.err conftest.$ac_objext \ ++ conftest$ac_exeext conftest.$ac_ext ++ LDFLAGS=$pkg_save_LDFLAGS ++fi ++ + + + if test $pkg_failed = yes; then +@@ -18531,7 +18432,7 @@ $as_echo "#define HAVE_LIBRPM 1" >>confdefs.h + LIBS="$LIBS $RPM_LIBS" + else + if $RPM_REQUIRE; then +- as_fn_error "$RPM_PKG_ERRORS" "$LINENO" 5 ++ 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;} +@@ -21164,6 +21065,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. @@ -20,7 +282,7 @@ diff --git a/gdb/configure b/gdb/configure { $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 (); +@@ -21188,7 +21090,7 @@ return waddstr (); return 0; } _ACEOF @@ -29,7 +291,7 @@ diff --git a/gdb/configure b/gdb/configure if test -z "$ac_lib"; then ac_res="none required" else -@@ -9747,6 +9748,7 @@ case $host_os in +@@ -21260,6 +21162,7 @@ case $host_os in esac # These are the libraries checked by Readline. @@ -37,7 +299,7 @@ diff --git a/gdb/configure b/gdb/configure { $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 (); +@@ -21284,7 +21187,7 @@ return tgetent (); return 0; } _ACEOF @@ -49,17 +311,17 @@ diff --git a/gdb/configure b/gdb/configure 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 +@@ -749,7 +749,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]) +- 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 ++ AC_SEARCH_LIBS(waddstr, [ncursesw], + [curses_found=yes + AC_DEFINE([HAVE_LIBCURSES], [1], + [Define to 1 if curses is enabled.]) +@@ -789,7 +790,8 @@ case $host_os in esac # These are the libraries checked by Readline. diff --git a/gdb-find_and_open_source-empty-string-ub-1of4.patch b/gdb-find_and_open_source-empty-string-ub-1of4.patch deleted file mode 100644 index 543b410..0000000 --- a/gdb-find_and_open_source-empty-string-ub-1of4.patch +++ /dev/null @@ -1,327 +0,0 @@ -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/gdb-find_and_open_source-empty-string-ub-2of4.patch b/gdb-find_and_open_source-empty-string-ub-2of4.patch deleted file mode 100644 index 0c988cd..0000000 --- a/gdb-find_and_open_source-empty-string-ub-2of4.patch +++ /dev/null @@ -1,475 +0,0 @@ -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/gdb-find_and_open_source-empty-string-ub-3of4.patch b/gdb-find_and_open_source-empty-string-ub-3of4.patch deleted file mode 100644 index 4cf6d67..0000000 --- a/gdb-find_and_open_source-empty-string-ub-3of4.patch +++ /dev/null @@ -1,47 +0,0 @@ -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/gdb-find_and_open_source-empty-string-ub-4of4.patch b/gdb-find_and_open_source-empty-string-ub-4of4.patch deleted file mode 100644 index b6d37f7..0000000 --- a/gdb-find_and_open_source-empty-string-ub-4of4.patch +++ /dev/null @@ -1,113 +0,0 @@ -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/gdb-fix-gdb.base-printcmds-s390x-regressions.patch b/gdb-fix-gdb.base-printcmds-s390x-regressions.patch deleted file mode 100644 index edf28c9..0000000 --- a/gdb-fix-gdb.base-printcmds-s390x-regressions.patch +++ /dev/null @@ -1,71 +0,0 @@ -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/gdb-flexible-array-member-expected-pattern.patch b/gdb-flexible-array-member-expected-pattern.patch deleted file mode 100644 index f61a661..0000000 --- a/gdb-flexible-array-member-expected-pattern.patch +++ /dev/null @@ -1,88 +0,0 @@ -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/gdb-fortran-frame-string.patch b/gdb-fortran-frame-string.patch deleted file mode 100644 index 4bdd059..0000000 --- a/gdb-fortran-frame-string.patch +++ /dev/null @@ -1,104 +0,0 @@ -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/gdb-ftbs-swapped-calloc-args.patch b/gdb-ftbs-swapped-calloc-args.patch new file mode 100644 index 0000000..3486c8e --- /dev/null +++ b/gdb-ftbs-swapped-calloc-args.patch @@ -0,0 +1,42 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Kevin Buettner +Date: Wed, 17 Jan 2024 12:53:53 -0700 +Subject: gdb-ftbs-swapped-calloc-args.patch + +Backport upstream commit 54195469c18ec9873cc5ba6907f768509473fa9b +which fixes a build problem in which arguments to calloc were swapped. + +[opcodes] ARC + PPC: Fix -Walloc-size warnings + +Recently, -Walloc-size warnings started to kick in. Fix these two +calloc() calls to match the intended usage pattern. + +opcodes/ChangeLog: + + * arc-dis.c (init_arc_disasm_info): Fix calloc() call. + * ppc-dis.c (powerpc_init_dialect): Ditto. + +diff --git a/opcodes/arc-dis.c b/opcodes/arc-dis.c +--- a/opcodes/arc-dis.c ++++ b/opcodes/arc-dis.c +@@ -147,7 +147,7 @@ static bool + init_arc_disasm_info (struct disassemble_info *info) + { + struct arc_disassemble_info *arc_infop +- = calloc (sizeof (*arc_infop), 1); ++ = calloc (1, sizeof (*arc_infop)); + + if (arc_infop == NULL) + return false; +diff --git a/opcodes/ppc-dis.c b/opcodes/ppc-dis.c +--- a/opcodes/ppc-dis.c ++++ b/opcodes/ppc-dis.c +@@ -348,7 +348,7 @@ powerpc_init_dialect (struct disassemble_info *info) + { + ppc_cpu_t dialect = 0; + ppc_cpu_t sticky = 0; +- struct dis_private *priv = calloc (sizeof (*priv), 1); ++ struct dis_private *priv = calloc (1, sizeof (*priv)); + + if (priv == NULL) + return; diff --git a/gdb-gdb27743-psymtab-imported-unit.patch b/gdb-gdb27743-psymtab-imported-unit.patch deleted file mode 100644 index c129b6d..0000000 --- a/gdb-gdb27743-psymtab-imported-unit.patch +++ /dev/null @@ -1,281 +0,0 @@ -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/gdb-libexec-add-index.patch b/gdb-libexec-add-index.patch deleted file mode 100644 index 19f6b54..0000000 --- a/gdb-libexec-add-index.patch +++ /dev/null @@ -1,37 +0,0 @@ -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/gdb-lineno-makeup-test.patch b/gdb-lineno-makeup-test.patch deleted file mode 100644 index 4b96286..0000000 --- a/gdb-lineno-makeup-test.patch +++ /dev/null @@ -1,165 +0,0 @@ -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/gdb-linux_perf-bundle.patch b/gdb-linux_perf-bundle.patch index 728f463..bb6fb6a 100644 --- a/gdb-linux_perf-bundle.patch +++ b/gdb-linux_perf-bundle.patch @@ -9,9 +9,9 @@ Subject: gdb-linux_perf-bundle.patch 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" +@@ -21,6 +21,10 @@ #include "interps.h" + #include "run-on-main-thread.h" +#ifdef PERF_ATTR_SIZE_VER5_BUNDLE +extern "C" void __libipt_init(void); @@ -20,6 +20,8 @@ diff --git a/gdb/gdb.c b/gdb/gdb.c int main (int argc, char **argv) { +@@ -32,6 +36,10 @@ main (int argc, char **argv) + struct captured_main_args args; +#ifdef PERF_ATTR_SIZE_VER5_BUNDLE @@ -32,7 +34,7 @@ diff --git a/gdb/gdb.c b/gdb/gdb.c 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 @@ +@@ -28,6 +28,177 @@ # include #endif @@ -213,7 +215,7 @@ diff --git a/gdb/nat/linux-btrace.h b/gdb/nat/linux-btrace.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], [ +@@ -168,7 +168,7 @@ AC_DEFUN([GDB_AC_COMMON], [ AC_PREPROC_IFELSE([AC_LANG_SOURCE([[ #include #ifndef PERF_ATTR_SIZE_VER5 diff --git a/gdb-opcodes-clflushopt-test.patch b/gdb-opcodes-clflushopt-test.patch deleted file mode 100644 index f95999e..0000000 --- a/gdb-opcodes-clflushopt-test.patch +++ /dev/null @@ -1,62 +0,0 @@ -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/gdb-physname-pr11734-test.patch b/gdb-physname-pr11734-test.patch deleted file mode 100644 index 835e18c..0000000 --- a/gdb-physname-pr11734-test.patch +++ /dev/null @@ -1,229 +0,0 @@ -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/gdb-physname-pr12273-test.patch b/gdb-physname-pr12273-test.patch deleted file mode 100644 index 6c943ad..0000000 --- a/gdb-physname-pr12273-test.patch +++ /dev/null @@ -1,103 +0,0 @@ -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/gdb-ppc-power7-test.patch b/gdb-ppc-power7-test.patch deleted file mode 100644 index c8b22cf..0000000 --- a/gdb-ppc-power7-test.patch +++ /dev/null @@ -1,303 +0,0 @@ -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/gdb-rhbz-2130624-assert_in_jit_event_handler.patch b/gdb-rhbz-2130624-assert_in_jit_event_handler.patch deleted file mode 100644 index 488aaa3..0000000 --- a/gdb-rhbz-2130624-assert_in_jit_event_handler.patch +++ /dev/null @@ -1,115 +0,0 @@ -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/gdb-rhbz-2232086-cpp-ify-mapped-symtab.patch b/gdb-rhbz-2232086-cpp-ify-mapped-symtab.patch new file mode 100644 index 0000000..1d6e1fb --- /dev/null +++ b/gdb-rhbz-2232086-cpp-ify-mapped-symtab.patch @@ -0,0 +1,264 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Andrew Burgess +Date: Sat, 25 Nov 2023 10:35:37 +0000 +Subject: gdb-rhbz-2232086-cpp-ify-mapped-symtab.patch + +;; Back-port upstream commit acc117b57f7 as part of a fix for +;; non-deterministic gdb-index generation (RH BZ 2232086). + +gdb: C++-ify mapped_symtab from dwarf2/index-write.c + +Make static the functions add_index_entry, find_slot, and hash_expand, +member functions of the mapped_symtab class. + +Fold an additional snippet of code from write_gdbindex into +mapped_symtab::minimize, this code relates to minimisation, so this +seems like a good home for it. + +Make the n_elements, data, and m_string_obstack member variables of +mapped_symtab private. Provide a new obstack() member function to +provide access to the obstack when needed, and also add member +functions begin(), end(), cbegin(), and cend() so that the +mapped_symtab class can be treated like a contained and iterated +over. + +I've also taken this opportunity to split out the logic for whether +the hash table (m_data) needs expanding, this is the new function +hash_needs_expanding. This will be useful in a later commit. + +There should be no user visible changes after this commit. + +Approved-By: Tom Tromey + +diff --git a/gdb/dwarf2/index-write.c b/gdb/dwarf2/index-write.c +--- a/gdb/dwarf2/index-write.c ++++ b/gdb/dwarf2/index-write.c +@@ -187,86 +187,135 @@ struct mapped_symtab + { + mapped_symtab () + { +- data.resize (1024); ++ m_data.resize (1024); + } + +- /* Minimize each entry in the symbol table, removing duplicates. */ ++ /* If there are no elements in the symbol table, then reduce the table ++ size to zero. Otherwise call symtab_index_entry::minimize each entry ++ in the symbol table. */ ++ + void minimize () + { +- for (symtab_index_entry &item : data) ++ if (m_element_count == 0) ++ m_data.resize (0); ++ ++ for (symtab_index_entry &item : m_data) + item.minimize (); + } + +- offset_type n_elements = 0; +- std::vector data; ++ /* Add an entry to SYMTAB. NAME is the name of the symbol. CU_INDEX is ++ the index of the CU in which the symbol appears. IS_STATIC is one if ++ the symbol is static, otherwise zero (global). */ ++ ++ void add_index_entry (const char *name, int is_static, ++ gdb_index_symbol_kind kind, offset_type cu_index); ++ ++ /* Access the obstack. */ ++ struct obstack *obstack () ++ { return &m_string_obstack; } ++ ++private: ++ ++ /* Find a slot in SYMTAB for the symbol NAME. Returns a reference to ++ the slot. ++ ++ Function is used only during write_hash_table so no index format ++ backward compatibility is needed. */ ++ ++ symtab_index_entry &find_slot (const char *name); ++ ++ /* Expand SYMTAB's hash table. */ ++ ++ void hash_expand (); ++ ++ /* Return true if the hash table in data needs to grow. */ ++ ++ bool hash_needs_expanding () const ++ { return 4 * m_element_count / 3 >= m_data.size (); } ++ ++ /* A vector that is used as a hash table. */ ++ std::vector m_data; ++ ++ /* The number of elements stored in the m_data hash. */ ++ offset_type m_element_count = 0; + + /* Temporary storage for names. */ + auto_obstack m_string_obstack; +-}; + +-/* Find a slot in SYMTAB for the symbol NAME. Returns a reference to +- the slot. ++public: ++ using iterator = decltype (m_data)::iterator; ++ using const_iterator = decltype (m_data)::const_iterator; + +- Function is used only during write_hash_table so no index format backward +- compatibility is needed. */ ++ iterator begin () ++ { return m_data.begin (); } + +-static symtab_index_entry & +-find_slot (struct mapped_symtab *symtab, const char *name) ++ iterator end () ++ { return m_data.end (); } ++ ++ const_iterator cbegin () ++ { return m_data.cbegin (); } ++ ++ const_iterator cend () ++ { return m_data.cend (); } ++}; ++ ++/* See class definition. */ ++ ++symtab_index_entry & ++mapped_symtab::find_slot (const char *name) + { + offset_type index, step, hash = mapped_index_string_hash (INT_MAX, name); + +- index = hash & (symtab->data.size () - 1); +- step = ((hash * 17) & (symtab->data.size () - 1)) | 1; ++ index = hash & (m_data.size () - 1); ++ step = ((hash * 17) & (m_data.size () - 1)) | 1; + + for (;;) + { +- if (symtab->data[index].name == NULL +- || strcmp (name, symtab->data[index].name) == 0) +- return symtab->data[index]; +- index = (index + step) & (symtab->data.size () - 1); ++ if (m_data[index].name == NULL ++ || strcmp (name, m_data[index].name) == 0) ++ return m_data[index]; ++ index = (index + step) & (m_data.size () - 1); + } + } + +-/* Expand SYMTAB's hash table. */ ++/* See class definition. */ + +-static void +-hash_expand (struct mapped_symtab *symtab) ++void ++mapped_symtab::hash_expand () + { +- auto old_entries = std::move (symtab->data); ++ auto old_entries = std::move (m_data); + +- symtab->data.clear (); +- symtab->data.resize (old_entries.size () * 2); ++ gdb_assert (m_data.size () == 0); ++ m_data.resize (old_entries.size () * 2); + + for (auto &it : old_entries) + if (it.name != NULL) + { +- auto &ref = find_slot (symtab, it.name); ++ auto &ref = this->find_slot (it.name); + ref = std::move (it); + } + } + +-/* Add an entry to SYMTAB. NAME is the name of the symbol. +- CU_INDEX is the index of the CU in which the symbol appears. +- IS_STATIC is one if the symbol is static, otherwise zero (global). */ ++/* See class definition. */ + +-static void +-add_index_entry (struct mapped_symtab *symtab, const char *name, +- int is_static, gdb_index_symbol_kind kind, +- offset_type cu_index) ++void ++mapped_symtab::add_index_entry (const char *name, int is_static, ++ gdb_index_symbol_kind kind, ++ offset_type cu_index) + { +- symtab_index_entry *slot = &find_slot (symtab, name); ++ symtab_index_entry *slot = &this->find_slot (name); + if (slot->name == NULL) + { + /* This is a new element in the hash table. */ +- ++symtab->n_elements; ++ ++this->m_element_count; + + /* We might need to grow the hash table. */ +- if (4 * symtab->n_elements / 3 >= symtab->data.size ()) ++ if (this->hash_needs_expanding ()) + { +- hash_expand (symtab); ++ this->hash_expand (); + + /* This element will have a different slot in the new table. */ +- slot = &find_slot (symtab, name); ++ slot = &this->find_slot (name); + + /* But it should still be a new element in the hash table. */ + gdb_assert (slot->name == nullptr); +@@ -387,7 +436,7 @@ write_hash_table (mapped_symtab *symtab, data_buf &output, data_buf &cpool) + + /* We add all the index vectors to the constant pool first, to + ensure alignment is ok. */ +- for (symtab_index_entry &entry : symtab->data) ++ for (symtab_index_entry &entry : *symtab) + { + if (entry.name == NULL) + continue; +@@ -416,7 +465,7 @@ write_hash_table (mapped_symtab *symtab, data_buf &output, data_buf &cpool) + + /* Now write out the hash table. */ + std::unordered_map str_table; +- for (const auto &entry : symtab->data) ++ for (const auto &entry : *symtab) + { + offset_type str_off, vec_off; + +@@ -1151,7 +1200,7 @@ write_cooked_index (cooked_index *table, + const auto it = cu_index_htab.find (entry->per_cu); + gdb_assert (it != cu_index_htab.cend ()); + +- const char *name = entry->full_name (&symtab->m_string_obstack); ++ const char *name = entry->full_name (symtab->obstack ()); + + if (entry->per_cu->lang () == language_ada) + { +@@ -1159,7 +1208,7 @@ write_cooked_index (cooked_index *table, + gdb, it has to use the encoded name, with any + suffixes stripped. */ + std::string encoded = ada_encode (name, false); +- name = obstack_strdup (&symtab->m_string_obstack, ++ name = obstack_strdup (symtab->obstack (), + encoded.c_str ()); + } + else if (entry->per_cu->lang () == language_cplus +@@ -1191,8 +1240,8 @@ write_cooked_index (cooked_index *table, + else + kind = GDB_INDEX_SYMBOL_KIND_TYPE; + +- add_index_entry (symtab, name, (entry->flags & IS_STATIC) != 0, +- kind, it->second); ++ symtab->add_index_entry (name, (entry->flags & IS_STATIC) != 0, ++ kind, it->second); + } + } + +@@ -1267,8 +1316,6 @@ write_gdbindex (dwarf2_per_bfd *per_bfd, cooked_index *table, + symtab.minimize (); + + data_buf symtab_vec, constant_pool; +- if (symtab.n_elements == 0) +- symtab.data.resize (0); + + write_hash_table (&symtab, symtab_vec, constant_pool); + diff --git a/gdb-rhbz-2232086-generate-dwarf-5-index-consistently.patch b/gdb-rhbz-2232086-generate-dwarf-5-index-consistently.patch new file mode 100644 index 0000000..e9b0b9e --- /dev/null +++ b/gdb-rhbz-2232086-generate-dwarf-5-index-consistently.patch @@ -0,0 +1,101 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Andrew Burgess +Date: Mon, 27 Nov 2023 13:19:39 +0000 +Subject: gdb-rhbz-2232086-generate-dwarf-5-index-consistently.patch + +;; Back-port upstream commit 3644f41dc80 as part of a fix for +;; non-deterministic gdb-index generation (RH BZ 2232086). + +gdb: generate dwarf-5 index identically as worker-thread count changes + +Similar to the previous commit, this commit ensures that the dwarf-5 +index files are generated identically as the number of worker-threads +changes. + +Building the dwarf-5 index makes use of a closed hash table, the +bucket_hash local within debug_names::build(). Entries are added to +bucket_hash from m_name_to_value_set, which, in turn, is populated +by calls to debug_names::insert() in write_debug_names. The insert +calls are ordered based on the entries within the cooked_index, and +the ordering within cooked_index depends on the number of worker +threads that GDB is using. + +My proposal is to sort each chain within the bucket_hash closed hash +table prior to using this to build the dwarf-5 index. + +The buckets within bucket_hash will always have the same ordering (for +a given GDB build with a given executable), and by sorting the chains +within each bucket, we can be sure that GDB will see each entry in a +deterministic order. + +I've extended the index creation test to cover this case. + +Approved-By: Tom Tromey + +diff --git a/gdb/dwarf2/index-write.c b/gdb/dwarf2/index-write.c +--- a/gdb/dwarf2/index-write.c ++++ b/gdb/dwarf2/index-write.c +@@ -452,6 +452,11 @@ class c_str_view + return strcmp (m_cstr, other.m_cstr) == 0; + } + ++ bool operator< (const c_str_view &other) const ++ { ++ return strcmp (m_cstr, other.m_cstr) < 0; ++ } ++ + /* Return the underlying C string. Note, the returned string is + only a reference with lifetime of this object. */ + const char *c_str () const +@@ -771,10 +776,18 @@ class debug_names + } + for (size_t bucket_ix = 0; bucket_ix < bucket_hash.size (); ++bucket_ix) + { +- const std::forward_list &hashitlist +- = bucket_hash[bucket_ix]; ++ std::forward_list &hashitlist = bucket_hash[bucket_ix]; + if (hashitlist.empty ()) + continue; ++ ++ /* Sort the items within each bucket. This ensures that the ++ generated index files will be the same no matter the order in ++ which symbols were added into the index. */ ++ hashitlist.sort ([] (const hash_it_pair &a, const hash_it_pair &b) ++ { ++ return a.it->first < b.it->first; ++ }); ++ + uint32_t &bucket_slot = m_bucket_table[bucket_ix]; + /* The hashes array is indexed starting at 1. */ + store_unsigned_integer (reinterpret_cast (&bucket_slot), +diff --git a/gdb/testsuite/gdb.gdb/index-file.exp b/gdb/testsuite/gdb.gdb/index-file.exp +--- a/gdb/testsuite/gdb.gdb/index-file.exp ++++ b/gdb/testsuite/gdb.gdb/index-file.exp +@@ -47,6 +47,9 @@ remote_exec host "mkdir -p ${dir1}" + with_timeout_factor $timeout_factor { + gdb_test_no_output "save gdb-index $dir1" \ + "create gdb-index file" ++ ++ gdb_test_no_output "save gdb-index -dwarf-5 $dir1" \ ++ "create dwarf-index files" + } + + # Close GDB. +@@ -143,13 +146,16 @@ if { $worker_threads > 1 } { + with_timeout_factor $timeout_factor { + gdb_test_no_output "save gdb-index $dir2" \ + "create second gdb-index file" ++ ++ gdb_test_no_output "save gdb-index -dwarf-5 $dir2" \ ++ "create second dwarf-index files" + } + + # Close GDB. + gdb_exit + + # Now check that the index files are identical. +- foreach suffix { gdb-index } { ++ foreach suffix { gdb-index debug_names debug_str } { + set result \ + [remote_exec host \ + "cmp -s \"$dir1/${index_filename_base}.${suffix}\" \"$dir2/${index_filename_base}.${suffix}\""] diff --git a/gdb-rhbz-2232086-generate-gdb-index-consistently.patch b/gdb-rhbz-2232086-generate-gdb-index-consistently.patch new file mode 100644 index 0000000..d6917ec --- /dev/null +++ b/gdb-rhbz-2232086-generate-gdb-index-consistently.patch @@ -0,0 +1,230 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Andrew Burgess +Date: Fri, 24 Nov 2023 12:04:36 +0000 +Subject: gdb-rhbz-2232086-generate-gdb-index-consistently.patch + +;; Back-port upstream commit aff250145af as part of a fix for +;; non-deterministic gdb-index generation (RH BZ 2232086). + +gdb: generate gdb-index identically regardless of work thread count + +It was observed that changing the number of worker threads that GDB +uses (maintenance set worker-threads NUM) would have an impact on the +layout of the generated gdb-index. + +The cause seems to be how the CU are distributed between threads, and +then symbols that appear in multiple CU can be encountered earlier or +later depending on whether a particular CU moves between threads. + +I certainly found this behaviour was reproducible when generating an +index for GDB itself, like: + + gdb -q -nx -nh -batch \ + -eiex 'maint set worker-threads NUM' \ + -ex 'save gdb-index /tmp/' + +And then setting different values for NUM will change the generated +index. + +Now, the question is: does this matter? + +I would like to suggest that yes, this does matter. At Red Hat we +generate a gdb-index as part of the build process, and we would +ideally like to have reproducible builds: for the same source, +compiled with the same tool-chain, we should get the exact same output +binary. And we do .... except for the index. + +Now we could simply force GDB to only use a single worker thread when +we build the index, but, I don't think the idea of reproducible builds +is that strange, so I think we should ensure that our generated +indexes are always reproducible. + +To achieve this, I propose that we add an extra step when building the +gdb-index file. After constructing the initial symbol hash table +contents, we will pull all the symbols out of the hash, sort them, +then re-insert them in sorted order. This will ensure that the +structure of the generated hash will remain consistent (given the same +set of symbols). + +I've extended the existing index-file test to check that the generated +index doesn't change if we adjust the number of worker threads used. +Given that this test is already rather slow, I've only made one change +to the worker-thread count. Maybe this test should be changed to use +a smaller binary, which is quicker to load, and for which we could +then try many different worker thread counts. + +Approved-By: Tom Tromey + +diff --git a/gdb/dwarf2/index-write.c b/gdb/dwarf2/index-write.c +--- a/gdb/dwarf2/index-write.c ++++ b/gdb/dwarf2/index-write.c +@@ -210,6 +210,13 @@ struct mapped_symtab + void add_index_entry (const char *name, int is_static, + gdb_index_symbol_kind kind, offset_type cu_index); + ++ /* When entries are originally added into the data hash the order will ++ vary based on the number of worker threads GDB is configured to use. ++ This function will rebuild the hash such that the final layout will be ++ deterministic regardless of the number of worker threads used. */ ++ ++ void sort (); ++ + /* Access the obstack. */ + struct obstack *obstack () + { return &m_string_obstack; } +@@ -296,6 +303,65 @@ mapped_symtab::hash_expand () + } + } + ++/* See mapped_symtab class declaration. */ ++ ++void mapped_symtab::sort () ++{ ++ /* Move contents out of this->data vector. */ ++ std::vector original_data = std::move (m_data); ++ ++ /* Restore the size of m_data, this will avoid having to expand the hash ++ table (and rehash all elements) when we reinsert after sorting. ++ However, we do reset the element count, this allows for some sanity ++ checking asserts during the reinsert phase. */ ++ gdb_assert (m_data.size () == 0); ++ m_data.resize (original_data.size ()); ++ m_element_count = 0; ++ ++ /* Remove empty entries from ORIGINAL_DATA, this makes sorting quicker. */ ++ auto it = std::remove_if (original_data.begin (), original_data.end (), ++ [] (const symtab_index_entry &entry) -> bool ++ { ++ return entry.name == nullptr; ++ }); ++ original_data.erase (it, original_data.end ()); ++ ++ /* Sort the existing contents. */ ++ std::sort (original_data.begin (), original_data.end (), ++ [] (const symtab_index_entry &a, ++ const symtab_index_entry &b) -> bool ++ { ++ /* Return true if A is before B. */ ++ gdb_assert (a.name != nullptr); ++ gdb_assert (b.name != nullptr); ++ ++ return strcmp (a.name, b.name) < 0; ++ }); ++ ++ /* Re-insert each item from the sorted list. */ ++ for (auto &entry : original_data) ++ { ++ /* We know that ORIGINAL_DATA contains no duplicates, this data was ++ taken from a hash table that de-duplicated entries for us, so ++ count this as a new item. ++ ++ As we retained the original size of m_data (see above) then we ++ should never need to grow m_data_ during this re-insertion phase, ++ assert that now. */ ++ ++m_element_count; ++ gdb_assert (!this->hash_needs_expanding ()); ++ ++ /* Lookup a slot. */ ++ symtab_index_entry &slot = this->find_slot (entry.name); ++ ++ /* As discussed above, we should not find duplicates. */ ++ gdb_assert (slot.name == nullptr); ++ ++ /* Move this item into the slot we found. */ ++ slot = std::move (entry); ++ } ++} ++ + /* See class definition. */ + + void +@@ -1311,6 +1377,9 @@ write_gdbindex (dwarf2_per_bfd *per_bfd, cooked_index *table, + for (auto map : table->get_addrmaps ()) + write_address_map (map, addr_vec, cu_index_htab); + ++ /* Ensure symbol hash is built domestically. */ ++ symtab.sort (); ++ + /* Now that we've processed all symbols we can shrink their cu_indices + lists. */ + symtab.minimize (); +diff --git a/gdb/testsuite/gdb.gdb/index-file.exp b/gdb/testsuite/gdb.gdb/index-file.exp +--- a/gdb/testsuite/gdb.gdb/index-file.exp ++++ b/gdb/testsuite/gdb.gdb/index-file.exp +@@ -38,6 +38,9 @@ with_timeout_factor $timeout_factor { + clean_restart $filename + } + ++# Record how many worker threads GDB is using. ++set worker_threads [gdb_get_worker_threads] ++ + # Generate an index file. + set dir1 [standard_output_file "index_1"] + remote_exec host "mkdir -p ${dir1}" +@@ -116,3 +119,41 @@ proc check_symbol_table_usage { filename } { + + set index_filename_base [file tail $filename] + check_symbol_table_usage "$dir1/${index_filename_base}.gdb-index" ++ ++# If GDB is using more than 1 worker thread then reduce the number of ++# worker threads, regenerate the index, and check that we get the same ++# index file back. At one point the layout of the index would vary ++# based on the number of worker threads used. ++if { $worker_threads > 1 } { ++ # Start GDB, but don't load a file yet. ++ clean_restart ++ ++ # Adjust the number of threads to use. ++ set reduced_threads [expr $worker_threads / 2] ++ gdb_test_no_output "maint set worker-threads $reduced_threads" ++ ++ with_timeout_factor $timeout_factor { ++ # Now load the test binary. ++ gdb_file_cmd $filename ++ } ++ ++ # Generate an index file. ++ set dir2 [standard_output_file "index_2"] ++ remote_exec host "mkdir -p ${dir2}" ++ with_timeout_factor $timeout_factor { ++ gdb_test_no_output "save gdb-index $dir2" \ ++ "create second gdb-index file" ++ } ++ ++ # Close GDB. ++ gdb_exit ++ ++ # Now check that the index files are identical. ++ foreach suffix { gdb-index } { ++ set result \ ++ [remote_exec host \ ++ "cmp -s \"$dir1/${index_filename_base}.${suffix}\" \"$dir2/${index_filename_base}.${suffix}\""] ++ gdb_assert { [lindex $result 0] == 0 } \ ++ "$suffix files are identical" ++ } ++} +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 +@@ -10033,6 +10033,21 @@ proc is_target_non_stop { {testname ""} } { + return $is_non_stop + } + ++# Return the number of worker threads that GDB is currently using. ++ ++proc gdb_get_worker_threads { {testname ""} } { ++ set worker_threads "UNKNOWN" ++ gdb_test_multiple "maintenance show worker-threads" $testname { ++ -wrap -re "The number of worker threads GDB can use is unlimited \\(currently ($::decimal)\\)\\." { ++ set worker_threads $expect_out(1,string) ++ } ++ -wrap -re "The number of worker threads GDB can use is ($::decimal)\\." { ++ set worker_threads $expect_out(1,string) ++ } ++ } ++ return $worker_threads ++} ++ + # Check if the compiler emits epilogue information associated + # with the closing brace or with the last statement line. + # diff --git a/gdb-rhbz-2232086-reduce-size-of-gdb-index.patch b/gdb-rhbz-2232086-reduce-size-of-gdb-index.patch new file mode 100644 index 0000000..9eaf615 --- /dev/null +++ b/gdb-rhbz-2232086-reduce-size-of-gdb-index.patch @@ -0,0 +1,222 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Andrew Burgess +Date: Fri, 24 Nov 2023 11:50:35 +0000 +Subject: gdb-rhbz-2232086-reduce-size-of-gdb-index.patch + +;; Back-port upstream commit aa19bc1d259 as part of a fix for +;; non-deterministic gdb-index generation (RH BZ 2232086). + +gdb: reduce size of generated gdb-index file + +I noticed in passing that out algorithm for generating the gdb-index +file is incorrect. When building the hash table in add_index_entry we +count every incoming entry rehash when the number of entries gets too +large. However, some of the incoming entries will be duplicates, +which don't actually result in new items being added to the hash +table. + +As a result, we grow the gdb-index hash table far too often. + +With an unmodified GDB, generating a gdb-index for GDB, I see a file +size of 90M, with a hash usage (in the generated index file) of just +2.6%. + +With a patched GDB, generating a gdb-index for the _same_ GDB binary, +I now see a gdb-index file size of 30M, with a hash usage of 41.9%. + +This is a 67% reduction in gdb-index file size. + +Obviously, not every gdb-index file is going to see such big savings, +however, the larger a program, and the more symbols that are +duplicated between compilation units, the more GDB would over count, +and so, over-grow the index. + +The gdb-index hash table we create has a minimum size of 1024, and +then we grow the hash when it is 75% full, doubling the hash table at +that time. Given this, then we expect that either: + + a. The hash table is size 1024, and less than 75% full, or + b. The hash table is between 37.5% and 75% full. + +I've include a test that checks some of these constraints -- I've not +bothered to check the upper limit, and over full hash table isn't +really a problem here, but if the fill percentage is less than 37.5% +then this indicates that we've done something wrong (obviously, I also +check for the 1024 minimum size). + +Approved-By: Tom Tromey + +diff --git a/gdb/dwarf2/index-write.c b/gdb/dwarf2/index-write.c +--- a/gdb/dwarf2/index-write.c ++++ b/gdb/dwarf2/index-write.c +@@ -254,20 +254,29 @@ add_index_entry (struct mapped_symtab *symtab, const char *name, + int is_static, gdb_index_symbol_kind kind, + offset_type cu_index) + { +- offset_type cu_index_and_attrs; ++ symtab_index_entry *slot = &find_slot (symtab, name); ++ if (slot->name == NULL) ++ { ++ /* This is a new element in the hash table. */ ++ ++symtab->n_elements; + +- ++symtab->n_elements; +- if (4 * symtab->n_elements / 3 >= symtab->data.size ()) +- hash_expand (symtab); ++ /* We might need to grow the hash table. */ ++ if (4 * symtab->n_elements / 3 >= symtab->data.size ()) ++ { ++ hash_expand (symtab); + +- symtab_index_entry &slot = find_slot (symtab, name); +- if (slot.name == NULL) +- { +- slot.name = name; ++ /* This element will have a different slot in the new table. */ ++ slot = &find_slot (symtab, name); ++ ++ /* But it should still be a new element in the hash table. */ ++ gdb_assert (slot->name == nullptr); ++ } ++ ++ slot->name = name; + /* index_offset is set later. */ + } + +- cu_index_and_attrs = 0; ++ offset_type cu_index_and_attrs = 0; + DW2_GDB_INDEX_CU_SET_VALUE (cu_index_and_attrs, cu_index); + DW2_GDB_INDEX_SYMBOL_STATIC_SET_VALUE (cu_index_and_attrs, is_static); + DW2_GDB_INDEX_SYMBOL_KIND_SET_VALUE (cu_index_and_attrs, kind); +@@ -279,7 +288,7 @@ add_index_entry (struct mapped_symtab *symtab, const char *name, + the last entry pushed), but a symbol could have multiple kinds in one CU. + To keep things simple we don't worry about the duplication here and + sort and uniquify the list after we've processed all symbols. */ +- slot.cu_indices.push_back (cu_index_and_attrs); ++ slot->cu_indices.push_back (cu_index_and_attrs); + } + + /* See symtab_index_entry. */ +diff --git a/gdb/testsuite/gdb.gdb/index-file.exp b/gdb/testsuite/gdb.gdb/index-file.exp +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.gdb/index-file.exp +@@ -0,0 +1,118 @@ ++# Copyright 2023 Free Software Foundation, Inc. ++ ++# This program is free software; you can 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 the GDB executable, and then 'save gdb-index', and make some ++# checks of the generated index file. ++ ++load_lib selftest-support.exp ++ ++# Can't save an index with readnow. ++if {[readnow]} { ++ untested "cannot create an index when readnow is in use" ++ return -1 ++} ++ ++# A multiplier used to ensure slow tasks are less likely to timeout. ++set timeout_factor 20 ++ ++set filename [selftest_prepare] ++if { $filename eq "" } { ++ unsupported "${gdb_test_file_name}.exp" ++ return -1 ++} ++ ++with_timeout_factor $timeout_factor { ++ # Start GDB, load FILENAME. ++ clean_restart $filename ++} ++ ++# Generate an index file. ++set dir1 [standard_output_file "index_1"] ++remote_exec host "mkdir -p ${dir1}" ++with_timeout_factor $timeout_factor { ++ gdb_test_no_output "save gdb-index $dir1" \ ++ "create gdb-index file" ++} ++ ++# Close GDB. ++gdb_exit ++ ++# Validate that the index-file FILENAME has made efficient use of its ++# symbol hash table. Calculate the number of symbols in the hash ++# table and the total hash table size. The hash table starts with ++# 1024 entries, and then doubles each time it is filled to 75%. At ++# 75% filled, doubling the size takes it to 37.5% filled. ++# ++# Thus, the hash table is correctly filled if: ++# 1. Its size is 1024 (i.e. it has not yet had its first doubling), or ++# 2. Its filled percentage is over 37% ++# ++# We could check that it is not over filled, but I don't as that's not ++# really an issue. But we did once have a bug where the table was ++# doubled incorrectly, in which case we'd see a filled percentage of ++# around 2% in some cases, which is a huge waste of disk space. ++proc check_symbol_table_usage { filename } { ++ # Open the file in binary mode and read-only mode. ++ set fp [open $filename rb] ++ ++ # Configure the channel to use binary translation. ++ fconfigure $fp -translation binary ++ ++ # Read the first 8 bytes of the file, which contain the header of ++ # the index section. ++ set header [read $fp [expr 7 * 4]] ++ ++ # Scan the header to get the version, the CU list offset, and the ++ # types CU list offset. ++ binary scan $header iiiiii version \ ++ _ _ _ symbol_table_offset shortcut_offset ++ ++ # The length of the symbol hash table (in entries). ++ set len [expr ($shortcut_offset - $symbol_table_offset) / 8] ++ ++ # Now walk the hash table and count how many entries are in use. ++ set offset $symbol_table_offset ++ set count 0 ++ while { $offset < $shortcut_offset } { ++ seek $fp $offset ++ set entry [read $fp 8] ++ binary scan $entry ii name_ptr flags ++ if { $name_ptr != 0 } { ++ incr count ++ } ++ ++ incr offset 8 ++ } ++ ++ # Close the file. ++ close $fp ++ ++ # Calculate how full the cache is. ++ set pct [expr (100 * double($count)) / $len] ++ ++ # Write our results out to the gdb.log. ++ verbose -log "Hash table size: $len" ++ verbose -log "Hash table entries: $count" ++ verbose -log "Percentage usage: $pct%" ++ ++ # The minimum fill percentage is actually 37.5%, but we give TCL a ++ # little flexibility in case the FP maths give a result a little ++ # off. ++ gdb_assert { $len == 1024 || $pct > 37 } \ ++ "symbol hash table usage" ++} ++ ++set index_filename_base [file tail $filename] ++check_symbol_table_usage "$dir1/${index_filename_base}.gdb-index" diff --git a/gdb-rhbz1186476-internal-error-unqualified-name-re-set-test.patch b/gdb-rhbz1186476-internal-error-unqualified-name-re-set-test.patch deleted file mode 100644 index 21a1a08..0000000 --- a/gdb-rhbz1186476-internal-error-unqualified-name-re-set-test.patch +++ /dev/null @@ -1,135 +0,0 @@ -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/gdb-rhbz1325795-framefilters-test.patch b/gdb-rhbz1325795-framefilters-test.patch deleted file mode 100644 index cfe309d..0000000 --- a/gdb-rhbz1325795-framefilters-test.patch +++ /dev/null @@ -1,176 +0,0 @@ -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/gdb-rhbz1350436-type-printers-error.patch b/gdb-rhbz1350436-type-printers-error.patch deleted file mode 100644 index d06e121..0000000 --- a/gdb-rhbz1350436-type-printers-error.patch +++ /dev/null @@ -1,81 +0,0 @@ -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/gdb-rhbz1398387-tab-crash-test.patch b/gdb-rhbz1398387-tab-crash-test.patch deleted file mode 100644 index d0555c0..0000000 --- a/gdb-rhbz1398387-tab-crash-test.patch +++ /dev/null @@ -1,454 +0,0 @@ -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=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,;%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/gdb-rhbz1553104-s390x-arch12-test.patch b/gdb-rhbz1553104-s390x-arch12-test.patch deleted file mode 100644 index 2cb15e5..0000000 --- a/gdb-rhbz1553104-s390x-arch12-test.patch +++ /dev/null @@ -1,81 +0,0 @@ -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/gdb-rhbz1870029-powerpc-remove-region-limit-dawr.patch b/gdb-rhbz1870029-powerpc-remove-region-limit-dawr.patch deleted file mode 100644 index b110d70..0000000 --- a/gdb-rhbz1870029-powerpc-remove-region-limit-dawr.patch +++ /dev/null @@ -1,79 +0,0 @@ -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/gdb-rhbz1870031-p10-prefixed-insn-1of3.patch b/gdb-rhbz1870031-p10-prefixed-insn-1of3.patch deleted file mode 100644 index 7515711..0000000 --- a/gdb-rhbz1870031-p10-prefixed-insn-1of3.patch +++ /dev/null @@ -1,89 +0,0 @@ -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/gdb-rhbz1870031-p10-prefixed-insn-2of3.patch b/gdb-rhbz1870031-p10-prefixed-insn-2of3.patch deleted file mode 100644 index e3dac8f..0000000 --- a/gdb-rhbz1870031-p10-prefixed-insn-2of3.patch +++ /dev/null @@ -1,633 +0,0 @@ -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/gdb-rhbz1870031-p10-prefixed-insn-3of3.patch b/gdb-rhbz1870031-p10-prefixed-insn-3of3.patch deleted file mode 100644 index 276cabf..0000000 --- a/gdb-rhbz1870031-p10-prefixed-insn-3of3.patch +++ /dev/null @@ -1,39 +0,0 @@ -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/gdb-rhbz1898252-loadable-section-outside-ELF-segments.patch b/gdb-rhbz1898252-loadable-section-outside-ELF-segments.patch deleted file mode 100644 index 1419455..0000000 --- a/gdb-rhbz1898252-loadable-section-outside-ELF-segments.patch +++ /dev/null @@ -1,67 +0,0 @@ -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/gdb-rhbz1903375-s390x-store-on-condition.patch b/gdb-rhbz1903375-s390x-store-on-condition.patch deleted file mode 100644 index 242e36f..0000000 --- a/gdb-rhbz1903375-s390x-store-on-condition.patch +++ /dev/null @@ -1,64 +0,0 @@ -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/gdb-rhbz1905996-fix-off-by-one-error-in-ada_fold_name.patch b/gdb-rhbz1905996-fix-off-by-one-error-in-ada_fold_name.patch deleted file mode 100644 index 5e1bc57..0000000 --- a/gdb-rhbz1905996-fix-off-by-one-error-in-ada_fold_name.patch +++ /dev/null @@ -1,82 +0,0 @@ -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/gdb-rhbz1909902-frame_id_p-assert-1.patch b/gdb-rhbz1909902-frame_id_p-assert-1.patch deleted file mode 100644 index 8dd99a5..0000000 --- a/gdb-rhbz1909902-frame_id_p-assert-1.patch +++ /dev/null @@ -1,593 +0,0 @@ -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/gdb-rhbz1909902-frame_id_p-assert-2.patch b/gdb-rhbz1909902-frame_id_p-assert-2.patch deleted file mode 100644 index d804bbe..0000000 --- a/gdb-rhbz1909902-frame_id_p-assert-2.patch +++ /dev/null @@ -1,169 +0,0 @@ -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/gdb-rhbz1912985-libstdc++-assert.patch b/gdb-rhbz1912985-libstdc++-assert.patch deleted file mode 100644 index 196e309..0000000 --- a/gdb-rhbz1912985-libstdc++-assert.patch +++ /dev/null @@ -1,64 +0,0 @@ -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/gdb-rhbz1931344-bfd_seek-elf_read_notes.patch b/gdb-rhbz1931344-bfd_seek-elf_read_notes.patch deleted file mode 100644 index e212dc6..0000000 --- a/gdb-rhbz1931344-bfd_seek-elf_read_notes.patch +++ /dev/null @@ -1,87 +0,0 @@ -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/gdb-rhbz1941080-fix-gdbserver-hang.patch b/gdb-rhbz1941080-fix-gdbserver-hang.patch deleted file mode 100644 index 512092a..0000000 --- a/gdb-rhbz1941080-fix-gdbserver-hang.patch +++ /dev/null @@ -1,58 +0,0 @@ -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/gdb-rhbz1964167-convert-enum-range_type.patch b/gdb-rhbz1964167-convert-enum-range_type.patch deleted file mode 100644 index ecf8042..0000000 --- a/gdb-rhbz1964167-convert-enum-range_type.patch +++ /dev/null @@ -1,375 +0,0 @@ -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/gdb-rhbz1964167-fortran-array-slices-at-prompt.patch b/gdb-rhbz1964167-fortran-array-slices-at-prompt.patch deleted file mode 100644 index 05e5890..0000000 --- a/gdb-rhbz1964167-fortran-array-slices-at-prompt.patch +++ /dev/null @@ -1,2660 +0,0 @@ -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/gdb-rhbz1964167-fortran-array-strides-in-expressions.patch b/gdb-rhbz1964167-fortran-array-strides-in-expressions.patch deleted file mode 100644 index c23ec34..0000000 --- a/gdb-rhbz1964167-fortran-array-strides-in-expressions.patch +++ /dev/null @@ -1,193 +0,0 @@ -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/gdb-rhbz1964167-fortran-clean-up-array-expression-evaluation.patch b/gdb-rhbz1964167-fortran-clean-up-array-expression-evaluation.patch deleted file mode 100644 index 7b62022..0000000 --- a/gdb-rhbz1964167-fortran-clean-up-array-expression-evaluation.patch +++ /dev/null @@ -1,209 +0,0 @@ -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/gdb-rhbz1964167-fortran-fix-type-format-mismatch-in-f-lang.c.patch b/gdb-rhbz1964167-fortran-fix-type-format-mismatch-in-f-lang.c.patch deleted file mode 100644 index 2cdb828..0000000 --- a/gdb-rhbz1964167-fortran-fix-type-format-mismatch-in-f-lang.c.patch +++ /dev/null @@ -1,128 +0,0 @@ -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/gdb-rhbz1964167-fortran-range_type-to-range_flag.patch b/gdb-rhbz1964167-fortran-range_type-to-range_flag.patch deleted file mode 100644 index fed239a..0000000 --- a/gdb-rhbz1964167-fortran-range_type-to-range_flag.patch +++ /dev/null @@ -1,224 +0,0 @@ -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/gdb-rhbz1964167-fortran-whitespace_array.patch b/gdb-rhbz1964167-fortran-whitespace_array.patch deleted file mode 100644 index 9021559..0000000 --- a/gdb-rhbz1964167-fortran-whitespace_array.patch +++ /dev/null @@ -1,137 +0,0 @@ -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/gdb-rhbz1964167-move-fortran-expr-handling.patch b/gdb-rhbz1964167-move-fortran-expr-handling.patch deleted file mode 100644 index b921684..0000000 --- a/gdb-rhbz1964167-move-fortran-expr-handling.patch +++ /dev/null @@ -1,787 +0,0 @@ -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/gdb-rhbz1971095-libthread_db-update-1of5.patch b/gdb-rhbz1971095-libthread_db-update-1of5.patch deleted file mode 100644 index 4da253d..0000000 --- a/gdb-rhbz1971095-libthread_db-update-1of5.patch +++ /dev/null @@ -1,306 +0,0 @@ -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/gdb-rhbz1971095-libthread_db-update-2of5.patch b/gdb-rhbz1971095-libthread_db-update-2of5.patch deleted file mode 100644 index 70d826f..0000000 --- a/gdb-rhbz1971095-libthread_db-update-2of5.patch +++ /dev/null @@ -1,148 +0,0 @@ -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/gdb-rhbz1971095-libthread_db-update-3of5.patch b/gdb-rhbz1971095-libthread_db-update-3of5.patch deleted file mode 100644 index a07e2fd..0000000 --- a/gdb-rhbz1971095-libthread_db-update-3of5.patch +++ /dev/null @@ -1,71 +0,0 @@ -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/gdb-rhbz1971095-libthread_db-update-4of5.patch b/gdb-rhbz1971095-libthread_db-update-4of5.patch deleted file mode 100644 index ab91469..0000000 --- a/gdb-rhbz1971095-libthread_db-update-4of5.patch +++ /dev/null @@ -1,88 +0,0 @@ -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/gdb-rhbz1971095-libthread_db-update-5of5.patch b/gdb-rhbz1971095-libthread_db-update-5of5.patch deleted file mode 100644 index d5cd92c..0000000 --- a/gdb-rhbz1971095-libthread_db-update-5of5.patch +++ /dev/null @@ -1,85 +0,0 @@ -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/gdb-rhbz2012819-ibmz-update-1of5.patch b/gdb-rhbz2012819-ibmz-update-1of5.patch deleted file mode 100644 index 7e36aaa..0000000 --- a/gdb-rhbz2012819-ibmz-update-1of5.patch +++ /dev/null @@ -1,99 +0,0 @@ -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/gdb-rhbz2012819-ibmz-update-2of5.patch b/gdb-rhbz2012819-ibmz-update-2of5.patch deleted file mode 100644 index 27b4165..0000000 --- a/gdb-rhbz2012819-ibmz-update-2of5.patch +++ /dev/null @@ -1,113 +0,0 @@ -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/gdb-rhbz2012819-ibmz-update-3of5.patch b/gdb-rhbz2012819-ibmz-update-3of5.patch deleted file mode 100644 index 715aac7..0000000 --- a/gdb-rhbz2012819-ibmz-update-3of5.patch +++ /dev/null @@ -1,84 +0,0 @@ -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/gdb-rhbz2012819-ibmz-update-4of5.patch b/gdb-rhbz2012819-ibmz-update-4of5.patch deleted file mode 100644 index fc79839..0000000 --- a/gdb-rhbz2012819-ibmz-update-4of5.patch +++ /dev/null @@ -1,50 +0,0 @@ -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/gdb-rhbz2012819-ibmz-update-5of5.patch b/gdb-rhbz2012819-ibmz-update-5of5.patch deleted file mode 100644 index e4a3ae7..0000000 --- a/gdb-rhbz2012819-ibmz-update-5of5.patch +++ /dev/null @@ -1,28 +0,0 @@ -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/gdb-rhbz2086761-unknown-cfa-rule.patch b/gdb-rhbz2086761-unknown-cfa-rule.patch deleted file mode 100644 index 8dd23fb..0000000 --- a/gdb-rhbz2086761-unknown-cfa-rule.patch +++ /dev/null @@ -1,54 +0,0 @@ -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/gdb-rhbz2155439-assert-failure-copy_type.patch b/gdb-rhbz2155439-assert-failure-copy_type.patch deleted file mode 100644 index 554d477..0000000 --- a/gdb-rhbz2155439-assert-failure-copy_type.patch +++ /dev/null @@ -1,73 +0,0 @@ -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/gdb-rhbz2232086-refactor-selftest-support.patch b/gdb-rhbz2232086-refactor-selftest-support.patch new file mode 100644 index 0000000..e9febf7 --- /dev/null +++ b/gdb-rhbz2232086-refactor-selftest-support.patch @@ -0,0 +1,77 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Andrew Burgess +Date: Fri, 24 Nov 2023 11:10:08 +0000 +Subject: gdb-rhbz2232086-refactor-selftest-support.patch + +;; Back-port upstream commit 1f0fab7ff86 as part of a fix for +;; non-deterministic gdb-index generation (RH BZ 2232086). + +gdb/testsuite: small refactor in selftest-support.exp + +Split out the code that makes a copy of the GDB executable ready for +self testing into a new proc. A later commit in this series wants to +load the GDB executable into GDB (for creating an on-disk debug +index), but doesn't need to make use of the full do_self_tests proc. + +There should be no changes in what is tested after this commit. + +Approved-By: Tom Tromey + +diff --git a/gdb/testsuite/lib/selftest-support.exp b/gdb/testsuite/lib/selftest-support.exp +--- a/gdb/testsuite/lib/selftest-support.exp ++++ b/gdb/testsuite/lib/selftest-support.exp +@@ -92,11 +92,13 @@ proc selftest_setup { executable function } { + return 0 + } + +-# A simple way to run some self-tests. +- +-proc do_self_tests {function body} { +- global GDB tool +- ++# Prepare for running a self-test by moving the GDB executable to a ++# location where we can use it as the inferior. Return the filename ++# of the new location. ++# ++# If the current testing setup is not suitable for running a ++# self-test, then return an empty string. ++proc selftest_prepare {} { + # Are we testing with a remote board? In that case, the target + # won't have access to the GDB's auxilliary data files + # (data-directory, etc.). It's simpler to just skip. +@@ -120,19 +122,31 @@ proc do_self_tests {function body} { + # Run the test with self. Copy the file executable file in case + # this OS doesn't like to edit its own text space. + +- set GDB_FULLPATH [find_gdb $GDB] ++ set gdb_fullpath [find_gdb $::GDB] + + if {[is_remote host]} { +- set xgdb x$tool ++ set xgdb x$::tool + } else { +- set xgdb [standard_output_file x$tool] ++ set xgdb [standard_output_file x$::tool] + } + + # Remove any old copy lying around. + remote_file host delete $xgdb + ++ set filename [remote_download host $gdb_fullpath $xgdb] ++ ++ return $filename ++} ++ ++# A simple way to run some self-tests. ++ ++proc do_self_tests {function body} { ++ set file [selftest_prepare] ++ if { $file eq "" } { ++ return ++ } ++ + gdb_start +- set file [remote_download host $GDB_FULLPATH $xgdb] + + # When debugging GDB with GDB, some operations can take a relatively long + # time, especially if the build is non-optimized. Bump the timeout for the diff --git a/gdb-rhbz2250652-avoid-PyOS_ReadlineTState.patch b/gdb-rhbz2250652-avoid-PyOS_ReadlineTState.patch new file mode 100644 index 0000000..1997ef9 --- /dev/null +++ b/gdb-rhbz2250652-avoid-PyOS_ReadlineTState.patch @@ -0,0 +1,48 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Alexandra=20H=C3=A1jkov=C3=A1?= +Date: Mon, 8 Jan 2024 13:24:05 +0100 +Subject: gdb-rhbz2250652-avoid-PyOS_ReadlineTState.patch + +gdb/python: avoid use of _PyOS_ReadlineTState + +In python/py-gdb-readline.c we make use of _PyOS_ReadlineTState, +however, this variable is no longer public in Python 3.13, and so GDB +no longer builds. + +We are making use of _PyOS_ReadlineTState in order to re-acquire the +Python Global Interpreter Lock (GIL). The _PyOS_ReadlineTState +variable is set in Python's outer readline code prior to calling the +user (GDB) supplied readline callback function, which for us is +gdbpy_readline_wrapper. The gdbpy_readline_wrapper function is called +without the GIL held. + +Instead of using _PyOS_ReadlineTState, I propose that we switch to +calling PyGILState_Ensure() and PyGILState_Release(). These functions +will acquire the GIL based on the current thread. I think this should +be sufficient; I can't imagine why we'd be running +gdbpy_readline_wrapper on one thread on behalf of a different Python +thread.... that would be unexpected I think. + +Approved-By: Tom Tromey + +diff --git a/gdb/python/py-gdb-readline.c b/gdb/python/py-gdb-readline.c +--- a/gdb/python/py-gdb-readline.c ++++ b/gdb/python/py-gdb-readline.c +@@ -56,13 +56,11 @@ gdbpy_readline_wrapper (FILE *sys_stdin, FILE *sys_stdout, + if (except.reason == RETURN_QUIT) + return NULL; + +- /* The thread state is nulled during gdbpy_readline_wrapper, +- with the original value saved in the following undocumented +- variable (see Python's Parser/myreadline.c and +- Modules/readline.c). */ +- PyEval_RestoreThread (_PyOS_ReadlineTState); ++ ++ /* This readline callback is called without the GIL held. */ ++ gdbpy_gil gil; ++ + gdbpy_convert_exception (except); +- PyEval_SaveThread (); + return NULL; + } + diff --git a/gdb-rhbz2250652-gdbpy_gil.patch b/gdb-rhbz2250652-gdbpy_gil.patch new file mode 100644 index 0000000..a72c350 --- /dev/null +++ b/gdb-rhbz2250652-gdbpy_gil.patch @@ -0,0 +1,81 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Alexandra=20H=C3=A1jkov=C3=A1?= +Date: Mon, 8 Jan 2024 13:12:15 +0100 +Subject: gdb-rhbz2250652-gdbpy_gil.patch + +gdb: move gdbpy_gil into python-internal.h + +Move gdbpy_gil class into python-internal.h, the next +commit wants to make use of this class from a file other +than python.c. + +Approved-By: Tom Tromey + +diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h +--- a/gdb/python/python-internal.h ++++ b/gdb/python/python-internal.h +@@ -754,6 +754,30 @@ class gdbpy_allow_threads + PyThreadState *m_save; + }; + ++/* A helper class to save and restore the GIL, but without touching ++ the other globals that are handled by gdbpy_enter. */ ++ ++class gdbpy_gil ++{ ++public: ++ ++ gdbpy_gil () ++ : m_state (PyGILState_Ensure ()) ++ { ++ } ++ ++ ~gdbpy_gil () ++ { ++ PyGILState_Release (m_state); ++ } ++ ++ DISABLE_COPY_AND_ASSIGN (gdbpy_gil); ++ ++private: ++ ++ PyGILState_STATE m_state; ++}; ++ + /* Use this after a TRY_EXCEPT to throw the appropriate Python + exception. */ + #define GDB_PY_HANDLE_EXCEPTION(Exception) \ +diff --git a/gdb/python/python.c b/gdb/python/python.c +--- a/gdb/python/python.c ++++ b/gdb/python/python.c +@@ -257,30 +257,6 @@ gdbpy_enter::finalize () + python_gdbarch = target_gdbarch (); + } + +-/* A helper class to save and restore the GIL, but without touching +- the other globals that are handled by gdbpy_enter. */ +- +-class gdbpy_gil +-{ +-public: +- +- gdbpy_gil () +- : m_state (PyGILState_Ensure ()) +- { +- } +- +- ~gdbpy_gil () +- { +- PyGILState_Release (m_state); +- } +- +- DISABLE_COPY_AND_ASSIGN (gdbpy_gil); +- +-private: +- +- PyGILState_STATE m_state; +-}; +- + /* Set the quit flag. */ + + static void diff --git a/gdb-rhbz2261580-intrusive_list-assertion-fix.patch b/gdb-rhbz2261580-intrusive_list-assertion-fix.patch new file mode 100644 index 0000000..adb8eb7 --- /dev/null +++ b/gdb-rhbz2261580-intrusive_list-assertion-fix.patch @@ -0,0 +1,55 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Kevin Buettner +Date: Mon, 29 Jan 2024 14:51:22 -0700 +Subject: gdb-rhbz2261580-intrusive_list-assertion-fix.patch + +;; Backport upstream workaround for GCC 14 problem which cause assertion +;; failures in GDB. + +[gdb/build] Workaround gcc PR113599 + +Since gcc commit d3f48f68227 ("c++: non-dependent .* operand folding +[PR112427]"), with gdb we run into PR gcc/113599 [1], a wrong-code bug, as +reported in PR build/31281. + +Work around this by flipping inherit order: +... +-class thread_info : public refcounted_object, +- public intrusive_list_node ++class thread_info : public intrusive_list_node, ++ public refcounted_object +... + +An argument could be made that this isn't necessary, because this occurred in +an unreleased gcc version. + +However, I think it could be useful when bisecting gcc for other problems in +building gdb. Having this workaround means the bisect won't reintroduce the +problem. Furthermore, the workaround is harmless. + +Tested on Fedora rawhide x86_64. + +Approved-By: Tom Tromey + +Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31281 + +[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113599 + +diff --git a/gdb/gdbthread.h b/gdb/gdbthread.h +--- a/gdb/gdbthread.h ++++ b/gdb/gdbthread.h +@@ -242,10 +242,11 @@ using private_thread_info_up = std::unique_ptr; + strong reference, and is thus not accounted for in the thread's + refcount. + +- The intrusive_list_node base links threads in a per-inferior list. */ ++ The intrusive_list_node base links threads in a per-inferior list. ++ We place it first in the inherit order to work around PR gcc/113599. */ + +-class thread_info : public refcounted_object, +- public intrusive_list_node ++class thread_info : public intrusive_list_node, ++ public refcounted_object + { + public: + explicit thread_info (inferior *inf, ptid_t ptid); diff --git a/gdb-rhel-10464-xsave-update-10of21.patch b/gdb-rhel-10464-xsave-update-10of21.patch deleted file mode 100644 index f907111..0000000 --- a/gdb-rhel-10464-xsave-update-10of21.patch +++ /dev/null @@ -1,39 +0,0 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: John Baldwin -Date: Thu, 11 Apr 2024 14:05:44 -0700 -Subject: gdb-rhel-10464-xsave-update-10of21.patch - -;; Backport "x86: Remove X86_XSTATE_SIZE and related constants." -;; (John Baldwin, RHEL-10464) - -Approved-By: Simon Marchi - -diff --git a/gdbsupport/x86-xstate.h b/gdbsupport/x86-xstate.h ---- a/gdbsupport/x86-xstate.h -+++ b/gdbsupport/x86-xstate.h -@@ -99,11 +99,6 @@ constexpr bool operator!= (const x86_xsave_layout &lhs, - - #define X86_XSTATE_SSE_SIZE 576 - #define X86_XSTATE_AVX_SIZE 832 --#define X86_XSTATE_BNDREGS_SIZE 1024 --#define X86_XSTATE_BNDCFG_SIZE 1088 --#define X86_XSTATE_AVX512_SIZE 2688 --#define X86_XSTATE_PKRU_SIZE 2696 --#define X86_XSTATE_MAX_SIZE 2696 - - - /* In case one of the MPX XCR0 bits is set we consider we have MPX. */ -@@ -112,13 +107,6 @@ constexpr bool operator!= (const x86_xsave_layout &lhs, - #define HAS_AVX512(XCR0) (((XCR0) & X86_XSTATE_AVX512) != 0) - #define HAS_PKRU(XCR0) (((XCR0) & X86_XSTATE_PKRU) != 0) - --/* Get I386 XSAVE extended state size. */ --#define X86_XSTATE_SIZE(XCR0) \ -- (HAS_PKRU (XCR0) ? X86_XSTATE_PKRU_SIZE : \ -- (HAS_AVX512 (XCR0) ? X86_XSTATE_AVX512_SIZE : \ -- (HAS_MPX (XCR0) ? X86_XSTATE_BNDCFG_SIZE : \ -- (HAS_AVX (XCR0) ? X86_XSTATE_AVX_SIZE : X86_XSTATE_SSE_SIZE)))) -- - /* Initial value for fctrl register, as defined in the X86 manual, and - confirmed in the (Linux) kernel source. When the x87 floating point - feature is not enabled in an inferior we use this as the value of the diff --git a/gdb-rhel-10464-xsave-update-11of21.patch b/gdb-rhel-10464-xsave-update-11of21.patch deleted file mode 100644 index f7d2428..0000000 --- a/gdb-rhel-10464-xsave-update-11of21.patch +++ /dev/null @@ -1,170 +0,0 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Tom de Vries -Date: Thu, 11 Apr 2024 14:05:44 -0700 -Subject: gdb-rhel-10464-xsave-update-11of21.patch - -;; Backport "[gdb/tdep] Fix avx512 -m32 support in gdbserver" -;; (Tom de Vries, RHEL-10464) - -PR27257 reports a problem that can be reproduced as follows: -- use x86_64 machine with avx512 support -- compile a hello world with -m32 to a.out -- start a gdbserver session with a.out -- use gdb to connect to the gdbserver session - -This makes us run into: -... -Listening on port 2346 -Remote debugging from host ::1, port 34940 -src/gdbserver/regcache.cc:257: \ - A problem internal to GDBserver has been detected. -Unknown register zmm16h requested -... - -The problem is that i387_xsave_to_cache in gdbserver/i387-fp.cc can't find a -register zmm16h in the register cache. - -To understand how this happens, first some background. - -SSE has 16 128-bit wide xmm registers. - -AVX extends the SSE registers set as follows: -- it extends the 16 existing 128-bit wide xmm registers to 256-bit wide ymm - registers. - -AVX512 extends the AVX register set as follows: -- it extends the 16 existing 256-bit wide ymm registers to 512-bit wide zmm - registers. -- it adds 16 additional 512-bit wide zmm registers (with corresponding ymm and - xmm subregisters added as well) - -However, in 32-bit mode, there are only 8 xmm/ymm/zmm registers. - -The problem we're running into is that gdbserver/i387-fp.cc uses these -constants to describe the size of the register file: -... -static const int num_avx512_zmmh_low_registers = 16; -static const int num_avx512_zmmh_high_registers = 16; -static const int num_avx512_ymmh_registers = 16; -static const int num_avx512_xmm_registers = 16; -... -which are all incorrect for the 32-bit case. - -Fix this by replacing the constants with variables that have the appropriate -values in 64-bit and 32-bit mode. - -Tested on x86_64-linux with native and unix/-m32. - -diff --git a/gdbserver/i387-fp.cc b/gdbserver/i387-fp.cc ---- a/gdbserver/i387-fp.cc -+++ b/gdbserver/i387-fp.cc -@@ -27,10 +27,6 @@ static unsigned long long x86_xcr0 = X86_XSTATE_SSE_MASK; - static const int num_mpx_bnd_registers = 4; - static const int num_mpx_cfg_registers = 2; - static const int num_avx512_k_registers = 8; --static const int num_avx512_zmmh_low_registers = 16; --static const int num_avx512_zmmh_high_registers = 16; --static const int num_avx512_ymmh_registers = 16; --static const int num_avx512_xmm_registers = 16; - static const int num_pkeys_registers = 1; - - static x86_xsave_layout xsave_layout; -@@ -262,14 +258,22 @@ void - i387_cache_to_xsave (struct regcache *regcache, void *buf) - { - struct i387_xsave *fp = (struct i387_xsave *) buf; -+ bool amd64 = register_size (regcache->tdesc, 0) == 8; - int i; - unsigned long val, val2; - unsigned long long xstate_bv = 0; - unsigned long long clear_bv = 0; - char raw[64]; - char *p; -+ - /* Amd64 has 16 xmm regs; I386 has 8 xmm regs. */ -- int num_xmm_registers = register_size (regcache->tdesc, 0) == 8 ? 16 : 8; -+ int num_xmm_registers = amd64 ? 16 : 8; -+ /* AVX512 extends the existing xmm/ymm registers to a wider mode: zmm. */ -+ int num_avx512_zmmh_low_registers = num_xmm_registers; -+ /* AVX512 adds 16 extra regs in Amd64 mode, but none in I386 mode.*/ -+ int num_avx512_zmmh_high_registers = amd64 ? 16 : 0; -+ int num_avx512_ymmh_registers = amd64 ? 16 : 0; -+ int num_avx512_xmm_registers = amd64 ? 16 : 0; - - /* The supported bits in `xstat_bv' are 8 bytes. Clear part in - vector registers if its bit in xstat_bv is zero. */ -@@ -458,7 +462,9 @@ i387_cache_to_xsave (struct regcache *regcache, void *buf) - /* Check if any of ZMM16H-ZMM31H registers are changed. */ - if ((x86_xcr0 & X86_XSTATE_ZMM)) - { -- int zmm16h_regnum = find_regno (regcache->tdesc, "zmm16h"); -+ int zmm16h_regnum = (num_avx512_zmmh_high_registers == 0 -+ ? -1 -+ : find_regno (regcache->tdesc, "zmm16h")); - - for (i = 0; i < num_avx512_zmmh_high_registers; i++) - { -@@ -475,7 +481,9 @@ i387_cache_to_xsave (struct regcache *regcache, void *buf) - /* Check if any XMM_AVX512 registers are changed. */ - if ((x86_xcr0 & X86_XSTATE_ZMM)) - { -- int xmm_avx512_regnum = find_regno (regcache->tdesc, "xmm16"); -+ int xmm_avx512_regnum = (num_avx512_xmm_registers == 0 -+ ? -1 -+ : find_regno (regcache->tdesc, "xmm16")); - - for (i = 0; i < num_avx512_xmm_registers; i++) - { -@@ -492,7 +500,9 @@ i387_cache_to_xsave (struct regcache *regcache, void *buf) - /* Check if any YMMH_AVX512 registers are changed. */ - if ((x86_xcr0 & X86_XSTATE_ZMM)) - { -- int ymmh_avx512_regnum = find_regno (regcache->tdesc, "ymm16h"); -+ int ymmh_avx512_regnum = (num_avx512_ymmh_registers == 0 -+ ? -1 -+ : find_regno (regcache->tdesc, "ymm16h")); - - for (i = 0; i < num_avx512_ymmh_registers; i++) - { -@@ -716,12 +726,20 @@ i387_xsave_to_cache (struct regcache *regcache, const void *buf) - { - struct i387_xsave *fp = (struct i387_xsave *) buf; - struct i387_fxsave *fxp = (struct i387_fxsave *) buf; -+ bool amd64 = register_size (regcache->tdesc, 0) == 8; - int i, top; - unsigned long val; - unsigned long long clear_bv; - gdb_byte *p; -- /* Amd64 has 16 xmm regs; I386 has 8 xmm regs. */ -- int num_xmm_registers = register_size (regcache->tdesc, 0) == 8 ? 16 : 8; -+ -+ /* Amd64 has 16 xmm regs; I386 has 8 xmm regs. */ -+ int num_xmm_registers = amd64 ? 16 : 8; -+ /* AVX512 extends the existing xmm/ymm registers to a wider mode: zmm. */ -+ int num_avx512_zmmh_low_registers = num_xmm_registers; -+ /* AVX512 adds 16 extra regs in Amd64 mode, but none in I386 mode.*/ -+ int num_avx512_zmmh_high_registers = amd64 ? 16 : 0; -+ int num_avx512_ymmh_registers = amd64 ? 16 : 0; -+ int num_avx512_xmm_registers = amd64 ? 16 : 0; - - /* The supported bits in `xstat_bv' are 8 bytes. Clear part in - vector registers if its bit in xstat_bv is zero. */ -@@ -851,9 +869,15 @@ i387_xsave_to_cache (struct regcache *regcache, const void *buf) - - if ((x86_xcr0 & X86_XSTATE_ZMM) != 0) - { -- int zmm16h_regnum = find_regno (regcache->tdesc, "zmm16h"); -- int ymm16h_regnum = find_regno (regcache->tdesc, "ymm16h"); -- int xmm16_regnum = find_regno (regcache->tdesc, "xmm16"); -+ int zmm16h_regnum = (num_avx512_zmmh_high_registers == 0 -+ ? -1 -+ : find_regno (regcache->tdesc, "zmm16h")); -+ int ymm16h_regnum = (num_avx512_ymmh_registers == 0 -+ ? -1 -+ : find_regno (regcache->tdesc, "ymm16h")); -+ int xmm16_regnum = (num_avx512_xmm_registers == 0 -+ ? -1 -+ : find_regno (regcache->tdesc, "xmm16")); - - if ((clear_bv & X86_XSTATE_ZMM) != 0) - { diff --git a/gdb-rhel-10464-xsave-update-12of21.patch b/gdb-rhel-10464-xsave-update-12of21.patch deleted file mode 100644 index 66f4203..0000000 --- a/gdb-rhel-10464-xsave-update-12of21.patch +++ /dev/null @@ -1,341 +0,0 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Aleksandar Paunovic -Date: Thu, 11 Apr 2024 14:05:45 -0700 -Subject: gdb-rhel-10464-xsave-update-12of21.patch - -;; Backport "gdbserver: Use x86_xstate_layout to parse the XSAVE extended -;; state area." -;; (Aleksandar Paunovic, RHEL-10464) - -Replace the extended state area fields of i387_xsave with methods which -return an offset into the XSAVE buffer. - -The two changed functions are called within all tests which runs -gdbserver. - -Signed-off-by: Aleksandar Paunovic -Co-authored-by: John Baldwin -Approved-By: Simon Marchi - -diff --git a/gdbserver/i387-fp.cc b/gdbserver/i387-fp.cc ---- a/gdbserver/i387-fp.cc -+++ b/gdbserver/i387-fp.cc -@@ -81,6 +81,8 @@ struct i387_fxsave { - unsigned char xmm_space[256]; - }; - -+gdb_static_assert (sizeof(i387_fxsave) == 416); -+ - struct i387_xsave { - /* All these are only sixteen bits, plus padding, except for fop (which - is only eleven bits), and fooff / fioff (which are 32 bits each). */ -@@ -115,36 +117,57 @@ struct i387_xsave { - /* The XSTATE_BV bit vector. */ - unsigned long long xstate_bv; - -- unsigned char reserved3[56]; -- -- /* Space for eight upper 128-bit YMM values, or 16 on x86-64. */ -- unsigned char ymmh_space[256]; -+ /* The XCOMP_BV bit vector. */ -+ unsigned long long xcomp_bv; - -- unsigned char reserved4[128]; -+ unsigned char reserved3[48]; - -- /* Space for 4 bound registers values of 128 bits. */ -- unsigned char mpx_bnd_space[64]; -- -- /* Space for 2 MPX configuration registers of 64 bits -- plus reserved space. */ -- unsigned char mpx_cfg_space[16]; -+ /* Byte 576. End of registers with fixed position in XSAVE. -+ The position of other XSAVE registers will be calculated -+ from the appropriate CPUID calls. */ - -- unsigned char reserved5[48]; -+private: -+ /* Base address of XSAVE data as an unsigned char *. Used to derive -+ pointers to XSAVE state components in the extended state -+ area. */ -+ unsigned char *xsave () -+ { return reinterpret_cast (this); } - -- /* Space for 8 OpMask register values of 64 bits. */ -- unsigned char k_space[64]; -+public: -+ /* Memory address of eight upper 128-bit YMM values, or 16 on x86-64. */ -+ unsigned char *ymmh_space () -+ { return xsave () + xsave_layout.avx_offset; } - -- /* Space for 16 256-bit zmm0-15. */ -- unsigned char zmmh_low_space[512]; -+ /* Memory address of 4 bound registers values of 128 bits. */ -+ unsigned char *bndregs_space () -+ { return xsave () + xsave_layout.bndregs_offset; } - -- /* Space for 16 512-bit zmm16-31 values. */ -- unsigned char zmmh_high_space[1024]; -- -- /* Space for 1 32-bit PKRU register. The HW XSTATE size for this feature is -- actually 64 bits, but WRPKRU/RDPKRU instructions ignore upper 32 bits. */ -- unsigned char pkru_space[8]; -+ /* Memory address of 2 MPX configuration registers of 64 bits -+ plus reserved space. */ -+ unsigned char *bndcfg_space () -+ { return xsave () + xsave_layout.bndcfg_offset; } -+ -+ /* Memory address of 8 OpMask register values of 64 bits. */ -+ unsigned char *k_space () -+ { return xsave () + xsave_layout.k_offset; } -+ -+ /* Memory address of 16 256-bit zmm0-15. */ -+ unsigned char *zmmh_space () -+ { return xsave () + xsave_layout.zmm_h_offset; } -+ -+ /* Memory address of 16 512-bit zmm16-31 values. */ -+ unsigned char *zmm16_space () -+ { return xsave () + xsave_layout.zmm_offset; } -+ -+ /* Memory address of 1 32-bit PKRU register. The HW XSTATE size for this -+ feature is actually 64 bits, but WRPKRU/RDPKRU instructions ignore upper -+ 32 bits. */ -+ unsigned char *pkru_space () -+ { return xsave () + xsave_layout.pkru_offset; } - }; - -+gdb_static_assert (sizeof(i387_xsave) == 576); -+ - void - i387_cache_to_fsave (struct regcache *regcache, void *buf) - { -@@ -264,7 +287,7 @@ i387_cache_to_xsave (struct regcache *regcache, void *buf) - unsigned long long xstate_bv = 0; - unsigned long long clear_bv = 0; - char raw[64]; -- char *p; -+ unsigned char *p; - - /* Amd64 has 16 xmm regs; I386 has 8 xmm regs. */ - int num_xmm_registers = amd64 ? 16 : 8; -@@ -304,40 +327,40 @@ i387_cache_to_xsave (struct regcache *regcache, void *buf) - - if ((clear_bv & X86_XSTATE_AVX)) - for (i = 0; i < num_xmm_registers; i++) -- memset (((char *) &fp->ymmh_space[0]) + i * 16, 0, 16); -+ memset (fp->ymmh_space () + i * 16, 0, 16); - - if ((clear_bv & X86_XSTATE_SSE) && (clear_bv & X86_XSTATE_AVX)) - memset (((char *) &fp->mxcsr), 0, 4); - - if ((clear_bv & X86_XSTATE_BNDREGS)) - for (i = 0; i < num_mpx_bnd_registers; i++) -- memset (((char *) &fp->mpx_bnd_space[0]) + i * 16, 0, 16); -+ memset (fp->bndregs_space () + i * 16, 0, 16); - - if ((clear_bv & X86_XSTATE_BNDCFG)) - for (i = 0; i < num_mpx_cfg_registers; i++) -- memset (((char *) &fp->mpx_cfg_space[0]) + i * 8, 0, 8); -+ memset (fp->bndcfg_space () + i * 8, 0, 8); - - if ((clear_bv & X86_XSTATE_K)) - for (i = 0; i < num_avx512_k_registers; i++) -- memset (((char *) &fp->k_space[0]) + i * 8, 0, 8); -+ memset (fp->k_space () + i * 8, 0, 8); - - if ((clear_bv & X86_XSTATE_ZMM_H)) - for (i = 0; i < num_avx512_zmmh_low_registers; i++) -- memset (((char *) &fp->zmmh_low_space[0]) + i * 32, 0, 32); -+ memset (fp->zmmh_space () + i * 32, 0, 32); - - if ((clear_bv & X86_XSTATE_ZMM)) - { - for (i = 0; i < num_avx512_zmmh_high_registers; i++) -- memset (((char *) &fp->zmmh_low_space[0]) + 32 + i * 64, 0, 32); -+ memset (fp->zmm16_space () + 32 + i * 64, 0, 32); - for (i = 0; i < num_avx512_xmm_registers; i++) -- memset (((char *) &fp->zmmh_high_space[0]) + i * 64, 0, 16); -+ memset (fp->zmm16_space () + i * 64, 0, 16); - for (i = 0; i < num_avx512_ymmh_registers; i++) -- memset (((char *) &fp->zmmh_high_space[0]) + 16 + i * 64, 0, 16); -+ memset (fp->zmm16_space () + 16 + i * 64, 0, 16); - } - - if ((clear_bv & X86_XSTATE_PKRU)) - for (i = 0; i < num_pkeys_registers; i++) -- memset (((char *) &fp->pkru_space[0]) + i * 4, 0, 4); -+ memset (fp->pkru_space () + i * 4, 0, 4); - } - - /* Check if any x87 registers are changed. */ -@@ -348,7 +371,7 @@ i387_cache_to_xsave (struct regcache *regcache, void *buf) - for (i = 0; i < 8; i++) - { - collect_register (regcache, i + st0_regnum, raw); -- p = ((char *) &fp->st_space[0]) + i * 16; -+ p = fp->st_space + i * 16; - if (memcmp (raw, p, 10)) - { - xstate_bv |= X86_XSTATE_X87; -@@ -365,7 +388,7 @@ i387_cache_to_xsave (struct regcache *regcache, void *buf) - for (i = 0; i < num_xmm_registers; i++) - { - collect_register (regcache, i + xmm0_regnum, raw); -- p = ((char *) &fp->xmm_space[0]) + i * 16; -+ p = fp->xmm_space + i * 16; - if (memcmp (raw, p, 16)) - { - xstate_bv |= X86_XSTATE_SSE; -@@ -382,7 +405,7 @@ i387_cache_to_xsave (struct regcache *regcache, void *buf) - for (i = 0; i < num_xmm_registers; i++) - { - collect_register (regcache, i + ymm0h_regnum, raw); -- p = ((char *) &fp->ymmh_space[0]) + i * 16; -+ p = fp->ymmh_space () + i * 16; - if (memcmp (raw, p, 16)) - { - xstate_bv |= X86_XSTATE_AVX; -@@ -399,7 +422,7 @@ i387_cache_to_xsave (struct regcache *regcache, void *buf) - for (i = 0; i < num_mpx_bnd_registers; i++) - { - collect_register (regcache, i + bnd0r_regnum, raw); -- p = ((char *) &fp->mpx_bnd_space[0]) + i * 16; -+ p = fp->bndregs_space () + i * 16; - if (memcmp (raw, p, 16)) - { - xstate_bv |= X86_XSTATE_BNDREGS; -@@ -416,7 +439,7 @@ i387_cache_to_xsave (struct regcache *regcache, void *buf) - for (i = 0; i < num_mpx_cfg_registers; i++) - { - collect_register (regcache, i + bndcfg_regnum, raw); -- p = ((char *) &fp->mpx_cfg_space[0]) + i * 8; -+ p = fp->bndcfg_space () + i * 8; - if (memcmp (raw, p, 8)) - { - xstate_bv |= X86_XSTATE_BNDCFG; -@@ -433,7 +456,7 @@ i387_cache_to_xsave (struct regcache *regcache, void *buf) - for (i = 0; i < num_avx512_k_registers; i++) - { - collect_register (regcache, i + k0_regnum, raw); -- p = ((char *) &fp->k_space[0]) + i * 8; -+ p = fp->k_space () + i * 8; - if (memcmp (raw, p, 8) != 0) - { - xstate_bv |= X86_XSTATE_K; -@@ -450,7 +473,7 @@ i387_cache_to_xsave (struct regcache *regcache, void *buf) - for (i = 0; i < num_avx512_zmmh_low_registers; i++) - { - collect_register (regcache, i + zmm0h_regnum, raw); -- p = ((char *) &fp->zmmh_low_space[0]) + i * 32; -+ p = fp->zmmh_space () + i * 32; - if (memcmp (raw, p, 32) != 0) - { - xstate_bv |= X86_XSTATE_ZMM_H; -@@ -469,7 +492,7 @@ i387_cache_to_xsave (struct regcache *regcache, void *buf) - for (i = 0; i < num_avx512_zmmh_high_registers; i++) - { - collect_register (regcache, i + zmm16h_regnum, raw); -- p = ((char *) &fp->zmmh_high_space[0]) + 32 + i * 64; -+ p = fp->zmm16_space () + 32 + i * 64; - if (memcmp (raw, p, 32) != 0) - { - xstate_bv |= X86_XSTATE_ZMM; -@@ -488,7 +511,7 @@ i387_cache_to_xsave (struct regcache *regcache, void *buf) - for (i = 0; i < num_avx512_xmm_registers; i++) - { - collect_register (regcache, i + xmm_avx512_regnum, raw); -- p = ((char *) &fp->zmmh_high_space[0]) + i * 64; -+ p = fp->zmm16_space () + i * 64; - if (memcmp (raw, p, 16) != 0) - { - xstate_bv |= X86_XSTATE_ZMM; -@@ -507,7 +530,7 @@ i387_cache_to_xsave (struct regcache *regcache, void *buf) - for (i = 0; i < num_avx512_ymmh_registers; i++) - { - collect_register (regcache, i + ymmh_avx512_regnum, raw); -- p = ((char *) &fp->zmmh_high_space[0]) + 16 + i * 64; -+ p = fp->zmm16_space () + 16 + i * 64; - if (memcmp (raw, p, 16) != 0) - { - xstate_bv |= X86_XSTATE_ZMM; -@@ -524,7 +547,7 @@ i387_cache_to_xsave (struct regcache *regcache, void *buf) - for (i = 0; i < num_pkeys_registers; i++) - { - collect_register (regcache, i + pkru_regnum, raw); -- p = ((char *) &fp->pkru_space[0]) + i * 4; -+ p = fp->pkru_space () + i * 4; - if (memcmp (raw, p, 4) != 0) - { - xstate_bv |= X86_XSTATE_PKRU; -@@ -730,7 +753,7 @@ i387_xsave_to_cache (struct regcache *regcache, const void *buf) - int i, top; - unsigned long val; - unsigned long long clear_bv; -- gdb_byte *p; -+ unsigned char *p; - - /* Amd64 has 16 xmm regs; I386 has 8 xmm regs. */ - int num_xmm_registers = amd64 ? 16 : 8; -@@ -791,7 +814,7 @@ i387_xsave_to_cache (struct regcache *regcache, const void *buf) - } - else - { -- p = (gdb_byte *) &fp->ymmh_space[0]; -+ p = fp->ymmh_space (); - for (i = 0; i < num_xmm_registers; i++) - supply_register (regcache, i + ymm0h_regnum, p + i * 16); - } -@@ -809,7 +832,7 @@ i387_xsave_to_cache (struct regcache *regcache, const void *buf) - } - else - { -- p = (gdb_byte *) &fp->mpx_bnd_space[0]; -+ p = fp->bndregs_space (); - for (i = 0; i < num_mpx_bnd_registers; i++) - supply_register (regcache, i + bnd0r_regnum, p + i * 16); - } -@@ -827,7 +850,7 @@ i387_xsave_to_cache (struct regcache *regcache, const void *buf) - } - else - { -- p = (gdb_byte *) &fp->mpx_cfg_space[0]; -+ p = fp->bndcfg_space (); - for (i = 0; i < num_mpx_cfg_registers; i++) - supply_register (regcache, i + bndcfg_regnum, p + i * 8); - } -@@ -844,7 +867,7 @@ i387_xsave_to_cache (struct regcache *regcache, const void *buf) - } - else - { -- p = (gdb_byte *) &fp->k_space[0]; -+ p = fp->k_space (); - for (i = 0; i < num_avx512_k_registers; i++) - supply_register (regcache, i + k0_regnum, p + i * 8); - } -@@ -861,7 +884,7 @@ i387_xsave_to_cache (struct regcache *regcache, const void *buf) - } - else - { -- p = (gdb_byte *) &fp->zmmh_low_space[0]; -+ p = fp->zmmh_space (); - for (i = 0; i < num_avx512_zmmh_low_registers; i++) - supply_register (regcache, i + zmm0h_regnum, p + i * 32); - } -@@ -890,7 +913,7 @@ i387_xsave_to_cache (struct regcache *regcache, const void *buf) - } - else - { -- p = (gdb_byte *) &fp->zmmh_high_space[0]; -+ p = fp->zmm16_space (); - for (i = 0; i < num_avx512_zmmh_high_registers; i++) - supply_register (regcache, i + zmm16h_regnum, p + 32 + i * 64); - for (i = 0; i < num_avx512_ymmh_registers; i++) -@@ -911,7 +934,7 @@ i387_xsave_to_cache (struct regcache *regcache, const void *buf) - } - else - { -- p = (gdb_byte *) &fp->pkru_space[0]; -+ p = fp->pkru_space (); - for (i = 0; i < num_pkeys_registers; i++) - supply_register (regcache, i + pkru_regnum, p + i * 4); - } diff --git a/gdb-rhel-10464-xsave-update-13of21.patch b/gdb-rhel-10464-xsave-update-13of21.patch deleted file mode 100644 index 2b9ba17..0000000 --- a/gdb-rhel-10464-xsave-update-13of21.patch +++ /dev/null @@ -1,229 +0,0 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: John Baldwin -Date: Thu, 11 Apr 2024 14:05:45 -0700 -Subject: gdb-rhel-10464-xsave-update-13of21.patch - -;; Backport "gdbserver: Simplify handling of ZMM registers." -;; (John Baldwin, RHEL-10464) - -- Reuse num_xmm_registers directly for the count of ZMM0-15 registers - as is already done for the YMM registers for AVX rather than using - a new variable that is always the same. - -- Replace 3 identical variables for the count of upper ZMM16-31 - registers with a single variable. Make use of this to merge - various loops working on the ZMM XSAVE region so that all of the - handling for the various sub-registers in this region are always - handled in a single loop. - -- While here, fix some bugs in i387_cache_to_xsave where if - X86_XSTATE_ZMM was set on i386 (e.g. a 32-bit process on a 64-bit - kernel), the -1 register nums would wrap around and store the value - of GPRs in the XSAVE area. This should be harmless, but is - definitely odd. Instead, check num_zmm_high_registers directly when - checking X86_XSTATE_ZMM and skip the ZMM region handling entirely if - the register count is 0. - -Approved-By: Simon Marchi - -diff --git a/gdbserver/i387-fp.cc b/gdbserver/i387-fp.cc ---- a/gdbserver/i387-fp.cc -+++ b/gdbserver/i387-fp.cc -@@ -291,12 +291,8 @@ i387_cache_to_xsave (struct regcache *regcache, void *buf) - - /* Amd64 has 16 xmm regs; I386 has 8 xmm regs. */ - int num_xmm_registers = amd64 ? 16 : 8; -- /* AVX512 extends the existing xmm/ymm registers to a wider mode: zmm. */ -- int num_avx512_zmmh_low_registers = num_xmm_registers; -- /* AVX512 adds 16 extra regs in Amd64 mode, but none in I386 mode.*/ -- int num_avx512_zmmh_high_registers = amd64 ? 16 : 0; -- int num_avx512_ymmh_registers = amd64 ? 16 : 0; -- int num_avx512_xmm_registers = amd64 ? 16 : 0; -+ /* AVX512 adds 16 extra ZMM regs in Amd64 mode, but none in I386 mode.*/ -+ int num_zmm_high_registers = amd64 ? 16 : 0; - - /* The supported bits in `xstat_bv' are 8 bytes. Clear part in - vector registers if its bit in xstat_bv is zero. */ -@@ -345,18 +341,12 @@ i387_cache_to_xsave (struct regcache *regcache, void *buf) - memset (fp->k_space () + i * 8, 0, 8); - - if ((clear_bv & X86_XSTATE_ZMM_H)) -- for (i = 0; i < num_avx512_zmmh_low_registers; i++) -+ for (i = 0; i < num_xmm_registers; i++) - memset (fp->zmmh_space () + i * 32, 0, 32); - - if ((clear_bv & X86_XSTATE_ZMM)) -- { -- for (i = 0; i < num_avx512_zmmh_high_registers; i++) -- memset (fp->zmm16_space () + 32 + i * 64, 0, 32); -- for (i = 0; i < num_avx512_xmm_registers; i++) -- memset (fp->zmm16_space () + i * 64, 0, 16); -- for (i = 0; i < num_avx512_ymmh_registers; i++) -- memset (fp->zmm16_space () + 16 + i * 64, 0, 16); -- } -+ for (i = 0; i < num_zmm_high_registers; i++) -+ memset (fp->zmm16_space () + i * 64, 0, 64); - - if ((clear_bv & X86_XSTATE_PKRU)) - for (i = 0; i < num_pkeys_registers; i++) -@@ -470,7 +460,7 @@ i387_cache_to_xsave (struct regcache *regcache, void *buf) - { - int zmm0h_regnum = find_regno (regcache->tdesc, "zmm0h"); - -- for (i = 0; i < num_avx512_zmmh_low_registers; i++) -+ for (i = 0; i < num_xmm_registers; i++) - { - collect_register (regcache, i + zmm0h_regnum, raw); - p = fp->zmmh_space () + i * 32; -@@ -482,55 +472,36 @@ i387_cache_to_xsave (struct regcache *regcache, void *buf) - } - } - -- /* Check if any of ZMM16H-ZMM31H registers are changed. */ -- if ((x86_xcr0 & X86_XSTATE_ZMM)) -+ /* Check if any of ZMM16-ZMM31 registers are changed. */ -+ if ((x86_xcr0 & X86_XSTATE_ZMM) && num_zmm_high_registers != 0) - { -- int zmm16h_regnum = (num_avx512_zmmh_high_registers == 0 -- ? -1 -- : find_regno (regcache->tdesc, "zmm16h")); -+ int zmm16h_regnum = find_regno (regcache->tdesc, "zmm16h"); -+ int ymm16h_regnum = find_regno (regcache->tdesc, "ymm16h"); -+ int xmm16_regnum = find_regno (regcache->tdesc, "xmm16"); - -- for (i = 0; i < num_avx512_zmmh_high_registers; i++) -+ for (i = 0; i < num_zmm_high_registers; i++) - { -+ p = fp->zmm16_space () + i * 64; -+ -+ /* ZMMH sub-register. */ - collect_register (regcache, i + zmm16h_regnum, raw); - p = fp->zmm16_space () + 32 + i * 64; -- if (memcmp (raw, p, 32) != 0) -+ if (memcmp (raw, p + 32, 32) != 0) - { - xstate_bv |= X86_XSTATE_ZMM; - memcpy (p, raw, 32); - } -- } -- } -- -- /* Check if any XMM_AVX512 registers are changed. */ -- if ((x86_xcr0 & X86_XSTATE_ZMM)) -- { -- int xmm_avx512_regnum = (num_avx512_xmm_registers == 0 -- ? -1 -- : find_regno (regcache->tdesc, "xmm16")); - -- for (i = 0; i < num_avx512_xmm_registers; i++) -- { -- collect_register (regcache, i + xmm_avx512_regnum, raw); -- p = fp->zmm16_space () + i * 64; -- if (memcmp (raw, p, 16) != 0) -+ /* YMMH sub-register. */ -+ collect_register (regcache, i + ymm16h_regnum, raw); -+ if (memcmp (raw, p + 16, 16) != 0) - { - xstate_bv |= X86_XSTATE_ZMM; - memcpy (p, raw, 16); - } -- } -- } - -- /* Check if any YMMH_AVX512 registers are changed. */ -- if ((x86_xcr0 & X86_XSTATE_ZMM)) -- { -- int ymmh_avx512_regnum = (num_avx512_ymmh_registers == 0 -- ? -1 -- : find_regno (regcache->tdesc, "ymm16h")); -- -- for (i = 0; i < num_avx512_ymmh_registers; i++) -- { -- collect_register (regcache, i + ymmh_avx512_regnum, raw); -- p = fp->zmm16_space () + 16 + i * 64; -+ /* XMM sub-register. */ -+ collect_register (regcache, i + xmm16_regnum, raw); - if (memcmp (raw, p, 16) != 0) - { - xstate_bv |= X86_XSTATE_ZMM; -@@ -757,12 +728,8 @@ i387_xsave_to_cache (struct regcache *regcache, const void *buf) - - /* Amd64 has 16 xmm regs; I386 has 8 xmm regs. */ - int num_xmm_registers = amd64 ? 16 : 8; -- /* AVX512 extends the existing xmm/ymm registers to a wider mode: zmm. */ -- int num_avx512_zmmh_low_registers = num_xmm_registers; -- /* AVX512 adds 16 extra regs in Amd64 mode, but none in I386 mode.*/ -- int num_avx512_zmmh_high_registers = amd64 ? 16 : 0; -- int num_avx512_ymmh_registers = amd64 ? 16 : 0; -- int num_avx512_xmm_registers = amd64 ? 16 : 0; -+ /* AVX512 adds 16 extra ZMM regs in Amd64 mode, but none in I386 mode.*/ -+ int num_zmm_high_registers = amd64 ? 16 : 0; - - /* The supported bits in `xstat_bv' are 8 bytes. Clear part in - vector registers if its bit in xstat_bv is zero. */ -@@ -879,47 +846,41 @@ i387_xsave_to_cache (struct regcache *regcache, const void *buf) - - if ((clear_bv & X86_XSTATE_ZMM_H) != 0) - { -- for (i = 0; i < num_avx512_zmmh_low_registers; i++) -+ for (i = 0; i < num_xmm_registers; i++) - supply_register_zeroed (regcache, i + zmm0h_regnum); - } - else - { - p = fp->zmmh_space (); -- for (i = 0; i < num_avx512_zmmh_low_registers; i++) -+ for (i = 0; i < num_xmm_registers; i++) - supply_register (regcache, i + zmm0h_regnum, p + i * 32); - } - } - -- if ((x86_xcr0 & X86_XSTATE_ZMM) != 0) -+ if ((x86_xcr0 & X86_XSTATE_ZMM) != 0 && num_zmm_high_registers != 0) - { -- int zmm16h_regnum = (num_avx512_zmmh_high_registers == 0 -- ? -1 -- : find_regno (regcache->tdesc, "zmm16h")); -- int ymm16h_regnum = (num_avx512_ymmh_registers == 0 -- ? -1 -- : find_regno (regcache->tdesc, "ymm16h")); -- int xmm16_regnum = (num_avx512_xmm_registers == 0 -- ? -1 -- : find_regno (regcache->tdesc, "xmm16")); -+ int zmm16h_regnum = find_regno (regcache->tdesc, "zmm16h"); -+ int ymm16h_regnum = find_regno (regcache->tdesc, "ymm16h"); -+ int xmm16_regnum = find_regno (regcache->tdesc, "xmm16"); - - if ((clear_bv & X86_XSTATE_ZMM) != 0) - { -- for (i = 0; i < num_avx512_zmmh_high_registers; i++) -- supply_register_zeroed (regcache, i + zmm16h_regnum); -- for (i = 0; i < num_avx512_ymmh_registers; i++) -- supply_register_zeroed (regcache, i + ymm16h_regnum); -- for (i = 0; i < num_avx512_xmm_registers; i++) -- supply_register_zeroed (regcache, i + xmm16_regnum); -+ for (i = 0; i < num_zmm_high_registers; i++) -+ { -+ supply_register_zeroed (regcache, i + zmm16h_regnum); -+ supply_register_zeroed (regcache, i + ymm16h_regnum); -+ supply_register_zeroed (regcache, i + xmm16_regnum); -+ } - } - else - { - p = fp->zmm16_space (); -- for (i = 0; i < num_avx512_zmmh_high_registers; i++) -- supply_register (regcache, i + zmm16h_regnum, p + 32 + i * 64); -- for (i = 0; i < num_avx512_ymmh_registers; i++) -- supply_register (regcache, i + ymm16h_regnum, p + 16 + i * 64); -- for (i = 0; i < num_avx512_xmm_registers; i++) -- supply_register (regcache, i + xmm16_regnum, p + i * 64); -+ for (i = 0; i < num_zmm_high_registers; i++) -+ { -+ supply_register (regcache, i + zmm16h_regnum, p + 32 + i * 64); -+ supply_register (regcache, i + ymm16h_regnum, p + 16 + i * 64); -+ supply_register (regcache, i + xmm16_regnum, p + i * 64); -+ } - } - } - diff --git a/gdb-rhel-10464-xsave-update-14of21.patch b/gdb-rhel-10464-xsave-update-14of21.patch deleted file mode 100644 index 3d7a673..0000000 --- a/gdb-rhel-10464-xsave-update-14of21.patch +++ /dev/null @@ -1,69 +0,0 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Aleksandar Paunovic -Date: Thu, 11 Apr 2024 14:05:45 -0700 -Subject: gdb-rhel-10464-xsave-update-14of21.patch - -;; Backport "gdbserver: Refactor the legacy region within the xsave struct" -;; (Aleksandar Paunovic, RHEL-10464) - -Legacy fields of the XSAVE area are already defined within fx_save -struct. Use class inheritance to remove code duplication. - -The two changed functions are called within all tests which run -gdbserver. - -Signed-off-by: Aleksandar Paunovic -Co-authored-by: John Baldwin -Approved-By: Simon Marchi - -diff --git a/gdbserver/i387-fp.cc b/gdbserver/i387-fp.cc ---- a/gdbserver/i387-fp.cc -+++ b/gdbserver/i387-fp.cc -@@ -83,29 +83,7 @@ struct i387_fxsave { - - gdb_static_assert (sizeof(i387_fxsave) == 416); - --struct i387_xsave { -- /* All these are only sixteen bits, plus padding, except for fop (which -- is only eleven bits), and fooff / fioff (which are 32 bits each). */ -- unsigned short fctrl; -- unsigned short fstat; -- unsigned short ftag; -- unsigned short fop; -- unsigned int fioff; -- unsigned short fiseg; -- unsigned short pad1; -- unsigned int fooff; -- unsigned short foseg; -- unsigned short pad12; -- -- unsigned int mxcsr; -- unsigned int mxcsr_mask; -- -- /* Space for eight 80-bit FP values in 128-bit spaces. */ -- unsigned char st_space[128]; -- -- /* Space for eight 128-bit XMM values, or 16 on x86-64. */ -- unsigned char xmm_space[256]; -- -+struct i387_xsave : public i387_fxsave { - unsigned char reserved1[48]; - - /* The extended control register 0 (the XFEATURE_ENABLED_MASK -@@ -719,7 +697,6 @@ void - i387_xsave_to_cache (struct regcache *regcache, const void *buf) - { - struct i387_xsave *fp = (struct i387_xsave *) buf; -- struct i387_fxsave *fxp = (struct i387_fxsave *) buf; - bool amd64 = register_size (regcache->tdesc, 0) == 8; - int i, top; - unsigned long val; -@@ -946,7 +923,7 @@ i387_xsave_to_cache (struct regcache *regcache, const void *buf) - { - int tag; - if (fp->ftag & (1 << i)) -- tag = i387_ftag (fxp, (i + 8 - top) % 8); -+ tag = i387_ftag (fp, (i + 8 - top) % 8); - else - tag = 3; - val |= tag << (2 * i); diff --git a/gdb-rhel-10464-xsave-update-15of21.patch b/gdb-rhel-10464-xsave-update-15of21.patch deleted file mode 100644 index c524cf8..0000000 --- a/gdb-rhel-10464-xsave-update-15of21.patch +++ /dev/null @@ -1,41 +0,0 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: John Baldwin -Date: Thu, 11 Apr 2024 14:05:45 -0700 -Subject: gdb-rhel-10464-xsave-update-15of21.patch - -;; Backport "gdbserver: Fix style of struct declarations in i387-fp.cc" -;; (John Baldwin, RHEL-10464) - -diff --git a/gdbserver/i387-fp.cc b/gdbserver/i387-fp.cc ---- a/gdbserver/i387-fp.cc -+++ b/gdbserver/i387-fp.cc -@@ -37,7 +37,8 @@ static x86_xsave_layout xsave_layout; - /* These structs should have the proper sizes and alignment on both - i386 and x86-64 machines. */ - --struct i387_fsave { -+struct i387_fsave -+{ - /* All these are only sixteen bits, plus padding, except for fop (which - is only eleven bits), and fooff / fioff (which are 32 bits each). */ - unsigned short fctrl; -@@ -57,7 +58,8 @@ struct i387_fsave { - unsigned char st_space[80]; - }; - --struct i387_fxsave { -+struct i387_fxsave -+{ - /* All these are only sixteen bits, plus padding, except for fop (which - is only eleven bits), and fooff / fioff (which are 32 bits each). */ - unsigned short fctrl; -@@ -83,7 +85,8 @@ struct i387_fxsave { - - gdb_static_assert (sizeof(i387_fxsave) == 416); - --struct i387_xsave : public i387_fxsave { -+struct i387_xsave : public i387_fxsave -+{ - unsigned char reserved1[48]; - - /* The extended control register 0 (the XFEATURE_ENABLED_MASK diff --git a/gdb-rhel-10464-xsave-update-16of21.patch b/gdb-rhel-10464-xsave-update-16of21.patch deleted file mode 100644 index e83e070..0000000 --- a/gdb-rhel-10464-xsave-update-16of21.patch +++ /dev/null @@ -1,52 +0,0 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: John Baldwin -Date: Thu, 11 Apr 2024 14:05:45 -0700 -Subject: gdb-rhel-10464-xsave-update-16of21.patch - -;; Backport "nat/x86-cpuid.h: Remove non-x86 fallbacks" -;; (John Baldwin, RHEL-10464) - -This header is only suitable for use on x86 hosts and is only included -there, so these fallbacks should not be needed. - -Approved-By: Simon Marchi - -diff --git a/gdb/nat/x86-cpuid.h b/gdb/nat/x86-cpuid.h ---- a/gdb/nat/x86-cpuid.h -+++ b/gdb/nat/x86-cpuid.h -@@ -28,8 +28,6 @@ - #define nullptr ((void *) 0) - #endif - --#if defined(__i386__) || defined(__x86_64__) -- - /* Return cpuid data for requested cpuid level, as found in returned - eax, ebx, ecx and edx registers. The function checks if cpuid is - supported and returns 1 for valid cpuid information or 0 for -@@ -78,26 +76,6 @@ x86_cpuid_count (unsigned int __level, unsigned int __sublevel, - return __get_cpuid_count (__level, __sublevel, __eax, __ebx, __ecx, __edx); - } - --#else -- --static __inline int --x86_cpuid (unsigned int __level, -- unsigned int *__eax, unsigned int *__ebx, -- unsigned int *__ecx, unsigned int *__edx) --{ -- return 0; --} -- --static __inline int --x86_cpuid_count (unsigned int __level, unsigned int __sublevel, -- unsigned int *__eax, unsigned int *__ebx, -- unsigned int *__ecx, unsigned int *__edx) --{ -- return 0; --} -- --#endif /* i386 && x86_64 */ -- - #ifndef __cplusplus - /* Avoid leaking this local definition beyond the scope of this header - file. */ diff --git a/gdb-rhel-10464-xsave-update-17of21.patch b/gdb-rhel-10464-xsave-update-17of21.patch deleted file mode 100644 index afa33f2..0000000 --- a/gdb-rhel-10464-xsave-update-17of21.patch +++ /dev/null @@ -1,188 +0,0 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: John Baldwin -Date: Thu, 11 Apr 2024 14:05:46 -0700 -Subject: gdb-rhel-10464-xsave-update-17of21.patch - -;; Backport "i386: Use a fallback XSAVE layout for remote targets" -;; (John Baldwin, RHEL-10464) - -If a target provides a target description including registers from the -XSAVE extended region, but does not provide an XSAVE layout, use a -fallback XSAVE layout based on the included registers. This fallback -layout matches GDB's behavior in earlier releases which assumes the -layout from Intel CPUs. - -This fallback layout is currently only used for remote targets since -native targets which support XSAVE provide an explicit layout derived -from CPUID. - -PR gdb/30912 -Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30912 -Approved-By: Simon Marchi - -diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c ---- a/gdb/i386-tdep.c -+++ b/gdb/i386-tdep.c -@@ -8244,6 +8244,72 @@ i386_floatformat_for_type (struct gdbarch *gdbarch, - return default_floatformat_for_type (gdbarch, name, len); - } - -+/* Compute an XCR0 mask based on a target description. */ -+ -+static uint64_t -+i386_xcr0_from_tdesc (const struct target_desc *tdesc) -+{ -+ if (! tdesc_has_registers (tdesc)) -+ return 0; -+ -+ const struct tdesc_feature *feature_core; -+ -+ const struct tdesc_feature *feature_sse, *feature_avx, *feature_mpx, -+ *feature_avx512, *feature_pkeys; -+ -+ /* Get core registers. */ -+ feature_core = tdesc_find_feature (tdesc, "org.gnu.gdb.i386.core"); -+ if (feature_core == NULL) -+ return 0; -+ -+ /* Get SSE registers. */ -+ feature_sse = tdesc_find_feature (tdesc, "org.gnu.gdb.i386.sse"); -+ -+ /* Try AVX registers. */ -+ feature_avx = tdesc_find_feature (tdesc, "org.gnu.gdb.i386.avx"); -+ -+ /* Try MPX registers. */ -+ feature_mpx = tdesc_find_feature (tdesc, "org.gnu.gdb.i386.mpx"); -+ -+ /* Try AVX512 registers. */ -+ feature_avx512 = tdesc_find_feature (tdesc, "org.gnu.gdb.i386.avx512"); -+ -+ /* Try PKEYS */ -+ feature_pkeys = tdesc_find_feature (tdesc, "org.gnu.gdb.i386.pkeys"); -+ -+ /* The XCR0 bits. */ -+ uint64_t xcr0 = X86_XSTATE_X87; -+ -+ if (feature_sse) -+ xcr0 |= X86_XSTATE_SSE; -+ -+ if (feature_avx) -+ { -+ /* AVX register description requires SSE register description. */ -+ if (!feature_sse) -+ return 0; -+ -+ xcr0 |= X86_XSTATE_AVX; -+ } -+ -+ if (feature_mpx) -+ xcr0 |= X86_XSTATE_MPX_MASK; -+ -+ if (feature_avx512) -+ { -+ /* AVX512 register description requires AVX register description. */ -+ if (!feature_avx) -+ return 0; -+ -+ xcr0 |= X86_XSTATE_AVX512; -+ } -+ -+ if (feature_pkeys) -+ xcr0 |= X86_XSTATE_PKRU; -+ -+ return xcr0; -+} -+ - static int - i386_validate_tdesc_p (struct gdbarch_tdep *tdep, - struct tdesc_arch_data *tdesc_data) -@@ -8458,6 +8524,15 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) - - x86_xsave_layout xsave_layout = target_fetch_x86_xsave_layout (); - -+ /* If the target did not provide an XSAVE layout but the target -+ description includes registers from the XSAVE extended region, -+ use a fallback XSAVE layout. Specifically, this fallback layout -+ is used when writing out a local core dump for a remote -+ target. */ -+ if (xsave_layout.sizeof_xsave == 0) -+ xsave_layout -+ = i387_fallback_xsave_layout (i386_xcr0_from_tdesc (info.target_desc)); -+ - /* If there is already a candidate, use it. */ - for (arches = gdbarch_list_lookup_by_info (arches, &info); - arches != NULL; -diff --git a/gdb/i387-tdep.c b/gdb/i387-tdep.c ---- a/gdb/i387-tdep.c -+++ b/gdb/i387-tdep.c -@@ -982,6 +982,55 @@ i387_guess_xsave_layout (uint64_t xcr0, size_t xsave_size, - return true; - } - -+/* See i387-tdep.h. */ -+ -+x86_xsave_layout -+i387_fallback_xsave_layout (uint64_t xcr0) -+{ -+ x86_xsave_layout layout; -+ memset (&layout, 0, sizeof (x86_xsave_layout)); -+ -+ if (HAS_PKRU (xcr0)) -+ { -+ /* Intel CPUs supporting PKRU. */ -+ layout.avx_offset = 576; -+ layout.bndregs_offset = 960; -+ layout.bndcfg_offset = 1024; -+ layout.k_offset = 1088; -+ layout.zmm_h_offset = 1152; -+ layout.zmm_offset = 1664; -+ layout.pkru_offset = 2688; -+ layout.sizeof_xsave = 2696; -+ } -+ else if (HAS_AVX512 (xcr0)) -+ { -+ /* Intel CPUs supporting AVX512. */ -+ layout.avx_offset = 576; -+ layout.bndregs_offset = 960; -+ layout.bndcfg_offset = 1024; -+ layout.k_offset = 1088; -+ layout.zmm_h_offset = 1152; -+ layout.zmm_offset = 1664; -+ layout.sizeof_xsave = 2688; -+ } -+ else if (HAS_MPX (xcr0)) -+ { -+ /* Intel CPUs supporting MPX. */ -+ layout.avx_offset = 576; -+ layout.bndregs_offset = 960; -+ layout.bndcfg_offset = 1024; -+ layout.sizeof_xsave = 1088; -+ } -+ else if (HAS_AVX (xcr0)) -+ { -+ /* Intel and AMD CPUs supporting AVX. */ -+ layout.avx_offset = 576; -+ layout.sizeof_xsave = 832; -+ } -+ -+ return layout; -+} -+ - /* Extract from XSAVE a bitset of the features that are available on the - target, but which have not yet been enabled. */ - -diff --git a/gdb/i387-tdep.h b/gdb/i387-tdep.h ---- a/gdb/i387-tdep.h -+++ b/gdb/i387-tdep.h -@@ -148,6 +148,11 @@ extern bool i387_guess_xsave_layout (uint64_t xcr0, size_t xsave_size, - x86_xsave_layout &layout); - - -+/* Compute an XSAVE layout based on the XCR0 bitmask. This is used -+ as a fallback if a target does not provide an XSAVE layout. */ -+ -+extern x86_xsave_layout i387_fallback_xsave_layout (uint64_t xcr0); -+ - /* Similar to i387_supply_fxsave, but use XSAVE extended state. */ - - extern void i387_supply_xsave (struct regcache *regcache, int regnum, diff --git a/gdb-rhel-10464-xsave-update-18of21.patch b/gdb-rhel-10464-xsave-update-18of21.patch deleted file mode 100644 index 1fcd446..0000000 --- a/gdb-rhel-10464-xsave-update-18of21.patch +++ /dev/null @@ -1,67 +0,0 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Simon Marchi -Date: Thu, 11 Apr 2024 14:05:46 -0700 -Subject: gdb-rhel-10464-xsave-update-18of21.patch - -;; Backport "gdbserver: i387_cache_to_xsave: fix copy dest of zmm registers" -;; (Simon Marchi, RHEL-10464) - -On a machine with AVX512 support (AMD EPYC 9634), I see these failures: - - $ make check TESTS="gdb.arch/i386-avx512.exp" RUNTESTFLAGS="--target_board=native-gdbserver" - ... - FAIL: gdb.arch/i386-avx512.exp: check contents of zmm_data[16] after writing ZMM regs - FAIL: gdb.arch/i386-avx512.exp: check contents of zmm_data[17] after writing ZMM regs - FAIL: gdb.arch/i386-avx512.exp: check contents of zmm_data[18] after writing ZMM regs - ... - -The problem can be reduced to: - - (gdb) print $zmm16.v8_int64 - $1 = {0, 0, 0, 0, 0, 0, 0, 0} - (gdb) print $zmm16.v8_int64 = {11,22,33,44,55,66,77,88} - $2 = {11, 22, 33, 44, 55, 66, 77, 88} - (gdb) print $zmm16.v8_int64 - $3 = {11, 22, 33, 44, 55, 66, 77, 88} - (gdb) step - 5 ++x; - (gdb) print $zmm16.v8_int64 - $4 = {11, 22, 77, 88, 0, 0, 0, 0} - -Writing to the local regcache in GDB works fine, but the writeback to -gdbserver (which happens when resuming / stepping) doesn't work (the -code being stepped doesn't touch AVX registers, so we don't expect the -value of zmm16 to change when stepping). - -The problem is on the gdbserver side, the zmmh and ymmh portions of the -zmm register are not memcpied at the right place in the xsave buffer. Fix -that. Note now how the two modified memcpy calls match the memcmp calls -just above them. - -With this patch, gdb.arch/i386-avx512.exp passes completely for me. - -Change-Id: I22c417e0f5e88d4bc635a0f08f8817a031c76433 -Reviewed-by: John Baldwin -Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30818 - -diff --git a/gdbserver/i387-fp.cc b/gdbserver/i387-fp.cc ---- a/gdbserver/i387-fp.cc -+++ b/gdbserver/i387-fp.cc -@@ -470,7 +470,7 @@ i387_cache_to_xsave (struct regcache *regcache, void *buf) - if (memcmp (raw, p + 32, 32) != 0) - { - xstate_bv |= X86_XSTATE_ZMM; -- memcpy (p, raw, 32); -+ memcpy (p + 32, raw, 32); - } - - /* YMMH sub-register. */ -@@ -478,7 +478,7 @@ i387_cache_to_xsave (struct regcache *regcache, void *buf) - if (memcmp (raw, p + 16, 16) != 0) - { - xstate_bv |= X86_XSTATE_ZMM; -- memcpy (p, raw, 16); -+ memcpy (p + 16, raw, 16); - } - - /* XMM sub-register. */ diff --git a/gdb-rhel-10464-xsave-update-19of21.patch b/gdb-rhel-10464-xsave-update-19of21.patch deleted file mode 100644 index abf790f..0000000 --- a/gdb-rhel-10464-xsave-update-19of21.patch +++ /dev/null @@ -1,132 +0,0 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Andrew Burgess -Date: Thu, 11 Apr 2024 14:05:46 -0700 -Subject: gdb-rhel-10464-xsave-update-19of21.patch - -;; Backport "bfd/binutils: support for gdb target descriptions in the core file" -;; (Andrew Burgess, RHEL-10464) - -This commit lays the ground work for allowing GDB to write its target -description into a generated core file. - -The goal of this work is to allow a user to connect to a remote -target, capture a core file from within GDB, then pass the executable -and core file to another user and have the user be able to examine the -state of the machine without needing to connect to a running target. - -Different remote targets can have different register sets and this -information is communicated from the target to GDB in the target -description. - -It is possible for a user to extract the target description from GDB -and pass this along with the core file so that when the core file is -used the target description can be fed back into GDB, however this is -not a great user experience. -It would be nicer, I think, if GDB could write the target description -directly into the core file, and then make use of this description -when loading a core file. - -This commit performs the binutils/bfd side of this task, adding the -boiler plate functions to access the target description from within a -core file note, and reserving a new number for a note containing the -target description. Later commits will extend GDB to make use of -this. - -The new note is given the name 'GDB' and a type NT_GDB_TDESC. This -should hopefully protect us if there's ever a reuse of the number -assigned to NT_GDB_TDESC by some other core file producer. It should -also, hopefully, make it clearer to users that this note carries GDB -specific information. - -diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h ---- a/bfd/elf-bfd.h -+++ b/bfd/elf-bfd.h -@@ -2795,6 +2795,8 @@ extern char *elfcore_write_aarch_pauth - (bfd *, char *, int *, const void *, int); - extern char *elfcore_write_arc_v2 - (bfd *, char *, int *, const void *, int); -+extern char *elfcore_write_gdb_tdesc -+ (bfd *, char *, int *, const void *, int); - extern char *elfcore_write_lwpstatus - (bfd *, char *, int *, long, int, const void *); - extern char *elfcore_write_register_note -diff --git a/bfd/elf.c b/bfd/elf.c ---- a/bfd/elf.c -+++ b/bfd/elf.c -@@ -9903,6 +9903,15 @@ elfcore_grok_arc_v2 (bfd *abfd, Elf_Internal_Note *note) - return elfcore_make_note_pseudosection (abfd, ".reg-arc-v2", note); - } - -+/* Convert NOTE into a bfd_section called ".gdb-tdesc". Return TRUE if -+ successful otherwise, return FALSE. */ -+ -+static bfd_boolean -+elfcore_grok_gdb_tdesc (bfd *abfd, Elf_Internal_Note *note) -+{ -+ return elfcore_make_note_pseudosection (abfd, ".gdb-tdesc", note); -+} -+ - #if defined (HAVE_PRPSINFO_T) - typedef prpsinfo_t elfcore_psinfo_t; - #if defined (HAVE_PRPSINFO32_T) /* Sparc64 cross Sparc32 */ -@@ -10560,6 +10569,13 @@ elfcore_grok_note (bfd *abfd, Elf_Internal_Note *note) - else - return TRUE; - -+ case NT_GDB_TDESC: -+ if (note->namesz == 4 -+ && strcmp (note->namedata, "GDB") == 0) -+ return elfcore_grok_gdb_tdesc (abfd, note); -+ else -+ return TRUE; -+ - case NT_PRPSINFO: - case NT_PSINFO: - if (bed->elf_backend_grok_psinfo) -@@ -11941,6 +11957,23 @@ elfcore_write_arc_v2 (bfd *abfd, - note_name, NT_ARC_V2, arc_v2, size); - } - -+/* Write the target description (a string) pointed to by TDESC, length -+ SIZE, into the note buffer BUF, and update *BUFSIZ. ABFD is the bfd the -+ note is being written into. Return a pointer to the new start of the -+ note buffer, to replace BUF which may no longer be valid. */ -+ -+char * -+elfcore_write_gdb_tdesc (bfd *abfd, -+ char *buf, -+ int *bufsiz, -+ const void *tdesc, -+ int size) -+{ -+ const char *note_name = "GDB"; -+ return elfcore_write_note (abfd, buf, bufsiz, -+ note_name, NT_GDB_TDESC, tdesc, size); -+} -+ - char * - elfcore_write_register_note (bfd *abfd, - char *buf, -@@ -12025,6 +12058,8 @@ elfcore_write_register_note (bfd *abfd, - return elfcore_write_aarch_pauth (abfd, buf, bufsiz, data, size); - if (strcmp (section, ".reg-arc-v2") == 0) - return elfcore_write_arc_v2 (abfd, buf, bufsiz, data, size); -+ if (strcmp (section, ".gdb-tdesc") == 0) -+ return elfcore_write_gdb_tdesc (abfd, buf, bufsiz, data, size); - return NULL; - } - -diff --git a/include/elf/common.h b/include/elf/common.h ---- a/include/elf/common.h -+++ b/include/elf/common.h -@@ -665,6 +665,10 @@ - #define NT_SIGINFO 0x53494749 /* Fields of siginfo_t. */ - #define NT_FILE 0x46494c45 /* Description of mapped files. */ - -+/* The range 0xff000000 to 0xffffffff is set aside for notes that don't -+ originate from any particular operating system. */ -+#define NT_GDB_TDESC 0xff000000 /* Contains copy of GDB's target description XML. */ -+ - /* Note segments for core files on dir-style procfs systems. */ - - #define NT_PSTATUS 10 /* Has a struct pstatus */ diff --git a/gdb-rhel-10464-xsave-update-1of21.patch b/gdb-rhel-10464-xsave-update-1of21.patch deleted file mode 100644 index 372d1b1..0000000 --- a/gdb-rhel-10464-xsave-update-1of21.patch +++ /dev/null @@ -1,125 +0,0 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: John Baldwin -Date: Thu, 11 Apr 2024 14:05:42 -0700 -Subject: gdb-rhel-10464-xsave-update-1of21.patch - -;; Backport "x86: Add an x86_xsave_layout structure to -;; handle variable XSAVE layouts." -;; (John Baldwin, RHEL-10464) - -The standard layout of the XSAVE extended state area consists of three -regions. The first 512 bytes (legacy region) match the layout of the -FXSAVE instruction including floating point registers, MMX registers, -and SSE registers. The next 64 bytes (XSAVE header) contains a header -with a fixed layout. The final region (extended region) contains zero -or more optional state components. Examples of these include the -upper 128 bits of YMM registers for AVX. - -These optional state components generally have an -architecturally-fixed size, but they are not assigned architectural -offsets in the extended region. Instead, processors provide -additional CPUID leafs describing the size and offset of each -component in the "standard" layout for a given CPU. (There is also a -"compact" format which uses an alternate layout, but existing OS's -currently export the "standard" layout when exporting XSAVE data via -ptrace() and core dumps.) - -To date, GDB has assumed the layout used on current Intel processors -for state components in the extended region and hardcoded those -offsets in the tables in i387-tdep.c and i387-fp.cc. However, this -fails on recent AMD processors which use a different layout. -Specifically, AMD Zen3 and later processors do not leave space for the -MPX register set in between the AVX and AVX512 register sets. - -To rectify this, add an x86_xsave_layout structure which contains the -total size of the XSAVE extended state area as well as the offset of -each known optional state component. - -Subsequent commits will modify XSAVE parsing in both gdb and gdbserver -to use x86_xsave_layout. - -Co-authored-by: Aleksandar Paunovic -Approved-By: Simon Marchi - -diff --git a/gdbsupport/x86-xstate.h b/gdbsupport/x86-xstate.h ---- a/gdbsupport/x86-xstate.h -+++ b/gdbsupport/x86-xstate.h -@@ -20,22 +20,69 @@ - #ifndef COMMON_X86_XSTATE_H - #define COMMON_X86_XSTATE_H - -+/* The extended state feature IDs in the state component bitmap. */ -+#define X86_XSTATE_X87_ID 0 -+#define X86_XSTATE_SSE_ID 1 -+#define X86_XSTATE_AVX_ID 2 -+#define X86_XSTATE_BNDREGS_ID 3 -+#define X86_XSTATE_BNDCFG_ID 4 -+#define X86_XSTATE_K_ID 5 -+#define X86_XSTATE_ZMM_H_ID 6 -+#define X86_XSTATE_ZMM_ID 7 -+#define X86_XSTATE_PKRU_ID 9 -+ - /* The extended state feature bits. */ --#define X86_XSTATE_X87 (1ULL << 0) --#define X86_XSTATE_SSE (1ULL << 1) --#define X86_XSTATE_AVX (1ULL << 2) --#define X86_XSTATE_BNDREGS (1ULL << 3) --#define X86_XSTATE_BNDCFG (1ULL << 4) -+#define X86_XSTATE_X87 (1ULL << X86_XSTATE_X87_ID) -+#define X86_XSTATE_SSE (1ULL << X86_XSTATE_SSE_ID) -+#define X86_XSTATE_AVX (1ULL << X86_XSTATE_AVX_ID) -+#define X86_XSTATE_BNDREGS (1ULL << X86_XSTATE_BNDREGS_ID) -+#define X86_XSTATE_BNDCFG (1ULL << X86_XSTATE_BNDCFG_ID) - #define X86_XSTATE_MPX (X86_XSTATE_BNDREGS | X86_XSTATE_BNDCFG) - - /* AVX 512 adds three feature bits. All three must be enabled. */ --#define X86_XSTATE_K (1ULL << 5) --#define X86_XSTATE_ZMM_H (1ULL << 6) --#define X86_XSTATE_ZMM (1ULL << 7) -+#define X86_XSTATE_K (1ULL << X86_XSTATE_K_ID) -+#define X86_XSTATE_ZMM_H (1ULL << X86_XSTATE_ZMM_H_ID) -+#define X86_XSTATE_ZMM (1ULL << X86_XSTATE_ZMM_ID) - #define X86_XSTATE_AVX512 (X86_XSTATE_K | X86_XSTATE_ZMM_H \ - | X86_XSTATE_ZMM) - --#define X86_XSTATE_PKRU (1ULL << 9) -+#define X86_XSTATE_PKRU (1ULL << X86_XSTATE_PKRU_ID) -+ -+/* Total size of the XSAVE area extended region and offsets of -+ register states within the region. Offsets are set to 0 to -+ indicate the absence of the associated registers. */ -+ -+struct x86_xsave_layout -+{ -+ int sizeof_xsave; -+ int avx_offset; -+ int bndregs_offset; -+ int bndcfg_offset; -+ int k_offset; -+ int zmm_h_offset; -+ int zmm_offset; -+ int pkru_offset; -+}; -+ -+constexpr bool operator== (const x86_xsave_layout &lhs, -+ const x86_xsave_layout &rhs) -+{ -+ return lhs.sizeof_xsave == rhs.sizeof_xsave -+ && lhs.avx_offset == rhs.avx_offset -+ && lhs.bndregs_offset == rhs.bndregs_offset -+ && lhs.bndcfg_offset == rhs.bndcfg_offset -+ && lhs.k_offset == rhs.k_offset -+ && lhs.zmm_h_offset == rhs.zmm_h_offset -+ && lhs.zmm_offset == rhs.zmm_offset -+ && lhs.pkru_offset == rhs.pkru_offset; -+} -+ -+constexpr bool operator!= (const x86_xsave_layout &lhs, -+ const x86_xsave_layout &rhs) -+{ -+ return !(lhs == rhs); -+} -+ - - /* Supported mask and size of the extended state. */ - #define X86_XSTATE_X87_MASK X86_XSTATE_X87 diff --git a/gdb-rhel-10464-xsave-update-20of21.patch b/gdb-rhel-10464-xsave-update-20of21.patch deleted file mode 100644 index a2c9b18..0000000 --- a/gdb-rhel-10464-xsave-update-20of21.patch +++ /dev/null @@ -1,162 +0,0 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: root -Date: Thu, 11 Apr 2024 14:05:47 -0700 -Subject: gdb-rhel-10464-xsave-update-20of21.patch - -;; Backport "gdb: write target description into core file" -;; (Andrew Burgess, RHEL-10464) - -When a core file is created from within GDB add the target description -into a note within the core file. - -When loading a core file, if the target description note is present -then load the target description from the core file. - -The benefit of this is that we can be sure that, when analysing the -core file within GDB, that we are using the exact same target -description as was in use at the time the core file was created. - -GDB already supports a mechanism for figuring out the target -description from a given corefile; gdbarch_core_read_description. -This new mechanism (GDB adding the target description) is not going to -replace the old mechanism. Core files generated outside of GDB will -not include a target description, and so GDB still needs to be able to -figure out a target description for these files. - -My primary motivation for adding this feature is that, in a future -commit, I will be adding support for bare metal core dumps on some -targets. For RISC-V specifically, I want to be able to dump all the -available control status registers. As different targets will present -different sets of register in their target description, including -registers that are possibly not otherwise known to GDB I wanted a way -to capture these registers in the core dump. - -I therefore need a mechanism to write out an arbitrary set of -registers, and to then derive a target description from this arbitrary -set when later loading the core file. The obvious approach (I think) -is to just reuse the target description. - -Once I'd decided to add support for writing out the target description -I could either choose to make this RISC-V only, or make it generic. I -figure that having the target description in the core file doesn't -hurt, and _might_ be helpful. So that's how I got here, general -support for including the target description in GDB generated core -files. - -In previous versions of this patch I added the target description from -generic code (in gcore.c). However, doing this creates a dependency -between GDB's common code and bfd ELF support. As ELF support in gdb -is optional (for example the target x86_64-apple-darwin20.3.0 does not -include ELF support) then having gcore.c require ELF support would -break the GDB build in some cases. - -Instead, in this version of the patch, writing the target description -note is done from each specific targets make notes function. Each of -these now calls a common function in gcore-elf.c (which is only linked -in when bfd has ELF support). And so only targets that are ELF based -will call the new function and we can therefore avoid an unconditional -dependency on ELF support. - -diff --git a/gdb/corelow.c b/gdb/corelow.c ---- a/gdb/corelow.c -+++ b/gdb/corelow.c -@@ -54,6 +54,7 @@ - #include - #include - #include "gdbcmd.h" -+#include "xml-tdesc.h" - - #ifndef O_LARGEFILE - #define O_LARGEFILE 0 -@@ -1032,6 +1033,29 @@ core_target::thread_alive (ptid_t ptid) - const struct target_desc * - core_target::read_description () - { -+ /* If the core file contains a target description note then we will use -+ that in preference to anything else. */ -+ bfd_size_type tdesc_note_size = 0; -+ struct bfd_section *tdesc_note_section -+ = bfd_get_section_by_name (core_bfd, ".gdb-tdesc"); -+ if (tdesc_note_section != nullptr) -+ tdesc_note_size = bfd_section_size (tdesc_note_section); -+ if (tdesc_note_size > 0) -+ { -+ gdb::char_vector contents (tdesc_note_size + 1); -+ if (bfd_get_section_contents (core_bfd, tdesc_note_section, -+ contents.data (), (file_ptr) 0, -+ tdesc_note_size)) -+ { -+ /* Ensure we have a null terminator. */ -+ contents[tdesc_note_size] = '\0'; -+ const struct target_desc *result -+ = string_read_description_xml (contents.data ()); -+ if (result != nullptr) -+ return result; -+ } -+ } -+ - if (m_core_gdbarch && gdbarch_core_read_description_p (m_core_gdbarch)) - { - const struct target_desc *result; -diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c ---- a/gdb/linux-tdep.c -+++ b/gdb/linux-tdep.c -@@ -39,6 +39,7 @@ - #include "gdb_regex.h" - #include "gdbsupport/enum-flags.h" - #include "gdbsupport/gdb_optional.h" -+#include "gdbsupport/tdesc.h" - - #include - -@@ -1968,6 +1969,40 @@ find_signalled_thread () - return nullptr; - } - -+/* Add content to *NOTE_DATA (and update *NOTE_SIZE) to include a note -+ containing the current targtet's target description. The core file is -+ being written to OBFD. If something goes wrong then *NOTE_DATA can be -+ set to nullptr. */ -+ -+static char * -+gcore_elf_make_tdesc_note (bfd *obfd, -+ char *note_data, -+ int *note_size) -+{ -+ /* Append the target description to the core file. */ -+ const struct target_desc *tdesc = gdbarch_target_desc (target_gdbarch ()); -+ const char *tdesc_xml -+ = tdesc == nullptr ? nullptr : tdesc_get_features_xml (tdesc); -+ if (tdesc_xml != nullptr && *tdesc_xml != '\0') -+ { -+ /* Skip the leading '@'. */ -+ if (*tdesc_xml == '@') -+ ++tdesc_xml; -+ -+ /* Include the null terminator in the length. */ -+ size_t tdesc_len = strlen (tdesc_xml) + 1; -+ -+ /* Now add the target description into the core file. */ -+ note_data = elfcore_write_register_note (obfd, -+ note_data, -+ note_size, -+ ".gdb-tdesc", tdesc_xml, -+ tdesc_len); -+ } -+ -+ return note_data; -+} -+ - /* Build the note section for a corefile, and return it in a malloc - buffer. */ - -@@ -2048,6 +2083,9 @@ linux_make_corefile_notes (struct gdbarch *gdbarch, bfd *obfd, int *note_size) - note_data = linux_make_mappings_corefile_notes (gdbarch, obfd, - note_data, note_size); - -+ /* Target description. */ -+ note_data = gcore_elf_make_tdesc_note (obfd, note_data, note_size); -+ - return note_data; - } - diff --git a/gdb-rhel-10464-xsave-update-21of21.patch b/gdb-rhel-10464-xsave-update-21of21.patch deleted file mode 100644 index 40bd77d..0000000 --- a/gdb-rhel-10464-xsave-update-21of21.patch +++ /dev/null @@ -1,66 +0,0 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: root -Date: Thu, 11 Apr 2024 14:05:47 -0700 -Subject: gdb-rhel-10464-xsave-update-21of21.patch - -;; Backport "gdb/corefile: write NT_GDB_TDESC based on signalled thread" -;; (Andrew Burgess, RHEL-10464) - -When creating a core file from within GDB we include a NT_GDB_TDESC -that includes the target description of the architecture in use. - -For architectures with dynamic architectures (e.g. AArch64 with -sve/sme) the original architecture, calculated from the original -target description, might not match the per-thread architecture. - -In the general case, where each thread has a different architecture, -then we really need a separate NT_GDB_TDESC for each thread, however, -there's currently no way to read in multiple NT_GDB_TDESC. - -This commit is a step towards per-thread NT_GDB_TDESC. In this commit -I have updated the function that writes the NT_GDB_TDESC to accept a -gdbarch (rather than calling target_gdbarch() to find a gdbarch), and -I now pass in the gdbarch of the signalled thread. - -In many cases (though NOT all) targets with dynamic architectures -really only use a single architecture, even when there are multiple -threads, so in the common case, this should ensure that GDB emits an -architecture that is more likely to be correct. - -Additional work will be needed in order to support corefiles with -truly per-thread architectures, but that will need to be done in the -future. - -diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c ---- a/gdb/linux-tdep.c -+++ b/gdb/linux-tdep.c -@@ -1975,12 +1975,12 @@ find_signalled_thread () - set to nullptr. */ - - static char * --gcore_elf_make_tdesc_note (bfd *obfd, -+gcore_elf_make_tdesc_note (struct gdbarch *gdbarch, bfd *obfd, - char *note_data, - int *note_size) - { - /* Append the target description to the core file. */ -- const struct target_desc *tdesc = gdbarch_target_desc (target_gdbarch ()); -+ const struct target_desc *tdesc = gdbarch_target_desc (gdbarch); - const char *tdesc_xml - = tdesc == nullptr ? nullptr : tdesc_get_features_xml (tdesc); - if (tdesc_xml != nullptr && *tdesc_xml != '\0') -@@ -2083,8 +2083,12 @@ linux_make_corefile_notes (struct gdbarch *gdbarch, bfd *obfd, int *note_size) - note_data = linux_make_mappings_corefile_notes (gdbarch, obfd, - note_data, note_size); - -- /* Target description. */ -- note_data = gcore_elf_make_tdesc_note (obfd, note_data, note_size); -+ /* Include the target description when possible. Some architectures -+ allow for per-thread gdbarch so we should really be emitting a tdesc -+ per-thread, however, we don't currently support reading in a -+ per-thread tdesc, so just emit the tdesc for the signalled thread. */ -+ gdbarch = target_thread_architecture (signalled_thr->ptid); -+ note_data = gcore_elf_make_tdesc_note (gdbarch, obfd, note_data, note_size); - - return note_data; - } diff --git a/gdb-rhel-10464-xsave-update-2of21.patch b/gdb-rhel-10464-xsave-update-2of21.patch deleted file mode 100644 index 5a432da..0000000 --- a/gdb-rhel-10464-xsave-update-2of21.patch +++ /dev/null @@ -1,190 +0,0 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Keith Seitz -Date: Thu, 11 Apr 2024 14:05:42 -0700 -Subject: gdb-rhel-10464-xsave-update-2of21.patch - -;; Backport "gdb: Store an x86_xsave_layout in i386_gdbarch_tdep." -;; (John Baldwin, RHEL-10464) - -This structure is fetched from the current target in i386_gdbarch_init -via a new "fetch_x86_xsave_layout" target method. - -Approved-By: Simon Marchi - -diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c ---- a/gdb/i386-tdep.c -+++ b/gdb/i386-tdep.c -@@ -8456,10 +8456,20 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) - int bnd0_regnum; - int num_bnd_cooked; - -+ x86_xsave_layout xsave_layout = target_fetch_x86_xsave_layout (); -+ - /* If there is already a candidate, use it. */ -- arches = gdbarch_list_lookup_by_info (arches, &info); -- if (arches != NULL) -- return arches->gdbarch; -+ for (arches = gdbarch_list_lookup_by_info (arches, &info); -+ arches != NULL; -+ arches = gdbarch_list_lookup_by_info (arches->next, &info)) -+ { -+ /* Check that the XSAVE layout of ARCHES matches the layout for -+ the current target. */ -+ struct gdbarch_tdep *other_tdep = gdbarch_tdep (arches->gdbarch); -+ -+ if (other_tdep->xsave_layout == xsave_layout) -+ return arches->gdbarch; -+ } - - /* Allocate space for the new architecture. Assume i386 for now. */ - tdep = XCNEW (struct gdbarch_tdep); -@@ -8711,6 +8721,7 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) - gdbarch_free (gdbarch); - return NULL; - } -+ tdep->xsave_layout = xsave_layout; - - num_bnd_cooked = (tdep->bnd0r_regnum > 0 ? I387_NUM_BND_REGS : 0); - -diff --git a/gdb/i386-tdep.h b/gdb/i386-tdep.h ---- a/gdb/i386-tdep.h -+++ b/gdb/i386-tdep.h -@@ -22,6 +22,7 @@ - - #include "gdbarch.h" - #include "infrun.h" -+#include "gdbsupport/x86-xstate.h" - - struct frame_info; - struct gdbarch; -@@ -144,6 +145,9 @@ struct gdbarch_tdep - /* Offset of XCR0 in XSAVE extended state. */ - int xsave_xcr0_offset; - -+ /* Layout of the XSAVE area extended region. */ -+ x86_xsave_layout xsave_layout; -+ - /* Register names. */ - const char **register_names; - -diff --git a/gdb/target-debug.h b/gdb/target-debug.h ---- a/gdb/target-debug.h -+++ b/gdb/target-debug.h -@@ -226,4 +226,23 @@ target_debug_print_signals (gdb::array_view sigs) - fputs_unfiltered (" }", gdb_stdlog); - } - -+static void -+target_debug_print_x86_xsave_layout (const x86_xsave_layout &layout) -+{ -+ fputs_unfiltered ("{", gdb_stdlog); -+ fprintf_unfiltered (gdb_stdlog, " sizeof_xsave=%d", layout.sizeof_xsave); -+#define POFFS(region) \ -+ if (layout.region##_offset != 0) \ -+ fprintf_unfiltered (gdb_stdlog, ", %s_offset=%d", #region, \ -+ layout.region##_offset) -+ POFFS(avx); -+ POFFS(bndregs); -+ POFFS(bndcfg); -+ POFFS(k); -+ POFFS(zmm_h); -+ POFFS(zmm); -+ POFFS(pkru); -+#undef POFFS -+ fputs_unfiltered (" }", gdb_stdlog); -+} - #endif /* TARGET_DEBUG_H */ -diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c ---- a/gdb/target-delegates.c -+++ b/gdb/target-delegates.c -@@ -173,6 +173,7 @@ struct dummy_target : public target_ops - const struct frame_unwind *get_tailcall_unwinder () override; - void prepare_to_generate_core () override; - void done_generating_core () override; -+ x86_xsave_layout fetch_x86_xsave_layout () override; - }; - - struct debug_target : public target_ops -@@ -344,6 +345,7 @@ struct debug_target : public target_ops - const struct frame_unwind *get_tailcall_unwinder () override; - void prepare_to_generate_core () override; - void done_generating_core () override; -+ x86_xsave_layout fetch_x86_xsave_layout () override; - }; - - void -@@ -4413,3 +4415,27 @@ debug_target::done_generating_core () - fputs_unfiltered (")\n", gdb_stdlog); - } - -+x86_xsave_layout -+target_ops::fetch_x86_xsave_layout () -+{ -+ return this->beneath ()->fetch_x86_xsave_layout (); -+} -+ -+x86_xsave_layout -+dummy_target::fetch_x86_xsave_layout () -+{ -+ return x86_xsave_layout (); -+} -+ -+x86_xsave_layout -+debug_target::fetch_x86_xsave_layout () -+{ -+ x86_xsave_layout result; -+ fprintf_unfiltered (gdb_stdlog, "-> %s->fetch_x86_xsave_layout (...)\n", this->beneath ()->shortname ()); -+ result = this->beneath ()->fetch_x86_xsave_layout (); -+ fprintf_unfiltered (gdb_stdlog, "<- %s->fetch_x86_xsave_layout (", this->beneath ()->shortname ()); -+ fputs_unfiltered (") = ", gdb_stdlog); -+ target_debug_print_x86_xsave_layout (result); -+ fputs_unfiltered ("\n", gdb_stdlog); -+ return result; -+} -diff --git a/gdb/target.c b/gdb/target.c ---- a/gdb/target.c -+++ b/gdb/target.c -@@ -227,6 +227,12 @@ target_has_execution_current (void) - return target_has_execution_1 (current_inferior ()); - } - -+x86_xsave_layout -+target_fetch_x86_xsave_layout () -+{ -+ return current_inferior ()->top_target ()->fetch_x86_xsave_layout (); -+} -+ - /* This is used to implement the various target commands. */ - - static void -diff --git a/gdb/target.h b/gdb/target.h ---- a/gdb/target.h -+++ b/gdb/target.h -@@ -81,6 +81,7 @@ struct inferior; - #include "command.h" - #include "disasm.h" - #include "tracepoint.h" -+#include "gdbsupport/x86-xstate.h" - - #include "gdbsupport/break-common.h" /* For enum target_hw_bp_type. */ - -@@ -1260,6 +1261,10 @@ struct target_ops - /* Cleanup after generating a core file. */ - virtual void done_generating_core () - TARGET_DEFAULT_IGNORE (); -+ -+ /* Return the x86 XSAVE extended state area layout. */ -+ virtual x86_xsave_layout fetch_x86_xsave_layout () -+ TARGET_DEFAULT_RETURN (x86_xsave_layout ()); - }; - - /* Deleter for std::unique_ptr. See comments in -@@ -2326,6 +2331,8 @@ extern gdb::unique_xmalloc_ptr target_fileio_read_stralloc - #define target_augmented_libraries_svr4_read() \ - (current_top_target ()->augmented_libraries_svr4_read) () - -+extern x86_xsave_layout target_fetch_x86_xsave_layout (); -+ - /* Command logging facility. */ - - #define target_log_command(p) \ diff --git a/gdb-rhel-10464-xsave-update-3of21.patch b/gdb-rhel-10464-xsave-update-3of21.patch deleted file mode 100644 index 95490b2..0000000 --- a/gdb-rhel-10464-xsave-update-3of21.patch +++ /dev/null @@ -1,269 +0,0 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: John Baldwin -Date: Thu, 11 Apr 2024 14:05:42 -0700 -Subject: gdb-rhel-10464-xsave-update-3of21.patch - -;; Backport "core: Support fetching x86 XSAVE layout from architectures." -;; (John Baldwin, RHEL-10464) - -Add gdbarch_core_read_x86_xsave_layout to fetch the x86 XSAVE layout -structure from a core file. - -Current OS's do not export the offsets of XSAVE state components in -core dumps, so provide an i387_guess_xsave_layout helper function to -set offsets based on known combinations of XCR0 masks and total state -sizes. Eventually when core dumps do contain this information this -function should only be used as a fall back for older core dumps. - -Approved-By: Simon Marchi -Please enter the commit message for your changes. Lines starting - -diff --git a/gdb/corelow.c b/gdb/corelow.c ---- a/gdb/corelow.c -+++ b/gdb/corelow.c -@@ -50,6 +50,7 @@ - #include "gdbsupport/filestuff.h" - #include "build-id.h" - #include "gdbsupport/pathstuff.h" -+#include "gdbsupport/x86-xstate.h" - #include - #include - #include "gdbcmd.h" -@@ -103,6 +104,8 @@ class core_target final : public process_stratum_target - - bool info_proc (const char *, enum info_proc_what) override; - -+ x86_xsave_layout fetch_x86_xsave_layout () override; -+ - /* A few helpers. */ - - /* Getter, see variable definition. */ -@@ -1113,6 +1116,25 @@ core_target::info_proc (const char *args, enum info_proc_what request) - return true; - } - -+/* Implementation of the "fetch_x86_xsave_layout" target_ops method. */ -+ -+x86_xsave_layout -+core_target::fetch_x86_xsave_layout () -+{ -+ if (m_core_gdbarch != nullptr && -+ gdbarch_core_read_x86_xsave_layout_p (m_core_gdbarch)) -+ { -+ x86_xsave_layout layout; -+ memset (&layout, 0, sizeof (x86_xsave_layout)); -+ if (!gdbarch_core_read_x86_xsave_layout (m_core_gdbarch, layout)) -+ return {}; -+ -+ return layout; -+ } -+ -+ return {}; -+} -+ - /* Get a pointer to the current core target. If not connected to a - core target, return NULL. */ - -diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c ---- a/gdb/gdbarch.c -+++ b/gdb/gdbarch.c -@@ -282,6 +282,7 @@ struct gdbarch - gdbarch_core_pid_to_str_ftype *core_pid_to_str; - gdbarch_core_thread_name_ftype *core_thread_name; - gdbarch_core_xfer_siginfo_ftype *core_xfer_siginfo; -+ gdbarch_core_read_x86_xsave_layout_ftype *core_read_x86_xsave_layout; - const char * gcore_bfd_target; - int vtable_function_descriptors; - int vbit_in_delta; -@@ -652,6 +653,7 @@ verify_gdbarch (struct gdbarch *gdbarch) - /* Skip verify of core_pid_to_str, has predicate. */ - /* Skip verify of core_thread_name, has predicate. */ - /* Skip verify of core_xfer_siginfo, has predicate. */ -+ /* Skip verify of core_read_x86_xsave_layout, has predicate. */ - /* Skip verify of gcore_bfd_target, has predicate. */ - /* Skip verify of vtable_function_descriptors, invalid_p == 0 */ - /* Skip verify of vbit_in_delta, invalid_p == 0 */ -@@ -879,6 +881,12 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) - fprintf_unfiltered (file, - "gdbarch_dump: core_read_description = <%s>\n", - host_address_to_string (gdbarch->core_read_description)); -+ fprintf_unfiltered (file, -+ "gdbarch_dump: gdbarch_core_read_x86_xsave_layout_p() = %d\n", -+ gdbarch_core_read_x86_xsave_layout_p (gdbarch)); -+ fprintf_unfiltered (file, -+ "gdbarch_dump: core_read_x86_xsave_layout = <%s>\n", -+ host_address_to_string (gdbarch->core_read_x86_xsave_layout)); - fprintf_unfiltered (file, - "gdbarch_dump: gdbarch_core_thread_name_p() = %d\n", - gdbarch_core_thread_name_p (gdbarch)); -@@ -3861,6 +3869,30 @@ set_gdbarch_core_xfer_siginfo (struct gdbarch *gdbarch, - gdbarch->core_xfer_siginfo = core_xfer_siginfo; - } - -+int -+gdbarch_core_read_x86_xsave_layout_p (struct gdbarch *gdbarch) -+{ -+ gdb_assert (gdbarch != NULL); -+ return gdbarch->core_read_x86_xsave_layout != NULL; -+} -+ -+bool -+gdbarch_core_read_x86_xsave_layout (struct gdbarch *gdbarch, x86_xsave_layout &xsave_layout) -+{ -+ gdb_assert (gdbarch != NULL); -+ gdb_assert (gdbarch->core_read_x86_xsave_layout != NULL); -+ if (gdbarch_debug >= 2) -+ fprintf_unfiltered (gdb_stdlog, "gdbarch_core_read_x86_xsave_layout called\n"); -+ return gdbarch->core_read_x86_xsave_layout (gdbarch, xsave_layout); -+} -+ -+void -+set_gdbarch_core_read_x86_xsave_layout (struct gdbarch *gdbarch, -+ gdbarch_core_read_x86_xsave_layout_ftype core_read_x86_xsave_layout) -+{ -+ gdbarch->core_read_x86_xsave_layout = core_read_x86_xsave_layout; -+} -+ - int - gdbarch_gcore_bfd_target_p (struct gdbarch *gdbarch) - { -diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h ---- a/gdb/gdbarch.h -+++ b/gdb/gdbarch.h -@@ -57,6 +57,7 @@ struct mem_range; - struct syscalls_info; - struct thread_info; - struct ui_out; -+struct x86_xsave_layout; - - #include "regcache.h" - -@@ -971,6 +972,15 @@ typedef LONGEST (gdbarch_core_xfer_siginfo_ftype) (struct gdbarch *gdbarch, gdb_ - extern LONGEST gdbarch_core_xfer_siginfo (struct gdbarch *gdbarch, gdb_byte *readbuf, ULONGEST offset, ULONGEST len); - extern void set_gdbarch_core_xfer_siginfo (struct gdbarch *gdbarch, gdbarch_core_xfer_siginfo_ftype *core_xfer_siginfo); - -+/* Read x86 XSAVE layout information from core file into XSAVE_LAYOUT. -+ Returns true if the layout was read successfully. */ -+ -+extern int gdbarch_core_read_x86_xsave_layout_p (struct gdbarch *gdbarch); -+ -+typedef bool (gdbarch_core_read_x86_xsave_layout_ftype) (struct gdbarch *gdbarch, x86_xsave_layout &xsave_layout); -+extern bool gdbarch_core_read_x86_xsave_layout (struct gdbarch *gdbarch, x86_xsave_layout &xsave_layout); -+extern void set_gdbarch_core_read_x86_xsave_layout (struct gdbarch *gdbarch, gdbarch_core_read_x86_xsave_layout_ftype *core_read_x86_xsave_layout); -+ - /* BFD target to use when generating a core file. */ - - extern int gdbarch_gcore_bfd_target_p (struct gdbarch *gdbarch); -diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh ---- a/gdb/gdbarch.sh -+++ b/gdb/gdbarch.sh -@@ -742,6 +742,10 @@ M;const char *;core_thread_name;struct thread_info *thr;thr - # of bytes read (zero indicates EOF, a negative value indicates failure). - M;LONGEST;core_xfer_siginfo;gdb_byte *readbuf, ULONGEST offset, ULONGEST len; readbuf, offset, len - -+# Read x86 XSAVE layout information from core file into XSAVE_LAYOUT. -+# Returns true if the layout was read successfully. -+M;bool;core_read_x86_xsave_layout;x86_xsave_layout &xsave_layout;xsave_layout -+ - # BFD target to use when generating a core file. - V;const char *;gcore_bfd_target;;;0;0;;;pstring (gdbarch->gcore_bfd_target) - -@@ -1297,6 +1301,7 @@ struct mem_range; - struct syscalls_info; - struct thread_info; - struct ui_out; -+struct x86_xsave_layout; - - #include "regcache.h" - -diff --git a/gdb/i387-tdep.c b/gdb/i387-tdep.c ---- a/gdb/i387-tdep.c -+++ b/gdb/i387-tdep.c -@@ -893,6 +893,61 @@ static int xsave_pkeys_offset[] = - (xsave + xsave_pkeys_offset[regnum - I387_PKRU_REGNUM (tdep)]) - - -+/* See i387-tdep.h. */ -+ -+bool -+i387_guess_xsave_layout (uint64_t xcr0, size_t xsave_size, -+ x86_xsave_layout &layout) -+{ -+ if (HAS_PKRU (xcr0) && xsave_size == 2696) -+ { -+ /* Intel CPUs supporting PKRU. */ -+ layout.avx_offset = 576; -+ layout.bndregs_offset = 960; -+ layout.bndcfg_offset = 1024; -+ layout.k_offset = 1088; -+ layout.zmm_h_offset = 1152; -+ layout.zmm_offset = 1664; -+ layout.pkru_offset = 2688; -+ } -+ else if (HAS_PKRU (xcr0) && xsave_size == 2440) -+ { -+ /* AMD CPUs supporting PKRU. */ -+ layout.avx_offset = 576; -+ layout.k_offset = 832; -+ layout.zmm_h_offset = 896; -+ layout.zmm_offset = 1408; -+ layout.pkru_offset = 2432; -+ } -+ else if (HAS_AVX512 (xcr0) && xsave_size == 2688) -+ { -+ /* Intel CPUs supporting AVX512. */ -+ layout.avx_offset = 576; -+ layout.bndregs_offset = 960; -+ layout.bndcfg_offset = 1024; -+ layout.k_offset = 1088; -+ layout.zmm_h_offset = 1152; -+ layout.zmm_offset = 1664; -+ } -+ else if (HAS_MPX (xcr0) && xsave_size == 1088) -+ { -+ /* Intel CPUs supporting MPX. */ -+ layout.avx_offset = 576; -+ layout.bndregs_offset = 960; -+ layout.bndcfg_offset = 1024; -+ } -+ else if (HAS_AVX (xcr0) && xsave_size == 832) -+ { -+ /* Intel and AMD CPUs supporting AVX. */ -+ layout.avx_offset = 576; -+ } -+ else -+ return false; -+ -+ layout.sizeof_xsave = xsave_size; -+ return true; -+} -+ - /* Extract from XSAVE a bitset of the features that are available on the - target, but which have not yet been enabled. */ - -diff --git a/gdb/i387-tdep.h b/gdb/i387-tdep.h ---- a/gdb/i387-tdep.h -+++ b/gdb/i387-tdep.h -@@ -25,6 +25,7 @@ struct frame_info; - struct regcache; - struct type; - struct ui_file; -+struct x86_xsave_layout; - - /* Number of i387 floating point registers. */ - #define I387_NUM_REGS 16 -@@ -138,6 +139,14 @@ extern void i387_collect_fsave (const struct regcache *regcache, int regnum, - extern void i387_supply_fxsave (struct regcache *regcache, int regnum, - const void *fxsave); - -+/* Select an XSAVE layout based on the XCR0 bitmask and total XSAVE -+ extended state size. Returns true if the bitmask and size matched -+ a known layout. */ -+ -+extern bool i387_guess_xsave_layout (uint64_t xcr0, size_t xsave_size, -+ x86_xsave_layout &layout); -+ -+ - /* Similar to i387_supply_fxsave, but use XSAVE extended state. */ - - extern void i387_supply_xsave (struct regcache *regcache, int regnum, diff --git a/gdb-rhel-10464-xsave-update-4of21.patch b/gdb-rhel-10464-xsave-update-4of21.patch deleted file mode 100644 index 800089c..0000000 --- a/gdb-rhel-10464-xsave-update-4of21.patch +++ /dev/null @@ -1,79 +0,0 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: John Baldwin -Date: Thu, 11 Apr 2024 14:05:43 -0700 -Subject: gdb-rhel-10464-xsave-update-4of21.patch - -;; Backport "nat/x86--cpuid.h: Add x86_cpuid_count wrapper around -;; __get_cpuid_count." -;; (John Baldwin, RHEL-10464) - -Approved-By: Simon Marchi - -diff --git a/gdb/nat/x86-cpuid.h b/gdb/nat/x86-cpuid.h ---- a/gdb/nat/x86-cpuid.h -+++ b/gdb/nat/x86-cpuid.h -@@ -22,6 +22,12 @@ - /* Always include the header for the cpu bit defines. */ - #include "x86-gcc-cpuid.h" - -+#ifndef __cplusplus -+/* This header file is also used in C code for some test-cases, so define -+ nullptr in C terms to avoid a compilation error. */ -+#define nullptr ((void *) 0) -+#endif -+ - #if defined(__i386__) || defined(__x86_64__) - - /* Return cpuid data for requested cpuid level, as found in returned -@@ -48,6 +54,30 @@ x86_cpuid (unsigned int __level, - return __get_cpuid (__level, __eax, __ebx, __ecx, __edx); - } - -+/* Return cpuid data for requested cpuid level and sub-level, as found -+ in returned eax, ebx, ecx and edx registers. The function checks -+ if cpuid is supported and returns 1 for valid cpuid information or -+ 0 for unsupported cpuid level. Pointers may be non-null. */ -+ -+static __inline int -+x86_cpuid_count (unsigned int __level, unsigned int __sublevel, -+ unsigned int *__eax, unsigned int *__ebx, -+ unsigned int *__ecx, unsigned int *__edx) -+{ -+ unsigned int __scratch; -+ -+ if (__eax == nullptr) -+ __eax = &__scratch; -+ if (__ebx == nullptr) -+ __ebx = &__scratch; -+ if (__ecx == nullptr) -+ __ecx = &__scratch; -+ if (__edx == nullptr) -+ __edx = &__scratch; -+ -+ return __get_cpuid_count (__level, __sublevel, __eax, __ebx, __ecx, __edx); -+} -+ - #else - - static __inline int -@@ -58,6 +88,20 @@ x86_cpuid (unsigned int __level, - return 0; - } - -+static __inline int -+x86_cpuid_count (unsigned int __level, unsigned int __sublevel, -+ unsigned int *__eax, unsigned int *__ebx, -+ unsigned int *__ecx, unsigned int *__edx) -+{ -+ return 0; -+} -+ - #endif /* i386 && x86_64 */ - -+#ifndef __cplusplus -+/* Avoid leaking this local definition beyond the scope of this header -+ file. */ -+#undef nullptr -+#endif -+ - #endif /* NAT_X86_CPUID_H */ diff --git a/gdb-rhel-10464-xsave-update-5of21.patch b/gdb-rhel-10464-xsave-update-5of21.patch deleted file mode 100644 index a2b20d7..0000000 --- a/gdb-rhel-10464-xsave-update-5of21.patch +++ /dev/null @@ -1,133 +0,0 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: John Baldwin -Date: Thu, 11 Apr 2024 14:05:43 -0700 -Subject: gdb-rhel-10464-xsave-update-5of21.patch - -;; Backport "x86 nat: Add helper functions to save the XSAVE layout for -;; the host." -;; (John Baldwin, RHEL-10464) - -x86_xsave_length returns the total length of the XSAVE state area -standard format as queried from CPUID. - -x86_fetch_xsave_layout uses CPUID to query the offsets of XSAVE -extended regions from the running host. The total length of the XSAVE -state area can either be supplied by the caller if known (e.g. from -FreeBSD's PT_GETXSTATEINFO) or it can be queried from the running host -using x86_xsave_length. - -Approved-By: Simon Marchi - -diff --git a/gdb/nat/x86-xstate.c b/gdb/nat/x86-xstate.c -new file mode 100644 ---- /dev/null -+++ b/gdb/nat/x86-xstate.c -@@ -0,0 +1,68 @@ -+/* x86 XSAVE extended state functions. -+ -+ Copyright (C) 2022-2023 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 "gdbsupport/common-defs.h" -+#include "gdbsupport/x86-xstate.h" -+#include "nat/x86-cpuid.h" -+#include "nat/x86-xstate.h" -+ -+/* Fetch the offset of a specific XSAVE extended region. */ -+ -+static int -+xsave_feature_offset (uint64_t xcr0, int feature) -+{ -+ uint32_t ebx; -+ -+ if ((xcr0 & (1ULL << feature)) == 0) -+ return 0; -+ -+ if (!x86_cpuid_count (0xd, feature, nullptr, &ebx, nullptr, nullptr)) -+ return 0; -+ return ebx; -+} -+ -+/* See x86-xstate.h. */ -+ -+int -+x86_xsave_length () -+{ -+ uint32_t ecx; -+ -+ if (!x86_cpuid_count (0xd, 0, nullptr, nullptr, &ecx, nullptr)) -+ return 0; -+ return ecx; -+} -+ -+/* See x86-xstate.h. */ -+ -+x86_xsave_layout -+x86_fetch_xsave_layout (uint64_t xcr0, int len) -+{ -+ x86_xsave_layout layout; -+ memset (&layout, 0, sizeof (x86_xsave_layout)); -+ layout.sizeof_xsave = len; -+ layout.avx_offset = xsave_feature_offset (xcr0, X86_XSTATE_AVX_ID); -+ layout.bndregs_offset = xsave_feature_offset (xcr0, X86_XSTATE_BNDREGS_ID); -+ layout.bndcfg_offset = xsave_feature_offset (xcr0, X86_XSTATE_BNDCFG_ID); -+ layout.k_offset = xsave_feature_offset (xcr0, X86_XSTATE_K_ID); -+ layout.zmm_h_offset = xsave_feature_offset (xcr0, X86_XSTATE_ZMM_H_ID); -+ layout.zmm_offset = xsave_feature_offset (xcr0, X86_XSTATE_ZMM_ID); -+ layout.pkru_offset = xsave_feature_offset (xcr0, X86_XSTATE_PKRU_ID); -+ return layout; -+} -diff --git a/gdb/nat/x86-xstate.h b/gdb/nat/x86-xstate.h -new file mode 100644 ---- /dev/null -+++ b/gdb/nat/x86-xstate.h -@@ -0,0 +1,35 @@ -+/* x86 XSAVE extended state functions. -+ -+ Copyright (C) 2022-2023 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 . */ -+ -+#ifndef NAT_X86_XSTATE_H -+#define NAT_X86_XSTATE_H -+ -+#include "gdbsupport/x86-xstate.h" -+ -+/* Return the size of the XSAVE extended state fetched via CPUID. */ -+ -+int x86_xsave_length (); -+ -+/* Return the layout (size and offsets) of the XSAVE extended regions -+ for the running host. Offsets of each of the enabled regions in -+ XCR0 are fetched via CPUID. */ -+ -+x86_xsave_layout x86_fetch_xsave_layout (uint64_t xcr0, int len); -+ -+#endif /* NAT_X86_XSTATE_H */ diff --git a/gdb-rhel-10464-xsave-update-6of21.patch b/gdb-rhel-10464-xsave-update-6of21.patch deleted file mode 100644 index 5ec3cb6..0000000 --- a/gdb-rhel-10464-xsave-update-6of21.patch +++ /dev/null @@ -1,217 +0,0 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: John Baldwin -Date: Thu, 11 Apr 2024 14:05:43 -0700 -Subject: gdb-rhel-10464-xsave-update-6of21.patch - -;; Backport "gdb: Update x86 Linux architectures to support XSAVE layouts." -;; (John Baldwin, RHEL-10464) - -Refactor i386_linux_core_read_xcr0 to fetch and return a corresponding -x86_xsave_layout as well as xcr0 using the size of an existing -NT_X86_XSTATE core dump to determine the offsets via -i387_guess_xsave_layout. Use this to add an implementation of -gdbarch_core_xfer_x86_xsave_layout. - -Use tdep->xsave_layout.sizeof_xsave as the size of the XSTATE register -set. - -Approved-By: Simon Marchi - -diff --git a/gdb/amd64-linux-tdep.c b/gdb/amd64-linux-tdep.c ---- a/gdb/amd64-linux-tdep.c -+++ b/gdb/amd64-linux-tdep.c -@@ -1608,7 +1608,11 @@ amd64_linux_core_read_description (struct gdbarch *gdbarch, - bfd *abfd) - { - /* Linux/x86-64. */ -- uint64_t xcr0 = i386_linux_core_read_xcr0 (abfd); -+ x86_xsave_layout layout; -+ memset (&layout, 0, sizeof (x86_xsave_layout)); -+ uint64_t xcr0 = i386_linux_core_read_xsave_info (abfd, layout); -+ if (xcr0 == 0) -+ xcr0 = X86_XSTATE_SSE_MASK; - - return amd64_linux_read_description (xcr0 & X86_XSTATE_ALL_MASK, - gdbarch_ptr_bit (gdbarch) == 32); -@@ -1653,8 +1657,10 @@ amd64_linux_iterate_over_regset_sections (struct gdbarch *gdbarch, - - cb (".reg", 27 * 8, 27 * 8, &i386_gregset, NULL, cb_data); - cb (".reg2", 512, 512, &amd64_fpregset, NULL, cb_data); -- cb (".reg-xstate", X86_XSTATE_SIZE (tdep->xcr0), X86_XSTATE_SIZE (tdep->xcr0), -- &amd64_linux_xstateregset, "XSAVE extended state", cb_data); -+ if (tdep->xsave_layout.sizeof_xsave != 0) -+ cb (".reg-xstate", tdep->xsave_layout.sizeof_xsave, -+ tdep->xsave_layout.sizeof_xsave, &amd64_linux_xstateregset, -+ "XSAVE extended state", cb_data); - } - - /* The instruction sequences used in x86_64 machines for a -@@ -1807,6 +1813,8 @@ amd64_linux_init_abi_common(struct gdbarch_info info, struct gdbarch *gdbarch) - tdep->sc_num_regs = ARRAY_SIZE (amd64_linux_sc_reg_offset); - - tdep->xsave_xcr0_offset = I386_LINUX_XSAVE_XCR0_OFFSET; -+ set_gdbarch_core_read_x86_xsave_layout -+ (gdbarch, i386_linux_core_read_x86_xsave_layout); - - /* Add the %orig_rax register used for syscall restarting. */ - set_gdbarch_write_pc (gdbarch, amd64_linux_write_pc); -diff --git a/gdb/i386-linux-tdep.c b/gdb/i386-linux-tdep.c ---- a/gdb/i386-linux-tdep.c -+++ b/gdb/i386-linux-tdep.c -@@ -637,45 +637,48 @@ static int i386_linux_sc_reg_offset[] = - 0 * 4 /* %gs */ - }; - --/* Get XSAVE extended state xcr0 from core dump. */ -+/* See i386-linux-tdep.h. */ - - uint64_t --i386_linux_core_read_xcr0 (bfd *abfd) -+i386_linux_core_read_xsave_info (bfd *abfd, x86_xsave_layout &layout) - { - asection *xstate = bfd_get_section_by_name (abfd, ".reg-xstate"); -- uint64_t xcr0; -+ if (xstate == nullptr) -+ return 0; - -- if (xstate) -- { -- size_t size = bfd_section_size (xstate); -+ /* Check extended state size. */ -+ size_t size = bfd_section_size (xstate); -+ if (size < X86_XSTATE_AVX_SIZE) -+ return 0; - -- /* Check extended state size. */ -- if (size < X86_XSTATE_AVX_SIZE) -- xcr0 = X86_XSTATE_SSE_MASK; -- else -- { -- char contents[8]; -- -- if (! bfd_get_section_contents (abfd, xstate, contents, -- I386_LINUX_XSAVE_XCR0_OFFSET, -- 8)) -- { -- warning (_("Couldn't read `xcr0' bytes from " -- "`.reg-xstate' section in core file.")); -- return 0; -- } -- -- xcr0 = bfd_get_64 (abfd, contents); -- } -+ char contents[8]; -+ if (! bfd_get_section_contents (abfd, xstate, contents, -+ I386_LINUX_XSAVE_XCR0_OFFSET, 8)) -+ { -+ warning (_("Couldn't read `xcr0' bytes from " -+ "`.reg-xstate' section in core file.")); -+ return 0; - } -- else -- xcr0 = 0; -+ -+ uint64_t xcr0 = bfd_get_64 (abfd, contents); -+ -+ if (!i387_guess_xsave_layout (xcr0, size, layout)) -+ return 0; - - return xcr0; - } - - /* See i386-linux-tdep.h. */ - -+bool -+i386_linux_core_read_x86_xsave_layout (struct gdbarch *gdbarch, -+ x86_xsave_layout &layout) -+{ -+ return i386_linux_core_read_xsave_info (core_bfd, layout) != 0; -+} -+ -+/* See i386-linux-tdep.h. */ -+ - const struct target_desc * - i386_linux_read_description (uint64_t xcr0) - { -@@ -707,7 +710,9 @@ i386_linux_core_read_description (struct gdbarch *gdbarch, - bfd *abfd) - { - /* Linux/i386. */ -- uint64_t xcr0 = i386_linux_core_read_xcr0 (abfd); -+ x86_xsave_layout layout; -+ memset (&layout, 0, sizeof (x86_xsave_layout)); -+ uint64_t xcr0 = i386_linux_core_read_xsave_info (abfd, layout); - const struct target_desc *tdesc = i386_linux_read_description (xcr0); - - if (tdesc != NULL) -@@ -766,9 +771,9 @@ i386_linux_iterate_over_regset_sections (struct gdbarch *gdbarch, - - cb (".reg", 68, 68, &i386_gregset, NULL, cb_data); - -- if (tdep->xcr0 & X86_XSTATE_AVX) -- cb (".reg-xstate", X86_XSTATE_SIZE (tdep->xcr0), -- X86_XSTATE_SIZE (tdep->xcr0), &i386_linux_xstateregset, -+ if (tdep->xsave_layout.sizeof_xsave != 0) -+ cb (".reg-xstate", tdep->xsave_layout.sizeof_xsave, -+ tdep->xsave_layout.sizeof_xsave, &i386_linux_xstateregset, - "XSAVE extended state", cb_data); - else if (tdep->xcr0 & X86_XSTATE_SSE) - cb (".reg-xfp", 512, 512, &i386_fpregset, "extended floating-point", -@@ -870,6 +875,8 @@ i386_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) - tdep->sc_num_regs = ARRAY_SIZE (i386_linux_sc_reg_offset); - - tdep->xsave_xcr0_offset = I386_LINUX_XSAVE_XCR0_OFFSET; -+ set_gdbarch_core_read_x86_xsave_layout -+ (gdbarch, i386_linux_core_read_x86_xsave_layout); - - set_gdbarch_process_record (gdbarch, i386_process_record); - set_gdbarch_process_record_signal (gdbarch, i386_linux_record_signal); -diff --git a/gdb/i386-linux-tdep.h b/gdb/i386-linux-tdep.h ---- a/gdb/i386-linux-tdep.h -+++ b/gdb/i386-linux-tdep.h -@@ -20,6 +20,8 @@ - #ifndef I386_LINUX_TDEP_H - #define I386_LINUX_TDEP_H - -+#include "gdbsupport/x86-xstate.h" -+ - /* The Linux kernel pretends there is an additional "orig_eax" - register. Since GDB needs access to that register to be able to - properly restart system calls when necessary (see -@@ -34,8 +36,18 @@ - /* Total number of registers for GNU/Linux. */ - #define I386_LINUX_NUM_REGS (I386_LINUX_ORIG_EAX_REGNUM + 1) - --/* Get XSAVE extended state xcr0 from core dump. */ --extern uint64_t i386_linux_core_read_xcr0 (bfd *abfd); -+/* Read the XSAVE extended state xcr0 value from the ABFD core file. -+ If it appears to be valid, return it and fill LAYOUT with values -+ inferred from that value. -+ -+ Otherwise, return 0 to indicate no state was found and leave LAYOUT -+ untouched. */ -+extern uint64_t i386_linux_core_read_xsave_info (bfd *abfd, -+ x86_xsave_layout &layout); -+ -+/* Implement the core_read_x86_xsave_layout gdbarch method. */ -+extern bool i386_linux_core_read_x86_xsave_layout (struct gdbarch *gdbarch, -+ x86_xsave_layout &layout); - - /* Handle and display information related to the MPX bound violation - to the user. */ -@@ -52,14 +64,7 @@ extern const struct target_desc *i386_linux_read_description (uint64_t xcr0); - fxsave_bytes[0..463] - sw_usable_bytes[464..511] - xstate_hdr_bytes[512..575] -- avx_bytes[576..831] -- mpx_bytes [960..1032] -- avx512_k_regs[1088..1152] -- avx512_zmmh_regs0-7[1153..1407] -- avx512_zmmh_regs8-15[1408..1663] -- avx512_zmm_regs16-31[1664..2687] -- pkru[2688..2752] -- future_state etc -+ extended state regions (AVX, MPX, AVX512, PKRU, etc.) - }; - - Same memory layout will be used for the coredump NT_X86_XSTATE diff --git a/gdb-rhel-10464-xsave-update-7of21.patch b/gdb-rhel-10464-xsave-update-7of21.patch deleted file mode 100644 index 1b38824..0000000 --- a/gdb-rhel-10464-xsave-update-7of21.patch +++ /dev/null @@ -1,148 +0,0 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: John Baldwin -Date: Thu, 11 Apr 2024 14:05:43 -0700 -Subject: gdb-rhel-10464-xsave-update-7of21.patch - -;; Backport "gdb: Support XSAVE layouts for the current host in the Linux -;; x86 targets." -;; (John Baldwin, RHEL-10464) - -Note that this uses the CPUID instruction to determine the total size -of the XSAVE register set. If there is a way to fetch the register set -size using ptrace that would probably be better. - -Approved-By: Simon Marchi - -diff --git a/gdb/amd64-linux-nat.c b/gdb/amd64-linux-nat.c ---- a/gdb/amd64-linux-nat.c -+++ b/gdb/amd64-linux-nat.c -@@ -210,6 +210,7 @@ void - amd64_linux_nat_target::fetch_registers (struct regcache *regcache, int regnum) - { - struct gdbarch *gdbarch = regcache->arch (); -+ const struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); - int tid; - - /* GNU/Linux LWP ID's are process ID's. */ -@@ -235,7 +236,7 @@ amd64_linux_nat_target::fetch_registers (struct regcache *regcache, int regnum) - - if (have_ptrace_getregset == TRIBOOL_TRUE) - { -- char xstateregs[X86_XSTATE_MAX_SIZE]; -+ char xstateregs[tdep->xsave_layout.sizeof_xsave]; - struct iovec iov; - - /* Pre-4.14 kernels have a bug (fixed by commit 0852b374173b -@@ -270,6 +271,7 @@ void - amd64_linux_nat_target::store_registers (struct regcache *regcache, int regnum) - { - struct gdbarch *gdbarch = regcache->arch (); -+ const struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); - int tid; - - /* GNU/Linux LWP ID's are process ID's. */ -@@ -299,7 +301,7 @@ amd64_linux_nat_target::store_registers (struct regcache *regcache, int regnum) - - if (have_ptrace_getregset == TRIBOOL_TRUE) - { -- char xstateregs[X86_XSTATE_MAX_SIZE]; -+ char xstateregs[tdep->xsave_layout.sizeof_xsave]; - struct iovec iov; - - iov.iov_base = xstateregs; -diff --git a/gdb/configure.nat b/gdb/configure.nat ---- a/gdb/configure.nat -+++ b/gdb/configure.nat -@@ -246,6 +246,7 @@ case ${gdb_host} in - i386) - # Host: Intel 386 running GNU/Linux. - NATDEPFILES="${NATDEPFILES} x86-nat.o nat/x86-dregs.o \ -+ nat/x86-xstate.o \ - i386-linux-nat.o x86-linux-nat.o nat/linux-btrace.o \ - nat/x86-linux.o nat/x86-linux-dregs.o" - ;; -@@ -303,7 +304,7 @@ case ${gdb_host} in - i386) - # Host: GNU/Linux x86-64 - NATDEPFILES="${NATDEPFILES} x86-nat.o nat/x86-dregs.o \ -- amd64-nat.o amd64-linux-nat.o x86-linux-nat.o \ -+ nat/x86-xstate.o amd64-nat.o amd64-linux-nat.o x86-linux-nat.o \ - nat/linux-btrace.o \ - nat/x86-linux.o nat/x86-linux-dregs.o \ - nat/amd64-linux-siginfo.o" -diff --git a/gdb/i386-linux-nat.c b/gdb/i386-linux-nat.c ---- a/gdb/i386-linux-nat.c -+++ b/gdb/i386-linux-nat.c -@@ -330,7 +330,9 @@ store_fpregs (const struct regcache *regcache, int tid, int regno) - static int - fetch_xstateregs (struct regcache *regcache, int tid) - { -- char xstateregs[X86_XSTATE_MAX_SIZE]; -+ struct gdbarch *gdbarch = regcache->arch (); -+ const struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); -+ char xstateregs[tdep->xsave_layout.sizeof_xsave]; - struct iovec iov; - - if (have_ptrace_getregset != TRIBOOL_TRUE) -@@ -353,7 +355,9 @@ fetch_xstateregs (struct regcache *regcache, int tid) - static int - store_xstateregs (const struct regcache *regcache, int tid, int regno) - { -- char xstateregs[X86_XSTATE_MAX_SIZE]; -+ struct gdbarch *gdbarch = regcache->arch (); -+ const struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); -+ char xstateregs[tdep->xsave_layout.sizeof_xsave]; - struct iovec iov; - - if (have_ptrace_getregset != TRIBOOL_TRUE) -diff --git a/gdb/x86-linux-nat.c b/gdb/x86-linux-nat.c ---- a/gdb/x86-linux-nat.c -+++ b/gdb/x86-linux-nat.c -@@ -36,6 +36,7 @@ - #include "amd64-linux-tdep.h" - #endif - #include "gdbsupport/x86-xstate.h" -+#include "nat/x86-xstate.h" - #include "nat/linux-btrace.h" - #include "nat/linux-nat.h" - #include "nat/x86-linux.h" -@@ -177,6 +178,8 @@ x86_linux_nat_target::read_description () - /* Get XCR0 from XSAVE extended state. */ - xcr0 = xstateregs[(I386_LINUX_XSAVE_XCR0_OFFSET - / sizeof (uint64_t))]; -+ -+ m_xsave_layout = x86_fetch_xsave_layout (xcr0, x86_xsave_length ()); - } - } - -diff --git a/gdb/x86-linux-nat.h b/gdb/x86-linux-nat.h ---- a/gdb/x86-linux-nat.h -+++ b/gdb/x86-linux-nat.h -@@ -22,6 +22,7 @@ - - #include "gdb_proc_service.h" /* For ps_err_e. */ - #include "linux-nat.h" -+#include "gdbsupport/x86-xstate.h" - #include "x86-nat.h" - #include "nat/x86-linux.h" - -@@ -44,6 +45,9 @@ struct x86_linux_nat_target : public x86_nat_target - enum btrace_read_type type) override; - const struct btrace_config *btrace_conf (const struct btrace_target_info *) override; - -+ x86_xsave_layout fetch_x86_xsave_layout () override -+ { return m_xsave_layout; } -+ - /* These two are rewired to low_ versions. linux-nat.c queries - stopped-by-watchpoint info as soon as an lwp stops (via the low_ - methods) and caches the result, to be returned via the normal -@@ -73,6 +77,9 @@ struct x86_linux_nat_target : public x86_nat_target - - void low_delete_thread (struct arch_lwp_info *lwp) override - { x86_linux_delete_thread (lwp); } -+ -+private: -+ x86_xsave_layout m_xsave_layout; - }; - - diff --git a/gdb-rhel-10464-xsave-update-8of21.patch b/gdb-rhel-10464-xsave-update-8of21.patch deleted file mode 100644 index 5fc859b..0000000 --- a/gdb-rhel-10464-xsave-update-8of21.patch +++ /dev/null @@ -1,720 +0,0 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: John Baldwin -Date: Thu, 11 Apr 2024 14:05:44 -0700 -Subject: gdb-rhel-10464-xsave-update-8of21.patch - -;; Backport "gdb: Use x86_xstate_layout to parse the XSAVE extended state area." -;; (John Baldwin, RHEL-10464) - -All of the tables describing the offsets of individual registers for -XSAVE state components now hold relative offsets rather than absolute -offsets. Some tables (those for MPX registers and ZMMH registers) had -to be split into separate tables as they held entries that spanned -multiple state components. - -Approved-By: Simon Marchi - -diff --git a/gdb/i387-tdep.c b/gdb/i387-tdep.c ---- a/gdb/i387-tdep.c -+++ b/gdb/i387-tdep.c -@@ -727,170 +727,204 @@ i387_collect_fxsave (const struct regcache *regcache, int regnum, void *fxsave) - /* `xstate_bv' is at byte offset 512. */ - #define XSAVE_XSTATE_BV_ADDR(xsave) (xsave + 512) - --/* At xsave_avxh_offset[REGNUM] you'll find the offset to the location in -- the upper 128bit of AVX register data structure used by the "xsave" -- instruction where GDB register REGNUM is stored. */ -+/* At xsave_avxh_offset[REGNUM] you'll find the relative offset within -+ the AVX region of the XSAVE extended state where the upper 128bits -+ of GDB register YMM0 + REGNUM is stored. */ - - static int xsave_avxh_offset[] = - { -- 576 + 0 * 16, /* Upper 128bit of %ymm0 through ... */ -- 576 + 1 * 16, -- 576 + 2 * 16, -- 576 + 3 * 16, -- 576 + 4 * 16, -- 576 + 5 * 16, -- 576 + 6 * 16, -- 576 + 7 * 16, -- 576 + 8 * 16, -- 576 + 9 * 16, -- 576 + 10 * 16, -- 576 + 11 * 16, -- 576 + 12 * 16, -- 576 + 13 * 16, -- 576 + 14 * 16, -- 576 + 15 * 16 /* Upper 128bit of ... %ymm15 (128 bits each). */ -+ 0 * 16, /* Upper 128bit of %ymm0 through ... */ -+ 1 * 16, -+ 2 * 16, -+ 3 * 16, -+ 4 * 16, -+ 5 * 16, -+ 6 * 16, -+ 7 * 16, -+ 8 * 16, -+ 9 * 16, -+ 10 * 16, -+ 11 * 16, -+ 12 * 16, -+ 13 * 16, -+ 14 * 16, -+ 15 * 16 /* Upper 128bit of ... %ymm15 (128 bits each). */ - }; - --#define XSAVE_AVXH_ADDR(tdep, xsave, regnum) \ -- (xsave + xsave_avxh_offset[regnum - I387_YMM0H_REGNUM (tdep)]) -+#define XSAVE_AVXH_ADDR(tdep, xsave, regnum) \ -+ (xsave + (tdep)->xsave_layout.avx_offset \ -+ + xsave_avxh_offset[regnum - I387_YMM0H_REGNUM (tdep)]) - --/* At xsave_ymm_avx512_offset[REGNUM] you'll find the offset to the location in -- the upper 128bit of ZMM register data structure used by the "xsave" -- instruction where GDB register REGNUM is stored. */ -+/* At xsave_ymm_avx512_offset[REGNUM] you'll find the relative offset -+ within the ZMM region of the XSAVE extended state where the second -+ 128bits of GDB register YMM16 + REGNUM is stored. */ - - static int xsave_ymm_avx512_offset[] = - { -- /* HI16_ZMM_area + 16 bytes + regnum* 64 bytes. */ -- 1664 + 16 + 0 * 64, /* %ymm16 through... */ -- 1664 + 16 + 1 * 64, -- 1664 + 16 + 2 * 64, -- 1664 + 16 + 3 * 64, -- 1664 + 16 + 4 * 64, -- 1664 + 16 + 5 * 64, -- 1664 + 16 + 6 * 64, -- 1664 + 16 + 7 * 64, -- 1664 + 16 + 8 * 64, -- 1664 + 16 + 9 * 64, -- 1664 + 16 + 10 * 64, -- 1664 + 16 + 11 * 64, -- 1664 + 16 + 12 * 64, -- 1664 + 16 + 13 * 64, -- 1664 + 16 + 14 * 64, -- 1664 + 16 + 15 * 64 /* ... %ymm31 (128 bits each). */ -+ 16 + 0 * 64, /* %ymm16 through... */ -+ 16 + 1 * 64, -+ 16 + 2 * 64, -+ 16 + 3 * 64, -+ 16 + 4 * 64, -+ 16 + 5 * 64, -+ 16 + 6 * 64, -+ 16 + 7 * 64, -+ 16 + 8 * 64, -+ 16 + 9 * 64, -+ 16 + 10 * 64, -+ 16 + 11 * 64, -+ 16 + 12 * 64, -+ 16 + 13 * 64, -+ 16 + 14 * 64, -+ 16 + 15 * 64 /* ... %ymm31 (128 bits each). */ - }; - --#define XSAVE_YMM_AVX512_ADDR(tdep, xsave, regnum) \ -- (xsave + xsave_ymm_avx512_offset[regnum - I387_YMM16H_REGNUM (tdep)]) -+#define XSAVE_YMM_AVX512_ADDR(tdep, xsave, regnum) \ -+ (xsave + (tdep)->xsave_layout.zmm_offset \ -+ + xsave_ymm_avx512_offset[regnum - I387_YMM16H_REGNUM (tdep)]) -+ -+/* At xsave_xmm_avx512_offset[REGNUM] you'll find the relative offset -+ within the ZMM region of the XSAVE extended state where the first -+ 128bits of GDB register XMM16 + REGNUM is stored. */ - - static int xsave_xmm_avx512_offset[] = - { -- 1664 + 0 * 64, /* %ymm16 through... */ -- 1664 + 1 * 64, -- 1664 + 2 * 64, -- 1664 + 3 * 64, -- 1664 + 4 * 64, -- 1664 + 5 * 64, -- 1664 + 6 * 64, -- 1664 + 7 * 64, -- 1664 + 8 * 64, -- 1664 + 9 * 64, -- 1664 + 10 * 64, -- 1664 + 11 * 64, -- 1664 + 12 * 64, -- 1664 + 13 * 64, -- 1664 + 14 * 64, -- 1664 + 15 * 64 /* ... %ymm31 (128 bits each). */ -+ 0 * 64, /* %xmm16 through... */ -+ 1 * 64, -+ 2 * 64, -+ 3 * 64, -+ 4 * 64, -+ 5 * 64, -+ 6 * 64, -+ 7 * 64, -+ 8 * 64, -+ 9 * 64, -+ 10 * 64, -+ 11 * 64, -+ 12 * 64, -+ 13 * 64, -+ 14 * 64, -+ 15 * 64 /* ... %xmm31 (128 bits each). */ - }; - --#define XSAVE_XMM_AVX512_ADDR(tdep, xsave, regnum) \ -- (xsave + xsave_xmm_avx512_offset[regnum - I387_XMM16_REGNUM (tdep)]) -+#define XSAVE_XMM_AVX512_ADDR(tdep, xsave, regnum) \ -+ (xsave + (tdep)->xsave_layout.zmm_offset \ -+ + xsave_xmm_avx512_offset[regnum - I387_XMM16_REGNUM (tdep)]) -+ -+/* At xsave_bndregs_offset[REGNUM] you'll find the relative offset -+ within the BNDREGS region of the XSAVE extended state where the GDB -+ register BND0R + REGNUM is stored. */ - --static int xsave_mpx_offset[] = { -- 960 + 0 * 16, /* bnd0r...bnd3r registers. */ -- 960 + 1 * 16, -- 960 + 2 * 16, -- 960 + 3 * 16, -- 1024 + 0 * 8, /* bndcfg ... bndstatus. */ -- 1024 + 1 * 8, -+static int xsave_bndregs_offset[] = { -+ 0 * 16, /* bnd0r...bnd3r registers. */ -+ 1 * 16, -+ 2 * 16, -+ 3 * 16 - }; - --#define XSAVE_MPX_ADDR(tdep, xsave, regnum) \ -- (xsave + xsave_mpx_offset[regnum - I387_BND0R_REGNUM (tdep)]) -+#define XSAVE_BNDREGS_ADDR(tdep, xsave, regnum) \ -+ (xsave + (tdep)->xsave_layout.bndregs_offset \ -+ + xsave_bndregs_offset[regnum - I387_BND0R_REGNUM (tdep)]) -+ -+static int xsave_bndcfg_offset[] = { -+ 0 * 8, /* bndcfg ... bndstatus. */ -+ 1 * 8, -+}; - -- /* At xsave_avx512__h_offset[REGNUM] you find the offset to the location -- of the AVX512 opmask register data structure used by the "xsave" -- instruction where GDB register REGNUM is stored. */ -+#define XSAVE_BNDCFG_ADDR(tdep, xsave, regnum) \ -+ (xsave + (tdep)->xsave_layout.bndcfg_offset \ -+ + xsave_bndcfg_offset[regnum - I387_BNDCFGU_REGNUM (tdep)]) -+ -+/* At xsave_avx512_k_offset[REGNUM] you'll find the relative offset -+ within the K region of the XSAVE extended state where the AVX512 -+ opmask register K0 + REGNUM is stored. */ - - static int xsave_avx512_k_offset[] = - { -- 1088 + 0 * 8, /* %k0 through... */ -- 1088 + 1 * 8, -- 1088 + 2 * 8, -- 1088 + 3 * 8, -- 1088 + 4 * 8, -- 1088 + 5 * 8, -- 1088 + 6 * 8, -- 1088 + 7 * 8 /* %k7 (64 bits each). */ -+ 0 * 8, /* %k0 through... */ -+ 1 * 8, -+ 2 * 8, -+ 3 * 8, -+ 4 * 8, -+ 5 * 8, -+ 6 * 8, -+ 7 * 8 /* %k7 (64 bits each). */ -+}; -+ -+#define XSAVE_AVX512_K_ADDR(tdep, xsave, regnum) \ -+ (xsave + (tdep)->xsave_layout.k_offset \ -+ + xsave_avx512_k_offset[regnum - I387_K0_REGNUM (tdep)]) -+ -+ -+/* At xsave_avx512_zmm0_h_offset[REGNUM] you find the relative offset -+ within the ZMM_H region of the XSAVE extended state where the upper -+ 256bits of the GDB register ZMM0 + REGNUM is stored. */ -+ -+static int xsave_avx512_zmm0_h_offset[] = -+{ -+ 0 * 32, /* Upper 256bit of %zmmh0 through... */ -+ 1 * 32, -+ 2 * 32, -+ 3 * 32, -+ 4 * 32, -+ 5 * 32, -+ 6 * 32, -+ 7 * 32, -+ 8 * 32, -+ 9 * 32, -+ 10 * 32, -+ 11 * 32, -+ 12 * 32, -+ 13 * 32, -+ 14 * 32, -+ 15 * 32 /* Upper 256bit of... %zmmh15 (256 bits each). */ - }; - --#define XSAVE_AVX512_K_ADDR(tdep, xsave, regnum) \ -- (xsave + xsave_avx512_k_offset[regnum - I387_K0_REGNUM (tdep)]) -+#define XSAVE_AVX512_ZMM0_H_ADDR(tdep, xsave, regnum) \ -+ (xsave + (tdep)->xsave_layout.zmm_h_offset \ -+ + xsave_avx512_zmm0_h_offset[regnum - I387_ZMM0H_REGNUM (tdep)]) - --/* At xsave_avx512_zmm_h_offset[REGNUM] you find the offset to the location in -- the upper 256bit of AVX512 ZMMH register data structure used by the "xsave" -- instruction where GDB register REGNUM is stored. */ -+/* At xsave_avx512_zmm16_h_offset[REGNUM] you find the relative offset -+ within the ZMM_H region of the XSAVE extended state where the upper -+ 256bits of the GDB register ZMM16 + REGNUM is stored. */ - --static int xsave_avx512_zmm_h_offset[] = -+static int xsave_avx512_zmm16_h_offset[] = - { -- 1152 + 0 * 32, -- 1152 + 1 * 32, /* Upper 256bit of %zmmh0 through... */ -- 1152 + 2 * 32, -- 1152 + 3 * 32, -- 1152 + 4 * 32, -- 1152 + 5 * 32, -- 1152 + 6 * 32, -- 1152 + 7 * 32, -- 1152 + 8 * 32, -- 1152 + 9 * 32, -- 1152 + 10 * 32, -- 1152 + 11 * 32, -- 1152 + 12 * 32, -- 1152 + 13 * 32, -- 1152 + 14 * 32, -- 1152 + 15 * 32, /* Upper 256bit of... %zmmh15 (256 bits each). */ -- 1664 + 32 + 0 * 64, /* Upper 256bit of... %zmmh16 (256 bits each). */ -- 1664 + 32 + 1 * 64, -- 1664 + 32 + 2 * 64, -- 1664 + 32 + 3 * 64, -- 1664 + 32 + 4 * 64, -- 1664 + 32 + 5 * 64, -- 1664 + 32 + 6 * 64, -- 1664 + 32 + 7 * 64, -- 1664 + 32 + 8 * 64, -- 1664 + 32 + 9 * 64, -- 1664 + 32 + 10 * 64, -- 1664 + 32 + 11 * 64, -- 1664 + 32 + 12 * 64, -- 1664 + 32 + 13 * 64, -- 1664 + 32 + 14 * 64, -- 1664 + 32 + 15 * 64 /* Upper 256bit of... %zmmh31 (256 bits each). */ -+ 32 + 0 * 64, /* Upper 256bit of... %zmmh16 (256 bits each). */ -+ 32 + 1 * 64, -+ 32 + 2 * 64, -+ 32 + 3 * 64, -+ 32 + 4 * 64, -+ 32 + 5 * 64, -+ 32 + 6 * 64, -+ 32 + 7 * 64, -+ 32 + 8 * 64, -+ 32 + 9 * 64, -+ 32 + 10 * 64, -+ 32 + 11 * 64, -+ 32 + 12 * 64, -+ 32 + 13 * 64, -+ 32 + 14 * 64, -+ 32 + 15 * 64 /* Upper 256bit of... %zmmh31 (256 bits each). */ - }; - --#define XSAVE_AVX512_ZMM_H_ADDR(tdep, xsave, regnum) \ -- (xsave + xsave_avx512_zmm_h_offset[regnum - I387_ZMM0H_REGNUM (tdep)]) -+#define XSAVE_AVX512_ZMM16_H_ADDR(tdep, xsave, regnum) \ -+ (xsave + (tdep)->xsave_layout.zmm_offset \ -+ + xsave_avx512_zmm16_h_offset[regnum - I387_ZMM16H_REGNUM (tdep)]) - --/* At xsave_pkeys_offset[REGNUM] you find the offset to the location -- of the PKRU register data structure used by the "xsave" -- instruction where GDB register REGNUM is stored. */ -+/* At xsave_pkeys_offset[REGNUM] you'll find the relative offset -+ within the PKEYS region of the XSAVE extended state where the PKRU -+ register is stored. */ - - static int xsave_pkeys_offset[] = - { --2688 + 0 * 8 /* %pkru (64 bits in XSTATE, 32-bit actually used by -+ 0 * 8 /* %pkru (64 bits in XSTATE, 32-bit actually used by - instructions and applications). */ - }; - --#define XSAVE_PKEYS_ADDR(tdep, xsave, regnum) \ -- (xsave + xsave_pkeys_offset[regnum - I387_PKRU_REGNUM (tdep)]) -+#define XSAVE_PKEYS_ADDR(tdep, xsave, regnum) \ -+ (xsave + (tdep)->xsave_layout.pkru_offset \ -+ + xsave_pkeys_offset[regnum - I387_PKRU_REGNUM (tdep)]) - - - /* See i387-tdep.h. */ -@@ -993,14 +1027,16 @@ i387_supply_xsave (struct regcache *regcache, int regnum, - x87 = 0x1, - sse = 0x2, - avxh = 0x4, -- mpx = 0x8, -- avx512_k = 0x10, -- avx512_zmm_h = 0x20, -- avx512_ymmh_avx512 = 0x40, -- avx512_xmm_avx512 = 0x80, -- pkeys = 0x100, -- all = x87 | sse | avxh | mpx | avx512_k | avx512_zmm_h -- | avx512_ymmh_avx512 | avx512_xmm_avx512 | pkeys -+ bndregs = 0x8, -+ bndcfg = 0x10, -+ avx512_k = 0x20, -+ avx512_zmm0_h = 0x40, -+ avx512_zmm16_h = 0x80, -+ avx512_ymmh_avx512 = 0x100, -+ avx512_xmm_avx512 = 0x200, -+ pkeys = 0x400, -+ all = x87 | sse | avxh | bndregs | bndcfg | avx512_k | avx512_zmm0_h -+ | avx512_zmm16_h | avx512_ymmh_avx512 | avx512_xmm_avx512 | pkeys - } regclass; - - gdb_assert (regs != NULL); -@@ -1013,8 +1049,11 @@ i387_supply_xsave (struct regcache *regcache, int regnum, - && regnum < I387_PKEYSEND_REGNUM (tdep)) - regclass = pkeys; - else if (regnum >= I387_ZMM0H_REGNUM (tdep) -+ && regnum < I387_ZMM16H_REGNUM (tdep)) -+ regclass = avx512_zmm0_h; -+ else if (regnum >= I387_ZMM16H_REGNUM (tdep) - && regnum < I387_ZMMENDH_REGNUM (tdep)) -- regclass = avx512_zmm_h; -+ regclass = avx512_zmm16_h; - else if (regnum >= I387_K0_REGNUM (tdep) - && regnum < I387_KEND_REGNUM (tdep)) - regclass = avx512_k; -@@ -1028,8 +1067,11 @@ i387_supply_xsave (struct regcache *regcache, int regnum, - && regnum < I387_YMMENDH_REGNUM (tdep)) - regclass = avxh; - else if (regnum >= I387_BND0R_REGNUM (tdep) -+ && regnum < I387_BNDCFGU_REGNUM (tdep)) -+ regclass = bndregs; -+ else if (regnum >= I387_BNDCFGU_REGNUM (tdep) - && regnum < I387_MPXEND_REGNUM (tdep)) -- regclass = mpx; -+ regclass = bndcfg; - else if (regnum >= I387_XMM0_REGNUM (tdep) - && regnum < I387_MXCSR_REGNUM (tdep)) - regclass = sse; -@@ -1062,13 +1104,20 @@ i387_supply_xsave (struct regcache *regcache, int regnum, - regcache->raw_supply (regnum, XSAVE_PKEYS_ADDR (tdep, regs, regnum)); - return; - -- case avx512_zmm_h: -- if ((clear_bv & (regnum < zmm_endlo_regnum ? X86_XSTATE_ZMM_H -- : X86_XSTATE_ZMM))) -+ case avx512_zmm0_h: -+ if ((clear_bv & X86_XSTATE_ZMM_H)) -+ regcache->raw_supply (regnum, zero); -+ else -+ regcache->raw_supply (regnum, -+ XSAVE_AVX512_ZMM0_H_ADDR (tdep, regs, regnum)); -+ return; -+ -+ case avx512_zmm16_h: -+ if ((clear_bv & X86_XSTATE_ZMM)) - regcache->raw_supply (regnum, zero); - else - regcache->raw_supply (regnum, -- XSAVE_AVX512_ZMM_H_ADDR (tdep, regs, regnum)); -+ XSAVE_AVX512_ZMM16_H_ADDR (tdep, regs, regnum)); - return; - - case avx512_k: -@@ -1101,11 +1150,18 @@ i387_supply_xsave (struct regcache *regcache, int regnum, - regcache->raw_supply (regnum, XSAVE_AVXH_ADDR (tdep, regs, regnum)); - return; - -- case mpx: -+ case bndcfg: -+ if ((clear_bv & X86_XSTATE_BNDCFG)) -+ regcache->raw_supply (regnum, zero); -+ else -+ regcache->raw_supply (regnum, XSAVE_BNDCFG_ADDR (tdep, regs, regnum)); -+ return; -+ -+ case bndregs: - if ((clear_bv & X86_XSTATE_BNDREGS)) - regcache->raw_supply (regnum, zero); - else -- regcache->raw_supply (regnum, XSAVE_MPX_ADDR (tdep, regs, regnum)); -+ regcache->raw_supply (regnum, XSAVE_BNDREGS_ADDR (tdep, regs, regnum)); - return; - - case sse: -@@ -1154,7 +1210,7 @@ i387_supply_xsave (struct regcache *regcache, int regnum, - { - for (i = I387_ZMM0H_REGNUM (tdep); i < zmm_endlo_regnum; i++) - regcache->raw_supply (i, -- XSAVE_AVX512_ZMM_H_ADDR (tdep, regs, i)); -+ XSAVE_AVX512_ZMM0_H_ADDR (tdep, regs, i)); - } - } - -@@ -1182,7 +1238,8 @@ i387_supply_xsave (struct regcache *regcache, int regnum, - { - if ((clear_bv & X86_XSTATE_ZMM)) - { -- for (i = zmm_endlo_regnum; i < I387_ZMMENDH_REGNUM (tdep); i++) -+ for (i = I387_ZMM16H_REGNUM (tdep); -+ i < I387_ZMMENDH_REGNUM (tdep); i++) - regcache->raw_supply (i, zero); - for (i = I387_YMM16H_REGNUM (tdep); - i < I387_YMMH_AVX512_END_REGNUM (tdep); -@@ -1195,9 +1252,10 @@ i387_supply_xsave (struct regcache *regcache, int regnum, - } - else - { -- for (i = zmm_endlo_regnum; i < I387_ZMMENDH_REGNUM (tdep); i++) -+ for (i = I387_ZMM16H_REGNUM (tdep); -+ i < I387_ZMMENDH_REGNUM (tdep); i++) - regcache->raw_supply (i, -- XSAVE_AVX512_ZMM_H_ADDR (tdep, regs, i)); -+ XSAVE_AVX512_ZMM16_H_ADDR (tdep, regs, i)); - for (i = I387_YMM16H_REGNUM (tdep); - i < I387_YMMH_AVX512_END_REGNUM (tdep); - i++) -@@ -1240,7 +1298,7 @@ i387_supply_xsave (struct regcache *regcache, int regnum, - { - for (i = I387_BND0R_REGNUM (tdep); - i < I387_BNDCFGU_REGNUM (tdep); i++) -- regcache->raw_supply (i, XSAVE_MPX_ADDR (tdep, regs, i)); -+ regcache->raw_supply (i, XSAVE_BNDREGS_ADDR (tdep, regs, i)); - } - } - -@@ -1257,7 +1315,7 @@ i387_supply_xsave (struct regcache *regcache, int regnum, - { - for (i = I387_BNDCFGU_REGNUM (tdep); - i < I387_MPXEND_REGNUM (tdep); i++) -- regcache->raw_supply (i, XSAVE_MPX_ADDR (tdep, regs, i)); -+ regcache->raw_supply (i, XSAVE_BNDCFG_ADDR (tdep, regs, i)); - } - } - -@@ -1413,14 +1471,16 @@ i387_collect_xsave (const struct regcache *regcache, int regnum, - x87 = 0x2, - sse = 0x4, - avxh = 0x8, -- mpx = 0x10, -- avx512_k = 0x20, -- avx512_zmm_h = 0x40, -- avx512_ymmh_avx512 = 0x80, -- avx512_xmm_avx512 = 0x100, -- pkeys = 0x200, -- all = x87 | sse | avxh | mpx | avx512_k | avx512_zmm_h -- | avx512_ymmh_avx512 | avx512_xmm_avx512 | pkeys -+ bndregs = 0x10, -+ bndcfg = 0x20, -+ avx512_k = 0x40, -+ avx512_zmm0_h = 0x80, -+ avx512_zmm16_h = 0x100, -+ avx512_ymmh_avx512 = 0x200, -+ avx512_xmm_avx512 = 0x400, -+ pkeys = 0x800, -+ all = x87 | sse | avxh | bndregs | bndcfg | avx512_k | avx512_zmm0_h -+ | avx512_zmm16_h | avx512_ymmh_avx512 | avx512_xmm_avx512 | pkeys - } regclass; - - gdb_assert (tdep->st0_regnum >= I386_ST0_REGNUM); -@@ -1432,8 +1492,11 @@ i387_collect_xsave (const struct regcache *regcache, int regnum, - && regnum < I387_PKEYSEND_REGNUM (tdep)) - regclass = pkeys; - else if (regnum >= I387_ZMM0H_REGNUM (tdep) -+ && regnum < I387_ZMM16H_REGNUM (tdep)) -+ regclass = avx512_zmm0_h; -+ else if (regnum >= I387_ZMM16H_REGNUM (tdep) - && regnum < I387_ZMMENDH_REGNUM (tdep)) -- regclass = avx512_zmm_h; -+ regclass = avx512_zmm16_h; - else if (regnum >= I387_K0_REGNUM (tdep) - && regnum < I387_KEND_REGNUM (tdep)) - regclass = avx512_k; -@@ -1447,8 +1510,11 @@ i387_collect_xsave (const struct regcache *regcache, int regnum, - && regnum < I387_YMMENDH_REGNUM (tdep)) - regclass = avxh; - else if (regnum >= I387_BND0R_REGNUM (tdep) -+ && regnum < I387_BNDCFGU_REGNUM (tdep)) -+ regclass = bndregs; -+ else if (regnum >= I387_BNDCFGU_REGNUM (tdep) - && regnum < I387_MPXEND_REGNUM (tdep)) -- regclass = mpx; -+ regclass = bndcfg; - else if (regnum >= I387_XMM0_REGNUM (tdep) - && regnum < I387_MXCSR_REGNUM (tdep)) - regclass = sse; -@@ -1465,7 +1531,7 @@ i387_collect_xsave (const struct regcache *regcache, int regnum, - if (gcore) - { - /* Clear XSAVE extended state. */ -- memset (regs, 0, X86_XSTATE_SIZE (tdep->xcr0)); -+ memset (regs, 0, tdep->xsave_layout.sizeof_xsave); - - /* Update XCR0 and `xstate_bv' with XCR0 for gcore. */ - if (tdep->xsave_xcr0_offset != -1) -@@ -1500,16 +1566,16 @@ i387_collect_xsave (const struct regcache *regcache, int regnum, - if ((clear_bv & X86_XSTATE_BNDREGS)) - for (i = I387_BND0R_REGNUM (tdep); - i < I387_BNDCFGU_REGNUM (tdep); i++) -- memset (XSAVE_MPX_ADDR (tdep, regs, i), 0, 16); -+ memset (XSAVE_BNDREGS_ADDR (tdep, regs, i), 0, 16); - - if ((clear_bv & X86_XSTATE_BNDCFG)) - for (i = I387_BNDCFGU_REGNUM (tdep); - i < I387_MPXEND_REGNUM (tdep); i++) -- memset (XSAVE_MPX_ADDR (tdep, regs, i), 0, 8); -+ memset (XSAVE_BNDCFG_ADDR (tdep, regs, i), 0, 8); - - if ((clear_bv & X86_XSTATE_ZMM_H)) - for (i = I387_ZMM0H_REGNUM (tdep); i < zmm_endlo_regnum; i++) -- memset (XSAVE_AVX512_ZMM_H_ADDR (tdep, regs, i), 0, 32); -+ memset (XSAVE_AVX512_ZMM0_H_ADDR (tdep, regs, i), 0, 32); - - if ((clear_bv & X86_XSTATE_K)) - for (i = I387_K0_REGNUM (tdep); -@@ -1518,8 +1584,9 @@ i387_collect_xsave (const struct regcache *regcache, int regnum, - - if ((clear_bv & X86_XSTATE_ZMM)) - { -- for (i = zmm_endlo_regnum; i < I387_ZMMENDH_REGNUM (tdep); i++) -- memset (XSAVE_AVX512_ZMM_H_ADDR (tdep, regs, i), 0, 32); -+ for (i = I387_ZMM16H_REGNUM (tdep); i < I387_ZMMENDH_REGNUM (tdep); -+ i++) -+ memset (XSAVE_AVX512_ZMM16_H_ADDR (tdep, regs, i), 0, 32); - for (i = I387_YMM16H_REGNUM (tdep); - i < I387_YMMH_AVX512_END_REGNUM (tdep); i++) - memset (XSAVE_YMM_AVX512_ADDR (tdep, regs, i), 0, 16); -@@ -1582,15 +1649,27 @@ i387_collect_xsave (const struct regcache *regcache, int regnum, - } - - /* Check if any ZMMH registers are changed. */ -- if ((tdep->xcr0 & (X86_XSTATE_ZMM_H | X86_XSTATE_ZMM))) -- for (i = I387_ZMM0H_REGNUM (tdep); -+ if ((tdep->xcr0 & X86_XSTATE_ZMM)) -+ for (i = I387_ZMM16H_REGNUM (tdep); - i < I387_ZMMENDH_REGNUM (tdep); i++) - { - regcache->raw_collect (i, raw); -- p = XSAVE_AVX512_ZMM_H_ADDR (tdep, regs, i); -+ p = XSAVE_AVX512_ZMM16_H_ADDR (tdep, regs, i); - if (memcmp (raw, p, 32) != 0) - { -- xstate_bv |= (X86_XSTATE_ZMM_H | X86_XSTATE_ZMM); -+ xstate_bv |= X86_XSTATE_ZMM; -+ memcpy (p, raw, 32); -+ } -+ } -+ -+ if ((tdep->xcr0 & X86_XSTATE_ZMM_H)) -+ for (i = I387_ZMM0H_REGNUM (tdep); i < zmm_endlo_regnum; i++) -+ { -+ regcache->raw_collect (i, raw); -+ p = XSAVE_AVX512_ZMM0_H_ADDR (tdep, regs, i); -+ if (memcmp (raw, p, 32) != 0) -+ { -+ xstate_bv |= X86_XSTATE_ZMM_H; - memcpy (p, raw, 32); - } - } -@@ -1642,7 +1721,7 @@ i387_collect_xsave (const struct regcache *regcache, int regnum, - i < I387_BNDCFGU_REGNUM (tdep); i++) - { - regcache->raw_collect (i, raw); -- p = XSAVE_MPX_ADDR (tdep, regs, i); -+ p = XSAVE_BNDREGS_ADDR (tdep, regs, i); - if (memcmp (raw, p, 16)) - { - xstate_bv |= X86_XSTATE_BNDREGS; -@@ -1656,7 +1735,7 @@ i387_collect_xsave (const struct regcache *regcache, int regnum, - i < I387_MPXEND_REGNUM (tdep); i++) - { - regcache->raw_collect (i, raw); -- p = XSAVE_MPX_ADDR (tdep, regs, i); -+ p = XSAVE_BNDCFG_ADDR (tdep, regs, i); - if (memcmp (raw, p, 8)) - { - xstate_bv |= X86_XSTATE_BNDCFG; -@@ -1746,15 +1825,26 @@ i387_collect_xsave (const struct regcache *regcache, int regnum, - } - break; - -- case avx512_zmm_h: -- /* This is a ZMM register. */ -- p = XSAVE_AVX512_ZMM_H_ADDR (tdep, regs, regnum); -+ case avx512_zmm16_h: -+ /* This is a ZMM16-31 register. */ -+ p = XSAVE_AVX512_ZMM16_H_ADDR (tdep, regs, regnum); - if (memcmp (raw, p, 32) != 0) - { -- xstate_bv |= (X86_XSTATE_ZMM_H | X86_XSTATE_ZMM); -+ xstate_bv |= X86_XSTATE_ZMM; - memcpy (p, raw, 32); - } - break; -+ -+ case avx512_zmm0_h: -+ /* This is a ZMM0-15 register. */ -+ p = XSAVE_AVX512_ZMM0_H_ADDR (tdep, regs, regnum); -+ if (memcmp (raw, p, 32) != 0) -+ { -+ xstate_bv |= X86_XSTATE_ZMM_H; -+ memcpy (p, raw, 32); -+ } -+ break; -+ - case avx512_k: - /* This is a AVX512 mask register. */ - p = XSAVE_AVX512_K_ADDR (tdep, regs, regnum); -@@ -1795,25 +1885,22 @@ i387_collect_xsave (const struct regcache *regcache, int regnum, - } - break; - -- case mpx: -- if (regnum < I387_BNDCFGU_REGNUM (tdep)) -- { -- regcache->raw_collect (regnum, raw); -- p = XSAVE_MPX_ADDR (tdep, regs, regnum); -- if (memcmp (raw, p, 16)) -- { -- xstate_bv |= X86_XSTATE_BNDREGS; -- memcpy (p, raw, 16); -- } -- } -- else -+ case bndregs: -+ regcache->raw_collect (regnum, raw); -+ p = XSAVE_BNDREGS_ADDR (tdep, regs, regnum); -+ if (memcmp (raw, p, 16)) - { -- p = XSAVE_MPX_ADDR (tdep, regs, regnum); -- xstate_bv |= X86_XSTATE_BNDCFG; -- memcpy (p, raw, 8); -+ xstate_bv |= X86_XSTATE_BNDREGS; -+ memcpy (p, raw, 16); - } - break; - -+ case bndcfg: -+ p = XSAVE_BNDCFG_ADDR (tdep, regs, regnum); -+ xstate_bv |= X86_XSTATE_BNDCFG; -+ memcpy (p, raw, 8); -+ break; -+ - case sse: - /* This is an SSE register. */ - p = FXSAVE_ADDR (tdep, regs, regnum); -diff --git a/gdb/i387-tdep.h b/gdb/i387-tdep.h ---- a/gdb/i387-tdep.h -+++ b/gdb/i387-tdep.h -@@ -51,6 +51,7 @@ struct x86_xsave_layout; - #define I387_K0_REGNUM(tdep) ((tdep)->k0_regnum) - #define I387_NUM_ZMMH_REGS(tdep) ((tdep)->num_zmm_regs) - #define I387_ZMM0H_REGNUM(tdep) ((tdep)->zmm0h_regnum) -+#define I387_ZMM16H_REGNUM(tdep) ((tdep)->zmm0h_regnum + 16) - #define I387_NUM_YMM_AVX512_REGS(tdep) ((tdep)->num_ymm_avx512_regs) - #define I387_YMM16H_REGNUM(tdep) ((tdep)->ymm16h_regnum) - diff --git a/gdb-rhel-10464-xsave-update-9of21.patch b/gdb-rhel-10464-xsave-update-9of21.patch deleted file mode 100644 index 529a9fb..0000000 --- a/gdb-rhel-10464-xsave-update-9of21.patch +++ /dev/null @@ -1,168 +0,0 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: John Baldwin -Date: Thu, 11 Apr 2024 14:05:44 -0700 -Subject: gdb-rhel-10464-xsave-update-9of21.patch - -;; Backport "gdbserver: Add a function to set the XSAVE mask and size." -;; (John Baldwin, RHEL-10464) - -Make x86_xcr0 private to i387-fp.cc and use i387_set_xsave_mask to set -the value instead. Add a static global instance of x86_xsave_layout -and initialize it in the new function as well to be used in a future -commit to parse XSAVE extended state regions. - -Update the Linux port to use this function rather than setting -x86_xcr0 directly. In the case that XML is not supported, don't -bother setting x86_xcr0 to the default value but just omit the call to -i387_set_xsave_mask as i387-fp.cc defaults to the SSE case used for -non-XML. - -In addition, use x86_xsave_length to determine the size of the XSAVE -register set via CPUID. - -Approved-By: Simon Marchi - -diff --git a/gdbserver/configure.srv b/gdbserver/configure.srv ---- a/gdbserver/configure.srv -+++ b/gdbserver/configure.srv -@@ -93,7 +93,8 @@ case "${gdbserver_host}" in - i[34567]86-*-linux*) srv_tgtobj="${srv_tgtobj} arch/i386.o" - srv_tgtobj="${srv_tgtobj} $srv_linux_obj" - srv_tgtobj="${srv_tgtobj} linux-x86-low.o x86-low.o" -- srv_tgtobj="${srv_tgtobj} nat/x86-dregs.o i387-fp.o" -+ srv_tgtobj="${srv_tgtobj} nat/x86-dregs.o" -+ srv_tgtobj="${srv_tgtobj} nat/x86-xstate.o i387-fp.o" - srv_tgtobj="${srv_tgtobj} linux-x86-tdesc.o" - srv_tgtobj="${srv_tgtobj} nat/linux-btrace.o" - srv_tgtobj="${srv_tgtobj} nat/x86-linux.o" -@@ -333,7 +334,8 @@ case "${gdbserver_host}" in - srv_linux_thread_db=yes - ;; - x86_64-*-linux*) srv_tgtobj="$srv_linux_obj linux-x86-low.o x86-low.o" -- srv_tgtobj="${srv_tgtobj} nat/x86-dregs.o i387-fp.o" -+ srv_tgtobj="${srv_tgtobj} nat/x86-dregs.o" -+ srv_tgtobj="${srv_tgtobj} nat/x86-xstate.o i387-fp.o" - srv_tgtobj="${srv_tgtobj} arch/i386.o arch/amd64.o" - srv_tgtobj="${srv_tgtobj} linux-x86-tdesc.o" - srv_tgtobj="${srv_tgtobj} nat/linux-btrace.o" -@@ -348,14 +350,16 @@ case "${gdbserver_host}" in - ipa_obj="${ipa_obj} arch/amd64-ipa.o" - ;; - x86_64-*-mingw*) srv_regobj="" -- srv_tgtobj="x86-low.o nat/x86-dregs.o i387-fp.o" -+ srv_tgtobj="x86-low.o nat/x86-dregs.o" -+ srv_tgtobj="${srv_tgtobj} nat/x86-xstate.o i387-fp.o" - srv_tgtobj="${srv_tgtobj} win32-low.o win32-i386-low.o" - srv_tgtobj="${srv_tgtobj} nat/windows-nat.o" - srv_tgtobj="${srv_tgtobj} arch/amd64.o arch/i386.o" - srv_mingw=yes - ;; - x86_64-*-cygwin*) srv_regobj="" -- srv_tgtobj="x86-low.o nat/x86-dregs.o i387-fp.o" -+ srv_tgtobj="x86-low.o nat/x86-dregs.o" -+ srv_tgtobj="${srv_tgtobj} nat/x86-xstate.o i387-fp.o" - srv_tgtobj="${srv_tgtobj} win32-low.o win32-i386-low.o" - srv_tgtobj="${srv_tgtobj} nat/windows-nat.o" - srv_tgtobj="${srv_tgtobj} arch/amd64.o arch/i386.o" -diff --git a/gdbserver/i387-fp.cc b/gdbserver/i387-fp.cc ---- a/gdbserver/i387-fp.cc -+++ b/gdbserver/i387-fp.cc -@@ -19,6 +19,10 @@ - #include "server.h" - #include "i387-fp.h" - #include "gdbsupport/x86-xstate.h" -+#include "nat/x86-xstate.h" -+ -+/* Default to SSE. */ -+static unsigned long long x86_xcr0 = X86_XSTATE_SSE_MASK; - - static const int num_mpx_bnd_registers = 4; - static const int num_mpx_cfg_registers = 2; -@@ -29,6 +33,8 @@ static const int num_avx512_ymmh_registers = 16; - static const int num_avx512_xmm_registers = 16; - static const int num_pkeys_registers = 1; - -+static x86_xsave_layout xsave_layout; -+ - /* Note: These functions preserve the reserved bits in control registers. - However, gdbserver promptly throws away that information. */ - -@@ -950,5 +956,11 @@ i387_xsave_to_cache (struct regcache *regcache, const void *buf) - } - } - --/* Default to SSE. */ --unsigned long long x86_xcr0 = X86_XSTATE_SSE_MASK; -+/* See i387-fp.h. */ -+ -+void -+i387_set_xsave_mask (uint64_t xcr0, int len) -+{ -+ x86_xcr0 = xcr0; -+ xsave_layout = x86_fetch_xsave_layout (xcr0, len); -+} -diff --git a/gdbserver/i387-fp.h b/gdbserver/i387-fp.h ---- a/gdbserver/i387-fp.h -+++ b/gdbserver/i387-fp.h -@@ -28,6 +28,8 @@ void i387_fxsave_to_cache (struct regcache *regcache, const void *buf); - void i387_cache_to_xsave (struct regcache *regcache, void *buf); - void i387_xsave_to_cache (struct regcache *regcache, const void *buf); - --extern unsigned long long x86_xcr0; -+/* Set the XSAVE mask and fetch the XSAVE layout via CPUID. */ -+ -+void i387_set_xsave_mask (uint64_t xcr0, int len); - - #endif /* GDBSERVER_I387_FP_H */ -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 -@@ -25,6 +25,7 @@ - #include "i387-fp.h" - #include "x86-low.h" - #include "gdbsupport/x86-xstate.h" -+#include "nat/x86-xstate.h" - #include "nat/gdb_ptrace.h" - - #ifdef __x86_64__ -@@ -871,6 +872,7 @@ x86_linux_read_description (void) - int xcr0_features; - int tid; - static uint64_t xcr0; -+ static int xsave_len; - struct regset_info *regset; - - tid = lwpid_of (current_thread); -@@ -905,8 +907,6 @@ x86_linux_read_description (void) - - if (!use_xml) - { -- x86_xcr0 = X86_XSTATE_SSE_MASK; -- - /* Don't use XML. */ - #ifdef __x86_64__ - if (machine == EM_X86_64) -@@ -936,11 +936,13 @@ x86_linux_read_description (void) - xcr0 = xstateregs[(I386_LINUX_XSAVE_XCR0_OFFSET - / sizeof (uint64_t))]; - -+ xsave_len = x86_xsave_length (); -+ - /* Use PTRACE_GETREGSET if it is available. */ - for (regset = x86_regsets; - regset->fill_function != NULL; regset++) - if (regset->get_request == PTRACE_GETREGSET) -- regset->size = X86_XSTATE_SIZE (xcr0); -+ regset->size = xsave_len; - else if (regset->type != GENERAL_REGS) - regset->size = 0; - } -@@ -951,7 +953,7 @@ x86_linux_read_description (void) - && (xcr0 & X86_XSTATE_ALL_MASK)); - - if (xcr0_features) -- x86_xcr0 = xcr0; -+ i387_set_xsave_mask (xcr0, xsave_len); - - if (machine == EM_X86_64) - { diff --git a/gdb-rhel-13298-inferior-funcall-bp-condition-1-of-5.patch b/gdb-rhel-13298-inferior-funcall-bp-condition-1-of-5.patch new file mode 100644 index 0000000..fbecc59 --- /dev/null +++ b/gdb-rhel-13298-inferior-funcall-bp-condition-1-of-5.patch @@ -0,0 +1,70 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Andrew Burgess +Date: Mon, 9 May 2022 17:51:54 +0100 +Subject: gdb-rhel-13298-inferior-funcall-bp-condition-1-of-5.patch + +;;Revert "gdb: remove unnecessary parameter wait_ptid from do_target_wait" +;;(Andrew Burgess, RHEL-13298) + +This reverts commit ac0d67ed1dcf470bad6a3bc4800c2ddc9bedecca. + +There was nothing wrong with the commit which I'm reverting here, but +it removed some functionality that will be needed for a later commit; +that is, the ability for GDB to ask for events from a specific ptid_t +via the do_target_wait function. + +In a follow up commit, this functionality will be used to implement +inferior function calls in multi-threaded inferiors. + +This is not a straight revert of the above commit. Reverting the +above commit replaces a 'nullptr' with 'NULL', I've gone in and +changed that, preserving the 'nullptr'. + +Reviewed-By: Tankut Baris Aktemur +Tested-By: Luis Machado +Tested-By: Keith Seitz + +diff --git a/gdb/infrun.c b/gdb/infrun.c +--- a/gdb/infrun.c ++++ b/gdb/infrun.c +@@ -3946,7 +3946,8 @@ do_target_wait_1 (inferior *inf, ptid_t ptid, + more events. Polls for events from all inferiors/targets. */ + + static bool +-do_target_wait (execution_control_state *ecs, target_wait_flags options) ++do_target_wait (ptid_t wait_ptid, execution_control_state *ecs, ++ target_wait_flags options) + { + int num_inferiors = 0; + int random_selector; +@@ -3956,9 +3957,10 @@ do_target_wait (execution_control_state *ecs, target_wait_flags options) + polling the rest of the inferior list starting from that one in a + circular fashion until the whole list is polled once. */ + +- auto inferior_matches = [] (inferior *inf) ++ auto inferior_matches = [&wait_ptid] (inferior *inf) + { +- return inf->process_target () != nullptr; ++ return (inf->process_target () != nullptr ++ && ptid_t (inf->pid).matches (wait_ptid)); + }; + + /* First see how many matching inferiors we have. */ +@@ -3997,7 +3999,7 @@ do_target_wait (execution_control_state *ecs, target_wait_flags options) + + auto do_wait = [&] (inferior *inf) + { +- ecs->ptid = do_target_wait_1 (inf, minus_one_ptid, &ecs->ws, options); ++ ecs->ptid = do_target_wait_1 (inf, wait_ptid, &ecs->ws, options); + ecs->target = inf->process_target (); + return (ecs->ws.kind () != TARGET_WAITKIND_IGNORE); + }; +@@ -4427,7 +4429,7 @@ fetch_inferior_event () + the event. */ + scoped_disable_commit_resumed disable_commit_resumed ("handling event"); + +- if (!do_target_wait (&ecs, TARGET_WNOHANG)) ++ if (!do_target_wait (minus_one_ptid, &ecs, TARGET_WNOHANG)) + { + infrun_debug_printf ("do_target_wait returned no event"); + disable_commit_resumed.reset_and_commit (); diff --git a/gdb-rhel-13298-inferior-funcall-bp-condition-2-of-5.patch b/gdb-rhel-13298-inferior-funcall-bp-condition-2-of-5.patch new file mode 100644 index 0000000..f582130 --- /dev/null +++ b/gdb-rhel-13298-inferior-funcall-bp-condition-2-of-5.patch @@ -0,0 +1,1274 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Andrew Burgess +Date: Fri, 9 Oct 2020 13:27:13 +0200 +Subject: gdb-rhel-13298-inferior-funcall-bp-condition-2-of-5.patch + +;;gdb: fix b/p conditions with infcalls in multi-threaded inferiors +;;(Andrew Burgess, RHEL-13298) + +This commit fixes bug PR 28942, that is, creating a conditional +breakpoint in a multi-threaded inferior, where the breakpoint +condition includes an inferior function call. + +Currently, when a user tries to create such a breakpoint, then GDB +will fail with: + + (gdb) break infcall-from-bp-cond-single.c:61 if (return_true ()) + Breakpoint 2 at 0x4011fa: file /tmp/build/gdb/testsuite/../../../src/gdb/testsuite/gdb.threads/infcall-from-bp-cond-single.c, line 61. + (gdb) continue + Continuing. + [New Thread 0x7ffff7c5d700 (LWP 2460150)] + [New Thread 0x7ffff745c700 (LWP 2460151)] + [New Thread 0x7ffff6c5b700 (LWP 2460152)] + [New Thread 0x7ffff645a700 (LWP 2460153)] + [New Thread 0x7ffff5c59700 (LWP 2460154)] + Error in testing breakpoint condition: + Couldn't get registers: No such process. + An error occurred while in a function called from GDB. + Evaluation of the expression containing the function + (return_true) will be abandoned. + When the function is done executing, GDB will silently stop. + Selected thread is running. + (gdb) + +Or, in some cases, like this: + + (gdb) break infcall-from-bp-cond-simple.c:56 if (is_matching_tid (arg, 1)) + Breakpoint 2 at 0x401194: file /tmp/build/gdb/testsuite/../../../src/gdb/testsuite/gdb.threads/infcall-from-bp-cond-simple.c, line 56. + (gdb) continue + Continuing. + [New Thread 0x7ffff7c5d700 (LWP 2461106)] + [New Thread 0x7ffff745c700 (LWP 2461107)] + ../../src.release/gdb/nat/x86-linux-dregs.c:146: internal-error: x86_linux_update_debug_registers: Assertion `lwp_is_stopped (lwp)' failed. + A problem internal to GDB has been detected, + further debugging may prove unreliable. + +The precise error depends on the exact thread state; so there's race +conditions depending on which threads have fully started, and which +have not. But the underlying problem is always the same; when GDB +tries to execute the inferior function call from within the breakpoint +condition, GDB will, incorrectly, try to resume threads that are +already running - GDB doesn't realise that some threads might already +be running. + +The solution proposed in this patch requires an additional member +variable thread_info::in_cond_eval. This flag is set to true (in +breakpoint.c) when GDB is evaluating a breakpoint condition. + +In user_visible_resume_ptid (infrun.c), when the in_cond_eval flag is +true, then GDB will only try to resume the current thread, that is, +the thread for which the breakpoint condition is being evaluated. +This solves the problem of GDB trying to resume threads that are +already running. + +The next problem is that inferior function calls are assumed to be +synchronous, that is, GDB doesn't expect to start an inferior function +call in thread #1, then receive a stop from thread #2 for some other, +unrelated reason. To prevent GDB responding to an event from another +thread, we update fetch_inferior_event and do_target_wait in infrun.c, +so that, when an inferior function call (on behalf of a breakpoint +condition) is in progress, we only wait for events from the current +thread (the one evaluating the condition). + +In do_target_wait I had to change the inferior_matches lambda +function, which is used to select which inferior to wait on. +Previously the logic was this: + + auto inferior_matches = [&wait_ptid] (inferior *inf) + { + return (inf->process_target () != nullptr + && ptid_t (inf->pid).matches (wait_ptid)); + }; + +This compares the pid of the inferior against the complete ptid we +want to wait on. Before this commit wait_ptid was only ever +minus_one_ptid (which is special, and means any process), and so every +inferior would match. + +After this commit though wait_ptid might represent a specific thread +in a specific inferior. If we compare the pid of the inferior to a +specific ptid then these will not match. The fix is to compare +against the pid extracted from the wait_ptid, not against the complete +wait_ptid itself. + +In fetch_inferior_event, after receiving the event, we only want to +stop all the other threads, and call inferior_event_handler with +INF_EXEC_COMPLETE, if we are not evaluating a conditional breakpoint. +If we are, then all the other threads should be left doing whatever +they were before. The inferior_event_handler call will be performed +once the breakpoint condition has finished being evaluated, and GDB +decides to stop or not. + +The final problem that needs solving relates to GDB's commit-resume +mechanism, which allows GDB to collect resume requests into a single +packet in order to reduce traffic to a remote target. + +The problem is that the commit-resume mechanism will not send any +resume requests for an inferior if there are already events pending on +the GDB side. + +Imagine an inferior with two threads. Both threads hit a breakpoint, +maybe the same conditional breakpoint. At this point there are two +pending events, one for each thread. + +GDB selects one of the events and spots that this is a conditional +breakpoint, GDB evaluates the condition. + +The condition includes an inferior function call, so GDB sets up for +the call and resumes the one thread, the resume request is added to +the commit-resume queue. + +When the commit-resume queue is committed GDB sees that there is a +pending event from another thread, and so doesn't send any resume +requests to the actual target, GDB is assuming that when we wait we +will select the event from the other thread. + +However, as this is an inferior function call for a condition +evaluation, we will not select the event from the other thread, we +only care about events from the thread that is evaluating the +condition - and the resume for this thread was never sent to the +target. + +And so, GDB hangs, waiting for an event from a thread that was never +fully resumed. + +To fix this issue I have added the concept of "forcing" the +commit-resume queue. When enabling commit resume, if the force flag +is true, then any resumes will be committed to the target, even if +there are other threads with pending events. + +A note on authorship: this patch was based on some work done by +Natalia Saiapova and Tankut Baris Aktemur from Intel[1]. I have made +some changes to their work in this version. + +Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28942 + +[1] https://sourceware.org/pipermail/gdb-patches/2020-October/172454.html + +Co-authored-by: Natalia Saiapova +Co-authored-by: Tankut Baris Aktemur +Reviewed-By: Tankut Baris Aktemur +Tested-By: Luis Machado +Tested-By: Keith Seitz + +diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c +--- a/gdb/breakpoint.c ++++ b/gdb/breakpoint.c +@@ -5679,6 +5679,8 @@ bpstat_check_breakpoint_conditions (bpstat *bs, thread_info *thread) + { + try + { ++ scoped_restore reset_in_cond_eval ++ = make_scoped_restore (&thread->control.in_cond_eval, true); + condition_result = breakpoint_cond_eval (cond); + } + catch (const gdb_exception_error &ex) +diff --git a/gdb/gdbthread.h b/gdb/gdbthread.h +--- a/gdb/gdbthread.h ++++ b/gdb/gdbthread.h +@@ -171,6 +171,9 @@ struct thread_control_state + command. This is used to decide whether "set scheduler-locking + step" behaves like "on" or "off". */ + int stepping_command = 0; ++ ++ /* True if the thread is evaluating a BP condition. */ ++ bool in_cond_eval = false; + }; + + /* Inferior thread specific part of `struct infcall_suspend_state'. */ +diff --git a/gdb/infcall.c b/gdb/infcall.c +--- a/gdb/infcall.c ++++ b/gdb/infcall.c +@@ -672,6 +672,12 @@ run_inferior_call (std::unique_ptr sm, + + proceed (real_pc, GDB_SIGNAL_0); + ++ /* Enable commit resume, but pass true for the force flag. This ++ ensures any thread we set running in proceed will actually be ++ committed to the target, even if some other thread in the current ++ target has a pending event. */ ++ scoped_enable_commit_resumed enable ("infcall", true); ++ + infrun_debug_show_threads ("non-exited threads after proceed for inferior-call", + all_non_exited_threads ()); + +diff --git a/gdb/infrun.c b/gdb/infrun.c +--- a/gdb/infrun.c ++++ b/gdb/infrun.c +@@ -2292,6 +2292,14 @@ user_visible_resume_ptid (int step) + mode. */ + resume_ptid = inferior_ptid; + } ++ else if (inferior_ptid != null_ptid ++ && inferior_thread ()->control.in_cond_eval) ++ { ++ /* The inferior thread is evaluating a BP condition. Other threads ++ might be stopped or running and we do not want to change their ++ state, thus, resume only the current thread. */ ++ resume_ptid = inferior_ptid; ++ } + else if (!sched_multi && target_supports_multi_process ()) + { + /* Resume all threads of the current process (and none of other +@@ -3020,12 +3028,24 @@ schedlock_applies (struct thread_info *tp) + execution_direction))); + } + +-/* Set process_stratum_target::COMMIT_RESUMED_STATE in all target +- stacks that have threads executing and don't have threads with +- pending events. */ ++/* When FORCE_P is false, set process_stratum_target::COMMIT_RESUMED_STATE ++ in all target stacks that have threads executing and don't have threads ++ with pending events. ++ ++ When FORCE_P is true, set process_stratum_target::COMMIT_RESUMED_STATE ++ in all target stacks that have threads executing regardless of whether ++ there are pending events or not. ++ ++ Passing FORCE_P as false makes sense when GDB is going to wait for ++ events from all threads and will therefore spot the pending events. ++ However, if GDB is only going to wait for events from select threads ++ (i.e. when performing an inferior call) then a pending event on some ++ other thread will not be spotted, and if we fail to commit the resume ++ state for the thread performing the inferior call, then the inferior ++ call will never complete (or even start). */ + + static void +-maybe_set_commit_resumed_all_targets () ++maybe_set_commit_resumed_all_targets (bool force_p) + { + scoped_restore_current_thread restore_thread; + +@@ -3054,7 +3074,7 @@ maybe_set_commit_resumed_all_targets () + status to report, handle it before requiring the target to + commit its resumed threads: handling the status might lead to + resuming more threads. */ +- if (proc_target->has_resumed_with_pending_wait_status ()) ++ if (!force_p && proc_target->has_resumed_with_pending_wait_status ()) + { + infrun_debug_printf ("not requesting commit-resumed for target %s, a" + " thread has a pending waitstatus", +@@ -3064,7 +3084,7 @@ maybe_set_commit_resumed_all_targets () + + switch_to_inferior_no_thread (inf); + +- if (target_has_pending_events ()) ++ if (!force_p && target_has_pending_events ()) + { + infrun_debug_printf ("not requesting commit-resumed for target %s, " + "target has pending events", +@@ -3157,7 +3177,7 @@ scoped_disable_commit_resumed::reset () + { + /* This is the outermost instance, re-enable + COMMIT_RESUMED_STATE on the targets where it's possible. */ +- maybe_set_commit_resumed_all_targets (); ++ maybe_set_commit_resumed_all_targets (false); + } + else + { +@@ -3190,7 +3210,7 @@ scoped_disable_commit_resumed::reset_and_commit () + /* See infrun.h. */ + + scoped_enable_commit_resumed::scoped_enable_commit_resumed +- (const char *reason) ++ (const char *reason, bool force_p) + : m_reason (reason), + m_prev_enable_commit_resumed (enable_commit_resumed) + { +@@ -3202,7 +3222,7 @@ scoped_enable_commit_resumed::scoped_enable_commit_resumed + + /* Re-enable COMMIT_RESUMED_STATE on the targets where it's + possible. */ +- maybe_set_commit_resumed_all_targets (); ++ maybe_set_commit_resumed_all_targets (force_p); + + maybe_call_commit_resumed_all_targets (); + } +@@ -3957,10 +3977,11 @@ do_target_wait (ptid_t wait_ptid, execution_control_state *ecs, + polling the rest of the inferior list starting from that one in a + circular fashion until the whole list is polled once. */ + +- auto inferior_matches = [&wait_ptid] (inferior *inf) ++ ptid_t wait_ptid_pid {wait_ptid.pid ()}; ++ auto inferior_matches = [&wait_ptid_pid] (inferior *inf) + { + return (inf->process_target () != nullptr +- && ptid_t (inf->pid).matches (wait_ptid)); ++ && ptid_t (inf->pid).matches (wait_ptid_pid)); + }; + + /* First see how many matching inferiors we have. */ +@@ -4429,7 +4450,17 @@ fetch_inferior_event () + the event. */ + scoped_disable_commit_resumed disable_commit_resumed ("handling event"); + +- if (!do_target_wait (minus_one_ptid, &ecs, TARGET_WNOHANG)) ++ /* Is the current thread performing an inferior function call as part ++ of a breakpoint condition evaluation? */ ++ bool in_cond_eval = (inferior_ptid != null_ptid ++ && inferior_thread ()->control.in_cond_eval); ++ ++ /* If the thread is in the middle of the condition evaluation, wait for ++ an event from the current thread. Otherwise, wait for an event from ++ any thread. */ ++ ptid_t waiton_ptid = in_cond_eval ? inferior_ptid : minus_one_ptid; ++ ++ if (!do_target_wait (waiton_ptid, &ecs, TARGET_WNOHANG)) + { + infrun_debug_printf ("do_target_wait returned no event"); + disable_commit_resumed.reset_and_commit (); +@@ -4487,7 +4518,12 @@ fetch_inferior_event () + bool should_notify_stop = true; + bool proceeded = false; + +- stop_all_threads_if_all_stop_mode (); ++ /* If the thread that stopped just completed an inferior ++ function call as part of a condition evaluation, then we ++ don't want to stop all the other threads. */ ++ if (ecs.event_thread == nullptr ++ || !ecs.event_thread->control.in_cond_eval) ++ stop_all_threads_if_all_stop_mode (); + + clean_up_just_stopped_threads_fsms (&ecs); + +@@ -4514,7 +4550,7 @@ fetch_inferior_event () + proceeded = normal_stop (); + } + +- if (!proceeded) ++ if (!proceeded && !in_cond_eval) + { + inferior_event_handler (INF_EXEC_COMPLETE); + cmd_done = 1; +diff --git a/gdb/infrun.h b/gdb/infrun.h +--- a/gdb/infrun.h ++++ b/gdb/infrun.h +@@ -406,7 +406,8 @@ extern void maybe_call_commit_resumed_all_targets (); + + struct scoped_enable_commit_resumed + { +- explicit scoped_enable_commit_resumed (const char *reason); ++ explicit scoped_enable_commit_resumed (const char *reason, ++ bool force_p = false); + ~scoped_enable_commit_resumed (); + + DISABLE_COPY_AND_ASSIGN (scoped_enable_commit_resumed); +diff --git a/gdb/testsuite/gdb.threads/infcall-from-bp-cond-other-thread-event.c b/gdb/testsuite/gdb.threads/infcall-from-bp-cond-other-thread-event.c +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.threads/infcall-from-bp-cond-other-thread-event.c +@@ -0,0 +1,135 @@ ++/* Copyright 2022-2024 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 ++#include ++#include ++ ++#define NUM_THREADS 2 ++ ++pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; ++ ++/* Some global variables to poke, just for something to do. */ ++volatile int global_var_0 = 0; ++volatile int global_var_1 = 0; ++ ++/* This flag is updated from GDB. */ ++volatile int raise_signal = 0; ++ ++/* Implement the breakpoint condition function. Release the other thread ++ and try to give the other thread a chance to run. Then return ANSWER. */ ++int ++condition_core_func (int answer) ++{ ++ /* This unlock should release the other thread. */ ++ if (pthread_mutex_unlock (&mutex) != 0) ++ abort (); ++ ++ /* And this yield and sleep should (hopefully) give the other thread a ++ chance to run. This isn't guaranteed of course, but once the other ++ thread does run it should hit a breakpoint, which GDB should ++ (temporarily) ignore, so there's no easy way for us to know the other ++ thread has done what it needs to, thus, yielding and sleeping is the ++ best we can do. */ ++ sched_yield (); ++ sleep (2); ++ ++ return answer; ++} ++ ++void ++stop_marker () ++{ ++ int a = 100; /* Final breakpoint here. */ ++} ++ ++/* A breakpoint condition function that always returns true. */ ++int ++condition_true_func () ++{ ++ return condition_core_func (1); ++} ++ ++/* A breakpoint condition function that always returns false. */ ++int ++condition_false_func () ++{ ++ return condition_core_func (0); ++} ++ ++void * ++worker_func (void *arg) ++{ ++ volatile int *ptr = 0; ++ int tid = *((int *) arg); ++ ++ switch (tid) ++ { ++ case 0: ++ global_var_0 = 11; /* First thread breakpoint. */ ++ break; ++ ++ case 1: ++ if (pthread_mutex_lock (&mutex) != 0) ++ abort (); ++ if (raise_signal) ++ global_var_1 = *ptr; /* Signal here. */ ++ else ++ global_var_1 = 99; /* Other thread breakpoint. */ ++ break; ++ ++ default: ++ abort (); ++ } ++ ++ return NULL; ++} ++ ++int ++main () ++{ ++ pthread_t threads[NUM_THREADS]; ++ int args[NUM_THREADS]; ++ ++ /* Set an alarm, just in case the test deadlocks. */ ++ alarm (300); ++ ++ /* We want the mutex to start locked. */ ++ if (pthread_mutex_lock (&mutex) != 0) ++ abort (); ++ ++ for (int i = 0; i < NUM_THREADS; i++) ++ { ++ args[i] = i; ++ pthread_create (&threads[i], NULL, worker_func, &args[i]); ++ } ++ ++ for (int i = 0; i < NUM_THREADS; i++) ++ { ++ void *retval; ++ pthread_join (threads[i], &retval); ++ } ++ ++ /* Unlock once we're done, just for cleanliness. */ ++ if (pthread_mutex_unlock (&mutex) != 0) ++ abort (); ++ ++ stop_marker (); ++ ++ return 0; ++} +diff --git a/gdb/testsuite/gdb.threads/infcall-from-bp-cond-other-thread-event.exp b/gdb/testsuite/gdb.threads/infcall-from-bp-cond-other-thread-event.exp +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.threads/infcall-from-bp-cond-other-thread-event.exp +@@ -0,0 +1,174 @@ ++# Copyright 2022-2024 Free Software Foundation, Inc. ++ ++# This program is free software; you can 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 for conditional breakpoints where the breakpoint condition includes ++# an inferior function call. ++# ++# The tests in this script are testing what happens when an event arrives in ++# another thread while GDB is waiting for the inferior function call (in the ++# breakpoint condition) to finish. ++# ++# The expectation is that GDB will queue events for other threads and wait ++# for the inferior function call to complete, if the condition is true, then ++# the conditional breakpoint should be reported first. The other thread ++# event should of course, not get lost, and should be reported as soon as ++# the user tries to continue the inferior. ++# ++# If the conditional breakpoint ends up not being taken (the condition is ++# false), then the other thread event should be reported immediately. ++# ++# This script tests what happens when the other thread event is (a) the ++# other thread hitting a breakpoint, and (b) the other thread taking a ++# signal (SIGSEGV in this case). ++ ++standard_testfile ++ ++if { [build_executable "failed to prepare" ${binfile} "${srcfile}" \ ++ {debug pthreads}] == -1 } { ++ return ++} ++ ++set cond_bp_line [gdb_get_line_number "First thread breakpoint"] ++set other_bp_line [gdb_get_line_number "Other thread breakpoint"] ++set final_bp_line [gdb_get_line_number "Final breakpoint here"] ++set signal_line [gdb_get_line_number "Signal here"] ++ ++# Start GDB based on TARGET_ASYNC and TARGET_NON_STOP, and then runto main. ++proc start_gdb_and_runto_main { target_async target_non_stop } { ++ save_vars { ::GDBFLAGS } { ++ append ::GDBFLAGS \ ++ " -ex \"maint set target-non-stop $target_non_stop\"" ++ append ::GDBFLAGS \ ++ " -ex \"maintenance set target-async ${target_async}\"" ++ ++ clean_restart ${::binfile} ++ } ++ ++ if { ![runto_main] } { ++ return -1 ++ } ++ ++ return 0 ++} ++ ++# Run a test of GDB's conditional breakpoints, where the conditions include ++# inferior function calls. While the inferior function call is executing ++# another thread will hit a breakpoint (when OTHER_THREAD_SIGNAL is false), ++# or receive a signal (when OTHER_THREAD_SIGNAL is true). GDB should report ++# the conditional breakpoint first (if the condition is true), and then ++# report the second thread event once the inferior is continued again. ++# ++# When STOP_AT_COND is true then the conditional breakpoint will have a ++# condition that evaluates to true (and GDB will stop at the breakpoint), ++# otherwise, the condition will evaluate to false (and GDB will not stop at ++# the breakpoint). ++proc run_condition_test { stop_at_cond other_thread_signal \ ++ target_async target_non_stop } { ++ if { [start_gdb_and_runto_main $target_async \ ++ $target_non_stop] == -1 } { ++ return ++ } ++ ++ # Setup the conditional breakpoint. ++ if { $stop_at_cond } { ++ set cond_func "condition_true_func" ++ } else { ++ set cond_func "condition_false_func" ++ } ++ gdb_breakpoint \ ++ "${::srcfile}:${::cond_bp_line} if (${cond_func} ())" ++ set cond_bp_num [get_integer_valueof "\$bpnum" "*UNKNOWN*" \ ++ "get number for conditional breakpoint"] ++ ++ if { $other_thread_signal } { ++ # Arrange for the other thread to raise a signal while GDB is ++ # evaluating the breakpoint condition. ++ gdb_test_no_output "set raise_signal = 1" ++ } else { ++ # And a breakpoint that will be hit by another thread only once the ++ # breakpoint condition starts to be evaluated. ++ gdb_breakpoint "${::srcfile}:${::other_bp_line}" ++ set other_bp_num [get_integer_valueof "\$bpnum" "*UNKNOWN*" \ ++ "get number for other breakpoint"] ++ } ++ ++ # A final breakpoint once the test has completed. ++ gdb_breakpoint "${::srcfile}:${::final_bp_line}" ++ set final_bp_num [get_integer_valueof "\$bpnum" "*UNKNOWN*" \ ++ "get number for final breakpoint"] ++ ++ if { $stop_at_cond } { ++ # Continue. The first breakpoint we hit should be the conditional ++ # breakpoint. The other thread will have hit its breakpoint, but ++ # that will have been deferred until the conditional breakpoint is ++ # reported. ++ gdb_test "continue" \ ++ [multi_line \ ++ "Continuing\\." \ ++ ".*" \ ++ "" \ ++ "Thread ${::decimal} \"\[^\"\r\n\]+\" hit Breakpoint ${cond_bp_num}, worker_func \[^\r\n\]+:${::cond_bp_line}" \ ++ "${::decimal}\\s+\[^\r\n\]+First thread breakpoint\[^\r\n\]+"] \ ++ "hit the conditional breakpoint" ++ } ++ ++ if { $other_thread_signal } { ++ # Now continue again, the other thread will now report that it ++ # received a signal. ++ gdb_test "continue" \ ++ [multi_line \ ++ "Continuing\\." \ ++ ".*" \ ++ "Thread ${::decimal} \"\[^\"\r\n\]+\" received signal SIGSEGV, Segmentation fault\\." \ ++ "\\\[Switching to Thread \[^\r\n\]+\\\]" \ ++ "${::hex} in worker_func \[^\r\n\]+:${::signal_line}" \ ++ "${::decimal}\\s+\[^\r\n\]+Signal here\[^\r\n\]+"] \ ++ "received signal in other thread" ++ } else { ++ # Now continue again, the other thread will now report its ++ # breakpoint. ++ gdb_test "continue" \ ++ [multi_line \ ++ "Continuing\\." \ ++ ".*" \ ++ "" \ ++ "Thread ${::decimal} \"\[^\"\r\n\]+\" hit Breakpoint ${other_bp_num}, worker_func \[^\r\n\]+:${::other_bp_line}" \ ++ "${::decimal}\\s+\[^\r\n\]+Other thread breakpoint\[^\r\n\]+"] \ ++ "hit the breakpoint in other thread" ++ ++ # Run to the stop marker. ++ gdb_test "continue" \ ++ [multi_line \ ++ "Continuing\\." \ ++ ".*" \ ++ "" \ ++ "Thread ${::decimal} \"\[^\"\r\n\]+\" hit Breakpoint ${final_bp_num}, stop_marker \[^\r\n\]+:${::final_bp_line}" \ ++ "${::decimal}\\s+\[^\r\n\]+Final breakpoint here\[^\r\n\]+"] \ ++ "hit the final breakpoint" ++ } ++ ++ gdb_exit ++} ++ ++foreach_with_prefix target_async { "on" "off" } { ++ foreach_with_prefix target_non_stop { "on" "off" } { ++ foreach_with_prefix other_thread_signal { true false } { ++ foreach_with_prefix stop_at_cond { true false } { ++ run_condition_test $stop_at_cond $other_thread_signal \ ++ $target_async $target_non_stop ++ } ++ } ++ } ++} +diff --git a/gdb/testsuite/gdb.threads/infcall-from-bp-cond-simple.c b/gdb/testsuite/gdb.threads/infcall-from-bp-cond-simple.c +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.threads/infcall-from-bp-cond-simple.c +@@ -0,0 +1,89 @@ ++/* Copyright 2022-2024 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 ++ ++#define NUM_THREADS 3 ++ ++int ++is_matching_tid (int *tid_ptr, int tid_value) ++{ ++ return *tid_ptr == tid_value; ++} ++ ++int ++return_true () ++{ ++ return 1; ++} ++ ++int ++return_false () ++{ ++ return 0; ++} ++ ++int ++function_that_segfaults () ++{ ++ int *p = 0; ++ *p = 1; /* Segfault happens here. */ ++} ++ ++int ++function_with_breakpoint () ++{ ++ return 1; /* Nested breakpoint. */ ++} ++ ++void * ++worker_func (void *arg) ++{ ++ int a = 42; /* Breakpoint here. */ ++} ++ ++void ++stop_marker () ++{ ++ int b = 99; /* Stop marker. */ ++} ++ ++int ++main () ++{ ++ pthread_t threads[NUM_THREADS]; ++ int args[NUM_THREADS]; ++ ++ alarm (300); ++ ++ for (int i = 0; i < NUM_THREADS; i++) ++ { ++ args[i] = i; ++ pthread_create (&threads[i], NULL, worker_func, &args[i]); ++ } ++ ++ for (int i = 0; i < NUM_THREADS; i++) ++ { ++ void *retval; ++ pthread_join (threads[i], &retval); ++ } ++ ++ stop_marker (); ++ ++ return 0; ++} +diff --git a/gdb/testsuite/gdb.threads/infcall-from-bp-cond-simple.exp b/gdb/testsuite/gdb.threads/infcall-from-bp-cond-simple.exp +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.threads/infcall-from-bp-cond-simple.exp +@@ -0,0 +1,235 @@ ++# Copyright 2022-2024 Free Software Foundation, Inc. ++ ++# This program is free software; you can 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 . ++ ++# Some simple tests of inferior function calls from breakpoint ++# conditions, in multi-threaded inferiors. ++# ++# This test sets up a multi-threaded inferior, and places a breakpoint ++# at a location that many of the threads will reach. We repeat the ++# test with different conditions, sometimes a single thread should ++# stop at the breakpoint, sometimes multiple threads should stop, and ++# sometimes no threads should stop. ++ ++standard_testfile ++ ++if { [build_executable "failed to prepare" ${binfile} "${srcfile}" \ ++ {debug pthreads}] == -1 } { ++ return ++} ++ ++set cond_bp_line [gdb_get_line_number "Breakpoint here"] ++set stop_bp_line [gdb_get_line_number "Stop marker"] ++set nested_bp_line [gdb_get_line_number "Nested breakpoint"] ++set segv_line [gdb_get_line_number "Segfault happens here"] ++ ++# Start GDB based on TARGET_ASYNC and TARGET_NON_STOP, and then runto main. ++proc start_gdb_and_runto_main { target_async target_non_stop } { ++ save_vars { ::GDBFLAGS } { ++ append ::GDBFLAGS \ ++ " -ex \"maint set target-non-stop $target_non_stop\"" ++ append ::GDBFLAGS \ ++ " -ex \"maintenance set target-async ${target_async}\"" ++ ++ clean_restart ${::binfile} ++ } ++ ++ if { ![runto_main] } { ++ return -1 ++ } ++ ++ return 0 ++} ++ ++# Run a test of GDB's conditional breakpoints, where the conditions include ++# inferior function calls. ++# ++# CONDITION is the expression to be used as the breakpoint condition. ++# ++# N_EXPECTED_HITS is the number of threads that we expect to stop due to ++# CONDITON. ++# ++# MESSAGE is used as a test name prefix. ++proc run_condition_test { message n_expected_hits condition \ ++ target_async target_non_stop } { ++ with_test_prefix $message { ++ ++ if { [start_gdb_and_runto_main $target_async \ ++ $target_non_stop] == -1 } { ++ return ++ } ++ ++ # Use this convenience variable to track how often the ++ # breakpoint condition has been evaluated. This should be ++ # once per thread. ++ gdb_test "set \$n_cond_eval = 0" ++ ++ # Setup the conditional breakpoint. ++ gdb_breakpoint \ ++ "${::srcfile}:${::cond_bp_line} if ((++\$n_cond_eval) && (${condition}))" ++ ++ # And a breakpoint that we hit when the test is over, this one is ++ # not conditional. Only the main thread gets here once all the ++ # other threads have finished. ++ gdb_breakpoint "${::srcfile}:${::stop_bp_line}" ++ ++ # The number of times we stop at the conditional breakpoint. ++ set n_hit_condition 0 ++ ++ # Now keep 'continue'-ing GDB until all the threads have finished ++ # and we reach the stop_marker breakpoint. ++ gdb_test_multiple "continue" "spot all breakpoint hits" { ++ -re " worker_func \[^\r\n\]+${::srcfile}:${::cond_bp_line}\r\n${::decimal}\\s+\[^\r\n\]+Breakpoint here\[^\r\n\]+\r\n${::gdb_prompt} $" { ++ incr n_hit_condition ++ send_gdb "continue\n" ++ exp_continue ++ } ++ ++ -re " stop_marker \[^\r\n\]+${::srcfile}:${::stop_bp_line}\r\n${::decimal}\\s+\[^\r\n\]+Stop marker\[^\r\n\]+\r\n${::gdb_prompt} $" { ++ pass $gdb_test_name ++ } ++ } ++ ++ gdb_assert { $n_hit_condition == $n_expected_hits } \ ++ "stopped at breakpoint the expected number of times" ++ ++ # Ensure the breakpoint condition was evaluated once per thread. ++ gdb_test "print \$n_cond_eval" "= 3" \ ++ "condition was evaluated in each thread" ++ } ++} ++ ++# Check that after handling a conditional breakpoint (where the condition ++# includes an inferior call), it is still possible to kill the running ++# inferior, and then restart the inferior. ++# ++# At once point doing this would result in GDB giving an assertion error. ++proc_with_prefix run_kill_and_restart_test { target_async target_non_stop } { ++ # This test relies on the 'start' command, which is not possible with ++ # the plain 'remote' target. ++ if { [target_info gdb_protocol] == "remote" } { ++ return ++ } ++ ++ if { [start_gdb_and_runto_main $target_async \ ++ $target_non_stop] == -1 } { ++ return ++ } ++ ++ # Setup the conditional breakpoint. ++ gdb_breakpoint \ ++ "${::srcfile}:${::cond_bp_line} if (is_matching_tid (arg, 1))" ++ gdb_continue_to_breakpoint "worker_func" ++ ++ # Now kill the program being debugged. ++ gdb_test "kill" "" "kill process" \ ++ "Kill the program being debugged.*y or n. $" "y" ++ ++ # Check we can restart the inferior. At one point this would trigger an ++ # assertion. ++ gdb_start_cmd ++} ++ ++# Create a conditional breakpoint which includes a call to a function that ++# segfaults. Run GDB and check what happens when the inferior segfaults ++# during the inferior call. ++proc_with_prefix run_bp_cond_segfaults { target_async target_non_stop } { ++ if { [start_gdb_and_runto_main $target_async \ ++ $target_non_stop] == -1 } { ++ return ++ } ++ ++ # This test relies on the inferior segfaulting when trying to ++ # access address zero. ++ if { [is_address_zero_readable] } { ++ return ++ } ++ ++ # Setup the conditional breakpoint, include a call to ++ # 'function_that_segfaults', which triggers the segfault. ++ gdb_breakpoint \ ++ "${::srcfile}:${::cond_bp_line} if (is_matching_tid (arg, 0) && function_that_segfaults ())" ++ set bp_1_num [get_integer_valueof "\$bpnum" "*UNKNOWN*" \ ++ "get number of conditional breakpoint"] ++ ++ gdb_test "continue" \ ++ [multi_line \ ++ "Continuing\\." \ ++ ".*" \ ++ "Thread ${::decimal} \"infcall-from-bp\" received signal SIGSEGV, Segmentation fault\\." \ ++ "${::hex} in function_that_segfaults \\(\\) at \[^\r\n\]+:${::segv_line}" \ ++ "${::decimal}\\s+\[^\r\n\]+Segfault happens here\[^\r\n\]+" \ ++ "Error in testing condition for breakpoint ${bp_1_num}:" \ ++ "The program being debugged was signaled while in a function called from GDB\\." \ ++ "GDB remains in the frame where the signal was received\\." \ ++ "To change this behavior use \"set unwindonsignal on\"\\." \ ++ "Evaluation of the expression containing the function" \ ++ "\\(function_that_segfaults\\) will be abandoned\\." \ ++ "When the function is done executing, GDB will silently stop\\."] ++} ++ ++# Create a conditional breakpoint which includes a call to a function that ++# itself has a breakpoint set within it. Run GDB and check what happens ++# when GDB hits the nested breakpoint. ++proc_with_prefix run_bp_cond_hits_breakpoint { target_async target_non_stop } { ++ if { [start_gdb_and_runto_main $target_async \ ++ $target_non_stop] == -1 } { ++ return ++ } ++ ++ # Setup the conditional breakpoint, include a call to ++ # 'function_with_breakpoint' in which we will shortly place a ++ # breakpoint. ++ gdb_breakpoint \ ++ "${::srcfile}:${::cond_bp_line} if (is_matching_tid (arg, 0) && function_with_breakpoint ())" ++ set bp_1_num [get_integer_valueof "\$bpnum" "*UNKNOWN*" \ ++ "get number of conditional breakpoint"] ++ ++ gdb_breakpoint "${::srcfile}:${::nested_bp_line}" ++ set bp_2_num [get_integer_valueof "\$bpnum" "*UNKNOWN*" \ ++ "get number of nested breakpoint"] ++ ++ gdb_test "continue" \ ++ [multi_line \ ++ "Continuing\\." \ ++ ".*" \ ++ "Thread ${::decimal} \"infcall-from-bp\" hit Breakpoint ${bp_2_num}, function_with_breakpoint \\(\\) at \[^\r\n\]+:${::nested_bp_line}" \ ++ "${::decimal}\\s+\[^\r\n\]+Nested breakpoint\[^\r\n\]+" \ ++ "Error in testing condition for breakpoint ${bp_1_num}:" \ ++ "The program being debugged stopped while in a function called from GDB\\." \ ++ "Evaluation of the expression containing the function" \ ++ "\\(function_with_breakpoint\\) will be abandoned\\." \ ++ "When the function is done executing, GDB will silently stop\\."] ++} ++ ++foreach_with_prefix target_async { "on" "off" } { ++ foreach_with_prefix target_non_stop { "on" "off" } { ++ run_condition_test "exactly one thread is hit" \ ++ 1 "is_matching_tid (arg, 1)" \ ++ $target_async $target_non_stop ++ run_condition_test "exactly two threads are hit" \ ++ 2 "(is_matching_tid (arg, 0) || is_matching_tid (arg, 2))" \ ++ $target_async $target_non_stop ++ run_condition_test "all three threads are hit" \ ++ 3 "return_true ()" \ ++ $target_async $target_non_stop ++ run_condition_test "no thread is hit" \ ++ 0 "return_false ()" \ ++ $target_async $target_non_stop ++ ++ run_kill_and_restart_test $target_async $target_non_stop ++ run_bp_cond_segfaults $target_async $target_non_stop ++ run_bp_cond_hits_breakpoint $target_async $target_non_stop ++ } ++} +diff --git a/gdb/testsuite/gdb.threads/infcall-from-bp-cond-single.c b/gdb/testsuite/gdb.threads/infcall-from-bp-cond-single.c +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.threads/infcall-from-bp-cond-single.c +@@ -0,0 +1,139 @@ ++/* Copyright 2022-2024 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 ++#include ++#include ++ ++#define NUM_THREADS 5 ++ ++/* Semaphores, used to track when threads have started, and to control ++ when the threads finish. */ ++sem_t startup_semaphore; ++sem_t finish_semaphore; ++ ++/* Mutex to control when the first worker thread hit a breakpoint ++ location. */ ++pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; ++ ++/* Global variable to poke, just so threads have something to do. */ ++volatile int global_var = 0; ++ ++int ++return_true () ++{ ++ return 1; ++} ++ ++int ++return_false () ++{ ++ return 0; ++} ++ ++void * ++worker_func (void *arg) ++{ ++ int tid = *((int *) arg); ++ ++ switch (tid) ++ { ++ case 0: ++ /* Wait for MUTEX to become available, then pass through the ++ conditional breakpoint location. */ ++ if (pthread_mutex_lock (&mutex) != 0) ++ abort (); ++ global_var = 99; /* Conditional breakpoint here. */ ++ if (pthread_mutex_unlock (&mutex) != 0) ++ abort (); ++ break; ++ ++ default: ++ /* Notify the main thread that the thread has started, then wait for ++ the main thread to tell us to finish. */ ++ sem_post (&startup_semaphore); ++ if (sem_wait (&finish_semaphore) != 0) ++ abort (); ++ break; ++ } ++} ++ ++void ++stop_marker () ++{ ++ global_var = 99; /* Stop marker. */ ++} ++ ++int ++main () ++{ ++ pthread_t threads[NUM_THREADS]; ++ int args[NUM_THREADS]; ++ void *retval; ++ ++ /* An alarm, just in case the thread deadlocks. */ ++ alarm (300); ++ ++ /* Semaphore initialization. */ ++ if (sem_init (&startup_semaphore, 0, 0) != 0) ++ abort (); ++ if (sem_init (&finish_semaphore, 0, 0) != 0) ++ abort (); ++ ++ /* Lock MUTEX, this prevents the first worker thread from rushing ahead. */ ++ if (pthread_mutex_lock (&mutex) != 0) ++ abort (); ++ ++ /* Worker thread creation. */ ++ for (int i = 0; i < NUM_THREADS; i++) ++ { ++ args[i] = i; ++ pthread_create (&threads[i], NULL, worker_func, &args[i]); ++ } ++ ++ /* Wait for every thread (other than the first) to tell us it has started ++ up. */ ++ for (int i = 1; i < NUM_THREADS; i++) ++ { ++ if (sem_wait (&startup_semaphore) != 0) ++ abort (); ++ } ++ ++ /* Unlock the first thread so it can proceed. */ ++ if (pthread_mutex_unlock (&mutex) != 0) ++ abort (); ++ ++ /* Wait for the first thread only. */ ++ pthread_join (threads[0], &retval); ++ ++ /* Now post FINISH_SEMAPHORE to allow all the other threads to finish. */ ++ for (int i = 1; i < NUM_THREADS; i++) ++ sem_post (&finish_semaphore); ++ ++ /* Now wait for the remaining threads to complete. */ ++ for (int i = 1; i < NUM_THREADS; i++) ++ pthread_join (threads[i], &retval); ++ ++ /* Semaphore cleanup. */ ++ sem_destroy (&finish_semaphore); ++ sem_destroy (&startup_semaphore); ++ ++ stop_marker (); ++ ++ return 0; ++} +diff --git a/gdb/testsuite/gdb.threads/infcall-from-bp-cond-single.exp b/gdb/testsuite/gdb.threads/infcall-from-bp-cond-single.exp +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.threads/infcall-from-bp-cond-single.exp +@@ -0,0 +1,117 @@ ++# Copyright 2022-2024 Free Software Foundation, Inc. ++ ++# This program is free software; you can 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 reprocuces bug gdb/28942, performing an inferior function ++# call from a breakpoint condition in a multi-threaded inferior. ++# ++# The important part of this test is that, when the conditional ++# breakpoint is hit, and the condition (which includes an inferior ++# function call) is evaluated, the other threads are running. ++ ++standard_testfile ++ ++if { [build_executable "failed to prepare" ${binfile} "${srcfile}" \ ++ {debug pthreads}] == -1 } { ++ return ++} ++ ++set cond_bp_line [gdb_get_line_number "Conditional breakpoint here"] ++set final_bp_line [gdb_get_line_number "Stop marker"] ++ ++# Start GDB based on TARGET_ASYNC and TARGET_NON_STOP, and then runto main. ++proc start_gdb_and_runto_main { target_async target_non_stop } { ++ save_vars { ::GDBFLAGS } { ++ append ::GDBFLAGS \ ++ " -ex \"maint set target-non-stop $target_non_stop\"" ++ append ::GDBFLAGS \ ++ " -ex \"maintenance set target-async ${target_async}\"" ++ ++ clean_restart ${::binfile} ++ } ++ ++ if { ![runto_main] } { ++ return -1 ++ } ++ ++ return 0 ++} ++ ++# Run a test of GDB's conditional breakpoints, where the conditions include ++# inferior function calls. ++# ++# TARGET_ASYNC and TARGET_NON_STOP are used when starting up GDB. ++# ++# When STOP_AT_COND is true the breakpoint condtion will evaluate to ++# true, and GDB will stop at the breakpoint. Otherwise, the ++# breakpoint condition will evaluate to false and GDB will not stop at ++# the breakpoint. ++proc run_condition_test { stop_at_cond \ ++ target_async target_non_stop } { ++ if { [start_gdb_and_runto_main $target_async \ ++ $target_non_stop] == -1 } { ++ return ++ } ++ ++ # Setup the conditional breakpoint. ++ if { $stop_at_cond } { ++ set cond_func "return_true" ++ } else { ++ set cond_func "return_false" ++ } ++ gdb_breakpoint \ ++ "${::srcfile}:${::cond_bp_line} if (${cond_func} ())" ++ set cond_bp_num [get_integer_valueof "\$bpnum" "*UNKNOWN*" \ ++ "get number for conditional breakpoint"] ++ ++ # And a breakpoint that we hit when the test is over, this one is ++ # not conditional. ++ gdb_breakpoint "${::srcfile}:${::final_bp_line}" ++ set final_bp_num [get_integer_valueof "\$bpnum" "*UNKNOWN*" \ ++ "get number for final breakpoint"] ++ ++ if { $stop_at_cond } { ++ # Continue. The first breakpoint we hit should be the conditional ++ # breakpoint. The other thread will have hit its breakpoint, but ++ # that will have been deferred until the conditional breakpoint is ++ # reported. ++ gdb_test "continue" \ ++ [multi_line \ ++ "Continuing\\." \ ++ ".*" \ ++ "" \ ++ "Thread ${::decimal} \"\[^\"\r\n\]+\" hit Breakpoint ${cond_bp_num}, worker_func \[^\r\n\]+:${::cond_bp_line}" \ ++ "${::decimal}\\s+\[^\r\n\]+Conditional breakpoint here\[^\r\n\]+"] \ ++ "hit the conditional breakpoint" ++ } ++ ++ # Run to the stop marker. ++ gdb_test "continue" \ ++ [multi_line \ ++ "Continuing\\." \ ++ ".*" \ ++ "" \ ++ "Thread ${::decimal} \"\[^\"\r\n\]+\" hit Breakpoint ${final_bp_num}, stop_marker \[^\r\n\]+:${::final_bp_line}" \ ++ "${::decimal}\\s+\[^\r\n\]+Stop marker\[^\r\n\]+"] \ ++ "hit the final breakpoint" ++} ++ ++foreach_with_prefix target_async { "on" "off" } { ++ foreach_with_prefix target_non_stop { "on" "off" } { ++ foreach_with_prefix stop_at_cond { true false } { ++ run_condition_test $stop_at_cond \ ++ $target_async $target_non_stop ++ } ++ } ++} diff --git a/gdb-rhel-13298-inferior-funcall-bp-condition-3-of-5.patch b/gdb-rhel-13298-inferior-funcall-bp-condition-3-of-5.patch new file mode 100644 index 0000000..3087f1d --- /dev/null +++ b/gdb-rhel-13298-inferior-funcall-bp-condition-3-of-5.patch @@ -0,0 +1,1148 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Andrew Burgess +Date: Fri, 7 Oct 2022 12:39:07 +0100 +Subject: gdb-rhel-13298-inferior-funcall-bp-condition-3-of-5.patch + +;;gdb: add timeouts for inferior function calls +;;(Andrew Burgess, RHEL-13298) + +In the previous commits I have been working on improving inferior +function call support. One thing that worries me about using inferior +function calls from a conditional breakpoint is: what happens if the +inferior function call fails? + +If the failure is obvious, e.g. the thread performing the call +crashes, or hits a breakpoint, then this case is already well handled, +and the error is reported to the user. + +But what if the thread performing the inferior call just deadlocks? +If the user made the call from a 'print' or 'call' command, then the +user might have some expectation of when the function call should +complete, and, when this time limit is exceeded, the user +will (hopefully) interrupt GDB and regain control of the debug +session. + +But, when the inferior function call is from a breakpoint condition it +is much harder to understand that GDB is deadlocked within an inferior +call. Maybe the breakpoint hasn't been hit yet? Or maybe the +condition was always false? Or maybe GDB is deadlocked in an inferior +call? The only way to know for sure is for the user to periodically +interrupt the inferior, check on the state of all the threads, and +then continue. + +Additionally, the focus of the previous commit was inferior function +calls, from a conditional breakpoint, in a multi-threaded inferior. +This opens up a whole new set of potential failure conditions. For +example, what if the function called relies on interaction with some +other thread, and the other thread crashes? Or hits a breakpoint? +Given how inferior function calls work (in a synchronous manner), a +stop event in some other thread is going to be ignored while the +inferior function call is being executed as part of a breakpoint +condition, and this means that GDB could get stuck waiting for the +original condition thread, which will now never complete. + +In this commit I propose a solution to this problem. A timeout. For +targets that support async-mode we can install an event-loop timer +before starting the inferior function call. When the timer expires we +will stop the thread performing the inferior function call. With this +mechanism in place a user can be sure that any inferior call they make +will either complete, or timeout eventually. + +Adding a timer like this is obviously a change in behaviour for the +more common 'call' and 'print' uses of inferior function calls, so, in +this patch, I propose having two different timers. One I call the +'direct-call-timeout', which is used for 'call' and 'print' commands. +This timeout is by default set to unlimited, which, not surprisingly, +means there is no timeout in place. + +A second timer, which I've called 'indirect-call-timeout', is used for +inferior function calls from breakpoint conditions. This timeout has +a default value of 30 seconds. This is a reasonably long time to +wait, and hopefully should be enough in most cases to allow the +inferior call to complete. An inferior call that takes more than 30 +seconds, which is installed on a breakpoint condition is really going +to slow down the debug session, so hopefully this is not a common use +case. + +The user is, of course, free to reduce, or increase the timeout value, +and can always use Ctrl-c to interrupt an inferior function call, but +this timeout will ensure that GDB will stop at some point. + +The new commands added by this commit are: + + set direct-call-timeout SECONDS + show direct-call-timeout + set indirect-call-timeout SECONDS + show indirect-call-timeout + +These new timeouts do depend on async-mode, so, if async-mode is +disabled (maint set target-async off), or not supported (e.g. target +sim), then the timeout is treated as unlimited (that is, no timeout is +set). + +For targets that "fake" non-async mode, e.g. Linux native, where +non-async mode is really just async mode, but then we park the target +in a sissuspend, we could easily fix things so that the timeouts still +work, however, for targets that really are not async aware, like the +simulator, fixing things so that timeouts work correctly would be a +much bigger task - that effort would be better spent just making the +target async-aware. And so, I'm happy for now that this feature will +only work on async targets. + +The two new show commands will display slightly different text if the +current target is a non-async target, which should allow users to +understand what's going on. + +There's a somewhat random test adjustment needed in gdb.base/help.exp, +the test uses a regexp with the apropos command, and expects to find a +single result. Turns out the new settings I added also matched the +regexp, which broke the test. I've updated the regexp a little to +exclude my new settings. + +Reviewed-By: Tankut Baris Aktemur +Reviewed-By: Eli Zaretskii +Tested-By: Luis Machado +Tested-By: Keith Seitz + +diff --git a/gdb/NEWS b/gdb/NEWS +--- a/gdb/NEWS ++++ b/gdb/NEWS +@@ -1,6 +1,179 @@ + What has changed in GDB? + (Organized release by release) + ++*** Changes since GDB 14 ++ ++* The MPX commands "show/set mpx bound" have been deprecated, as Intel ++ listed MPX as removed in 2019. ++ ++* Building GDB and GDBserver now requires a C++17 compiler. ++ For example, GCC 9 or later. ++ ++* GDB index now contains information about the main function. This speeds up ++ startup when it is being used for some large binaries. ++ ++* On hosts where threading is available, DWARF reading is now done in ++ the background, resulting in faster startup. This can be controlled ++ using "maint set dwarf synchronous". ++ ++* Changed commands ++ ++disassemble ++ Attempting to use both the 'r' and 'b' flags with the disassemble ++ command will now give an error. Previously the 'b' flag would ++ always override the 'r' flag. ++ ++gcore ++generate-core-file ++ GDB now generates sparse core files, on systems that support it. ++ ++maintenance info line-table ++ Add an EPILOGUE-BEGIN column to the output of the command. It indicates ++ if the line is considered the start of the epilgoue, and thus a point at ++ which the frame can be considered destroyed. ++ ++* New commands ++ ++info missing-debug-handler ++ List all the registered missing debug handlers. ++ ++enable missing-debug-handler LOCUS HANDLER ++disable missing-debug-handler LOCUS HANDLER ++ Enable or disable a missing debug handler with a name matching the ++ regular expression HANDLER, in LOCUS. ++ ++ LOCUS can be 'global' to operate on global missing debug handler, ++ 'progspace' to operate on handlers within the current program space, ++ or can be a regular expression which is matched against the filename ++ of the primary executable in each program space. ++ ++maintenance info linux-lwps ++ List all LWPs under control of the linux-nat target. ++ ++set remote thread-options-packet ++show remote thread-options-packet ++ Set/show the use of the thread options packet. ++ ++set direct-call-timeout SECONDS ++show direct-call-timeout ++set indirect-call-timeout SECONDS ++show indirect-call-timeout ++ These new settings can be used to limit how long GDB will wait for ++ an inferior function call to complete. The direct timeout is used ++ for inferior function calls from e.g. 'call' and 'print' commands, ++ while the indirect timeout is used for inferior function calls from ++ within a conditional breakpoint expression. ++ ++ The default for the direct timeout is unlimited, while the default ++ for the indirect timeout is 30 seconds. ++ ++ These timeouts will only have an effect for targets that are ++ operating in async mode. For non-async targets the timeouts are ++ ignored, GDB will wait indefinitely for an inferior function to ++ complete, unless interrupted by the user using Ctrl-C. ++ ++* New features in the GDB remote stub, GDBserver ++ ++ ** The --remote-debug and --event-loop-debug command line options ++ have been removed. ++ ++ ** The --debug command line option now takes an optional comma ++ separated list of components to emit debug for. The currently ++ supported components are: all, threads, event-loop, and remote. ++ If no components are given then threads is assumed. ++ ++ ** The 'monitor set remote-debug' and 'monitor set event-loop-debug' ++ command have been removed. ++ ++ ** The 'monitor set debug 0|1' command has been extended to take a ++ component name, e.g.: 'monitor set debug COMPONENT off|on'. ++ Possible component names are: all, threads, event-loop, and ++ remote. ++ ++* Python API ++ ++ ** New function gdb.notify_mi(NAME, DATA), that emits custom ++ GDB/MI async notification. ++ ++ ** New read/write attribute gdb.Value.bytes that contains a bytes ++ object holding the contents of this value. ++ ++ ** New module gdb.missing_debug that facilitates dealing with ++ objfiles that are missing any debug information. ++ ++ ** New function gdb.missing_debug.register_handler that can register ++ an instance of a sub-class of gdb.missing_debug.MissingDebugInfo ++ as a handler for objfiles that are missing debug information. ++ ++ ** New class gdb.missing_debug.MissingDebugInfo which can be ++ sub-classed to create handlers for objfiles with missing debug ++ information. ++ ++ ** Stop events now have a "details" attribute that holds a ++ dictionary that carries the same information as an MI "*stopped" ++ event. ++ ++ ** New function gdb.interrupt(), that interrupts GDB as if the user ++ typed control-c. ++ ++ ** New gdb.InferiorThread.ptid_string attribute. This read-only ++ attribute contains the string that appears in the 'Target Id' ++ column of the 'info threads' command output. ++ ++ ** It is no longer possible to create new gdb.Progspace object using ++ 'gdb.Progspace()', this will result in a TypeError. Progspace ++ objects can still be obtained through calling other API ++ functions, for example 'gdb.current_progspace()'. ++ ++ ** User defined attributes can be added to a gdb.Inferior object, ++ these will be stored in the object's new Inferior.__dict__ ++ attribute. ++ ++ ** User defined attributes can be added to a gdb.InferiorThread ++ object, these will be stored in the object's new ++ InferiorThread.__dict__ attribute. ++ ++ ** New constants gdb.SYMBOL_TYPE_DOMAIN, gdb.SYMBOL_FUNCTION_DOMAIN, ++ and gdb.SEARCH_*_DOMAIN corresponding to all the existing symbol ++ domains. Symbol lookup can now search in multiple domains at ++ once, and can also narrowly search for just a type or function. ++ ++* Debugger Adapter Protocol changes ++ ++ ** GDB now emits the "process" event. ++ ++ ** GDB now supports the "cancel" request. ++ ++ ** The "attach" request now supports specifying the program. ++ ++ ** New command "set debug dap-log-level" controls DAP logging. ++ ++ ** The "set debug dap-log-file" command is now documented. This ++ command was available in GDB 14 but not documented. ++ ++* Guile API ++ ++ ** New constants SYMBOL_TYPE_DOMAIN, SYMBOL_FUNCTION_DOMAIN, and ++ SEARCH_*_DOMAIN corresponding to all the existing symbol domains. ++ Symbol lookup can now search in multiple domains at once, and can ++ also narrowly search for just a type or function. ++ ++* New remote packets ++ ++New stop reason: clone ++ Indicates that a clone system call was executed. ++ ++QThreadOptions ++ Enable/disable optional event reporting, on a per-thread basis. ++ Currently supported options are GDB_THREAD_OPTION_CLONE, to enable ++ clone event reporting, and GDB_THREAD_OPTION_EXIT to enable thread ++ exit event reporting. ++ ++QThreadOptions in qSupported ++ The qSupported packet allows GDB to inform the stub it supports the ++ QThreadOptions packet, and the qSupported response can contain the ++ set of thread options the remote stub supports. ++ + *** Changes in GDB 14 + + * GDB now supports the AArch64 Scalable Matrix Extension 2 (SME2), which +diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo +--- a/gdb/doc/gdb.texinfo ++++ b/gdb/doc/gdb.texinfo +@@ -20987,6 +20987,72 @@ to resume the inferior (using commands like @code{continue}, + @code{step}, etc). In this case, when the inferior finally returns to + the dummy-frame, @value{GDBN} will once again halt the inferior. + ++On targets that support asynchronous execution (@pxref{Background ++Execution}) @value{GDBN} can place a timeout on any functions called ++from @value{GDBN}. If the timeout expires and the function call is ++still ongoing, then @value{GDBN} will interrupt the program. ++ ++For targets that don't support asynchronous execution ++(@pxref{Background Execution}) then timeouts for functions called from ++@value{GDBN} are not supported, the timeout settings described below ++will be treated as @code{unlimited}, meaning @value{GDBN} will wait ++indefinitely for function call to complete, unless interrupted by the ++user using @kbd{Ctrl-C}. ++ ++@table @code ++@item set direct-call-timeout @var{seconds} ++@kindex set direct-call-timeout ++@cindex timeout for called functions ++Set the timeout used when calling functions in the program to ++@var{seconds}, which should be an integer greater than zero, or the ++special value @code{unlimited}, which indicates no timeout should be ++used. The default for this setting is @code{unlimited}. ++ ++This setting is used when the user calls a function directly from the ++command prompt, for example with a @code{call} or @code{print} ++command. ++ ++This setting only works for targets that support asynchronous ++execution (@pxref{Background Execution}), for any other target the ++setting is treated as @code{unlimited}. ++ ++@item show direct-call-timeout ++@kindex show direct-call-timeout ++@cindex timeout for called functions ++Show the timeout used when calling functions in the program with a ++@code{call} or @code{print} command. ++@end table ++ ++It is also possible to call functions within the program from the ++condition of a conditional breakpoint (@pxref{Conditions, ,Break ++Conditions}). A different setting controls the timeout used for ++function calls made from a breakpoint condition. ++ ++@table @code ++@item set indirect-call-timeout @var{seconds} ++@kindex set indirect-call-timeout ++@cindex timeout for called functions ++Set the timeout used when calling functions in the program from a ++breakpoint or watchpoint condition to @var{seconds}, which should be ++an integer greater than zero, or the special value @code{unlimited}, ++which indicates no timeout should be used. The default for this ++setting is @code{30} seconds. ++ ++This setting only works for targets that support asynchronous ++execution (@pxref{Background Execution}), for any other target the ++setting is treated as @code{unlimited}. ++ ++If a function called from a breakpoint or watchpoint condition times ++out, then @value{GDBN} will stop at the point where the timeout ++occurred. The breakpoint condition evaluation will be abandoned. ++ ++@item show indirect-call-timeout ++@kindex show indirect-call-timeout ++@cindex timeout for called functions ++Show the timeout used when calling functions in the program from a ++breakpoint or watchpoint condition. ++@end table ++ + @subsection Calling functions with no debug info + + @cindex no debug info functions +diff --git a/gdb/infcall.c b/gdb/infcall.c +--- a/gdb/infcall.c ++++ b/gdb/infcall.c +@@ -96,6 +96,53 @@ show_may_call_functions_p (struct ui_file *file, int from_tty, + value); + } + ++/* A timeout (in seconds) for direct inferior calls. A direct inferior ++ call is one the user triggers from the prompt, e.g. with a 'call' or ++ 'print' command. Compare with the definition of indirect calls below. */ ++ ++static unsigned int direct_call_timeout = UINT_MAX; ++ ++/* Implement 'show direct-call-timeout'. */ ++ ++static void ++show_direct_call_timeout (struct ui_file *file, int from_tty, ++ struct cmd_list_element *c, const char *value) ++{ ++ if (target_has_execution () && !target_can_async_p ()) ++ gdb_printf (file, _("Current target does not support async mode, timeout " ++ "for direct inferior calls is \"unlimited\".\n")); ++ else if (direct_call_timeout == UINT_MAX) ++ gdb_printf (file, _("Timeout for direct inferior function calls " ++ "is \"unlimited\".\n")); ++ else ++ gdb_printf (file, _("Timeout for direct inferior function calls " ++ "is \"%s seconds\".\n"), value); ++} ++ ++/* A timeout (in seconds) for indirect inferior calls. An indirect inferior ++ call is one that originates from within GDB, for example, when ++ evaluating an expression for a conditional breakpoint. Compare with ++ the definition of direct calls above. */ ++ ++static unsigned int indirect_call_timeout = 30; ++ ++/* Implement 'show indirect-call-timeout'. */ ++ ++static void ++show_indirect_call_timeout (struct ui_file *file, int from_tty, ++ struct cmd_list_element *c, const char *value) ++{ ++ if (target_has_execution () && !target_can_async_p ()) ++ gdb_printf (file, _("Current target does not support async mode, timeout " ++ "for indirect inferior calls is \"unlimited\".\n")); ++ else if (indirect_call_timeout == UINT_MAX) ++ gdb_printf (file, _("Timeout for indirect inferior function calls " ++ "is \"unlimited\".\n")); ++ else ++ gdb_printf (file, _("Timeout for indirect inferior function calls " ++ "is \"%s seconds\".\n"), value); ++} ++ + /* How you should pass arguments to a function depends on whether it + was defined in K&R style or prototype style. If you define a + function using the K&R syntax that takes a `float' argument, then +@@ -620,6 +667,85 @@ call_thread_fsm::should_notify_stop () + return true; + } + ++/* A class to control creation of a timer that will interrupt a thread ++ during an inferior call. */ ++struct infcall_timer_controller ++{ ++ /* Setup an event-loop timer that will interrupt PTID if the inferior ++ call takes too long. DIRECT_CALL_P is true when this inferior call is ++ a result of the user using a 'print' or 'call' command, and false when ++ this inferior call is a result of e.g. a conditional breakpoint ++ expression, this is used to select which timeout to use. */ ++ infcall_timer_controller (thread_info *thr, bool direct_call_p) ++ : m_thread (thr) ++ { ++ unsigned int timeout ++ = direct_call_p ? direct_call_timeout : indirect_call_timeout; ++ if (timeout < UINT_MAX && target_can_async_p ()) ++ { ++ int ms = timeout * 1000; ++ int id = create_timer (ms, infcall_timer_controller::timed_out, this); ++ m_timer_id.emplace (id); ++ infcall_debug_printf ("Setting up infcall timeout timer for " ++ "ptid %s: %d milliseconds", ++ m_thread->ptid.to_string ().c_str (), ms); ++ } ++ } ++ ++ /* Destructor. Ensure that the timer is removed from the event loop. */ ++ ~infcall_timer_controller () ++ { ++ /* If the timer has already triggered, then it will have already been ++ deleted from the event loop. If the timer has not triggered, then ++ delete it now. */ ++ if (m_timer_id.has_value () && !m_triggered) ++ delete_timer (*m_timer_id); ++ ++ /* Just for clarity, discard the timer id now. */ ++ m_timer_id.reset (); ++ } ++ ++ /* Return true if there was a timer in place, and the timer triggered, ++ otherwise, return false. */ ++ bool triggered_p () ++ { ++ gdb_assert (!m_triggered || m_timer_id.has_value ()); ++ return m_triggered; ++ } ++ ++private: ++ /* The thread we should interrupt. */ ++ thread_info *m_thread; ++ ++ /* Set true when the timer is triggered. */ ++ bool m_triggered = false; ++ ++ /* Given a value when a timer is in place. */ ++ gdb::optional m_timer_id; ++ ++ /* Callback for the timer, forwards to ::trigger below. */ ++ static void ++ timed_out (gdb_client_data context) ++ { ++ infcall_timer_controller *ctrl ++ = static_cast (context); ++ ctrl->trigger (); ++ } ++ ++ /* Called when the timer goes off. Stop thread M_THREAD. */ ++ void ++ trigger () ++ { ++ m_triggered = true; ++ ++ scoped_disable_commit_resumed disable_commit_resumed ("infcall timeout"); ++ ++ infcall_debug_printf ("Stopping thread %s", ++ m_thread->ptid.to_string ().c_str ()); ++ target_stop (m_thread->ptid); ++ } ++}; ++ + /* Subroutine of call_function_by_hand to simplify it. + Start up the inferior and wait for it to stop. + Return the exception if there's an error, or an exception with +@@ -630,13 +756,15 @@ call_thread_fsm::should_notify_stop () + + static struct gdb_exception + run_inferior_call (std::unique_ptr sm, +- struct thread_info *call_thread, CORE_ADDR real_pc) ++ struct thread_info *call_thread, CORE_ADDR real_pc, ++ bool *timed_out_p) + { + INFCALL_SCOPED_DEBUG_ENTER_EXIT; + + struct gdb_exception caught_error; + ptid_t call_thread_ptid = call_thread->ptid; + int was_running = call_thread->state == THREAD_RUNNING; ++ *timed_out_p = false; + + infcall_debug_printf ("call function at %s in thread %s, was_running = %d", + core_addr_to_string (real_pc), +@@ -681,11 +809,23 @@ run_inferior_call (std::unique_ptr sm, + infrun_debug_show_threads ("non-exited threads after proceed for inferior-call", + all_non_exited_threads ()); + ++ /* Setup a timer (if possible, and if the settings allow) to prevent ++ the inferior call running forever. */ ++ bool direct_call_p = !call_thread->control.in_cond_eval; ++ infcall_timer_controller infcall_timer (call_thread, direct_call_p); ++ + /* Inferior function calls are always synchronous, even if the + target supports asynchronous execution. */ + wait_sync_command_done (); + +- infcall_debug_printf ("inferior call completed successfully"); ++ /* If the timer triggered then the inferior call failed. */ ++ if (infcall_timer.triggered_p ()) ++ { ++ infcall_debug_printf ("inferior call timed out"); ++ *timed_out_p = true; ++ } ++ else ++ infcall_debug_printf ("inferior call completed successfully"); + } + catch (gdb_exception &e) + { +@@ -1357,6 +1497,10 @@ call_function_by_hand_dummy (struct value *function, + scoped_restore restore_stopped_by_random_signal + = make_scoped_restore (&stopped_by_random_signal, 0); + ++ /* Set to true by the call to run_inferior_call below if the inferior ++ call is artificially interrupted by GDB due to taking too long. */ ++ bool timed_out_p = false; ++ + /* - SNIP - SNIP - SNIP - SNIP - SNIP - SNIP - SNIP - SNIP - SNIP - + If you're looking to implement asynchronous dummy-frames, then + just below is the place to chop this function in two.. */ +@@ -1383,7 +1527,8 @@ call_function_by_hand_dummy (struct value *function, + struct_addr); + { + std::unique_ptr sm_up (sm); +- e = run_inferior_call (std::move (sm_up), call_thread.get (), real_pc); ++ e = run_inferior_call (std::move (sm_up), call_thread.get (), real_pc, ++ &timed_out_p); + } + + if (e.reason < 0) +@@ -1535,7 +1680,10 @@ When the function is done executing, GDB will silently stop."), + std::string name = get_function_name (funaddr, name_buf, + sizeof (name_buf)); + +- if (stopped_by_random_signal) ++ /* If the inferior call timed out then it will have been interrupted ++ by a signal, but we want to report this differently to the user, ++ which is done later in this function. */ ++ if (stopped_by_random_signal && !timed_out_p) + { + /* We stopped inside the FUNCTION because of a random + signal. Further execution of the FUNCTION is not +@@ -1586,6 +1734,36 @@ GDB remains in the frame where the signal was received.\n\ + To change this behavior use \"set unwindonsignal on\".\n\ + Evaluation of the expression containing the function\n\ + (%s) will be abandoned.\n\ ++When the function is done executing, GDB will silently stop."), ++ name.c_str ()); ++ } ++ } ++ ++ if (timed_out_p) ++ { ++ /* A timeout results in a signal being sent to the inferior. */ ++ gdb_assert (stopped_by_random_signal); ++ ++ /* Indentation is weird here. A later patch is going to move the ++ following block into an if/else, so I'm leaving the indentation ++ here to minimise the later patch. ++ ++ Also, the error message used below refers to 'set ++ unwind-on-timeout' which doesn't exist yet. This will be added ++ in a later commit, I'm leaving this in for now to minimise the ++ churn caused by the commit that adds unwind-on-timeout. */ ++ { ++ /* The user wants to stay in the frame where we stopped ++ (default). Discard inferior status, we're not at the same ++ point we started at. */ ++ discard_infcall_control_state (inf_status.release ()); ++ ++ error (_("\ ++The program being debugged timed out while in a function called from GDB.\n\ ++GDB remains in the frame where the timeout occurred.\n\ ++To change this behavior use \"set unwind-on-timeout on\".\n\ ++Evaluation of the expression containing the function\n\ ++(%s) will be abandoned.\n\ + When the function is done executing, GDB will silently stop."), + name.c_str ()); + } +@@ -1699,6 +1877,30 @@ The default is to unwind the frame."), + show_unwind_on_terminating_exception_p, + &setlist, &showlist); + ++ add_setshow_uinteger_cmd ("direct-call-timeout", no_class, ++ &direct_call_timeout, _("\ ++Set the timeout, for direct calls to inferior function calls."), _("\ ++Show the timeout, for direct calls to inferior function calls."), _("\ ++If running on a target that supports, and is running in, async mode\n\ ++then this timeout is used for any inferior function calls triggered\n\ ++directly from the prompt, i.e. from a 'call' or 'print' command. The\n\ ++timeout is specified in seconds."), ++ nullptr, ++ show_direct_call_timeout, ++ &setlist, &showlist); ++ ++ add_setshow_uinteger_cmd ("indirect-call-timeout", no_class, ++ &indirect_call_timeout, _("\ ++Set the timeout, for indirect calls to inferior function calls."), _("\ ++Show the timeout, for indirect calls to inferior function calls."), _("\ ++If running on a target that supports, and is running in, async mode\n\ ++then this timeout is used for any inferior function calls triggered\n\ ++indirectly, i.e. being made as part of a breakpoint, or watchpoint,\n\ ++condition expression. The timeout is specified in seconds."), ++ nullptr, ++ show_indirect_call_timeout, ++ &setlist, &showlist); ++ + add_setshow_boolean_cmd + ("infcall", class_maintenance, &debug_infcall, + _("Set inferior call debugging."), +diff --git a/gdb/testsuite/gdb.base/help.exp b/gdb/testsuite/gdb.base/help.exp +--- a/gdb/testsuite/gdb.base/help.exp ++++ b/gdb/testsuite/gdb.base/help.exp +@@ -121,7 +121,7 @@ gdb_test "help info bogus-gdb-command" "Undefined info command: \"bogus-gdb-comm + gdb_test "help gotcha" "Undefined command: \"gotcha\"\. Try \"help\"\." + + # Test apropos regex. +-gdb_test "apropos \\\(print\[\^\[ bsiedf\\\".-\]\\\)" "handle -- Specify how to handle signals\." ++gdb_test "apropos \\\(print\[\^\[ bsiedf\\\"'.-\]\\\)" "handle -- Specify how to handle signals\." + # Test apropos >1 word string. + gdb_test "apropos handle signal" "handle -- Specify how to handle signals\." + # Test apropos apropos. +diff --git a/gdb/testsuite/gdb.base/infcall-timeout.c b/gdb/testsuite/gdb.base/infcall-timeout.c +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.base/infcall-timeout.c +@@ -0,0 +1,36 @@ ++/* Copyright 2022-2024 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 ++ ++/* This function is called from GDB. */ ++int ++function_that_never_returns () ++{ ++ while (1) ++ sleep (1); ++ ++ return 0; ++} ++ ++int ++main () ++{ ++ alarm (300); ++ ++ return 0; ++} +diff --git a/gdb/testsuite/gdb.base/infcall-timeout.exp b/gdb/testsuite/gdb.base/infcall-timeout.exp +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.base/infcall-timeout.exp +@@ -0,0 +1,94 @@ ++# Copyright 2022-2024 Free Software Foundation, Inc. ++ ++# This program is free software; you can 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 GDB's direct-call-timeout setting, that is, ensure that if an ++# inferior function call, invoked from e.g. a 'print' command, takes ++# too long, then GDB can interrupt it, and return control to the user. ++ ++standard_testfile ++ ++if { [build_executable "failed to prepare" ${binfile} "${srcfile}" \ ++ {debug}] == -1 } { ++ return ++} ++ ++# Start GDB according to TARGET_ASYNC, TARGET_NON_STOP, and NON_STOP, ++# then adjust the direct-call-timeout, and make an inferior function ++# call that will never return. GDB should eventually timeout and stop ++# the inferior. ++proc run_test { target_async target_non_stop non_stop } { ++ save_vars { ::GDBFLAGS } { ++ append ::GDBFLAGS \ ++ " -ex \"maint set target-non-stop $target_non_stop\"" ++ append ::GDBFLAGS \ ++ " -ex \"set non-stop $non_stop\"" ++ append ::GDBFLAGS \ ++ " -ex \"maintenance set target-async ${target_async}\"" ++ ++ clean_restart ${::binfile} ++ } ++ ++ if {![runto_main]} { ++ return ++ } ++ ++ gdb_test_no_output "set direct-call-timeout 5" ++ ++ # When non-stop mode is off we get slightly different output from GDB. ++ if { ([target_info gdb_protocol] == "remote" ++ || [target_info gdb_protocol] == "extended-remote") ++ && !$target_non_stop } { ++ set stopped_line_pattern "Program received signal SIGINT, Interrupt\\." ++ } else { ++ set stopped_line_pattern "Program stopped\\." ++ } ++ ++ gdb_test "print function_that_never_returns ()" \ ++ [multi_line \ ++ $stopped_line_pattern \ ++ ".*" \ ++ "The program being debugged timed out while in a function called from GDB\\." \ ++ "GDB remains in the frame where the timeout occurred\\." \ ++ "To change this behavior use \"set unwind-on-timeout on\"\\." \ ++ "Evaluation of the expression containing the function" \ ++ "\\(function_that_never_returns\\) will be abandoned\\." \ ++ "When the function is done executing, GDB will silently stop\\."] ++ ++ gdb_test "bt" ".* function_that_never_returns .*.*" ++} ++ ++foreach_with_prefix target_async { "on" "off" } { ++ ++ if { !$target_async } { ++ # GDB can't timeout while waiting for a thread if the target ++ # runs with async-mode turned off; once the target is running ++ # GDB is effectively blocked until the target stops for some ++ # reason. ++ continue ++ } ++ ++ foreach_with_prefix target_non_stop { "on" "off" } { ++ foreach_with_prefix non_stop { "on" "off" } { ++ if { $non_stop && !$target_non_stop } { ++ # It doesn't make sense to operate GDB in non-stop ++ # mode when the target has (in theory) non-stop mode ++ # disabled. ++ continue ++ } ++ ++ run_test $target_async $target_non_stop $non_stop ++ } ++ } ++} +diff --git a/gdb/testsuite/gdb.threads/infcall-from-bp-cond-timeout.c b/gdb/testsuite/gdb.threads/infcall-from-bp-cond-timeout.c +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.threads/infcall-from-bp-cond-timeout.c +@@ -0,0 +1,169 @@ ++/* This testcase is part of GDB, the GNU debugger. ++ ++ Copyright 2022-2024 Free Software Foundation, Inc. ++ ++ This program is free software; you can 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 ++#include ++#include ++#include ++ ++#define NUM_THREADS 5 ++ ++/* Semaphores, used to track when threads have started, and to control ++ when the threads finish. */ ++sem_t startup_semaphore; ++sem_t finish_semaphore; ++sem_t thread_1_semaphore; ++sem_t thread_2_semaphore; ++ ++/* Mutex to control when the first worker thread hit a breakpoint ++ location. */ ++pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; ++ ++/* Global variable to poke, just so threads have something to do. */ ++volatile int global_var = 0; ++ ++int ++condition_func () ++{ ++ /* Let thread 2 run. */ ++ if (sem_post (&thread_2_semaphore) != 0) ++ abort (); ++ ++ /* Wait for thread 2 to complete its actions. */ ++ if (sem_wait (&thread_1_semaphore) != 0) ++ abort (); ++ ++ return 1; ++} ++ ++void ++do_segfault () ++{ ++ volatile int *p = 0; ++ *p = 0; /* Segfault here. */ ++} ++ ++void * ++worker_func (void *arg) ++{ ++ int tid = *((int *) arg); ++ ++ /* Let the main thread know that this worker has started. */ ++ if (sem_post (&startup_semaphore) != 0) ++ abort (); ++ ++ switch (tid) ++ { ++ case 0: ++ /* Wait for MUTEX to become available, then pass through the ++ conditional breakpoint location. */ ++ if (pthread_mutex_lock (&mutex) != 0) ++ abort (); ++ global_var = 99; /* Conditional breakpoint here. */ ++ if (pthread_mutex_unlock (&mutex) != 0) ++ abort (); ++ break; ++ ++ case 1: ++ if (sem_wait (&thread_2_semaphore) != 0) ++ abort (); ++ do_segfault (); ++ if (sem_post (&thread_1_semaphore) != 0) ++ abort (); ++ ++ /* Fall through. */ ++ default: ++ /* Wait until we are allowed to finish. */ ++ if (sem_wait (&finish_semaphore) != 0) ++ abort (); ++ break; ++ } ++} ++ ++void ++stop_marker () ++{ ++ global_var = 99; /* Stop marker. */ ++} ++ ++/* The main program entry point. */ ++ ++int ++main () ++{ ++ pthread_t threads[NUM_THREADS]; ++ int args[NUM_THREADS]; ++ void *retval; ++ ++ /* An alarm, just in case the thread deadlocks. */ ++ alarm (300); ++ ++ /* Semaphore initialization. */ ++ if (sem_init (&startup_semaphore, 0, 0) != 0) ++ abort (); ++ if (sem_init (&finish_semaphore, 0, 0) != 0) ++ abort (); ++ if (sem_init (&thread_1_semaphore, 0, 0) != 0) ++ abort (); ++ if (sem_init (&thread_2_semaphore, 0, 0) != 0) ++ abort (); ++ ++ /* Lock MUTEX, this prevents the first worker thread from rushing ahead. */ ++ if (pthread_mutex_lock (&mutex) != 0) ++ abort (); ++ ++ /* Worker thread creation. */ ++ for (int i = 0; i < NUM_THREADS; i++) ++ { ++ args[i] = i; ++ pthread_create (&threads[i], NULL, worker_func, &args[i]); ++ } ++ ++ /* Wait for every thread to start. */ ++ for (int i = 0; i < NUM_THREADS; i++) ++ { ++ if (sem_wait (&startup_semaphore) != 0) ++ abort (); ++ } ++ ++ /* Unlock the first thread so it can proceed. */ ++ if (pthread_mutex_unlock (&mutex) != 0) ++ abort (); ++ ++ /* Wait for the first thread only. */ ++ pthread_join (threads[0], &retval); ++ ++ /* Now post FINISH_SEMAPHORE to allow all the other threads to finish. */ ++ for (int i = 1; i < NUM_THREADS; i++) ++ sem_post (&finish_semaphore); ++ ++ /* Now wait for the remaining threads to complete. */ ++ for (int i = 1; i < NUM_THREADS; i++) ++ pthread_join (threads[i], &retval); ++ ++ /* Semaphore cleanup. */ ++ sem_destroy (&finish_semaphore); ++ sem_destroy (&startup_semaphore); ++ sem_destroy (&thread_1_semaphore); ++ sem_destroy (&thread_2_semaphore); ++ ++ stop_marker (); ++ ++ return 0; ++} +diff --git a/gdb/testsuite/gdb.threads/infcall-from-bp-cond-timeout.exp b/gdb/testsuite/gdb.threads/infcall-from-bp-cond-timeout.exp +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.threads/infcall-from-bp-cond-timeout.exp +@@ -0,0 +1,166 @@ ++# Copyright 2022-2024 Free Software Foundation, Inc. ++ ++# This program is free software; you can 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 . ++ ++# Tests inferior calls executed from a breakpoint condition in ++# a multi-threaded program. ++# ++# This test has the inferior function call timeout, and checks how GDB ++# handles this situation. ++ ++standard_testfile ++ ++if { [build_executable "failed to prepare" ${binfile} "${srcfile}" \ ++ {debug pthreads}] } { ++ return ++} ++ ++set cond_bp_line [gdb_get_line_number "Conditional breakpoint here"] ++set final_bp_line [gdb_get_line_number "Stop marker"] ++set segfault_line [gdb_get_line_number "Segfault here"] ++ ++# Setup GDB based on TARGET_ASYNC, TARGET_NON_STOP, and NON_STOP. ++# Setup some breakpoints in the inferior, one of which has an inferior ++# call within its condition. ++# ++# Continue GDB, the breakpoint with inferior call will be hit, but the ++# inferior call will never return. We expect GDB to timeout. ++# ++# The reason that the inferior call never completes is that a second ++# thread, on which the inferior call relies, either hits a breakpoint ++# (when OTHER_THREAD_BP is true), or crashes (when OTHER_THREAD_BP is ++# false). ++proc run_test { target_async target_non_stop non_stop other_thread_bp } { ++ save_vars { ::GDBFLAGS } { ++ append ::GDBFLAGS " -ex \"maint set target-non-stop $target_non_stop\"" ++ append ::GDBFLAGS " -ex \"maint non-stop $non_stop\"" ++ append ::GDBFLAGS " -ex \"maintenance set target-async ${target_async}\"" ++ ++ clean_restart ${::binfile} ++ } ++ ++ if {![runto_main]} { ++ return ++ } ++ ++ # The default timeout for indirect inferior calls (e.g. inferior ++ # calls for conditional breakpoint expressions) is pretty high. ++ # We don't want the test to take too long, so reduce this. ++ # ++ # However, the test relies on a second thread hitting some event ++ # (either a breakpoint or signal) before this timeout expires. ++ # ++ # There is a chance that on a really slow system this might not ++ # happen, in which case the test might fail. ++ # ++ # However, we still allocate 5 seconds, which feels like it should ++ # be enough time in most cases, but maybe we need to do something ++ # smarter here? Possibly we could have some initial run where the ++ # inferior doesn't timeout, but does perform the same interaction ++ # between threads, we could time that, and use that as the basis ++ # for this timeout. For now though, we just hope 5 seconds is ++ # enough. ++ gdb_test_no_output "set indirect-call-timeout 5" ++ ++ gdb_breakpoint \ ++ "${::srcfile}:${::cond_bp_line} if (condition_func ())" ++ set bp_num [get_integer_valueof "\$bpnum" "*UNKNOWN*" \ ++ "get number for conditional breakpoint"] ++ ++ gdb_breakpoint "${::srcfile}:${::final_bp_line}" ++ set final_bp_num [get_integer_valueof "\$bpnum" "*UNKNOWN*" \ ++ "get number for final breakpoint"] ++ ++ # The thread performing an inferior call relies on a second ++ # thread. The second thread will segfault unless it hits a ++ # breakpoint first. In either case the initial thread will not ++ # complete its inferior call. ++ if { $other_thread_bp } { ++ gdb_breakpoint "${::srcfile}:${::segfault_line}" ++ set segfault_bp_num [get_integer_valueof "\$bpnum" "*UNKNOWN*" \ ++ "get number for segfault breakpoint"] ++ } ++ ++ # When non-stop mode is off we get slightly different output from GDB. ++ if { ([target_info gdb_protocol] == "remote" ++ || [target_info gdb_protocol] == "extended-remote") ++ && !$target_non_stop} { ++ set stopped_line_pattern "Thread ${::decimal} \"\[^\r\n\"\]+\" received signal SIGINT, Interrupt\\." ++ } else { ++ set stopped_line_pattern "Thread ${::decimal} \"\[^\r\n\"\]+\" stopped\\." ++ } ++ ++ gdb_test "continue" \ ++ [multi_line \ ++ $stopped_line_pattern \ ++ ".*" \ ++ "Error in testing condition for breakpoint ${bp_num}:" \ ++ "The program being debugged timed out while in a function called from GDB\\." \ ++ "GDB remains in the frame where the timeout occurred\\." \ ++ "To change this behavior use \"set unwind-on-timeout on\"\\." \ ++ "Evaluation of the expression containing the function" \ ++ "\\(condition_func\\) will be abandoned\\." \ ++ "When the function is done executing, GDB will silently stop\\."] \ ++ "expected timeout waiting for inferior call to complete" ++ ++ # Remember that other thread that either crashed (with a segfault) ++ # or hit a breakpoint? Now that the inferior call has timed out, ++ # if we try to resume then we should see the pending event from ++ # that other thread. ++ if { $other_thread_bp } { ++ gdb_test "continue" \ ++ [multi_line \ ++ "Continuing\\." \ ++ ".*" \ ++ "" \ ++ "Thread ${::decimal} \"\[^\"\r\n\]+\" hit Breakpoint ${segfault_bp_num}, do_segfault \[^\r\n\]+:${::segfault_line}" \ ++ "${::decimal}\\s+\[^\r\n\]+Segfault here\[^\r\n\]+"] \ ++ "hit the segfault breakpoint" ++ } else { ++ gdb_test "continue" \ ++ [multi_line \ ++ "Continuing\\." \ ++ ".*" \ ++ "Thread ${::decimal} \"infcall-from-bp\" received signal SIGSEGV, Segmentation fault\\." \ ++ "\\\[Switching to Thread \[^\r\n\]+\\\]" \ ++ "${::hex} in do_segfault \\(\\) at \[^\r\n\]+:${::segfault_line}" \ ++ "${::decimal}\\s+\[^\r\n\]+Segfault here\[^\r\n\]+"] \ ++ "hit the segfault" ++ } ++} ++ ++foreach_with_prefix target_async {"on" "off" } { ++ ++ if { !$target_async } { ++ # GDB can't timeout while waiting for a thread if the target ++ # runs with async-mode turned off; once the target is running ++ # GDB is effectively blocked until the target stops for some ++ # reason. ++ continue ++ } ++ ++ foreach_with_prefix target_non_stop {"off" "on"} { ++ foreach_with_prefix non_stop {"off" "on"} { ++ if { $non_stop && !$target_non_stop } { ++ # It doesn't make sense to operate GDB in non-stop ++ # mode when the target has (in theory) non-stop mode ++ # disabled. ++ continue ++ } ++ foreach_with_prefix other_thread_bp { true false } { ++ run_test $target_async $target_non_stop $non_stop $other_thread_bp ++ } ++ } ++ } ++} diff --git a/gdb-rhel-13298-inferior-funcall-bp-condition-4-of-5.patch b/gdb-rhel-13298-inferior-funcall-bp-condition-4-of-5.patch new file mode 100644 index 0000000..579e2f5 --- /dev/null +++ b/gdb-rhel-13298-inferior-funcall-bp-condition-4-of-5.patch @@ -0,0 +1,413 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Andrew Burgess +Date: Wed, 18 Jan 2023 10:17:57 +0000 +Subject: gdb-rhel-13298-inferior-funcall-bp-condition-4-of-5.patch + +;;gdb: introduce unwind-on-timeout setting +;;(Andrew Burgess, RHEL-13298) + +Now that inferior function calls can timeout (see the recent +introduction of direct-call-timeout and indirect-call-timeout), this +commit adds a new setting unwind-on-timeout. + +This new setting is just like the existing unwindonsignal and +unwind-on-terminating-exception, but the new setting will cause GDB to +unwind the stack if an inferior function call times out. + +The existing inferior function call timeout tests have been updated to +cover the new setting. + +Reviewed-By: Eli Zaretskii +Tested-By: Luis Machado +Tested-By: Keith Seitz + +diff --git a/gdb/NEWS b/gdb/NEWS +--- a/gdb/NEWS ++++ b/gdb/NEWS +@@ -72,6 +72,15 @@ show indirect-call-timeout + ignored, GDB will wait indefinitely for an inferior function to + complete, unless interrupted by the user using Ctrl-C. + ++set unwind-on-timeout on|off ++show unwind-on-timeout ++ These commands control whether GDB should unwind the stack when a ++ timeout occurs during an inferior function call. The default is ++ off, in which case the inferior will remain in the frame where the ++ timeout occurred. When on, GDB will unwind the stack removing the ++ dummy frame that was added for the inferior call, and restoring the ++ inferior state to how it was before the inferior call started. ++ + * New features in the GDB remote stub, GDBserver + + ** The --remote-debug and --event-loop-debug command line options +diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo +--- a/gdb/doc/gdb.texinfo ++++ b/gdb/doc/gdb.texinfo +@@ -20932,6 +20932,22 @@ the default C@t{++} exception handler and the inferior terminated. + Show the current setting of stack unwinding in the functions called by + @value{GDBN}. + ++@anchor{set unwind-on-timeout} ++@item set unwind-on-timeout ++@kindex set unwind-on-timeout ++@cindex unwind stack in called functions when timing out ++@cindex call dummy stack unwinding on timeout. ++Set unwinding of the stack if a function called from @value{GDBN} ++times out. If set to @code{off} (the default), @value{GDBN} stops in ++the frame where the timeout occurred. If set to @code{on}, ++@value{GDBN} unwinds the stack it created for the call and restores ++the context to what it was before the call. ++ ++@item show unwind-on-timeout ++@kindex show unwind-on-timeout ++Show whether @value{GDBN} will unwind the stack if a function called ++from @value{GDBN} times out. ++ + @item set may-call-functions + @kindex set may-call-functions + @cindex disabling calling functions in the program +@@ -20963,11 +20979,11 @@ call by typing the interrupt character (often @kbd{Ctrl-c}). + + If a called function is interrupted for any reason, including hitting + a breakpoint, or triggering a watchpoint, and the stack is not unwound +-due to @code{set unwind-on-terminating-exception on} or @code{set +-unwindonsignal on} (@pxref{stack unwind settings}), +-then the dummy-frame, created by @value{GDBN} to facilitate the call +-to the program function, will be visible in the backtrace, for example +-frame @code{#3} in the following backtrace: ++due to @code{set unwind-on-terminating-exception on}, @code{set ++unwind-on-timeout on}, or @code{set unwindonsignal on} (@pxref{stack ++unwind settings}), then the dummy-frame, created by @value{GDBN} to ++facilitate the call to the program function, will be visible in the ++backtrace, for example frame @code{#3} in the following backtrace: + + @smallexample + (@value{GDBP}) backtrace +@@ -20992,6 +21008,11 @@ Execution}) @value{GDBN} can place a timeout on any functions called + from @value{GDBN}. If the timeout expires and the function call is + still ongoing, then @value{GDBN} will interrupt the program. + ++If a function called from @value{GDBN} is interrupted by a timeout, ++then by default the inferior is left in the frame where the timeout ++occurred, this behaviour can be adjusted with @samp{set ++unwind-on-timeout} (@pxref{set unwind-on-timeout}). ++ + For targets that don't support asynchronous execution + (@pxref{Background Execution}) then timeouts for functions called from + @value{GDBN} are not supported, the timeout settings described below +diff --git a/gdb/infcall.c b/gdb/infcall.c +--- a/gdb/infcall.c ++++ b/gdb/infcall.c +@@ -218,6 +218,27 @@ show_unwind_on_terminating_exception_p (struct ui_file *file, int from_tty, + value); + } + ++/* This boolean tells GDB what to do if an inferior function, called from ++ GDB, times out. If true, GDB unwinds the stack and restores the context ++ to what it was before the call. When false, GDB leaves the thread as it ++ is at the point of the timeout. ++ ++ The default is to stop in the frame where the timeout occurred. */ ++ ++static bool unwind_on_timeout_p = false; ++ ++/* Implement 'show unwind-on-timeout'. */ ++ ++static void ++show_unwind_on_timeout_p (struct ui_file *file, int from_tty, ++ struct cmd_list_element *c, const char *value) ++{ ++ gdb_printf (file, ++ _("Unwinding of stack if a timeout occurs " ++ "while in a call dummy is %s.\n"), ++ value); ++} ++ + /* Perform the standard coercions that are specified + for arguments to be passed to C, Ada or Fortran functions. + +@@ -574,6 +595,16 @@ struct call_thread_fsm : public thread_fsm + bool should_stop (struct thread_info *thread) override; + + bool should_notify_stop () override; ++ ++ /* Record that this thread timed out while performing an infcall. */ ++ void timed_out () ++ { ++ m_timed_out = true; ++ } ++ ++private: ++ /* Set true if the thread timed out while performing an infcall. */ ++ bool m_timed_out = false; + }; + + /* Allocate a new call_thread_fsm object. */ +@@ -649,7 +680,8 @@ call_thread_fsm::should_notify_stop () + + infcall_debug_printf ("inferior call didn't complete fully"); + +- if (stopped_by_random_signal && unwind_on_signal_p) ++ if ((stopped_by_random_signal && unwind_on_signal_p) ++ || (m_timed_out && unwind_on_timeout_p)) + { + infcall_debug_printf ("unwind-on-signal is on, don't notify"); + return false; +@@ -742,6 +774,9 @@ struct infcall_timer_controller + + infcall_debug_printf ("Stopping thread %s", + m_thread->ptid.to_string ().c_str ()); ++ call_thread_fsm *fsm ++ = gdb::checked_static_cast (m_thread->thread_fsm ()); ++ fsm->timed_out (); + target_stop (m_thread->ptid); + } + }; +@@ -1744,14 +1779,27 @@ When the function is done executing, GDB will silently stop."), + /* A timeout results in a signal being sent to the inferior. */ + gdb_assert (stopped_by_random_signal); + +- /* Indentation is weird here. A later patch is going to move the +- following block into an if/else, so I'm leaving the indentation +- here to minimise the later patch. ++ if (unwind_on_timeout_p) ++ { ++ /* The user wants the context restored. */ ++ ++ /* We must get back to the frame we were before the ++ dummy call. */ ++ dummy_frame_pop (dummy_id, call_thread.get ()); + +- Also, the error message used below refers to 'set +- unwind-on-timeout' which doesn't exist yet. This will be added +- in a later commit, I'm leaving this in for now to minimise the +- churn caused by the commit that adds unwind-on-timeout. */ ++ /* We also need to restore inferior status to that before the ++ dummy call. */ ++ restore_infcall_control_state (inf_status.release ()); ++ ++ error (_("\ ++The program being debugged timed out while in a function called from GDB.\n\ ++GDB has restored the context to what it was before the call.\n\ ++To change this behavior use \"set unwind-on-timeout off\".\n\ ++Evaluation of the expression containing the function\n\ ++(%s) will be abandoned."), ++ name.c_str ()); ++ } ++ else + { + /* The user wants to stay in the frame where we stopped + (default). Discard inferior status, we're not at the same +@@ -1877,6 +1925,20 @@ The default is to unwind the frame."), + show_unwind_on_terminating_exception_p, + &setlist, &showlist); + ++ add_setshow_boolean_cmd ("unwind-on-timeout", no_class, ++ &unwind_on_timeout_p, _("\ ++Set unwinding of stack if a timeout occurs while in a call dummy."), _("\ ++Show unwinding of stack if a timeout occurs while in a call dummy."), ++ _("\ ++The unwind on timeout flag lets the user determine what gdb should do if\n\ ++gdb times out while in a function called from gdb. If set, gdb unwinds\n\ ++the stack and restores the context to what it was before the call. If\n\ ++unset, gdb leaves the inferior in the frame where the timeout occurred.\n\ ++The default is to stop in the frame where the timeout occurred."), ++ NULL, ++ show_unwind_on_timeout_p, ++ &setlist, &showlist); ++ + add_setshow_uinteger_cmd ("direct-call-timeout", no_class, + &direct_call_timeout, _("\ + Set the timeout, for direct calls to inferior function calls."), _("\ +diff --git a/gdb/testsuite/gdb.base/infcall-timeout.exp b/gdb/testsuite/gdb.base/infcall-timeout.exp +--- a/gdb/testsuite/gdb.base/infcall-timeout.exp ++++ b/gdb/testsuite/gdb.base/infcall-timeout.exp +@@ -28,7 +28,11 @@ if { [build_executable "failed to prepare" ${binfile} "${srcfile}" \ + # then adjust the direct-call-timeout, and make an inferior function + # call that will never return. GDB should eventually timeout and stop + # the inferior. +-proc run_test { target_async target_non_stop non_stop } { ++# ++# When UNWIND is "off" the inferior wil be left in the frame where the ++# timeout occurs, otherwise, when UNWIND is "on", GDB should unwind ++# back to the frame where the inferior call was made. ++proc run_test { target_async target_non_stop non_stop unwind } { + save_vars { ::GDBFLAGS } { + append ::GDBFLAGS \ + " -ex \"maint set target-non-stop $target_non_stop\"" +@@ -45,28 +49,43 @@ proc run_test { target_async target_non_stop non_stop } { + } + + gdb_test_no_output "set direct-call-timeout 5" ++ gdb_test_no_output "set unwind-on-timeout $unwind" ++ ++ if { $unwind } { ++ gdb_test "print function_that_never_returns ()" \ ++ [multi_line \ ++ "The program being debugged timed out while in a function called from GDB\\." \ ++ "GDB has restored the context to what it was before the call\\." \ ++ "To change this behavior use \"set unwind-on-timeout off\"\\." \ ++ "Evaluation of the expression containing the function" \ ++ "\\(function_that_never_returns\\) will be abandoned\\."] + +- # When non-stop mode is off we get slightly different output from GDB. +- if { ([target_info gdb_protocol] == "remote" +- || [target_info gdb_protocol] == "extended-remote") +- && !$target_non_stop } { +- set stopped_line_pattern "Program received signal SIGINT, Interrupt\\." ++ gdb_test "bt" \ ++ "#0\\s+main \\(\\).*" + } else { +- set stopped_line_pattern "Program stopped\\." +- } ++ # When non-stop mode is off we get slightly different output from GDB. ++ if { ([target_info gdb_protocol] == "remote" ++ || [target_info gdb_protocol] == "extended-remote") ++ && !$target_non_stop } { ++ set stopped_line_pattern "Program received signal SIGINT, Interrupt\\." ++ } else { ++ set stopped_line_pattern "Program stopped\\." ++ } + +- gdb_test "print function_that_never_returns ()" \ +- [multi_line \ +- $stopped_line_pattern \ +- ".*" \ +- "The program being debugged timed out while in a function called from GDB\\." \ +- "GDB remains in the frame where the timeout occurred\\." \ +- "To change this behavior use \"set unwind-on-timeout on\"\\." \ +- "Evaluation of the expression containing the function" \ +- "\\(function_that_never_returns\\) will be abandoned\\." \ +- "When the function is done executing, GDB will silently stop\\."] +- +- gdb_test "bt" ".* function_that_never_returns .*.*" ++ gdb_test "print function_that_never_returns ()" \ ++ [multi_line \ ++ $stopped_line_pattern \ ++ ".*" \ ++ "The program being debugged timed out while in a function called from GDB\\." \ ++ "GDB remains in the frame where the timeout occurred\\." \ ++ "To change this behavior use \"set unwind-on-timeout on\"\\." \ ++ "Evaluation of the expression containing the function" \ ++ "\\(function_that_never_returns\\) will be abandoned\\." \ ++ "When the function is done executing, GDB will silently stop\\."] ++ ++ gdb_test "bt" \ ++ ".* function_that_never_returns .*.*" ++ } + } + + foreach_with_prefix target_async { "on" "off" } { +@@ -88,7 +107,9 @@ foreach_with_prefix target_async { "on" "off" } { + continue + } + +- run_test $target_async $target_non_stop $non_stop ++ foreach_with_prefix unwind { "on" "off" } { ++ run_test $target_async $target_non_stop $non_stop $unwind ++ } + } + } + } +diff --git a/gdb/testsuite/gdb.threads/infcall-from-bp-cond-timeout.exp b/gdb/testsuite/gdb.threads/infcall-from-bp-cond-timeout.exp +--- a/gdb/testsuite/gdb.threads/infcall-from-bp-cond-timeout.exp ++++ b/gdb/testsuite/gdb.threads/infcall-from-bp-cond-timeout.exp +@@ -41,7 +41,12 @@ set segfault_line [gdb_get_line_number "Segfault here"] + # thread, on which the inferior call relies, either hits a breakpoint + # (when OTHER_THREAD_BP is true), or crashes (when OTHER_THREAD_BP is + # false). +-proc run_test { target_async target_non_stop non_stop other_thread_bp } { ++# ++# When UNWIND is "on" GDB will unwind the thread which performed the ++# inferior function call back to the state where the inferior call was ++# made (when the inferior call times out). Otherwise, when UNWIND is ++# "off", the inferior is left in the frame where the timeout occurred. ++proc run_test { target_async target_non_stop non_stop other_thread_bp unwind } { + save_vars { ::GDBFLAGS } { + append ::GDBFLAGS " -ex \"maint set target-non-stop $target_non_stop\"" + append ::GDBFLAGS " -ex \"maint non-stop $non_stop\"" +@@ -72,6 +77,7 @@ proc run_test { target_async target_non_stop non_stop other_thread_bp } { + # for this timeout. For now though, we just hope 5 seconds is + # enough. + gdb_test_no_output "set indirect-call-timeout 5" ++ gdb_test_no_output "set unwind-on-timeout $unwind" + + gdb_breakpoint \ + "${::srcfile}:${::cond_bp_line} if (condition_func ())" +@@ -92,27 +98,43 @@ proc run_test { target_async target_non_stop non_stop other_thread_bp } { + "get number for segfault breakpoint"] + } + +- # When non-stop mode is off we get slightly different output from GDB. +- if { ([target_info gdb_protocol] == "remote" +- || [target_info gdb_protocol] == "extended-remote") +- && !$target_non_stop} { +- set stopped_line_pattern "Thread ${::decimal} \"\[^\r\n\"\]+\" received signal SIGINT, Interrupt\\." ++ if { $unwind } { ++ gdb_test "continue" \ ++ [multi_line \ ++ "Error in testing condition for breakpoint ${bp_num}:" \ ++ "The program being debugged timed out while in a function called from GDB\\." \ ++ "GDB has restored the context to what it was before the call\\." \ ++ "To change this behavior use \"set unwind-on-timeout off\"\\." \ ++ "Evaluation of the expression containing the function" \ ++ "\\(condition_func\\) will be abandoned\\.(\r\n\\\[New Thread \[^\r\n\]+\\\])*" \ ++ "" \ ++ "Thread ${::decimal}\[^\r\n\]*hit Breakpoint ${bp_num}, \[^\r\n\]+" \ ++ "\[^\r\n\]+ Conditional breakpoint here\\. \[^\r\n\]+"] \ ++ "expected timeout waiting for inferior call to complete" + } else { +- set stopped_line_pattern "Thread ${::decimal} \"\[^\r\n\"\]+\" stopped\\." +- } ++ # When non-stop mode is off we get slightly different output from GDB. ++ if { ([target_info gdb_protocol] == "remote" ++ || [target_info gdb_protocol] == "extended-remote") ++ && !$target_non_stop} { ++ set stopped_line_pattern \ ++ "Thread ${::decimal} \"\[^\r\n\"\]+\" received signal SIGINT, Interrupt\\." ++ } else { ++ set stopped_line_pattern "Thread ${::decimal} \"\[^\r\n\"\]+\" stopped\\." ++ } + +- gdb_test "continue" \ +- [multi_line \ +- $stopped_line_pattern \ +- ".*" \ +- "Error in testing condition for breakpoint ${bp_num}:" \ +- "The program being debugged timed out while in a function called from GDB\\." \ +- "GDB remains in the frame where the timeout occurred\\." \ +- "To change this behavior use \"set unwind-on-timeout on\"\\." \ +- "Evaluation of the expression containing the function" \ +- "\\(condition_func\\) will be abandoned\\." \ +- "When the function is done executing, GDB will silently stop\\."] \ +- "expected timeout waiting for inferior call to complete" ++ gdb_test "continue" \ ++ [multi_line \ ++ "$stopped_line_pattern" \ ++ ".*" \ ++ "Error in testing condition for breakpoint ${bp_num}:" \ ++ "The program being debugged timed out while in a function called from GDB\\." \ ++ "GDB remains in the frame where the timeout occurred\\." \ ++ "To change this behavior use \"set unwind-on-timeout on\"\\." \ ++ "Evaluation of the expression containing the function" \ ++ "\\(condition_func\\) will be abandoned\\." \ ++ "When the function is done executing, GDB will silently stop\\."] \ ++ "expected timeout waiting for inferior call to complete" ++ } + + # Remember that other thread that either crashed (with a segfault) + # or hit a breakpoint? Now that the inferior call has timed out, +@@ -158,8 +180,11 @@ foreach_with_prefix target_async {"on" "off" } { + # disabled. + continue + } +- foreach_with_prefix other_thread_bp { true false } { +- run_test $target_async $target_non_stop $non_stop $other_thread_bp ++ foreach_with_prefix unwind {"off" "on"} { ++ foreach_with_prefix other_thread_bp { true false } { ++ run_test $target_async $target_non_stop $non_stop \ ++ $other_thread_bp $unwind ++ } + } + } + } diff --git a/gdb-rhel-13298-inferior-funcall-bp-condition-5-of-5.patch b/gdb-rhel-13298-inferior-funcall-bp-condition-5-of-5.patch new file mode 100644 index 0000000..9dcaeac --- /dev/null +++ b/gdb-rhel-13298-inferior-funcall-bp-condition-5-of-5.patch @@ -0,0 +1,467 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Andrew Burgess +Date: Wed, 18 Jan 2023 12:09:05 +0000 +Subject: gdb-rhel-13298-inferior-funcall-bp-condition-5-of-5.patch + +;;gdb: rename unwindonsignal to unwind-on-signal +;;(Andrew Burgess, RHEL-13298) + +We now have unwind-on-timeout and unwind-on-terminating-exception, and +then the odd one out unwindonsignal. + +I'm not a great fan of these squashed together command names, so in +this commit I propose renaming this to unwind-on-signal. + +Obviously I've added the hidden alias unwindonsignal so any existing +GDB scripts will keep working. + +There's one test that I've extended to test the alias works, but in +most of the other test scripts I've changed over to use the new name. + +The docs are updated to reference the new name. + +Reviewed-By: Eli Zaretskii +Tested-By: Luis Machado +Tested-By: Keith Seitz + +diff --git a/gdb/NEWS b/gdb/NEWS +--- a/gdb/NEWS ++++ b/gdb/NEWS +@@ -32,6 +32,10 @@ maintenance info line-table + if the line is considered the start of the epilgoue, and thus a point at + which the frame can be considered destroyed. + ++set unwindonsignal on|off ++show unwindonsignal ++ These commands are now aliases for the new set/show unwind-on-signal. ++ + * New commands + + info missing-debug-handler +@@ -81,6 +85,11 @@ show unwind-on-timeout + dummy frame that was added for the inferior call, and restoring the + inferior state to how it was before the inferior call started. + ++set unwind-on-signal on|off ++show unwind-on-signal ++ These new commands replaces the existing set/show unwindonsignal. The ++ old command is maintained as an alias. ++ + * New features in the GDB remote stub, GDBserver + + ** The --remote-debug and --event-loop-debug command line options +diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo +--- a/gdb/doc/gdb.texinfo ++++ b/gdb/doc/gdb.texinfo +@@ -20886,7 +20886,7 @@ value history. + It is possible for the function you call via the @code{print} or + @code{call} command to generate a signal (e.g., if there's a bug in + the function, or if you passed it incorrect arguments). What happens +-in that case is controlled by the @code{set unwindonsignal} command. ++in that case is controlled by the @code{set unwind-on-signal} command. + + Similarly, with a C@t{++} program it is possible for the function you + call via the @code{print} or @code{call} command to generate an +@@ -20900,7 +20900,8 @@ in that case is controlled by the + + @anchor{stack unwind settings} + @table @code +-@item set unwindonsignal ++@item set unwind-on-signal ++@kindex set unwind-on-signal + @kindex set unwindonsignal + @cindex unwind stack in called functions + @cindex call dummy stack unwinding +@@ -20911,11 +20912,18 @@ the context to what it was before the call. If set to off (the + default), @value{GDBN} stops in the frame where the signal was + received. + +-@item show unwindonsignal ++The command @code{set unwindonsignal} is an alias for this command, ++and is maintained for backward compatibility. ++ ++@item show unwind-on-signal ++@kindex show unwind-on-signal + @kindex show unwindonsignal + Show the current setting of stack unwinding in the functions called by + @value{GDBN}. + ++The command @code{show unwindonsignal} is an alias for this command, ++and is maintained for backward compatibility. ++ + @item set unwind-on-terminating-exception + @kindex set unwind-on-terminating-exception + @cindex unwind stack in called functions with unhandled exceptions +@@ -20980,7 +20988,7 @@ call by typing the interrupt character (often @kbd{Ctrl-c}). + If a called function is interrupted for any reason, including hitting + a breakpoint, or triggering a watchpoint, and the stack is not unwound + due to @code{set unwind-on-terminating-exception on}, @code{set +-unwind-on-timeout on}, or @code{set unwindonsignal on} (@pxref{stack ++unwind-on-timeout on}, or @code{set unwind-on-signal on} (@pxref{stack + unwind settings}), then the dummy-frame, created by @value{GDBN} to + facilitate the call to the program function, will be visible in the + backtrace, for example frame @code{#3} in the following backtrace: +diff --git a/gdb/infcall.c b/gdb/infcall.c +--- a/gdb/infcall.c ++++ b/gdb/infcall.c +@@ -1747,7 +1747,7 @@ When the function is done executing, GDB will silently stop."), + The program being debugged received signal %s, %s\n\ + while in a function called from GDB. GDB has restored the context\n\ + to what it was before the call. To change this behavior use\n\ +-\"set unwindonsignal off\". Evaluation of the expression containing\n\ ++\"set unwind-on-signal off\". Evaluation of the expression containing\n\ + the function (%s) will be abandoned."), + gdb_signal_to_name (stop_signal), + gdb_signal_to_string (stop_signal), +@@ -1766,7 +1766,7 @@ the function (%s) will be abandoned."), + error (_("\ + The program being debugged was signaled while in a function called from GDB.\n\ + GDB remains in the frame where the signal was received.\n\ +-To change this behavior use \"set unwindonsignal on\".\n\ ++To change this behavior use \"set unwind-on-signal on\".\n\ + Evaluation of the expression containing the function\n\ + (%s) will be abandoned.\n\ + When the function is done executing, GDB will silently stop."), +@@ -1898,17 +1898,22 @@ The default is to perform the conversion."), + show_coerce_float_to_double_p, + &setlist, &showlist); + +- add_setshow_boolean_cmd ("unwindonsignal", no_class, +- &unwind_on_signal_p, _("\ ++ set_show_commands setshow_unwind_on_signal_cmds ++ = add_setshow_boolean_cmd ("unwind-on-signal", no_class, ++ &unwind_on_signal_p, _("\ + Set unwinding of stack if a signal is received while in a call dummy."), _("\ + Show unwinding of stack if a signal is received while in a call dummy."), _("\ +-The unwindonsignal lets the user determine what gdb should do if a signal\n\ ++The unwind-on-signal lets the user determine what gdb should do if a signal\n\ + is received while in a function called from gdb (call dummy). If set, gdb\n\ + unwinds the stack and restore the context to what as it was before the call.\n\ + The default is to stop in the frame where the signal was received."), +- NULL, +- show_unwind_on_signal_p, +- &setlist, &showlist); ++ NULL, ++ show_unwind_on_signal_p, ++ &setlist, &showlist); ++ add_alias_cmd ("unwindonsignal", setshow_unwind_on_signal_cmds.set, ++ no_class, 1, &setlist); ++ add_alias_cmd ("unwindonsignal", setshow_unwind_on_signal_cmds.show, ++ no_class, 1, &showlist); + + add_setshow_boolean_cmd ("unwind-on-terminating-exception", no_class, + &unwind_on_terminating_exception_p, _("\ +diff --git a/gdb/testsuite/gdb.base/callfuncs.exp b/gdb/testsuite/gdb.base/callfuncs.exp +--- a/gdb/testsuite/gdb.base/callfuncs.exp ++++ b/gdb/testsuite/gdb.base/callfuncs.exp +@@ -46,7 +46,7 @@ proc do_function_calls {prototypes} { + + # If any of these calls segv we don't want to affect subsequent tests. + # E.g., we want to ensure register values are restored. +- gdb_test_no_output "set unwindonsignal on" ++ gdb_test_no_output "set unwind-on-signal on" + + gdb_test "p t_char_values(0,0)" " = 0" + gdb_test "p t_char_values('a','b')" " = 1" +@@ -237,7 +237,7 @@ proc do_function_calls {prototypes} { + "call inferior func with struct - returns char *" + + # Restore default value. +- gdb_test_no_output "set unwindonsignal off" ++ gdb_test_no_output "set unwind-on-signal off" + } + + # Procedure to get current content of all registers. +diff --git a/gdb/testsuite/gdb.base/infcall-failure.exp b/gdb/testsuite/gdb.base/infcall-failure.exp +--- a/gdb/testsuite/gdb.base/infcall-failure.exp ++++ b/gdb/testsuite/gdb.base/infcall-failure.exp +@@ -137,7 +137,7 @@ proc_with_prefix run_cond_hits_segfault_test { async_p non_stop_p } { + "Error in testing condition for breakpoint ${bp_1_num}:" \ + "The program being debugged was signaled while in a function called from GDB\\." \ + "GDB remains in the frame where the signal was received\\." \ +- "To change this behavior use \"set unwindonsignal on\"\\." \ ++ "To change this behavior use \"set unwind-on-signal on\"\\." \ + "Evaluation of the expression containing the function" \ + "\\(func_segfault\\) will be abandoned\\." \ + "When the function is done executing, GDB will silently stop\\."] +@@ -166,7 +166,7 @@ proc_with_prefix run_call_hits_segfault_test { async_p non_stop_p } { + "${::decimal}\\s+\[^\r\n\]+Segfault here\[^\r\n\]+" \ + "The program being debugged was signaled while in a function called from GDB\\." \ + "GDB remains in the frame where the signal was received\\." \ +- "To change this behavior use \"set unwindonsignal on\"\\." \ ++ "To change this behavior use \"set unwind-on-signal on\"\\." \ + "Evaluation of the expression containing the function" \ + "\\(func_segfault\\) will be abandoned\\." \ + "When the function is done executing, GDB will silently stop\\."] +diff --git a/gdb/testsuite/gdb.base/unwindonsignal.exp b/gdb/testsuite/gdb.base/unwindonsignal.exp +--- a/gdb/testsuite/gdb.base/unwindonsignal.exp ++++ b/gdb/testsuite/gdb.base/unwindonsignal.exp +@@ -34,13 +34,29 @@ gdb_test "break stop_here" "Breakpoint \[0-9\]* at .*" + gdb_test "continue" "Continuing.*Breakpoint \[0-9\]*, stop_here.*" \ + "continue to breakpoint at stop_here" + +-# Turn on unwindonsignal. +-gdb_test_no_output "set unwindonsignal on" \ +- "setting unwindonsignal" ++# Turn on unwind-on-signal. ++gdb_test_no_output "set unwind-on-signal on" \ ++ "setting unwind-on-signal" + +-gdb_test "show unwindonsignal" \ ++gdb_test "show unwind-on-signal" \ + "Unwinding of stack .* is on." \ +- "showing unwindonsignal" ++ "showing unwind-on-signal" ++ ++# For backward compatibility we maintain a 'unwindonsignal' alias for ++# 'unwind-on-signal', check it now. ++gdb_test "show unwindonsignal" \ ++ "Unwinding of stack .* is on\\." \ ++ "showing unwindonsignal alias" ++ ++gdb_test_no_output "set unwindonsignal off" \ ++ "setting unwindonsignal alias to off" ++ ++gdb_test "show unwind-on-signal" \ ++ "Unwinding of stack .* is off\\." \ ++ "showing unwind-on-signal after setting via alias" ++ ++gdb_test_no_output "set unwindonsignal on" \ ++ "setting unwindonsignal alias to on" + + # Call function (causing the program to get a signal), and see if gdb handles + # it properly. +@@ -49,7 +65,7 @@ if {[gdb_test "call gen_signal ()" \ + "The program being debugged received signal SIGABRT, Aborted" \ + "while in a function called from GDB\\. GDB has restored the context" \ + "to what it was before the call\\. To change this behavior use" \ +- "\"set unwindonsignal off\"\\. Evaluation of the expression containing" \ ++ "\"set unwind-on-signal off\"\\. Evaluation of the expression containing" \ + "the function \\(gen_signal\\) will be abandoned\\."] \ + "unwindonsignal, inferior function call signaled"] != 0} { + return 0 +@@ -58,15 +74,15 @@ if {[gdb_test "call gen_signal ()" \ + # Verify the stack got unwound. + gdb_test "bt" \ + "#0 *\[x0-9a-f in\]*stop_here \\(.*\\) at .*#1 *\[x0-9a-f in\]*main \\(.*\\) at .*" \ +- "unwindonsignal, stack unwound" ++ "stack unwound" + + # Verify the dummy frame got removed from dummy_frame_stack. + gdb_test_multiple "maint print dummy-frames" \ +- "unwindonsignal, dummy frame removed" { ++ "unwind-on-signal, dummy frame removed" { + -re "\[\r\n\]*.*stack=.*code=.*\[\r\n\]+$gdb_prompt $" { +- fail "unwindonsignal, dummy frame removed" ++ fail $gdb_test_name + } + -re "\[\r\n\]+$gdb_prompt $" { +- pass "unwindonsignal, dummy frame removed" ++ pass $gdb_test_name + } + } +diff --git a/gdb/testsuite/gdb.compile/compile-cplus.exp b/gdb/testsuite/gdb.compile/compile-cplus.exp +--- a/gdb/testsuite/gdb.compile/compile-cplus.exp ++++ b/gdb/testsuite/gdb.compile/compile-cplus.exp +@@ -131,13 +131,13 @@ gdb_test "return" "\r\n#0 main .*" "return" \ + "Make _gdb_expr\\(__gdb_regs\\*\\) return now\\? \\(y or n\\) " "y" + gdb_test "info sym $infcall_pc" "\r\nNo symbol matches .*" "info sym not found" + +-gdb_test_no_output "set unwindonsignal on" ++gdb_test_no_output "set unwind-on-signal on" + gdb_test "compile code *(volatile int *) 0 = 0;" \ + [multi_line \ + "The program being debugged received signal SIGSEGV, Segmentation fault" \ + "while in a function called from GDB\\. GDB has restored the context" \ + "to what it was before the call\\. To change this behavior use" \ +- "\"set unwindonsignal off\"\\. Evaluation of the expression containing" \ ++ "\"set unwind-on-signal off\"\\. Evaluation of the expression containing" \ + "the function \\(_gdb_expr\\(__gdb_regs\\*\\)\\) will be abandoned\\."] \ + "compile code segfault second" + +@@ -313,7 +313,7 @@ gdb_test "compile code static const int readonly = 1; *(int *) &readonly = 2;" \ + "The program being debugged received signal SIGSEGV, Segmentation fault" \ + "while in a function called from GDB\\. GDB has restored the context" \ + "to what it was before the call\\. To change this behavior use" \ +- "\"set unwindonsignal off\"\\. Evaluation of the expression containing" \ ++ "\"set unwind-on-signal off\"\\. Evaluation of the expression containing" \ + "the function \\(_gdb_expr\\(__gdb_regs\\*\\)\\) will be abandoned\\."] + gdb_test_no_output "set debug compile off" + +diff --git a/gdb/testsuite/gdb.compile/compile.exp b/gdb/testsuite/gdb.compile/compile.exp +--- a/gdb/testsuite/gdb.compile/compile.exp ++++ b/gdb/testsuite/gdb.compile/compile.exp +@@ -157,13 +157,13 @@ gdb_test "return" "\r\n#0 main .*" "return" \ + "Make _gdb_expr return now\\? \\(y or n\\) " "y" + gdb_test "info sym $infcall_pc" "\r\nNo symbol matches .*" "info sym not found" + +-gdb_test_no_output "set unwindonsignal on" ++gdb_test_no_output "set unwind-on-signal on" + gdb_test "compile code *(volatile int *) 0 = 0;" \ + [multi_line \ + "The program being debugged received signal SIGSEGV, Segmentation fault" \ + "while in a function called from GDB\\. GDB has restored the context" \ + "to what it was before the call\\. To change this behavior use" \ +- "\"set unwindonsignal off\"\\. Evaluation of the expression containing" \ ++ "\"set unwind-on-signal off\"\\. Evaluation of the expression containing" \ + "the function \\(_gdb_expr\\) will be abandoned\\."] \ + "compile code segfault second" + +@@ -321,7 +321,7 @@ gdb_test "compile code static const int readonly = 1; *(int *) &readonly = 2;" \ + "The program being debugged received signal SIGSEGV, Segmentation fault" \ + "while in a function called from GDB\\. GDB has restored the context" \ + "to what it was before the call\\. To change this behavior use" \ +- "\"set unwindonsignal off\"\\. Evaluation of the expression containing" \ ++ "\"set unwind-on-signal off\"\\. Evaluation of the expression containing" \ + "the function \\(_gdb_expr\\) will be abandoned\\."] + gdb_test_no_output "set debug compile off" + +diff --git a/gdb/testsuite/gdb.cp/gdb2495.exp b/gdb/testsuite/gdb.cp/gdb2495.exp +--- a/gdb/testsuite/gdb.cp/gdb2495.exp ++++ b/gdb/testsuite/gdb.cp/gdb2495.exp +@@ -98,10 +98,10 @@ if {![runto_main]} { + # behaviour; it should not. Test both on and off states. + + # Turn on unwind on signal behaviour. +-gdb_test_no_output "set unwindonsignal on" ++gdb_test_no_output "set unwind-on-signal on" + + # Check that it is turned on. +-gdb_test "show unwindonsignal" \ ++gdb_test "show unwind-on-signal" \ + "signal is received while in a call dummy is on.*" \ + "turn on unwind on signal" + +@@ -112,20 +112,20 @@ gdb_test "p exceptions.raise_signal(1)" \ + "The program being debugged received signal SIGABRT, Aborted" \ + "while in a function called from GDB\\. GDB has restored the context" \ + "to what it was before the call\\. To change this behavior use" \ +- "\"set unwindonsignal off\"\\. Evaluation of the expression containing" \ ++ "\"set unwind-on-signal off\"\\. Evaluation of the expression containing" \ + "the function \\(SimpleException::raise_signal\\(int\\)\\) will be abandoned\\."]\ +- "check for unwindonsignal off message" ++ "check for unwind-on-signal off message" + + # And reverse - turn off again. +-gdb_test_no_output "set unwindonsignal off" ++gdb_test_no_output "set unwind-on-signal off" + + # Check that it is actually turned off. +-gdb_test "show unwindonsignal" \ ++gdb_test "show unwind-on-signal" \ + "signal is received while in a call dummy is off.*" \ + "turn off unwind on signal" + + # Check to see if new behaviour interferes with + # normal signal handling in inferior function calls. + gdb_test "p exceptions.raise_signal(1)" \ +- "To change this behavior use \"set unwindonsignal on\".*" \ +- "check for unwindonsignal on message" ++ "To change this behavior use \"set unwind-on-signal on\".*" \ ++ "check for unwind-on-signal on message" +diff --git a/gdb/testsuite/gdb.fortran/function-calls.exp b/gdb/testsuite/gdb.fortran/function-calls.exp +--- a/gdb/testsuite/gdb.fortran/function-calls.exp ++++ b/gdb/testsuite/gdb.fortran/function-calls.exp +@@ -44,7 +44,7 @@ if {![runto [gdb_get_line_number "post_init"]]} { + } + + # Use inspired by gdb.base/callfuncs.exp. +-gdb_test_no_output "set unwindonsignal on" ++gdb_test_no_output "set unwind-on-signal on" + + # Baseline: function and subroutine call with no arguments. + gdb_test "p no_arg()" " = .TRUE." +diff --git a/gdb/testsuite/gdb.mi/mi-condbreak-fail.exp b/gdb/testsuite/gdb.mi/mi-condbreak-fail.exp +--- a/gdb/testsuite/gdb.mi/mi-condbreak-fail.exp ++++ b/gdb/testsuite/gdb.mi/mi-condbreak-fail.exp +@@ -43,7 +43,7 @@ proc run_test { unwind_on_signal } { + return + } + +- mi_gdb_test "-gdb-set unwindonsignal ${unwind_on_signal}" {\^done} \ ++ mi_gdb_test "-gdb-set unwind-on-signal ${unwind_on_signal}" {\^done} \ + "set unwind-on-signal" + + # Create the conditional breakpoint. +@@ -70,7 +70,7 @@ proc run_test { unwind_on_signal } { + "&\"The program being debugged received signal SIGSEGV, Segmentation fault\\\\n\"" \ + "&\"while in a function called from GDB\\. GDB has restored the context\\\\n\"" \ + "&\"to what it was before the call\\. To change this behavior use\\\\n\"" \ +- "&\"\\\\\"set unwindonsignal off\\\\\"\\. Evaluation of the expression containing\\\\n\"" \ ++ "&\"\\\\\"set unwind-on-signal off\\\\\"\\. Evaluation of the expression containing\\\\n\"" \ + "&\"the function \\(cond_fail\\) will be abandoned\\.\\\\n\"" \ + "=breakpoint-modified,bkpt={number=\"$bpnum\",type=\"breakpoint\",\[^\r\n\]+times=\"1\",\[^\r\n\]+}" \ + "~\"\\\\n\"" \ +@@ -92,7 +92,7 @@ proc run_test { unwind_on_signal } { + "&\"Error in testing condition for breakpoint $bpnum:\\\\n\"" \ + "&\"The program being debugged was signaled while in a function called from GDB\\.\\\\n\"" \ + "&\"GDB remains in the frame where the signal was received\\.\\\\n\"" \ +- "&\"To change this behavior use \\\\\"set unwindonsignal on\\\\\"\\.\\\\n\"" \ ++ "&\"To change this behavior use \\\\\"set unwind-on-signal on\\\\\"\\.\\\\n\"" \ + "&\"Evaluation of the expression containing the function\\\\n\"" \ + "&\"\\(cond_fail\\) will be abandoned\\.\\\\n\"" \ + "&\"When the function is done executing, GDB will silently stop\\.\\\\n\"" \ +diff --git a/gdb/testsuite/gdb.mi/mi-condbreak-throw.exp b/gdb/testsuite/gdb.mi/mi-condbreak-throw.exp +--- a/gdb/testsuite/gdb.mi/mi-condbreak-throw.exp ++++ b/gdb/testsuite/gdb.mi/mi-condbreak-throw.exp +@@ -103,7 +103,7 @@ proc run_test { unwind_on_exception } { + "&\"Error in testing condition for breakpoint $bpnum:\\\\n\"" \ + "&\"The program being debugged was signaled while in a function called from GDB\\.\\\\n\"" \ + "&\"GDB remains in the frame where the signal was received\\.\\\\n\"" \ +- "&\"To change this behavior use \\\\\"set unwindonsignal on\\\\\"\\.\\\\n\"" \ ++ "&\"To change this behavior use \\\\\"set unwind-on-signal on\\\\\"\\.\\\\n\"" \ + "&\"Evaluation of the expression containing the function\\\\n\"" \ + "&\"\\(cond_throw\\(\\)\\) will be abandoned\\.\\\\n\"" \ + "&\"When the function is done executing, GDB will silently stop\\.\\\\n\"" \ +diff --git a/gdb/testsuite/gdb.mi/mi-syn-frame.exp b/gdb/testsuite/gdb.mi/mi-syn-frame.exp +--- a/gdb/testsuite/gdb.mi/mi-syn-frame.exp ++++ b/gdb/testsuite/gdb.mi/mi-syn-frame.exp +@@ -94,7 +94,7 @@ mi_gdb_test "409-stack-list-frames 0 0" \ + # + + mi_gdb_test "410-data-evaluate-expression bar()" \ +- ".*410\\^error,msg=\"The program being debugged was signaled while in a function called from GDB.\\\\nGDB remains in the frame where the signal was received.\\\\nTo change this behavior use \\\\\"set unwindonsignal on\\\\\".\\\\nEvaluation of the expression containing the function\\\\n\\(bar\\) will be abandoned.\\\\nWhen the function is done executing, GDB will silently stop.\"" \ ++ ".*410\\^error,msg=\"The program being debugged was signaled while in a function called from GDB.\\\\nGDB remains in the frame where the signal was received.\\\\nTo change this behavior use \\\\\"set unwind-on-signal on\\\\\".\\\\nEvaluation of the expression containing the function\\\\n\\(bar\\) will be abandoned.\\\\nWhen the function is done executing, GDB will silently stop.\"" \ + "call inferior function which raises exception" + + mi_gdb_test "411-stack-list-frames" "411\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"bar\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\",arch=\"$any\"},frame=\{level=\"1\",addr=\"$hex\",func=\"\"\},frame=\{level=\"2\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\",arch=\"$any\"}.*\\\]" "backtrace from inferior function at exception" +diff --git a/gdb/testsuite/gdb.threads/infcall-from-bp-cond-simple.exp b/gdb/testsuite/gdb.threads/infcall-from-bp-cond-simple.exp +--- a/gdb/testsuite/gdb.threads/infcall-from-bp-cond-simple.exp ++++ b/gdb/testsuite/gdb.threads/infcall-from-bp-cond-simple.exp +@@ -173,7 +173,7 @@ proc_with_prefix run_bp_cond_segfaults { target_async target_non_stop } { + "Error in testing condition for breakpoint ${bp_1_num}:" \ + "The program being debugged was signaled while in a function called from GDB\\." \ + "GDB remains in the frame where the signal was received\\." \ +- "To change this behavior use \"set unwindonsignal on\"\\." \ ++ "To change this behavior use \"set unwind-on-signal on\"\\." \ + "Evaluation of the expression containing the function" \ + "\\(function_that_segfaults\\) will be abandoned\\." \ + "When the function is done executing, GDB will silently stop\\."] +diff --git a/gdb/testsuite/gdb.threads/thread-unwindonsignal.exp b/gdb/testsuite/gdb.threads/thread-unwindonsignal.exp +--- a/gdb/testsuite/gdb.threads/thread-unwindonsignal.exp ++++ b/gdb/testsuite/gdb.threads/thread-unwindonsignal.exp +@@ -13,7 +13,7 @@ + # You should have received a copy of the GNU General Public License + # along with this program. If not, see . + +-# Test use of unwindonsignal when a hand function call that gets interrupted ++# Test use of unwind-on-signal when a hand function call that gets interrupted + # by a signal in another thread. + + set NR_THREADS 4 +@@ -49,12 +49,12 @@ gdb_test "continue" \ + # We want the main thread (hand_call_with_signal) and + # thread 1 (sigabrt_handler) to both run. + +-# Do turn on unwindonsignal. ++# Do turn on unwind-on-signal. + # We want to test gdb handling of the current thread changing when + # unwindonsignal is in effect. +-gdb_test_no_output "set unwindonsignal on" \ ++gdb_test_no_output "set unwind-on-signal on" \ + "setting unwindonsignal" +-gdb_test "show unwindonsignal" \ ++gdb_test "show unwind-on-signal" \ + "Unwinding of stack .* is on." \ + "showing unwindonsignal" + diff --git a/gdb-rhel-17399-sect_index_data-not-initialized.patch b/gdb-rhel-17399-sect_index_data-not-initialized.patch deleted file mode 100644 index aefdb75..0000000 --- a/gdb-rhel-17399-sect_index_data-not-initialized.patch +++ /dev/null @@ -1,127 +0,0 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Kevin Buettner -Date: Tue, 25 Jan 2022 14:45:16 -0700 -Subject: gdb-rhel-17399-sect_index_data-not-initialized.patch - -;; Backport "Fix GDB internal error by using text (instead of data) -;; section offset" -;; (Kevin Buettner, RHEL-107399) - -Fedora Rawhide is now using gcc-12.0. As part of updating to the -gcc-12.0 package set, Rawhide is also now using a version of libgcc_s -which lacks a .data section. This causes gdb to fail in the following -fashion while debugging a program (such as gdb) which uses libgcc_s: - - (top-gdb) run - Starting program: rawhide-master/bld/gdb/gdb - ... - objfiles.h:467: internal-error: sect_index_data not initialized - A problem internal to GDB has been detected, - further debugging may prove unreliable. - ... - -I snipped the backtrace from the above output. Instead, here's a -portion of a backtrace obtained using GDB's backtrace command. -(Obviously, in order to obtain it, I used a GDB which has been patched -with this commit.) - - #0 internal_error ( - file=0xc6a508 "gdb/objfiles.h", line=467, - fmt=0xc6a4e8 "sect_index_data not initialized") - at gdbsupport/errors.cc:51 - #1 0x00000000005f9651 in objfile::data_section_offset (this=0x4fa48f0) - at gdb/objfiles.h:467 - #2 0x000000000097c5f8 in relocate_address (address=0x17244, objfile=0x4fa48f0) - at gdb/stap-probe.c:1333 - #3 0x000000000097c630 in stap_probe::get_relocated_address (this=0xa1a17a0, - objfile=0x4fa48f0) - at gdb/stap-probe.c:1341 - #4 0x00000000004d7025 in create_exception_master_breakpoint_probe ( - objfile=0x4fa48f0) - at gdb/breakpoint.c:3505 - #5 0x00000000004d7426 in create_exception_master_breakpoint () - at gdb/breakpoint.c:3575 - #6 0x00000000004efcc1 in breakpoint_re_set () - at gdb/breakpoint.c:13407 - #7 0x0000000000956998 in solib_add (pattern=0x0, from_tty=0, readsyms=1) - at gdb/solib.c:1001 - #8 0x00000000009576a8 in handle_solib_event () - at gdb/solib.c:1269 - ... - -The function 'relocate_address' in gdb/stap-probe.c attempts to do -its "relocation" by using objfile->data_section_offset(). That -method, data_section_offset() is defined as follows in objfiles.h: - - CORE_ADDR data_section_offset () const - { - return section_offsets[SECT_OFF_DATA (this)]; - } - -The internal error occurs when the SECT_OFF_DATA macro finds that the -'sect_index_data' field is -1: - - #define SECT_OFF_DATA(objfile) \ - ((objfile->sect_index_data == -1) \ - ? (internal_error (__FILE__, __LINE__, \ - _("sect_index_data not initialized")), -1) \ - : objfile->sect_index_data) - -relocate_address() is obtaining the section offset in order to compute -a relocated address. For some ABIs, such as the System V ABI, the -section offsets will all be the same. So for those ABIs, it doesn't -matter which offset is used. However, other ABIs, such as the FDPIC -ABI, will have different offsets for the various sections. Thus, for -those ABIs, it is vital that this and other relocation code use the -correct offset. - -In stap_probe::get_relocated_address, the address to which to add the -offset (thus forming the relocated address) is obtained via -this->get_address (); get_address is a getter for m_address in -probe.h. It's documented/defined as follows (also in probe.h): - - /* The address where the probe is inserted, relative to - SECT_OFF_TEXT. */ - CORE_ADDR m_address; - -(Thanks to Tom Tromey for this observation.) - -So, based on this, the current use of data_section_offset / -SECT_OFF_DATA is wrong. This relocation code should have been using -text_section_offset / SECT_OFF_TEXT all along. That being the -case, I've adjusted the stap-probe.c relocation code accordingly. - -Searching the sources turned up one other use of data_section_offset, -in gdb/dtrace-probe.c, so I've updated that code as well. The same -reasoning presented above applies to this case too. - -Summary: - - * gdb/dtrace-probe.c (dtrace_probe::get_relocated_address): - Use method text_section_offset instead of data_section_offset. - * gdb/stap-probe.c (relocate_address): Likewise. - -diff --git a/gdb/dtrace-probe.c b/gdb/dtrace-probe.c ---- a/gdb/dtrace-probe.c -+++ b/gdb/dtrace-probe.c -@@ -685,7 +685,7 @@ dtrace_probe::is_enabled () const - CORE_ADDR - dtrace_probe::get_relocated_address (struct objfile *objfile) - { -- return this->get_address () + objfile->data_section_offset (); -+ return this->get_address () + objfile->text_section_offset (); - } - - /* Implementation of the get_argument_count method. */ -diff --git a/gdb/stap-probe.c b/gdb/stap-probe.c ---- a/gdb/stap-probe.c -+++ b/gdb/stap-probe.c -@@ -1290,7 +1290,7 @@ stap_probe::parse_arguments (struct gdbarch *gdbarch) - static CORE_ADDR - relocate_address (CORE_ADDR address, struct objfile *objfile) - { -- return address + objfile->data_section_offset (); -+ return address + objfile->text_section_offset (); - } - - /* Implementation of the get_relocated_address method. */ diff --git a/gdb-rhel-19390-pc-not-saved.patch b/gdb-rhel-19390-pc-not-saved.patch new file mode 100644 index 0000000..3bfd212 --- /dev/null +++ b/gdb-rhel-19390-pc-not-saved.patch @@ -0,0 +1,379 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Andrew Burgess +Date: Wed, 24 Jan 2024 13:52:59 +0000 +Subject: gdb-rhel-19390-pc-not-saved.patch + +;;gdb/unwinders: better support for $pc not saved +;;(Andrew Burgess, RHEL-19390) + +This started with a Red Hat bug report which can be seen here: + + https://bugzilla.redhat.com/show_bug.cgi?id=1850710 + +The problem reported here was using GDB on GNU/Linux for S390, the +user stepped into JIT generated code. As they enter the JIT code GDB +would report 'PC not saved', and this same message would be reported +after each step/stepi. + +Additionally, the user had 'set disassemble-next-line on', and once +they entered the JIT code this output was not displayed, nor were any +'display' directives displayed. + +The user is not making use of the JIT plugin API to provide debug +information. But that's OK, they aren't expecting any source level +debug here, they are happy to use 'stepi', but the missing 'display' +directives are a problem, as is the constant 'PC not saved' (error) +message. + +What is happening here is that as GDB is failing to find any debug +information for the JIT generated code, it is falling back on to the +S390 prologue unwinder to try and unwind frame #0. Unfortunately, +without being able to identify the function boundaries, the S390 +prologue scanner can't help much, in fact, it doesn't even suggest an +arbitrary previous $pc value (some targets that use a link-register +will, by default, assume the link-register contains the previous $pc), +instead the S390 will just say, "sorry, I have no previous $pc value". + +The result of this is that when GDB tries to find frame #1 we end +throwing an error from frame_unwind_pc (the 'PC not saved' error). +This error is not caught anywhere except at the top-level interpreter +loop, and so we end up skipping all the 'display' directive handling. + +While thinking about this, I wondered, could I trigger the same error +using the Python Unwinder API? What happens if a Python unwinder +claims a frame, but then fails to provide a previous $pc value? + +Turns out that exactly the same thing happens, which is great, as that +means we now have a way to reproduce this bug on any target. And so +the test included with this patch does just this. I have a Python +unwinder that claims a frame, but doesn't provide any previous +register values. + +I then do two tests, first I stop in the claimed frame (i.e. frame #0 +is the frame that can't be unwound), I perform a few steps, and check +the backtrace. And second, I stop in a child of the problem +frame (i.e. frame #1 is the frame that can't be unwound), and from +here I check the backtrace. + +While all this is going on I have a 'display' directive in place, and +each time GDB stops I check that the display directive triggers. + +Additionally, when checking the backtrace, I am checking that the +backtrace finishes with the message 'Backtrace stopped: frame did not +save the PC'. + +As for the fix I chose to add a call to frame_unwind_pc directly to +get_prev_frame_always_1. Calling frame_unwind_pc will cache the +unwound $pc value, so this doesn't add much additional work as +immediately after the new frame_unwind_pc call, we call +get_prev_frame_maybe_check_cycle, which actually generates the +previous frame, which will always (I think) require a call to +frame_unwind_pc anyway. + +The reason for adding the frame_unwind_pc call into +get_prev_frame_always_1, is that if the frame_unwind_pc call fails we +want to set the frames 'stop_reason', and get_prev_frame_always_1 +seems to be the place where this is done, so I wanted to keep the new +stop_reason setting code next to all the existing stop_reason setting +code. + +Additionally, once we enter get_prev_frame_maybe_check_cycle we +actually create the previous frame, then, if it turns out that the +previous frame can't be created we need to remove the frame .. this +seemed more complex than just making the check in +get_prev_frame_always_1. + +With this fix in place the original S390 bug is fixed, and also the +test added in this commit, that uses the Python API, is also fixed. + +Reviewed-By: Kevin Buettner + +diff --git a/gdb/frame.c b/gdb/frame.c +--- a/gdb/frame.c ++++ b/gdb/frame.c +@@ -2422,6 +2422,38 @@ get_prev_frame_always_1 (frame_info_ptr this_frame) + } + } + ++ /* Ensure we can unwind the program counter of THIS_FRAME. */ ++ try ++ { ++ /* Calling frame_unwind_pc for the sentinel frame relies on the ++ current_frame being set, which at this point it might not be if we ++ are in the process of setting the current_frame after a stop (see ++ get_current_frame). ++ ++ The point of this check is to ensure that the unwinder for ++ THIS_FRAME can actually unwind the $pc, which we assume the ++ sentinel frame unwinder can always do (it's just a read from the ++ machine state), so we only call frame_unwind_pc for frames other ++ than the sentinel (level -1) frame. ++ ++ Additionally, we don't actually care about the value of the ++ unwound $pc, just that the call completed successfully. */ ++ if (this_frame->level >= 0) ++ frame_unwind_pc (this_frame); ++ } ++ catch (const gdb_exception_error &ex) ++ { ++ if (ex.error == NOT_AVAILABLE_ERROR || ex.error == OPTIMIZED_OUT_ERROR) ++ { ++ frame_debug_printf (" -> nullptr // no saved PC"); ++ this_frame->stop_reason = UNWIND_NO_SAVED_PC; ++ this_frame->prev = nullptr; ++ return nullptr; ++ } ++ ++ throw; ++ } ++ + return get_prev_frame_maybe_check_cycle (this_frame); + } + +diff --git a/gdb/testsuite/gdb.base/pc-not-saved.c b/gdb/testsuite/gdb.base/pc-not-saved.c +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.base/pc-not-saved.c +@@ -0,0 +1,48 @@ ++/* This testcase is part of GDB, the GNU debugger. ++ ++ Copyright 2024 Free Software Foundation, Inc. ++ ++ This program is free software; you can 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 . */ ++ ++volatile int global_var = 0; ++ ++void ++other_func (void) ++{ ++ /* Nothing. */ ++} ++ ++void ++break_bt_here (void) ++{ ++ /* This is all nonsense; just filler so this function has a body. */ ++ if (global_var != 99) ++ global_var++; ++ if (global_var != 98) ++ global_var++; ++ if (global_var != 97) ++ global_var++; ++ if (global_var != 96) ++ global_var++; ++ other_func (); ++ if (global_var != 95) ++ global_var++; ++} ++ ++int ++main (void) ++{ ++ break_bt_here (); ++ return 0; ++} +diff --git a/gdb/testsuite/gdb.base/pc-not-saved.exp b/gdb/testsuite/gdb.base/pc-not-saved.exp +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.base/pc-not-saved.exp +@@ -0,0 +1,113 @@ ++# Copyright 2024 Free Software Foundation, Inc. ++ ++# This program is free software; you can 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 how GDB handles a frame in which the previous-pc value is not ++# available. Specifically, check that the backtrace correctly reports ++# why the backtrace is truncated, and ensure that 'display' directives ++# still work when 'stepi'-ing through the frame. ++# ++# We do this by registering a Python unwinder which doesn't provide ++# any previous register values. ++ ++require allow_python_tests ++ ++standard_testfile ++ ++if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } { ++ return ++} ++ ++set remote_python_file \ ++ [gdb_remote_download host "${srcdir}/${subdir}/${testfile}.py"] ++ ++if { ![runto "break_bt_here"] } { ++ return ++} ++ ++# Figuring out the correct frame-id from a Python unwinder is hard. ++# We need to know the function's start address (not too hard), and the ++# stack address on entry to the function, which is much harder to ++# figure out in a cross-target way. ++# ++# So instead we run without any Python unwinder in place and use ++# 'maint print frame-id' to record the frame-id. We then restart GDB, ++# load the Python unwinder, and tell it to use the frame-id we ++# recorded here. ++set pc unknown ++set cfa unknown ++gdb_test_multiple "maintenance print frame-id" "store break_bt_here frame-id" { ++ -re -wrap "frame-id for frame #0: \\{stack=($hex),code=($hex),\[^\}\]+\\}" { ++ set cfa $expect_out(1,string) ++ set pc $expect_out(1,string) ++ } ++} ++gdb_assert { ![string equal $cfa unknown] } \ ++ "check we read the frame's CFA" ++ ++gdb_assert { ![string equal $pc unknown] } \ ++ "check we read the frame's PC" ++ ++# Restart and load the Python unwinder script. ++clean_restart $binfile ++gdb_test_no_output "source ${remote_python_file}" "load python file" ++ ++# Tell the Python unwinder to use the frame-id we cached above. ++gdb_test_no_output "python set_break_bt_here_frame_id($pc, $cfa)" ++ ++# Run up to the function which the unwinder will claim. ++if { ![runto "break_bt_here"] } { ++ return ++} ++ ++# Print the backtrace. Check that the reason for stopping the ++# backtrace is that the previous $pc is not available. ++gdb_test "bt" \ ++ [multi_line \ ++ "^#0 break_bt_here \\(\\) at \[^\r\n\]+" \ ++ "Backtrace stopped: frame did not save the PC"] \ ++ "backtrace from break_bt_here function" ++ ++# Ensure we can stepi. ++gdb_test "stepi" \ ++ "(:?$hex\\s+)?$decimal\\s+\[^\r\n\]+" \ ++ "stepi without a display in place" ++ ++# Setup a 'display' directive. ++gdb_test "display/i \$pc" \ ++ [multi_line \ ++ "^1: x/i \\\$pc" \ ++ "=> $hex :\\s+\[^\r\n\]+"] ++ ++# Step again, check the 'display' directive is shown. ++gdb_test "stepi" \ ++ [multi_line \ ++ "(:?$hex\\s+)?$decimal\\s+\[^\r\n\]+" \ ++ "1: x/i \\\$pc" \ ++ "=> $hex :\\s+\[^\r\n\]+"] \ ++ "stepi with a display in place" ++ ++# Continue to a function that is called from within break_bt_here. ++# The Python unwinder will then be claiming frame #1. ++gdb_breakpoint other_func ++gdb_continue_to_breakpoint "continue to other_func" ++ ++# Print the backtrace and check that the reason for stopping the ++# backtrace is that the previous $pc is not available. ++gdb_test "bt" \ ++ [multi_line \ ++ "#0 other_func \\(\\) at \[^\r\n\]+" \ ++ "#1 (:?$hex in )?break_bt_here \\(\\) at \[^\r\n\]+" \ ++ "Backtrace stopped: frame did not save the PC"] \ ++ "backtrace from other_func function" +diff --git a/gdb/testsuite/gdb.base/pc-not-saved.py b/gdb/testsuite/gdb.base/pc-not-saved.py +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.base/pc-not-saved.py +@@ -0,0 +1,71 @@ ++# Copyright (C) 2024 Free Software Foundation, Inc. ++ ++# This program is free software; you can 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 . ++ ++import gdb ++from gdb.unwinder import Unwinder, FrameId ++ ++# Cached FrameId. See set_break_bt_here_frame_id for details. ++break_bt_here_frame_id = None ++ ++ ++def set_break_bt_here_frame_id(pc, cfa): ++ """Call this to pre-calculate the FrameId for the frame our unwinder ++ is going to claim, this avoids us having to actually figure out a ++ frame-id within the unwinder, something which is going to be hard ++ to do in a cross-target way. ++ ++ Instead we first run the test without the Python unwinder in ++ place, use 'maint print frame-id' to record the frame-id, then, ++ after loading this Python script, we all this function to record ++ the frame-id that the unwinder should use.""" ++ global break_bt_here_frame_id ++ break_bt_here_frame_id = FrameId(cfa, pc) ++ ++ ++class break_unwinding(Unwinder): ++ ++ """An unwinder for the function 'break_bt_here'. This unwinder will ++ claim any frame for the function in question, but doesn't provide ++ any unwound register values. Importantly, we don't provide a ++ previous $pc value, this means that if we are stopped in ++ 'break_bt_here' then we should fail to unwind beyond frame #0.""" ++ ++ def __init__(self): ++ Unwinder.__init__(self, "break unwinding") ++ ++ def __call__(self, pending_frame): ++ pc_desc = pending_frame.architecture().registers().find("pc") ++ pc = pending_frame.read_register(pc_desc) ++ ++ if pc.is_optimized_out: ++ return None ++ ++ block = gdb.block_for_pc(pc) ++ if block == None: ++ return None ++ func = block.function ++ if func == None: ++ return None ++ if str(func) != "break_bt_here": ++ return None ++ ++ global break_bt_here_frame_id ++ if break_bt_here_frame_id is None: ++ return None ++ ++ return pending_frame.create_unwind_info(break_bt_here_frame_id) ++ ++ ++gdb.unwinder.register_unwinder(None, break_unwinding(), True) diff --git a/gdb-rhel-10550-add-arch14-record.patch b/gdb-rhel-36225-add-arch14-record.patch similarity index 91% rename from gdb-rhel-10550-add-arch14-record.patch rename to gdb-rhel-36225-add-arch14-record.patch index 6002e99..31c15f9 100644 --- a/gdb-rhel-10550-add-arch14-record.patch +++ b/gdb-rhel-36225-add-arch14-record.patch @@ -1,10 +1,10 @@ From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 From: Andreas Arnez Date: Tue, 13 Feb 2024 18:55:29 +0100 -Subject: gdb-rhel-10550-add-arch14-record.patch +Subject: gdb-rhel-36225-add-arch14-record.patch ;; Backport "gdb: s390: Add arch14 record/replay support" -;; (Andreas Arnez, RHEL-10550) +;; (Andreas Arnez, RHEL-36225) Enable recording of the new "arch14" instructions on z/Architecture targets, except for the specialized-function-assist instruction NNPA. @@ -12,7 +12,7 @@ targets, except for the specialized-function-assist instruction NNPA. diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c --- a/gdb/s390-tdep.c +++ b/gdb/s390-tdep.c -@@ -5529,6 +5529,14 @@ s390_process_record (struct gdbarch *gdbarch, struct regcache *regcache, +@@ -5534,6 +5534,14 @@ s390_process_record (struct gdbarch *gdbarch, struct regcache *regcache, case 0xe635: /* VLRL - vector load rightmost with immed. length */ case 0xe637: /* VLRLR - vector load rightmost with length */ case 0xe649: /* VLIP - vector load immediate decimal */ @@ -27,7 +27,7 @@ diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c case 0xe700: /* VLEB - vector load element */ case 0xe701: /* VLEH - vector load element */ case 0xe702: /* VLEG - vector load element */ -@@ -5786,11 +5794,16 @@ s390_process_record (struct gdbarch *gdbarch, struct regcache *regcache, +@@ -5791,11 +5799,16 @@ s390_process_record (struct gdbarch *gdbarch, struct regcache *regcache, /* 0xe747-0xe749 undefined */ diff --git a/gdb-rhel-36518-add-power11-support.patch b/gdb-rhel-36518-add-power11-support.patch new file mode 100644 index 0000000..805a868 --- /dev/null +++ b/gdb-rhel-36518-add-power11-support.patch @@ -0,0 +1,48 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Peter Bergner +Date: Fri, 9 Feb 2024 10:51:30 -0600 +Subject: gdb-rhel-36518-add-power11-support.patch + +;; Backport "PowerPC: Add support for Power11 options" +;; (Peter Bergner, RHEL-36518) + +opcodes/ + * ppc-dis.c (ppc_opts): Add "power11" and "pwr11" entries. + (powerpc_init_dialect): Default to "power11". + +diff --git a/opcodes/ppc-dis.c b/opcodes/ppc-dis.c +--- a/opcodes/ppc-dis.c ++++ b/opcodes/ppc-dis.c +@@ -208,6 +208,11 @@ struct ppc_mopt ppc_opts[] = { + | PPC_OPCODE_POWER7 | PPC_OPCODE_POWER8 | PPC_OPCODE_POWER9 + | PPC_OPCODE_POWER10 | PPC_OPCODE_ALTIVEC | PPC_OPCODE_VSX), + 0 }, ++ { "power11", (PPC_OPCODE_PPC | PPC_OPCODE_ISEL | PPC_OPCODE_64 ++ | PPC_OPCODE_POWER4 | PPC_OPCODE_POWER5 | PPC_OPCODE_POWER6 ++ | PPC_OPCODE_POWER7 | PPC_OPCODE_POWER8 | PPC_OPCODE_POWER9 ++ | PPC_OPCODE_POWER10 | PPC_OPCODE_ALTIVEC | PPC_OPCODE_VSX), ++ 0 }, + { "libresoc",(PPC_OPCODE_PPC | PPC_OPCODE_ISEL | PPC_OPCODE_64 + | PPC_OPCODE_POWER4 | PPC_OPCODE_POWER5 | PPC_OPCODE_POWER6 + | PPC_OPCODE_POWER7 | PPC_OPCODE_POWER8 | PPC_OPCODE_POWER9 +@@ -267,6 +272,11 @@ struct ppc_mopt ppc_opts[] = { + | PPC_OPCODE_POWER7 | PPC_OPCODE_POWER8 | PPC_OPCODE_POWER9 + | PPC_OPCODE_POWER10 | PPC_OPCODE_ALTIVEC | PPC_OPCODE_VSX), + 0 }, ++ { "pwr11", (PPC_OPCODE_PPC | PPC_OPCODE_ISEL | PPC_OPCODE_64 ++ | PPC_OPCODE_POWER4 | PPC_OPCODE_POWER5 | PPC_OPCODE_POWER6 ++ | PPC_OPCODE_POWER7 | PPC_OPCODE_POWER8 | PPC_OPCODE_POWER9 ++ | PPC_OPCODE_POWER10 | PPC_OPCODE_ALTIVEC | PPC_OPCODE_VSX), ++ 0 }, + { "pwrx", PPC_OPCODE_POWER | PPC_OPCODE_POWER2, + 0 }, + { "raw", PPC_OPCODE_PPC, +@@ -396,7 +406,7 @@ powerpc_init_dialect (struct disassemble_info *info) + break; + default: + if (info->arch == bfd_arch_powerpc) +- dialect = ppc_parse_cpu (dialect, &sticky, "power10") | PPC_OPCODE_ANY; ++ dialect = ppc_parse_cpu (dialect, &sticky, "power11") | PPC_OPCODE_ANY; + else + dialect = ppc_parse_cpu (dialect, &sticky, "pwr"); + break; diff --git a/gdb-rhel-36527-apx-disasm.patch b/gdb-rhel-36527-apx-disasm.patch new file mode 100644 index 0000000..e143e99 --- /dev/null +++ b/gdb-rhel-36527-apx-disasm.patch @@ -0,0 +1,7834 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Keith Seitz +Date: Wed, 15 May 2024 09:59:51 -0700 +Subject: gdb-rhel-36527-apx-disasm.patch + +;; Update x86 disassembler + +Update x86 disassembler with APX improvements by syncing +with gdb-15.1 release candidate. + +Resolves: RHEL-36527 + +diff --git a/include/opcode/i386.h b/include/opcode/i386.h +--- a/include/opcode/i386.h ++++ b/include/opcode/i386.h +@@ -1,5 +1,5 @@ + /* opcode/i386.h -- Intel 80386 opcode macros +- Copyright (C) 1989-2023 Free Software Foundation, Inc. ++ Copyright (C) 1989-2024 Free Software Foundation, Inc. + + This file is part of GAS, the GNU Assembler, and GDB, the GNU Debugger. + +@@ -112,9 +112,13 @@ + /* x86-64 extension prefix. */ + #define REX_OPCODE 0x40 + ++#define REX2_OPCODE 0xd5 ++ + /* Non-zero if OPCODE is the rex prefix. */ + #define REX_PREFIX_P(opcode) (((opcode) & 0xf0) == REX_OPCODE) + ++/* M0 in rex2 prefix represents map0 or map1. */ ++#define REX2_M 0x8 + /* Indicates 64 bit operand size. */ + #define REX_W 8 + /* High extension to reg field of modrm byte. */ +diff --git a/opcodes/i386-dis-evex-mod.h b/opcodes/i386-dis-evex-mod.h +--- a/opcodes/i386-dis-evex-mod.h ++++ b/opcodes/i386-dis-evex-mod.h +@@ -1 +1,10 @@ +-/* Nothing at present. */ ++ /* MOD_EVEX_MAP4_F8_P1 */ ++ { ++ { "enqcmds", { Gva, M }, 0 }, ++ { VEX_W_TABLE (EVEX_W_MAP4_F8_P1_M_1) }, ++ }, ++ /* MOD_EVEX_MAP4_F8_P3 */ ++ { ++ { "enqcmd", { Gva, M }, 0 }, ++ { VEX_W_TABLE (EVEX_W_MAP4_F8_P3_M_1) }, ++ }, +diff --git a/opcodes/i386-dis-evex-prefix.h b/opcodes/i386-dis-evex-prefix.h +--- a/opcodes/i386-dis-evex-prefix.h ++++ b/opcodes/i386-dis-evex-prefix.h +@@ -338,6 +338,29 @@ + { "vcmpp%XH", { MaskG, Vex, EXxh, EXxEVexS, CMP }, 0 }, + { "vcmps%XH", { MaskG, VexScalar, EXw, EXxEVexS, CMP }, 0 }, + }, ++ /* PREFIX_EVEX_MAP4_F0 */ ++ { ++ { "crc32A", { Gdq, Eb }, 0 }, ++ { "invept", { Gm, Mo }, 0 }, ++ }, ++ /* PREFIX_EVEX_MAP4_F1 */ ++ { ++ { "crc32Q", { Gdq, Ev }, 0 }, ++ { "invvpid", { Gm, Mo }, 0 }, ++ { "crc32Q", { Gdq, Ev }, 0 }, ++ }, ++ /* PREFIX_EVEX_MAP4_F2 */ ++ { ++ { Bad_Opcode }, ++ { "invpcid", { Gm, M }, 0 }, ++ }, ++ /* PREFIX_EVEX_MAP4_F8 */ ++ { ++ { Bad_Opcode }, ++ { MOD_TABLE (MOD_EVEX_MAP4_F8_P_1) }, ++ { "movdir64b", { Gva, M }, 0 }, ++ { MOD_TABLE (MOD_EVEX_MAP4_F8_P_3) }, ++ }, + /* PREFIX_EVEX_MAP5_10 */ + { + { Bad_Opcode }, +diff --git a/opcodes/i386-dis-evex-reg.h b/opcodes/i386-dis-evex-reg.h +--- a/opcodes/i386-dis-evex-reg.h ++++ b/opcodes/i386-dis-evex-reg.h +@@ -49,3 +49,74 @@ + { "vscatterpf0qp%XW", { MVexVSIBQWpX }, PREFIX_DATA }, + { "vscatterpf1qp%XW", { MVexVSIBQWpX }, PREFIX_DATA }, + }, ++ /* REG_EVEX_MAP4_80 */ ++ { ++ { "%NFaddA", { VexGb, Eb, Ib }, NO_PREFIX }, ++ { "%NForA", { VexGb, Eb, Ib }, NO_PREFIX }, ++ { "adcA", { VexGb, Eb, Ib }, NO_PREFIX }, ++ { "sbbA", { VexGb, Eb, Ib }, NO_PREFIX }, ++ { "%NFandA", { VexGb, Eb, Ib }, NO_PREFIX }, ++ { "%NFsubA", { VexGb, Eb, Ib }, NO_PREFIX }, ++ { "%NFxorA", { VexGb, Eb, Ib }, NO_PREFIX }, ++ }, ++ /* REG_EVEX_MAP4_81 */ ++ { ++ { "%NFaddQ", { VexGv, Ev, Iv }, PREFIX_NP_OR_DATA }, ++ { "%NForQ", { VexGv, Ev, Iv }, PREFIX_NP_OR_DATA }, ++ { "adcQ", { VexGv, Ev, Iv }, PREFIX_NP_OR_DATA }, ++ { "sbbQ", { VexGv, Ev, Iv }, PREFIX_NP_OR_DATA }, ++ { "%NFandQ", { VexGv, Ev, Iv }, PREFIX_NP_OR_DATA }, ++ { "%NFsubQ", { VexGv, Ev, Iv }, PREFIX_NP_OR_DATA }, ++ { "%NFxorQ", { VexGv, Ev, Iv }, PREFIX_NP_OR_DATA }, ++ }, ++ /* REG_EVEX_MAP4_83 */ ++ { ++ { "%NFaddQ", { VexGv, Ev, sIb }, PREFIX_NP_OR_DATA }, ++ { "%NForQ", { VexGv, Ev, sIb }, PREFIX_NP_OR_DATA }, ++ { "adcQ", { VexGv, Ev, sIb }, PREFIX_NP_OR_DATA }, ++ { "sbbQ", { VexGv, Ev, sIb }, PREFIX_NP_OR_DATA }, ++ { "%NFandQ", { VexGv, Ev, sIb }, PREFIX_NP_OR_DATA }, ++ { "%NFsubQ", { VexGv, Ev, sIb }, PREFIX_NP_OR_DATA }, ++ { "%NFxorQ", { VexGv, Ev, sIb }, PREFIX_NP_OR_DATA }, ++ }, ++ /* REG_EVEX_MAP4_8F */ ++ { ++ { VEX_W_TABLE (EVEX_W_MAP4_8F_R_0) }, ++ }, ++ /* REG_EVEX_MAP4_F6 */ ++ { ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { "notA", { VexGb, Eb }, NO_PREFIX }, ++ { "%NFnegA", { VexGb, Eb }, NO_PREFIX }, ++ { "%NFmulA", { Eb }, NO_PREFIX }, ++ { "%NFimulA", { Eb }, NO_PREFIX }, ++ { "%NFdivA", { Eb }, NO_PREFIX }, ++ { "%NFidivA", { Eb }, NO_PREFIX }, ++ }, ++ /* REG_EVEX_MAP4_F7 */ ++ { ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { "notQ", { VexGv, Ev }, PREFIX_NP_OR_DATA }, ++ { "%NFnegQ", { VexGv, Ev }, PREFIX_NP_OR_DATA }, ++ { "%NFmulQ", { Ev }, PREFIX_NP_OR_DATA }, ++ { "%NFimulQ", { Ev }, PREFIX_NP_OR_DATA }, ++ { "%NFdivQ", { Ev }, PREFIX_NP_OR_DATA }, ++ { "%NFidivQ", { Ev }, PREFIX_NP_OR_DATA }, ++ }, ++ /* REG_EVEX_MAP4_FE */ ++ { ++ { "%NFincA", { VexGb, Eb }, NO_PREFIX }, ++ { "%NFdecA", { VexGb, Eb }, NO_PREFIX }, ++ }, ++ /* REG_EVEX_MAP4_FF */ ++ { ++ { "%NFincQ", { VexGv, Ev }, PREFIX_NP_OR_DATA }, ++ { "%NFdecQ", { VexGv, Ev }, PREFIX_NP_OR_DATA }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { VEX_W_TABLE (EVEX_W_MAP4_FF_R_6) }, ++ }, +diff --git a/opcodes/i386-dis-evex-w.h b/opcodes/i386-dis-evex-w.h +--- a/opcodes/i386-dis-evex-w.h ++++ b/opcodes/i386-dis-evex-w.h +@@ -442,6 +442,24 @@ + { Bad_Opcode }, + { "vpshrdw", { XM, Vex, EXx, Ib }, 0 }, + }, ++ /* EVEX_W_MAP4_8F_R_0 */ ++ { ++ { "pop2", { { PUSH2_POP2_Fixup, q_mode}, Eq }, NO_PREFIX }, ++ { "pop2p", { { PUSH2_POP2_Fixup, q_mode}, Eq }, NO_PREFIX }, ++ }, ++ /* EVEX_W_MAP4_F8_P1_M_1 */ ++ { ++ { "uwrmsr", { Gq, Eq }, 0 }, ++ }, ++ /* EVEX_W_MAP4_F8_P3_M_1 */ ++ { ++ { "urdmsr", { Eq, Gq }, 0 }, ++ }, ++ /* EVEX_W_MAP4_FF_R_6 */ ++ { ++ { "push2", { { PUSH2_POP2_Fixup, q_mode}, Eq }, 0 }, ++ { "push2p", { { PUSH2_POP2_Fixup, q_mode}, Eq }, 0 }, ++ }, + /* EVEX_W_MAP5_5B_P_0 */ + { + { "vcvtdq2ph%XY", { XMxmmq, EXx, EXxEVexR }, 0 }, +diff --git a/opcodes/i386-dis-evex.h b/opcodes/i386-dis-evex.h +--- a/opcodes/i386-dis-evex.h ++++ b/opcodes/i386-dis-evex.h +@@ -164,10 +164,10 @@ static const struct dis386 evex_table[][256] = { + { Bad_Opcode }, + { Bad_Opcode }, + /* 90 */ +- { Bad_Opcode }, +- { Bad_Opcode }, +- { Bad_Opcode }, +- { Bad_Opcode }, ++ { X86_64_EVEX_W_TABLE (VEX_W_0F90_L_0) }, ++ { X86_64_EVEX_W_TABLE (VEX_W_0F91_L_0) }, ++ { X86_64_EVEX_W_TABLE (VEX_W_0F92_L_0) }, ++ { X86_64_EVEX_W_TABLE (VEX_W_0F93_L_0) }, + { Bad_Opcode }, + { Bad_Opcode }, + { Bad_Opcode }, +@@ -375,9 +375,9 @@ static const struct dis386 evex_table[][256] = { + { "vpsllv%DQ", { XM, Vex, EXx }, PREFIX_DATA }, + /* 48 */ + { Bad_Opcode }, ++ { X86_64_EVEX_MEM_W_TABLE (VEX_W_0F3849_X86_64_L_0) }, + { Bad_Opcode }, +- { Bad_Opcode }, +- { Bad_Opcode }, ++ { X86_64_EVEX_MEM_W_TABLE (VEX_W_0F384B_X86_64_L_0) }, + { "vrcp14p%XW", { XM, EXx }, PREFIX_DATA }, + { "vrcp14s%XW", { XMScalar, VexScalar, EXdq }, PREFIX_DATA }, + { "vrsqrt14p%XW", { XM, EXx }, 0 }, +@@ -545,32 +545,32 @@ static const struct dis386 evex_table[][256] = { + { "%XEvaesdecY", { XM, Vex, EXx }, PREFIX_DATA }, + { "%XEvaesdeclastY", { XM, Vex, EXx }, PREFIX_DATA }, + /* E0 */ +- { Bad_Opcode }, +- { Bad_Opcode }, +- { Bad_Opcode }, +- { Bad_Opcode }, +- { Bad_Opcode }, +- { Bad_Opcode }, +- { Bad_Opcode }, +- { Bad_Opcode }, ++ { X86_64_EVEX_FROM_VEX_TABLE (X86_64_VEX_0F38E0) }, ++ { X86_64_EVEX_FROM_VEX_TABLE (X86_64_VEX_0F38E1) }, ++ { X86_64_EVEX_FROM_VEX_TABLE (X86_64_VEX_0F38E2) }, ++ { X86_64_EVEX_FROM_VEX_TABLE (X86_64_VEX_0F38E3) }, ++ { X86_64_EVEX_FROM_VEX_TABLE (X86_64_VEX_0F38E4) }, ++ { X86_64_EVEX_FROM_VEX_TABLE (X86_64_VEX_0F38E5) }, ++ { X86_64_EVEX_FROM_VEX_TABLE (X86_64_VEX_0F38E6) }, ++ { X86_64_EVEX_FROM_VEX_TABLE (X86_64_VEX_0F38E7) }, + /* E8 */ +- { Bad_Opcode }, +- { Bad_Opcode }, +- { Bad_Opcode }, +- { Bad_Opcode }, +- { Bad_Opcode }, +- { Bad_Opcode }, +- { Bad_Opcode }, +- { Bad_Opcode }, ++ { X86_64_EVEX_FROM_VEX_TABLE (X86_64_VEX_0F38E8) }, ++ { X86_64_EVEX_FROM_VEX_TABLE (X86_64_VEX_0F38E9) }, ++ { X86_64_EVEX_FROM_VEX_TABLE (X86_64_VEX_0F38EA) }, ++ { X86_64_EVEX_FROM_VEX_TABLE (X86_64_VEX_0F38EB) }, ++ { X86_64_EVEX_FROM_VEX_TABLE (X86_64_VEX_0F38EC) }, ++ { X86_64_EVEX_FROM_VEX_TABLE (X86_64_VEX_0F38ED) }, ++ { X86_64_EVEX_FROM_VEX_TABLE (X86_64_VEX_0F38EE) }, ++ { X86_64_EVEX_FROM_VEX_TABLE (X86_64_VEX_0F38EF) }, + /* F0 */ + { Bad_Opcode }, + { Bad_Opcode }, ++ { X86_64_EVEX_PFX_TABLE (PREFIX_VEX_0F38F2_L_0) }, ++ { X86_64_EVEX_PFX_TABLE (PREFIX_VEX_0F38F3_L_0) }, + { Bad_Opcode }, +- { Bad_Opcode }, +- { Bad_Opcode }, +- { Bad_Opcode }, +- { Bad_Opcode }, +- { Bad_Opcode }, ++ { X86_64_EVEX_PFX_TABLE (PREFIX_VEX_0F38F5_L_0) }, ++ { X86_64_EVEX_PFX_TABLE (PREFIX_VEX_0F38F6_L_0) }, ++ { X86_64_EVEX_PFX_TABLE (PREFIX_VEX_0F38F7_L_0) }, + /* F8 */ + { Bad_Opcode }, + { Bad_Opcode }, +@@ -854,7 +854,7 @@ static const struct dis386 evex_table[][256] = { + { Bad_Opcode }, + { Bad_Opcode }, + /* F0 */ +- { Bad_Opcode }, ++ { X86_64_EVEX_PFX_TABLE (PREFIX_VEX_0F3AF0_L_0) }, + { Bad_Opcode }, + { Bad_Opcode }, + { Bad_Opcode }, +@@ -872,6 +872,297 @@ static const struct dis386 evex_table[][256] = { + { Bad_Opcode }, + { Bad_Opcode }, + }, ++ /* EVEX_MAP4_ */ ++ { ++ /* 00 */ ++ { "%NFaddB", { VexGb, Eb, Gb }, NO_PREFIX }, ++ { "%NFaddS", { VexGv, Ev, Gv }, PREFIX_NP_OR_DATA }, ++ { "%NFaddB", { VexGb, Gb, EbS }, NO_PREFIX }, ++ { "%NFaddS", { VexGv, Gv, EvS }, PREFIX_NP_OR_DATA }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ /* 08 */ ++ { "%NForB", { VexGb, Eb, Gb }, NO_PREFIX }, ++ { "%NForS", { VexGv, Ev, Gv }, PREFIX_NP_OR_DATA }, ++ { "%NForB", { VexGb, Gb, EbS }, NO_PREFIX }, ++ { "%NForS", { VexGv, Gv, EvS }, PREFIX_NP_OR_DATA }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ /* 10 */ ++ { "adcB", { VexGb, Eb, Gb }, NO_PREFIX }, ++ { "adcS", { VexGv, Ev, Gv }, PREFIX_NP_OR_DATA }, ++ { "adcB", { VexGb, Gb, EbS }, NO_PREFIX }, ++ { "adcS", { VexGv, Gv, EvS }, PREFIX_NP_OR_DATA }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ /* 18 */ ++ { "sbbB", { VexGb, Eb, Gb }, NO_PREFIX }, ++ { "sbbS", { VexGv, Ev, Gv }, PREFIX_NP_OR_DATA }, ++ { "sbbB", { VexGb, Gb, EbS }, NO_PREFIX }, ++ { "sbbS", { VexGv, Gv, EvS }, PREFIX_NP_OR_DATA }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ /* 20 */ ++ { "%NFandB", { VexGb, Eb, Gb }, NO_PREFIX }, ++ { "%NFandS", { VexGv, Ev, Gv }, PREFIX_NP_OR_DATA }, ++ { "%NFandB", { VexGb, Gb, EbS }, NO_PREFIX }, ++ { "%NFandS", { VexGv, Gv, EvS }, PREFIX_NP_OR_DATA }, ++ { "%NFshldS", { VexGv, Ev, Gv, Ib }, PREFIX_NP_OR_DATA }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ /* 28 */ ++ { "%NFsubB", { VexGb, Eb, Gb }, NO_PREFIX }, ++ { "%NFsubS", { VexGv, Ev, Gv }, PREFIX_NP_OR_DATA }, ++ { "%NFsubB", { VexGb, Gb, EbS }, NO_PREFIX }, ++ { "%NFsubS", { VexGv, Gv, EvS }, PREFIX_NP_OR_DATA }, ++ { "%NFshrdS", { VexGv, Ev, Gv, Ib }, PREFIX_NP_OR_DATA }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ /* 30 */ ++ { "%NFxorB", { VexGb, Eb, Gb }, NO_PREFIX }, ++ { "%NFxorS", { VexGv, Ev, Gv }, PREFIX_NP_OR_DATA }, ++ { "%NFxorB", { VexGb, Gb, EbS }, NO_PREFIX }, ++ { "%NFxorS", { VexGv, Gv, EvS }, PREFIX_NP_OR_DATA }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ /* 38 */ ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ /* 40 */ ++ { "%CFcmovoS", { VexGv, Gv, Ev }, PREFIX_NP_OR_DATA }, ++ { "%CFcmovnoS", { VexGv, Gv, Ev }, PREFIX_NP_OR_DATA }, ++ { "%CFcmovbS", { VexGv, Gv, Ev }, PREFIX_NP_OR_DATA }, ++ { "%CFcmovaeS", { VexGv, Gv, Ev }, PREFIX_NP_OR_DATA }, ++ { "%CFcmoveS", { VexGv, Gv, Ev }, PREFIX_NP_OR_DATA }, ++ { "%CFcmovneS", { VexGv, Gv, Ev }, PREFIX_NP_OR_DATA }, ++ { "%CFcmovbeS", { VexGv, Gv, Ev }, PREFIX_NP_OR_DATA }, ++ { "%CFcmovaS", { VexGv, Gv, Ev }, PREFIX_NP_OR_DATA }, ++ /* 48 */ ++ { "%CFcmovsS", { VexGv, Gv, Ev }, PREFIX_NP_OR_DATA }, ++ { "%CFcmovnsS", { VexGv, Gv, Ev }, PREFIX_NP_OR_DATA }, ++ { "%CFcmovpS", { VexGv, Gv, Ev }, PREFIX_NP_OR_DATA }, ++ { "%CFcmovnpS", { VexGv, Gv, Ev }, PREFIX_NP_OR_DATA }, ++ { "%CFcmovlS", { VexGv, Gv, Ev }, PREFIX_NP_OR_DATA }, ++ { "%CFcmovgeS", { VexGv, Gv, Ev }, PREFIX_NP_OR_DATA }, ++ { "%CFcmovleS", { VexGv, Gv, Ev }, PREFIX_NP_OR_DATA }, ++ { "%CFcmovgS", { VexGv, Gv, Ev }, PREFIX_NP_OR_DATA }, ++ /* 50 */ ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ /* 58 */ ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ /* 60 */ ++ { "%MEmovbeS", { Gv, Ev }, PREFIX_NP_OR_DATA }, ++ { "%MEmovbeS", { Ev, Gv }, PREFIX_NP_OR_DATA }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { "wrussK", { M, Gdq }, PREFIX_DATA }, ++ { PREFIX_TABLE (PREFIX_0F38F6) }, ++ { Bad_Opcode }, ++ /* 68 */ ++ { Bad_Opcode }, ++ { "%NFimulS", { Gv, Ev, Iv }, PREFIX_NP_OR_DATA }, ++ { Bad_Opcode }, ++ { "%NFimulS", { Gv, Ev, sIb }, PREFIX_NP_OR_DATA }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ /* 70 */ ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ /* 78 */ ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ /* 80 */ ++ { REG_TABLE (REG_EVEX_MAP4_80) }, ++ { REG_TABLE (REG_EVEX_MAP4_81) }, ++ { Bad_Opcode }, ++ { REG_TABLE (REG_EVEX_MAP4_83) }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ /* 88 */ ++ { "%NFpopcntS", { Gv, Ev }, PREFIX_NP_OR_DATA }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { REG_TABLE (REG_EVEX_MAP4_8F) }, ++ /* 90 */ ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ /* 98 */ ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ /* A0 */ ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { "%NFshldS", { VexGv, Ev, Gv, CL }, PREFIX_NP_OR_DATA }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ /* A8 */ ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { "%NFshrdS", { VexGv, Ev, Gv, CL }, PREFIX_NP_OR_DATA }, ++ { Bad_Opcode }, ++ { "%NFimulS", { VexGv, Gv, Ev }, PREFIX_NP_OR_DATA }, ++ /* B0 */ ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ /* B8 */ ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ /* C0 */ ++ { REG_TABLE (REG_C0) }, ++ { REG_TABLE (REG_C1) }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ /* C8 */ ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ /* D0 */ ++ { REG_TABLE (REG_D0) }, ++ { REG_TABLE (REG_D1) }, ++ { REG_TABLE (REG_D2) }, ++ { REG_TABLE (REG_D3) }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ /* D8 */ ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ /* E0 */ ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ /* E8 */ ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ /* F0 */ ++ { PREFIX_TABLE (PREFIX_EVEX_MAP4_F0) }, ++ { PREFIX_TABLE (PREFIX_EVEX_MAP4_F1) }, ++ { PREFIX_TABLE (PREFIX_EVEX_MAP4_F2) }, ++ { Bad_Opcode }, ++ { "%NFtzcntS", { Gv, Ev }, PREFIX_NP_OR_DATA }, ++ { "%NFlzcntS", { Gv, Ev }, PREFIX_NP_OR_DATA }, ++ { REG_TABLE (REG_EVEX_MAP4_F6) }, ++ { REG_TABLE (REG_EVEX_MAP4_F7) }, ++ /* F8 */ ++ { PREFIX_TABLE (PREFIX_EVEX_MAP4_F8) }, ++ { "movdiri", { Mdq, Gdq }, NO_PREFIX }, ++ { Bad_Opcode }, ++ { Bad_Opcode }, ++ { PREFIX_TABLE (PREFIX_0F38FC) }, ++ { Bad_Opcode }, ++ { REG_TABLE (REG_EVEX_MAP4_FE) }, ++ { REG_TABLE (REG_EVEX_MAP4_FF) }, ++ }, + /* EVEX_MAP5_ */ + { + /* 00 */ +diff --git a/opcodes/i386-dis.c b/opcodes/i386-dis.c +--- a/opcodes/i386-dis.c ++++ b/opcodes/i386-dis.c +@@ -1,5 +1,5 @@ + /* Print i386 instructions for GDB, the GNU debugger. +- Copyright (C) 1988-2023 Free Software Foundation, Inc. ++ Copyright (C) 1988-2024 Free Software Foundation, Inc. + + This file is part of the GNU opcodes library. + +@@ -105,6 +105,8 @@ static bool FXSAVE_Fixup (instr_info *, int, int); + static bool MOVSXD_Fixup (instr_info *, int, int); + static bool DistinctDest_Fixup (instr_info *, int, int); + static bool PREFETCHI_Fixup (instr_info *, int, int); ++static bool PUSH2_POP2_Fixup (instr_info *, int, int); ++static bool JMPABS_Fixup (instr_info *, int, int); + + static void ATTRIBUTE_PRINTF_3 i386_dis_printf (const disassemble_info *, + enum disassembler_style, +@@ -132,6 +134,13 @@ enum x86_64_isa + intel64 + }; + ++enum evex_type ++{ ++ evex_default = 0, ++ evex_from_legacy, ++ evex_from_vex, ++}; ++ + struct instr_info + { + enum address_mode address_mode; +@@ -144,6 +153,12 @@ struct instr_info + /* Bits of REX we've already used. */ + uint8_t rex_used; + ++ /* Record W R4 X4 B4 bits for rex2. */ ++ unsigned char rex2; ++ /* Bits of rex2 we've already used. */ ++ unsigned char rex2_used; ++ unsigned char rex2_payload; ++ + bool need_modrm; + unsigned char need_vex; + bool has_sib; +@@ -169,6 +184,7 @@ struct instr_info + signed char last_data_prefix; + signed char last_addr_prefix; + signed char last_rex_prefix; ++ signed char last_rex2_prefix; + signed char last_seg_prefix; + signed char fwait_prefix; + /* The active segment register prefix. */ +@@ -205,14 +221,19 @@ struct instr_info + int ll; + bool w; + bool evex; +- bool r; + bool v; + bool zeroing; + bool b; + bool no_broadcast; ++ bool nf; + } + vex; + ++/* For APX EVEX-promoted prefix, EVEX.ND shares the same bit as vex.b. */ ++#define nd b ++ ++ enum evex_type evex_type; ++ + /* Remember if the current op is a jump instruction. */ + bool op_is_jump; + +@@ -221,6 +242,9 @@ struct instr_info + /* Record whether EVEX masking is used incorrectly. */ + bool illegal_masking; + ++ /* Record whether the modrm byte has been skipped. */ ++ bool has_skipped_modrm; ++ + unsigned char op_ad; + signed char op_index[MAX_OPERANDS]; + bool op_riprel[MAX_OPERANDS]; +@@ -262,8 +286,13 @@ struct dis_private { + { \ + if (value) \ + { \ +- if ((ins->rex & value)) \ ++ if (ins->rex & value) \ + ins->rex_used |= (value) | REX_OPCODE; \ ++ if (ins->rex2 & value) \ ++ { \ ++ ins->rex2_used |= (value); \ ++ ins->rex_used |= REX_OPCODE; \ ++ } \ + } \ + else \ + ins->rex_used |= REX_OPCODE; \ +@@ -273,6 +302,10 @@ struct dis_private { + #define EVEX_b_used 1 + #define EVEX_len_used 2 + ++ ++/* {rex2} is not printed when the REX2_SPECIAL is set. */ ++#define REX2_SPECIAL 16 ++ + /* Flags stored in PREFIXES. */ + #define PREFIX_REPZ 1 + #define PREFIX_REPNZ 2 +@@ -286,6 +319,9 @@ struct dis_private { + #define PREFIX_DATA 0x200 + #define PREFIX_ADDR 0x400 + #define PREFIX_FWAIT 0x800 ++#define PREFIX_REX2 0x1000 ++#define PREFIX_NP_OR_DATA 0x2000 ++#define NO_PREFIX 0x4000 + + /* Make sure that bytes from INFO->PRIVATE_DATA->BUFFER (inclusive) + to ADDR (exclusive) are valid. Returns true for success, false +@@ -367,6 +403,7 @@ fetch_error (const instr_info *ins) + #define PREFIX_IGNORED_DATA (PREFIX_DATA << PREFIX_IGNORED_SHIFT) + #define PREFIX_IGNORED_ADDR (PREFIX_ADDR << PREFIX_IGNORED_SHIFT) + #define PREFIX_IGNORED_LOCK (PREFIX_LOCK << PREFIX_IGNORED_SHIFT) ++#define PREFIX_REX2_ILLEGAL (PREFIX_REX2 << PREFIX_IGNORED_SHIFT) + + /* Opcode prefixes. */ + #define PREFIX_OPCODE (PREFIX_REPZ \ +@@ -418,6 +455,7 @@ fetch_error (const instr_info *ins) + #define Gv { OP_G, v_mode } + #define Gd { OP_G, d_mode } + #define Gdq { OP_G, dq_mode } ++#define Gq { OP_G, q_mode } + #define Gm { OP_G, m_mode } + #define Gva { OP_G, va_mode } + #define Gw { OP_G, w_mode } +@@ -527,7 +565,8 @@ fetch_error (const instr_info *ins) + #define EXEvexXNoBcst { OP_EX, evex_x_nobcst_mode } + #define Rd { OP_R, d_mode } + #define Rdq { OP_R, dq_mode } +-#define Nq { OP_R, q_mode } ++#define Rq { OP_R, q_mode } ++#define Nq { OP_R, q_mm_mode } + #define Ux { OP_R, x_mode } + #define Uxmm { OP_R, xmm_mode } + #define Rxmmq { OP_R, xmmq_mode } +@@ -548,6 +587,8 @@ fetch_error (const instr_info *ins) + #define VexGatherD { OP_VEX, vex_vsib_d_w_dq_mode } + #define VexGatherQ { OP_VEX, vex_vsib_q_w_dq_mode } + #define VexGdq { OP_VEX, dq_mode } ++#define VexGb { OP_VEX, b_mode } ++#define VexGv { OP_VEX, v_mode } + #define VexTmm { OP_VEX, tmm_mode } + #define XMVexI4 { OP_REG_VexI4, x_mode } + #define XMVexScalarI4 { OP_REG_VexI4, scalar_mode } +@@ -624,6 +665,8 @@ enum + d_swap_mode, + /* quad word operand */ + q_mode, ++ /* 8-byte MM operand */ ++ q_mm_mode, + /* quad word operand with operand swapped */ + q_swap_mode, + /* ten-byte operand */ +@@ -778,6 +821,10 @@ enum + USE_RM_TABLE, + USE_PREFIX_TABLE, + USE_X86_64_TABLE, ++ USE_X86_64_EVEX_FROM_VEX_TABLE, ++ USE_X86_64_EVEX_PFX_TABLE, ++ USE_X86_64_EVEX_W_TABLE, ++ USE_X86_64_EVEX_MEM_W_TABLE, + USE_3BYTE_TABLE, + USE_XOP_8F_TABLE, + USE_VEX_C4_TABLE, +@@ -796,6 +843,11 @@ enum + #define RM_TABLE(I) DIS386 (USE_RM_TABLE, (I)) + #define PREFIX_TABLE(I) DIS386 (USE_PREFIX_TABLE, (I)) + #define X86_64_TABLE(I) DIS386 (USE_X86_64_TABLE, (I)) ++#define X86_64_EVEX_FROM_VEX_TABLE(I) \ ++ DIS386 (USE_X86_64_EVEX_FROM_VEX_TABLE, (I)) ++#define X86_64_EVEX_PFX_TABLE(I) DIS386 (USE_X86_64_EVEX_PFX_TABLE, (I)) ++#define X86_64_EVEX_W_TABLE(I) DIS386 (USE_X86_64_EVEX_W_TABLE, (I)) ++#define X86_64_EVEX_MEM_W_TABLE(I) DIS386 (USE_X86_64_EVEX_MEM_W_TABLE, (I)) + #define THREE_BYTE_TABLE(I) DIS386 (USE_3BYTE_TABLE, (I)) + #define XOP_8F_TABLE() DIS386 (USE_XOP_8F_TABLE, 0) + #define VEX_C4_TABLE() DIS386 (USE_VEX_C4_TABLE, 0) +@@ -844,7 +896,8 @@ enum + REG_VEX_0F73, + REG_VEX_0FAE, + REG_VEX_0F3849_X86_64_L_0_W_0_M_1_P_0, +- REG_VEX_0F38F3_L_0, ++ REG_VEX_0F38F3_L_0_P_0, ++ REG_VEX_MAP7_F8_L_0_W_0, + + REG_XOP_09_01_L_0, + REG_XOP_09_02_L_0, +@@ -855,7 +908,15 @@ enum + REG_EVEX_0F72, + REG_EVEX_0F73, + REG_EVEX_0F38C6_L_2, +- REG_EVEX_0F38C7_L_2 ++ REG_EVEX_0F38C7_L_2, ++ REG_EVEX_MAP4_80, ++ REG_EVEX_MAP4_81, ++ REG_EVEX_MAP4_83, ++ REG_EVEX_MAP4_8F, ++ REG_EVEX_MAP4_F6, ++ REG_EVEX_MAP4_F7, ++ REG_EVEX_MAP4_FE, ++ REG_EVEX_MAP4_FF, + }; + + enum +@@ -893,8 +954,12 @@ enum + MOD_0FC7_REG_6, + MOD_0FC7_REG_7, + MOD_0F38DC_PREFIX_1, ++ MOD_0F38F8, + + MOD_VEX_0F3849_X86_64_L_0_W_0, ++ ++ MOD_EVEX_MAP4_F8_P_1, ++ MOD_EVEX_MAP4_F8_P_3, + }; + + enum +@@ -1010,7 +1075,8 @@ enum + PREFIX_0F38F0, + PREFIX_0F38F1, + PREFIX_0F38F6, +- PREFIX_0F38F8, ++ PREFIX_0F38F8_M_0, ++ PREFIX_0F38F8_M_1_X86_64, + PREFIX_0F38FA, + PREFIX_0F38FB, + PREFIX_0F38FC, +@@ -1069,10 +1135,13 @@ enum + PREFIX_VEX_0F38CC, + PREFIX_VEX_0F38CD, + PREFIX_VEX_0F38DA_W_0, ++ PREFIX_VEX_0F38F2_L_0, ++ PREFIX_VEX_0F38F3_L_0, + PREFIX_VEX_0F38F5_L_0, + PREFIX_VEX_0F38F6_L_0, + PREFIX_VEX_0F38F7_L_0, + PREFIX_VEX_0F3AF0_L_0, ++ PREFIX_VEX_MAP7_F8_L_0_W_0_R_0_X86_64, + + PREFIX_EVEX_0F5B, + PREFIX_EVEX_0F6F, +@@ -1130,6 +1199,11 @@ enum + PREFIX_EVEX_0F3A67, + PREFIX_EVEX_0F3AC2, + ++ PREFIX_EVEX_MAP4_F0, ++ PREFIX_EVEX_MAP4_F1, ++ PREFIX_EVEX_MAP4_F2, ++ PREFIX_EVEX_MAP4_F8, ++ + PREFIX_EVEX_MAP5_10, + PREFIX_EVEX_MAP5_11, + PREFIX_EVEX_MAP5_1D, +@@ -1217,6 +1291,7 @@ enum + X86_64_0F18_REG_7_MOD_0, + X86_64_0F24, + X86_64_0F26, ++ X86_64_0F38F8_M_1, + X86_64_0FC7_REG_6_MOD_3_PREFIX_1, + + X86_64_VEX_0F3849, +@@ -1240,6 +1315,8 @@ enum + X86_64_VEX_0F38ED, + X86_64_VEX_0F38EE, + X86_64_VEX_0F38EF, ++ ++ X86_64_VEX_MAP7_F8_L_0_W_0_R_0, + }; + + enum +@@ -1259,7 +1336,8 @@ enum + { + VEX_0F = 0, + VEX_0F38, +- VEX_0F3A ++ VEX_0F3A, ++ VEX_MAP7, + }; + + enum +@@ -1267,8 +1345,10 @@ enum + EVEX_0F = 0, + EVEX_0F38, + EVEX_0F3A, ++ EVEX_MAP4, + EVEX_MAP5, + EVEX_MAP6, ++ EVEX_MAP7, + }; + + enum +@@ -1350,6 +1430,7 @@ enum + VEX_LEN_0F3ADE_W_0, + VEX_LEN_0F3ADF, + VEX_LEN_0F3AF0, ++ VEX_LEN_MAP7_F8, + VEX_LEN_XOP_08_85, + VEX_LEN_XOP_08_86, + VEX_LEN_XOP_08_87, +@@ -1510,6 +1591,7 @@ enum + VEX_W_0F3ACE, + VEX_W_0F3ACF, + VEX_W_0F3ADE, ++ VEX_W_MAP7_F8_L_0, + + VEX_W_XOP_08_85_L_0, + VEX_W_XOP_08_86_L_0, +@@ -1656,6 +1738,11 @@ enum + EVEX_W_0F3A70, + EVEX_W_0F3A72, + ++ EVEX_W_MAP4_8F_R_0, ++ EVEX_W_MAP4_F8_P1_M_1, ++ EVEX_W_MAP4_F8_P3_M_1, ++ EVEX_W_MAP4_FF_R_6, ++ + EVEX_W_MAP5_5B_P_0, + EVEX_W_MAP5_7A_P_3, + }; +@@ -1673,7 +1760,7 @@ struct dis386 { + }; + + /* Upper case letters in the instruction names here are macros. +- 'A' => print 'b' if no register operands or suffix_always is true ++ 'A' => print 'b' if no (suitable) register operand or suffix_always is true + 'B' => print 'b' if suffix_always is true + 'C' => print 's' or 'l' ('w' or 'd' in Intel mode) depending on operand + size prefix +@@ -1686,14 +1773,14 @@ struct dis386 { + 'I' unused. + 'J' unused. + 'K' => print 'd' or 'q' if rex prefix is present. +- 'L' unused. ++ 'L' => print 'l' or 'q' if suffix_always is true + 'M' => print 'r' if intel_mnemonic is false. + 'N' => print 'n' if instruction has no wait "prefix" + 'O' => print 'd' or 'o' (or 'q' in Intel mode) + 'P' => behave as 'T' except with register operand outside of suffix_always + mode +- 'Q' => print 'w', 'l' or 'q' for memory operand or suffix_always +- is true ++ 'Q' => print 'w', 'l' or 'q' if no (suitable) register operand or ++ suffix_always is true + 'R' => print 'w', 'l' or 'q' ('d' for 'l' and 'e' in Intel mode) + 'S' => print 'w', 'l' or 'q' if suffix_always is true + 'T' => print 'w', 'l'/'d', or 'q' if instruction has an operand size +@@ -1724,6 +1811,11 @@ struct dis386 { + "XV" => print "{vex} " pseudo prefix + "XE" => print "{evex} " pseudo prefix if no EVEX-specific functionality is + is used by an EVEX-encoded (AVX512VL) instruction. ++ "ME" => print "{evex} " pseudo prefix for ins->modrm.mod != 3,if no ++ EVEX-specific functionality is used by an EVEX-encoded (AVX512VL) ++ instruction. ++ "NF" => print "{nf} " pseudo prefix when EVEX.NF = 1 and print "{evex} " ++ pseudo prefix when instructions without NF, EGPR and VVVV, + "YK" keep unused, to avoid ambiguity with the combined use of Y and K. + "YX" keep unused, to avoid ambiguity with the combined use of Y and X. + "LQ" => print 'l' ('d' in Intel mode) or 'q' for memory operand, cond +@@ -1836,23 +1928,23 @@ static const struct dis386 dis386[] = { + { "dec{S|}", { RMeSI }, 0 }, + { "dec{S|}", { RMeDI }, 0 }, + /* 50 */ +- { "push{!P|}", { RMrAX }, 0 }, +- { "push{!P|}", { RMrCX }, 0 }, +- { "push{!P|}", { RMrDX }, 0 }, +- { "push{!P|}", { RMrBX }, 0 }, +- { "push{!P|}", { RMrSP }, 0 }, +- { "push{!P|}", { RMrBP }, 0 }, +- { "push{!P|}", { RMrSI }, 0 }, +- { "push{!P|}", { RMrDI }, 0 }, ++ { "push!P", { RMrAX }, 0 }, ++ { "push!P", { RMrCX }, 0 }, ++ { "push!P", { RMrDX }, 0 }, ++ { "push!P", { RMrBX }, 0 }, ++ { "push!P", { RMrSP }, 0 }, ++ { "push!P", { RMrBP }, 0 }, ++ { "push!P", { RMrSI }, 0 }, ++ { "push!P", { RMrDI }, 0 }, + /* 58 */ +- { "pop{!P|}", { RMrAX }, 0 }, +- { "pop{!P|}", { RMrCX }, 0 }, +- { "pop{!P|}", { RMrDX }, 0 }, +- { "pop{!P|}", { RMrBX }, 0 }, +- { "pop{!P|}", { RMrSP }, 0 }, +- { "pop{!P|}", { RMrBP }, 0 }, +- { "pop{!P|}", { RMrSI }, 0 }, +- { "pop{!P|}", { RMrDI }, 0 }, ++ { "pop!P", { RMrAX }, 0 }, ++ { "pop!P", { RMrCX }, 0 }, ++ { "pop!P", { RMrDX }, 0 }, ++ { "pop!P", { RMrBX }, 0 }, ++ { "pop!P", { RMrSP }, 0 }, ++ { "pop!P", { RMrBP }, 0 }, ++ { "pop!P", { RMrSI }, 0 }, ++ { "pop!P", { RMrDI }, 0 }, + /* 60 */ + { X86_64_TABLE (X86_64_60) }, + { X86_64_TABLE (X86_64_61) }, +@@ -1872,23 +1964,23 @@ static const struct dis386 dis386[] = { + { "outs{b|}", { indirDXr, Xb }, 0 }, + { X86_64_TABLE (X86_64_6F) }, + /* 70 */ +- { "joH", { Jb, BND, cond_jump_flag }, 0 }, +- { "jnoH", { Jb, BND, cond_jump_flag }, 0 }, +- { "jbH", { Jb, BND, cond_jump_flag }, 0 }, +- { "jaeH", { Jb, BND, cond_jump_flag }, 0 }, +- { "jeH", { Jb, BND, cond_jump_flag }, 0 }, +- { "jneH", { Jb, BND, cond_jump_flag }, 0 }, +- { "jbeH", { Jb, BND, cond_jump_flag }, 0 }, +- { "jaH", { Jb, BND, cond_jump_flag }, 0 }, ++ { "joH", { Jb, BND, cond_jump_flag }, PREFIX_REX2_ILLEGAL }, ++ { "jnoH", { Jb, BND, cond_jump_flag }, PREFIX_REX2_ILLEGAL }, ++ { "jbH", { Jb, BND, cond_jump_flag }, PREFIX_REX2_ILLEGAL }, ++ { "jaeH", { Jb, BND, cond_jump_flag }, PREFIX_REX2_ILLEGAL }, ++ { "jeH", { Jb, BND, cond_jump_flag }, PREFIX_REX2_ILLEGAL }, ++ { "jneH", { Jb, BND, cond_jump_flag }, PREFIX_REX2_ILLEGAL }, ++ { "jbeH", { Jb, BND, cond_jump_flag }, PREFIX_REX2_ILLEGAL }, ++ { "jaH", { Jb, BND, cond_jump_flag }, PREFIX_REX2_ILLEGAL }, + /* 78 */ +- { "jsH", { Jb, BND, cond_jump_flag }, 0 }, +- { "jnsH", { Jb, BND, cond_jump_flag }, 0 }, +- { "jpH", { Jb, BND, cond_jump_flag }, 0 }, +- { "jnpH", { Jb, BND, cond_jump_flag }, 0 }, +- { "jlH", { Jb, BND, cond_jump_flag }, 0 }, +- { "jgeH", { Jb, BND, cond_jump_flag }, 0 }, +- { "jleH", { Jb, BND, cond_jump_flag }, 0 }, +- { "jgH", { Jb, BND, cond_jump_flag }, 0 }, ++ { "jsH", { Jb, BND, cond_jump_flag }, PREFIX_REX2_ILLEGAL }, ++ { "jnsH", { Jb, BND, cond_jump_flag }, PREFIX_REX2_ILLEGAL }, ++ { "jpH", { Jb, BND, cond_jump_flag }, PREFIX_REX2_ILLEGAL }, ++ { "jnpH", { Jb, BND, cond_jump_flag }, PREFIX_REX2_ILLEGAL }, ++ { "jlH", { Jb, BND, cond_jump_flag }, PREFIX_REX2_ILLEGAL }, ++ { "jgeH", { Jb, BND, cond_jump_flag }, PREFIX_REX2_ILLEGAL }, ++ { "jleH", { Jb, BND, cond_jump_flag }, PREFIX_REX2_ILLEGAL }, ++ { "jgH", { Jb, BND, cond_jump_flag }, PREFIX_REX2_ILLEGAL }, + /* 80 */ + { REG_TABLE (REG_80) }, + { REG_TABLE (REG_81) }, +@@ -1926,23 +2018,23 @@ static const struct dis386 dis386[] = { + { "sahf", { XX }, 0 }, + { "lahf", { XX }, 0 }, + /* a0 */ +- { "mov%LB", { AL, Ob }, 0 }, +- { "mov%LS", { eAX, Ov }, 0 }, +- { "mov%LB", { Ob, AL }, 0 }, +- { "mov%LS", { Ov, eAX }, 0 }, +- { "movs{b|}", { Ybr, Xb }, 0 }, +- { "movs{R|}", { Yvr, Xv }, 0 }, +- { "cmps{b|}", { Xb, Yb }, 0 }, +- { "cmps{R|}", { Xv, Yv }, 0 }, ++ { "mov%LB", { AL, Ob }, PREFIX_REX2_ILLEGAL }, ++ { "mov%LS", { { JMPABS_Fixup, eAX_reg }, { JMPABS_Fixup, v_mode } }, PREFIX_REX2_ILLEGAL }, ++ { "mov%LB", { Ob, AL }, PREFIX_REX2_ILLEGAL }, ++ { "mov%LS", { Ov, eAX }, PREFIX_REX2_ILLEGAL }, ++ { "movs{b|}", { Ybr, Xb }, PREFIX_REX2_ILLEGAL }, ++ { "movs{R|}", { Yvr, Xv }, PREFIX_REX2_ILLEGAL }, ++ { "cmps{b|}", { Xb, Yb }, PREFIX_REX2_ILLEGAL }, ++ { "cmps{R|}", { Xv, Yv }, PREFIX_REX2_ILLEGAL }, + /* a8 */ +- { "testB", { AL, Ib }, 0 }, +- { "testS", { eAX, Iv }, 0 }, +- { "stosB", { Ybr, AL }, 0 }, +- { "stosS", { Yvr, eAX }, 0 }, +- { "lodsB", { ALr, Xb }, 0 }, +- { "lodsS", { eAXr, Xv }, 0 }, +- { "scasB", { AL, Yb }, 0 }, +- { "scasS", { eAX, Yv }, 0 }, ++ { "testB", { AL, Ib }, PREFIX_REX2_ILLEGAL }, ++ { "testS", { eAX, Iv }, PREFIX_REX2_ILLEGAL }, ++ { "stosB", { Ybr, AL }, PREFIX_REX2_ILLEGAL }, ++ { "stosS", { Yvr, eAX }, PREFIX_REX2_ILLEGAL }, ++ { "lodsB", { ALr, Xb }, PREFIX_REX2_ILLEGAL }, ++ { "lodsS", { eAXr, Xv }, PREFIX_REX2_ILLEGAL }, ++ { "scasB", { AL, Yb }, PREFIX_REX2_ILLEGAL }, ++ { "scasS", { eAX, Yv }, PREFIX_REX2_ILLEGAL }, + /* b0 */ + { "movB", { RMAL, Ib }, 0 }, + { "movB", { RMCL, Ib }, 0 }, +@@ -1998,23 +2090,23 @@ static const struct dis386 dis386[] = { + { FLOAT }, + { FLOAT }, + /* e0 */ +- { "loopneFH", { Jb, XX, loop_jcxz_flag }, 0 }, +- { "loopeFH", { Jb, XX, loop_jcxz_flag }, 0 }, +- { "loopFH", { Jb, XX, loop_jcxz_flag }, 0 }, +- { "jEcxzH", { Jb, XX, loop_jcxz_flag }, 0 }, +- { "inB", { AL, Ib }, 0 }, +- { "inG", { zAX, Ib }, 0 }, +- { "outB", { Ib, AL }, 0 }, +- { "outG", { Ib, zAX }, 0 }, ++ { "loopneFH", { Jb, XX, loop_jcxz_flag }, PREFIX_REX2_ILLEGAL }, ++ { "loopeFH", { Jb, XX, loop_jcxz_flag }, PREFIX_REX2_ILLEGAL }, ++ { "loopFH", { Jb, XX, loop_jcxz_flag }, PREFIX_REX2_ILLEGAL }, ++ { "jEcxzH", { Jb, XX, loop_jcxz_flag }, PREFIX_REX2_ILLEGAL }, ++ { "inB", { AL, Ib }, PREFIX_REX2_ILLEGAL }, ++ { "inG", { zAX, Ib }, PREFIX_REX2_ILLEGAL }, ++ { "outB", { Ib, AL }, PREFIX_REX2_ILLEGAL }, ++ { "outG", { Ib, zAX }, PREFIX_REX2_ILLEGAL }, + /* e8 */ + { X86_64_TABLE (X86_64_E8) }, + { X86_64_TABLE (X86_64_E9) }, + { X86_64_TABLE (X86_64_EA) }, +- { "jmp", { Jb, BND }, 0 }, +- { "inB", { AL, indirDX }, 0 }, +- { "inG", { zAX, indirDX }, 0 }, +- { "outB", { indirDX, AL }, 0 }, +- { "outG", { indirDX, zAX }, 0 }, ++ { "jmp", { Jb, BND }, PREFIX_REX2_ILLEGAL }, ++ { "inB", { AL, indirDX }, PREFIX_REX2_ILLEGAL }, ++ { "inG", { zAX, indirDX }, PREFIX_REX2_ILLEGAL }, ++ { "outB", { indirDX, AL }, PREFIX_REX2_ILLEGAL }, ++ { "outG", { indirDX, zAX }, PREFIX_REX2_ILLEGAL }, + /* f0 */ + { Bad_Opcode }, /* lock prefix */ + { "int1", { XX }, 0 }, +@@ -2091,12 +2183,12 @@ static const struct dis386 dis386_twobyte[] = { + { PREFIX_TABLE (PREFIX_0F2E) }, + { PREFIX_TABLE (PREFIX_0F2F) }, + /* 30 */ +- { "wrmsr", { XX }, 0 }, +- { "rdtsc", { XX }, 0 }, +- { "rdmsr", { XX }, 0 }, +- { "rdpmc", { XX }, 0 }, +- { "sysenter", { SEP }, 0 }, +- { "sysexit%LQ", { SEP }, 0 }, ++ { "wrmsr", { XX }, PREFIX_REX2_ILLEGAL }, ++ { "rdtsc", { XX }, PREFIX_REX2_ILLEGAL }, ++ { "rdmsr", { XX }, PREFIX_REX2_ILLEGAL }, ++ { "rdpmc", { XX }, PREFIX_REX2_ILLEGAL }, ++ { "sysenter", { SEP }, PREFIX_REX2_ILLEGAL }, ++ { "sysexit%LQ", { SEP }, PREFIX_REX2_ILLEGAL }, + { Bad_Opcode }, + { "getsec", { XX }, 0 }, + /* 38 */ +@@ -2181,23 +2273,23 @@ static const struct dis386 dis386_twobyte[] = { + { PREFIX_TABLE (PREFIX_0F7E) }, + { PREFIX_TABLE (PREFIX_0F7F) }, + /* 80 */ +- { "joH", { Jv, BND, cond_jump_flag }, 0 }, +- { "jnoH", { Jv, BND, cond_jump_flag }, 0 }, +- { "jbH", { Jv, BND, cond_jump_flag }, 0 }, +- { "jaeH", { Jv, BND, cond_jump_flag }, 0 }, +- { "jeH", { Jv, BND, cond_jump_flag }, 0 }, +- { "jneH", { Jv, BND, cond_jump_flag }, 0 }, +- { "jbeH", { Jv, BND, cond_jump_flag }, 0 }, +- { "jaH", { Jv, BND, cond_jump_flag }, 0 }, ++ { "joH", { Jv, BND, cond_jump_flag }, PREFIX_REX2_ILLEGAL }, ++ { "jnoH", { Jv, BND, cond_jump_flag }, PREFIX_REX2_ILLEGAL }, ++ { "jbH", { Jv, BND, cond_jump_flag }, PREFIX_REX2_ILLEGAL }, ++ { "jaeH", { Jv, BND, cond_jump_flag }, PREFIX_REX2_ILLEGAL }, ++ { "jeH", { Jv, BND, cond_jump_flag }, PREFIX_REX2_ILLEGAL }, ++ { "jneH", { Jv, BND, cond_jump_flag }, PREFIX_REX2_ILLEGAL }, ++ { "jbeH", { Jv, BND, cond_jump_flag }, PREFIX_REX2_ILLEGAL }, ++ { "jaH", { Jv, BND, cond_jump_flag }, PREFIX_REX2_ILLEGAL }, + /* 88 */ +- { "jsH", { Jv, BND, cond_jump_flag }, 0 }, +- { "jnsH", { Jv, BND, cond_jump_flag }, 0 }, +- { "jpH", { Jv, BND, cond_jump_flag }, 0 }, +- { "jnpH", { Jv, BND, cond_jump_flag }, 0 }, +- { "jlH", { Jv, BND, cond_jump_flag }, 0 }, +- { "jgeH", { Jv, BND, cond_jump_flag }, 0 }, +- { "jleH", { Jv, BND, cond_jump_flag }, 0 }, +- { "jgH", { Jv, BND, cond_jump_flag }, 0 }, ++ { "jsH", { Jv, BND, cond_jump_flag }, PREFIX_REX2_ILLEGAL }, ++ { "jnsH", { Jv, BND, cond_jump_flag }, PREFIX_REX2_ILLEGAL }, ++ { "jpH", { Jv, BND, cond_jump_flag }, PREFIX_REX2_ILLEGAL }, ++ { "jnpH", { Jv, BND, cond_jump_flag }, PREFIX_REX2_ILLEGAL }, ++ { "jlH", { Jv, BND, cond_jump_flag }, PREFIX_REX2_ILLEGAL }, ++ { "jgeH", { Jv, BND, cond_jump_flag }, PREFIX_REX2_ILLEGAL }, ++ { "jleH", { Jv, BND, cond_jump_flag }, PREFIX_REX2_ILLEGAL }, ++ { "jgH", { Jv, BND, cond_jump_flag }, PREFIX_REX2_ILLEGAL }, + /* 90 */ + { "seto", { Eb }, 0 }, + { "setno", { Eb }, 0 }, +@@ -2390,22 +2482,30 @@ static const char intel_index16[][6] = { + + static const char att_names64[][8] = { + "%rax", "%rcx", "%rdx", "%rbx", "%rsp", "%rbp", "%rsi", "%rdi", +- "%r8", "%r9", "%r10", "%r11", "%r12", "%r13", "%r14", "%r15" ++ "%r8", "%r9", "%r10", "%r11", "%r12", "%r13", "%r14", "%r15", ++ "%r16", "%r17", "%r18", "%r19", "%r20", "%r21", "%r22", "%r23", ++ "%r24", "%r25", "%r26", "%r27", "%r28", "%r29", "%r30", "%r31", + }; + static const char att_names32[][8] = { + "%eax", "%ecx", "%edx", "%ebx", "%esp", "%ebp", "%esi", "%edi", +- "%r8d", "%r9d", "%r10d", "%r11d", "%r12d", "%r13d", "%r14d", "%r15d" ++ "%r8d", "%r9d", "%r10d", "%r11d", "%r12d", "%r13d", "%r14d", "%r15d", ++ "%r16d", "%r17d", "%r18d", "%r19d", "%r20d", "%r21d", "%r22d", "%r23d", ++ "%r24d", "%r25d", "%r26d", "%r27d", "%r28d", "%r29d", "%r30d", "%r31d", + }; + static const char att_names16[][8] = { + "%ax", "%cx", "%dx", "%bx", "%sp", "%bp", "%si", "%di", +- "%r8w", "%r9w", "%r10w", "%r11w", "%r12w", "%r13w", "%r14w", "%r15w" ++ "%r8w", "%r9w", "%r10w", "%r11w", "%r12w", "%r13w", "%r14w", "%r15w", ++ "%r16w", "%r17w", "%r18w", "%r19w", "%r20w", "%r21w", "%r22w", "%r23w", ++ "%r24w", "%r25w", "%r26w", "%r27w", "%r28w", "%r29w", "%r30w", "%r31w", + }; + static const char att_names8[][8] = { + "%al", "%cl", "%dl", "%bl", "%ah", "%ch", "%dh", "%bh", + }; + static const char att_names8rex[][8] = { + "%al", "%cl", "%dl", "%bl", "%spl", "%bpl", "%sil", "%dil", +- "%r8b", "%r9b", "%r10b", "%r11b", "%r12b", "%r13b", "%r14b", "%r15b" ++ "%r8b", "%r9b", "%r10b", "%r11b", "%r12b", "%r13b", "%r14b", "%r15b", ++ "%r16b", "%r17b", "%r18b", "%r19b", "%r20b", "%r21b", "%r22b", "%r23b", ++ "%r24b", "%r25b", "%r26b", "%r27b", "%r28b", "%r29b", "%r30b", "%r31b", + }; + static const char att_names_seg[][4] = { + "%es", "%cs", "%ss", "%ds", "%fs", "%gs", "%?", "%?", +@@ -2520,25 +2620,25 @@ static const struct dis386 reg_table[][8] = { + }, + /* REG_C0 */ + { +- { "rolA", { Eb, Ib }, 0 }, +- { "rorA", { Eb, Ib }, 0 }, +- { "rclA", { Eb, Ib }, 0 }, +- { "rcrA", { Eb, Ib }, 0 }, +- { "shlA", { Eb, Ib }, 0 }, +- { "shrA", { Eb, Ib }, 0 }, +- { "shlA", { Eb, Ib }, 0 }, +- { "sarA", { Eb, Ib }, 0 }, ++ { "%NFrolA", { VexGb, Eb, Ib }, NO_PREFIX }, ++ { "%NFrorA", { VexGb, Eb, Ib }, NO_PREFIX }, ++ { "rclA", { VexGb, Eb, Ib }, NO_PREFIX }, ++ { "rcrA", { VexGb, Eb, Ib }, NO_PREFIX }, ++ { "%NFshlA", { VexGb, Eb, Ib }, NO_PREFIX }, ++ { "%NFshrA", { VexGb, Eb, Ib }, NO_PREFIX }, ++ { "%NFshlA", { VexGb, Eb, Ib }, NO_PREFIX }, ++ { "%NFsarA", { VexGb, Eb, Ib }, NO_PREFIX }, + }, + /* REG_C1 */ + { +- { "rolQ", { Ev, Ib }, 0 }, +- { "rorQ", { Ev, Ib }, 0 }, +- { "rclQ", { Ev, Ib }, 0 }, +- { "rcrQ", { Ev, Ib }, 0 }, +- { "shlQ", { Ev, Ib }, 0 }, +- { "shrQ", { Ev, Ib }, 0 }, +- { "shlQ", { Ev, Ib }, 0 }, +- { "sarQ", { Ev, Ib }, 0 }, ++ { "%NFrolQ", { VexGv, Ev, Ib }, PREFIX_NP_OR_DATA }, ++ { "%NFrorQ", { VexGv, Ev, Ib }, PREFIX_NP_OR_DATA }, ++ { "rclQ", { VexGv, Ev, Ib }, PREFIX_NP_OR_DATA }, ++ { "rcrQ", { VexGv, Ev, Ib }, PREFIX_NP_OR_DATA }, ++ { "%NFshlQ", { VexGv, Ev, Ib }, PREFIX_NP_OR_DATA }, ++ { "%NFshrQ", { VexGv, Ev, Ib }, PREFIX_NP_OR_DATA }, ++ { "%NFshlQ", { VexGv, Ev, Ib }, PREFIX_NP_OR_DATA }, ++ { "%NFsarQ", { VexGv, Ev, Ib }, PREFIX_NP_OR_DATA }, + }, + /* REG_C6 */ + { +@@ -2564,47 +2664,47 @@ static const struct dis386 reg_table[][8] = { + }, + /* REG_D0 */ + { +- { "rolA", { Eb, I1 }, 0 }, +- { "rorA", { Eb, I1 }, 0 }, +- { "rclA", { Eb, I1 }, 0 }, +- { "rcrA", { Eb, I1 }, 0 }, +- { "shlA", { Eb, I1 }, 0 }, +- { "shrA", { Eb, I1 }, 0 }, +- { "shlA", { Eb, I1 }, 0 }, +- { "sarA", { Eb, I1 }, 0 }, ++ { "%NFrolA", { VexGb, Eb, I1 }, NO_PREFIX }, ++ { "%NFrorA", { VexGb, Eb, I1 }, NO_PREFIX }, ++ { "rclA", { VexGb, Eb, I1 }, NO_PREFIX }, ++ { "rcrA", { VexGb, Eb, I1 }, NO_PREFIX }, ++ { "%NFshlA", { VexGb, Eb, I1 }, NO_PREFIX }, ++ { "%NFshrA", { VexGb, Eb, I1 }, NO_PREFIX }, ++ { "%NFshlA", { VexGb, Eb, I1 }, NO_PREFIX }, ++ { "%NFsarA", { VexGb, Eb, I1 }, NO_PREFIX }, + }, + /* REG_D1 */ + { +- { "rolQ", { Ev, I1 }, 0 }, +- { "rorQ", { Ev, I1 }, 0 }, +- { "rclQ", { Ev, I1 }, 0 }, +- { "rcrQ", { Ev, I1 }, 0 }, +- { "shlQ", { Ev, I1 }, 0 }, +- { "shrQ", { Ev, I1 }, 0 }, +- { "shlQ", { Ev, I1 }, 0 }, +- { "sarQ", { Ev, I1 }, 0 }, ++ { "%NFrolQ", { VexGv, Ev, I1 }, PREFIX_NP_OR_DATA }, ++ { "%NFrorQ", { VexGv, Ev, I1 }, PREFIX_NP_OR_DATA }, ++ { "rclQ", { VexGv, Ev, I1 }, PREFIX_NP_OR_DATA }, ++ { "rcrQ", { VexGv, Ev, I1 }, PREFIX_NP_OR_DATA }, ++ { "%NFshlQ", { VexGv, Ev, I1 }, PREFIX_NP_OR_DATA }, ++ { "%NFshrQ", { VexGv, Ev, I1 }, PREFIX_NP_OR_DATA }, ++ { "%NFshlQ", { VexGv, Ev, I1 }, PREFIX_NP_OR_DATA }, ++ { "%NFsarQ", { VexGv, Ev, I1 }, PREFIX_NP_OR_DATA }, + }, + /* REG_D2 */ + { +- { "rolA", { Eb, CL }, 0 }, +- { "rorA", { Eb, CL }, 0 }, +- { "rclA", { Eb, CL }, 0 }, +- { "rcrA", { Eb, CL }, 0 }, +- { "shlA", { Eb, CL }, 0 }, +- { "shrA", { Eb, CL }, 0 }, +- { "shlA", { Eb, CL }, 0 }, +- { "sarA", { Eb, CL }, 0 }, ++ { "%NFrolA", { VexGb, Eb, CL }, NO_PREFIX }, ++ { "%NFrorA", { VexGb, Eb, CL }, NO_PREFIX }, ++ { "rclA", { VexGb, Eb, CL }, NO_PREFIX }, ++ { "rcrA", { VexGb, Eb, CL }, NO_PREFIX }, ++ { "%NFshlA", { VexGb, Eb, CL }, NO_PREFIX }, ++ { "%NFshrA", { VexGb, Eb, CL }, NO_PREFIX }, ++ { "%NFshlA", { VexGb, Eb, CL }, NO_PREFIX }, ++ { "%NFsarA", { VexGb, Eb, CL }, NO_PREFIX }, + }, + /* REG_D3 */ + { +- { "rolQ", { Ev, CL }, 0 }, +- { "rorQ", { Ev, CL }, 0 }, +- { "rclQ", { Ev, CL }, 0 }, +- { "rcrQ", { Ev, CL }, 0 }, +- { "shlQ", { Ev, CL }, 0 }, +- { "shrQ", { Ev, CL }, 0 }, +- { "shlQ", { Ev, CL }, 0 }, +- { "sarQ", { Ev, CL }, 0 }, ++ { "%NFrolQ", { VexGv, Ev, CL }, PREFIX_NP_OR_DATA }, ++ { "%NFrorQ", { VexGv, Ev, CL }, PREFIX_NP_OR_DATA }, ++ { "rclQ", { VexGv, Ev, CL }, PREFIX_NP_OR_DATA }, ++ { "rcrQ", { VexGv, Ev, CL }, PREFIX_NP_OR_DATA }, ++ { "%NFshlQ", { VexGv, Ev, CL }, PREFIX_NP_OR_DATA }, ++ { "%NFshrQ", { VexGv, Ev, CL }, PREFIX_NP_OR_DATA }, ++ { "%NFshlQ", { VexGv, Ev, CL }, PREFIX_NP_OR_DATA }, ++ { "%NFsarQ", { VexGv, Ev, CL }, PREFIX_NP_OR_DATA }, + }, + /* REG_F6 */ + { +@@ -2794,9 +2894,9 @@ static const struct dis386 reg_table[][8] = { + { Bad_Opcode }, + { "cmpxchg8b", { { CMPXCHG8B_Fixup, q_mode } }, 0 }, + { Bad_Opcode }, +- { "xrstors", { FXSAVE }, 0 }, +- { "xsavec", { FXSAVE }, 0 }, +- { "xsaves", { FXSAVE }, 0 }, ++ { "xrstors", { FXSAVE }, PREFIX_REX2_ILLEGAL }, ++ { "xsavec", { FXSAVE }, PREFIX_REX2_ILLEGAL }, ++ { "xsaves", { FXSAVE }, PREFIX_REX2_ILLEGAL }, + { MOD_TABLE (MOD_0FC7_REG_6) }, + { MOD_TABLE (MOD_0FC7_REG_7) }, + }, +@@ -2842,12 +2942,16 @@ static const struct dis386 reg_table[][8] = { + { + { RM_TABLE (RM_VEX_0F3849_X86_64_L_0_W_0_M_1_P_0_R_0) }, + }, +- /* REG_VEX_0F38F3_L_0 */ ++ /* REG_VEX_0F38F3_L_0_P_0 */ + { + { Bad_Opcode }, +- { "blsrS", { VexGdq, Edq }, PREFIX_OPCODE }, +- { "blsmskS", { VexGdq, Edq }, PREFIX_OPCODE }, +- { "blsiS", { VexGdq, Edq }, PREFIX_OPCODE }, ++ { "%NFblsrS", { VexGdq, Edq }, 0 }, ++ { "%NFblsmskS", { VexGdq, Edq }, 0 }, ++ { "%NFblsiS", { VexGdq, Edq }, 0 }, ++ }, ++ /* REG_VEX_MAP7_F8_L_0_W_0 */ ++ { ++ { X86_64_TABLE (X86_64_VEX_MAP7_F8_L_0_W_0_R_0) }, + }, + /* REG_XOP_09_01_L_0 */ + { +@@ -3364,7 +3468,7 @@ static const struct dis386 prefix_table[][4] = { + + /* PREFIX_0FAE_REG_4_MOD_0 */ + { +- { "xsave", { FXSAVE }, 0 }, ++ { "xsave", { FXSAVE }, PREFIX_REX2_ILLEGAL }, + { "ptwrite{%LQ|}", { Edq }, 0 }, + }, + +@@ -3382,7 +3486,7 @@ static const struct dis386 prefix_table[][4] = { + + /* PREFIX_0FAE_REG_6_MOD_0 */ + { +- { "xsaveopt", { FXSAVE }, PREFIX_OPCODE }, ++ { "xsaveopt", { FXSAVE }, PREFIX_OPCODE | PREFIX_REX2_ILLEGAL }, + { "clrssbsy", { Mq }, PREFIX_OPCODE }, + { "clwb", { Mb }, PREFIX_OPCODE }, + }, +@@ -3550,18 +3654,27 @@ static const struct dis386 prefix_table[][4] = { + /* PREFIX_0F38F6 */ + { + { "wrssK", { M, Gdq }, 0 }, +- { "adoxS", { Gdq, Edq}, 0 }, +- { "adcxS", { Gdq, Edq}, 0 }, ++ { "adoxL", { VexGdq, Gdq, Edq }, 0 }, ++ { "adcxL", { VexGdq, Gdq, Edq }, 0 }, + { Bad_Opcode }, + }, + +- /* PREFIX_0F38F8 */ ++ /* PREFIX_0F38F8_M_0 */ + { + { Bad_Opcode }, + { "enqcmds", { Gva, M }, 0 }, + { "movdir64b", { Gva, M }, 0 }, + { "enqcmd", { Gva, M }, 0 }, + }, ++ ++ /* PREFIX_0F38F8_M_1_X86_64 */ ++ { ++ { Bad_Opcode }, ++ { "uwrmsr", { Gq, Rq }, 0 }, ++ { Bad_Opcode }, ++ { "urdmsr", { Rq, Gq }, 0 }, ++ }, ++ + /* PREFIX_0F38FA */ + { + { Bad_Opcode }, +@@ -3768,38 +3881,38 @@ static const struct dis386 prefix_table[][4] = { + + /* PREFIX_VEX_0F90_L_0_W_0 */ + { +- { "kmovw", { MaskG, MaskE }, 0 }, ++ { "%XEkmovw", { MaskG, MaskE }, 0 }, + { Bad_Opcode }, +- { "kmovb", { MaskG, MaskBDE }, 0 }, ++ { "%XEkmovb", { MaskG, MaskBDE }, 0 }, + }, + + /* PREFIX_VEX_0F90_L_0_W_1 */ + { +- { "kmovq", { MaskG, MaskE }, 0 }, ++ { "%XEkmovq", { MaskG, MaskE }, 0 }, + { Bad_Opcode }, +- { "kmovd", { MaskG, MaskBDE }, 0 }, ++ { "%XEkmovd", { MaskG, MaskBDE }, 0 }, + }, + + /* PREFIX_VEX_0F91_L_0_W_0 */ + { +- { "kmovw", { Mw, MaskG }, 0 }, ++ { "%XEkmovw", { Mw, MaskG }, 0 }, + { Bad_Opcode }, +- { "kmovb", { Mb, MaskG }, 0 }, ++ { "%XEkmovb", { Mb, MaskG }, 0 }, + }, + + /* PREFIX_VEX_0F91_L_0_W_1 */ + { +- { "kmovq", { Mq, MaskG }, 0 }, ++ { "%XEkmovq", { Mq, MaskG }, 0 }, + { Bad_Opcode }, +- { "kmovd", { Md, MaskG }, 0 }, ++ { "%XEkmovd", { Md, MaskG }, 0 }, + }, + + /* PREFIX_VEX_0F92_L_0_W_0 */ + { +- { "kmovw", { MaskG, Rdq }, 0 }, ++ { "%XEkmovw", { MaskG, Rdq }, 0 }, + { Bad_Opcode }, +- { "kmovb", { MaskG, Rdq }, 0 }, +- { "kmovd", { MaskG, Rdq }, 0 }, ++ { "%XEkmovb", { MaskG, Rdq }, 0 }, ++ { "%XEkmovd", { MaskG, Rdq }, 0 }, + }, + + /* PREFIX_VEX_0F92_L_0_W_1 */ +@@ -3807,15 +3920,15 @@ static const struct dis386 prefix_table[][4] = { + { Bad_Opcode }, + { Bad_Opcode }, + { Bad_Opcode }, +- { "kmovK", { MaskG, Rdq }, 0 }, ++ { "%XEkmovK", { MaskG, Rdq }, 0 }, + }, + + /* PREFIX_VEX_0F93_L_0_W_0 */ + { +- { "kmovw", { Gdq, MaskR }, 0 }, ++ { "%XEkmovw", { Gdq, MaskR }, 0 }, + { Bad_Opcode }, +- { "kmovb", { Gdq, MaskR }, 0 }, +- { "kmovd", { Gdq, MaskR }, 0 }, ++ { "%XEkmovb", { Gdq, MaskR }, 0 }, ++ { "%XEkmovd", { Gdq, MaskR }, 0 }, + }, + + /* PREFIX_VEX_0F93_L_0_W_1 */ +@@ -3823,7 +3936,7 @@ static const struct dis386 prefix_table[][4] = { + { Bad_Opcode }, + { Bad_Opcode }, + { Bad_Opcode }, +- { "kmovK", { Gdq, MaskR }, 0 }, ++ { "%XEkmovK", { Gdq, MaskR }, 0 }, + }, + + /* PREFIX_VEX_0F98_L_0_W_0 */ +@@ -3982,12 +4095,22 @@ static const struct dis386 prefix_table[][4] = { + { "vsm4rnds4", { XM, Vex, EXx }, 0 }, + }, + ++ /* PREFIX_VEX_0F38F2_L_0 */ ++ { ++ { "%NFandnS", { Gdq, VexGdq, Edq }, 0 }, ++ }, ++ ++ /* PREFIX_VEX_0F38F3_L_0 */ ++ { ++ { REG_TABLE (REG_VEX_0F38F3_L_0_P_0) }, ++ }, ++ + /* PREFIX_VEX_0F38F5_L_0 */ + { +- { "bzhiS", { Gdq, Edq, VexGdq }, 0 }, +- { "pextS", { Gdq, VexGdq, Edq }, 0 }, ++ { "%NFbzhiS", { Gdq, Edq, VexGdq }, 0 }, ++ { "%XEpextS", { Gdq, VexGdq, Edq }, 0 }, + { Bad_Opcode }, +- { "pdepS", { Gdq, VexGdq, Edq }, 0 }, ++ { "%XEpdepS", { Gdq, VexGdq, Edq }, 0 }, + }, + + /* PREFIX_VEX_0F38F6_L_0 */ +@@ -3995,15 +4118,15 @@ static const struct dis386 prefix_table[][4] = { + { Bad_Opcode }, + { Bad_Opcode }, + { Bad_Opcode }, +- { "mulxS", { Gdq, VexGdq, Edq }, 0 }, ++ { "%XEmulxS", { Gdq, VexGdq, Edq }, 0 }, + }, + + /* PREFIX_VEX_0F38F7_L_0 */ + { +- { "bextrS", { Gdq, Edq, VexGdq }, 0 }, +- { "sarxS", { Gdq, Edq, VexGdq }, 0 }, +- { "shlxS", { Gdq, Edq, VexGdq }, 0 }, +- { "shrxS", { Gdq, Edq, VexGdq }, 0 }, ++ { "%NFbextrS", { Gdq, Edq, VexGdq }, 0 }, ++ { "%XEsarxS", { Gdq, Edq, VexGdq }, 0 }, ++ { "%XEshlxS", { Gdq, Edq, VexGdq }, 0 }, ++ { "%XEshrxS", { Gdq, Edq, VexGdq }, 0 }, + }, + + /* PREFIX_VEX_0F3AF0_L_0 */ +@@ -4011,7 +4134,15 @@ static const struct dis386 prefix_table[][4] = { + { Bad_Opcode }, + { Bad_Opcode }, + { Bad_Opcode }, +- { "rorxS", { Gdq, Edq, Ib }, 0 }, ++ { "%XErorxS", { Gdq, Edq, Ib }, 0 }, ++ }, ++ ++ /* PREFIX_VEX_MAP7_F8_L_0_W_0_R_0_X86_64 */ ++ { ++ { Bad_Opcode }, ++ { "uwrmsr", { Skip_MODRM, Id, Rq }, 0 }, ++ { Bad_Opcode }, ++ { "urdmsr", { Rq, Id }, 0 }, + }, + + #include "i386-dis-evex-prefix.h" +@@ -4160,13 +4291,13 @@ static const struct dis386 x86_64_table[][2] = { + /* X86_64_E8 */ + { + { "callP", { Jv, BND }, 0 }, +- { "call@", { Jv, BND }, 0 } ++ { "call@", { Jv, BND }, PREFIX_REX2_ILLEGAL } + }, + + /* X86_64_E9 */ + { + { "jmpP", { Jv, BND }, 0 }, +- { "jmp@", { Jv, BND }, 0 } ++ { "jmp@", { Jv, BND }, PREFIX_REX2_ILLEGAL } + }, + + /* X86_64_EA */ +@@ -4322,6 +4453,12 @@ static const struct dis386 x86_64_table[][2] = { + { "movZ", { Td, Em }, 0 }, + }, + ++ { ++ /* X86_64_0F38F8_M_1 */ ++ { Bad_Opcode }, ++ { PREFIX_TABLE (PREFIX_0F38F8_M_1_X86_64) }, ++ }, ++ + /* X86_64_0FC7_REG_6_MOD_3_PREFIX_1 */ + { + { Bad_Opcode }, +@@ -4361,97 +4498,103 @@ static const struct dis386 x86_64_table[][2] = { + /* X86_64_VEX_0F38E0 */ + { + { Bad_Opcode }, +- { "cmpoxadd", { Mdq, Gdq, VexGdq }, PREFIX_DATA }, ++ { "%XEcmpoxadd", { Mdq, Gdq, VexGdq }, PREFIX_DATA }, + }, + + /* X86_64_VEX_0F38E1 */ + { + { Bad_Opcode }, +- { "cmpnoxadd", { Mdq, Gdq, VexGdq }, PREFIX_DATA }, ++ { "%XEcmpnoxadd", { Mdq, Gdq, VexGdq }, PREFIX_DATA }, + }, + + /* X86_64_VEX_0F38E2 */ + { + { Bad_Opcode }, +- { "cmpbxadd", { Mdq, Gdq, VexGdq }, PREFIX_DATA }, ++ { "%XEcmpbxadd", { Mdq, Gdq, VexGdq }, PREFIX_DATA }, + }, + + /* X86_64_VEX_0F38E3 */ + { + { Bad_Opcode }, +- { "cmpnbxadd", { Mdq, Gdq, VexGdq }, PREFIX_DATA }, ++ { "%XEcmpnbxadd", { Mdq, Gdq, VexGdq }, PREFIX_DATA }, + }, + + /* X86_64_VEX_0F38E4 */ + { + { Bad_Opcode }, +- { "cmpzxadd", { Mdq, Gdq, VexGdq }, PREFIX_DATA }, ++ { "%XEcmpzxadd", { Mdq, Gdq, VexGdq }, PREFIX_DATA }, + }, + + /* X86_64_VEX_0F38E5 */ + { + { Bad_Opcode }, +- { "cmpnzxadd", { Mdq, Gdq, VexGdq }, PREFIX_DATA }, ++ { "%XEcmpnzxadd", { Mdq, Gdq, VexGdq }, PREFIX_DATA }, + }, + + /* X86_64_VEX_0F38E6 */ + { + { Bad_Opcode }, +- { "cmpbexadd", { Mdq, Gdq, VexGdq }, PREFIX_DATA }, ++ { "%XEcmpbexadd", { Mdq, Gdq, VexGdq }, PREFIX_DATA }, + }, + + /* X86_64_VEX_0F38E7 */ + { + { Bad_Opcode }, +- { "cmpnbexadd", { Mdq, Gdq, VexGdq }, PREFIX_DATA }, ++ { "%XEcmpnbexadd", { Mdq, Gdq, VexGdq }, PREFIX_DATA }, + }, + + /* X86_64_VEX_0F38E8 */ + { + { Bad_Opcode }, +- { "cmpsxadd", { Mdq, Gdq, VexGdq }, PREFIX_DATA }, ++ { "%XEcmpsxadd", { Mdq, Gdq, VexGdq }, PREFIX_DATA }, + }, + + /* X86_64_VEX_0F38E9 */ + { + { Bad_Opcode }, +- { "cmpnsxadd", { Mdq, Gdq, VexGdq }, PREFIX_DATA }, ++ { "%XEcmpnsxadd", { Mdq, Gdq, VexGdq }, PREFIX_DATA }, + }, + + /* X86_64_VEX_0F38EA */ + { + { Bad_Opcode }, +- { "cmppxadd", { Mdq, Gdq, VexGdq }, PREFIX_DATA }, ++ { "%XEcmppxadd", { Mdq, Gdq, VexGdq }, PREFIX_DATA }, + }, + + /* X86_64_VEX_0F38EB */ + { + { Bad_Opcode }, +- { "cmpnpxadd", { Mdq, Gdq, VexGdq }, PREFIX_DATA }, ++ { "%XEcmpnpxadd", { Mdq, Gdq, VexGdq }, PREFIX_DATA }, + }, + + /* X86_64_VEX_0F38EC */ + { + { Bad_Opcode }, +- { "cmplxadd", { Mdq, Gdq, VexGdq }, PREFIX_DATA }, ++ { "%XEcmplxadd", { Mdq, Gdq, VexGdq }, PREFIX_DATA }, + }, + + /* X86_64_VEX_0F38ED */ + { + { Bad_Opcode }, +- { "cmpnlxadd", { Mdq, Gdq, VexGdq }, PREFIX_DATA }, ++ { "%XEcmpnlxadd", { Mdq, Gdq, VexGdq }, PREFIX_DATA }, + }, + + /* X86_64_VEX_0F38EE */ + { + { Bad_Opcode }, +- { "cmplexadd", { Mdq, Gdq, VexGdq }, PREFIX_DATA }, ++ { "%XEcmplexadd", { Mdq, Gdq, VexGdq }, PREFIX_DATA }, + }, + + /* X86_64_VEX_0F38EF */ + { + { Bad_Opcode }, +- { "cmpnlexadd", { Mdq, Gdq, VexGdq }, PREFIX_DATA }, ++ { "%XEcmpnlexadd", { Mdq, Gdq, VexGdq }, PREFIX_DATA }, ++ }, ++ ++ /* X86_64_VEX_MAP7_F8_L_0_W_0_R_0 */ ++ { ++ { Bad_Opcode }, ++ { PREFIX_TABLE (PREFIX_VEX_MAP7_F8_L_0_W_0_R_0_X86_64) }, + }, + }; + +@@ -4739,7 +4882,7 @@ static const struct dis386 three_byte_table[][256] = { + { PREFIX_TABLE (PREFIX_0F38F6) }, + { Bad_Opcode }, + /* f8 */ +- { PREFIX_TABLE (PREFIX_0F38F8) }, ++ { MOD_TABLE (MOD_0F38F8) }, + { "movdiri", { Mdq, Gdq }, PREFIX_OPCODE }, + { PREFIX_TABLE (PREFIX_0F38FA) }, + { PREFIX_TABLE (PREFIX_0F38FB) }, +@@ -7039,12 +7182,12 @@ static const struct dis386 vex_len_table[][2] = { + + /* VEX_LEN_0F38F2 */ + { +- { "andnS", { Gdq, VexGdq, Edq }, PREFIX_OPCODE }, ++ { PREFIX_TABLE (PREFIX_VEX_0F38F2_L_0) }, + }, + + /* VEX_LEN_0F38F3 */ + { +- { REG_TABLE(REG_VEX_0F38F3_L_0) }, ++ { PREFIX_TABLE (PREFIX_VEX_0F38F3_L_0) }, + }, + + /* VEX_LEN_0F38F5 */ +@@ -7205,6 +7348,11 @@ static const struct dis386 vex_len_table[][2] = { + { PREFIX_TABLE (PREFIX_VEX_0F3AF0_L_0) }, + }, + ++ /* VEX_LEN_MAP7_F8 */ ++ { ++ { VEX_W_TABLE (VEX_W_MAP7_F8_L_0) }, ++ }, ++ + /* VEX_LEN_XOP_08_85 */ + { + { VEX_W_TABLE (VEX_W_XOP_08_85_L_0) }, +@@ -7811,6 +7959,10 @@ static const struct dis386 vex_w_table[][2] = { + /* VEX_W_0F3ADE */ + { VEX_LEN_TABLE (VEX_LEN_0F3ADE_W_0) }, + }, ++ { ++ /* VEX_W_MAP7_F8_L_0 */ ++ { REG_TABLE (REG_VEX_MAP7_F8_L_0_W_0) }, ++ }, + /* VEX_W_XOP_08_85_L_0 */ + { + { "vpmacssww", { XM, Vex, EXx, XMVexI4 }, 0 }, +@@ -8125,7 +8277,7 @@ static const struct dis386 mod_table[][2] = { + }, + { + /* MOD_0FAE_REG_5 */ +- { "xrstor", { FXSAVE }, PREFIX_OPCODE }, ++ { "xrstor", { FXSAVE }, PREFIX_OPCODE | PREFIX_REX2_ILLEGAL }, + { PREFIX_TABLE (PREFIX_0FAE_REG_5_MOD_3) }, + }, + { +@@ -8153,6 +8305,11 @@ static const struct dis386 mod_table[][2] = { + { "aesenc128kl", { XM, M }, 0 }, + { "loadiwkey", { XM, EXx }, 0 }, + }, ++ /* MOD_0F38F8 */ ++ { ++ { PREFIX_TABLE (PREFIX_0F38F8_M_0) }, ++ { X86_64_TABLE (X86_64_0F38F8_M_1) }, ++ }, + { + /* MOD_VEX_0F3849_X86_64_L_0_W_0 */ + { PREFIX_TABLE (PREFIX_VEX_0F3849_X86_64_L_0_W_0_M_0) }, +@@ -8323,6 +8480,24 @@ ckprefix (instr_info *ins) + return ckp_okay; + ins->last_rex_prefix = i; + break; ++ /* REX2 must be the last prefix. */ ++ case REX2_OPCODE: ++ if (ins->address_mode == mode_64bit) ++ { ++ if (ins->last_rex_prefix >= 0) ++ return ckp_bogus; ++ ++ ins->codep++; ++ if (!fetch_code (ins->info, ins->codep + 1)) ++ return ckp_fetch_error; ++ ins->rex2_payload = *ins->codep; ++ ins->rex2 = ins->rex2_payload >> 4; ++ ins->rex = (ins->rex2_payload & 0xf) | REX_OPCODE; ++ ins->codep++; ++ ins->last_rex2_prefix = i; ++ ins->all_prefixes[i] = REX2_OPCODE; ++ } ++ return ckp_okay; + case 0xf3: + ins->prefixes |= PREFIX_REPZ; + ins->last_repz_prefix = i; +@@ -8490,6 +8665,8 @@ prefix_name (enum address_mode mode, uint8_t pref, int sizeflag) + return "bnd"; + case NOTRACK_PREFIX: + return "notrack"; ++ case REX2_OPCODE: ++ return "rex2"; + default: + return NULL; + } +@@ -8507,10 +8684,10 @@ with the -M switch (multiple options should be separated by commas):\n")); + fprintf (stream, _(" i8086 Disassemble in 16bit mode\n")); + fprintf (stream, _(" att Display instruction in AT&T syntax\n")); + fprintf (stream, _(" intel Display instruction in Intel syntax\n")); +- fprintf (stream, _(" att-mnemonic\n" +- " Display instruction in AT&T mnemonic\n")); +- fprintf (stream, _(" intel-mnemonic\n" +- " Display instruction in Intel mnemonic\n")); ++ fprintf (stream, _(" att-mnemonic (AT&T syntax only)\n" ++ " Display instruction with AT&T mnemonic\n")); ++ fprintf (stream, _(" intel-mnemonic (AT&T syntax only)\n" ++ " Display instruction with Intel mnemonic\n")); + fprintf (stream, _(" addr64 Assume 64bit address size\n")); + fprintf (stream, _(" addr32 Assume 32bit address size\n")); + fprintf (stream, _(" addr16 Assume 16bit address size\n")); +@@ -8527,6 +8704,8 @@ static const struct dis386 bad_opcode = { "(bad)", { XX }, 0 }; + /* Fetch error indicator. */ + static const struct dis386 err_opcode = { NULL, { XX }, 0 }; + ++static const struct dis386 map7_f8_opcode = { VEX_LEN_TABLE (VEX_LEN_MAP7_F8) }; ++ + /* Get a pointer to struct dis386 with a valid name. */ + + static const struct dis386 * +@@ -8553,6 +8732,7 @@ get_valid_dis386 (const struct dis386 *dp, instr_info *ins) + break; + + case USE_PREFIX_TABLE: ++ use_prefix_table: + if (ins->need_vex) + { + /* The prefix in VEX is implicit. */ +@@ -8622,12 +8802,40 @@ get_valid_dis386 (const struct dis386 *dp, instr_info *ins) + dp = &prefix_table[dp->op[1].bytemode][vindex]; + break; + ++ case USE_X86_64_EVEX_FROM_VEX_TABLE: ++ case USE_X86_64_EVEX_PFX_TABLE: ++ case USE_X86_64_EVEX_W_TABLE: ++ case USE_X86_64_EVEX_MEM_W_TABLE: ++ ins->evex_type = evex_from_vex; ++ /* EVEX from VEX instructions are 64-bit only and require that EVEX.z, ++ EVEX.L'L, EVEX.b, and the lower 2 bits of EVEX.aaa must be 0. */ ++ if (ins->address_mode != mode_64bit ++ || (ins->vex.mask_register_specifier & 0x3) != 0 ++ || ins->vex.ll != 0 ++ || ins->vex.zeroing != 0 ++ || ins->vex.b) ++ return &bad_opcode; ++ ++ if (dp->op[0].bytemode == USE_X86_64_EVEX_PFX_TABLE) ++ goto use_prefix_table; ++ if (dp->op[0].bytemode == USE_X86_64_EVEX_W_TABLE) ++ goto use_vex_w_table; ++ if (dp->op[0].bytemode == USE_X86_64_EVEX_MEM_W_TABLE) ++ { ++ if (ins->modrm.mod == 3) ++ return &bad_opcode; ++ goto use_vex_w_table; ++ } ++ ++ /* Fall through. */ + case USE_X86_64_TABLE: + vindex = ins->address_mode == mode_64bit ? 1 : 0; + dp = &x86_64_table[dp->op[1].bytemode][vindex]; + break; + + case USE_3BYTE_TABLE: ++ if (ins->last_rex2_prefix >= 0) ++ return &err_opcode; + if (!fetch_code (ins->info, ins->codep + 2)) + return &err_opcode; + vindex = *ins->codep++; +@@ -8769,6 +8977,9 @@ get_valid_dis386 (const struct dis386 *dp, instr_info *ins) + case 0x3: + vex_table_index = VEX_0F3A; + break; ++ case 0x7: ++ vex_table_index = VEX_MAP7; ++ break; + } + ins->codep++; + ins->vex.w = *ins->codep & 0x80; +@@ -8803,7 +9014,12 @@ get_valid_dis386 (const struct dis386 *dp, instr_info *ins) + ins->need_vex = 3; + ins->codep++; + vindex = *ins->codep++; +- dp = &vex_table[vex_table_index][vindex]; ++ if (vex_table_index != VEX_MAP7) ++ dp = &vex_table[vex_table_index][vindex]; ++ else if (vindex == 0xf8) ++ dp = &map7_f8_opcode; ++ else ++ dp = &bad_opcode; + ins->end_codep = ins->codep; + /* There is no MODRM byte for VEX0F 77. */ + if ((vex_table_index != VEX_0F || vindex != 0x77) +@@ -8846,6 +9062,7 @@ get_valid_dis386 (const struct dis386 *dp, instr_info *ins) + break; + + case USE_VEX_W_TABLE: ++ use_vex_w_table: + if (!ins->need_vex) + abort (); + +@@ -8859,9 +9076,13 @@ get_valid_dis386 (const struct dis386 *dp, instr_info *ins) + if (!fetch_code (ins->info, ins->codep + 4)) + return &err_opcode; + /* The first byte after 0x62. */ ++ if (*ins->codep & 0x8) ++ ins->rex2 |= REX_B; ++ if (!(*ins->codep & 0x10)) ++ ins->rex2 |= REX_R; ++ + ins->rex = ~(*ins->codep >> 5) & 0x7; +- ins->vex.r = *ins->codep & 0x10; +- switch ((*ins->codep & 0xf)) ++ switch (*ins->codep & 0x7) + { + default: + return &bad_opcode; +@@ -8874,12 +9095,21 @@ get_valid_dis386 (const struct dis386 *dp, instr_info *ins) + case 0x3: + vex_table_index = EVEX_0F3A; + break; ++ case 0x4: ++ vex_table_index = EVEX_MAP4; ++ ins->evex_type = evex_from_legacy; ++ if (ins->address_mode != mode_64bit) ++ return &bad_opcode; ++ break; + case 0x5: + vex_table_index = EVEX_MAP5; + break; + case 0x6: + vex_table_index = EVEX_MAP6; + break; ++ case 0x7: ++ vex_table_index = EVEX_MAP7; ++ break; + } + + /* The second byte after 0x62. */ +@@ -8890,9 +9120,8 @@ get_valid_dis386 (const struct dis386 *dp, instr_info *ins) + + ins->vex.register_specifier = (~(*ins->codep >> 3)) & 0xf; + +- /* The U bit. */ + if (!(*ins->codep & 0x4)) +- return &bad_opcode; ++ ins->rex2 |= REX_X; + + switch ((*ins->codep & 0x3)) + { +@@ -8919,24 +9148,54 @@ get_valid_dis386 (const struct dis386 *dp, instr_info *ins) + ins->vex.v = *ins->codep & 0x8; + ins->vex.mask_register_specifier = *ins->codep & 0x7; + ins->vex.zeroing = *ins->codep & 0x80; ++ /* Set the NF bit for EVEX-Promoted instructions, this bit will be cleared ++ when it's an evex_default one. */ ++ ins->vex.nf = *ins->codep & 0x4; + + if (ins->address_mode != mode_64bit) + { ++ /* Report bad for !evex_default and when two fixed values of evex ++ change.. */ ++ if (ins->evex_type != evex_default ++ || (ins->rex2 & (REX_B | REX_X))) ++ return &bad_opcode; + /* In 16/32-bit mode silently ignore following bits. */ + ins->rex &= ~REX_B; +- ins->vex.r = true; ++ ins->rex2 &= ~REX_R; + } + ++ /* EVEX from legacy instructions, when the EVEX.ND bit is 0, ++ all bits of EVEX.vvvv and EVEX.V' must be 1. */ ++ if (ins->evex_type == evex_from_legacy && !ins->vex.nd ++ && (ins->vex.register_specifier || !ins->vex.v)) ++ return &bad_opcode; ++ + ins->need_vex = 4; ++ ++ /* EVEX from legacy instructions require that EVEX.z, EVEX.L’L and the ++ lower 2 bits of EVEX.aaa must be 0. */ ++ if (ins->evex_type == evex_from_legacy ++ && ((ins->vex.mask_register_specifier & 0x3) != 0 ++ || ins->vex.ll != 0 ++ || ins->vex.zeroing != 0)) ++ return &bad_opcode; ++ + ins->codep++; + vindex = *ins->codep++; +- dp = &evex_table[vex_table_index][vindex]; ++ if (vex_table_index != EVEX_MAP7) ++ dp = &evex_table[vex_table_index][vindex]; ++ else if (vindex == 0xf8) ++ dp = &map7_f8_opcode; ++ else ++ dp = &bad_opcode; + ins->end_codep = ins->codep; + if (!fetch_modrm (ins)) + return &err_opcode; + +- /* Set vector length. */ +- if (ins->modrm.mod == 3 && ins->vex.b) ++ /* Set vector length. For EVEX-promoted instructions, evex.ll == 0b00, ++ which has the same encoding as vex.length == 128 and they can share ++ the same processing with vex.length in OP_VEX. */ ++ if (ins->modrm.mod == 3 && ins->vex.b && ins->evex_type != evex_from_legacy) + ins->vex.length = 512; + else + { +@@ -9128,6 +9387,7 @@ print_insn (bfd_vma pc, disassemble_info *info, int intel_syntax) + .last_data_prefix = -1, + .last_addr_prefix = -1, + .last_rex_prefix = -1, ++ .last_rex2_prefix = -1, + .last_seg_prefix = -1, + .fwait_prefix = -1, + }; +@@ -9167,9 +9427,10 @@ print_insn (bfd_vma pc, disassemble_info *info, int intel_syntax) + } + else if (startswith (p, "intel")) + { +- ins.intel_syntax = 1; + if (startswith (p + 5, "-mnemonic")) + ins.intel_mnemonic = true; ++ else ++ ins.intel_syntax = 1; + } + else if (startswith (p, "att")) + { +@@ -9292,24 +9553,25 @@ print_insn (bfd_vma pc, disassemble_info *info, int intel_syntax) + goto out; + } + +- if (*ins.codep == 0x0f) ++ /* REX2.M in rex2 prefix represents map0 or map1. */ ++ if (ins.last_rex2_prefix < 0 ? *ins.codep == 0x0f : (ins.rex2 & REX2_M)) + { +- unsigned char threebyte; ++ if (!ins.rex2) ++ { ++ ins.codep++; ++ if (!fetch_code (info, ins.codep + 1)) ++ goto fetch_error_out; ++ } + +- ins.codep++; +- if (!fetch_code (info, ins.codep + 1)) +- goto fetch_error_out; +- threebyte = *ins.codep; +- dp = &dis386_twobyte[threebyte]; +- ins.need_modrm = twobyte_has_modrm[threebyte]; +- ins.codep++; ++ dp = &dis386_twobyte[*ins.codep]; ++ ins.need_modrm = twobyte_has_modrm[*ins.codep]; + } + else + { + dp = &dis386[*ins.codep]; + ins.need_modrm = onebyte_has_modrm[*ins.codep]; +- ins.codep++; + } ++ ins.codep++; + + /* Save sizeflag for printing the extra ins.prefixes later before updating + it for mnemonic and operand processing. The prefix names depend +@@ -9335,6 +9597,22 @@ print_insn (bfd_vma pc, disassemble_info *info, int intel_syntax) + dp = get_valid_dis386 (dp, &ins); + if (dp == &err_opcode) + goto fetch_error_out; ++ ++ /* For APX instructions promoted from legacy maps 0/1, embedded prefix ++ is interpreted as the operand size override. */ ++ if (ins.evex_type == evex_from_legacy ++ && ins.vex.prefix == DATA_PREFIX_OPCODE) ++ sizeflag ^= DFLAG; ++ ++ if(ins.evex_type == evex_default) ++ ins.vex.nf = false; ++ else ++ /* For EVEX-promoted formats, we need to clear EVEX.NF (ccmp and ctest ++ are cleared separately.) in mask_register_specifier and keep the low ++ 2 bits of mask_register_specifier to report errors for invalid cases ++ . */ ++ ins.vex.mask_register_specifier &= 0x3; ++ + if (dp != NULL && putop (&ins, dp->name, sizeflag) == 0) + { + if (!get_sib (&ins, sizeflag)) +@@ -9387,10 +9665,13 @@ print_insn (bfd_vma pc, disassemble_info *info, int intel_syntax) + oappend (&ins, "/(bad)"); + } + } ++ /* vex.nf is cleared after being consumed. */ ++ if (ins.vex.nf) ++ oappend (&ins, "{bad-nf}"); + + /* Check whether rounding control was enabled for an insn not +- supporting it. */ +- if (ins.modrm.mod == 3 && ins.vex.b ++ supporting it, when evex.b is not treated as evex.nd. */ ++ if (ins.modrm.mod == 3 && ins.vex.b && ins.evex_type == evex_default + && !(ins.evex_used & EVEX_b_used)) + { + for (i = 0; i < MAX_OPERANDS; ++i) +@@ -9454,7 +9735,15 @@ print_insn (bfd_vma pc, disassemble_info *info, int intel_syntax) + goto out; + } + +- switch (dp->prefix_requirement) ++ if ((dp->prefix_requirement & PREFIX_REX2_ILLEGAL) ++ && ins.last_rex2_prefix >= 0 && (ins.rex2 & REX2_SPECIAL) == 0) ++ { ++ i386_dis_printf (info, dis_style_text, "(bad)"); ++ ret = ins.end_codep - priv.the_buffer; ++ goto out; ++ } ++ ++ switch (dp->prefix_requirement & ~PREFIX_REX2_ILLEGAL) + { + case PREFIX_DATA: + /* If only the data prefix is marked as mandatory, its absence renders +@@ -9506,6 +9795,25 @@ print_insn (bfd_vma pc, disassemble_info *info, int intel_syntax) + if (ins.last_repnz_prefix >= 0) + ins.all_prefixes[ins.last_repnz_prefix] = 0xf2; + break; ++ ++ case PREFIX_NP_OR_DATA: ++ if (ins.vex.prefix == REPE_PREFIX_OPCODE ++ || ins.vex.prefix == REPNE_PREFIX_OPCODE) ++ { ++ i386_dis_printf (info, dis_style_text, "(bad)"); ++ ret = ins.end_codep - priv.the_buffer; ++ goto out; ++ } ++ break; ++ ++ case NO_PREFIX: ++ if (ins.vex.prefix) ++ { ++ i386_dis_printf (info, dis_style_text, "(bad)"); ++ ret = ins.end_codep - priv.the_buffer; ++ goto out; ++ } ++ break; + } + + /* Check if the REX prefix is used. */ +@@ -9513,6 +9821,14 @@ print_insn (bfd_vma pc, disassemble_info *info, int intel_syntax) + && !ins.need_vex && ins.last_rex_prefix >= 0) + ins.all_prefixes[ins.last_rex_prefix] = 0; + ++ /* Check if the REX2 prefix is used. */ ++ if (ins.last_rex2_prefix >= 0 ++ && ((ins.rex2 & REX2_SPECIAL) ++ || (((ins.rex2 & 7) ^ (ins.rex2_used & 7)) == 0 ++ && (ins.rex ^ ins.rex_used) == 0 ++ && (ins.rex2 & 7)))) ++ ins.all_prefixes[ins.last_rex2_prefix] = 0; ++ + /* Check if the SEG prefix is used. */ + if ((ins.prefixes & (PREFIX_CS | PREFIX_SS | PREFIX_DS | PREFIX_ES + | PREFIX_FS | PREFIX_GS)) != 0 +@@ -9541,7 +9857,11 @@ print_insn (bfd_vma pc, disassemble_info *info, int intel_syntax) + if (name == NULL) + abort (); + prefix_length += strlen (name) + 1; +- i386_dis_printf (info, dis_style_mnemonic, "%s ", name); ++ if (ins.all_prefixes[i] == REX2_OPCODE) ++ i386_dis_printf (info, dis_style_mnemonic, "{%s 0x%x} ", name, ++ (unsigned int) ins.rex2_payload); ++ else ++ i386_dis_printf (info, dis_style_mnemonic, "%s ", name); + } + + /* Check maximum code length. */ +@@ -10077,6 +10397,16 @@ putop (instr_info *ins, const char *in_template, int sizeflag) + int cond = 1; + unsigned int l = 0, len = 0; + char last[4]; ++ bool evex_printed = false; ++ ++ /* We don't want to add any prefix or suffix to (bad), so return early. */ ++ if (!strncmp (in_template, "(bad)", 5)) ++ { ++ oappend (ins, "(bad)"); ++ *ins->obufp = 0; ++ ins->mnemonicendp = ins->obufp; ++ return 0; ++ } + + for (p = in_template; *p; p++) + { +@@ -10090,6 +10420,12 @@ putop (instr_info *ins, const char *in_template, int sizeflag) + switch (*p) + { + default: ++ if (ins->evex_type == evex_from_legacy && !ins->vex.nd ++ && !(ins->rex2 & 7) && !evex_printed) ++ { ++ oappend (ins, "{evex} "); ++ evex_printed = true; ++ } + *ins->obufp++ = *p; + break; + case '%': +@@ -10120,7 +10456,7 @@ putop (instr_info *ins, const char *in_template, int sizeflag) + case 'A': + if (ins->intel_syntax) + break; +- if ((ins->need_modrm && ins->modrm.mod != 3) ++ if ((ins->need_modrm && ins->modrm.mod != 3 && !ins->vex.nd) + || (sizeflag & SUFFIX_ALWAYS)) + *ins->obufp++ = 'b'; + break; +@@ -10204,7 +10540,7 @@ putop (instr_info *ins, const char *in_template, int sizeflag) + { + case 'X': + if (!ins->vex.evex || ins->vex.b || ins->vex.ll >= 2 +- || !ins->vex.r ++ || (ins->rex2 & 7) + || (ins->modrm.mod == 3 && (ins->rex & REX_X)) + || !ins->vex.v || ins->vex.mask_register_specifier) + break; +@@ -10226,6 +10562,11 @@ putop (instr_info *ins, const char *in_template, int sizeflag) + *ins->obufp++ = '}'; + *ins->obufp++ = ' '; + break; ++ case 'M': ++ if (ins->modrm.mod != 3 && !(ins->rex2 & 7)) ++ oappend (ins, "{evex} "); ++ evex_printed = true; ++ break; + default: + abort (); + } +@@ -10245,16 +10586,39 @@ putop (instr_info *ins, const char *in_template, int sizeflag) + ins->used_prefixes |= (ins->prefixes & PREFIX_ADDR); + break; + case 'F': +- if (ins->intel_syntax) ++ if (l == 0) ++ { ++ if (ins->intel_syntax) ++ break; ++ if ((ins->prefixes & PREFIX_ADDR) || (sizeflag & SUFFIX_ALWAYS)) ++ { ++ if (sizeflag & AFLAG) ++ *ins->obufp++ = ins->address_mode == mode_64bit ? 'q' : 'l'; ++ else ++ *ins->obufp++ = ins->address_mode == mode_64bit ? 'l' : 'w'; ++ ins->used_prefixes |= (ins->prefixes & PREFIX_ADDR); ++ } ++ } ++ else if (l == 1 && last[0] == 'C') + break; +- if ((ins->prefixes & PREFIX_ADDR) || (sizeflag & SUFFIX_ALWAYS)) ++ else if (l == 1 && last[0] == 'N') + { +- if (sizeflag & AFLAG) +- *ins->obufp++ = ins->address_mode == mode_64bit ? 'q' : 'l'; +- else +- *ins->obufp++ = ins->address_mode == mode_64bit ? 'l' : 'w'; +- ins->used_prefixes |= (ins->prefixes & PREFIX_ADDR); ++ if (ins->vex.nf) ++ { ++ oappend (ins, "{nf} "); ++ /* This bit needs to be cleared after it is consumed. */ ++ ins->vex.nf = false; ++ evex_printed = true; ++ } ++ else if (ins->evex_type == evex_from_vex && !(ins->rex2 & 7) ++ && ins->vex.v) ++ { ++ oappend (ins, "{evex} "); ++ evex_printed = true; ++ } + } ++ else ++ abort (); + break; + case 'G': + if (ins->intel_syntax || (ins->obufp[-1] != 's' +@@ -10311,7 +10675,16 @@ putop (instr_info *ins, const char *in_template, int sizeflag) + *ins->obufp++ = 'd'; + break; + case 'L': +- abort (); ++ if (ins->intel_syntax) ++ break; ++ if (sizeflag & SUFFIX_ALWAYS) ++ { ++ if (ins->rex & REX_W) ++ *ins->obufp++ = 'q'; ++ else ++ *ins->obufp++ = 'l'; ++ } ++ break; + case 'M': + if (ins->intel_mnemonic != cond) + *ins->obufp++ = 'r'; +@@ -10346,6 +10719,19 @@ putop (instr_info *ins, const char *in_template, int sizeflag) + case 'P': + if (l == 0) + { ++ if (!cond && ins->last_rex2_prefix >= 0 && (ins->rex & REX_W)) ++ { ++ /* For pushp and popp, p is printed and do not print {rex2} ++ for them. */ ++ *ins->obufp++ = 'p'; ++ ins->rex2 |= REX2_SPECIAL; ++ break; ++ } ++ ++ /* For "!P" print nothing else in Intel syntax. */ ++ if (!cond && ins->intel_syntax) ++ break; ++ + if ((ins->modrm.mod == 3 || !cond) + && !(sizeflag & SUFFIX_ALWAYS)) + break; +@@ -10390,7 +10776,7 @@ putop (instr_info *ins, const char *in_template, int sizeflag) + if (ins->intel_syntax && !alt) + break; + USED_REX (REX_W); +- if ((ins->need_modrm && ins->modrm.mod != 3) ++ if ((ins->need_modrm && ins->modrm.mod != 3 && !ins->vex.nd) + || (sizeflag & SUFFIX_ALWAYS)) + { + if (ins->rex & REX_W) +@@ -10818,7 +11204,8 @@ print_displacement (instr_info *ins, bfd_signed_vma val) + static void + intel_operand_size (instr_info *ins, int bytemode, int sizeflag) + { +- if (ins->vex.b) ++ /* Check if there is a broadcast, when evex.b is not treated as evex.nd. */ ++ if (ins->vex.b && ins->evex_type == evex_default) + { + if (!ins->vex.no_broadcast) + switch (bytemode) +@@ -11088,6 +11475,8 @@ print_register (instr_info *ins, unsigned int reg, unsigned int rexmask, + USED_REX (rexmask); + if (ins->rex & rexmask) + reg += 8; ++ if (ins->rex2 & rexmask) ++ reg += 16; + + switch (bytemode) + { +@@ -11095,7 +11484,7 @@ print_register (instr_info *ins, unsigned int reg, unsigned int rexmask, + case b_swap_mode: + if (reg & 4) + USED_REX (0); +- if (ins->rex) ++ if (ins->rex || ins->rex2) + names = att_names8rex; + else + names = att_names8; +@@ -11300,6 +11689,7 @@ OP_Skip_MODRM (instr_info *ins, int bytemode ATTRIBUTE_UNUSED, + /* Skip mod/rm byte. */ + MODRM_CHECK; + ins->codep++; ++ ins->has_skipped_modrm = true; + return true; + } + +@@ -11310,7 +11700,10 @@ OP_E_memory (instr_info *ins, int bytemode, int sizeflag) + int riprel = 0; + int shift; + +- if (ins->vex.evex) ++ add += (ins->rex2 & REX_B) ? 16 : 0; ++ ++ /* Handles EVEX other than APX EVEX-promoted instructions. */ ++ if (ins->vex.evex && ins->evex_type == evex_default) + { + + /* Zeroing-masking is invalid for memory destinations. Set the flag +@@ -11454,6 +11847,13 @@ OP_E_memory (instr_info *ins, int bytemode, int sizeflag) + abort (); + if (ins->vex.evex) + { ++ /* S/G EVEX insns require EVEX.X4 not to be set. */ ++ if (ins->rex2 & REX_X) ++ { ++ oappend (ins, "(bad)"); ++ return true; ++ } ++ + if (!ins->vex.v) + vindex += 16; + check_gather = ins->obufp == ins->op_out[1]; +@@ -11483,6 +11883,9 @@ OP_E_memory (instr_info *ins, int bytemode, int sizeflag) + } + break; + default: ++ if (ins->rex2 & REX_X) ++ vindex += 16; ++ + if (vindex != 4) + indexes = ins->address_mode == mode_64bit && !addr32flag + ? att_names64 : att_names32; +@@ -11653,7 +12056,7 @@ OP_E_memory (instr_info *ins, int bytemode, int sizeflag) + + if (ins->rex & REX_R) + modrm_reg += 8; +- if (!ins->vex.r) ++ if (ins->rex2 & REX_R) + modrm_reg += 16; + if (vindex == modrm_reg) + oappend (ins, "/(bad)"); +@@ -11735,7 +12138,7 @@ OP_E_memory (instr_info *ins, int bytemode, int sizeflag) + print_operand_value (ins, disp & 0xffff, dis_style_text); + } + } +- if (ins->vex.b) ++ if (ins->vex.b && ins->evex_type == evex_default) + { + ins->evex_used |= EVEX_b_used; + +@@ -11818,7 +12221,11 @@ OP_E (instr_info *ins, int bytemode, int sizeflag) + { + /* Skip mod/rm byte. */ + MODRM_CHECK; +- ins->codep++; ++ if (!ins->has_skipped_modrm) ++ { ++ ins->codep++; ++ ins->has_skipped_modrm = true; ++ } + + if (ins->modrm.mod == 3) + { +@@ -11855,10 +12262,7 @@ OP_indirE (instr_info *ins, int bytemode, int sizeflag) + static bool + OP_G (instr_info *ins, int bytemode, int sizeflag) + { +- if (ins->vex.evex && !ins->vex.r && ins->address_mode == mode_64bit) +- oappend (ins, "(bad)"); +- else +- print_register (ins, ins->modrm.reg, REX_R, bytemode, sizeflag); ++ print_register (ins, ins->modrm.reg, REX_R, bytemode, sizeflag); + return true; + } + +@@ -11866,7 +12270,7 @@ static bool + OP_REG (instr_info *ins, int code, int sizeflag) + { + const char *s; +- int add; ++ int add = 0; + + switch (code) + { +@@ -11879,8 +12283,8 @@ OP_REG (instr_info *ins, int code, int sizeflag) + USED_REX (REX_B); + if (ins->rex & REX_B) + add = 8; +- else +- add = 0; ++ if (ins->rex2 & REX_B) ++ add += 16; + + switch (code) + { +@@ -12011,6 +12415,8 @@ OP_I (instr_info *ins, int bytemode, int sizeflag) + case const_1_mode: + if (ins->intel_syntax) + oappend (ins, "1"); ++ else ++ oappend (ins, "$1"); + return true; + default: + oappend (ins, INTERNAL_DISASSEMBLER_ERROR); +@@ -12487,7 +12893,7 @@ OP_XMM (instr_info *ins, int bytemode, int sizeflag ATTRIBUTE_UNUSED) + reg += 8; + if (ins->vex.evex) + { +- if (!ins->vex.r) ++ if (ins->rex2 & REX_R) + reg += 16; + } + +@@ -12592,6 +12998,8 @@ OP_EX (instr_info *ins, int bytemode, int sizeflag) + USED_REX (REX_B); + if (ins->rex & REX_B) + reg += 8; ++ if (ins->rex2 & REX_B) ++ reg += 16; + if (ins->vex.evex) + { + USED_REX (REX_X); +@@ -12623,9 +13031,10 @@ OP_R (instr_info *ins, int bytemode, int sizeflag) + { + case d_mode: + case dq_mode: ++ case q_mode: + case mask_mode: + return OP_E (ins, bytemode, sizeflag); +- case q_mode: ++ case q_mm_mode: + return OP_EM (ins, x_mode, sizeflag); + case xmm_mode: + if (ins->vex.length <= 128) +@@ -13095,6 +13504,13 @@ OP_VEX (instr_info *ins, int bytemode, int sizeflag ATTRIBUTE_UNUSED) + if (!ins->need_vex) + return true; + ++ if (ins->evex_type == evex_from_legacy) ++ { ++ ins->evex_used |= EVEX_b_used; ++ if (!ins->vex.nd) ++ return true; ++ } ++ + reg = ins->vex.register_specifier; + ins->vex.register_specifier = 0; + if (ins->address_mode != mode_64bit) +@@ -13186,12 +13602,22 @@ OP_VEX (instr_info *ins, int bytemode, int sizeflag ATTRIBUTE_UNUSED) + names = att_names_xmm; + ins->evex_used |= EVEX_len_used; + break; ++ case v_mode: + case dq_mode: + if (ins->rex & REX_W) + names = att_names64; ++ else if (bytemode == v_mode ++ && !(sizeflag & DFLAG)) ++ names = att_names16; + else + names = att_names32; + break; ++ case b_mode: ++ names = att_names8rex; ++ break; ++ case q_mode: ++ names = att_names64; ++ break; + case mask_bd_mode: + case mask_mode: + if (reg > 0x7) +@@ -13491,7 +13917,7 @@ DistinctDest_Fixup (instr_info *ins, int bytemode, int sizeflag) + /* Calc destination register number. */ + if (ins->rex & REX_R) + modrm_reg += 8; +- if (!ins->vex.r) ++ if (ins->rex2 & REX_R) + modrm_reg += 16; + + /* Calc src1 register number. */ +@@ -13576,3 +14002,58 @@ PREFETCHI_Fixup (instr_info *ins, int bytemode, int sizeflag) + + return OP_M (ins, bytemode, sizeflag); + } ++ ++static bool ++PUSH2_POP2_Fixup (instr_info *ins, int bytemode, int sizeflag) ++{ ++ if (ins->modrm.mod != 3) ++ return true; ++ ++ unsigned int vvvv_reg = ins->vex.register_specifier ++ | (!ins->vex.v << 4); ++ unsigned int rm_reg = ins->modrm.rm + (ins->rex & REX_B ? 8 : 0) ++ + (ins->rex2 & REX_B ? 16 : 0); ++ ++ /* Push2/Pop2 cannot use RSP and Pop2 cannot pop two same registers. */ ++ if (!ins->vex.nd || vvvv_reg == 0x4 || rm_reg == 0x4 ++ || (!ins->modrm.reg ++ && vvvv_reg == rm_reg)) ++ { ++ oappend (ins, "(bad)"); ++ return true; ++ } ++ ++ return OP_VEX (ins, bytemode, sizeflag); ++} ++ ++static bool ++JMPABS_Fixup (instr_info *ins, int bytemode, int sizeflag) ++{ ++ if (ins->last_rex2_prefix >= 0) ++ { ++ uint64_t op; ++ ++ if ((ins->prefixes & (PREFIX_OPCODE | PREFIX_ADDR | PREFIX_LOCK)) != 0x0 ++ || (ins->rex & REX_W) != 0x0) ++ { ++ oappend (ins, "(bad)"); ++ return true; ++ } ++ ++ if (bytemode == eAX_reg) ++ return true; ++ ++ if (!get64 (ins, &op)) ++ return false; ++ ++ ins->mnemonicendp = stpcpy (ins->obuf, "jmpabs"); ++ ins->rex2 |= REX2_SPECIAL; ++ oappend_immediate (ins, op); ++ ++ return true; ++ } ++ ++ if (bytemode == eAX_reg) ++ return OP_IMREG (ins, bytemode, sizeflag); ++ return OP_OFF64 (ins, bytemode, sizeflag); ++} +diff --git a/opcodes/i386-gen.c b/opcodes/i386-gen.c +--- a/opcodes/i386-gen.c ++++ b/opcodes/i386-gen.c +@@ -1,4 +1,4 @@ +-/* Copyright (C) 2007-2023 Free Software Foundation, Inc. ++/* Copyright (C) 2007-2024 Free Software Foundation, Inc. + + This file is part of the GNU opcodes library. + +@@ -63,7 +63,7 @@ static const dependency isa_dependencies[] = + { "NOCONA", + "GENERIC64|FISTTP|SSE3|MONITOR|CX16" }, + { "CORE", +- "P4|FISTTP|SSE3|MONITOR|CX16" }, ++ "P4|FISTTP|SSE3|MONITOR" }, + { "CORE2", + "NOCONA|SSSE3" }, + { "COREI7", +@@ -94,6 +94,8 @@ static const dependency isa_dependencies[] = + "ZNVER2|INVLPGB|TLBSYNC|VAES|VPCLMULQDQ|INVPCID|SNP|OSPKE" }, + { "ZNVER4", + "ZNVER3|AVX512F|AVX512DQ|AVX512IFMA|AVX512CD|AVX512BW|AVX512VL|AVX512_BF16|AVX512VBMI|AVX512_VBMI2|AVX512_VNNI|AVX512_BITALG|AVX512_VPOPCNTDQ|GFNI|RMPQUERY" }, ++ { "ZNVER5", ++ "ZNVER4|AVX_VNNI|MOVDIRI|MOVDIR64B|AVX512_VP2INTERSECT|PREFETCHI" }, + { "BTVER1", + "GENERIC64|FISTTP|MONITOR|CX16|LAHF_SAHF|Rdtscp|SSSE3|SSE4A|ABM|PRFCHW|Clflush|FISTTP|SVME" }, + { "BTVER2", +@@ -166,6 +168,10 @@ static const dependency isa_dependencies[] = + "AVX2" }, + { "AVX_NE_CONVERT", + "AVX2" }, ++ { "CX16", ++ "64" }, ++ { "LKGS", ++ "64" }, + { "FRED", + "LKGS" }, + { "AVX512F", +@@ -240,13 +246,13 @@ static const dependency isa_dependencies[] = + { "SNP", + "SEV_ES" }, + { "RMPQUERY", +- "SNP" }, ++ "SNP|64" }, + { "TSX", + "RTM|HLE" }, + { "TSXLDTRK", + "RTM" }, + { "AMX_TILE", +- "XSAVE" }, ++ "XSAVE|64" }, + { "AMX_INT8", + "AMX_TILE" }, + { "AMX_BF16", +@@ -259,6 +265,20 @@ static const dependency isa_dependencies[] = + "SSE2" }, + { "WIDEKL", + "KL" }, ++ { "PBNDKB", ++ "64" }, ++ { "UINTR", ++ "64" }, ++ { "PREFETCHI", ++ "64" }, ++ { "CMPCCXADD", ++ "64" }, ++ { "MSRLIST", ++ "64" }, ++ { "USER_MSR", ++ "64" }, ++ { "APX_F", ++ "XSAVE|64" }, + }; + + /* This array is populated as process_i386_initializers() walks cpu_flags[]. */ +@@ -380,6 +400,8 @@ static bitfield cpu_flags[] = + BITFIELD (RAO_INT), + BITFIELD (FRED), + BITFIELD (LKGS), ++ BITFIELD (USER_MSR), ++ BITFIELD (APX_F), + BITFIELD (MWAITX), + BITFIELD (CLZERO), + BITFIELD (OSPKE), +@@ -463,12 +485,12 @@ static bitfield opcode_modifiers[] = + BITFIELD (StaticRounding), + BITFIELD (SAE), + BITFIELD (Disp8MemShift), +- BITFIELD (Vsz), + BITFIELD (Optimize), +- BITFIELD (ATTMnemonic), +- BITFIELD (ATTSyntax), +- BITFIELD (IntelSyntax), ++ BITFIELD (Dialect), + BITFIELD (ISA64), ++ BITFIELD (NoEgpr), ++ BITFIELD (NF), ++ BITFIELD (Rex2), + }; + + #define CLASS(n) #n, n +@@ -587,7 +609,7 @@ static void + process_copyright (FILE *fp) + { + fprintf (fp, "/* This file is automatically generated by i386-gen. Do not edit! */\n\ +-/* Copyright (C) 2007-2023 Free Software Foundation, Inc.\n\ ++/* Copyright (C) 2007-2024 Free Software Foundation, Inc.\n\ + \n\ + This file is part of the GNU opcodes library.\n\ + \n\ +@@ -771,8 +793,10 @@ add_isa_dependencies (bitfield *flags, const char *f, int value, + } + free (deps); + +- /* ISA extensions with dependencies need CPU_ANY_*_FLAGS emitted. */ +- if (reverse < ARRAY_SIZE (isa_reverse_deps[0])) ++ /* ISA extensions with dependencies need CPU_ANY_*_FLAGS emitted, ++ unless the sole dependency is the "64-bit mode only" one. */ ++ if (reverse < ARRAY_SIZE (isa_reverse_deps[0]) ++ && strcmp (isa_dependencies[i].deps, "64")) + isa_reverse_deps[reverse][reverse] = 1; + + is_avx = orig_is_avx; +@@ -787,15 +811,16 @@ add_isa_dependencies (bitfield *flags, const char *f, int value, + + static void + output_cpu_flags (FILE *table, bitfield *flags, unsigned int size, +- int macro, const char *comma, const char *indent, int lineno) ++ int mode, const char *comma, const char *indent, int lineno) + { + unsigned int i = 0, j = 0; + +- memset (&active_cpu_flags, 0, sizeof(active_cpu_flags)); ++ if (mode < 0) ++ memset (&active_cpu_flags, 0, sizeof(active_cpu_flags)); + + fprintf (table, "%s{ { ", indent); + +- if (!macro) ++ if (mode <= 0) + { + for (j = ~0u; i < CpuAttrEnums; i++) + { +@@ -806,7 +831,8 @@ output_cpu_flags (FILE *table, bitfield *flags, unsigned int size, + fail ("%s: %d: invalid combination of CPU identifiers\n", + filename, lineno); + j = i; +- active_cpu_flags.array[i / 32] |= 1U << (i % 32); ++ if (mode) ++ active_cpu_flags.array[i / 32] |= 1U << (i % 32); + } + + /* Write 0 to indicate "no associated flag". */ +@@ -824,16 +850,25 @@ output_cpu_flags (FILE *table, bitfield *flags, unsigned int size, + if (((j + 1) % 20) == 0) + { + /* We need \\ for macro. */ +- if (macro) ++ if (mode > 0) + fprintf (table, " \\\n %s", indent); + else + fprintf (table, "\n %s", indent); + } +- if (flags[i].value) ++ if (mode < 0 && flags[i].value) + active_cpu_flags.array[i / 32] |= 1U << (i % 32); + } + +- fprintf (table, "%d } }%s\n", flags[i].value, comma); ++#if defined(CpuAttrUnused) != defined(CpuUnused) ++ if (mode <= 0) ++# ifdef CpuUnused ++ fprintf (table, " } }%s\n", comma); ++# else ++ fprintf (table, "%d, 0 } }%s\n", flags[i].value, comma); ++# endif ++ else ++#endif ++ fprintf (table, "%d } }%s\n", flags[i].value, comma); + } + + static void +@@ -846,15 +881,17 @@ process_i386_cpu_flag (FILE *table, char *flag, + unsigned int i; + int value = 1; + bool is_isa = false; +- bitfield flags [ARRAY_SIZE (cpu_flags)]; ++ bitfield all [ARRAY_SIZE (cpu_flags)]; ++ bitfield any [ARRAY_SIZE (cpu_flags)]; + + /* Copy the default cpu flags. */ +- memcpy (flags, cpu_flags, sizeof (cpu_flags)); ++ memcpy (all, cpu_flags, sizeof (cpu_flags)); ++ memcpy (any, cpu_flags, sizeof (cpu_flags)); + + if (flag == NULL) + { + for (i = 0; i < ARRAY_SIZE (isa_reverse_deps[0]); ++i) +- flags[i].value = isa_reverse_deps[reverse][i]; ++ any[i].value = isa_reverse_deps[reverse][i]; + goto output; + } + +@@ -876,9 +913,9 @@ process_i386_cpu_flag (FILE *table, char *flag, + + /* First we turn on everything except for cpuno64 and - if + present - the padding field. */ +- for (i = 0; i < ARRAY_SIZE (flags); i++) +- if (flags[i].position < CpuNo64) +- flags[i].value = 1; ++ for (i = 0; i < ARRAY_SIZE (any); i++) ++ if (any[i].position < CpuNo64) ++ any[i].value = 1; + + /* Turn off selective bits. */ + value = 0; +@@ -886,10 +923,10 @@ process_i386_cpu_flag (FILE *table, char *flag, + + if (name != NULL && value != 0) + { +- for (i = 0; i < ARRAY_SIZE (flags); i++) +- if (strcasecmp (flags[i].name, name) == 0) ++ for (i = 0; i < ARRAY_SIZE (any); i++) ++ if (strcasecmp (any[i].name, name) == 0) + { +- add_isa_dependencies (flags, name, 1, reverse); ++ add_isa_dependencies (any, name, 1, reverse); + is_isa = true; + break; + } +@@ -897,18 +934,40 @@ process_i386_cpu_flag (FILE *table, char *flag, + + if (strcmp (flag, "0")) + { ++ bool combined = false; ++ + if (is_isa) + return; + + /* Turn on/off selective bits. */ + last = flag + strlen (flag); ++ if (name == NULL && strchr (flag, '&')) ++ { ++ for (; next < last && *next != '('; ) ++ { ++ str = next_field (next, '&', &next, last); ++ set_bitfield (str, all, value, ARRAY_SIZE (all), lineno); ++ } ++ if (*next == '(') ++ { ++ if (*--last != ')') ++ fail ("%s: %d: missing `)' in bitfield: %s\n", filename, ++ lineno, flag); ++ ++next; ++ *last = '\0'; ++ } ++ combined = true; ++ } + for (; next && next < last; ) + { + str = next_field (next, '|', &next, last); +- if (name == NULL) +- set_bitfield (str, flags, value, ARRAY_SIZE (flags), lineno); +- else +- add_isa_dependencies (flags, str, value, reverse); ++ if (name) ++ add_isa_dependencies (any, str, value, reverse); ++ else if (combined || next < last) ++ set_bitfield (str, any, value, ARRAY_SIZE (any), lineno); ++ else /* Singular specifiers go into "all". */ ++ set_bitfield (str, all, value, ARRAY_SIZE (all), lineno); ++ combined = true; + } + } + +@@ -918,6 +977,15 @@ process_i386_cpu_flag (FILE *table, char *flag, + size_t len = strlen (name); + char *upper = xmalloc (len + 1); + ++ /* Cpu64 is special: It specifies a mode dependency, not an ISA one. Zap ++ the flag from ISA initializer macros (and from CPU_ANY_64_FLAGS ++ itself we only care about tracking its dependents. Also don't emit the ++ (otherwise all zero) CPU_64_FLAGS. */ ++ if (flag != NULL && reverse == Cpu64) ++ return; ++ if (is_isa || flag == NULL) ++ any[Cpu64].value = 0; ++ + for (i = 0; i < len; ++i) + { + /* Don't emit #define-s for auxiliary entries. */ +@@ -930,8 +998,18 @@ process_i386_cpu_flag (FILE *table, char *flag, + flag != NULL ? "": "ANY_", upper); + free (upper); + } ++ else ++ { ++ /* Synthesize "64-bit mode only" dependencies from the dependencies we ++ have accumulated. */ ++ for (i = 0; i < ARRAY_SIZE (isa_reverse_deps[0]); ++i) ++ if (all[i].value && isa_reverse_deps[Cpu64][i]) ++ all[Cpu64].value = 1; ++ ++ output_cpu_flags(table, all, ARRAY_SIZE (all), -1, comma, indent, lineno); ++ } + +- output_cpu_flags (table, flags, ARRAY_SIZE (flags), name != NULL, ++ output_cpu_flags (table, any, ARRAY_SIZE (any), name != NULL, + comma, indent, lineno); + } + +@@ -1008,10 +1086,44 @@ get_element_size (char **opnd, int lineno) + return elem_size; + } + ++static bool ++rex2_disallowed (const unsigned long long opcode, unsigned int length, ++ unsigned int space, const char *cpu_flags) ++{ ++ /* Some opcodes encode a ModR/M-like byte directly in the opcode. */ ++ unsigned int base_opcode = opcode >> (8 * length - 8); ++ ++ /* All opcodes listed map0 0x4*, 0x7*, 0xa*, 0xe* and map1 0x3*, 0x8* ++ are reserved under REX2 and triggers #UD when prefixed with REX2 */ ++ if (space == 0) ++ switch (base_opcode >> 4) ++ { ++ case 0x4: ++ case 0x7: ++ case 0xA: ++ case 0xE: ++ return true; ++ default: ++ return false; ++ } ++ ++ if (space == SPACE_0F) ++ switch (base_opcode >> 4) ++ { ++ case 0x3: ++ case 0x8: ++ return true; ++ default: ++ return false; ++ } ++ ++ return false; ++} ++ + static void + process_i386_opcode_modifier (FILE *table, char *mod, unsigned int space, + unsigned int prefix, const char *extension_opcode, +- char **opnd, int lineno) ++ char **opnd, int lineno, bool rex2_disallowed) + { + char *str, *next, *last; + bitfield modifiers [ARRAY_SIZE (opcode_modifiers)]; +@@ -1021,8 +1133,10 @@ process_i386_opcode_modifier (FILE *table, char *mod, unsigned int space, + SPACE(0F), + SPACE(0F38), + SPACE(0F3A), ++ SPACE(EVEXMAP4), + SPACE(EVEXMAP5), + SPACE(EVEXMAP6), ++ SPACE(VEXMAP7), + SPACE(XOP08), + SPACE(XOP09), + SPACE(XOP0A), +@@ -1127,6 +1241,22 @@ process_i386_opcode_modifier (FILE *table, char *mod, unsigned int space, + fprintf (table, " SPACE_%s, %s,\n", + spaces[space], extension_opcode ? extension_opcode : "None"); + ++ /* Rather than evaluating multiple conditions at runtime to determine ++ whether an EVEX encoding is being dealt with, derive that information ++ right here. A missing EVex attribute means "dynamic". */ ++ if (!modifiers[EVex].value ++ && (modifiers[Disp8MemShift].value ++ || modifiers[Broadcast].value ++ || modifiers[Masking].value ++ || modifiers[SAE].value)) ++ modifiers[EVex].value = EVEXDYN; ++ ++ /* Vex, legacy map2 and map3 and rex2_disallowed do not support EGPR. ++ For templates supporting both Vex and EVex allowing EGPR. */ ++ if ((modifiers[Vex].value || space > SPACE_0F || rex2_disallowed) ++ && !modifiers[EVex].value) ++ modifiers[NoEgpr].value = 1; ++ + output_opcode_modifier (table, modifiers, ARRAY_SIZE (modifiers)); + } + +@@ -1351,7 +1481,9 @@ output_i386_opcode (FILE *table, const char *name, char *str, + free (ident); + + process_i386_opcode_modifier (table, opcode_modifier, space, prefix, +- extension_opcode, operand_types, lineno); ++ extension_opcode, operand_types, lineno, ++ rex2_disallowed (opcode, length, space, ++ cpu_flags)); + + process_i386_cpu_flag (table, cpu_flags, NULL, ",", " ", lineno, CpuMax); + +@@ -1406,10 +1538,10 @@ opcode_hash_eq (const void *p, const void *q) + return strcmp (name, entry->name) == 0; + } + +-static void ++static bool + parse_template (char *buf, int lineno) + { +- char sep, *end, *name; ++ char sep, *end, *ptr; + struct template *tmpl; + struct template_instance *last_inst = NULL; + +@@ -1436,8 +1568,16 @@ parse_template (char *buf, int lineno) + prev->next = tmpl->next; + else + templates = tmpl->next; +- return; ++ return true; + } ++ ++ /* Check whether this actually is a reference to an existing template: ++ If there's '>' ahead of ':', it can't be a new template definition ++ (and template undefs have are dealt with above). */ ++ ptr = strchr (buf, '>'); ++ if (ptr != NULL && ptr < end) ++ return false; ++ + *end++ = '\0'; + remove_trailing_whitespaces (buf); + +@@ -1512,6 +1652,8 @@ parse_template (char *buf, int lineno) + + tmpl->next = templates; + templates = tmpl; ++ ++ return true; + } + + static unsigned int +@@ -1768,10 +1910,12 @@ process_i386_opcodes (FILE *table) + /* Ignore comments. */ + case '\0': + continue; +- break; ++ + case '<': +- parse_template (p, lineno); +- continue; ++ if (parse_template (p, lineno)) ++ continue; ++ break; ++ + default: + if (!marker) + continue; +@@ -1808,23 +1952,26 @@ process_i386_opcodes (FILE *table) + + /* Generate opcode sets array. */ + fprintf (table, "\n/* i386 opcode sets table. */\n\n"); +- fprintf (table, "static const insn_template *const i386_op_sets[] =\n{\n"); +- fprintf (table, " i386_optab,\n"); ++ fprintf (table, "typedef unsigned short i386_op_off_t;\n"); ++ fprintf (table, "static const i386_op_off_t i386_op_sets[] =\n{\n "); + + for (nr = j = 0; j < i; j++) + { + struct opcode_entry *next = &opcode_array[j]->entry; + ++ if ((j + 1) % 8 != 0) ++ fprintf (table, "%5u,", nr); ++ else ++ fprintf (table, "%5u,\n ", nr); + do + { + ++nr; + next = next->next; + } + while (next); +- fprintf (table, " i386_optab + %u,\n", nr); + } + +- fprintf (table, "};\n"); ++ fprintf (table, "%5u\n};\n", nr); + + /* Emit mnemonics and associated #define-s. */ + qsort (opcode_array, i, sizeof (*opcode_array), mnemonic_cmp); +@@ -2140,6 +2287,8 @@ main (int argc, char **argv) + qsort (operand_types, ARRAY_SIZE (operand_types), + sizeof (operand_types [0]), compare); + ++ process_i386_initializers (); ++ + table = fopen ("i386-tbl.h", "w"); + if (table == NULL) + fail ("can't create i386-tbl.h, errno = %s\n", +@@ -2149,7 +2298,6 @@ main (int argc, char **argv) + + process_i386_opcodes (table); + process_i386_registers (table); +- process_i386_initializers (); + + fclose (table); + +diff --git a/opcodes/i386-init.h b/opcodes/i386-init.h +--- a/opcodes/i386-init.h ++++ b/opcodes/i386-init.h +@@ -1,5 +1,5 @@ + /* This file is automatically generated by i386-gen. Do not edit! */ +-/* Copyright (C) 2007-2023 Free Software Foundation, Inc. ++/* Copyright (C) 2007-2024 Free Software Foundation, Inc. + + This file is part of the GNU opcodes library. + +@@ -26,7 +26,7 @@ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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, 0, 0, 0, 0, \ +@@ -2536,5 +2566,15 @@ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ +- 0, 1, 0, 0 } } ++ 0, 0, 1, 0, 0, 0 } } ++ ++#define CPU_ANY_APX_F_FLAGS \ ++ { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ ++ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ ++ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ ++ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ ++ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ ++ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ ++ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ ++ 0, 0, 0, 1, 0, 0 } } + +diff --git a/opcodes/i386-opc.tbl b/opcodes/i386-opc.tbl +--- a/opcodes/i386-opc.tbl ++++ b/opcodes/i386-opc.tbl +@@ -1,5 +1,5 @@ + // i386 opcode table. +-// Copyright (C) 2007-2023 Free Software Foundation, Inc. ++// Copyright (C) 2007-2024 Free Software Foundation, Inc. + // + // This file is part of the GNU opcodes library. + // +@@ -85,6 +85,11 @@ + #define RegKludge OperandConstraint=REG_KLUDGE + #define SwapSources OperandConstraint=SWAP_SOURCES + #define Ugh OperandConstraint=UGH ++#define ImplicitStackOp OperandConstraint=IMPLICIT_STACK_OP ++ ++#define ATTSyntax Dialect=ATT_SYNTAX ++#define ATTMnemonic Dialect=ATT_MNEMONIC ++#define IntelSyntax Dialect=INTEL_SYNTAX + + #define IgnoreSize MnemonicSize=IGNORESIZE + #define DefaultSize MnemonicSize=DEFAULTSIZE +@@ -109,9 +114,12 @@ + #define SpaceXOP09 OpcodeSpace=SPACE_XOP09 + #define SpaceXOP0A OpcodeSpace=SPACE_XOP0A + ++#define EVexMap4 OpcodeSpace=SPACE_EVEXMAP4|EVex128 + #define EVexMap5 OpcodeSpace=SPACE_EVEXMAP5 + #define EVexMap6 OpcodeSpace=SPACE_EVEXMAP6 + ++#define VexMap7 OpcodeSpace=SPACE_VEXMAP7 ++ + #define VexW0 VexW=VEXW0 + #define VexW1 VexW=VEXW1 + #define VexWIG VexW=VEXWIG +@@ -133,12 +141,22 @@ + + #define Disp8ShiftVL Disp8MemShift=DISP8_SHIFT_VL + +-#define Vsz256 Vsz=VSZ256 +-#define Vsz512 Vsz=VSZ512 ++#define DstVVVV VexVVVV=VexVVVV_DST ++ ++// The template supports VEX format for cpuid and EVEX format for cpuid & APX_F. ++// While therefore we really mean cpuid|(cpuid&APX_F) here, this can't be ++// expressed in the generated templates. It's equivalent to just cpuid|APX_F ++// anyway, but that is not what we want (as APX_F alone isn't a sufficient ++// prereq for such insns). Instead the assembler will massage the CPU specifier ++// to the equivalent of either cpuid&(cpuid) or cpuid&(APX_F) (or something ++// substantially similar), depending on what encoding was requested. ++#define APX_F(cpuid) cpuid&(cpuid|APX_F) + + // The EVEX purpose of StaticRounding appears only together with SAE. Re-use + // the bit to mark commutative VEX encodings where swapping the source + // operands may allow to switch from 3-byte to 2-byte VEX encoding. ++// And re-use the bit to mark some NDD insns that swapping the source operands ++// may allow to switch from EVEX encoding to REX2 encoding. + #define C StaticRounding + + #define FP 387|287|8087 +@@ -156,6 +174,8 @@ + #define i287 287 + #define i387 387 + #define i687 687 ++// Note: Don't add this one to any templates already specifying a 64-bit-mode- ++// only ISA extension: i386-gen takes care of adding such dependencies. + #define x64 64 + + ### MARKER ### +@@ -164,11 +184,11 @@ + mov, 0xa0, No64, D|W|CheckOperandSize|No_sSuf|No_qSuf, { Disp16|Disp32|Unspecified|Byte|Word|Dword, Acc|Byte|Word|Dword } + mov, 0xa0, x64, D|W|CheckOperandSize|No_sSuf, { Disp64|Unspecified|Byte|Word|Dword|Qword, Acc|Byte|Word|Dword|Qword } + movabs, 0xa0, x64, D|W|CheckOperandSize|No_sSuf, { Disp64|Unspecified|Byte|Word|Dword|Qword, Acc|Byte|Word|Dword|Qword } +-mov, 0x88, 0, D|W|CheckOperandSize|Modrm|No_sSuf|HLEPrefixRelease, { Reg8|Reg16|Reg32|Reg64, Reg8|Reg16|Reg32|Reg64|Byte|Word|Dword|Qword|Unspecified|BaseIndex } ++mov, 0x88, 0, D|W|CheckOperandSize|Modrm|No_sSuf|HLEPrefixRelease, { Reg8|Reg16|Reg32|Reg64, Reg8|Reg16|Reg32|Reg64|Unspecified|BaseIndex } + // In the 64bit mode the short form mov immediate is redefined to have + // 64bit value. + mov, 0xb0, 0, W|No_sSuf|No_qSuf, { Imm8|Imm16|Imm32|Imm32S, Reg8|Reg16|Reg32 } +-mov, 0xc6/0, 0, W|Modrm|No_sSuf|HLEPrefixRelease|Optimize, { Imm8|Imm16|Imm32|Imm32S, Reg8|Reg16|Reg32|Reg64|Byte|Word|Dword|Qword|Unspecified|BaseIndex } ++mov, 0xc6/0, 0, W|Modrm|No_sSuf|HLEPrefixRelease|Optimize, { Imm8|Imm16|Imm32|Imm32S, Reg8|Reg16|Reg32|Reg64|Unspecified|BaseIndex } + mov, 0xb8, x64, No_bSuf|No_wSuf|No_lSuf|No_sSuf|Optimize, { Imm64, Reg64 } + movabs, 0xb8, x64, No_bSuf|No_wSuf|No_lSuf|No_sSuf, { Imm64, Reg64 } + // The segment register moves accept WordReg so that a segment register +@@ -181,14 +201,18 @@ mov, 0x8c, 0, D|Modrm|IgnoreSize|No_bSuf|No_lSuf|No_sSuf|No_qSuf, { SReg, Word|U + mov, 0x8e, 0, Modrm|IgnoreSize|No_bSuf|No_sSuf|NoRex64, { Reg16|Reg32|Reg64, SReg } + // Move to/from control debug registers. In the 16 or 32bit modes + // they are 32bit. In the 64bit mode they are 64bit. +-mov, 0xf20, i386|No64, D|RegMem|IgnoreSize|No_bSuf|No_wSuf|No_sSuf|No_qSuf, { Control, Reg32 } ++mov, 0xf20, i386&No64, D|RegMem|IgnoreSize|No_bSuf|No_wSuf|No_sSuf|No_qSuf, { Control, Reg32 } + mov, 0xf20, x64, D|RegMem|No_bSuf|No_wSuf|No_lSuf|No_sSuf|NoRex64, { Control, Reg64 } +-mov, 0xf21, i386|No64, D|RegMem|IgnoreSize|No_bSuf|No_wSuf|No_sSuf|No_qSuf, { Debug, Reg32 } ++mov, 0xf21, i386&No64, D|RegMem|IgnoreSize|No_bSuf|No_wSuf|No_sSuf|No_qSuf, { Debug, Reg32 } + mov, 0xf21, x64, D|RegMem|No_bSuf|No_wSuf|No_lSuf|No_sSuf|NoRex64, { Debug, Reg64 } +-mov, 0xf24, i386|No64, D|RegMem|IgnoreSize|No_bSuf|No_wSuf|No_sSuf|No_qSuf, { Test, Reg32 } ++mov, 0xf24, i386&No64, D|RegMem|IgnoreSize|No_bSuf|No_wSuf|No_sSuf|No_qSuf, { Test, Reg32 } + + // Move after swapping the bytes + movbe, 0x0f38f0, Movbe, D|Modrm|CheckOperandSize|No_bSuf|No_sSuf, { Word|Dword|Qword|Unspecified|BaseIndex, Reg16|Reg32|Reg64 } ++movbe, 0x60, Movbe&APX_F, D|Modrm|CheckOperandSize|No_bSuf|No_sSuf|EVexMap4, { Reg16|Reg32|Reg64|Unspecified|BaseIndex, Reg16|Reg32|Reg64 } ++// This needs to live here for easy EVEX -> REX2 conversion, which wants to ++// restart with the next sequential template. ++bswap, 0xfc8, i486, No_bSuf|No_wSuf|No_sSuf, { Reg32|Reg64 } + + // Move with sign extend. + movsb, 0xfbe, i386, Modrm|No_bSuf|No_sSuf, { Reg8|Unspecified|BaseIndex, Reg16|Reg32|Reg64 } +@@ -201,37 +225,39 @@ movsxd, 0x63, x64, Amd64|Modrm|NoSuf, { Reg32|Unspecified|BaseIndex, Reg16 } + movsxd, 0x63, x64, Intel64|Modrm|NoSuf, { Reg16|Unspecified|BaseIndex, Reg16 } + + // Move with zero extend. +-movzb, 0xfb6, i386, Modrm|No_bSuf|No_sSuf, { Reg8|Byte|Unspecified|BaseIndex, Reg16|Reg32|Reg64 } +-movzw, 0xfb7, i386, Modrm|No_bSuf|No_wSuf|No_sSuf, { Reg16|Word|Unspecified|BaseIndex, Reg32|Reg64 } ++movzb, 0xfb6, i386, Modrm|No_bSuf|No_sSuf, { Reg8|Unspecified|BaseIndex, Reg16|Reg32|Reg64 } ++movzw, 0xfb7, i386, Modrm|No_bSuf|No_wSuf|No_sSuf, { Reg16|Unspecified|BaseIndex, Reg32|Reg64 } + // The 64-bit variant is not particularly useful since the zero extend + // 32->64 is implicit, but we can encode them. + movzx, 0xfb6, i386, W|Modrm|No_lSuf|No_sSuf|No_qSuf, { Reg8|Reg16|Unspecified|BaseIndex, Reg16|Reg32|Reg64 } + + // Push instructions. +-push, 0x50, No64, No_bSuf|No_sSuf|No_qSuf, { Reg16|Reg32 } +-push, 0xff/6, No64, Modrm|DefaultSize|No_bSuf|No_sSuf|No_qSuf, { Reg16|Reg32|Word|Dword|Unspecified|BaseIndex } +-push, 0x6a, i186|No64, DefaultSize|No_bSuf|No_sSuf|No_qSuf, { Imm8S } +-push, 0x68, i186|No64, DefaultSize|No_bSuf|No_sSuf|No_qSuf, { Imm16|Imm32 } +-push, 0x6, No64, DefaultSize|No_bSuf|No_sSuf|No_qSuf, { SReg } ++push, 0x50, No64, ImplicitStackOp|No_bSuf|No_sSuf|No_qSuf, { Reg16|Reg32 } ++push, 0xff/6, No64, Modrm|ImplicitStackOp|DefaultSize|No_bSuf|No_sSuf|No_qSuf, { Reg16|Reg32|Unspecified|BaseIndex } ++push, 0x6a, i186&No64, ImplicitStackOp|DefaultSize|No_bSuf|No_sSuf|No_qSuf, { Imm8S } ++push, 0x68, i186&No64, ImplicitStackOp|DefaultSize|No_bSuf|No_sSuf|No_qSuf, { Imm16|Imm32 } ++push, 0x6, No64, ImplicitStackOp|DefaultSize|No_bSuf|No_sSuf|No_qSuf, { SReg } + // In 64bit mode, the operand size is implicitly 64bit. +-push, 0x50, x64, No_bSuf|No_lSuf|No_sSuf|NoRex64, { Reg16|Reg64 } +-push, 0xff/6, x64, Modrm|DefaultSize|No_bSuf|No_lSuf|No_sSuf|NoRex64, { Reg16|Reg64|Word|Qword|Unspecified|BaseIndex } +-push, 0x6a, x64, DefaultSize|No_bSuf|No_lSuf|No_sSuf|NoRex64, { Imm8S } +-push, 0x68, x64, DefaultSize|No_bSuf|No_lSuf|No_sSuf|NoRex64, { Imm16|Imm32S } +-push, 0xfa0, x64, DefaultSize|No_bSuf|No_lSuf|No_sSuf|NoRex64, { SReg } ++push, 0x50, x64, ImplicitStackOp|No_bSuf|No_lSuf|No_sSuf|NoRex64, { Reg16|Reg64 } ++pushp, 0x50, APX_F, ImplicitStackOp|No_bSuf|No_wSuf|No_lSuf|No_sSuf|Rex2, { Reg64 } ++push, 0xff/6, x64, Modrm|ImplicitStackOp|DefaultSize|No_bSuf|No_lSuf|No_sSuf|NoRex64, { Reg16|Reg64|Unspecified|BaseIndex } ++push, 0x6a, x64, ImplicitStackOp|DefaultSize|No_bSuf|No_lSuf|No_sSuf|NoRex64, { Imm8S } ++push, 0x68, x64, ImplicitStackOp|DefaultSize|No_bSuf|No_lSuf|No_sSuf|NoRex64, { Imm16|Imm32S } ++push, 0xfa0, x64, ImplicitStackOp|DefaultSize|No_bSuf|No_lSuf|No_sSuf|NoRex64, { SReg } + +-pusha, 0x60, i186|No64, DefaultSize|No_bSuf|No_sSuf|No_qSuf, {} ++pusha, 0x60, i186&No64, ImplicitStackOp|DefaultSize|No_bSuf|No_sSuf|No_qSuf, {} + + // Pop instructions. +-pop, 0x58, No64, No_bSuf|No_sSuf|No_qSuf, { Reg16|Reg32 } +-pop, 0x8f/0, No64, Modrm|DefaultSize|No_bSuf|No_sSuf|No_qSuf, { Reg16|Reg32|Word|Dword|Unspecified|BaseIndex } +-pop, 0x7, No64, DefaultSize|No_bSuf|No_sSuf|No_qSuf, { SReg } ++pop, 0x58, No64, ImplicitStackOp|No_bSuf|No_sSuf|No_qSuf, { Reg16|Reg32 } ++pop, 0x8f/0, No64, Modrm|ImplicitStackOp|DefaultSize|No_bSuf|No_sSuf|No_qSuf, { Reg16|Reg32|Unspecified|BaseIndex } ++pop, 0x7, No64, ImplicitStackOp|DefaultSize|No_bSuf|No_sSuf|No_qSuf, { SReg } + // In 64bit mode, the operand size is implicitly 64bit. +-pop, 0x58, x64, No_bSuf|No_lSuf|No_sSuf|NoRex64, { Reg16|Reg64 } +-pop, 0x8f/0, x64, Modrm|DefaultSize|No_bSuf|No_lSuf|No_sSuf|NoRex64, { Reg16|Reg64|Word|Qword|Unspecified|BaseIndex } +-pop, 0xfa1, x64, DefaultSize|No_bSuf|No_lSuf|No_sSuf|NoRex64, { SReg } ++pop, 0x58, x64, ImplicitStackOp|No_bSuf|No_lSuf|No_sSuf|NoRex64, { Reg16|Reg64 } ++popp, 0x58, APX_F, ImplicitStackOp|No_bSuf|No_wSuf|No_lSuf|No_sSuf|Rex2, { Reg64 } ++pop, 0x8f/0, x64, Modrm|ImplicitStackOp|DefaultSize|No_bSuf|No_lSuf|No_sSuf|NoRex64, { Reg16|Reg64|Unspecified|BaseIndex } ++pop, 0xfa1, x64, ImplicitStackOp|DefaultSize|No_bSuf|No_lSuf|No_sSuf|NoRex64, { SReg } + +-popa, 0x61, i186|No64, DefaultSize|No_bSuf|No_sSuf|No_qSuf, {} ++popa, 0x61, i186&No64, ImplicitStackOp|DefaultSize|No_bSuf|No_sSuf|No_qSuf, {} + + // Exchange instructions. + // xchg commutes: we allow both operand orders. +@@ -273,70 +299,67 @@ lahf, 0x9f, No64, NoSuf, {} + lahf, 0x9f, LAHF_SAHF, NoSuf, {} + sahf, 0x9e, No64, NoSuf, {} + sahf, 0x9e, LAHF_SAHF, NoSuf, {} +-pushf, 0x9c, No64, DefaultSize|No_bSuf|No_sSuf|No_qSuf, {} +-pushf, 0x9c, x64, DefaultSize|No_bSuf|No_lSuf|No_sSuf|NoRex64, {} +-popf, 0x9d, No64, DefaultSize|No_bSuf|No_sSuf|No_qSuf, {} +-popf, 0x9d, x64, DefaultSize|No_bSuf|No_lSuf|No_sSuf|NoRex64, {} ++pushf, 0x9c, No64, ImplicitStackOp|DefaultSize|No_bSuf|No_sSuf|No_qSuf, {} ++pushf, 0x9c, x64, ImplicitStackOp|DefaultSize|No_bSuf|No_lSuf|No_sSuf|NoRex64, {} ++popf, 0x9d, No64, ImplicitStackOp|DefaultSize|No_bSuf|No_sSuf|No_qSuf, {} ++popf, 0x9d, x64, ImplicitStackOp|DefaultSize|No_bSuf|No_lSuf|No_sSuf|NoRex64, {} + stc, 0xf9, 0, NoSuf, {} + std, 0xfd, 0, NoSuf, {} + sti, 0xfb, 0, NoSuf, {} + + // Arithmetic. +-add, 0x0, 0, D|W|CheckOperandSize|Modrm|No_sSuf|HLEPrefixLock, { Reg8|Reg16|Reg32|Reg64, Reg8|Reg16|Reg32|Reg64|Byte|Word|Dword|Qword|Unspecified|BaseIndex } +-add, 0x83/0, 0, Modrm|No_bSuf|No_sSuf|HLEPrefixLock, { Imm8S, Reg16|Reg32|Reg64|Word|Dword|Qword|Unspecified|BaseIndex } +-add, 0x4, 0, W|No_sSuf, { Imm8|Imm16|Imm32|Imm32S, Acc|Byte|Word|Dword|Qword } +-add, 0x80/0, 0, W|Modrm|No_sSuf|HLEPrefixLock, { Imm8|Imm16|Imm32|Imm32S, Reg8|Reg16|Reg32|Reg64|Byte|Word|Dword|Qword|Unspecified|BaseIndex } +- +-inc, 0x40, No64, No_bSuf|No_sSuf|No_qSuf, { Reg16|Reg32 } +-inc, 0xfe/0, 0, W|Modrm|No_sSuf|HLEPrefixLock, { Reg8|Reg16|Reg32|Reg64|Byte|Word|Dword|Qword|Unspecified|BaseIndex } + +-sub, 0x28, 0, D|W|CheckOperandSize|Modrm|No_sSuf|HLEPrefixLock|Optimize, { Reg8|Reg16|Reg32|Reg64, Reg8|Reg16|Reg32|Reg64|Byte|Word|Dword|Qword|Unspecified|BaseIndex } +-sub, 0x83/5, 0, Modrm|No_bSuf|No_sSuf|HLEPrefixLock, { Imm8S, Reg16|Reg32|Reg64|Word|Dword|Qword|Unspecified|BaseIndex } +-sub, 0x2c, 0, W|No_sSuf, { Imm8|Imm16|Imm32|Imm32S, Acc|Byte|Word|Dword|Qword } +-sub, 0x80/5, 0, W|Modrm|No_sSuf|HLEPrefixLock, { Imm8|Imm16|Imm32|Imm32S, Reg8|Reg16|Reg32|Reg64|Byte|Word|Dword|Qword|Unspecified|BaseIndex } ++ ++ ++, << 3, APX_F, D||W|CheckOperandSize|Modrm|No_sSuf|DstVVVV|EVexMap4||, { Reg8|Reg16|Reg32|Reg64, Reg8|Reg16|Reg32|Reg64|Unspecified|BaseIndex, Reg8|Reg16|Reg32|Reg64 } ++, << 3, 0, D|W|CheckOperandSize|Modrm|No_sSuf|HLEPrefixLock||, { Reg8|Reg16|Reg32|Reg64, Reg8|Reg16|Reg32|Reg64|Unspecified|BaseIndex } ++, << 3, APX_F, D|W|CheckOperandSize|Modrm|No_sSuf|EVexMap4|, { Reg8|Reg16|Reg32|Reg64, Reg8|Reg16|Reg32|Reg64|Unspecified|BaseIndex } ++, 0x83/, APX_F, Modrm|CheckOperandSize|No_bSuf|No_sSuf|DstVVVV|EVexMap4|, { Imm8S, Reg16|Reg32|Reg64|Unspecified|BaseIndex, Reg16|Reg32|Reg64 } ++, 0x83/, 0, Modrm|No_bSuf|No_sSuf|HLEPrefixLock|, { Imm8S, Reg16|Reg32|Reg64|Unspecified|BaseIndex } ++, 0x83/, 0, Modrm|No_bSuf|No_sSuf|EVexMap4|, { Imm8S, Reg16|Reg32|Reg64|Unspecified|BaseIndex } ++, 0x04 | ( << 3), 0, W|No_sSuf|, { Imm8|Imm16|Imm32|Imm32S, Acc|Byte|Word|Dword|Qword } ++, 0x80/, APX_F, W|Modrm|CheckOperandSize|No_sSuf|DstVVVV|EVexMap4|, { Imm8|Imm16|Imm32|Imm32S, Reg8|Reg16|Reg32|Reg64|Unspecified|BaseIndex, Reg8|Reg16|Reg32|Reg64 } ++, 0x80/, 0, W|Modrm|No_sSuf|HLEPrefixLock|, { Imm8|Imm16|Imm32|Imm32S, Reg8|Reg16|Reg32|Reg64|Unspecified|BaseIndex } ++, 0x80/, APX_F, W|Modrm|EVexMap4|No_sSuf|, { Imm8|Imm16|Imm32|Imm32S, Reg8|Reg16|Reg32|Reg64|Unspecified|BaseIndex } ++ ++ + +-dec, 0x48, No64, No_bSuf|No_sSuf|No_qSuf, { Reg16|Reg32 } +-dec, 0xfe/1, 0, W|Modrm|No_sSuf|HLEPrefixLock, { Reg8|Reg16|Reg32|Reg64|Byte|Word|Dword|Qword|Unspecified|BaseIndex } +- +-sbb, 0x18, 0, D|W|CheckOperandSize|Modrm|No_sSuf|HLEPrefixLock, { Reg8|Reg16|Reg32|Reg64, Reg8|Reg16|Reg32|Reg64|Byte|Word|Dword|Qword|Unspecified|BaseIndex } +-sbb, 0x83/3, 0, Modrm|No_bSuf|No_sSuf|HLEPrefixLock, { Imm8S, Reg16|Reg32|Reg64|Word|Dword|Qword|Unspecified|BaseIndex } +-sbb, 0x1c, 0, W|No_sSuf, { Imm8|Imm16|Imm32|Imm32S, Acc|Byte|Word|Dword|Qword } +-sbb, 0x80/3, 0, W|Modrm|No_sSuf|HLEPrefixLock, { Imm8|Imm16|Imm32|Imm32S, Reg8|Reg16|Reg32|Reg64|Byte|Word|Dword|Qword|Unspecified|BaseIndex } ++// clr with 1 operand is really xor with 2 operands. ++clr, 0x30, 0, W|Modrm|No_sSuf|RegKludge|Optimize, { Reg8|Reg16|Reg32|Reg64 } ++clr, 0x30, APX_F, W|Modrm|No_sSuf|RegKludge|EVexMap4|NF, { Reg8|Reg16|Reg32|Reg64 } + +-cmp, 0x38, 0, D|W|CheckOperandSize|Modrm|No_sSuf, { Reg8|Reg16|Reg32|Reg64, Reg8|Reg16|Reg32|Reg64|Byte|Word|Dword|Qword|Unspecified|BaseIndex } +-cmp, 0x83/7, 0, Modrm|No_bSuf|No_sSuf, { Imm8S, Reg16|Reg32|Reg64|Word|Dword|Qword|Unspecified|BaseIndex } ++cmp, 0x38, 0, D|W|CheckOperandSize|Modrm|No_sSuf, { Reg8|Reg16|Reg32|Reg64, Reg8|Reg16|Reg32|Reg64|Unspecified|BaseIndex } ++cmp, 0x83/7, 0, Modrm|No_bSuf|No_sSuf, { Imm8S, Reg16|Reg32|Reg64|Unspecified|BaseIndex } + cmp, 0x3c, 0, W|No_sSuf, { Imm8|Imm16|Imm32|Imm32S, Acc|Byte|Word|Dword|Qword } +-cmp, 0x80/7, 0, W|Modrm|No_sSuf, { Imm8|Imm16|Imm32|Imm32S, Reg8|Reg16|Reg32|Reg64|Byte|Word|Dword|Qword|Unspecified|BaseIndex } ++cmp, 0x80/7, 0, W|Modrm|No_sSuf, { Imm8|Imm16|Imm32|Imm32S, Reg8|Reg16|Reg32|Reg64|Unspecified|BaseIndex } + + test, 0x84, 0, D|W|C|CheckOperandSize|Modrm|No_sSuf, { Reg8|Reg16|Reg32|Reg64, Reg8|Reg16|Reg32|Reg64|Unspecified|BaseIndex } + test, 0xa8, 0, W|No_sSuf|Optimize, { Imm8|Imm16|Imm32|Imm32S, Acc|Byte|Word|Dword|Qword } +-test, 0xf6/0, 0, W|Modrm|No_sSuf|Optimize, { Imm8|Imm16|Imm32|Imm32S, Reg8|Reg16|Reg32|Reg64|Byte|Word|Dword|Qword|Unspecified|BaseIndex } ++test, 0xf6/0, 0, W|Modrm|No_sSuf|Optimize, { Imm8|Imm16|Imm32|Imm32S, Reg8|Reg16|Reg32|Reg64|Unspecified|BaseIndex } + +-and, 0x20, 0, D|W|CheckOperandSize|Modrm|No_sSuf|HLEPrefixLock|Optimize, { Reg8|Reg16|Reg32|Reg64, Reg8|Reg16|Reg32|Reg64|Byte|Word|Dword|Qword|Unspecified|BaseIndex } +-and, 0x83/4, 0, Modrm|No_bSuf|No_sSuf|HLEPrefixLock|Optimize, { Imm8S, Reg16|Reg32|Reg64|Word|Dword|Qword|Unspecified|BaseIndex } +-and, 0x24, 0, W|No_sSuf|Optimize, { Imm8|Imm16|Imm32|Imm32S, Acc|Byte|Word|Dword|Qword } +-and, 0x80/4, 0, W|Modrm|No_sSuf|HLEPrefixLock|Optimize, { Imm8|Imm16|Imm32|Imm32S, Reg8|Reg16|Reg32|Reg64|Byte|Word|Dword|Qword|Unspecified|BaseIndex } ++ + +-or, 0x8, 0, D|W|CheckOperandSize|Modrm|No_sSuf|HLEPrefixLock|Optimize, { Reg8|Reg16|Reg32|Reg64, Reg8|Reg16|Reg32|Reg64|Byte|Word|Dword|Qword|Unspecified|BaseIndex } +-or, 0x83/1, 0, Modrm|No_bSuf|No_sSuf|HLEPrefixLock, { Imm8S, Reg16|Reg32|Reg64|Word|Dword|Qword|Unspecified|BaseIndex } +-or, 0xc, 0, W|No_sSuf, { Imm8|Imm16|Imm32|Imm32S, Acc|Byte|Word|Dword|Qword } +-or, 0x80/1, 0, W|Modrm|No_sSuf|HLEPrefixLock, { Imm8|Imm16|Imm32|Imm32S, Reg8|Reg16|Reg32|Reg64|Byte|Word|Dword|Qword|Unspecified|BaseIndex } ++, 0x40 | ( << 3), No64, No_bSuf|No_sSuf|No_qSuf, { Reg16|Reg32 } ++, 0xfe/, APX_F, W|Modrm|No_sSuf|CheckOperandSize|DstVVVV|EVexMap4|NF, {Reg8|Reg16|Reg32|Reg64|Unspecified|BaseIndex, Reg8|Reg16|Reg32|Reg64} ++, 0xfe/, 0, W|Modrm|No_sSuf|HLEPrefixLock, { Reg8|Reg16|Reg32|Reg64|Unspecified|BaseIndex } ++, 0xfe/, APX_F, W|Modrm|No_sSuf|EVexMap4|NF, { Reg8|Reg16|Reg32|Reg64|Unspecified|BaseIndex } + +-xor, 0x30, 0, D|W|CheckOperandSize|Modrm|No_sSuf|HLEPrefixLock|Optimize, { Reg8|Reg16|Reg32|Reg64, Reg8|Reg16|Reg32|Reg64|Byte|Word|Dword|Qword|Unspecified|BaseIndex } +-xor, 0x83/6, 0, Modrm|No_bSuf|No_sSuf|HLEPrefixLock, { Imm8S, Reg16|Reg32|Reg64|Word|Dword|Qword|Unspecified|BaseIndex } +-xor, 0x34, 0, W|No_sSuf, { Imm8|Imm16|Imm32|Imm32S, Acc|Byte|Word|Dword|Qword } +-xor, 0x80/6, 0, W|Modrm|No_sSuf|HLEPrefixLock, { Imm8|Imm16|Imm32|Imm32S, Reg8|Reg16|Reg32|Reg64|Byte|Word|Dword|Qword|Unspecified|BaseIndex } ++ + +-// clr with 1 operand is really xor with 2 operands. +-clr, 0x30, 0, W|Modrm|No_sSuf|RegKludge|Optimize, { Reg8|Reg16|Reg32|Reg64 } ++ + +-adc, 0x10, 0, D|W|CheckOperandSize|Modrm|No_sSuf|HLEPrefixLock, { Reg8|Reg16|Reg32|Reg64, Reg8|Reg16|Reg32|Reg64|Byte|Word|Dword|Qword|Unspecified|BaseIndex } +-adc, 0x83/2, 0, Modrm|No_bSuf|No_sSuf|HLEPrefixLock, { Imm8S, Reg16|Reg32|Reg64|Word|Dword|Qword|Unspecified|BaseIndex } +-adc, 0x14, 0, W|No_sSuf, { Imm8|Imm16|Imm32|Imm32S, Acc|Byte|Word|Dword|Qword } +-adc, 0x80/2, 0, W|Modrm|No_sSuf|HLEPrefixLock, { Imm8|Imm16|Imm32|Imm32S, Reg8|Reg16|Reg32|Reg64|Byte|Word|Dword|Qword|Unspecified|BaseIndex } ++, 0xf6/, APX_F, W|Modrm|CheckOperandSize|No_sSuf|DstVVVV|EVexMap4|, { Reg8|Reg16|Reg32|Reg64|Unspecified|BaseIndex, Reg8|Reg16|Reg32|Reg64 } ++, 0xf6/, 0, W|Modrm|No_sSuf|HLEPrefixLock, { Reg8|Reg16|Reg32|Reg64|Unspecified|BaseIndex } ++, 0xf6/, APX_F, W|Modrm|No_sSuf|EVexMap4|, { Reg8|Reg16|Reg32|Reg64|Unspecified|BaseIndex } + +-neg, 0xf6/3, 0, W|Modrm|No_sSuf|HLEPrefixLock, { Reg8|Reg16|Reg32|Reg64|Byte|Word|Dword|Qword|Unspecified|BaseIndex } +-not, 0xf6/2, 0, W|Modrm|No_sSuf|HLEPrefixLock, { Reg8|Reg16|Reg32|Reg64|Byte|Word|Dword|Qword|Unspecified|BaseIndex } ++ + + aaa, 0x37, No64, NoSuf, {} + aas, 0x3f, No64, NoSuf, {} +@@ -367,81 +390,82 @@ cqto, 0x99, x64, Size64|NoSuf, {} + // expanding 64-bit multiplies, and *cannot* be selected to accomplish + // 'imul %ebx, %eax' (opcode 0x0faf must be used in this case) + // These multiplies can only be selected with single operand forms. +-mul, 0xf6/4, 0, W|Modrm|No_sSuf, { Reg8|Reg16|Reg32|Reg64|Byte|Word|Dword|Qword|Unspecified|BaseIndex } +-imul, 0xf6/5, 0, W|Modrm|No_sSuf, { Reg8|Reg16|Reg32|Reg64|Byte|Word|Dword|Qword|Unspecified|BaseIndex } +-imul, 0xfaf, i386, Modrm|CheckOperandSize|No_bSuf|No_sSuf, { Reg16|Reg32|Reg64|Unspecified|Word|Dword|Qword|BaseIndex, Reg16|Reg32|Reg64 } +-imul, 0x6b, i186, Modrm|CheckOperandSize|No_bSuf|No_sSuf, { Imm8S, Reg16|Reg32|Reg64|Word|Dword|Qword|Unspecified|BaseIndex, Reg16|Reg32|Reg64 } +-imul, 0x69, i186, Modrm|CheckOperandSize|No_bSuf|No_sSuf, { Imm16|Imm32|Imm32S, Reg16|Reg32|Reg64|Word|Dword|Qword|Unspecified|BaseIndex, Reg16|Reg32|Reg64 } ++ ++ ++, 0xf6/, 0, W|Modrm|No_sSuf, { Reg8|Reg16|Reg32|Reg64|Unspecified|BaseIndex } ++, 0xf6/, APX_F, W|Modrm|No_sSuf|EVexMap4|NF, { Reg8|Reg16|Reg32|Reg64|Unspecified|BaseIndex } ++imul, 0xaf, APX_F, C|Modrm|CheckOperandSize|No_bSuf|No_sSuf|DstVVVV|EVexMap4|NF, { Reg16|Reg32|Reg64|Unspecified|BaseIndex, Reg16|Reg32|Reg64, Reg16|Reg32|Reg64 } ++imul, 0xfaf, i386, Modrm|CheckOperandSize|No_bSuf|No_sSuf, { Reg16|Reg32|Reg64|Unspecified|BaseIndex, Reg16|Reg32|Reg64 } ++imul, 0xaf, APX_F, Modrm|CheckOperandSize|No_bSuf|No_sSuf|EVexMap4|NF, { Reg16|Reg32|Reg64|Unspecified|BaseIndex, Reg16|Reg32|Reg64 } ++imul, 0x6b, i186, Modrm|CheckOperandSize|No_bSuf|No_sSuf, { Imm8S, Reg16|Reg32|Reg64|Unspecified|BaseIndex, Reg16|Reg32|Reg64 } ++imul, 0x6b, APX_F, Modrm|CheckOperandSize|No_bSuf|No_sSuf|EVexMap4|NF, { Imm8S, Reg16|Reg32|Reg64|Unspecified|BaseIndex, Reg16|Reg32|Reg64 } ++imul, 0x69, i186, Modrm|CheckOperandSize|No_bSuf|No_sSuf, { Imm16|Imm32|Imm32S, Reg16|Reg32|Reg64|Unspecified|BaseIndex, Reg16|Reg32|Reg64 } ++imul, 0x69, APX_F, Modrm|CheckOperandSize|No_bSuf|No_sSuf|EVexMap4|NF, { Imm16|Imm32|Imm32S, Reg16|Reg32|Reg64|Unspecified|BaseIndex, Reg16|Reg32|Reg64 } + // imul with 2 operands mimics imul with 3 by putting the register in + // both i.rm.reg & i.rm.regmem fields. RegKludge enables this + // transformation. + imul, 0x6b, i186, Modrm|No_bSuf|No_sSuf|RegKludge, { Imm8S, Reg16|Reg32|Reg64 } ++imul, 0x6b, APX_F, Modrm|No_bSuf|No_sSuf|RegKludge|EVexMap4|NF, { Imm8S, Reg16|Reg32|Reg64 } + imul, 0x69, i186, Modrm|No_bSuf|No_sSuf|RegKludge, { Imm16|Imm32|Imm32S, Reg16|Reg32|Reg64 } +- +-div, 0xf6/6, 0, W|Modrm|No_sSuf, { Reg8|Reg16|Reg32|Reg64|Byte|Word|Dword|Qword|Unspecified|BaseIndex } +-div, 0xf6/6, 0, W|CheckOperandSize|Modrm|No_sSuf, { Reg8|Reg16|Reg32|Reg64|Byte|Word|Dword|Qword|Unspecified|BaseIndex, Acc|Byte|Word|Dword|Qword } +-idiv, 0xf6/7, 0, W|Modrm|No_sSuf, { Reg8|Reg16|Reg32|Reg64|Byte|Word|Dword|Qword|Unspecified|BaseIndex } +-idiv, 0xf6/7, 0, W|CheckOperandSize|Modrm|No_sSuf, { Reg8|Reg16|Reg32|Reg64|Byte|Word|Dword|Qword|Unspecified|BaseIndex, Acc|Byte|Word|Dword|Qword } +- +-rol, 0xd0/0, 0, W|Modrm|No_sSuf, { Imm1, Reg8|Reg16|Reg32|Reg64|Byte|Word|Dword|Qword|Unspecified|BaseIndex } +-rol, 0xc0/0, i186, W|Modrm|No_sSuf, { Imm8|Imm8S, Reg8|Reg16|Reg32|Reg64|Byte|Word|Dword|Qword|Unspecified|BaseIndex } +-rol, 0xd2/0, 0, W|Modrm|No_sSuf, { ShiftCount, Reg8|Reg16|Reg32|Reg64|Byte|Word|Dword|Qword|Unspecified|BaseIndex } +-rol, 0xd0/0, 0, W|Modrm|No_sSuf, { Reg8|Reg16|Reg32|Reg64|Byte|Word|Dword|Qword|Unspecified|BaseIndex } +- +-ror, 0xd0/1, 0, W|Modrm|No_sSuf, { Imm1, Reg8|Reg16|Reg32|Reg64|Byte|Word|Dword|Qword|Unspecified|BaseIndex } +-ror, 0xc0/1, i186, W|Modrm|No_sSuf, { Imm8|Imm8S, Reg8|Reg16|Reg32|Reg64|Byte|Word|Dword|Qword|Unspecified|BaseIndex } +-ror, 0xd2/1, 0, W|Modrm|No_sSuf, { ShiftCount, Reg8|Reg16|Reg32|Reg64|Byte|Word|Dword|Qword|Unspecified|BaseIndex } +-ror, 0xd0/1, 0, W|Modrm|No_sSuf, { Reg8|Reg16|Reg32|Reg64|Byte|Word|Dword|Qword|Unspecified|BaseIndex } +- +-rcl, 0xd0/2, 0, W|Modrm|No_sSuf, { Imm1, Reg8|Reg16|Reg32|Reg64|Byte|Word|Dword|Qword|Unspecified|BaseIndex } +-rcl, 0xc0/2, i186, W|Modrm|No_sSuf, { Imm8, Reg8|Reg16|Reg32|Reg64|Byte|Word|Dword|Qword|Unspecified|BaseIndex } +-rcl, 0xd2/2, 0, W|Modrm|No_sSuf, { ShiftCount, Reg8|Reg16|Reg32|Reg64|Byte|Word|Dword|Qword|Unspecified|BaseIndex } +-rcl, 0xd0/2, 0, W|Modrm|No_sSuf, { Reg8|Reg16|Reg32|Reg64|Byte|Word|Dword|Qword|Unspecified|BaseIndex } +- +-rcr, 0xd0/3, 0, W|Modrm|No_sSuf, { Imm1, Reg8|Reg16|Reg32|Reg64|Byte|Word|Dword|Qword|Unspecified|BaseIndex } +-rcr, 0xc0/3, i186, W|Modrm|No_sSuf, { Imm8, Reg8|Reg16|Reg32|Reg64|Byte|Word|Dword|Qword|Unspecified|BaseIndex } +-rcr, 0xd2/3, 0, W|Modrm|No_sSuf, { ShiftCount, Reg8|Reg16|Reg32|Reg64|Byte|Word|Dword|Qword|Unspecified|BaseIndex } +-rcr, 0xd0/3, 0, W|Modrm|No_sSuf, { Reg8|Reg16|Reg32|Reg64|Byte|Word|Dword|Qword|Unspecified|BaseIndex } +- +-sal, 0xd0/4, 0, W|Modrm|No_sSuf, { Imm1, Reg8|Reg16|Reg32|Reg64|Byte|Word|Dword|Qword|Unspecified|BaseIndex } +-sal, 0xc0/4, i186, W|Modrm|No_sSuf, { Imm8, Reg8|Reg16|Reg32|Reg64|Byte|Word|Dword|Qword|Unspecified|BaseIndex } +-sal, 0xd2/4, 0, W|Modrm|No_sSuf, { ShiftCount, Reg8|Reg16|Reg32|Reg64|Byte|Word|Dword|Qword|Unspecified|BaseIndex } +-sal, 0xd0/4, 0, W|Modrm|No_sSuf, { Reg8|Reg16|Reg32|Reg64|Byte|Word|Dword|Qword|Unspecified|BaseIndex } +- +-shl, 0xd0/4, 0, W|Modrm|No_sSuf, { Imm1, Reg8|Reg16|Reg32|Reg64|Byte|Word|Dword|Qword|Unspecified|BaseIndex } +-shl, 0xc0/4, i186, W|Modrm|No_sSuf, { Imm8, Reg8|Reg16|Reg32|Reg64|Byte|Word|Dword|Qword|Unspecified|BaseIndex } +-shl, 0xd2/4, 0, W|Modrm|No_sSuf, { ShiftCount, Reg8|Reg16|Reg32|Reg64|Byte|Word|Dword|Qword|Unspecified|BaseIndex } +-shl, 0xd0/4, 0, W|Modrm|No_sSuf, { Reg8|Reg16|Reg32|Reg64|Byte|Word|Dword|Qword|Unspecified|BaseIndex } +- +-shr, 0xd0/5, 0, W|Modrm|No_sSuf, { Imm1, Reg8|Reg16|Reg32|Reg64|Byte|Word|Dword|Qword|Unspecified|BaseIndex } +-shr, 0xc0/5, i186, W|Modrm|No_sSuf, { Imm8, Reg8|Reg16|Reg32|Reg64|Byte|Word|Dword|Qword|Unspecified|BaseIndex } +-shr, 0xd2/5, 0, W|Modrm|No_sSuf, { ShiftCount, Reg8|Reg16|Reg32|Reg64|Byte|Word|Dword|Qword|Unspecified|BaseIndex } +-shr, 0xd0/5, 0, W|Modrm|No_sSuf, { Reg8|Reg16|Reg32|Reg64|Byte|Word|Dword|Qword|Unspecified|BaseIndex } +- +-sar, 0xd0/7, 0, W|Modrm|No_sSuf, { Imm1, Reg8|Reg16|Reg32|Reg64|Byte|Word|Dword|Qword|Unspecified|BaseIndex } +-sar, 0xc0/7, i186, W|Modrm|No_sSuf, { Imm8, Reg8|Reg16|Reg32|Reg64|Byte|Word|Dword|Qword|Unspecified|BaseIndex } +-sar, 0xd2/7, 0, W|Modrm|No_sSuf, { ShiftCount, Reg8|Reg16|Reg32|Reg64|Byte|Word|Dword|Qword|Unspecified|BaseIndex } +-sar, 0xd0/7, 0, W|Modrm|No_sSuf, { Reg8|Reg16|Reg32|Reg64|Byte|Word|Dword|Qword|Unspecified|BaseIndex } +- +-shld, 0xfa4, i386, Modrm|CheckOperandSize|No_bSuf|No_sSuf, { Imm8, Reg16|Reg32|Reg64, Reg16|Reg32|Reg64|Word|Dword|Qword|Unspecified|BaseIndex } +-shld, 0xfa5, i386, Modrm|CheckOperandSize|No_bSuf|No_sSuf, { ShiftCount, Reg16|Reg32|Reg64, Reg16|Reg32|Reg64|Word|Dword|Qword|Unspecified|BaseIndex } +-shld, 0xfa5, i386, Modrm|CheckOperandSize|No_bSuf|No_sSuf, { Reg16|Reg32|Reg64, Reg16|Reg32|Reg64|Word|Dword|Qword|Unspecified|BaseIndex } +- +-shrd, 0xfac, i386, Modrm|CheckOperandSize|No_bSuf|No_sSuf, { Imm8, Reg16|Reg32|Reg64, Reg16|Reg32|Reg64|Word|Dword|Qword|Unspecified|BaseIndex } +-shrd, 0xfad, i386, Modrm|CheckOperandSize|No_bSuf|No_sSuf, { ShiftCount, Reg16|Reg32|Reg64, Reg16|Reg32|Reg64|Word|Dword|Qword|Unspecified|BaseIndex } +-shrd, 0xfad, i386, Modrm|CheckOperandSize|No_bSuf|No_sSuf, { Reg16|Reg32|Reg64, Reg16|Reg32|Reg64|Word|Dword|Qword|Unspecified|BaseIndex } ++imul, 0x69, APX_F, Modrm|No_bSuf|No_sSuf|RegKludge|EVexMap4|NF, { Imm16|Imm32|Imm32S, Reg16|Reg32|Reg64 } ++ ++ ++ ++ ++ ++
, 0xf6/, 0, W|Modrm|No_sSuf, { Reg8|Reg16|Reg32|Reg64|Unspecified|BaseIndex } ++
, 0xf6/, APX_F, W|Modrm|No_sSuf|EVexMap4|NF, { Reg8|Reg16|Reg32|Reg64|Unspecified|BaseIndex } ++
, 0xf6/, 0, W|CheckOperandSize|Modrm|No_sSuf, { Reg8|Reg16|Reg32|Reg64|Unspecified|BaseIndex, Acc|Byte|Word|Dword|Qword } ++
, 0xf6/, APX_F, W|CheckOperandSize|Modrm|No_sSuf|EVexMap4|NF, { Reg8|Reg16|Reg32|Reg64|Unspecified|BaseIndex, Acc|Byte|Word|Dword|Qword } ++ ++
++ ++ ++ ++, 0xd0/, APX_F, W|Modrm|No_sSuf|CheckOperandSize|DstVVVV|EVexMap4|, { Imm1, Reg8|Reg16|Reg32|Reg64|Unspecified|BaseIndex, Reg8|Reg16|Reg32|Reg64 } ++, 0xd0/, 0, W|Modrm|No_sSuf, { Imm1, Reg8|Reg16|Reg32|Reg64|Unspecified|BaseIndex } ++, 0xd0/, APX_F, W|Modrm|No_sSuf|EVexMap4|, { Imm1, Reg8|Reg16|Reg32|Reg64|Unspecified|BaseIndex } ++, 0xc0/, APX_F, W|Modrm|No_sSuf|CheckOperandSize|DstVVVV|EVexMap4|, { , Reg8|Reg16|Reg32|Reg64|Unspecified|BaseIndex, Reg8|Reg16|Reg32|Reg64 } ++, 0xc0/, i186, W|Modrm|No_sSuf, { , Reg8|Reg16|Reg32|Reg64|Unspecified|BaseIndex } ++, 0xc0/, APX_F, W|Modrm|No_sSuf|EVexMap4|, { , Reg8|Reg16|Reg32|Reg64|Unspecified|BaseIndex } ++, 0xd2/, APX_F, W|Modrm|No_sSuf|CheckOperandSize|DstVVVV|EVexMap4|, { ShiftCount, Reg8|Reg16|Reg32|Reg64|Unspecified|BaseIndex, Reg8|Reg16|Reg32|Reg64 } ++, 0xd2/, 0, W|Modrm|No_sSuf, { ShiftCount, Reg8|Reg16|Reg32|Reg64|Unspecified|BaseIndex } ++, 0xd2/, APX_F, W|Modrm|No_sSuf|EVexMap4|, { ShiftCount, Reg8|Reg16|Reg32|Reg64|Unspecified|BaseIndex } ++, 0xd0/, 0, W|Modrm|No_sSuf, { Reg8|Reg16|Reg32|Reg64|Unspecified|BaseIndex } ++ ++ ++ ++ ++ ++shd, 0x24 | , APX_F, Modrm|CheckOperandSize|No_bSuf|No_sSuf|DstVVVV|EVexMap4|NF, { Imm8, Reg16|Reg32|Reg64, Reg16|Reg32|Reg64|Unspecified|BaseIndex, Reg16|Reg32|Reg64 } ++shd, 0x0fa4 | , i386, Modrm|CheckOperandSize|No_bSuf|No_sSuf, { Imm8, Reg16|Reg32|Reg64, Reg16|Reg32|Reg64|Unspecified|BaseIndex } ++shd, 0x24 | , APX_F, Modrm|CheckOperandSize|No_bSuf|No_sSuf|EVexMap4|NF, { Imm8, Reg16|Reg32|Reg64, Reg16|Reg32|Reg64|Unspecified|BaseIndex } ++shd, 0xa5 | , APX_F, Modrm|CheckOperandSize|No_bSuf|No_sSuf|DstVVVV|EVexMap4|NF, { ShiftCount, Reg16|Reg32|Reg64, Reg16|Reg32|Reg64|Unspecified|BaseIndex, Reg16|Reg32|Reg64 } ++shd, 0x0fa5 | , i386, Modrm|CheckOperandSize|No_bSuf|No_sSuf, { ShiftCount, Reg16|Reg32|Reg64, Reg16|Reg32|Reg64|Unspecified|BaseIndex } ++shd, 0xa5 | , APX_F, Modrm|CheckOperandSize|No_bSuf|No_sSuf|EVexMap4|NF, { ShiftCount, Reg16|Reg32|Reg64, Reg16|Reg32|Reg64|Unspecified|BaseIndex } ++shd, 0x0fa5 | , i386, Modrm|CheckOperandSize|No_bSuf|No_sSuf, { Reg16|Reg32|Reg64, Reg16|Reg32|Reg64|Unspecified|BaseIndex } ++ ++ + + // Control transfer instructions. +-call, 0xe8, No64, JumpDword|DefaultSize|No_bSuf|No_sSuf|No_qSuf|BNDPrefixOk, { Disp16|Disp32 } +-call, 0xe8, x64, Amd64|JumpDword|DefaultSize|No_bSuf|No_lSuf|No_sSuf|NoRex64|BNDPrefixOk, { Disp16|Disp32 } +-call, 0xe8, x64, Intel64|JumpDword|No_bSuf|No_wSuf|No_lSuf|No_sSuf|NoRex64|BNDPrefixOk, { Disp32 } +-call, 0xff/2, No64, Modrm|JumpAbsolute|DefaultSize|No_bSuf|No_sSuf|No_qSuf|BNDPrefixOk|NoTrackPrefixOk, { Reg16|Reg32|Unspecified|BaseIndex } +-call, 0xff/2, x64, Amd64|Modrm|JumpAbsolute|DefaultSize|No_bSuf|No_lSuf|No_sSuf|NoRex64|BNDPrefixOk|NoTrackPrefixOk, { Reg16|Reg64|Unspecified|BaseIndex } +-call, 0xff/2, x64, Intel64|Modrm|JumpAbsolute|No_bSuf|No_wSuf|No_lSuf|No_sSuf|NoRex64|BNDPrefixOk|NoTrackPrefixOk, { Reg64|Unspecified|BaseIndex } ++call, 0xe8, No64, JumpDword|ImplicitStackOp|DefaultSize|No_bSuf|No_sSuf|No_qSuf|BNDPrefixOk, { Disp16|Disp32 } ++call, 0xe8, x64, Amd64|JumpDword|ImplicitStackOp|DefaultSize|No_bSuf|No_lSuf|No_sSuf|NoRex64|BNDPrefixOk, { Disp16|Disp32 } ++call, 0xe8, x64, Intel64|JumpDword|ImplicitStackOp|No_bSuf|No_wSuf|No_lSuf|No_sSuf|NoRex64|BNDPrefixOk, { Disp32 } ++call, 0xff/2, No64, Modrm|JumpAbsolute|ImplicitStackOp|DefaultSize|No_bSuf|No_sSuf|No_qSuf|BNDPrefixOk|NoTrackPrefixOk, { Reg16|Reg32|Unspecified|BaseIndex } ++call, 0xff/2, x64, Amd64|Modrm|JumpAbsolute|ImplicitStackOp|DefaultSize|No_bSuf|No_lSuf|No_sSuf|NoRex64|BNDPrefixOk|NoTrackPrefixOk, { Reg16|Reg64|Unspecified|BaseIndex } ++call, 0xff/2, x64, Intel64|Modrm|JumpAbsolute|ImplicitStackOp|No_bSuf|No_wSuf|No_lSuf|No_sSuf|NoRex64|BNDPrefixOk|NoTrackPrefixOk, { Reg64|Unspecified|BaseIndex } + // Intel Syntax remaining call instances. +-call, 0x9a, No64, JumpInterSegment|DefaultSize|No_bSuf|No_sSuf|No_qSuf, { Imm16, Imm16|Imm32 } +-call, 0xff/3, 0, Amd64|Modrm|JumpAbsolute|DefaultSize|NoSuf, { Dword|Fword|BaseIndex } +-call, 0xff/3, x64, Intel64|Modrm|JumpAbsolute|NoSuf, { Dword|Fword|Tbyte|BaseIndex } ++call, 0x9a, No64, JumpInterSegment|ImplicitStackOp|DefaultSize|No_bSuf|No_sSuf|No_qSuf, { Imm16, Imm16|Imm32 } ++call, 0xff/3, 0, Amd64|Modrm|JumpAbsolute|ImplicitStackOp|DefaultSize|NoSuf, { Dword|Fword|BaseIndex } ++call, 0xff/3, x64, Intel64|Modrm|JumpAbsolute|ImplicitStackOp|NoSuf, { Dword|Fword|Tbyte|BaseIndex } + lcall, 0x9a, No64, JumpInterSegment|DefaultSize|No_bSuf|No_sSuf|No_qSuf, { Imm16, Imm16|Imm32 } + lcall, 0xff/3, 0, Amd64|Modrm|JumpAbsolute|DefaultSize|No_bSuf|No_sSuf|No_qSuf, { Unspecified|BaseIndex } + lcall, 0xff/3, x64, Intel64|Modrm|JumpAbsolute|No_bSuf|No_sSuf, { Unspecified|BaseIndex } +@@ -459,22 +483,22 @@ ljmp, 0xea, No64, JumpInterSegment|No_bSuf|No_sSuf|No_qSuf, { Imm16, Imm16|Imm32 + ljmp, 0xff/5, 0, Amd64|Modrm|JumpAbsolute|No_bSuf|No_sSuf|No_qSuf, { Unspecified|BaseIndex } + ljmp, 0xff/5, x64, Intel64|Modrm|JumpAbsolute|No_bSuf|No_sSuf, { Unspecified|BaseIndex } + +-ret, 0xc3, No64, DefaultSize|No_bSuf|No_sSuf|No_qSuf|RepPrefixOk|BNDPrefixOk, {} +-ret, 0xc2, No64, DefaultSize|No_bSuf|No_sSuf|No_qSuf|RepPrefixOk|BNDPrefixOk, { Imm16 } +-ret, 0xc3, x64, Amd64|DefaultSize|No_bSuf|No_lSuf|No_sSuf|NoRex64|RepPrefixOk|BNDPrefixOk, {} +-ret, 0xc2, x64, Amd64|DefaultSize|No_bSuf|No_lSuf|No_sSuf|NoRex64|RepPrefixOk|BNDPrefixOk, { Imm16 } +-ret, 0xc3, x64, Intel64|Size64|No_bSuf|No_wSuf|No_lSuf|No_sSuf|NoRex64|RepPrefixOk|BNDPrefixOk, {} +-ret, 0xc2, x64, Intel64|Size64|No_bSuf|No_wSuf|No_lSuf|No_sSuf|NoRex64|RepPrefixOk|BNDPrefixOk, { Imm16 } ++ret, 0xc3, No64, ImplicitStackOp|DefaultSize|No_bSuf|No_sSuf|No_qSuf|RepPrefixOk|BNDPrefixOk, {} ++ret, 0xc2, No64, ImplicitStackOp|DefaultSize|No_bSuf|No_sSuf|No_qSuf|RepPrefixOk|BNDPrefixOk, { Imm16 } ++ret, 0xc3, x64, Amd64|ImplicitStackOp|DefaultSize|No_bSuf|No_lSuf|No_sSuf|NoRex64|RepPrefixOk|BNDPrefixOk, {} ++ret, 0xc2, x64, Amd64|ImplicitStackOp|DefaultSize|No_bSuf|No_lSuf|No_sSuf|NoRex64|RepPrefixOk|BNDPrefixOk, { Imm16 } ++ret, 0xc3, x64, Intel64|ImplicitStackOp|Size64|No_bSuf|No_wSuf|No_lSuf|No_sSuf|NoRex64|RepPrefixOk|BNDPrefixOk, {} ++ret, 0xc2, x64, Intel64|ImplicitStackOp|Size64|No_bSuf|No_wSuf|No_lSuf|No_sSuf|NoRex64|RepPrefixOk|BNDPrefixOk, { Imm16 } + lret, 0xcb, 0, DefaultSize|No_bSuf|No_sSuf, {} + lret, 0xca, 0, DefaultSize|No_bSuf|No_sSuf, { Imm16 } + // Intel Syntax. + retf, 0xcb, 0, DefaultSize|No_bSuf|No_sSuf, {} + retf, 0xca, 0, DefaultSize|No_bSuf|No_sSuf, { Imm16 } + +-enter, 0xc8, i186|No64, DefaultSize|No_bSuf|No_sSuf|No_qSuf, { Imm16, Imm8 } +-enter, 0xc8, x64, DefaultSize|No_bSuf|No_lSuf|No_sSuf|NoRex64, { Imm16, Imm8 } +-leave, 0xc9, i186|No64, DefaultSize|No_bSuf|No_sSuf|No_qSuf, {} +-leave, 0xc9, x64, DefaultSize|No_bSuf|No_lSuf|No_sSuf|NoRex64, {} ++enter, 0xc8, i186&No64, ImplicitStackOp|DefaultSize|No_bSuf|No_sSuf|No_qSuf, { Imm16, Imm8 } ++enter, 0xc8, x64, ImplicitStackOp|DefaultSize|No_bSuf|No_lSuf|No_sSuf|NoRex64, { Imm16, Imm8 } ++leave, 0xc9, i186&No64, ImplicitStackOp|DefaultSize|No_bSuf|No_sSuf|No_qSuf, {} ++leave, 0xc9, x64, ImplicitStackOp|DefaultSize|No_bSuf|No_lSuf|No_sSuf|NoRex64, {} + + +@@ -503,7 +527,7 @@ loopne, 0xe0, No64, JumpByte|No_bSuf|No_sSuf|No_qSuf, { Disp8 } + loopne, 0xe0, x64, JumpByte|No_bSuf|No_wSuf|No_sSuf|NoRex64, { Disp8 } + + // Set byte on flag instructions. +-set, 0xf9/0, i386, Modrm|No_wSuf|No_lSuf|No_sSuf|No_qSuf, { Reg8|Byte|Unspecified|BaseIndex } ++set, 0xf9/0, i386, Modrm|No_wSuf|No_lSuf|No_sSuf|No_qSuf, { Reg8|Unspecified|BaseIndex } + + // String manipulation. + cmps, 0xa6, 0, W|No_sSuf|RepPrefixOk, {} +@@ -540,58 +564,58 @@ xlat, 0xd7, 0, No_wSuf|No_lSuf|No_sSuf|No_qSuf, {} + xlat, 0xd7, 0, No_wSuf|No_lSuf|No_sSuf|No_qSuf|IsString, { Byte|Unspecified|BaseIndex } + + // Bit manipulation. +-bsf, 0xfbc, i386, Modrm|CheckOperandSize|No_bSuf|No_sSuf|RepPrefixOk, { Reg16|Reg32|Reg64|Word|Dword|Qword|Unspecified|BaseIndex, Reg16|Reg32|Reg64 } +-bsr, 0xfbd, i386, Modrm|CheckOperandSize|No_bSuf|No_sSuf|RepPrefixOk, { Reg16|Reg32|Reg64|Word|Dword|Qword|Unspecified|BaseIndex, Reg16|Reg32|Reg64 } +-bt, 0xfa3, i386, Modrm|CheckOperandSize|No_bSuf|No_sSuf, { Reg16|Reg32|Reg64, Reg16|Reg32|Reg64|Word|Dword|Qword|Unspecified|BaseIndex } ++bsf, 0xfbc, i386, Modrm|CheckOperandSize|No_bSuf|No_sSuf|RepPrefixOk, { Reg16|Reg32|Reg64|Unspecified|BaseIndex, Reg16|Reg32|Reg64 } ++bsr, 0xfbd, i386, Modrm|CheckOperandSize|No_bSuf|No_sSuf|RepPrefixOk, { Reg16|Reg32|Reg64|Unspecified|BaseIndex, Reg16|Reg32|Reg64 } ++bt, 0xfa3, i386, Modrm|CheckOperandSize|No_bSuf|No_sSuf, { Reg16|Reg32|Reg64, Reg16|Reg32|Reg64|Unspecified|BaseIndex } + bt, 0xfba/4, i386, Modrm|No_bSuf|No_sSuf|Optimize, { Imm8, Reg16|Reg32|Reg64|Unspecified|BaseIndex } +-btc, 0xfbb, i386, Modrm|CheckOperandSize|No_bSuf|No_sSuf|HLEPrefixLock, { Reg16|Reg32|Reg64, Reg16|Reg32|Reg64|Word|Dword|Qword|Unspecified|BaseIndex } ++btc, 0xfbb, i386, Modrm|CheckOperandSize|No_bSuf|No_sSuf|HLEPrefixLock, { Reg16|Reg32|Reg64, Reg16|Reg32|Reg64|Unspecified|BaseIndex } + btc, 0xfba/7, i386, Modrm|No_bSuf|No_sSuf|Optimize|HLEPrefixLock, { Imm8, Reg16|Reg32|Reg64|Unspecified|BaseIndex } +-btr, 0xfb3, i386, Modrm|CheckOperandSize|No_bSuf|No_sSuf|HLEPrefixLock, { Reg16|Reg32|Reg64, Reg16|Reg32|Reg64|Word|Dword|Qword|Unspecified|BaseIndex } ++btr, 0xfb3, i386, Modrm|CheckOperandSize|No_bSuf|No_sSuf|HLEPrefixLock, { Reg16|Reg32|Reg64, Reg16|Reg32|Reg64|Unspecified|BaseIndex } + btr, 0xfba/6, i386, Modrm|No_bSuf|No_sSuf|Optimize|HLEPrefixLock, { Imm8, Reg16|Reg32|Reg64|Unspecified|BaseIndex } +-bts, 0xfab, i386, Modrm|CheckOperandSize|No_bSuf|No_sSuf|HLEPrefixLock, { Reg16|Reg32|Reg64, Reg16|Reg32|Reg64|Word|Dword|Qword|Unspecified|BaseIndex } ++bts, 0xfab, i386, Modrm|CheckOperandSize|No_bSuf|No_sSuf|HLEPrefixLock, { Reg16|Reg32|Reg64, Reg16|Reg32|Reg64|Unspecified|BaseIndex } + bts, 0xfba/5, i386, Modrm|No_bSuf|No_sSuf|Optimize|HLEPrefixLock, { Imm8, Reg16|Reg32|Reg64|Unspecified|BaseIndex } + + // Interrupts & op. sys insns. + // See gas/config/tc-i386.c for conversion of 'int $3' into the special + // int 3 insn. +-int, 0xcd, 0, NoSuf, { Imm8 } +-int1, 0xf1, 0, NoSuf, {} +-int3, 0xcc, 0, NoSuf, {} +-into, 0xce, No64, NoSuf, {} +-iret, 0xcf, 0, DefaultSize|No_bSuf|No_sSuf, {} ++int, 0xcd, 0, ImplicitStackOp|NoSuf, { Imm8 } ++int1, 0xf1, 0, ImplicitStackOp|NoSuf, {} ++int3, 0xcc, 0, ImplicitStackOp|NoSuf, {} ++into, 0xce, No64, ImplicitStackOp|NoSuf, {} ++iret, 0xcf, 0, ImplicitStackOp|DefaultSize|No_bSuf|No_sSuf, {} + // i386sl, i486sl, later 486, and Pentium. + rsm, 0xfaa, i386, NoSuf, {} + +-bound, 0x62, i186|No64, Modrm|No_bSuf|No_sSuf|No_qSuf, { Reg16|Reg32, Dword|Qword|Unspecified|BaseIndex } ++bound, 0x62, i186&No64, Modrm|No_bSuf|No_sSuf|No_qSuf, { Reg16|Reg32, Dword|Qword|Unspecified|BaseIndex } + + hlt, 0xf4, 0, NoSuf, {} + +-nop, 0xf1f/0, Nop, Modrm|No_bSuf|No_sSuf, { Reg16|Reg32|Reg64|Word|Dword|Qword|Unspecified|BaseIndex } ++nop, 0xf1f/0, Nop, Modrm|No_bSuf|No_sSuf, { Reg16|Reg32|Reg64|Unspecified|BaseIndex } + + // nop is actually "xchg %ax,%ax" in 16bit mode, "xchg %eax,%eax" in + // 32bit mode and "xchg %rax,%rax" in 64bit mode. + nop, 0x90, 0, NoSuf|RepPrefixOk, {} + + // Protection control. +-arpl, 0x63, i286|No64, RegMem|CheckOperandSize|IgnoreSize|No_bSuf|No_sSuf|No_qSuf, { Reg16|Reg32, Reg16|Reg32 } +-arpl, 0x63, i286|No64, Modrm|IgnoreSize|No_bSuf|No_sSuf|No_qSuf, { Reg16|Reg32, Word|Unspecified|BaseIndex } ++arpl, 0x63, i286&No64, RegMem|CheckOperandSize|IgnoreSize|No_bSuf|No_sSuf|No_qSuf, { Reg16|Reg32, Reg16|Reg32 } ++arpl, 0x63, i286&No64, Modrm|IgnoreSize|No_bSuf|No_sSuf|No_qSuf, { Reg16|Reg32, Word|Unspecified|BaseIndex } + lar, 0xf02, i286, Modrm|CheckOperandSize|No_bSuf|No_sSuf|NoRex64, { Reg16|Reg32|Reg64, Reg16|Reg32|Reg64 } + lar, 0xf02, i286, Modrm|No_bSuf|No_sSuf|NoRex64, { Reg16|Unspecified|BaseIndex, Reg16|Reg32|Reg64 } +-lgdt, 0xf01/2, i286|No64, Modrm|No_bSuf|No_sSuf|No_qSuf, { Fword|Unspecified|BaseIndex } ++lgdt, 0xf01/2, i286&No64, Modrm|No_bSuf|No_sSuf|No_qSuf, { Fword|Unspecified|BaseIndex } + lgdt, 0xf01/2, x64, Modrm|No_bSuf|No_wSuf|No_lSuf|No_sSuf|NoRex64, { Tbyte|Unspecified|BaseIndex } +-lidt, 0xf01/3, i286|No64, Modrm|No_bSuf|No_sSuf|No_qSuf, { Fword|Unspecified|BaseIndex } ++lidt, 0xf01/3, i286&No64, Modrm|No_bSuf|No_sSuf|No_qSuf, { Fword|Unspecified|BaseIndex } + lidt, 0xf01/3, x64, Modrm|No_bSuf|No_wSuf|No_lSuf|No_sSuf|NoRex64, { Tbyte|Unspecified|BaseIndex } + lldt, 0xf00/2, i286, Modrm|IgnoreSize|No_bSuf|No_sSuf|NoRex64, { Reg16|Reg32|Reg64 } + lldt, 0xf00/2, i286, Modrm|IgnoreSize|No_bSuf|No_lSuf|No_sSuf|No_qSuf, { Word|Unspecified|BaseIndex } +-lmsw, 0xf01/6, i286, Modrm|IgnoreSize|No_bSuf|No_lSuf|No_sSuf|No_qSuf, { Reg16|Word|Unspecified|BaseIndex } ++lmsw, 0xf01/6, i286, Modrm|IgnoreSize|No_bSuf|No_lSuf|No_sSuf|No_qSuf, { Reg16|Unspecified|BaseIndex } + lsl, 0xf03, i286, Modrm|CheckOperandSize|No_bSuf|No_sSuf|NoRex64, { Reg16|Reg32|Reg64, Reg16|Reg32|Reg64 } + lsl, 0xf03, i286, Modrm|No_bSuf|No_sSuf|NoRex64, { Reg16|Unspecified|BaseIndex, Reg16|Reg32|Reg64 } + ltr, 0xf00/3, i286, Modrm|IgnoreSize|No_bSuf|No_sSuf|NoRex64, { Reg16|Reg32|Reg64 } + ltr, 0xf00/3, i286, Modrm|IgnoreSize|No_bSuf|No_lSuf|No_sSuf|No_qSuf, { Word|Unspecified|BaseIndex } + +-sgdt, 0xf01/0, i286|No64, Modrm|No_bSuf|No_sSuf|No_qSuf, { Fword|Unspecified|BaseIndex } ++sgdt, 0xf01/0, i286&No64, Modrm|No_bSuf|No_sSuf|No_qSuf, { Fword|Unspecified|BaseIndex } + sgdt, 0xf01/0, x64, Modrm|No_bSuf|No_wSuf|No_lSuf|No_sSuf|NoRex64, { Tbyte|Unspecified|BaseIndex } +-sidt, 0xf01/1, i286|No64, Modrm|No_bSuf|No_sSuf|No_qSuf, { Fword|Unspecified|BaseIndex } ++sidt, 0xf01/1, i286&No64, Modrm|No_bSuf|No_sSuf|No_qSuf, { Fword|Unspecified|BaseIndex } + sidt, 0xf01/1, x64, Modrm|No_bSuf|No_wSuf|No_lSuf|No_sSuf|NoRex64, { Tbyte|Unspecified|BaseIndex } + sldt, 0xf00/0, i286, Modrm|No_bSuf|No_sSuf|NoRex64, { Reg16|Reg32|Reg64 } + sldt, 0xf00/0, i286, Modrm|IgnoreSize|No_bSuf|No_lSuf|No_sSuf|No_qSuf, { Word|Unspecified|BaseIndex } +@@ -700,14 +724,13 @@ faddp, 0xdec1, FP, NoSuf, {} + fsub, 0xd8/4, FP, Modrm|NoSuf, { FloatReg } + fsub, 0xd8/4, FP, D|Modrm|NoSuf, { FloatReg, FloatAcc } + // alias for fsubp +-fsub, 0xdee1, FP, NoSuf|Ugh|ATTMnemonic|ATTSyntax, {} +-fsub, 0xdee9, FP, NoSuf|Ugh|ATTMnemonic, {} ++fsub, 0xdee1, FP, NoSuf|Ugh|ATTMnemonic, {} + fsub, 0xd8/4, FP, Modrm|FloatMF|No_bSuf|No_wSuf|No_qSuf, { Dword|Qword|Unspecified|BaseIndex } + fisub, 0xde/4, FP, Modrm|FloatMF|No_bSuf|No_wSuf|No_qSuf, { Word|Dword|Unspecified|BaseIndex } + +-fsubp, 0xde/4, FP, Modrm|NoSuf|ATTMnemonic|ATTSyntax, { FloatAcc, FloatReg } +-fsubp, 0xde/4, FP, Modrm|NoSuf|ATTMnemonic|ATTSyntax, { FloatReg } +-fsubp, 0xdee1, FP, NoSuf|ATTMnemonic|ATTSyntax, {} ++fsubp, 0xde/4, FP, Modrm|NoSuf|ATTMnemonic, { FloatAcc, FloatReg } ++fsubp, 0xde/4, FP, Modrm|NoSuf|ATTMnemonic, { FloatReg } ++fsubp, 0xdee1, FP, NoSuf|ATTMnemonic, {} + fsubp, 0xde/5, FP, Modrm|NoSuf, { FloatAcc, FloatReg } + fsubp, 0xde/5, FP, Modrm|NoSuf, { FloatReg } + fsubp, 0xdee9, FP, NoSuf, {} +@@ -716,14 +739,13 @@ fsubp, 0xdee9, FP, NoSuf, {} + fsubr, 0xd8/5, FP, Modrm|NoSuf, { FloatReg } + fsubr, 0xd8/5, FP, D|Modrm|NoSuf, { FloatReg, FloatAcc } + // alias for fsubrp +-fsubr, 0xdee9, FP, NoSuf|Ugh|ATTMnemonic|ATTSyntax, {} +-fsubr, 0xdee1, FP, NoSuf|Ugh|ATTMnemonic, {} ++fsubr, 0xdee9, FP, NoSuf|Ugh|ATTMnemonic, {} + fsubr, 0xd8/5, FP, Modrm|FloatMF|No_bSuf|No_wSuf|No_qSuf, { Dword|Qword|Unspecified|BaseIndex } + fisubr, 0xde/5, FP, Modrm|FloatMF|No_bSuf|No_wSuf|No_qSuf, { Word|Dword|Unspecified|BaseIndex } + +-fsubrp, 0xde/5, FP, Modrm|NoSuf|ATTMnemonic|ATTSyntax, { FloatAcc, FloatReg } +-fsubrp, 0xde/5, FP, Modrm|NoSuf|ATTMnemonic|ATTSyntax, { FloatReg } +-fsubrp, 0xdee9, FP, NoSuf|ATTMnemonic|ATTSyntax, {} ++fsubrp, 0xde/5, FP, Modrm|NoSuf|ATTMnemonic, { FloatAcc, FloatReg } ++fsubrp, 0xde/5, FP, Modrm|NoSuf|ATTMnemonic, { FloatReg } ++fsubrp, 0xdee9, FP, NoSuf|ATTMnemonic, {} + fsubrp, 0xde/4, FP, Modrm|NoSuf, { FloatAcc, FloatReg } + fsubrp, 0xde/4, FP, Modrm|NoSuf, { FloatReg } + fsubrp, 0xdee1, FP, NoSuf, {} +@@ -745,14 +767,13 @@ fmulp, 0xdec9, FP, NoSuf, {} + fdiv, 0xd8/6, FP, Modrm|NoSuf, { FloatReg } + fdiv, 0xd8/6, FP, D|Modrm|NoSuf, { FloatReg, FloatAcc } + // alias for fdivp +-fdiv, 0xdef1, FP, NoSuf|Ugh|ATTMnemonic|ATTSyntax, {} +-fdiv, 0xdef9, FP, NoSuf|Ugh|ATTMnemonic, {} ++fdiv, 0xdef1, FP, NoSuf|Ugh|ATTMnemonic, {} + fdiv, 0xd8/6, FP, Modrm|FloatMF|No_bSuf|No_wSuf|No_qSuf, { Dword|Qword|Unspecified|BaseIndex } + fidiv, 0xde/6, FP, Modrm|FloatMF|No_bSuf|No_wSuf|No_qSuf, { Word|Dword|Unspecified|BaseIndex } + +-fdivp, 0xde/6, FP, Modrm|NoSuf|ATTMnemonic|ATTSyntax, { FloatAcc, FloatReg } +-fdivp, 0xde/6, FP, Modrm|NoSuf|ATTMnemonic|ATTSyntax, { FloatReg } +-fdivp, 0xdef1, FP, NoSuf|ATTMnemonic|ATTSyntax, {} ++fdivp, 0xde/6, FP, Modrm|NoSuf|ATTMnemonic, { FloatAcc, FloatReg } ++fdivp, 0xde/6, FP, Modrm|NoSuf|ATTMnemonic, { FloatReg } ++fdivp, 0xdef1, FP, NoSuf|ATTMnemonic, {} + fdivp, 0xde/7, FP, Modrm|NoSuf, { FloatAcc, FloatReg } + fdivp, 0xde/7, FP, Modrm|NoSuf, { FloatReg } + fdivp, 0xdef9, FP, NoSuf, {} +@@ -761,14 +782,13 @@ fdivp, 0xdef9, FP, NoSuf, {} + fdivr, 0xd8/7, FP, Modrm|NoSuf, { FloatReg } + fdivr, 0xd8/7, FP, D|Modrm|NoSuf, { FloatReg, FloatAcc } + // alias for fdivrp +-fdivr, 0xdef9, FP, NoSuf|Ugh|ATTMnemonic|ATTSyntax, {} +-fdivr, 0xdef1, FP, NoSuf|Ugh|ATTMnemonic, {} ++fdivr, 0xdef9, FP, NoSuf|Ugh|ATTMnemonic, {} + fdivr, 0xd8/7, FP, Modrm|FloatMF|No_bSuf|No_wSuf|No_qSuf, { Dword|Qword|Unspecified|BaseIndex } + fidivr, 0xde/7, FP, Modrm|FloatMF|No_bSuf|No_wSuf|No_qSuf, { Word|Dword|Unspecified|BaseIndex } + +-fdivrp, 0xde/7, FP, Modrm|NoSuf|ATTMnemonic|ATTSyntax, { FloatAcc, FloatReg } +-fdivrp, 0xde/7, FP, Modrm|NoSuf|ATTMnemonic|ATTSyntax, { FloatReg } +-fdivrp, 0xdef9, FP, NoSuf|ATTMnemonic|ATTSyntax, {} ++fdivrp, 0xde/7, FP, Modrm|NoSuf|ATTMnemonic, { FloatAcc, FloatReg } ++fdivrp, 0xde/7, FP, Modrm|NoSuf|ATTMnemonic, { FloatReg } ++fdivrp, 0xdef9, FP, NoSuf|ATTMnemonic, {} + fdivrp, 0xde/6, FP, Modrm|NoSuf, { FloatAcc, FloatReg } + fdivrp, 0xde/6, FP, Modrm|NoSuf, { FloatReg } + fdivrp, 0xdef1, FP, NoSuf, {} +@@ -831,14 +851,14 @@ fwait, 0x9b, FP, NoSuf, {} + + // Opcode prefixes; we allow them as separate insns too. + +-addr16, 0x67, i386|No64, Size16|IgnoreSize|NoSuf|IsPrefix, {} ++addr16, 0x67, i386&No64, Size16|IgnoreSize|NoSuf|IsPrefix, {} + addr32, 0x67, i386, Size32|IgnoreSize|NoSuf|IsPrefix, {} +-aword, 0x67, i386|No64, Size16|IgnoreSize|NoSuf|IsPrefix, {} ++aword, 0x67, i386&No64, Size16|IgnoreSize|NoSuf|IsPrefix, {} + adword, 0x67, i386, Size32|IgnoreSize|NoSuf|IsPrefix, {} + data16, 0x66, i386, Size16|IgnoreSize|NoSuf|IsPrefix, {} +-data32, 0x66, i386|No64, Size32|IgnoreSize|NoSuf|IsPrefix, {} ++data32, 0x66, i386&No64, Size32|IgnoreSize|NoSuf|IsPrefix, {} + word, 0x66, i386, Size16|IgnoreSize|NoSuf|IsPrefix, {} +-dword, 0x66, i386|No64, Size32|IgnoreSize|NoSuf|IsPrefix, {} ++dword, 0x66, i386&No64, Size32|IgnoreSize|NoSuf|IsPrefix, {} + lock, 0xf0, 0, NoSuf|IsPrefix, {} + wait, 0x9b, 0, NoSuf|IsPrefix, {} + cs, 0x2e, 0, NoSuf|IsPrefix, {} +@@ -888,18 +908,18 @@ rex.wrxb, 0x4f, x64, NoSuf|IsPrefix, {} + + // Pseudo prefixes (base_opcode == PSEUDO_PREFIX) + +- ++ rex:REX:x64, rex2:REX2:APX_F, nf:NF:APX_F, + ++ nooptimize:NoOptimize:0> + + {}, PSEUDO_PREFIX/Prefix_, , NoSuf|IsPrefix, {} + +-// 486 extensions. ++// 486 extensions (BSWAP moved elsewhere). + +-bswap, 0xfc8, i486, No_bSuf|No_wSuf|No_sSuf, { Reg32|Reg64 } +-xadd, 0xfc0, i486, W|CheckOperandSize|Modrm|No_sSuf|HLEPrefixLock, { Reg8|Reg16|Reg32|Reg64, Reg8|Reg16|Reg32|Reg64|Byte|Word|Dword|Qword|Unspecified|BaseIndex } +-cmpxchg, 0xfb0, i486, W|CheckOperandSize|Modrm|No_sSuf|HLEPrefixLock, { Reg8|Reg16|Reg32|Reg64, Reg8|Reg16|Reg32|Reg64|Byte|Word|Dword|Qword|Unspecified|BaseIndex } ++xadd, 0xfc0, i486, W|CheckOperandSize|Modrm|No_sSuf|HLEPrefixLock, { Reg8|Reg16|Reg32|Reg64, Reg8|Reg16|Reg32|Reg64|Unspecified|BaseIndex } ++cmpxchg, 0xfb0, i486, W|CheckOperandSize|Modrm|No_sSuf|HLEPrefixLock, { Reg8|Reg16|Reg32|Reg64, Reg8|Reg16|Reg32|Reg64|Unspecified|BaseIndex } + invd, 0xf08, i486, NoSuf, {} + wbinvd, 0xf09, i486, NoSuf, {} + invlpg, 0xf01/7, i486, Modrm|Anysize|IgnoreSize|NoSuf, { BaseIndex } +@@ -915,13 +935,13 @@ cmpxchg8b, 0xfc7/1, i586, Modrm|No_bSuf|No_wSuf|No_lSuf|No_sSuf|NoRex64|HLEPrefi + + // Pentium II/Pentium Pro extensions. + sysenter, 0xf34, x64, Intel64Only|NoSuf, {} +-sysenter, 0xf34, i686|No64, NoSuf, {} ++sysenter, 0xf34, i686&No64, NoSuf, {} + sysexit, 0xf35, x64, Intel64Only|No_bSuf|No_wSuf|No_sSuf, {} +-sysexit, 0xf35, i686|No64, NoSuf, {} ++sysexit, 0xf35, i686&No64, NoSuf, {} + fxsave, 0xfae/0, FXSR, Modrm|No_bSuf|No_wSuf|No_lSuf|No_sSuf, { Unspecified|BaseIndex } +-fxsave64, 0xfae/0, FXSR|x64, Modrm|NoSuf|Size64, { Unspecified|BaseIndex } ++fxsave64, 0xfae/0, FXSR&x64, Modrm|NoSuf|Size64, { Unspecified|BaseIndex } + fxrstor, 0xfae/1, FXSR, Modrm|No_bSuf|No_wSuf|No_lSuf|No_sSuf, { Unspecified|BaseIndex } +-fxrstor64, 0xfae/1, FXSR|x64, Modrm|NoSuf|Size64, { Unspecified|BaseIndex } ++fxrstor64, 0xfae/1, FXSR&x64, Modrm|NoSuf|Size64, { Unspecified|BaseIndex } + rdpmc, 0xf33, i686, NoSuf, {} + // official undefined instr. + ud2, 0xf0b, i186, NoSuf, {} +@@ -934,7 +954,8 @@ ud2b, 0xfb9, i186, Modrm|CheckOperandSize|No_bSuf|No_sSuf, { Reg16|Reg32|Reg64|U + // 3rd official undefined instr (older CPUs don't take a ModR/M byte) + ud0, 0xfff, i186, Modrm|CheckOperandSize|No_bSuf|No_sSuf, { Reg16|Reg32|Reg64|Unspecified|BaseIndex, Reg16|Reg32|Reg64 } + +-cmov, 0xf4, CMOV, Modrm|CheckOperandSize|No_bSuf|No_sSuf, { Reg16|Reg32|Reg64|Word|Dword|Qword|Unspecified|BaseIndex, Reg16|Reg32|Reg64 } ++cmov, 0x4, CMOV&APX_F, Modrm|CheckOperandSize|No_bSuf|No_sSuf|DstVVVV|EVexMap4, { Reg16|Reg32|Reg64|Unspecified|BaseIndex, Reg16|Reg32|Reg64, Reg16|Reg32|Reg64 } ++cmov, 0xf4, CMOV, Modrm|CheckOperandSize|No_bSuf|No_sSuf, { Reg16|Reg32|Reg64|Unspecified|BaseIndex, Reg16|Reg32|Reg64 } + + fcmovb, 0xda/0, i687, Modrm|NoSuf, { FloatReg, FloatAcc } + fcmovnae, 0xda/0, i687, Modrm|NoSuf, { FloatReg, FloatAcc } +@@ -992,9 +1013,9 @@ pause, 0xf390, i186, NoSuf, {} + b:0:VexW0:Byte:AVX512DQ:66:AVX512VBMI, + + w:1:VexW1:Word:AVX512F::AVX512BW> + +- ++ + + emms, 0xf77, MMX, NoSuf, {} + // These really shouldn't allow for Reg64 (movq is the right mnemonic for +@@ -1002,21 +1023,21 @@ emms, 0xf77, MMX, NoSuf, {} + // spec). AMD's spec, having been in existence for much longer, failed to + // recognize that and specified movd for 32- and 64-bit operations. + movd, 0x666e, AVX, D|Modrm|Vex128|Space0F|VexW0|NoSuf|SSE2AVX, { Reg32|Unspecified|BaseIndex, RegXMM } +-movd, 0x666e, AVX|x64, D|Modrm|Vex=1|Space0F|VexW1|NoSuf|Size64|SSE2AVX, { Reg64|BaseIndex, RegXMM } ++movd, 0x666e, AVX&x64, D|Modrm|Vex=1|Space0F|VexW1|NoSuf|Size64|SSE2AVX, { Reg64|BaseIndex, RegXMM } + movd, 0x660f6e, SSE2, D|Modrm|IgnoreSize|NoSuf, { Reg32|Unspecified|BaseIndex, RegXMM } +-movd, 0x660f6e, SSE2|x64, D|Modrm|NoSuf|Size64, { Reg64|BaseIndex, RegXMM } ++movd, 0x660f6e, SSE2&x64, D|Modrm|NoSuf|Size64, { Reg64|BaseIndex, RegXMM } + // The MMX templates have to remain after at least the SSE2AVX ones. + movd, 0xf6e, MMX, D|Modrm|IgnoreSize|NoSuf, { Reg32|Unspecified|BaseIndex, RegMMX } +-movd, 0xf6e, MMX|x64, D|Modrm|NoSuf|Size64, { Reg64|BaseIndex, RegMMX } +-movq, 0xf37e, AVX, Load|Modrm|Vex=1|Space0F|VexWIG|NoSuf|SSE2AVX, { Qword|Unspecified|BaseIndex|RegXMM, RegXMM } +-movq, 0x66d6, AVX, Modrm|Vex=1|Space0F|VexWIG|NoSuf|SSE2AVX, { RegXMM, Qword|Unspecified|BaseIndex|RegXMM } +-movq, 0x666e, AVX|x64, D|Modrm|Vex=1|Space0F|VexW1|NoSuf|Size64|SSE2AVX, { Reg64|Unspecified|BaseIndex, RegXMM } ++movd, 0xf6e, MMX&x64, D|Modrm|NoSuf|Size64, { Reg64|BaseIndex, RegMMX } ++movq, 0xf37e, AVX, Load|Modrm|Vex128|Space0F|VexW0|NoSuf|SSE2AVX, { Qword|Unspecified|BaseIndex|RegXMM, RegXMM } ++movq, 0x66d6, AVX, Modrm|Vex128|Space0F|VexW0|NoSuf|SSE2AVX, { RegXMM, Qword|Unspecified|BaseIndex|RegXMM } ++movq, 0x666e, AVX&x64, D|Modrm|Vex=1|Space0F|VexW1|NoSuf|Size64|SSE2AVX, { Reg64|Unspecified|BaseIndex, RegXMM } + movq, 0xf30f7e, SSE2, Load|Modrm|NoSuf, { Unspecified|Qword|BaseIndex|RegXMM, RegXMM } + movq, 0x660fd6, SSE2, Modrm|NoSuf, { RegXMM, Unspecified|Qword|BaseIndex|RegXMM } +-movq, 0x660f6e, SSE2|x64, D|Modrm|NoSuf|Size64, { Reg64|Unspecified|BaseIndex, RegXMM } ++movq, 0x660f6e, SSE2&x64, D|Modrm|NoSuf|Size64, { Reg64|Unspecified|BaseIndex, RegXMM } + // The MMX templates have to remain after at least the SSE2AVX ones. + movq, 0xf6f, MMX, D|Modrm|NoSuf, { Unspecified|Qword|BaseIndex|RegMMX, RegMMX } +-movq, 0xf6e, MMX|x64, D|Modrm|NoSuf|Size64, { Reg64|Unspecified|BaseIndex, RegMMX } ++movq, 0xf6e, MMX&x64, D|Modrm|NoSuf|Size64, { Reg64|Unspecified|BaseIndex, RegMMX } + packssdw, 0x0f6b, , Modrm||NoSuf, { ||Unspecified|BaseIndex, } + packsswb, 0x0f63, , Modrm||NoSuf, { ||Unspecified|BaseIndex, } + packuswb, 0x0f67, , Modrm||NoSuf, { ||Unspecified|BaseIndex, } +@@ -1083,11 +1104,11 @@ cmpss, 0xf30fc2, , Modrm|||NoSuf, { Imm8, Dwor + comiss, 0x0f2f, , Modrm||NoSuf, { Dword|Unspecified|BaseIndex|RegXMM, RegXMM } + cvtpi2ps, 0xf2a, SSE, Modrm|NoSuf, { Qword|Unspecified|BaseIndex|RegMMX, RegXMM } + cvtps2pi, 0xf2d, SSE, Modrm|NoSuf, { Qword|Unspecified|BaseIndex|RegXMM, RegMMX } +-cvtsi2ss, 0xf30f2a, |No64, Modrm|||IgnoreSize|No_bSuf|No_wSuf|No_sSuf|No_qSuf, { Reg32|Unspecified|BaseIndex, RegXMM } +-cvtsi2ss, 0xf32a, AVX|x64, Modrm|Vex=3|Space0F|VexVVVV|IgnoreSize|No_bSuf|No_wSuf|No_sSuf|SSE2AVX|ATTSyntax, { Reg32|Reg64|Dword|Qword|Unspecified|BaseIndex, RegXMM } +-cvtsi2ss, 0xf32a, AVX|x64, Modrm|Vex=3|Space0F|VexVVVV|No_bSuf|No_wSuf|No_sSuf|SSE2AVX|IntelSyntax, { Reg32|Reg64|Dword|Qword|Unspecified|BaseIndex, RegXMM } +-cvtsi2ss, 0xf30f2a, SSE|x64, Modrm|IgnoreSize|No_bSuf|No_wSuf|No_sSuf|ATTSyntax, { Reg32|Reg64|Dword|Qword|Unspecified|BaseIndex, RegXMM } +-cvtsi2ss, 0xf30f2a, SSE|x64, Modrm|No_bSuf|No_wSuf|No_sSuf|IntelSyntax, { Reg32|Reg64|Dword|Qword|Unspecified|BaseIndex, RegXMM } ++cvtsi2ss, 0xf30f2a, &No64, Modrm|||IgnoreSize|No_bSuf|No_wSuf|No_sSuf|No_qSuf, { Reg32|Unspecified|BaseIndex, RegXMM } ++cvtsi2ss, 0xf32a, AVX&x64, Modrm|Vex=3|Space0F|VexVVVV|IgnoreSize|No_bSuf|No_wSuf|No_sSuf|SSE2AVX|ATTSyntax, { Reg32|Reg64|Unspecified|BaseIndex, RegXMM } ++cvtsi2ss, 0xf32a, AVX&x64, Modrm|Vex=3|Space0F|VexVVVV|No_bSuf|No_wSuf|No_sSuf|SSE2AVX|IntelSyntax, { Reg32|Reg64|Unspecified|BaseIndex, RegXMM } ++cvtsi2ss, 0xf30f2a, SSE&x64, Modrm|IgnoreSize|No_bSuf|No_wSuf|No_sSuf|ATTSyntax, { Reg32|Reg64|Unspecified|BaseIndex, RegXMM } ++cvtsi2ss, 0xf30f2a, SSE&x64, Modrm|No_bSuf|No_wSuf|No_sSuf|IntelSyntax, { Reg32|Reg64|Unspecified|BaseIndex, RegXMM } + cvtss2si, 0xf32d, AVX, Modrm|VexLIG|Space0F|No_bSuf|No_wSuf|No_sSuf|SSE2AVX, { Dword|Unspecified|BaseIndex|RegXMM, Reg32|Reg64 } + cvtss2si, 0xf30f2d, SSE, Modrm|IgnoreSize|No_bSuf|No_wSuf|No_sSuf, { Dword|Unspecified|BaseIndex|RegXMM, Reg32|Reg64 } + cvttps2pi, 0xf2c, SSE, Modrm|NoSuf, { Qword|Unspecified|BaseIndex|RegXMM, RegMMX } +@@ -1178,11 +1199,11 @@ comisd, 0x660f2f, , Modrm||NoSuf, { Qword|Unspecified + cvtpi2pd, 0x660f2a, SSE2, Modrm|NoSuf, { RegMMX, RegXMM } + cvtpi2pd, 0xf3e6, AVX, Modrm|Vex|Space0F|VexW0|NoSuf|SSE2AVX, { Qword|Unspecified|BaseIndex, RegXMM } + cvtpi2pd, 0x660f2a, SSE2, Modrm|NoSuf, { Qword|Unspecified|BaseIndex, RegXMM } +-cvtsi2sd, 0xf20f2a, |No64, Modrm|IgnoreSize|||No_bSuf|No_wSuf|No_sSuf|No_qSuf, { Reg32|Unspecified|BaseIndex, RegXMM } +-cvtsi2sd, 0xf22a, AVX|x64, Modrm|Vex=3|Space0F|VexVVVV|IgnoreSize|No_bSuf|No_wSuf|No_sSuf|SSE2AVX|ATTSyntax, { Reg32|Reg64|Dword|Qword|Unspecified|BaseIndex, RegXMM } +-cvtsi2sd, 0xf22a, AVX|x64, Modrm|Vex=3|Space0F|VexVVVV|No_bSuf|No_wSuf|No_sSuf|SSE2AVX|IntelSyntax, { Reg32|Reg64|Dword|Qword|Unspecified|BaseIndex, RegXMM } +-cvtsi2sd, 0xf20f2a, SSE2|x64, Modrm|IgnoreSize|No_bSuf|No_wSuf|No_sSuf|ATTSyntax, { Reg32|Reg64|Dword|Qword|Unspecified|BaseIndex, RegXMM } +-cvtsi2sd, 0xf20f2a, SSE2|x64, Modrm|No_bSuf|No_wSuf|No_sSuf|IntelSyntax, { Reg32|Reg64|Dword|Qword|Unspecified|BaseIndex, RegXMM } ++cvtsi2sd, 0xf20f2a, &No64, Modrm|IgnoreSize|||No_bSuf|No_wSuf|No_sSuf|No_qSuf, { Reg32|Unspecified|BaseIndex, RegXMM } ++cvtsi2sd, 0xf22a, AVX&x64, Modrm|Vex=3|Space0F|VexVVVV|IgnoreSize|No_bSuf|No_wSuf|No_sSuf|SSE2AVX|ATTSyntax, { Reg32|Reg64|Unspecified|BaseIndex, RegXMM } ++cvtsi2sd, 0xf22a, AVX&x64, Modrm|Vex=3|Space0F|VexVVVV|No_bSuf|No_wSuf|No_sSuf|SSE2AVX|IntelSyntax, { Reg32|Reg64|Unspecified|BaseIndex, RegXMM } ++cvtsi2sd, 0xf20f2a, SSE2&x64, Modrm|IgnoreSize|No_bSuf|No_wSuf|No_sSuf|ATTSyntax, { Reg32|Reg64|Unspecified|BaseIndex, RegXMM } ++cvtsi2sd, 0xf20f2a, SSE2&x64, Modrm|No_bSuf|No_wSuf|No_sSuf|IntelSyntax, { Reg32|Reg64|Unspecified|BaseIndex, RegXMM } + divpd, 0x660f5e, , Modrm|||NoSuf, { RegXMM|Unspecified|BaseIndex, RegXMM } + divsd, 0xf20f5e, , Modrm|||NoSuf, { Qword|Unspecified|BaseIndex|RegXMM, RegXMM } + maxpd, 0x660f5f, , Modrm|||NoSuf, { RegXMM|Unspecified|BaseIndex, RegXMM } +@@ -1271,7 +1292,7 @@ fisttpll, 0xdd/1, FISTTP, Modrm|NoSuf|ATTSyntax, { Unspecified|BaseIndex } + + // CMPXCHG16B instruction. + +-cmpxchg16b, 0xfc7/1, CX16|x64, Modrm|NoSuf|Size64|LockPrefixOk, { Oword|Unspecified|BaseIndex } ++cmpxchg16b, 0xfc7/1, CX16, Modrm|NoSuf|Size64|LockPrefixOk, { Oword|Unspecified|BaseIndex } + + // MONITOR instructions. + +@@ -1281,7 +1302,7 @@ monitor, 0xf01c8, MONITOR, NoSuf, {} + // all modes. + monitor, 0xf01c8, MONITOR, AddrPrefixOpReg|NoSuf, { Acc|Word|Dword|Qword, RegC|Dword, RegD|Dword } + // The 64-bit form exists only for compatibility with older gas. +-monitor, 0xf01c8, MONITOR|x64, AddrPrefixOpReg|NoSuf, { Acc|Dword|Qword, RegC|Qword, RegD|Qword } ++monitor, 0xf01c8, MONITOR&x64, AddrPrefixOpReg|NoSuf, { Acc|Dword|Qword, RegC|Qword, RegD|Qword } + mwait, 0xf01c9, MONITOR, NoSuf, {} + // mwait is very special. AX and CX are always 32 bits. + // The 64-bit form exists only for compatibility with older gas. +@@ -1295,10 +1316,10 @@ vmlaunch, 0xf01c2, VMX, NoSuf, {} + vmresume, 0xf01c3, VMX, NoSuf, {} + vmptrld, 0xfc7/6, VMX, Modrm|NoSuf, { Qword|Unspecified|BaseIndex } + vmptrst, 0xfc7/7, VMX, Modrm|NoSuf, { Qword|Unspecified|BaseIndex } +-vmread, 0xf78, VMX|No64, Modrm|IgnoreSize|No_bSuf|No_wSuf|No_sSuf|No_qSuf, { Reg32, Reg32|Unspecified|BaseIndex } +-vmread, 0xf78, VMX|x64, Modrm|No_bSuf|No_wSuf|No_lSuf|No_sSuf|NoRex64, { Reg64, Reg64|Qword|Unspecified|BaseIndex } +-vmwrite, 0xf79, VMX|No64, Modrm|IgnoreSize|No_bSuf|No_wSuf|No_sSuf|No_qSuf, { Reg32|Unspecified|BaseIndex, Reg32 } +-vmwrite, 0xf79, VMX|x64, Modrm|No_bSuf|No_wSuf|No_lSuf|No_sSuf|NoRex64, { Reg64|Qword|Unspecified|BaseIndex, Reg64 } ++vmread, 0xf78, VMX&No64, Modrm|IgnoreSize|No_bSuf|No_wSuf|No_sSuf|No_qSuf, { Reg32, Reg32|Unspecified|BaseIndex } ++vmread, 0xf78, VMX&x64, Modrm|No_bSuf|No_wSuf|No_lSuf|No_sSuf|NoRex64, { Reg64, Reg64|Unspecified|BaseIndex } ++vmwrite, 0xf79, VMX&No64, Modrm|IgnoreSize|No_bSuf|No_wSuf|No_sSuf|No_qSuf, { Reg32|Unspecified|BaseIndex, Reg32 } ++vmwrite, 0xf79, VMX&x64, Modrm|No_bSuf|No_wSuf|No_lSuf|No_sSuf|NoRex64, { Reg64|Unspecified|BaseIndex, Reg64 } + vmxoff, 0xf01c4, VMX, NoSuf, {} + vmxon, 0xf30fc7/6, VMX, Modrm|NoSuf, { Qword|Unspecified|BaseIndex } + +@@ -1312,15 +1333,18 @@ getsec, 0xf37, SMX, NoSuf, {} + + // EPT instructions. + +-invept, 0x660f3880, EPT|No64, Modrm|IgnoreSize|NoSuf, { Oword|Unspecified|BaseIndex, Reg32 } +-invept, 0x660f3880, EPT|x64, Modrm|NoSuf|NoRex64, { Oword|Unspecified|BaseIndex, Reg64 } +-invvpid, 0x660f3881, EPT|No64, Modrm|IgnoreSize|NoSuf, { Oword|Unspecified|BaseIndex, Reg32 } +-invvpid, 0x660f3881, EPT|x64, Modrm|NoSuf|NoRex64, { Oword|Unspecified|BaseIndex, Reg64 } ++invept, 0x660f3880, EPT&No64, Modrm|IgnoreSize|NoSuf, { Oword|Unspecified|BaseIndex, Reg32 } ++invept, 0x660f3880, EPT&x64, Modrm|NoSuf|NoRex64, { Oword|Unspecified|BaseIndex, Reg64 } ++invept, 0xf3f0, EPT&APX_F, Modrm|NoSuf|EVexMap4|VexWIG, { Oword|Unspecified|BaseIndex, Reg64 } ++invvpid, 0x660f3881, EPT&No64, Modrm|IgnoreSize|NoSuf, { Oword|Unspecified|BaseIndex, Reg32 } ++invvpid, 0x660f3881, EPT&x64, Modrm|NoSuf|NoRex64, { Oword|Unspecified|BaseIndex, Reg64 } ++invvpid, 0xf3f1, EPT&APX_F, Modrm|NoSuf|EVexMap4|VexWIG, { Oword|Unspecified|BaseIndex, Reg64 } + + // INVPCID instruction + +-invpcid, 0x660f3882, INVPCID|No64, Modrm|IgnoreSize|NoSuf, { Oword|Unspecified|BaseIndex, Reg32 } +-invpcid, 0x660f3882, INVPCID|x64, Modrm|NoSuf|NoRex64, { Oword|Unspecified|BaseIndex, Reg64 } ++invpcid, 0x660f3882, INVPCID&No64, Modrm|IgnoreSize|NoSuf, { Oword|Unspecified|BaseIndex, Reg32 } ++invpcid, 0x660f3882, INVPCID&x64, Modrm|NoSuf|NoRex64, { Oword|Unspecified|BaseIndex, Reg64 } ++invpcid, 0xf3f2, INVPCID&APX_F, Modrm|NoSuf|EVexMap4|VexWIG, { Oword|Unspecified|BaseIndex, Reg64 } + + // SSSE3 instructions. + +@@ -1355,10 +1379,10 @@ blendvp, 0x664a | , AVX, Modrm|Vex128|Space0F3A|VexVVVV|VexW0|NoSuf| + blendvp, 0x660f3814 | , SSE4_1, Modrm|NoSuf, { Acc|Xmmword, RegXMM|Unspecified|BaseIndex, RegXMM } + blendvp, 0x660f3814 | , SSE4_1, Modrm|NoSuf, { RegXMM|Unspecified|BaseIndex, RegXMM } + dpp, 0x660f3a40 | , , Modrm|||NoSuf, { Imm8|Imm8S, RegXMM|Unspecified|BaseIndex, RegXMM } +-extractps, 0x6617, AVX, Modrm|Vex|Space0F3A|VexWIG|NoSuf|SSE2AVX, { Imm8, RegXMM, Reg32|Dword|Unspecified|BaseIndex } +-extractps, 0x6617, AVX|x64, RegMem|Vex|Space0F3A|VexWIG|NoSuf|SSE2AVX, { Imm8, RegXMM, Reg64 } +-extractps, 0x660f3a17, SSE4_1, Modrm|IgnoreSize|NoSuf, { Imm8, RegXMM, Reg32|Dword|Unspecified|BaseIndex } +-extractps, 0x660f3a17, SSE4_1|x64, RegMem|NoSuf|NoRex64, { Imm8, RegXMM, Reg64 } ++extractps, 0x6617, AVX, Modrm|Vex128|Space0F3A|VexW0|NoSuf|SSE2AVX, { Imm8, RegXMM, Reg32|Unspecified|BaseIndex } ++extractps, 0x6617, AVX&x64, RegMem|Vex128|Space0F3A|VexW1|NoSuf|SSE2AVX, { Imm8, RegXMM, Reg64 } ++extractps, 0x660f3a17, SSE4_1, Modrm|IgnoreSize|NoSuf, { Imm8, RegXMM, Reg32|Unspecified|BaseIndex } ++extractps, 0x660f3a17, SSE4_1&x64, RegMem|NoSuf|NoRex64, { Imm8, RegXMM, Reg64 } + insertps, 0x660f3a21, , Modrm|||NoSuf, { Imm8, Dword|Unspecified|BaseIndex|RegXMM, RegXMM } + movntdqa, 0x660f382a, , Modrm||NoSuf, { Xmmword|Unspecified|BaseIndex, RegXMM } + mpsadbw, 0x660f3a42, , Modrm|||NoSuf, { Imm8|Imm8S, RegXMM|Unspecified|BaseIndex, RegXMM } +@@ -1372,14 +1396,14 @@ pcmpeqq, 0x660f3829, , Modrm|||NoSuf|O + pextr, 0x660f3a14 | , , RegMem||NoSuf|IgnoreSize|NoRex64, { Imm8, RegXMM, Reg32|Reg64 } + pextr, 0x660f3a14 | , , Modrm||NoSuf, { Imm8, RegXMM, |Unspecified|BaseIndex } + pextrd, 0x660f3a16, , Modrm||NoSuf|IgnoreSize, { Imm8, RegXMM, Reg32|Unspecified|BaseIndex } +-pextrq, 0x6616, AVX|x64, Modrm|Vex|Space0F3A|VexW1|NoSuf|SSE2AVX, { Imm8, RegXMM, Reg64|Unspecified|BaseIndex } +-pextrq, 0x660f3a16, SSE4_1|x64, Modrm|Size64|NoSuf, { Imm8, RegXMM, Reg64|Unspecified|BaseIndex } ++pextrq, 0x6616, AVX&x64, Modrm|Vex|Space0F3A|VexW1|NoSuf|SSE2AVX, { Imm8, RegXMM, Reg64|Unspecified|BaseIndex } ++pextrq, 0x660f3a16, SSE4_1&x64, Modrm|Size64|NoSuf, { Imm8, RegXMM, Reg64|Unspecified|BaseIndex } + phminposuw, 0x660f3841, , Modrm||NoSuf, { RegXMM|Unspecified|BaseIndex, RegXMM } + pinsrb, 0x660f3a20, , Modrm|||NoSuf|IgnoreSize|NoRex64, { Imm8, Reg32|Reg64, RegXMM } + pinsrb, 0x660f3a20, , Modrm|||NoSuf, { Imm8, Byte|Unspecified|BaseIndex, RegXMM } + pinsrd, 0x660f3a22, , Modrm|||NoSuf|IgnoreSize, { Imm8, Reg32|Unspecified|BaseIndex, RegXMM } +-pinsrq, 0x6622, AVX|x64, Modrm|Vex|Space0F3A|VexVVVV|VexW1|NoSuf|SSE2AVX, { Imm8, Reg64|Unspecified|BaseIndex, RegXMM } +-pinsrq, 0x660f3a22, SSE4_1|x64, Modrm|Size64|NoSuf, { Imm8, Reg64|Unspecified|BaseIndex, RegXMM } ++pinsrq, 0x6622, AVX&x64, Modrm|Vex|Space0F3A|VexVVVV|VexW1|NoSuf|SSE2AVX, { Imm8, Reg64|Unspecified|BaseIndex, RegXMM } ++pinsrq, 0x660f3a22, SSE4_1&x64, Modrm|Size64|NoSuf, { Imm8, Reg64|Unspecified|BaseIndex, RegXMM } + pmaxsb, 0x660f383c, , Modrm|||NoSuf, { RegXMM|Unspecified|BaseIndex, RegXMM } + pmaxsd, 0x660f383d, , Modrm|||NoSuf, { RegXMM|Unspecified|BaseIndex, RegXMM } + pmaxud, 0x660f383f, , Modrm|||NoSuf, { RegXMM|Unspecified|BaseIndex, RegXMM } +@@ -1411,33 +1435,36 @@ rounds, 0x660f3a0a | , , Modrm|| + + pcmpgtq, 0x660f3837, , Modrm|||NoSuf|Optimize, { RegXMM|Unspecified|BaseIndex, RegXMM } +-pcmpestri, 0x660f3a61, |No64, Modrm||NoSuf, { Imm8, RegXMM|Unspecified|BaseIndex, RegXMM } +-pcmpestri, 0x6661, AVX|x64, Modrm|Vex|Space0F3A|IgnoreSize|No_bSuf|No_wSuf|No_sSuf|SSE2AVX, { Imm8, Xmmword|Unspecified|BaseIndex|RegXMM, RegXMM } +-pcmpestri, 0x660f3a61, SSE4_2|x64, Modrm|IgnoreSize|No_bSuf|No_wSuf|No_sSuf, { Imm8, Xmmword|Unspecified|BaseIndex|RegXMM, RegXMM } +-pcmpestrm, 0x660f3a60, |No64, Modrm||NoSuf, { Imm8, RegXMM|Unspecified|BaseIndex, RegXMM } +-pcmpestrm, 0x6660, AVX|x64, Modrm|Vex|Space0F3A|IgnoreSize|No_bSuf|No_wSuf|No_sSuf|SSE2AVX, { Imm8, Xmmword|Unspecified|BaseIndex|RegXMM, RegXMM } +-pcmpestrm, 0x660f3a60, SSE4_2|x64, Modrm|IgnoreSize|No_bSuf|No_wSuf|No_sSuf, { Imm8, Xmmword|Unspecified|BaseIndex|RegXMM, RegXMM } ++pcmpestri, 0x660f3a61, &No64, Modrm||NoSuf, { Imm8, RegXMM|Unspecified|BaseIndex, RegXMM } ++pcmpestri, 0x6661, AVX&x64, Modrm|Vex|Space0F3A|IgnoreSize|No_bSuf|No_wSuf|No_sSuf|SSE2AVX, { Imm8, RegXMM|Unspecified|BaseIndex, RegXMM } ++pcmpestri, 0x660f3a61, SSE4_2&x64, Modrm|IgnoreSize|No_bSuf|No_wSuf|No_sSuf, { Imm8, RegXMM|Unspecified|BaseIndex, RegXMM } ++pcmpestrm, 0x660f3a60, &No64, Modrm||NoSuf, { Imm8, RegXMM|Unspecified|BaseIndex, RegXMM } ++pcmpestrm, 0x6660, AVX&x64, Modrm|Vex|Space0F3A|IgnoreSize|No_bSuf|No_wSuf|No_sSuf|SSE2AVX, { Imm8, RegXMM|Unspecified|BaseIndex, RegXMM } ++pcmpestrm, 0x660f3a60, SSE4_2&x64, Modrm|IgnoreSize|No_bSuf|No_wSuf|No_sSuf, { Imm8, RegXMM|Unspecified|BaseIndex, RegXMM } + pcmpistri, 0x660f3a63, , Modrm||NoSuf, { Imm8, RegXMM|Unspecified|BaseIndex, RegXMM } + pcmpistrm, 0x660f3a62, , Modrm||NoSuf, { Imm8, RegXMM|Unspecified|BaseIndex, RegXMM } + crc32, 0xf20f38f0, SSE4_2, W|Modrm|No_sSuf|No_qSuf, { Reg8|Reg16|Reg32|Unspecified|BaseIndex, Reg32 } +-crc32, 0xf20f38f0, SSE4_2|x64, W|Modrm|No_wSuf|No_lSuf|No_sSuf, { Reg8|Reg64|Unspecified|BaseIndex, Reg64 } ++crc32, 0xf20f38f0, SSE4_2&x64, W|Modrm|No_wSuf|No_lSuf|No_sSuf, { Reg8|Reg64|Unspecified|BaseIndex, Reg64 } ++crc32, 0xf0, APX_F, W|Modrm|No_sSuf|No_qSuf|EVexMap4, { Reg8|Reg16|Reg32|Unspecified|BaseIndex, Reg32 } ++crc32, 0xf0, APX_F, W|Modrm|No_wSuf|No_lSuf|No_sSuf|EVexMap4, { Reg8|Reg64|Unspecified|BaseIndex, Reg64 } + + // xsave/xrstor New Instructions. + +-xsave, 0xfae/4, Xsave, Modrm|No_bSuf|No_wSuf|No_lSuf|No_sSuf, { Unspecified|BaseIndex } +-xsave64, 0xfae/4, Xsave|x64, Modrm|NoSuf|Size64, { Unspecified|BaseIndex } +-xrstor, 0xfae/5, Xsave, Modrm|No_bSuf|No_wSuf|No_lSuf|No_sSuf, { Unspecified|BaseIndex } +-xrstor64, 0xfae/5, Xsave|x64, Modrm|NoSuf|Size64, { Unspecified|BaseIndex } ++xsave, 0xfae/4, Xsave, Modrm|No_bSuf|No_wSuf|No_lSuf|No_sSuf|NoEgpr, { Unspecified|BaseIndex } ++xsave64, 0xfae/4, Xsave&x64, Modrm|NoSuf|Size64|NoEgpr, { Unspecified|BaseIndex } ++xrstor, 0xfae/5, Xsave, Modrm|No_bSuf|No_wSuf|No_lSuf|No_sSuf|NoEgpr, { Unspecified|BaseIndex } ++xrstor64, 0xfae/5, Xsave&x64, Modrm|NoSuf|Size64|NoEgpr, { Unspecified|BaseIndex } + xgetbv, 0xf01d0, Xsave, NoSuf, {} + xsetbv, 0xf01d1, Xsave, NoSuf, {} + + // xsaveopt +-xsaveopt, 0xfae/6, Xsaveopt, Modrm|No_bSuf|No_wSuf|No_lSuf|No_sSuf, { Unspecified|BaseIndex } +-xsaveopt64, 0xfae/6, Xsaveopt|x64, Modrm|NoSuf|Size64, { Unspecified|BaseIndex } ++ ++xsaveopt, 0xfae/6, Xsaveopt, Modrm|No_bSuf|No_wSuf|No_lSuf|No_sSuf|NoEgpr, { Unspecified|BaseIndex } ++xsaveopt64, 0xfae/6, Xsaveopt&x64, Modrm|NoSuf|Size64|NoEgpr, { Unspecified|BaseIndex } + + // AES instructions. + +- ++ + + aesdec, 0x660f38de, AES, Modrm|||NoSuf, { RegXMM|Unspecified|BaseIndex, RegXMM } + aesdeclast, 0x660f38df, AES, Modrm|||NoSuf, { RegXMM|Unspecified|BaseIndex, RegXMM } +@@ -1448,7 +1475,7 @@ aeskeygenassist, 0x660f3adf, AES, Modrm||NoSuf, { Imm8, + + // PCLMULQDQ + +- ++ + + pclmulqdq, 0x660f3a44, PCLMULQDQ, Modrm||NoSuf, { Imm8|Imm8S, RegXMM|Unspecified|BaseIndex, RegXMM } + pclmullqlqdq, 0x660f3a44/0x00, PCLMULQDQ, Modrm||NoSuf|ImmExt, { RegXMM|Unspecified|BaseIndex, RegXMM } +@@ -1458,7 +1485,7 @@ pclmulhqhqdq, 0x660f3a44/0x11, PCLMULQDQ, Modrm| ++ + + gf2p8affineqb, 0x660f3ace, GFNI, Modrm||NoSuf, { Imm8, RegXMM|Unspecified|BaseIndex, RegXMM } + gf2p8affineinvqb, 0x660f3acf, GFNI, Modrm||NoSuf, { Imm8, RegXMM|Unspecified|BaseIndex, RegXMM } +@@ -1477,6 +1504,9 @@ gf2p8mulb, 0x660f38cf, GFNI, Modrm||NoSuf, { RegXMM|Uns + true_us:1f:C> + + // is used for VEX instructions with x/y suffixes. ++// NOTE: The order of the "unnamed" ($-prefixed) entries here needs to remain ++// in sync with , for match_template()'s EVEX-to-VEX lowering to ++// continue to work. + , 0x55, AVX, Modrm|Vex|Space0F|VexVVVV|VexWIG|CheckOperandSiz + vandp, 0x54, AVX, Modrm|C|Vex|Space0F|VexVVVV|VexWIG|CheckOperandSize|NoSuf, { Unspecified|BaseIndex|RegXMM|RegYMM, RegXMM|RegYMM, RegXMM|RegYMM } + vblendp, 0x660c | , AVX, Modrm|Vex|Space0F3A|VexVVVV|VexWIG|CheckOperandSize|NoSuf, { Imm8|Imm8S, Unspecified|BaseIndex|RegXMM|RegYMM, RegXMM|RegYMM, RegXMM|RegYMM } + vblendvp, 0x664a | , AVX, Modrm|Vex|Space0F3A|VexVVVV|VexW0|CheckOperandSize|NoSuf, { RegXMM|RegYMM, Unspecified|BaseIndex|RegXMM|RegYMM, RegXMM|RegYMM, RegXMM|RegYMM } +-vbroadcastf128, 0x661a, AVX, Modrm|Vex=2|Space0F38|VexW=1|NoSuf, { Xmmword|Unspecified|BaseIndex, RegYMM } ++vbroadcastf128, 0x661a, AVX, Modrm|Vex256|Space0F38|VexW0|NoSuf, { Xmmword|Unspecified|BaseIndex, RegYMM } ++// vbroadcastf32x4 in disguise (see vround{p,s}{s,d} comment) ++vbroadcastf128, 0x661a, APX_F&AVX512VL, Modrm|EVex256|Space0F38|VexW0|Disp8MemShift=4|NoSuf, { Xmmword|Unspecified|BaseIndex, RegYMM } + vbroadcastsd, 0x6619, AVX, Modrm|Vex256|Space0F38|VexW0|NoSuf, { Qword|Unspecified|BaseIndex, RegYMM } + vbroadcastss, 0x6618, AVX, Modrm|Vex128|Space0F38|VexW0|NoSuf, { Dword|Unspecified|BaseIndex, RegXMM|RegYMM } + vcmpp, 0xc2/0x, AVX, Modrm||Vex|Space0F|VexVVVV|VexWIG|CheckOperandSize|NoSuf|ImmExt, { RegXMM|RegYMM|Unspecified|BaseIndex, RegXMM|RegYMM, RegXMM|RegYMM } +@@ -1519,14 +1551,18 @@ vdivp, 0x5e, AVX, Modrm|Vex|Space0F|VexVVVV|VexWIG|CheckOperandSize + vdivs, 0x5e, AVX, Modrm|VexLIG|Space0F|VexVVVV|VexWIG|NoSuf, { |Unspecified|BaseIndex|RegXMM, RegXMM, RegXMM } + vdppd, 0x6641, AVX, Modrm|Vex|Space0F3A|VexVVVV|VexWIG|NoSuf, { Imm8|Imm8S, Unspecified|BaseIndex|RegXMM, RegXMM, RegXMM } + vdpps, 0x6640, AVX, Modrm|Vex|Space0F3A|VexVVVV|VexWIG|CheckOperandSize|NoSuf, { Imm8|Imm8S, Unspecified|BaseIndex|RegXMM|RegYMM, RegXMM|RegYMM, RegXMM|RegYMM } +-vextractf128, 0x6619, AVX, Modrm|Vex=2|Space0F3A|VexW=1|NoSuf, { Imm8, RegYMM, Unspecified|BaseIndex|RegXMM } +-vextractps, 0x6617, AVX|AVX512F, Modrm|Vex128|EVex128|Space0F3A|VexWIG|Disp8MemShift=2|NoSuf, { Imm8, RegXMM, Reg32|Dword|Unspecified|BaseIndex } +-vextractps, 0x6617, AVX|AVX512F|x64, RegMem|Vex128|EVex128|Space0F3A|VexWIG|NoSuf, { Imm8, RegXMM, Reg64 } ++vextractf128, 0x6619, AVX, Modrm|Vex256|Space0F3A|VexW0|NoSuf, { Imm8, RegYMM, Unspecified|BaseIndex|RegXMM } ++// vextractf32x4 in disguise (see vround{p,s}{s,d} comment) ++vextractf128, 0x6619, APX_F&AVX512VL, Modrm|EVex256|Space0F3A|VexW0|Disp8MemShift=4|NoSuf, { Imm8, RegYMM, Xmmword|Unspecified|BaseIndex } ++vextractps, 0x6617, AVX|AVX512F, Modrm|Vex128|EVex128|Space0F3A|VexWIG|Disp8MemShift=2|NoSuf, { Imm8, RegXMM, Reg32|Unspecified|BaseIndex } ++vextractps, 0x6617, x64&(AVX|AVX512F), RegMem|Vex128|EVex128|Space0F3A|VexWIG|NoSuf, { Imm8, RegXMM, Reg64 } + vhaddpd, 0x667c, AVX, Modrm|Vex|Space0F|VexVVVV|VexWIG|CheckOperandSize|NoSuf, { Unspecified|BaseIndex|RegXMM|RegYMM, RegXMM|RegYMM, RegXMM|RegYMM } + vhaddps, 0xf27c, AVX, Modrm|Vex|Space0F|VexVVVV|VexWIG|CheckOperandSize|NoSuf, { Unspecified|BaseIndex|RegXMM|RegYMM, RegXMM|RegYMM, RegXMM|RegYMM } + vhsubpd, 0x667d, AVX, Modrm|Vex|Space0F|VexVVVV|VexWIG|CheckOperandSize|NoSuf, { Unspecified|BaseIndex|RegXMM|RegYMM, RegXMM|RegYMM, RegXMM|RegYMM } + vhsubps, 0xf27d, AVX, Modrm|Vex|Space0F|VexVVVV|VexWIG|CheckOperandSize|NoSuf, { Unspecified|BaseIndex|RegXMM|RegYMM, RegXMM|RegYMM, RegXMM|RegYMM } + vinsertf128, 0x6618, AVX, Modrm|Vex256|Space0F3A|VexVVVV|VexW0|NoSuf, { Imm8, Unspecified|BaseIndex|RegXMM, RegYMM, RegYMM } ++// vinsertf32x4 in disguise (see vround{p,s}{s,d} comment) ++vinsertf128, 0x6618, APX_F&AVX512VL, Modrm|EVex256|Space0F3A|VexVVVV|VexW0|Disp8MemShift=4|NoSuf, { Imm8, Xmmword|Unspecified|BaseIndex, RegYMM, RegYMM } + vinsertps, 0x6621, AVX, Modrm|Vex|Space0F3A|VexVVVV|VexWIG|NoSuf, { Imm8, Dword|Unspecified|BaseIndex|RegXMM, RegXMM, RegXMM } + vlddqu, 0xf2f0, AVX, Modrm|Vex|Space0F|VexWIG|CheckOperandSize|NoSuf, { Xmmword|Ymmword|Unspecified|BaseIndex, RegXMM|RegYMM } + vldmxcsr, 0xae/2, AVX, Modrm|Vex128|Space0F|VexWIG|NoSuf, { Dword|Unspecified|BaseIndex } +@@ -1544,7 +1580,7 @@ vmovap, 0x28, AVX, D|Modrm|Vex|Space0F|VexWIG|CheckOperandSize|NoSu + // support assembler for AMD64, we accept 64bit operand on vmovd so + // that we can use one template for both SSE and AVX instructions. + vmovd, 0x666e, AVX|AVX512F, D|Modrm|Vex128|EVex128|Space0F|Disp8MemShift=2|NoSuf, { Reg32|Unspecified|BaseIndex, RegXMM } +-vmovd, 0x667e, AVX|x64, D|RegMem|Vex=1|Space0F|VexW=2|NoSuf|Size64, { RegXMM, Reg64 } ++vmovd, 0x667e, AVX&x64, D|RegMem|Vex=1|Space0F|VexW=2|NoSuf|Size64, { RegXMM, Reg64 } + vmovddup, 0xf212, AVX, Modrm|Vex|Space0F|VexWIG|NoSuf, { Qword|Unspecified|BaseIndex|RegXMM, RegXMM } + vmovddup, 0xf212, AVX, Modrm|Vex=2|Space0F|VexWIG|NoSuf, { Unspecified|BaseIndex|RegYMM, RegYMM } + vmovdqa, 0x666f, AVX, D|Modrm|Vex|Space0F|VexWIG|CheckOperandSize|NoSuf, { Unspecified|BaseIndex|RegXMM|RegYMM, RegXMM|RegYMM } +@@ -1561,7 +1597,7 @@ vmovntdqa, 0x662a, AVX|AVX2, Modrm|Vex|Space0F38|VexWIG|CheckOperandSize|NoSuf, + vmovntp, 0x2b, AVX, Modrm|Vex|Space0F|VexWIG|CheckOperandSize|NoSuf, { RegXMM|RegYMM, Xmmword|Ymmword|Unspecified|BaseIndex } + vmovq, 0xf37e, AVX, Load|Modrm|Vex=1|Space0F|VexWIG|NoSuf, { Qword|Unspecified|BaseIndex|RegXMM, RegXMM } + vmovq, 0x66d6, AVX, Modrm|Vex=1|Space0F|VexWIG|NoSuf, { RegXMM, Qword|Unspecified|BaseIndex|RegXMM } +-vmovq, 0x666e, AVX|AVX512F|x64, D|Modrm|Vex128|EVex128|Space0F|VexW1|Disp8MemShift=3|NoSuf, { Reg64|Unspecified|BaseIndex, RegXMM } ++vmovq, 0x666e, x64&(AVX|AVX512F), D|Modrm|Vex128|EVex128|Space0F|VexW1|Disp8MemShift=3|NoSuf, { Reg64|Unspecified|BaseIndex, RegXMM } + vmovs, 0x10, AVX, D|Modrm|VexLIG|Space0F|VexWIG|NoSuf, { |Unspecified|BaseIndex, RegXMM } + vmovs, 0x10, AVX, D|Modrm|VexLIG|Space0F|VexVVVV|VexWIG|NoSuf, { RegXMM, RegXMM, RegXMM } + vmovshdup, 0xf316, AVX, Modrm|Vex|Space0F|VexWIG|CheckOperandSize|NoSuf, { Unspecified|BaseIndex|RegXMM|RegYMM, RegXMM|RegYMM } +@@ -1591,10 +1627,10 @@ vpblendw, 0x660e, AVX|AVX2, Modrm|Vex|Space0F3A|VexVVVV|VexWIG|CheckOperandSize| + vpcmpeq, 0x6674 | , AVX|AVX2, Modrm|C|Vex|Space0F|VexVVVV|VexWIG|CheckOperandSize|NoSuf, { Unspecified|BaseIndex|RegXMM|RegYMM, RegXMM|RegYMM, RegXMM|RegYMM } + vpcmpeqd, 0x6676, AVX|AVX2, Modrm|C|Vex|Space0F|VexVVVV|VexWIG|CheckOperandSize|NoSuf, { Unspecified|BaseIndex|RegXMM|RegYMM, RegXMM|RegYMM, RegXMM|RegYMM } + vpcmpeqq, 0x6629, AVX|AVX2, Modrm|Vex|Space0F38|VexVVVV|VexWIG|CheckOperandSize|NoSuf|Optimize, { Unspecified|BaseIndex|RegXMM|RegYMM, RegXMM|RegYMM, RegXMM|RegYMM } +-vpcmpestri, 0x6661, AVX|No64, Modrm|Vex|Space0F3A|NoSuf, { Imm8, Unspecified|BaseIndex|RegXMM, RegXMM } +-vpcmpestri, 0x6661, AVX|x64, Modrm|Vex|Space0F3A|IgnoreSize|No_bSuf|No_wSuf|No_sSuf, { Imm8, Xmmword|Unspecified|BaseIndex|RegXMM, RegXMM } +-vpcmpestrm, 0x6660, AVX|No64, Modrm|Vex|Space0F3A|NoSuf, { Imm8, Unspecified|BaseIndex|RegXMM, RegXMM } +-vpcmpestrm, 0x6660, AVX|x64, Modrm|Vex|Space0F3A|IgnoreSize|No_bSuf|No_wSuf|No_sSuf, { Imm8, Xmmword|Unspecified|BaseIndex|RegXMM, RegXMM } ++vpcmpestri, 0x6661, AVX&No64, Modrm|Vex|Space0F3A|NoSuf, { Imm8, Unspecified|BaseIndex|RegXMM, RegXMM } ++vpcmpestri, 0x6661, AVX&x64, Modrm|Vex|Space0F3A|IgnoreSize|No_bSuf|No_wSuf|No_sSuf, { Imm8, Unspecified|BaseIndex|RegXMM, RegXMM } ++vpcmpestrm, 0x6660, AVX&No64, Modrm|Vex|Space0F3A|NoSuf, { Imm8, Unspecified|BaseIndex|RegXMM, RegXMM } ++vpcmpestrm, 0x6660, AVX&x64, Modrm|Vex|Space0F3A|IgnoreSize|No_bSuf|No_wSuf|No_sSuf, { Imm8, Unspecified|BaseIndex|RegXMM, RegXMM } + vpcmpgt, 0x6664 | , AVX|AVX2, Modrm|Vex|Space0F|VexVVVV|VexWIG|CheckOperandSize|NoSuf|Optimize, { Unspecified|BaseIndex|RegXMM|RegYMM, RegXMM|RegYMM, RegXMM|RegYMM } + vpcmpgtd, 0x6666, AVX|AVX2, Modrm|Vex|Space0F|VexVVVV|VexWIG|CheckOperandSize|NoSuf|Optimize, { Unspecified|BaseIndex|RegXMM|RegYMM, RegXMM|RegYMM, RegXMM|RegYMM } + vpcmpgtq, 0x6637, AVX|AVX2, Modrm|Vex|Space0F38|VexVVVV|VexWIG|CheckOperandSize|NoSuf|Optimize, { Unspecified|BaseIndex|RegXMM|RegYMM, RegXMM|RegYMM, RegXMM|RegYMM } +@@ -1605,7 +1641,7 @@ vpermilps, 0x660c, AVX|AVX512F, Modrm|Vex|EVexDYN|Masking|Space0F38|VexVVVV|VexW + vpermilps, 0x6604, AVX|AVX512F, Modrm|Vex|EVexDYN|Masking|Space0F3A|VexW0|Broadcast|Disp8ShiftVL|CheckOperandSize|NoSuf, { Imm8|Imm8S, RegXMM|RegYMM|RegZMM|Dword|Unspecified|BaseIndex, RegXMM|RegYMM|RegZMM } + vpermilpd, 0x660d, AVX, Modrm|Vex|Space0F38|VexVVVV|VexW0|CheckOperandSize|NoSuf, { Unspecified|BaseIndex|RegXMM|RegYMM, RegXMM|RegYMM, RegXMM|RegYMM } + vpermilpd, 0x6605, AVX, Modrm|Vex|Space0F3A|VexW0|CheckOperandSize|NoSuf, { Imm8|Imm8S, Unspecified|BaseIndex|RegXMM|RegYMM, RegXMM|RegYMM } +-vpextr, 0x6616, AVX|, Modrm|Vex|Space0F3A||NoSuf, { Imm8, RegXMM, |Unspecified|BaseIndex } ++vpextr, 0x6616, AVX&, Modrm|Vex|Space0F3A||NoSuf, { Imm8, RegXMM, |Unspecified|BaseIndex } + vpextrw, 0x66c5, AVX, Load|Modrm|Vex|Space0F|VexWIG|No_bSuf|No_wSuf|No_sSuf, { Imm8, RegXMM, Reg32|Reg64 } + vpextr, 0x6614 | , AVX, RegMem|Vex|Space0F3A|VexWIG|NoSuf, { Imm8, RegXMM, Reg32|Reg64 } + vpextr, 0x6614 | , AVX, Modrm|Vex|Space0F3A|VexWIG|NoSuf, { Imm8, RegXMM, |Unspecified|BaseIndex } +@@ -1618,7 +1654,7 @@ vphsubsw, 0x6607, AVX|AVX2, Modrm|Vex|Space0F38|VexVVVV|VexWIG|CheckOperandSize| + vphsubw, 0x6605, AVX|AVX2, Modrm|Vex|Space0F38|VexVVVV|VexWIG|CheckOperandSize|NoSuf, { Unspecified|BaseIndex|RegXMM|RegYMM, RegXMM|RegYMM, RegXMM|RegYMM } + vpinsrb, 0x6620, AVX, Modrm|Vex|Space0F3A|VexVVVV|VexWIG|NoSuf, { Imm8, Reg32|Reg64, RegXMM, RegXMM } + vpinsrb, 0x6620, AVX, Modrm|Vex|Space0F3A|VexVVVV|VexWIG|NoSuf, { Imm8, Byte|Unspecified|BaseIndex, RegXMM, RegXMM } +-vpinsr, 0x6622, AVX|, Modrm|Vex|Space0F3A|VexVVVV||NoSuf, { Imm8, |Unspecified|BaseIndex, RegXMM, RegXMM } ++vpinsr, 0x6622, AVX&, Modrm|Vex|Space0F3A|VexVVVV||NoSuf, { Imm8, |Unspecified|BaseIndex, RegXMM, RegXMM } + vpinsrw, 0x66c4, AVX, Modrm|Vex|Space0F|VexVVVV|VexWIG|No_bSuf|No_wSuf|No_sSuf, { Imm8, Reg32|Reg64, RegXMM, RegXMM } + vpinsrw, 0x66c4, AVX, Modrm|Vex|Space0F|VexVVVV|VexWIG|NoSuf, { Imm8, Word|Unspecified|BaseIndex, RegXMM, RegXMM } + vpmaddubsw, 0x6604, AVX|AVX2, Modrm|Vex|Space0F38|VexVVVV|VexWIG|CheckOperandSize|NoSuf, { Unspecified|BaseIndex|RegXMM|RegYMM, RegXMM|RegYMM, RegXMM|RegYMM } +@@ -1636,18 +1672,18 @@ vpminub, 0x66da, AVX|AVX2, Modrm|C|Vex|Space0F|VexVVVV|VexWIG|CheckOperandSize|N + vpminud, 0x663b, AVX|AVX2, Modrm|Vex|Space0F38|VexVVVV|VexWIG|CheckOperandSize|NoSuf, { Unspecified|BaseIndex|RegXMM|RegYMM, RegXMM|RegYMM, RegXMM|RegYMM } + vpminuw, 0x663a, AVX|AVX2, Modrm|Vex|Space0F38|VexVVVV|VexWIG|CheckOperandSize|NoSuf, { Unspecified|BaseIndex|RegXMM|RegYMM, RegXMM|RegYMM, RegXMM|RegYMM } + vpmovmskb, 0x66d7, AVX|AVX2, Modrm|Vex|Space0F|VexWIG|No_bSuf|No_wSuf|No_sSuf, { RegXMM|RegYMM, Reg32|Reg64 } +-vpmovsxbd, 0x6621, AVX|AVX512F|AVX512VL, Modrm|Vex128|EVex128|Masking|Space0F38|VexWIG|Disp8MemShift=2|NoSuf, { RegXMM|Dword|Unspecified|BaseIndex, RegXMM } +-vpmovsxbq, 0x6622, AVX|AVX512F|AVX512VL, Modrm|Vex128|EVex128|Masking|Space0F38|VexWIG|Disp8MemShift=1|NoSuf, { RegXMM|Word|Unspecified|BaseIndex, RegXMM } ++vpmovsxbd, 0x6621, AVX|AVX512VL, Modrm|Vex128|EVex128|Masking|Space0F38|VexWIG|Disp8MemShift=2|NoSuf, { RegXMM|Dword|Unspecified|BaseIndex, RegXMM } ++vpmovsxbq, 0x6622, AVX|AVX512VL, Modrm|Vex128|EVex128|Masking|Space0F38|VexWIG|Disp8MemShift=1|NoSuf, { RegXMM|Word|Unspecified|BaseIndex, RegXMM } + vpmovsxbw, 0x6620, AVX, Modrm|Vex|Space0F38|VexWIG|NoSuf, { Qword|Unspecified|BaseIndex|RegXMM, RegXMM } + vpmovsxdq, 0x6625, AVX, Modrm|Vex|Space0F38|VexWIG|NoSuf, { Qword|Unspecified|BaseIndex|RegXMM, RegXMM } +-vpmovsxwd, 0x6623, AVX|AVX512F|AVX512VL, Modrm|Vex128|EVex128|Masking|Space0F38|VexWIG|Disp8MemShift=3|NoSuf, { RegXMM|Qword|Unspecified|BaseIndex, RegXMM } +-vpmovsxwq, 0x6624, AVX|AVX512F|AVX512VL, Modrm|Vex128|EVex128|Masking|Space0F38|VexWIG|Disp8MemShift=2|NoSuf, { RegXMM|Dword|Unspecified|BaseIndex, RegXMM } +-vpmovzxbd, 0x6631, AVX|AVX512F|AVX512VL, Modrm|Vex128|EVex128|Masking|Space0F38|VexWIG|Disp8MemShift=2|NoSuf, { RegXMM|Dword|Unspecified|BaseIndex, RegXMM } +-vpmovzxbq, 0x6632, AVX|AVX512F|AVX512VL, Modrm|Vex128|EVex128|Masking|Space0F38|VexWIG|Disp8MemShift=1|NoSuf, { RegXMM|Word|Unspecified|BaseIndex, RegXMM } ++vpmovsxwd, 0x6623, AVX|AVX512VL, Modrm|Vex128|EVex128|Masking|Space0F38|VexWIG|Disp8MemShift=3|NoSuf, { RegXMM|Qword|Unspecified|BaseIndex, RegXMM } ++vpmovsxwq, 0x6624, AVX|AVX512VL, Modrm|Vex128|EVex128|Masking|Space0F38|VexWIG|Disp8MemShift=2|NoSuf, { RegXMM|Dword|Unspecified|BaseIndex, RegXMM } ++vpmovzxbd, 0x6631, AVX|AVX512VL, Modrm|Vex128|EVex128|Masking|Space0F38|VexWIG|Disp8MemShift=2|NoSuf, { RegXMM|Dword|Unspecified|BaseIndex, RegXMM } ++vpmovzxbq, 0x6632, AVX|AVX512VL, Modrm|Vex128|EVex128|Masking|Space0F38|VexWIG|Disp8MemShift=1|NoSuf, { RegXMM|Word|Unspecified|BaseIndex, RegXMM } + vpmovzxbw, 0x6630, AVX, Modrm|Vex|Space0F38|VexWIG|NoSuf, { Qword|Unspecified|BaseIndex|RegXMM, RegXMM } + vpmovzxdq, 0x6635, AVX, Modrm|Vex|Space0F38|VexWIG|NoSuf, { Qword|Unspecified|BaseIndex|RegXMM, RegXMM } +-vpmovzxwd, 0x6633, AVX|AVX512F|AVX512VL, Modrm|Vex128|EVex128|Masking|Space0F38|VexWIG|Disp8MemShift=3|NoSuf, { RegXMM|Qword|Unspecified|BaseIndex, RegXMM } +-vpmovzxwq, 0x6634, AVX|AVX512F|AVX512VL, Modrm|Vex128|EVex128|Masking|Space0F38|VexWIG|Disp8MemShift=2|NoSuf, { RegXMM|Dword|Unspecified|BaseIndex, RegXMM } ++vpmovzxwd, 0x6633, AVX|AVX512VL, Modrm|Vex128|EVex128|Masking|Space0F38|VexWIG|Disp8MemShift=3|NoSuf, { RegXMM|Qword|Unspecified|BaseIndex, RegXMM } ++vpmovzxwq, 0x6634, AVX|AVX512VL, Modrm|Vex128|EVex128|Masking|Space0F38|VexWIG|Disp8MemShift=2|NoSuf, { RegXMM|Dword|Unspecified|BaseIndex, RegXMM } + vpmuldq, 0x6628, AVX|AVX2, Modrm|Vex|Space0F38|VexVVVV|VexWIG|CheckOperandSize|NoSuf, { Unspecified|BaseIndex|RegXMM|RegYMM, RegXMM|RegYMM, RegXMM|RegYMM } + vpmulhrsw, 0x660b, AVX|AVX2, Modrm|Vex|Space0F38|VexVVVV|VexWIG|CheckOperandSize|NoSuf, { Unspecified|BaseIndex|RegXMM|RegYMM, RegXMM|RegYMM, RegXMM|RegYMM } + vpmulhuw, 0x66e4, AVX|AVX2, Modrm|C|Vex|Space0F|VexVVVV|VexWIG|CheckOperandSize|NoSuf, { Unspecified|BaseIndex|RegXMM|RegYMM, RegXMM|RegYMM, RegXMM|RegYMM } +@@ -1695,6 +1731,10 @@ vrcpps, 0x53, AVX, Modrm|Vex|Space0F|VexWIG|CheckOperandSize|NoSuf, { Unspecifie + vrcpss, 0xf353, AVX, Modrm|Vex=3|Space0F|VexVVVV|VexWIG|NoSuf, { Dword|Unspecified|BaseIndex|RegXMM, RegXMM, RegXMM } + vroundp, 0x6608 | , AVX, Modrm|Vex|Space0F3A|VexWIG|CheckOperandSize|NoSuf, { Imm8, Unspecified|BaseIndex|RegXMM|RegYMM, RegXMM|RegYMM } + vrounds, 0x660a | , AVX, Modrm|VexLIG|Space0F3A|VexVVVV|VexWIG|NoSuf, { Imm8, |Unspecified|BaseIndex|RegXMM, RegXMM, RegXMM } ++// These are really clones of VRNDSCALE{P,S}{S,D}, with broadcast, masking, SAE, ++// 512-bit operand size, and register sources dropped. ++vroundp, 0x6608 | , APX_F&AVX512VL, Modrm|Space0F3A||Disp8ShiftVL|CheckOperandSize|NoSuf, { Imm8, Xmmword|Ymmword|Unspecified|BaseIndex, RegXMM|RegYMM } ++vrounds, 0x660a | , APX_F&AVX512F, Modrm|EVexLIG|Space0F3A|VexVVVV||Disp8MemShift|NoSuf, { Imm8, |Unspecified|BaseIndex, RegXMM, RegXMM } + vrsqrtps, 0x52, AVX, Modrm|Vex|Space0F|VexWIG|CheckOperandSize|NoSuf, { Unspecified|BaseIndex|RegXMM|RegYMM, RegXMM|RegYMM } + vrsqrtss, 0xf352, AVX, Modrm|Vex=3|Space0F|VexVVVV|VexWIG|NoSuf, { Dword|Unspecified|BaseIndex|RegXMM, RegXMM, RegXMM } + vshufp, 0xc6, AVX, Modrm|Vex|Space0F|VexVVVV|VexWIG|CheckOperandSize|NoSuf, { Imm8|Imm8S, Unspecified|BaseIndex|RegXMM|RegYMM, RegXMM|RegYMM, RegXMM|RegYMM } +@@ -1714,22 +1754,24 @@ vzeroupper, 0x77, AVX, Vex|Space0F|VexWIG|NoSuf, {} + + // 256bit integer AVX2 instructions. + +-vpmovsxbd, 0x6621, AVX2|AVX512F|AVX512VL, Modrm|Vex256|EVex256|Masking|Space0F38|VexWIG|Disp8MemShift=3|NoSuf, { RegXMM|Qword|Unspecified|BaseIndex, RegYMM } +-vpmovsxbq, 0x6622, AVX2|AVX512F|AVX512VL, Modrm|Vex256|EVex256|Masking|Space0F38|VexWIG|Disp8MemShift=2|NoSuf, { RegXMM|Dword|Unspecified|BaseIndex, RegYMM } ++vpmovsxbd, 0x6621, AVX2|AVX512VL, Modrm|Vex256|EVex256|Masking|Space0F38|VexWIG|Disp8MemShift=3|NoSuf, { RegXMM|Qword|Unspecified|BaseIndex, RegYMM } ++vpmovsxbq, 0x6622, AVX2|AVX512VL, Modrm|Vex256|EVex256|Masking|Space0F38|VexWIG|Disp8MemShift=2|NoSuf, { RegXMM|Dword|Unspecified|BaseIndex, RegYMM } + vpmovsxbw, 0x6620, AVX2, Modrm|Vex=2|Space0F38|VexWIG|NoSuf, { Unspecified|BaseIndex|RegXMM, RegYMM } + vpmovsxdq, 0x6625, AVX2, Modrm|Vex=2|Space0F38|VexWIG|NoSuf, { Unspecified|BaseIndex|RegXMM, RegYMM } +-vpmovsxwd, 0x6623, AVX2|AVX512F|AVX512VL, Modrm|Vex256|EVex256|Masking|Space0F38|VexWIG|Disp8MemShift=4|NoSuf, { RegXMM|Unspecified|BaseIndex, RegYMM } +-vpmovsxwq, 0x6624, AVX2|AVX512F|AVX512VL, Modrm|Vex256|EVex256|Masking|Space0F38|VexWIG|Disp8MemShift=3|NoSuf, { RegXMM|Qword|Unspecified|BaseIndex, RegYMM } +-vpmovzxbd, 0x6631, AVX2|AVX512F|AVX512VL, Modrm|Vex256|EVex256|Masking|Space0F38|VexWIG|Disp8MemShift=3|NoSuf, { RegXMM|Qword|Unspecified|BaseIndex, RegYMM } +-vpmovzxbq, 0x6632, AVX2|AVX512F|AVX512VL, Modrm|Vex256|EVex256|Masking|Space0F38|VexWIG|Disp8MemShift=2|NoSuf, { RegXMM|Dword|Unspecified|BaseIndex, RegYMM } ++vpmovsxwd, 0x6623, AVX2|AVX512VL, Modrm|Vex256|EVex256|Masking|Space0F38|VexWIG|Disp8MemShift=4|NoSuf, { RegXMM|Unspecified|BaseIndex, RegYMM } ++vpmovsxwq, 0x6624, AVX2|AVX512VL, Modrm|Vex256|EVex256|Masking|Space0F38|VexWIG|Disp8MemShift=3|NoSuf, { RegXMM|Qword|Unspecified|BaseIndex, RegYMM } ++vpmovzxbd, 0x6631, AVX2|AVX512VL, Modrm|Vex256|EVex256|Masking|Space0F38|VexWIG|Disp8MemShift=3|NoSuf, { RegXMM|Qword|Unspecified|BaseIndex, RegYMM } ++vpmovzxbq, 0x6632, AVX2|AVX512VL, Modrm|Vex256|EVex256|Masking|Space0F38|VexWIG|Disp8MemShift=2|NoSuf, { RegXMM|Dword|Unspecified|BaseIndex, RegYMM } + vpmovzxbw, 0x6630, AVX2, Modrm|Vex=2|Space0F38|VexWIG|NoSuf, { Unspecified|BaseIndex|RegXMM, RegYMM } + vpmovzxdq, 0x6635, AVX2, Modrm|Vex=2|Space0F38|VexWIG|NoSuf, { Unspecified|BaseIndex|RegXMM, RegYMM } +-vpmovzxwd, 0x6633, AVX2|AVX512F|AVX512VL, Modrm|Vex256|EVex256|Masking|Space0F38|VexWIG|Disp8MemShift=4|NoSuf, { RegXMM|Unspecified|BaseIndex, RegYMM } +-vpmovzxwq, 0x6634, AVX2|AVX512F|AVX512VL, Modrm|Vex256|EVex256|Masking|Space0F38|VexWIG|Disp8MemShift=3|NoSuf, { RegXMM|Qword|Unspecified|BaseIndex, RegYMM } ++vpmovzxwd, 0x6633, AVX2|AVX512VL, Modrm|Vex256|EVex256|Masking|Space0F38|VexWIG|Disp8MemShift=4|NoSuf, { RegXMM|Unspecified|BaseIndex, RegYMM } ++vpmovzxwq, 0x6634, AVX2|AVX512VL, Modrm|Vex256|EVex256|Masking|Space0F38|VexWIG|Disp8MemShift=3|NoSuf, { RegXMM|Qword|Unspecified|BaseIndex, RegYMM } + + // New AVX2 instructions. + +-vbroadcasti128, 0x665A, AVX2, Modrm|Vex=2|Space0F38|VexW=1|NoSuf, { Xmmword|Unspecified|BaseIndex, RegYMM } ++vbroadcasti128, 0x665A, AVX2, Modrm|Vex256|Space0F38|VexW0|NoSuf, { Xmmword|Unspecified|BaseIndex, RegYMM } ++// vbroadcasti32x4 in disguise (see vround{p,s}{s,d} comment) ++vbroadcasti128, 0x665a, APX_F&AVX512VL, Modrm|EVex256|Space0F38|VexW0|Disp8MemShift=4|NoSuf, { Xmmword|Unspecified|BaseIndex, RegYMM } + vbroadcastsd, 0x6619, AVX2, Modrm|Vex=2|Space0F38|VexW=1|NoSuf, { RegXMM, RegYMM } + vbroadcastss, 0x6618, AVX2|AVX512F, Modrm|Vex|EVexDYN|Masking|Space0F38|VexW0|Disp8MemShift=2|NoSuf, { RegXMM|Dword|Unspecified|BaseIndex, RegXMM|RegYMM|RegZMM } + vpblendd, 0x6602, AVX2, Modrm|Vex|Space0F3A|VexVVVV|VexW0|CheckOperandSize|NoSuf, { Imm8|Imm8S, Unspecified|BaseIndex|RegXMM|RegYMM, RegXMM|RegYMM, RegXMM|RegYMM } +@@ -1741,8 +1783,12 @@ vpermd, 0x6636, AVX2|AVX512F, Modrm|Vex256|EVexDYN|Masking|Space0F38|VexVVVV|Vex + vpermpd, 0x6601, AVX2|AVX512F, Modrm|Vex256|EVexDYN|Masking|Space0F3A|VexW1|Broadcast|Disp8ShiftVL|CheckOperandSize|NoSuf, { Imm8|Imm8S, RegYMM|RegZMM|Qword|Unspecified|BaseIndex, RegYMM|RegZMM } + vpermps, 0x6616, AVX2|AVX512F, Modrm|Vex256|EVexDYN|Masking|Space0F38|VexVVVV|VexW0|Broadcast|Disp8ShiftVL|CheckOperandSize|NoSuf, { RegYMM|RegZMM|Dword|Unspecified|BaseIndex, RegYMM|RegZMM, RegYMM|RegZMM } + vpermq, 0x6600, AVX2|AVX512F, Modrm|Vex256|EVexDYN|Masking|Space0F3A|VexW1|Broadcast|Disp8ShiftVL|CheckOperandSize|NoSuf, { Imm8|Imm8S, RegYMM|RegZMM|Qword|Unspecified|BaseIndex, RegYMM|RegZMM } +-vextracti128, 0x6639, AVX2, Modrm|Vex=2|Space0F3A|VexW=1|NoSuf, { Imm8, RegYMM, Unspecified|BaseIndex|RegXMM } ++vextracti128, 0x6639, AVX2, Modrm|Vex256|Space0F3A|VexW0|NoSuf, { Imm8, RegYMM, Unspecified|BaseIndex|RegXMM } ++// vextracti32x4 in disguise (see vround{p,s}{s,d} comment) ++vextracti128, 0x6639, APX_F&AVX512VL, Modrm|EVex256|Space0F3A|VexW0|Disp8MemShift=4|NoSuf, { Imm8, RegYMM, Xmmword|Unspecified|BaseIndex } + vinserti128, 0x6638, AVX2, Modrm|Vex256|Space0F3A|VexVVVV|VexW0|NoSuf, { Imm8, Unspecified|BaseIndex|RegXMM, RegYMM, RegYMM } ++// vinserti32x4 in disguise (see vround{p,s}{s,d} comment) ++vinserti128, 0x6638, APX_F&AVX512VL, Modrm|EVex256|Space0F3A|VexVVVV|VexW0|Disp8MemShift=4|NoSuf, { Imm8, Xmmword|Unspecified|BaseIndex, RegYMM, RegYMM } + vpmaskmov, 0x668e, AVX2, Modrm|Vex|Space0F38|VexVVVV||CheckOperandSize|NoSuf, { RegXMM|RegYMM, RegXMM|RegYMM, Xmmword|Ymmword|Unspecified|BaseIndex } + vpmaskmov, 0x668c, AVX2, Modrm|Vex|Space0F38|VexVVVV||CheckOperandSize|NoSuf, { Xmmword|Ymmword|Unspecified|BaseIndex, RegXMM|RegYMM, RegXMM|RegYMM } + vpsllv, 0x6647, AVX2|AVX512F, Modrm|Vex|EVexDYN|Masking|Space0F38|VexVVVV||Broadcast|Disp8ShiftVL|CheckOperandSize|NoSuf, { RegXMM|RegYMM|RegZMM||Unspecified|BaseIndex, RegXMM|RegYMM|RegZMM, RegXMM|RegYMM|RegZMM } +@@ -1765,26 +1811,26 @@ vpgatherqq, 0x6691, AVX2, Modrm|Vex256|Space0F38|VexVVVV|VexW1|SwapSources|NoSuf + + // AES + AVX + +-vaesdec, 0x66de, AVX|AES, Modrm|Vex|Space0F38|VexVVVV|VexWIG|NoSuf, { Unspecified|BaseIndex|RegXMM, RegXMM, RegXMM } +-vaesdeclast, 0x66df, AVX|AES, Modrm|Vex|Space0F38|VexVVVV|VexWIG|NoSuf, { Unspecified|BaseIndex|RegXMM, RegXMM, RegXMM } +-vaesenc, 0x66dc, AVX|AES, Modrm|Vex|Space0F38|VexVVVV|VexWIG|NoSuf, { Unspecified|BaseIndex|RegXMM, RegXMM, RegXMM } +-vaesenclast, 0x66dd, AVX|AES, Modrm|Vex|Space0F38|VexVVVV|VexWIG|NoSuf, { Unspecified|BaseIndex|RegXMM, RegXMM, RegXMM } +-vaesimc, 0x66db, AVX|AES, Modrm|Vex|Space0F38|VexWIG|NoSuf, { Unspecified|BaseIndex|RegXMM, RegXMM } +-vaeskeygenassist, 0x66df, AVX|AES, Modrm|Vex|Space0F3A|VexWIG|NoSuf, { Imm8, Unspecified|BaseIndex|RegXMM, RegXMM } ++vaesdec, 0x66de, AVX&AES, Modrm|Vex|Space0F38|VexVVVV|VexWIG|NoSuf, { Unspecified|BaseIndex|RegXMM, RegXMM, RegXMM } ++vaesdeclast, 0x66df, AVX&AES, Modrm|Vex|Space0F38|VexVVVV|VexWIG|NoSuf, { Unspecified|BaseIndex|RegXMM, RegXMM, RegXMM } ++vaesenc, 0x66dc, AVX&AES, Modrm|Vex|Space0F38|VexVVVV|VexWIG|NoSuf, { Unspecified|BaseIndex|RegXMM, RegXMM, RegXMM } ++vaesenclast, 0x66dd, AVX&AES, Modrm|Vex|Space0F38|VexVVVV|VexWIG|NoSuf, { Unspecified|BaseIndex|RegXMM, RegXMM, RegXMM } ++vaesimc, 0x66db, AVX&AES, Modrm|Vex|Space0F38|VexWIG|NoSuf, { Unspecified|BaseIndex|RegXMM, RegXMM } ++vaeskeygenassist, 0x66df, AVX&AES, Modrm|Vex|Space0F3A|VexWIG|NoSuf, { Imm8, Unspecified|BaseIndex|RegXMM, RegXMM } + + // PCLMULQDQ + AVX + +-vpclmulqdq, 0x6644, AVX|PCLMULQDQ, Modrm|Vex|Space0F3A|VexVVVV|VexWIG|NoSuf, { Imm8|Imm8S, Unspecified|BaseIndex|RegXMM, RegXMM, RegXMM } +-vpclmullqlqdq, 0x6644/0x00, AVX|PCLMULQDQ, Modrm|Vex|Space0F3A|VexVVVV|VexWIG|NoSuf|ImmExt, { Unspecified|BaseIndex|RegXMM, RegXMM, RegXMM } +-vpclmulhqlqdq, 0x6644/0x01, AVX|PCLMULQDQ, Modrm|Vex|Space0F3A|VexVVVV|VexWIG|NoSuf|ImmExt, { Unspecified|BaseIndex|RegXMM, RegXMM, RegXMM } +-vpclmullqhqdq, 0x6644/0x10, AVX|PCLMULQDQ, Modrm|Vex|Space0F3A|VexVVVV|VexWIG|NoSuf|ImmExt, { Unspecified|BaseIndex|RegXMM, RegXMM, RegXMM } +-vpclmulhqhqdq, 0x6644/0x11, AVX|PCLMULQDQ, Modrm|Vex|Space0F3A|VexVVVV|VexWIG|NoSuf|ImmExt, { Unspecified|BaseIndex|RegXMM, RegXMM, RegXMM } ++vpclmulqdq, 0x6644, AVX&PCLMULQDQ, Modrm|Vex|Space0F3A|VexVVVV|VexWIG|NoSuf, { Imm8|Imm8S, Unspecified|BaseIndex|RegXMM, RegXMM, RegXMM } ++vpclmullqlqdq, 0x6644/0x00, AVX&PCLMULQDQ, Modrm|Vex|Space0F3A|VexVVVV|VexWIG|NoSuf|ImmExt, { Unspecified|BaseIndex|RegXMM, RegXMM, RegXMM } ++vpclmulhqlqdq, 0x6644/0x01, AVX&PCLMULQDQ, Modrm|Vex|Space0F3A|VexVVVV|VexWIG|NoSuf|ImmExt, { Unspecified|BaseIndex|RegXMM, RegXMM, RegXMM } ++vpclmullqhqdq, 0x6644/0x10, AVX&PCLMULQDQ, Modrm|Vex|Space0F3A|VexVVVV|VexWIG|NoSuf|ImmExt, { Unspecified|BaseIndex|RegXMM, RegXMM, RegXMM } ++vpclmulhqhqdq, 0x6644/0x11, AVX&PCLMULQDQ, Modrm|Vex|Space0F3A|VexVVVV|VexWIG|NoSuf|ImmExt, { Unspecified|BaseIndex|RegXMM, RegXMM, RegXMM } + + // GFNI + AVX + +-vgf2p8affineinvqb, 0x66cf, AVX|GFNI, Modrm|Vex|Space0F3A|VexVVVV|VexW1|CheckOperandSize|NoSuf, { Imm8, Unspecified|BaseIndex|RegXMM|RegYMM, RegXMM|RegYMM, RegXMM|RegYMM } +-vgf2p8affineqb, 0x66ce, AVX|GFNI, Modrm|Vex|Space0F3A|VexVVVV|VexW1|CheckOperandSize|NoSuf, { Imm8, Unspecified|BaseIndex|RegXMM|RegYMM, RegXMM|RegYMM, RegXMM|RegYMM } +-vgf2p8mulb, 0x66cf, GFNI|AVX|AVX512F, Modrm|Vex|EVexDYN|Masking|Space0F38|VexVVVV|VexW0|Disp8ShiftVL|CheckOperandSize|NoSuf, { RegXMM|RegYMM|RegZMM|Unspecified|BaseIndex, RegXMM|RegYMM|RegZMM, RegXMM|RegYMM|RegZMM } ++vgf2p8affineinvqb, 0x66cf, AVX&GFNI, Modrm|Vex|Space0F3A|VexVVVV|VexW1|CheckOperandSize|NoSuf, { Imm8, Unspecified|BaseIndex|RegXMM|RegYMM, RegXMM|RegYMM, RegXMM|RegYMM } ++vgf2p8affineqb, 0x66ce, AVX&GFNI, Modrm|Vex|Space0F3A|VexVVVV|VexW1|CheckOperandSize|NoSuf, { Imm8, Unspecified|BaseIndex|RegXMM|RegYMM, RegXMM|RegYMM, RegXMM|RegYMM } ++vgf2p8mulb, 0x66cf, GFNI&(AVX|AVX512F), Modrm|Vex|EVexDYN|Masking|Space0F38|VexVVVV|VexW0|Disp8ShiftVL|CheckOperandSize|NoSuf, { RegXMM|RegYMM|RegZMM|Unspecified|BaseIndex, RegXMM|RegYMM|RegZMM, RegXMM|RegYMM|RegZMM } + + // FSGSBASE, RDRND and F16C + +@@ -1803,8 +1849,8 @@ vcvtps2ph, 0x661d, F16C, Modrm|Vex=2|Space0F3A|VexW=1|NoSuf, { Imm8, RegYMM, Uns + + + + + vfmaddp, 0x6688 | 0x, , Modrm||Masking||VexVVVV||Broadcast|Disp8ShiftVL|CheckOperandSize|NoSuf|StaticRounding|SAE, { RegXMM|RegYMM|RegZMM||Unspecified|BaseIndex, RegXMM|RegYMM|RegZMM, RegXMM|RegYMM|RegZMM } +@@ -1831,14 +1877,14 @@ xtest, 0xf01d6, HLE|RTM, NoSuf, {} + + // BMI2 instructions. + +-bzhi, 0xf5, BMI2, Modrm|CheckOperandSize|Vex128|Space0F38|VexVVVV|SwapSources|No_bSuf|No_wSuf|No_sSuf, { Reg32|Reg64, Reg32|Reg64|Unspecified|BaseIndex, Reg32|Reg64 } +-mulx, 0xf2f6, BMI2, Modrm|CheckOperandSize|Vex128|Space0F38|VexVVVV|No_bSuf|No_wSuf|No_sSuf, { Reg32|Reg64|Unspecified|BaseIndex, Reg32|Reg64, Reg32|Reg64 } +-pdep, 0xf2f5, BMI2, Modrm|CheckOperandSize|Vex128|Space0F38|VexVVVV|No_bSuf|No_wSuf|No_sSuf, { Reg32|Reg64|Unspecified|BaseIndex, Reg32|Reg64, Reg32|Reg64 } +-pext, 0xf3f5, BMI2, Modrm|CheckOperandSize|Vex128|Space0F38|VexVVVV|No_bSuf|No_wSuf|No_sSuf, { Reg32|Reg64|Unspecified|BaseIndex, Reg32|Reg64, Reg32|Reg64 } +-rorx, 0xf2f0, BMI2, Modrm|CheckOperandSize|Vex128|Space0F3A|No_bSuf|No_wSuf|No_sSuf, { Imm8|Imm8S, Reg32|Reg64|Dword|Qword|Unspecified|BaseIndex, Reg32|Reg64 } +-sarx, 0xf3f7, BMI2, Modrm|CheckOperandSize|Vex128|Space0F38|VexVVVV|SwapSources|No_bSuf|No_wSuf|No_sSuf, { Reg32|Reg64, Reg32|Reg64|Unspecified|BaseIndex, Reg32|Reg64 } +-shlx, 0x66f7, BMI2, Modrm|CheckOperandSize|Vex128|Space0F38|VexVVVV|SwapSources|No_bSuf|No_wSuf|No_sSuf, { Reg32|Reg64, Reg32|Reg64|Unspecified|BaseIndex, Reg32|Reg64 } +-shrx, 0xf2f7, BMI2, Modrm|CheckOperandSize|Vex128|Space0F38|VexVVVV|SwapSources|No_bSuf|No_wSuf|No_sSuf, { Reg32|Reg64, Reg32|Reg64|Unspecified|BaseIndex, Reg32|Reg64 } ++bzhi, 0xf5, APX_F(BMI2), Modrm|CheckOperandSize|Vex128|EVex128|Space0F38|VexVVVV|SwapSources|No_bSuf|No_wSuf|No_sSuf|NF, { Reg32|Reg64, Reg32|Reg64|Unspecified|BaseIndex, Reg32|Reg64 } ++mulx, 0xf2f6, APX_F(BMI2), Modrm|CheckOperandSize|Vex128|EVex128|Space0F38|VexVVVV|No_bSuf|No_wSuf|No_sSuf, { Reg32|Reg64|Unspecified|BaseIndex, Reg32|Reg64, Reg32|Reg64 } ++pdep, 0xf2f5, APX_F(BMI2), Modrm|CheckOperandSize|Vex128|EVex128|Space0F38|VexVVVV|No_bSuf|No_wSuf|No_sSuf, { Reg32|Reg64|Unspecified|BaseIndex, Reg32|Reg64, Reg32|Reg64 } ++pext, 0xf3f5, APX_F(BMI2), Modrm|CheckOperandSize|Vex128|EVex128|Space0F38|VexVVVV|No_bSuf|No_wSuf|No_sSuf, { Reg32|Reg64|Unspecified|BaseIndex, Reg32|Reg64, Reg32|Reg64 } ++rorx, 0xf2f0, APX_F(BMI2), Modrm|CheckOperandSize|Vex128|EVex128|Space0F3A|No_bSuf|No_wSuf|No_sSuf, { Imm8|Imm8S, Reg32|Reg64|Unspecified|BaseIndex, Reg32|Reg64 } ++sarx, 0xf3f7, APX_F(BMI2), Modrm|CheckOperandSize|Vex128|EVex128|Space0F38|VexVVVV|SwapSources|No_bSuf|No_wSuf|No_sSuf, { Reg32|Reg64, Reg32|Reg64|Unspecified|BaseIndex, Reg32|Reg64 } ++shlx, 0x66f7, APX_F(BMI2), Modrm|CheckOperandSize|Vex128|EVex128|Space0F38|VexVVVV|SwapSources|No_bSuf|No_wSuf|No_sSuf, { Reg32|Reg64, Reg32|Reg64|Unspecified|BaseIndex, Reg32|Reg64 } ++shrx, 0xf2f7, APX_F(BMI2), Modrm|CheckOperandSize|Vex128|EVex128|Space0F38|VexVVVV|SwapSources|No_bSuf|No_wSuf|No_sSuf, { Reg32|Reg64, Reg32|Reg64|Unspecified|BaseIndex, Reg32|Reg64 } + + // FMA4 instructions + +@@ -1908,12 +1954,13 @@ lwpins, 0x12/0, LWP, Modrm|SpaceXOP0A|NoSuf|VexVVVV|Vex, { Imm32|Imm32S, Reg32|U + + // BMI instructions + +-andn, 0xf2, BMI, Modrm|CheckOperandSize|Vex128|Space0F38|VexVVVV|No_bSuf|No_wSuf|No_sSuf, { Reg32|Reg64|Unspecified|BaseIndex, Reg32|Reg64, Reg32|Reg64 } +-bextr, 0xf7, BMI, Modrm|CheckOperandSize|Vex128|Space0F38|VexVVVV|SwapSources|No_bSuf|No_wSuf|No_sSuf, { Reg32|Reg64, Reg32|Reg64|Unspecified|BaseIndex, Reg32|Reg64 } +-blsi, 0xf3/3, BMI, Modrm|CheckOperandSize|Vex128|Space0F38|VexVVVV|No_bSuf|No_wSuf|No_sSuf, { Reg32|Reg64|Unspecified|BaseIndex, Reg32|Reg64 } +-blsmsk, 0xf3/2, BMI, Modrm|CheckOperandSize|Vex128|Space0F38|VexVVVV|No_bSuf|No_wSuf|No_sSuf, { Reg32|Reg64|Unspecified|BaseIndex, Reg32|Reg64 } +-blsr, 0xf3/1, BMI, Modrm|CheckOperandSize|Vex128|Space0F38|VexVVVV|No_bSuf|No_wSuf|No_sSuf, { Reg32|Reg64|Unspecified|BaseIndex, Reg32|Reg64 } +-tzcnt, 0xf30fbc, BMI, Modrm|CheckOperandSize|No_bSuf|No_sSuf, { Reg16|Reg32|Reg64|Word|Dword|Qword|Unspecified|BaseIndex, Reg16|Reg32|Reg64 } ++andn, 0xf2, APX_F(BMI), Modrm|CheckOperandSize|Vex128|EVex128|Space0F38|VexVVVV|No_bSuf|No_wSuf|No_sSuf|NF, { Reg32|Reg64|Unspecified|BaseIndex, Reg32|Reg64, Reg32|Reg64 } ++bextr, 0xf7, APX_F(BMI), Modrm|CheckOperandSize|Vex128|EVex128|Space0F38|VexVVVV|SwapSources|No_bSuf|No_wSuf|No_sSuf|NF, { Reg32|Reg64, Reg32|Reg64|Unspecified|BaseIndex, Reg32|Reg64 } ++blsi, 0xf3/3, APX_F(BMI), Modrm|CheckOperandSize|Vex128|EVex128|Space0F38|VexVVVV|No_bSuf|No_wSuf|No_sSuf|NF, { Reg32|Reg64|Unspecified|BaseIndex, Reg32|Reg64 } ++blsmsk, 0xf3/2, APX_F(BMI), Modrm|CheckOperandSize|Vex128|EVex128|Space0F38|VexVVVV|No_bSuf|No_wSuf|No_sSuf|NF, { Reg32|Reg64|Unspecified|BaseIndex, Reg32|Reg64 } ++blsr, 0xf3/1, APX_F(BMI), Modrm|CheckOperandSize|Vex128|EVex128|Space0F38|VexVVVV|No_bSuf|No_wSuf|No_sSuf|NF, { Reg32|Reg64|Unspecified|BaseIndex, Reg32|Reg64 } ++tzcnt, 0xf30fbc, BMI, Modrm|CheckOperandSize|No_bSuf|No_sSuf, { Reg16|Reg32|Reg64|Unspecified|BaseIndex, Reg16|Reg32|Reg64 } ++tzcnt, 0xf4, BMI&APX_F, Modrm|CheckOperandSize|No_bSuf|No_sSuf|EVexMap4|NF, { Reg16|Reg32|Reg64|Unspecified|BaseIndex, Reg16|Reg32|Reg64 } + + // TBM instructions + +@@ -1990,10 +2037,12 @@ insertq, 0xf20f79, SSE4a, Modrm|NoSuf, { RegXMM, RegXMM } + insertq, 0xf20f78, SSE4a, Modrm|NoSuf, { Imm8, Imm8, RegXMM, RegXMM } + + // LZCNT instruction +-lzcnt, 0xf30fbd, LZCNT, Modrm|CheckOperandSize|No_bSuf|No_sSuf, { Reg16|Reg32|Reg64|Word|Dword|Qword|Unspecified|BaseIndex, Reg16|Reg32|Reg64 } ++lzcnt, 0xf30fbd, LZCNT, Modrm|CheckOperandSize|No_bSuf|No_sSuf, { Reg16|Reg32|Reg64|Unspecified|BaseIndex, Reg16|Reg32|Reg64 } ++lzcnt, 0xf5, LZCNT&APX_F, Modrm|CheckOperandSize|No_bSuf|No_sSuf|EVexMap4|NF, { Reg16|Reg32|Reg64|Unspecified|BaseIndex, Reg16|Reg32|Reg64 } + + // POPCNT instruction +-popcnt, 0xf30fb8, POPCNT, Modrm|CheckOperandSize|No_bSuf|No_sSuf, { Reg16|Reg32|Reg64|Word|Dword|Qword|Unspecified|BaseIndex, Reg16|Reg32|Reg64 } ++popcnt, 0xf30fb8, POPCNT, Modrm|CheckOperandSize|No_bSuf|No_sSuf, { Reg16|Reg32|Reg64|Unspecified|BaseIndex, Reg16|Reg32|Reg64 } ++popcnt, 0x88, POPCNT&APX_F, Modrm|CheckOperandSize|No_bSuf|No_sSuf|EVexMap4|NF, { Reg16|Reg32|Reg64|Unspecified|BaseIndex, Reg16|Reg32|Reg64 } + + // VIA PadLock extensions. + xstore-rng, 0xfa7c0, PadLock, NoSuf|RepPrefixOk, {} +@@ -2016,8 +2065,11 @@ xcryptofb, 0xf30fa7e8, PadLock, NoSuf|RepPrefixOk, {} + xstore, 0xfa7c0, PadLock, NoSuf|RepPrefixOk, {} + + // Multy-precision Add Carry, rdseed instructions. +-adcx, 0x660f38f6, ADX, Modrm|CheckOperandSize|IgnoreSize|No_bSuf|No_wSuf|No_sSuf, { Reg32|Reg64|Unspecified|BaseIndex, Reg32|Reg64 } +-adox, 0xf30f38f6, ADX, Modrm|CheckOperandSize|IgnoreSize|No_bSuf|No_wSuf|No_sSuf, { Reg32|Reg64|Unspecified|BaseIndex, Reg32|Reg64 } ++ ++adx, 0x66, ADX&APX_F, C|Modrm|CheckOperandSize|No_bSuf|No_wSuf|No_sSuf|DstVVVV|EVexMap4, { Reg32|Reg64|Unspecified|BaseIndex, Reg32|Reg64, Reg32|Reg64 } ++adx, 0x0f38f6, ADX, Modrm|CheckOperandSize|IgnoreSize|No_bSuf|No_wSuf|No_sSuf, { Reg32|Reg64|Unspecified|BaseIndex, Reg32|Reg64 } ++adx, 0x66, ADX&APX_F, Modrm|CheckOperandSize|No_bSuf|No_wSuf|No_sSuf|EVexMap4, { Reg32|Reg64|Unspecified|BaseIndex, Reg32|Reg64 } ++ + rdseed, 0xfc7/7, RdSeed, Modrm|NoSuf, { Reg16|Reg32|Reg64 } + + // SMAP instructions. +@@ -2030,12 +2082,12 @@ bnd, 0xf2, MPX, NoSuf|IsPrefix, {} + // MPX instructions. + bndmk, 0xf30f1b, MPX, Modrm|Anysize|IgnoreSize|NoSuf, { BaseIndex, RegBND } + bndmov, 0x660f1a, MPX, D|Modrm|NoSuf, { Xmmword|Unspecified|BaseIndex|RegBND, RegBND } +-bndcl, 0xf30f1a, MPX|No64, Modrm|Anysize|IgnoreSize|NoSuf, { Reg32|BaseIndex, RegBND } +-bndcl, 0xf30f1a, MPX|x64, Modrm|Anysize|IgnoreSize|NoSuf|NoRex64, { Reg64|BaseIndex, RegBND } +-bndcu, 0xf20f1a, MPX|No64, Modrm|Anysize|IgnoreSize|NoSuf, { Reg32|BaseIndex, RegBND } +-bndcu, 0xf20f1a, MPX|x64, Modrm|Anysize|IgnoreSize|NoSuf|NoRex64, { Reg64|BaseIndex, RegBND } +-bndcn, 0xf20f1b, MPX|No64, Modrm|Anysize|IgnoreSize|NoSuf, { Reg32|BaseIndex, RegBND } +-bndcn, 0xf20f1b, MPX|x64, Modrm|Anysize|IgnoreSize|NoSuf|NoRex64, { Reg64|BaseIndex, RegBND } ++bndcl, 0xf30f1a, MPX&No64, Modrm|Anysize|IgnoreSize|NoSuf, { Reg32|BaseIndex, RegBND } ++bndcl, 0xf30f1a, MPX&x64, Modrm|Anysize|IgnoreSize|NoSuf|NoRex64, { Reg64|BaseIndex, RegBND } ++bndcu, 0xf20f1a, MPX&No64, Modrm|Anysize|IgnoreSize|NoSuf, { Reg32|BaseIndex, RegBND } ++bndcu, 0xf20f1a, MPX&x64, Modrm|Anysize|IgnoreSize|NoSuf|NoRex64, { Reg64|BaseIndex, RegBND } ++bndcn, 0xf20f1b, MPX&No64, Modrm|Anysize|IgnoreSize|NoSuf, { Reg32|BaseIndex, RegBND } ++bndcn, 0xf20f1b, MPX&x64, Modrm|Anysize|IgnoreSize|NoSuf|NoRex64, { Reg64|BaseIndex, RegBND } + bndstx, 0x0f1b, MPX, Modrm|Anysize|IgnoreSize|NoSuf, { RegBND, BaseIndex } + bndldx, 0x0f1a, MPX, Modrm|Anysize|IgnoreSize|NoSuf, { BaseIndex, RegBND } + +@@ -2073,26 +2125,29 @@ vsm4rnds4, 0xf2da, SM4, Modrm|Space0F38|Vex|VexVVVV|VexW0|CheckOperandSize|NoSuf + + // VAES + +-vaesdec, 0x66de, VAES|AVX|AVX512F, Modrm|Vex|EVexDYN|Space0F38|VexWIG|VexVVVV|Disp8ShiftVL|CheckOperandSize|NoSuf, { RegXMM|RegYMM|RegZMM|Unspecified|BaseIndex, RegXMM|RegYMM|RegZMM, RegXMM|RegYMM|RegZMM } +-vaesdeclast, 0x66df, VAES|AVX|AVX512F, Modrm|Vex|EVexDYN|Space0F38|VexWIG|VexVVVV|Disp8ShiftVL|CheckOperandSize|NoSuf, { RegXMM|RegYMM|RegZMM|Unspecified|BaseIndex, RegXMM|RegYMM|RegZMM, RegXMM|RegYMM|RegZMM } +-vaesenc, 0x66dc, VAES|AVX|AVX512F, Modrm|Vex|EVexDYN|Space0F38|VexWIG|VexVVVV|Disp8ShiftVL|CheckOperandSize|NoSuf, { RegXMM|RegYMM|RegZMM|Unspecified|BaseIndex, RegXMM|RegYMM|RegZMM, RegXMM|RegYMM|RegZMM } +-vaesenclast, 0x66dd, VAES|AVX|AVX512F, Modrm|Vex|EVexDYN|Space0F38|VexWIG|VexVVVV|Disp8ShiftVL|CheckOperandSize|NoSuf, { RegXMM|RegYMM|RegZMM|Unspecified|BaseIndex, RegXMM|RegYMM|RegZMM, RegXMM|RegYMM|RegZMM } ++vaesdec, 0x66de, VAES&(AVX|AVX512F), Modrm|Vex|EVexDYN|Space0F38|VexWIG|VexVVVV|Disp8ShiftVL|CheckOperandSize|NoSuf, { RegXMM|RegYMM|RegZMM|Unspecified|BaseIndex, RegXMM|RegYMM|RegZMM, RegXMM|RegYMM|RegZMM } ++vaesdeclast, 0x66df, VAES&(AVX|AVX512F), Modrm|Vex|EVexDYN|Space0F38|VexWIG|VexVVVV|Disp8ShiftVL|CheckOperandSize|NoSuf, { RegXMM|RegYMM|RegZMM|Unspecified|BaseIndex, RegXMM|RegYMM|RegZMM, RegXMM|RegYMM|RegZMM } ++vaesenc, 0x66dc, VAES&(AVX|AVX512F), Modrm|Vex|EVexDYN|Space0F38|VexWIG|VexVVVV|Disp8ShiftVL|CheckOperandSize|NoSuf, { RegXMM|RegYMM|RegZMM|Unspecified|BaseIndex, RegXMM|RegYMM|RegZMM, RegXMM|RegYMM|RegZMM } ++vaesenclast, 0x66dd, VAES&(AVX|AVX512F), Modrm|Vex|EVexDYN|Space0F38|VexWIG|VexVVVV|Disp8ShiftVL|CheckOperandSize|NoSuf, { RegXMM|RegYMM|RegZMM|Unspecified|BaseIndex, RegXMM|RegYMM|RegZMM, RegXMM|RegYMM|RegZMM } + + // VAES instructions end + + // VPCLMULQDQ instructions + +-vpclmulqdq, 0x6644, VPCLMULQDQ|AVX|AVX512F, Modrm|Space0F3A|Vex|EVexDYN|VexWIG|VexVVVV|Disp8ShiftVL|CheckOperandSize|NoSuf, { Imm8|Imm8S, RegXMM|RegYMM|RegZMM|Unspecified|BaseIndex, RegXMM|RegYMM|RegZMM, RegXMM|RegYMM|RegZMM } +-vpclmullqlqdq, 0x6644/0x00, VPCLMULQDQ|AVX|AVX512F, Modrm|Space0F3A|Vex|EVexDYN|VexWIG|VexVVVV|Disp8ShiftVL|CheckOperandSize|NoSuf|ImmExt, { RegXMM|RegYMM|RegZMM|Unspecified|BaseIndex, RegXMM|RegYMM|RegZMM, RegXMM|RegYMM|RegZMM } +-vpclmulhqlqdq, 0x6644/0x01, VPCLMULQDQ|AVX|AVX512F, Modrm|Space0F3A|Vex|EVexDYN|VexWIG|VexVVVV|Disp8ShiftVL|CheckOperandSize|NoSuf|ImmExt, { RegXMM|RegYMM|RegZMM|Unspecified|BaseIndex, RegXMM|RegYMM|RegZMM, RegXMM|RegYMM|RegZMM } +-vpclmullqhqdq, 0x6644/0x10, VPCLMULQDQ|AVX|AVX512F, Modrm|Space0F3A|Vex|EVexDYN|VexWIG|VexVVVV|Disp8ShiftVL|CheckOperandSize|NoSuf|ImmExt, { RegXMM|RegYMM|RegZMM|Unspecified|BaseIndex, RegXMM|RegYMM|RegZMM, RegXMM|RegYMM|RegZMM } +-vpclmulhqhqdq, 0x6644/0x11, VPCLMULQDQ|AVX|AVX512F, Modrm|Space0F3A|Vex|EVexDYN|VexWIG|VexVVVV|Disp8ShiftVL|CheckOperandSize|NoSuf|ImmExt, { RegXMM|RegYMM|RegZMM|Unspecified|BaseIndex, RegXMM|RegYMM|RegZMM, RegXMM|RegYMM|RegZMM } ++vpclmulqdq, 0x6644, VPCLMULQDQ&(AVX|AVX512F), Modrm|Space0F3A|Vex|EVexDYN|VexWIG|VexVVVV|Disp8ShiftVL|CheckOperandSize|NoSuf, { Imm8|Imm8S, RegXMM|RegYMM|RegZMM|Unspecified|BaseIndex, RegXMM|RegYMM|RegZMM, RegXMM|RegYMM|RegZMM } ++vpclmullqlqdq, 0x6644/0x00, VPCLMULQDQ&(AVX|AVX512F), Modrm|Space0F3A|Vex|EVexDYN|VexWIG|VexVVVV|Disp8ShiftVL|CheckOperandSize|NoSuf|ImmExt, { RegXMM|RegYMM|RegZMM|Unspecified|BaseIndex, RegXMM|RegYMM|RegZMM, RegXMM|RegYMM|RegZMM } ++vpclmulhqlqdq, 0x6644/0x01, VPCLMULQDQ&(AVX|AVX512F), Modrm|Space0F3A|Vex|EVexDYN|VexWIG|VexVVVV|Disp8ShiftVL|CheckOperandSize|NoSuf|ImmExt, { RegXMM|RegYMM|RegZMM|Unspecified|BaseIndex, RegXMM|RegYMM|RegZMM, RegXMM|RegYMM|RegZMM } ++vpclmullqhqdq, 0x6644/0x10, VPCLMULQDQ&(AVX|AVX512F), Modrm|Space0F3A|Vex|EVexDYN|VexWIG|VexVVVV|Disp8ShiftVL|CheckOperandSize|NoSuf|ImmExt, { RegXMM|RegYMM|RegZMM|Unspecified|BaseIndex, RegXMM|RegYMM|RegZMM, RegXMM|RegYMM|RegZMM } ++vpclmulhqhqdq, 0x6644/0x11, VPCLMULQDQ&(AVX|AVX512F), Modrm|Space0F3A|Vex|EVexDYN|VexWIG|VexVVVV|Disp8ShiftVL|CheckOperandSize|NoSuf|ImmExt, { RegXMM|RegYMM|RegZMM|Unspecified|BaseIndex, RegXMM|RegYMM|RegZMM, RegXMM|RegYMM|RegZMM } + + // VPCLMULQDQ instructions end + + // AVX512F instructions. + + // is used for EVEX instructions with x/y suffixes. ++// NOTE: The order of the "unnamed" ($-prefixed) entries here needs to remain ++// in sync with , for match_template()'s EVEX-to-VEX lowering to ++// continue to work. + , 0x45, , Modrm|Vex256|Space0F|VexVVVV|VexW0|NoSuf, { R + kxnor, 0x46, , Modrm|Vex256|Space0F|VexVVVV|VexW0|NoSuf, { RegMask, RegMask, RegMask } + kxor, 0x47, , Modrm|Vex256|Space0F|VexVVVV|VexW0|NoSuf, { RegMask, RegMask, RegMask } + +-kmov, 0x90, , Modrm|Vex128|Space0F|VexW0|NoSuf, { RegMask||Unspecified|BaseIndex, RegMask } +-kmov, 0x91, , Modrm|Vex128|Space0F|VexW0|NoSuf, { RegMask, |Unspecified|BaseIndex } +-kmov, 0x92, , D|Modrm|Vex128|Space0F|VexW0|NoSuf, { Reg32, RegMask } ++kmov, 0x90, APX_F(), Modrm|Vex128|EVex128|Space0F|VexW0|NoSuf, { RegMask||Unspecified|BaseIndex, RegMask } ++kmov, 0x91, APX_F(), Modrm|Vex128|EVex128|Space0F|VexW0|NoSuf, { RegMask, |Unspecified|BaseIndex } ++kmov, 0x92, APX_F(), D|Modrm|Vex128|EVex128|Space0F|VexW0|NoSuf, { Reg32, RegMask } + + knot, 0x44, , Modrm|Vex128|Space0F|VexW0|NoSuf, { RegMask, RegMask } + kortest, 0x98, , Modrm|Vex128|Space0F|VexW0|NoSuf, { RegMask, RegMask } +@@ -2188,11 +2243,11 @@ vcvtudq2pd, 0xF37A, AVX512F, Modrm|EVex=1|Masking|Space0F|VexW=1|Broadcast|Disp8 + vcvtdq2ps, 0x5B, AVX512F, Modrm|Masking|Space0F|VexW0|Broadcast|Disp8ShiftVL|CheckOperandSize|NoSuf|StaticRounding|SAE, { RegXMM|RegYMM|RegZMM|Dword|Unspecified|BaseIndex, RegXMM|RegYMM|RegZMM } + vcvtps2udq, 0x79, AVX512F, Modrm|Masking|Space0F|VexW0|Broadcast|Disp8ShiftVL|CheckOperandSize|NoSuf|StaticRounding|SAE, { RegXMM|RegYMM|RegZMM|Dword|Unspecified|BaseIndex, RegXMM|RegYMM|RegZMM } + +-vcvtpd2dq, 0xf2e6, AVX512F|, Modrm||Masking|Space0F|VexW1|Broadcast|NoSuf|, { |Qword, } ++vcvtpd2dq, 0xf2e6, AVX512F&, Modrm||Masking|Space0F|VexW1|Broadcast|NoSuf|, { |Qword, } + +-vcvtpd2ps, 0x665a, AVX512F|, Modrm||Masking|Space0F|VexW1|Broadcast|NoSuf|, { |Qword, } ++vcvtpd2ps, 0x665a, AVX512F&, Modrm||Masking|Space0F|VexW1|Broadcast|NoSuf|, { |Qword, } + +-vcvtpd2udq, 0x79, AVX512F|, Modrm||Masking|Space0F|VexW1|Broadcast|NoSuf|, { |Qword, } ++vcvtpd2udq, 0x79, AVX512F&, Modrm||Masking|Space0F|VexW1|Broadcast|NoSuf|, { |Qword, } + + vcvtph2ps, 0x6613, AVX512F, Modrm|EVex512|Masking|Space0F38|VexW0|Disp8MemShift=5|NoSuf|SAE, { RegYMM|Unspecified|BaseIndex, RegZMM } + +@@ -2223,8 +2278,8 @@ vcvtusi2ss, 0xF37B, AVX512F, Modrm|EVexLIG|Space0F|VexVVVV|Disp8ShiftVL|No_bSuf| + + vcvtss2sd, 0xF35A, AVX512F, Modrm|EVexLIG|Masking|Space0F|VexVVVV|VexW0|Disp8MemShift=2|NoSuf|SAE, { RegXMM|Dword|Unspecified|BaseIndex, RegXMM, RegXMM } + +-vcvttpd2dq, 0x66e6, AVX512F|, Modrm||Masking|Space0F|VexW1|Broadcast|NoSuf|, { |Qword, } +-vcvttpd2udq, 0x78, AVX512F|, Modrm||Masking|Space0F|VexW1|Broadcast|NoSuf|, { |Qword, } ++vcvttpd2dq, 0x66e6, AVX512F&, Modrm||Masking|Space0F|VexW1|Broadcast|NoSuf|, { |Qword, } ++vcvttpd2udq, 0x78, AVX512F&, Modrm||Masking|Space0F|VexW1|Broadcast|NoSuf|, { |Qword, } + + vcvttps2dq, 0xF35B, AVX512F, Modrm|Masking|Space0F|VexW0|Broadcast|Disp8ShiftVL|CheckOperandSize|NoSuf|SAE, { RegXMM|RegYMM|RegZMM|Dword|Unspecified|BaseIndex, RegXMM|RegYMM|RegZMM } + vcvttps2udq, 0x78, AVX512F, Modrm|Masking|Space0F|VexW0|Broadcast|Disp8ShiftVL|CheckOperandSize|NoSuf|SAE, { RegXMM|RegYMM|RegZMM|Dword|Unspecified|BaseIndex, RegXMM|RegYMM|RegZMM } +@@ -2272,8 +2327,8 @@ vmovntdqa, 0x662A, AVX512F, Modrm|Space0F38|VexW=1|Disp8ShiftVL|CheckOperandSize + vgetexpp, 0x6642, , Modrm|Masking|||Broadcast|Disp8ShiftVL|CheckOperandSize|NoSuf|SAE, { RegXMM|RegYMM|RegZMM||Unspecified|BaseIndex, RegXMM|RegYMM|RegZMM } + vgetexps, 0x6643, , Modrm|EVexLIG|Masking||VexVVVV||Disp8MemShift|NoSuf|SAE, { RegXMM||Unspecified|BaseIndex, RegXMM, RegXMM } + +-vinsertf32x4, 0x6618, AVX512F, Modrm|Masking|Space0F3A|VexVVVV|VexW0|Disp8MemShift=4|CheckOperandSize|NoSuf, { Imm8, RegXMM|XMMword|Unspecified|BaseIndex, RegYMM|RegZMM, RegYMM|RegZMM } +-vinserti32x4, 0x6638, AVX512F, Modrm|Masking|Space0F3A|VexVVVV|VexW0|Disp8MemShift=4|CheckOperandSize|NoSuf, { Imm8, RegXMM|XMMword|Unspecified|BaseIndex, RegYMM|RegZMM, RegYMM|RegZMM } ++vinsertf32x4, 0x6618, AVX512F, Modrm|Masking|Space0F3A|VexVVVV|VexW0|Disp8MemShift=4|CheckOperandSize|NoSuf, { Imm8, RegXMM|Unspecified|BaseIndex, RegYMM|RegZMM, RegYMM|RegZMM } ++vinserti32x4, 0x6638, AVX512F, Modrm|Masking|Space0F3A|VexVVVV|VexW0|Disp8MemShift=4|CheckOperandSize|NoSuf, { Imm8, RegXMM|Unspecified|BaseIndex, RegYMM|RegZMM, RegYMM|RegZMM } + + vinsertf64x4, 0x661A, AVX512F, Modrm|EVex=1|Masking|Space0F3A|VexVVVV|VexW1|Disp8MemShift=5|NoSuf, { Imm8, RegYMM|Unspecified|BaseIndex, RegZMM, RegZMM } + vinserti64x4, 0x663A, AVX512F, Modrm|EVex=1|Masking|Space0F3A|VexVVVV|VexW1|Disp8MemShift=5|NoSuf, { Imm8, RegYMM|Unspecified|BaseIndex, RegZMM, RegZMM } +@@ -2470,17 +2525,17 @@ clflushopt, 0x660fae/7, ClflushOpt, Modrm|Anysize|IgnoreSize|NoSuf, { BaseIndex + + // XSAVES/XRSTORS instructions. + +-xrstors, 0xfc7/3, XSAVES, Modrm|NoSuf, { Unspecified|BaseIndex } +-xrstors64, 0xfc7/3, XSAVES|x64, Modrm|NoSuf|Size64, { Unspecified|BaseIndex } +-xsaves, 0xfc7/5, XSAVES, Modrm|NoSuf, { Unspecified|BaseIndex } +-xsaves64, 0xfc7/5, XSAVES|x64, Modrm|NoSuf|Size64, { Unspecified|BaseIndex } ++xrstors, 0xfc7/3, XSAVES, Modrm|NoSuf|NoEgpr, { Unspecified|BaseIndex } ++xrstors64, 0xfc7/3, XSAVES&x64, Modrm|NoSuf|Size64|NoEgpr, { Unspecified|BaseIndex } ++xsaves, 0xfc7/5, XSAVES, Modrm|NoSuf|NoEgpr, { Unspecified|BaseIndex } ++xsaves64, 0xfc7/5, XSAVES&x64, Modrm|NoSuf|Size64|NoEgpr, { Unspecified|BaseIndex } + + // XSAVES instructions end. + + // XSAVEC instructions. + +-xsavec, 0xfc7/4, XSAVEC, Modrm|NoSuf, { Unspecified|BaseIndex } +-xsavec64, 0xfc7/4, XSAVEC|x64, Modrm|NoSuf|Size64, { Unspecified|BaseIndex } ++xsavec, 0xfc7/4, XSAVEC, Modrm|NoSuf|NoEgpr, { Unspecified|BaseIndex } ++xsavec64, 0xfc7/4, XSAVEC&x64, Modrm|NoSuf|Size64|NoEgpr, { Unspecified|BaseIndex } + + // XSAVEC instructions end. + +@@ -2494,108 +2549,108 @@ enclv, 0xf01c0, SE1, NoSuf, {} + + // AVX512VL instructions. + +-vgatherdpd, 0x6692, AVX512F|AVX512VL, Modrm|Masking|NoDefMask|Space0F38|VexW1|Disp8MemShift=3|VecSIB128|NoSuf, { Qword|Unspecified|BaseIndex, RegXMM|RegYMM } +-vgatherdps, 0x6692, AVX512F|AVX512VL, Modrm|EVex=2|Masking|NoDefMask|Space0F38|VexW0|Disp8MemShift=2|VecSIB128|NoSuf, { Dword|Unspecified|BaseIndex, RegXMM } +-vgatherdps, 0x6692, AVX512F|AVX512VL, Modrm|EVex=3|Masking|NoDefMask|Space0F38|VexW0|Disp8MemShift=2|VecSIB256|NoSuf, { Dword|Unspecified|BaseIndex, RegYMM } +-vgatherqp, 0x6693, AVX512F|AVX512VL, Modrm|EVex128|Masking|NoDefMask|Space0F38||Disp8MemShift|VecSIB128|NoSuf, { |Unspecified|BaseIndex, RegXMM } +-vgatherqpd, 0x6693, AVX512F|AVX512VL, Modrm|EVex256|Masking|NoDefMask|Space0F38|VexW1|Disp8MemShift=3|VecSIB256|NoSuf, { Qword|Unspecified|BaseIndex, RegYMM } +-vgatherqps, 0x6693, AVX512F|AVX512VL, Modrm|EVex=3|Masking|NoDefMask|Space0F38|VexW0|Disp8MemShift=2|VecSIB256|NoSuf, { Dword|Unspecified|BaseIndex, RegXMM } +-vpgatherdd, 0x6690, AVX512F|AVX512VL, Modrm|EVex=2|Masking|NoDefMask|Space0F38|VexW0|Disp8MemShift=2|VecSIB128|NoSuf, { Dword|Unspecified|BaseIndex, RegXMM } +-vpgatherdd, 0x6690, AVX512F|AVX512VL, Modrm|EVex=3|Masking|NoDefMask|Space0F38|VexW0|Disp8MemShift=2|VecSIB256|NoSuf, { Dword|Unspecified|BaseIndex, RegYMM } +-vpgatherdq, 0x6690, AVX512F|AVX512VL, Modrm|Masking|NoDefMask|Space0F38|VexW1|Disp8MemShift=3|VecSIB128|NoSuf, { Qword|Unspecified|BaseIndex, RegXMM|RegYMM } +-vpgatherq, 0x6691, AVX512F|AVX512VL, Modrm|EVex128|Masking|NoDefMask|Space0F38||Disp8MemShift|VecSIB128|NoSuf, { |Unspecified|BaseIndex, RegXMM } +-vpgatherqd, 0x6691, AVX512F|AVX512VL, Modrm|EVex=3|Masking|NoDefMask|Space0F38|VexW0|Disp8MemShift=2|VecSIB256|NoSuf, { Dword|Unspecified|BaseIndex, RegXMM } +-vpgatherqq, 0x6691, AVX512F|AVX512VL, Modrm|EVex256|Masking|NoDefMask|Space0F38|VexW1|Disp8MemShift=3|VecSIB256|NoSuf, { Qword|Unspecified|BaseIndex, RegYMM } +- +-vpscatterdd, 0x66A0, AVX512F|AVX512VL, Modrm|EVex=2|Masking|NoDefMask|Space0F38|VexW0|Disp8MemShift=2|VecSIB128|NoSuf, { RegXMM, Dword|Unspecified|BaseIndex } +-vpscatterdd, 0x66A0, AVX512F|AVX512VL, Modrm|EVex=3|Masking|NoDefMask|Space0F38|VexW0|Disp8MemShift=2|VecSIB256|NoSuf, { RegYMM, Dword|Unspecified|BaseIndex } +-vpscatterdq, 0x66A0, AVX512F|AVX512VL, Modrm|Masking|NoDefMask|Space0F38|VexW1|Disp8MemShift=3|VecSIB128|NoSuf, { RegXMM|RegYMM, Qword|Unspecified|BaseIndex } +-vpscatterq, 0x66A1, AVX512F|AVX512VL, Modrm|EVex128|Masking|NoDefMask|Space0F38||Disp8MemShift|VecSIB128|NoSuf, { RegXMM, |Unspecified|BaseIndex } +-vpscatterqd, 0x66A1, AVX512F|AVX512VL, Modrm|EVex=3|Masking|NoDefMask|Space0F38|VexW0|Disp8MemShift=2|VecSIB256|NoSuf, { RegXMM, Dword|Unspecified|BaseIndex } +-vpscatterqq, 0x66A1, AVX512F|AVX512VL, Modrm|EVex256|Masking|NoDefMask|Space0F38|VexW1|Disp8MemShift=3|VecSIB256|NoSuf, { RegYMM, Qword|Unspecified|BaseIndex } +-vscatterdpd, 0x66A2, AVX512F|AVX512VL, Modrm|Masking|NoDefMask|Space0F38|VexW1|Disp8MemShift=3|VecSIB128|NoSuf, { RegXMM|RegYMM, Qword|Unspecified|BaseIndex } +-vscatterdps, 0x66A2, AVX512F|AVX512VL, Modrm|EVex=2|Masking|NoDefMask|Space0F38|VexW0|Disp8MemShift=2|VecSIB128|NoSuf, { RegXMM, Dword|Unspecified|BaseIndex } +-vscatterdps, 0x66A2, AVX512F|AVX512VL, Modrm|EVex=3|Masking|NoDefMask|Space0F38|VexW0|Disp8MemShift=2|VecSIB256|NoSuf, { RegYMM, Dword|Unspecified|BaseIndex } +-vscatterqp, 0x66A3, AVX512F|AVX512VL, Modrm|EVex128|Masking|NoDefMask|Space0F38||Disp8MemShift|VecSIB128|NoSuf, { RegXMM, |Unspecified|BaseIndex } +-vscatterqpd, 0x66A3, AVX512F|AVX512VL, Modrm|EVex256|Masking|NoDefMask|Space0F38|VexW1|Disp8MemShift=3|VecSIB256|NoSuf, { RegYMM, Qword|Unspecified|BaseIndex } +-vscatterqps, 0x66A3, AVX512F|AVX512VL, Modrm|EVex=3|Masking|NoDefMask|Space0F38|VexW0|Disp8MemShift=2|VecSIB256|NoSuf, { RegXMM, Dword|Unspecified|BaseIndex } +- +-vcvtdq2pd, 0xF3E6, AVX512F|AVX512VL, Modrm|EVex128|Masking|Space0F|VexW0|Broadcast|Disp8MemShift=3|NoSuf, { RegXMM|Dword|Qword|Unspecified|BaseIndex, RegXMM } +-vcvtdq2pd, 0xF3E6, AVX512F|AVX512VL, Modrm|EVex256|Masking|Space0F|VexW0|Broadcast|Disp8MemShift=4|NoSuf, { RegXMM|Dword|Unspecified|BaseIndex, RegYMM } +-vcvtudq2pd, 0xF37A, AVX512F|AVX512VL, Modrm|EVex128|Masking|Space0F|VexW0|Broadcast|Disp8MemShift=3|NoSuf, { RegXMM|Dword|Qword|Unspecified|BaseIndex, RegXMM } +-vcvtudq2pd, 0xF37A, AVX512F|AVX512VL, Modrm|EVex256|Masking|Space0F|VexW0|Broadcast|Disp8MemShift=4|NoSuf, { RegXMM|Dword|Unspecified|BaseIndex, RegYMM } +- +-vcvtph2ps, 0x6613, AVX512F|AVX512VL, Modrm|EVex=2|Masking|Space0F38|VexW0|Disp8MemShift=3|NoSuf, { RegXMM|Qword|Unspecified|BaseIndex, RegXMM } +-vcvtph2ps, 0x6613, AVX512F|AVX512VL, Modrm|EVex=3|Masking|Space0F38|VexW=1|Disp8MemShift=4|NoSuf, { RegXMM|Unspecified|BaseIndex, RegYMM } +- +-vcvtps2pd, 0x5A, AVX512F|AVX512VL, Modrm|EVex128|Masking|Space0F|VexW0|Broadcast|Disp8MemShift=3|NoSuf, { RegXMM|Dword|Qword|Unspecified|BaseIndex, RegXMM } +-vcvtps2pd, 0x5A, AVX512F|AVX512VL, Modrm|EVex256|Masking|Space0F|VexW0|Broadcast|Disp8MemShift=4|NoSuf, { RegXMM|Dword|Unspecified|BaseIndex, RegYMM } +- +-vcvtps2ph, 0x661D, AVX512F|AVX512VL, Modrm|EVex128|Masking|Space0F3A|VexW0|Disp8MemShift=3|NoSuf, { Imm8, RegXMM, RegXMM|Qword|Unspecified|BaseIndex } +-vcvtps2ph, 0x661D, AVX512F|AVX512VL, Modrm|EVex256|Masking|Space0F3A|VexW0|Disp8MemShift=4|NoSuf, { Imm8, RegYMM, RegXMM|Unspecified|BaseIndex } +- +-vmovddup, 0xF212, AVX512F|AVX512VL, Modrm|EVex=2|Masking|Space0F|VexW1|Disp8MemShift=3|NoSuf, { RegXMM|Qword|Unspecified|BaseIndex, RegXMM } +- +-vpmovdb, 0xF331, AVX512F|AVX512VL, Modrm|EVex=2|Masking|Space0F38|VexW0|Disp8MemShift=2|NoSuf, { RegXMM, RegXMM|Dword|Unspecified|BaseIndex } +-vpmovdb, 0xF331, AVX512F|AVX512VL, Modrm|EVex=3|Masking|Space0F38|VexW0|Disp8MemShift=3|NoSuf, { RegYMM, RegXMM|Qword|Unspecified|BaseIndex } +-vpmovsdb, 0xF321, AVX512F|AVX512VL, Modrm|EVex=2|Masking|Space0F38|VexW0|Disp8MemShift=2|NoSuf, { RegXMM, RegXMM|Dword|Unspecified|BaseIndex } +-vpmovsdb, 0xF321, AVX512F|AVX512VL, Modrm|EVex=3|Masking|Space0F38|VexW0|Disp8MemShift=3|NoSuf, { RegYMM, RegXMM|Qword|Unspecified|BaseIndex } +-vpmovusdb, 0xF311, AVX512F|AVX512VL, Modrm|EVex=2|Masking|Space0F38|VexW0|Disp8MemShift=2|NoSuf, { RegXMM, RegXMM|Dword|Unspecified|BaseIndex } +-vpmovusdb, 0xF311, AVX512F|AVX512VL, Modrm|EVex=3|Masking|Space0F38|VexW0|Disp8MemShift=3|NoSuf, { RegYMM, RegXMM|Qword|Unspecified|BaseIndex } +- +-vpmovdw, 0xF333, AVX512F|AVX512VL, Modrm|EVex=2|Masking|Space0F38|VexW0|Disp8MemShift=3|NoSuf, { RegXMM, RegXMM|Qword|Unspecified|BaseIndex } +-vpmovdw, 0xF333, AVX512F|AVX512VL, Modrm|EVex=3|Masking|Space0F38|VexW=1|Disp8MemShift=4|NoSuf, { RegYMM, RegXMM|Unspecified|BaseIndex } +-vpmovsdw, 0xF323, AVX512F|AVX512VL, Modrm|EVex=2|Masking|Space0F38|VexW0|Disp8MemShift=3|NoSuf, { RegXMM, RegXMM|Qword|Unspecified|BaseIndex } +-vpmovsdw, 0xF323, AVX512F|AVX512VL, Modrm|EVex=3|Masking|Space0F38|VexW=1|Disp8MemShift=4|NoSuf, { RegYMM, RegXMM|Unspecified|BaseIndex } +-vpmovusdw, 0xF313, AVX512F|AVX512VL, Modrm|EVex=2|Masking|Space0F38|VexW0|Disp8MemShift=3|NoSuf, { RegXMM, RegXMM|Qword|Unspecified|BaseIndex } +-vpmovusdw, 0xF313, AVX512F|AVX512VL, Modrm|EVex=3|Masking|Space0F38|VexW=1|Disp8MemShift=4|NoSuf, { RegYMM, RegXMM|Unspecified|BaseIndex } +- +-vpmovqb, 0xF332, AVX512F|AVX512VL, Modrm|EVex=2|Masking|Space0F38|VexW0|Disp8MemShift=1|NoSuf, { RegXMM, RegXMM|Word|Unspecified|BaseIndex } +-vpmovqb, 0xF332, AVX512F|AVX512VL, Modrm|EVex=3|Masking|Space0F38|VexW0|Disp8MemShift=2|NoSuf, { RegYMM, RegXMM|Dword|Unspecified|BaseIndex } +-vpmovsqb, 0xF322, AVX512F|AVX512VL, Modrm|EVex=2|Masking|Space0F38|VexW0|Disp8MemShift=1|NoSuf, { RegXMM, RegXMM|Word|Unspecified|BaseIndex } +-vpmovsqb, 0xF322, AVX512F|AVX512VL, Modrm|EVex=3|Masking|Space0F38|VexW0|Disp8MemShift=2|NoSuf, { RegYMM, RegXMM|Dword|Unspecified|BaseIndex } +-vpmovusqb, 0xF312, AVX512F|AVX512VL, Modrm|EVex=2|Masking|Space0F38|VexW0|Disp8MemShift=1|NoSuf, { RegXMM, RegXMM|Word|Unspecified|BaseIndex } +-vpmovusqb, 0xF312, AVX512F|AVX512VL, Modrm|EVex=3|Masking|Space0F38|VexW0|Disp8MemShift=2|NoSuf, { RegYMM, RegXMM|Dword|Unspecified|BaseIndex } +- +-vpmovqd, 0xF335, AVX512F|AVX512VL, Modrm|EVex=2|Masking|Space0F38|VexW0|Disp8MemShift=3|NoSuf, { RegXMM, RegXMM|Qword|Unspecified|BaseIndex } +-vpmovqd, 0xF335, AVX512F|AVX512VL, Modrm|EVex=3|Masking|Space0F38|VexW=1|Disp8MemShift=4|NoSuf, { RegYMM, RegXMM|Unspecified|BaseIndex } +-vpmovsqd, 0xF325, AVX512F|AVX512VL, Modrm|EVex=2|Masking|Space0F38|VexW0|Disp8MemShift=3|NoSuf, { RegXMM, RegXMM|Qword|Unspecified|BaseIndex } +-vpmovsqd, 0xF325, AVX512F|AVX512VL, Modrm|EVex=3|Masking|Space0F38|VexW=1|Disp8MemShift=4|NoSuf, { RegYMM, RegXMM|Unspecified|BaseIndex } +-vpmovusqd, 0xF315, AVX512F|AVX512VL, Modrm|EVex=2|Masking|Space0F38|VexW0|Disp8MemShift=3|NoSuf, { RegXMM, RegXMM|Qword|Unspecified|BaseIndex } +-vpmovusqd, 0xF315, AVX512F|AVX512VL, Modrm|EVex=3|Masking|Space0F38|VexW=1|Disp8MemShift=4|NoSuf, { RegYMM, RegXMM|Unspecified|BaseIndex } +- +-vpmovqw, 0xF334, AVX512F|AVX512VL, Modrm|EVex=2|Masking|Space0F38|VexW0|Disp8MemShift=2|NoSuf, { RegXMM, RegXMM|Dword|Unspecified|BaseIndex } +-vpmovqw, 0xF334, AVX512F|AVX512VL, Modrm|EVex=3|Masking|Space0F38|VexW0|Disp8MemShift=3|NoSuf, { RegYMM, RegXMM|Qword|Unspecified|BaseIndex } +-vpmovsqw, 0xF324, AVX512F|AVX512VL, Modrm|EVex=2|Masking|Space0F38|VexW0|Disp8MemShift=2|NoSuf, { RegXMM, RegXMM|Dword|Unspecified|BaseIndex } +-vpmovsqw, 0xF324, AVX512F|AVX512VL, Modrm|EVex=3|Masking|Space0F38|VexW0|Disp8MemShift=3|NoSuf, { RegYMM, RegXMM|Qword|Unspecified|BaseIndex } +-vpmovusqw, 0xF314, AVX512F|AVX512VL, Modrm|EVex=2|Masking|Space0F38|VexW0|Disp8MemShift=2|NoSuf, { RegXMM, RegXMM|Dword|Unspecified|BaseIndex } +-vpmovusqw, 0xF314, AVX512F|AVX512VL, Modrm|EVex=3|Masking|Space0F38|VexW0|Disp8MemShift=3|NoSuf, { RegYMM, RegXMM|Qword|Unspecified|BaseIndex } +- +-vpmovsxdq, 0x6625, AVX512F|AVX512VL, Modrm|EVex=2|Masking|Space0F38|VexW0|Disp8MemShift=3|NoSuf, { RegXMM|Qword|Unspecified|BaseIndex, RegXMM } +-vpmovsxdq, 0x6625, AVX512F|AVX512VL, Modrm|EVex=3|Masking|Space0F38|VexW=1|Disp8MemShift=4|NoSuf, { RegXMM|Unspecified|BaseIndex, RegYMM } +-vpmovzxdq, 0x6635, AVX512F|AVX512VL, Modrm|EVex=2|Masking|Space0F38|VexW0|Disp8MemShift=3|NoSuf, { RegXMM|Qword|Unspecified|BaseIndex, RegXMM } +-vpmovzxdq, 0x6635, AVX512F|AVX512VL, Modrm|EVex=3|Masking|Space0F38|VexW=1|Disp8MemShift=4|NoSuf, { RegXMM|Unspecified|BaseIndex, RegYMM } ++vgatherdpd, 0x6692, AVX512VL, Modrm|Masking|NoDefMask|Space0F38|VexW1|Disp8MemShift=3|VecSIB128|NoSuf, { Qword|Unspecified|BaseIndex, RegXMM|RegYMM } ++vgatherdps, 0x6692, AVX512VL, Modrm|EVex=2|Masking|NoDefMask|Space0F38|VexW0|Disp8MemShift=2|VecSIB128|NoSuf, { Dword|Unspecified|BaseIndex, RegXMM } ++vgatherdps, 0x6692, AVX512VL, Modrm|EVex=3|Masking|NoDefMask|Space0F38|VexW0|Disp8MemShift=2|VecSIB256|NoSuf, { Dword|Unspecified|BaseIndex, RegYMM } ++vgatherqp, 0x6693, AVX512VL, Modrm|EVex128|Masking|NoDefMask|Space0F38||Disp8MemShift|VecSIB128|NoSuf, { |Unspecified|BaseIndex, RegXMM } ++vgatherqpd, 0x6693, AVX512VL, Modrm|EVex256|Masking|NoDefMask|Space0F38|VexW1|Disp8MemShift=3|VecSIB256|NoSuf, { Qword|Unspecified|BaseIndex, RegYMM } ++vgatherqps, 0x6693, AVX512VL, Modrm|EVex=3|Masking|NoDefMask|Space0F38|VexW0|Disp8MemShift=2|VecSIB256|NoSuf, { Dword|Unspecified|BaseIndex, RegXMM } ++vpgatherdd, 0x6690, AVX512VL, Modrm|EVex=2|Masking|NoDefMask|Space0F38|VexW0|Disp8MemShift=2|VecSIB128|NoSuf, { Dword|Unspecified|BaseIndex, RegXMM } ++vpgatherdd, 0x6690, AVX512VL, Modrm|EVex=3|Masking|NoDefMask|Space0F38|VexW0|Disp8MemShift=2|VecSIB256|NoSuf, { Dword|Unspecified|BaseIndex, RegYMM } ++vpgatherdq, 0x6690, AVX512VL, Modrm|Masking|NoDefMask|Space0F38|VexW1|Disp8MemShift=3|VecSIB128|NoSuf, { Qword|Unspecified|BaseIndex, RegXMM|RegYMM } ++vpgatherq, 0x6691, AVX512VL, Modrm|EVex128|Masking|NoDefMask|Space0F38||Disp8MemShift|VecSIB128|NoSuf, { |Unspecified|BaseIndex, RegXMM } ++vpgatherqd, 0x6691, AVX512VL, Modrm|EVex=3|Masking|NoDefMask|Space0F38|VexW0|Disp8MemShift=2|VecSIB256|NoSuf, { Dword|Unspecified|BaseIndex, RegXMM } ++vpgatherqq, 0x6691, AVX512VL, Modrm|EVex256|Masking|NoDefMask|Space0F38|VexW1|Disp8MemShift=3|VecSIB256|NoSuf, { Qword|Unspecified|BaseIndex, RegYMM } ++ ++vpscatterdd, 0x66A0, AVX512VL, Modrm|EVex=2|Masking|NoDefMask|Space0F38|VexW0|Disp8MemShift=2|VecSIB128|NoSuf, { RegXMM, Dword|Unspecified|BaseIndex } ++vpscatterdd, 0x66A0, AVX512VL, Modrm|EVex=3|Masking|NoDefMask|Space0F38|VexW0|Disp8MemShift=2|VecSIB256|NoSuf, { RegYMM, Dword|Unspecified|BaseIndex } ++vpscatterdq, 0x66A0, AVX512VL, Modrm|Masking|NoDefMask|Space0F38|VexW1|Disp8MemShift=3|VecSIB128|NoSuf, { RegXMM|RegYMM, Qword|Unspecified|BaseIndex } ++vpscatterq, 0x66A1, AVX512VL, Modrm|EVex128|Masking|NoDefMask|Space0F38||Disp8MemShift|VecSIB128|NoSuf, { RegXMM, |Unspecified|BaseIndex } ++vpscatterqd, 0x66A1, AVX512VL, Modrm|EVex=3|Masking|NoDefMask|Space0F38|VexW0|Disp8MemShift=2|VecSIB256|NoSuf, { RegXMM, Dword|Unspecified|BaseIndex } ++vpscatterqq, 0x66A1, AVX512VL, Modrm|EVex256|Masking|NoDefMask|Space0F38|VexW1|Disp8MemShift=3|VecSIB256|NoSuf, { RegYMM, Qword|Unspecified|BaseIndex } ++vscatterdpd, 0x66A2, AVX512VL, Modrm|Masking|NoDefMask|Space0F38|VexW1|Disp8MemShift=3|VecSIB128|NoSuf, { RegXMM|RegYMM, Qword|Unspecified|BaseIndex } ++vscatterdps, 0x66A2, AVX512VL, Modrm|EVex=2|Masking|NoDefMask|Space0F38|VexW0|Disp8MemShift=2|VecSIB128|NoSuf, { RegXMM, Dword|Unspecified|BaseIndex } ++vscatterdps, 0x66A2, AVX512VL, Modrm|EVex=3|Masking|NoDefMask|Space0F38|VexW0|Disp8MemShift=2|VecSIB256|NoSuf, { RegYMM, Dword|Unspecified|BaseIndex } ++vscatterqp, 0x66A3, AVX512VL, Modrm|EVex128|Masking|NoDefMask|Space0F38||Disp8MemShift|VecSIB128|NoSuf, { RegXMM, |Unspecified|BaseIndex } ++vscatterqpd, 0x66A3, AVX512VL, Modrm|EVex256|Masking|NoDefMask|Space0F38|VexW1|Disp8MemShift=3|VecSIB256|NoSuf, { RegYMM, Qword|Unspecified|BaseIndex } ++vscatterqps, 0x66A3, AVX512VL, Modrm|EVex=3|Masking|NoDefMask|Space0F38|VexW0|Disp8MemShift=2|VecSIB256|NoSuf, { RegXMM, Dword|Unspecified|BaseIndex } ++ ++vcvtdq2pd, 0xF3E6, AVX512VL, Modrm|EVex128|Masking|Space0F|VexW0|Broadcast|Disp8MemShift=3|NoSuf, { RegXMM|Dword|Qword|Unspecified|BaseIndex, RegXMM } ++vcvtdq2pd, 0xF3E6, AVX512VL, Modrm|EVex256|Masking|Space0F|VexW0|Broadcast|Disp8MemShift=4|NoSuf, { RegXMM|Dword|Unspecified|BaseIndex, RegYMM } ++vcvtudq2pd, 0xF37A, AVX512VL, Modrm|EVex128|Masking|Space0F|VexW0|Broadcast|Disp8MemShift=3|NoSuf, { RegXMM|Dword|Qword|Unspecified|BaseIndex, RegXMM } ++vcvtudq2pd, 0xF37A, AVX512VL, Modrm|EVex256|Masking|Space0F|VexW0|Broadcast|Disp8MemShift=4|NoSuf, { RegXMM|Dword|Unspecified|BaseIndex, RegYMM } ++ ++vcvtph2ps, 0x6613, AVX512VL, Modrm|EVex=2|Masking|Space0F38|VexW0|Disp8MemShift=3|NoSuf, { RegXMM|Qword|Unspecified|BaseIndex, RegXMM } ++vcvtph2ps, 0x6613, AVX512VL, Modrm|EVex=3|Masking|Space0F38|VexW=1|Disp8MemShift=4|NoSuf, { RegXMM|Unspecified|BaseIndex, RegYMM } ++ ++vcvtps2pd, 0x5A, AVX512VL, Modrm|EVex128|Masking|Space0F|VexW0|Broadcast|Disp8MemShift=3|NoSuf, { RegXMM|Dword|Qword|Unspecified|BaseIndex, RegXMM } ++vcvtps2pd, 0x5A, AVX512VL, Modrm|EVex256|Masking|Space0F|VexW0|Broadcast|Disp8MemShift=4|NoSuf, { RegXMM|Dword|Unspecified|BaseIndex, RegYMM } ++ ++vcvtps2ph, 0x661D, AVX512VL, Modrm|EVex128|Masking|Space0F3A|VexW0|Disp8MemShift=3|NoSuf, { Imm8, RegXMM, RegXMM|Qword|Unspecified|BaseIndex } ++vcvtps2ph, 0x661D, AVX512VL, Modrm|EVex256|Masking|Space0F3A|VexW0|Disp8MemShift=4|NoSuf, { Imm8, RegYMM, RegXMM|Unspecified|BaseIndex } ++ ++vmovddup, 0xF212, AVX512VL, Modrm|EVex=2|Masking|Space0F|VexW1|Disp8MemShift=3|NoSuf, { RegXMM|Qword|Unspecified|BaseIndex, RegXMM } ++ ++vpmovdb, 0xF331, AVX512VL, Modrm|EVex=2|Masking|Space0F38|VexW0|Disp8MemShift=2|NoSuf, { RegXMM, RegXMM|Dword|Unspecified|BaseIndex } ++vpmovdb, 0xF331, AVX512VL, Modrm|EVex=3|Masking|Space0F38|VexW0|Disp8MemShift=3|NoSuf, { RegYMM, RegXMM|Qword|Unspecified|BaseIndex } ++vpmovsdb, 0xF321, AVX512VL, Modrm|EVex=2|Masking|Space0F38|VexW0|Disp8MemShift=2|NoSuf, { RegXMM, RegXMM|Dword|Unspecified|BaseIndex } ++vpmovsdb, 0xF321, AVX512VL, Modrm|EVex=3|Masking|Space0F38|VexW0|Disp8MemShift=3|NoSuf, { RegYMM, RegXMM|Qword|Unspecified|BaseIndex } ++vpmovusdb, 0xF311, AVX512VL, Modrm|EVex=2|Masking|Space0F38|VexW0|Disp8MemShift=2|NoSuf, { RegXMM, RegXMM|Dword|Unspecified|BaseIndex } ++vpmovusdb, 0xF311, AVX512VL, Modrm|EVex=3|Masking|Space0F38|VexW0|Disp8MemShift=3|NoSuf, { RegYMM, RegXMM|Qword|Unspecified|BaseIndex } ++ ++vpmovdw, 0xF333, AVX512VL, Modrm|EVex=2|Masking|Space0F38|VexW0|Disp8MemShift=3|NoSuf, { RegXMM, RegXMM|Qword|Unspecified|BaseIndex } ++vpmovdw, 0xF333, AVX512VL, Modrm|EVex=3|Masking|Space0F38|VexW=1|Disp8MemShift=4|NoSuf, { RegYMM, RegXMM|Unspecified|BaseIndex } ++vpmovsdw, 0xF323, AVX512VL, Modrm|EVex=2|Masking|Space0F38|VexW0|Disp8MemShift=3|NoSuf, { RegXMM, RegXMM|Qword|Unspecified|BaseIndex } ++vpmovsdw, 0xF323, AVX512VL, Modrm|EVex=3|Masking|Space0F38|VexW=1|Disp8MemShift=4|NoSuf, { RegYMM, RegXMM|Unspecified|BaseIndex } ++vpmovusdw, 0xF313, AVX512VL, Modrm|EVex=2|Masking|Space0F38|VexW0|Disp8MemShift=3|NoSuf, { RegXMM, RegXMM|Qword|Unspecified|BaseIndex } ++vpmovusdw, 0xF313, AVX512VL, Modrm|EVex=3|Masking|Space0F38|VexW=1|Disp8MemShift=4|NoSuf, { RegYMM, RegXMM|Unspecified|BaseIndex } ++ ++vpmovqb, 0xF332, AVX512VL, Modrm|EVex=2|Masking|Space0F38|VexW0|Disp8MemShift=1|NoSuf, { RegXMM, RegXMM|Word|Unspecified|BaseIndex } ++vpmovqb, 0xF332, AVX512VL, Modrm|EVex=3|Masking|Space0F38|VexW0|Disp8MemShift=2|NoSuf, { RegYMM, RegXMM|Dword|Unspecified|BaseIndex } ++vpmovsqb, 0xF322, AVX512VL, Modrm|EVex=2|Masking|Space0F38|VexW0|Disp8MemShift=1|NoSuf, { RegXMM, RegXMM|Word|Unspecified|BaseIndex } ++vpmovsqb, 0xF322, AVX512VL, Modrm|EVex=3|Masking|Space0F38|VexW0|Disp8MemShift=2|NoSuf, { RegYMM, RegXMM|Dword|Unspecified|BaseIndex } ++vpmovusqb, 0xF312, AVX512VL, Modrm|EVex=2|Masking|Space0F38|VexW0|Disp8MemShift=1|NoSuf, { RegXMM, RegXMM|Word|Unspecified|BaseIndex } ++vpmovusqb, 0xF312, AVX512VL, Modrm|EVex=3|Masking|Space0F38|VexW0|Disp8MemShift=2|NoSuf, { RegYMM, RegXMM|Dword|Unspecified|BaseIndex } ++ ++vpmovqd, 0xF335, AVX512VL, Modrm|EVex=2|Masking|Space0F38|VexW0|Disp8MemShift=3|NoSuf, { RegXMM, RegXMM|Qword|Unspecified|BaseIndex } ++vpmovqd, 0xF335, AVX512VL, Modrm|EVex=3|Masking|Space0F38|VexW=1|Disp8MemShift=4|NoSuf, { RegYMM, RegXMM|Unspecified|BaseIndex } ++vpmovsqd, 0xF325, AVX512VL, Modrm|EVex=2|Masking|Space0F38|VexW0|Disp8MemShift=3|NoSuf, { RegXMM, RegXMM|Qword|Unspecified|BaseIndex } ++vpmovsqd, 0xF325, AVX512VL, Modrm|EVex=3|Masking|Space0F38|VexW=1|Disp8MemShift=4|NoSuf, { RegYMM, RegXMM|Unspecified|BaseIndex } ++vpmovusqd, 0xF315, AVX512VL, Modrm|EVex=2|Masking|Space0F38|VexW0|Disp8MemShift=3|NoSuf, { RegXMM, RegXMM|Qword|Unspecified|BaseIndex } ++vpmovusqd, 0xF315, AVX512VL, Modrm|EVex=3|Masking|Space0F38|VexW=1|Disp8MemShift=4|NoSuf, { RegYMM, RegXMM|Unspecified|BaseIndex } ++ ++vpmovqw, 0xF334, AVX512VL, Modrm|EVex=2|Masking|Space0F38|VexW0|Disp8MemShift=2|NoSuf, { RegXMM, RegXMM|Dword|Unspecified|BaseIndex } ++vpmovqw, 0xF334, AVX512VL, Modrm|EVex=3|Masking|Space0F38|VexW0|Disp8MemShift=3|NoSuf, { RegYMM, RegXMM|Qword|Unspecified|BaseIndex } ++vpmovsqw, 0xF324, AVX512VL, Modrm|EVex=2|Masking|Space0F38|VexW0|Disp8MemShift=2|NoSuf, { RegXMM, RegXMM|Dword|Unspecified|BaseIndex } ++vpmovsqw, 0xF324, AVX512VL, Modrm|EVex=3|Masking|Space0F38|VexW0|Disp8MemShift=3|NoSuf, { RegYMM, RegXMM|Qword|Unspecified|BaseIndex } ++vpmovusqw, 0xF314, AVX512VL, Modrm|EVex=2|Masking|Space0F38|VexW0|Disp8MemShift=2|NoSuf, { RegXMM, RegXMM|Dword|Unspecified|BaseIndex } ++vpmovusqw, 0xF314, AVX512VL, Modrm|EVex=3|Masking|Space0F38|VexW0|Disp8MemShift=3|NoSuf, { RegYMM, RegXMM|Qword|Unspecified|BaseIndex } ++ ++vpmovsxdq, 0x6625, AVX512VL, Modrm|EVex=2|Masking|Space0F38|VexW0|Disp8MemShift=3|NoSuf, { RegXMM|Qword|Unspecified|BaseIndex, RegXMM } ++vpmovsxdq, 0x6625, AVX512VL, Modrm|EVex=3|Masking|Space0F38|VexW=1|Disp8MemShift=4|NoSuf, { RegXMM|Unspecified|BaseIndex, RegYMM } ++vpmovzxdq, 0x6635, AVX512VL, Modrm|EVex=2|Masking|Space0F38|VexW0|Disp8MemShift=3|NoSuf, { RegXMM|Qword|Unspecified|BaseIndex, RegXMM } ++vpmovzxdq, 0x6635, AVX512VL, Modrm|EVex=3|Masking|Space0F38|VexW=1|Disp8MemShift=4|NoSuf, { RegXMM|Unspecified|BaseIndex, RegYMM } + + // AVX512VL instructions end. + + // AVX512BW instructions. + +-kadd, 0x4a, AVX512BW, Modrm|Vex256|Space0F|VexVVVV|VexW1||NoSuf, { RegMask, RegMask, RegMask } +-kand, 0x41, AVX512BW, Modrm|Vex256|Space0F|VexVVVV|VexW1||NoSuf, { RegMask, RegMask, RegMask } +-kandn, 0x42, AVX512BW, Modrm|Vex256|Space0F|VexVVVV|VexW1||NoSuf|Optimize, { RegMask, RegMask, RegMask } +-kmov, 0x90, AVX512BW, Modrm|Vex128|Space0F|VexW1||NoSuf, { RegMask||Unspecified|BaseIndex, RegMask } +-kmov, 0x91, AVX512BW, Modrm|Vex128|Space0F|VexW1||NoSuf, { RegMask, |Unspecified|BaseIndex } +-kmov, 0xf292, AVX512BW, D|Modrm|Vex128|Space0F|||NoSuf, { , RegMask } +-knot, 0x44, AVX512BW, Modrm|Vex128|Space0F|VexW1||NoSuf, { RegMask, RegMask } +-kor, 0x45, AVX512BW, Modrm|Vex256|Space0F|VexVVVV|VexW1||NoSuf, { RegMask, RegMask, RegMask } +-kortest, 0x98, AVX512BW, Modrm|Vex128|Space0F|VexW1||NoSuf, { RegMask, RegMask } +-ktest, 0x99, AVX512BW, Modrm|Vex128|Space0F|VexW1||NoSuf, { RegMask, RegMask } +-kxnor, 0x46, AVX512BW, Modrm|Vex256|Space0F|VexVVVV|VexW1||NoSuf, { RegMask, RegMask, RegMask } +-kxor, 0x47, AVX512BW, Modrm|Vex256|Space0F|VexVVVV|VexW1||NoSuf|Optimize, { RegMask, RegMask, RegMask } +-kunpckdq, 0x4B, AVX512BW, Modrm|Vex256|Space0F|VexVVVV|VexW1|Vsz512|NoSuf, { RegMask, RegMask, RegMask } +-kunpckwd, 0x4B, AVX512BW, Modrm|Vex256|Space0F|VexVVVV|VexW0|Vsz256|NoSuf, { RegMask, RegMask, RegMask } +-kshiftl, 0x6633, AVX512BW, Modrm|Vex128|Space0F3A|||NoSuf, { Imm8, RegMask, RegMask } +-kshiftr, 0x6631, AVX512BW, Modrm|Vex128|Space0F3A|||NoSuf, { Imm8, RegMask, RegMask } ++kadd, 0x4a, AVX512BW, Modrm|Vex256|Space0F|VexVVVV|VexW1|NoSuf, { RegMask, RegMask, RegMask } ++kand, 0x41, AVX512BW, Modrm|Vex256|Space0F|VexVVVV|VexW1|NoSuf, { RegMask, RegMask, RegMask } ++kandn, 0x42, AVX512BW, Modrm|Vex256|Space0F|VexVVVV|VexW1|NoSuf|Optimize, { RegMask, RegMask, RegMask } ++kmov, 0x90, APX_F(AVX512BW), Modrm|Vex128|EVex128|Space0F|VexW1|NoSuf, { RegMask||Unspecified|BaseIndex, RegMask } ++kmov, 0x91, APX_F(AVX512BW), Modrm|Vex128|EVex128|Space0F|VexW1|NoSuf, { RegMask, |Unspecified|BaseIndex } ++kmov, 0xf292, APX_F(AVX512BW), D|Modrm|Vex128|EVex128|Space0F||NoSuf, { , RegMask } ++knot, 0x44, AVX512BW, Modrm|Vex128|Space0F|VexW1|NoSuf, { RegMask, RegMask } ++kor, 0x45, AVX512BW, Modrm|Vex256|Space0F|VexVVVV|VexW1|NoSuf, { RegMask, RegMask, RegMask } ++kortest, 0x98, AVX512BW, Modrm|Vex128|Space0F|VexW1|NoSuf, { RegMask, RegMask } ++ktest, 0x99, AVX512BW, Modrm|Vex128|Space0F|VexW1|NoSuf, { RegMask, RegMask } ++kxnor, 0x46, AVX512BW, Modrm|Vex256|Space0F|VexVVVV|VexW1|NoSuf, { RegMask, RegMask, RegMask } ++kxor, 0x47, AVX512BW, Modrm|Vex256|Space0F|VexVVVV|VexW1|NoSuf|Optimize, { RegMask, RegMask, RegMask } ++kunpckdq, 0x4B, AVX512BW, Modrm|Vex256|Space0F|VexVVVV|VexW1|NoSuf, { RegMask, RegMask, RegMask } ++kunpckwd, 0x4B, AVX512BW, Modrm|Vex256|Space0F|VexVVVV|VexW0|NoSuf, { RegMask, RegMask, RegMask } ++kshiftl, 0x6633, AVX512BW, Modrm|Vex128|Space0F3A||NoSuf, { Imm8, RegMask, RegMask } ++kshiftr, 0x6631, AVX512BW, Modrm|Vex128|Space0F3A||NoSuf, { Imm8, RegMask, RegMask } + + vdbpsadbw, 0x6642, AVX512BW, Modrm|Masking|Space0F3A|VexVVVV|VexW0|Disp8ShiftVL|CheckOperandSize|NoSuf, { Imm8|Imm8S, RegXMM|RegYMM|RegZMM|Unspecified|BaseIndex, RegXMM|RegYMM|RegZMM, RegXMM|RegYMM|RegZMM } + +@@ -2681,23 +2736,23 @@ vpmov2m, 0xf329, AVX512BW, Modrm|EVexDYN|Space0F38||NoSuf, { RegXMM + vpmovm2, 0xf328, AVX512BW, Modrm|EVexDYN|Space0F38||NoSuf, { RegMask, RegXMM|RegYMM|RegZMM } + + vpmovswb, 0xF320, AVX512BW, Modrm|EVex=1|Masking|Space0F38|VexW=1|Disp8MemShift=5|NoSuf, { RegZMM, RegYMM|Unspecified|BaseIndex } +-vpmovswb, 0xF320, AVX512BW|AVX512VL, Modrm|EVex=2|Masking|Space0F38|VexW0|Disp8MemShift=3|NoSuf, { RegXMM, RegXMM|Qword|Unspecified|BaseIndex } +-vpmovswb, 0xF320, AVX512BW|AVX512VL, Modrm|EVex=3|Masking|Space0F38|VexW=1|Disp8MemShift=4|NoSuf, { RegYMM, RegXMM|Unspecified|BaseIndex } ++vpmovswb, 0xF320, AVX512BW&AVX512VL, Modrm|EVex=2|Masking|Space0F38|VexW0|Disp8MemShift=3|NoSuf, { RegXMM, RegXMM|Qword|Unspecified|BaseIndex } ++vpmovswb, 0xF320, AVX512BW&AVX512VL, Modrm|EVex=3|Masking|Space0F38|VexW=1|Disp8MemShift=4|NoSuf, { RegYMM, RegXMM|Unspecified|BaseIndex } + + vpmovuswb, 0xF310, AVX512BW, Modrm|EVex=1|Masking|Space0F38|VexW=1|Disp8MemShift=5|NoSuf, { RegZMM, RegYMM|Unspecified|BaseIndex } +-vpmovuswb, 0xF310, AVX512BW|AVX512VL, Modrm|EVex=2|Masking|Space0F38|VexW0|Disp8MemShift=3|NoSuf, { RegXMM, RegXMM|Qword|Unspecified|BaseIndex } +-vpmovuswb, 0xF310, AVX512BW|AVX512VL, Modrm|EVex=3|Masking|Space0F38|VexW=1|Disp8MemShift=4|NoSuf, { RegYMM, RegXMM|Unspecified|BaseIndex } ++vpmovuswb, 0xF310, AVX512BW&AVX512VL, Modrm|EVex=2|Masking|Space0F38|VexW0|Disp8MemShift=3|NoSuf, { RegXMM, RegXMM|Qword|Unspecified|BaseIndex } ++vpmovuswb, 0xF310, AVX512BW&AVX512VL, Modrm|EVex=3|Masking|Space0F38|VexW=1|Disp8MemShift=4|NoSuf, { RegYMM, RegXMM|Unspecified|BaseIndex } + + vpmovwb, 0xF330, AVX512BW, Modrm|EVex=1|Masking|Space0F38|VexW=1|Disp8MemShift=5|NoSuf, { RegZMM, RegYMM|Unspecified|BaseIndex } +-vpmovwb, 0xF330, AVX512BW|AVX512VL, Modrm|EVex=2|Masking|Space0F38|VexW0|Disp8MemShift=3|NoSuf, { RegXMM, RegXMM|Qword|Unspecified|BaseIndex } +-vpmovwb, 0xF330, AVX512BW|AVX512VL, Modrm|EVex=3|Masking|Space0F38|VexW=1|Disp8MemShift=4|NoSuf, { RegYMM, RegXMM|Unspecified|BaseIndex } ++vpmovwb, 0xF330, AVX512BW&AVX512VL, Modrm|EVex=2|Masking|Space0F38|VexW0|Disp8MemShift=3|NoSuf, { RegXMM, RegXMM|Qword|Unspecified|BaseIndex } ++vpmovwb, 0xF330, AVX512BW&AVX512VL, Modrm|EVex=3|Masking|Space0F38|VexW=1|Disp8MemShift=4|NoSuf, { RegYMM, RegXMM|Unspecified|BaseIndex } + + vpmovsxbw, 0x6620, AVX512BW, Modrm|EVex=1|Masking|Space0F38|VexWIG|Disp8MemShift=5|NoSuf, { RegYMM|Unspecified|BaseIndex, RegZMM } +-vpmovsxbw, 0x6620, AVX512BW|AVX512VL, Modrm|EVex=2|Masking|VexWIG|Space0F38|Disp8MemShift=3|NoSuf, { RegXMM|Qword|Unspecified|BaseIndex, RegXMM } +-vpmovsxbw, 0x6620, AVX512BW|AVX512VL, Modrm|EVex=3|Masking|VexWIG|Space0F38|Disp8MemShift=4|NoSuf, { RegXMM|Unspecified|BaseIndex, RegYMM } ++vpmovsxbw, 0x6620, AVX512BW&AVX512VL, Modrm|EVex=2|Masking|VexWIG|Space0F38|Disp8MemShift=3|NoSuf, { RegXMM|Qword|Unspecified|BaseIndex, RegXMM } ++vpmovsxbw, 0x6620, AVX512BW&AVX512VL, Modrm|EVex=3|Masking|VexWIG|Space0F38|Disp8MemShift=4|NoSuf, { RegXMM|Unspecified|BaseIndex, RegYMM } + vpmovzxbw, 0x6630, AVX512BW, Modrm|EVex=1|Masking|Space0F38|VexWIG|Disp8MemShift=5|NoSuf, { RegYMM|Unspecified|BaseIndex, RegZMM } +-vpmovzxbw, 0x6630, AVX512BW|AVX512VL, Modrm|EVex=2|Masking|VexWIG|Space0F38|Disp8MemShift=3|NoSuf, { RegXMM|Qword|Unspecified|BaseIndex, RegXMM } +-vpmovzxbw, 0x6630, AVX512BW|AVX512VL, Modrm|EVex=3|Masking|VexWIG|Space0F38|Disp8MemShift=4|NoSuf, { RegXMM|Unspecified|BaseIndex, RegYMM } ++vpmovzxbw, 0x6630, AVX512BW&AVX512VL, Modrm|EVex=2|Masking|VexWIG|Space0F38|Disp8MemShift=3|NoSuf, { RegXMM|Qword|Unspecified|BaseIndex, RegXMM } ++vpmovzxbw, 0x6630, AVX512BW&AVX512VL, Modrm|EVex=3|Masking|VexWIG|Space0F38|Disp8MemShift=4|NoSuf, { RegXMM|Unspecified|BaseIndex, RegYMM } + + vpsadbw, 0x66F6, AVX512BW, Modrm|Space0F|VexVVVV|VexWIG|Disp8ShiftVL|CheckOperandSize|NoSuf, { RegXMM|RegYMM|RegZMM|Unspecified|BaseIndex, RegXMM|RegYMM|RegZMM, RegXMM|RegYMM|RegZMM } + +@@ -2738,36 +2793,36 @@ vcvtpd2qq, 0x667B, AVX512DQ, Modrm|Masking|Space0F|VexW1|Broadcast|Disp8ShiftVL| + vcvtpd2uqq, 0x6679, AVX512DQ, Modrm|Masking|Space0F|VexW1|Broadcast|Disp8ShiftVL|CheckOperandSize|NoSuf|StaticRounding|SAE, { RegXMM|RegYMM|RegZMM|Qword|Unspecified|BaseIndex, RegXMM|RegYMM|RegZMM } + + vcvtps2qq, 0x667B, AVX512DQ, Modrm|EVex512|Masking|Space0F|VexW0|Broadcast|Disp8MemShift=5|NoSuf|StaticRounding|SAE, { RegYMM|Dword|Unspecified|BaseIndex, RegZMM } +-vcvtps2qq, 0x667B, AVX512DQ|AVX512VL, Modrm|EVex128|Masking|Space0F|VexW0|Broadcast|Disp8MemShift=3|NoSuf, { RegXMM|Dword|Qword|Unspecified|BaseIndex, RegXMM } +-vcvtps2qq, 0x667B, AVX512DQ|AVX512VL, Modrm|EVex256|Masking|Space0F|VexW0|Broadcast|Disp8MemShift=4|NoSuf, { RegXMM|Dword|Unspecified|BaseIndex, RegYMM } ++vcvtps2qq, 0x667B, AVX512DQ&AVX512VL, Modrm|EVex128|Masking|Space0F|VexW0|Broadcast|Disp8MemShift=3|NoSuf, { RegXMM|Dword|Qword|Unspecified|BaseIndex, RegXMM } ++vcvtps2qq, 0x667B, AVX512DQ&AVX512VL, Modrm|EVex256|Masking|Space0F|VexW0|Broadcast|Disp8MemShift=4|NoSuf, { RegXMM|Dword|Unspecified|BaseIndex, RegYMM } + vcvtps2uqq, 0x6679, AVX512DQ, Modrm|EVex512|Masking|Space0F|VexW0|Broadcast|Disp8MemShift=5|NoSuf|StaticRounding|SAE, { RegYMM|Dword|Unspecified|BaseIndex, RegZMM } +-vcvtps2uqq, 0x6679, AVX512DQ|AVX512VL, Modrm|EVex128|Masking|Space0F|VexW0|Broadcast|Disp8MemShift=3|NoSuf, { RegXMM|Dword|Qword|Unspecified|BaseIndex, RegXMM } +-vcvtps2uqq, 0x6679, AVX512DQ|AVX512VL, Modrm|EVex256|Masking|Space0F|VexW0|Broadcast|Disp8MemShift=4|NoSuf, { RegXMM|RegXMM|Dword|Unspecified|BaseIndex, RegYMM } ++vcvtps2uqq, 0x6679, AVX512DQ&AVX512VL, Modrm|EVex128|Masking|Space0F|VexW0|Broadcast|Disp8MemShift=3|NoSuf, { RegXMM|Dword|Qword|Unspecified|BaseIndex, RegXMM } ++vcvtps2uqq, 0x6679, AVX512DQ&AVX512VL, Modrm|EVex256|Masking|Space0F|VexW0|Broadcast|Disp8MemShift=4|NoSuf, { RegXMM|RegXMM|Dword|Unspecified|BaseIndex, RegYMM } + + vcvtqq2pd, 0xF3E6, AVX512DQ, Modrm|Masking|Space0F|VexW1|Broadcast|Disp8ShiftVL|CheckOperandSize|NoSuf|StaticRounding|SAE, { RegXMM|RegYMM|RegZMM|Qword|Unspecified|BaseIndex, RegXMM|RegYMM|RegZMM } + vcvtuqq2pd, 0xF37A, AVX512DQ, Modrm|Masking|Space0F|VexW1|Broadcast|Disp8ShiftVL|CheckOperandSize|NoSuf|StaticRounding|SAE, { RegXMM|RegYMM|RegZMM|Qword|Unspecified|BaseIndex, RegXMM|RegYMM|RegZMM } + +-vcvtqq2ps, 0x5b, AVX512DQ|, Modrm||Masking|Space0F|VexW1|Broadcast|NoSuf|, { |Qword, } ++vcvtqq2ps, 0x5b, AVX512DQ&, Modrm||Masking|Space0F|VexW1|Broadcast|NoSuf|, { |Qword, } + + vcvttpd2qq, 0x667A, AVX512DQ, Modrm|Masking|Space0F|VexW1|Broadcast|Disp8ShiftVL|CheckOperandSize|NoSuf|SAE, { RegXMM|RegYMM|RegZMM|Qword|Unspecified|BaseIndex, RegXMM|RegYMM|RegZMM } + vcvttpd2uqq, 0x6678, AVX512DQ, Modrm|Masking|Space0F|VexW1|Broadcast|Disp8ShiftVL|CheckOperandSize|NoSuf|SAE, { RegXMM|RegYMM|RegZMM|Qword|Unspecified|BaseIndex, RegXMM|RegYMM|RegZMM } + + vcvttps2qq, 0x667A, AVX512DQ, Modrm|EVex512|Masking|Space0F|VexW0|Broadcast|Disp8MemShift=5|NoSuf|SAE, { RegYMM|Dword|Unspecified|BaseIndex, RegZMM } +-vcvttps2qq, 0x667A, AVX512DQ|AVX512VL, Modrm|EVex128|Masking|Space0F|VexW0|Broadcast|Disp8MemShift=3|NoSuf, { RegXMM|Dword|Qword|Unspecified|BaseIndex, RegXMM } +-vcvttps2qq, 0x667A, AVX512DQ|AVX512VL, Modrm|EVex256|Masking|Space0F|VexW0|Broadcast|Disp8MemShift=4|NoSuf, { RegXMM|Dword|Unspecified|BaseIndex, RegYMM } ++vcvttps2qq, 0x667A, AVX512DQ&AVX512VL, Modrm|EVex128|Masking|Space0F|VexW0|Broadcast|Disp8MemShift=3|NoSuf, { RegXMM|Dword|Qword|Unspecified|BaseIndex, RegXMM } ++vcvttps2qq, 0x667A, AVX512DQ&AVX512VL, Modrm|EVex256|Masking|Space0F|VexW0|Broadcast|Disp8MemShift=4|NoSuf, { RegXMM|Dword|Unspecified|BaseIndex, RegYMM } + vcvttps2uqq, 0x6678, AVX512DQ, Modrm|EVex512|Masking|Space0F|VexW0|Broadcast|Disp8MemShift=5|NoSuf|SAE, { RegYMM|Dword|Unspecified|BaseIndex, RegZMM } +-vcvttps2uqq, 0x6678, AVX512DQ|AVX512VL, Modrm|EVex128|Masking|Space0F|VexW0|Broadcast|Disp8MemShift=3|NoSuf, { RegXMM|Dword|Qword|Unspecified|BaseIndex, RegXMM } +-vcvttps2uqq, 0x6678, AVX512DQ|AVX512VL, Modrm|EVex256|Masking|Space0F|VexW0|Broadcast|Disp8MemShift=4|NoSuf, { RegXMM|Dword|Unspecified|BaseIndex, RegYMM } ++vcvttps2uqq, 0x6678, AVX512DQ&AVX512VL, Modrm|EVex128|Masking|Space0F|VexW0|Broadcast|Disp8MemShift=3|NoSuf, { RegXMM|Dword|Qword|Unspecified|BaseIndex, RegXMM } ++vcvttps2uqq, 0x6678, AVX512DQ&AVX512VL, Modrm|EVex256|Masking|Space0F|VexW0|Broadcast|Disp8MemShift=4|NoSuf, { RegXMM|Dword|Unspecified|BaseIndex, RegYMM } + +-vcvtuqq2ps, 0xf27a, AVX512DQ|, Modrm||Masking|Space0F|VexW1|Broadcast|NoSuf|, { |Qword, } ++vcvtuqq2ps, 0xf27a, AVX512DQ&, Modrm||Masking|Space0F|VexW1|Broadcast|NoSuf|, { |Qword, } + + vextractf32x8, 0x661B, AVX512DQ, Modrm|EVex=1|Masking|Space0F3A|VexW=1|Disp8MemShift=5|NoSuf, { Imm8, RegZMM, RegYMM|Unspecified|BaseIndex } + vextracti32x8, 0x663B, AVX512DQ, Modrm|EVex=1|Masking|Space0F3A|VexW=1|Disp8MemShift=5|NoSuf, { Imm8, RegZMM, RegYMM|Unspecified|BaseIndex } + vinsertf32x8, 0x661A, AVX512DQ, Modrm|EVex512|Masking|Space0F3A|VexVVVV|VexW0|Disp8MemShift=5|NoSuf, { Imm8, RegYMM|Unspecified|BaseIndex, RegZMM, RegZMM } + vinserti32x8, 0x663A, AVX512DQ, Modrm|EVex512|Masking|Space0F3A|VexVVVV|VexW0|Disp8MemShift=5|NoSuf, { Imm8, RegYMM|Unspecified|BaseIndex, RegZMM, RegZMM } + +-vpextr, 0x6616, AVX512DQ|, Modrm|EVex128|Space0F3A||Disp8MemShift|NoSuf, { Imm8, RegXMM, |Unspecified|BaseIndex } +-vpinsr, 0x6622, AVX512DQ|, Modrm|EVex128|Space0F3A|VexVVVV||Disp8MemShift|NoSuf, { Imm8, |Unspecified|BaseIndex, RegXMM, RegXMM } ++vpextr, 0x6616, AVX512DQ&, Modrm|EVex128|Space0F3A||Disp8MemShift|NoSuf, { Imm8, RegXMM, |Unspecified|BaseIndex } ++vpinsr, 0x6622, AVX512DQ&, Modrm|EVex128|Space0F3A|VexVVVV||Disp8MemShift|NoSuf, { Imm8, |Unspecified|BaseIndex, RegXMM, RegXMM } + + vextractf64x2, 0x6619, AVX512DQ, Modrm|Masking|Space0F3A|VexW=2|Disp8MemShift=4|NoSuf, { Imm8, RegYMM|RegZMM, RegXMM|Unspecified|BaseIndex } + vextracti64x2, 0x6639, AVX512DQ, Modrm|Masking|Space0F3A|VexW=2|Disp8MemShift=4|NoSuf, { Imm8, RegYMM|RegZMM, RegXMM|Unspecified|BaseIndex } +@@ -2777,8 +2832,8 @@ vinserti64x2, 0x6638, AVX512DQ, Modrm|Masking|Space0F3A|VexVVVV|VexW1|Disp8MemSh + vfpclassp, 0x6666, AVX512DQ, Modrm|Masking|Space0F3A||Broadcast|Disp8ShiftVL|NoSuf|IntelSyntax, { Imm8|Imm8S, RegXMM|RegYMM|RegZMM||Unspecified|BaseIndex, RegMask } + vfpclassp, 0x6666, AVX512DQ, Modrm|Masking|Space0F3A||Broadcast|Disp8ShiftVL|NoSuf|ATTSyntax, { Imm8|Imm8S, RegXMM|RegYMM|RegZMM||BaseIndex, RegMask } + vfpclasspz, 0x6666, AVX512DQ, Modrm|EVex512|Masking|Space0F3A||Broadcast|Disp8MemShift=6|NoSuf, { Imm8|Imm8S, RegZMM||Unspecified|BaseIndex, RegMask } +-vfpclasspx, 0x6666, AVX512DQ|AVX512VL, Modrm|EVex128|Masking|Space0F3A||Broadcast|Disp8MemShift=4|NoSuf, { Imm8|Imm8S, RegXMM||Unspecified|BaseIndex, RegMask } +-vfpclasspy, 0x6666, AVX512DQ|AVX512VL, Modrm|EVex256|Masking|Space0F3A||Broadcast|Disp8MemShift=5|NoSuf, { Imm8|Imm8S, RegYMM||Unspecified|BaseIndex, RegMask } ++vfpclasspx, 0x6666, AVX512DQ&AVX512VL, Modrm|EVex128|Masking|Space0F3A||Broadcast|Disp8MemShift=4|NoSuf, { Imm8|Imm8S, RegXMM||Unspecified|BaseIndex, RegMask } ++vfpclasspy, 0x6666, AVX512DQ&AVX512VL, Modrm|EVex256|Masking|Space0F3A||Broadcast|Disp8MemShift=5|NoSuf, { Imm8|Imm8S, RegYMM||Unspecified|BaseIndex, RegMask } + vfpclasss, 0x67, , Modrm|EVexLIG|Masking|Space0F3A||Disp8MemShift|NoSuf, { Imm8|Imm8S, RegXMM||Unspecified|BaseIndex, RegMask } + + vpmov2m, 0xf339, AVX512DQ, Modrm|EVexDYN|Space0F38||NoSuf, { RegXMM|RegYMM|RegZMM, RegMask } +@@ -2916,8 +2971,8 @@ vpshufbitqmb, 0x668f, AVX512_BITALG, Modrm|Masking|Space0F38|VexVVVV|VexW0|Disp8 + + // AVX512 + GFNI instructions + +-vgf2p8affineinvqb, 0x66cf, GFNI|AVX512F, Modrm|Masking|Space0F3A|VexVVVV|VexW1|Broadcast|Disp8ShiftVL|CheckOperandSize|NoSuf, { Imm8, RegXMM|RegYMM|RegZMM|Qword|Unspecified|BaseIndex, RegXMM|RegYMM|RegZMM, RegXMM|RegYMM|RegZMM } +-vgf2p8affineqb, 0x66ce, GFNI|AVX512F, Modrm|Masking|Space0F3A|VexVVVV|VexW1|Broadcast|Disp8ShiftVL|CheckOperandSize|NoSuf, { Imm8, RegXMM|RegYMM|RegZMM|Qword|Unspecified|BaseIndex, RegXMM|RegYMM|RegZMM, RegXMM|RegYMM|RegZMM } ++vgf2p8affineinvqb, 0x66cf, GFNI&AVX512F, Modrm|Masking|Space0F3A|VexVVVV|VexW1|Broadcast|Disp8ShiftVL|CheckOperandSize|NoSuf, { Imm8, RegXMM|RegYMM|RegZMM|Qword|Unspecified|BaseIndex, RegXMM|RegYMM|RegZMM, RegXMM|RegYMM|RegZMM } ++vgf2p8affineqb, 0x66ce, GFNI&AVX512F, Modrm|Masking|Space0F3A|VexVVVV|VexW1|Broadcast|Disp8ShiftVL|CheckOperandSize|NoSuf, { Imm8, RegXMM|RegYMM|RegZMM|Qword|Unspecified|BaseIndex, RegXMM|RegYMM|RegZMM, RegXMM|RegYMM|RegZMM } + + // AVX512 + GFNI instructions end + +@@ -2946,7 +3001,7 @@ clzero, 0xf01fc, CLZERO, AddrPrefixOpReg|NoSuf, { Acc|Word|Dword|Qword } + monitorx, 0xf01fa, MWAITX, NoSuf, {} + monitorx, 0xf01fa, MWAITX, AddrPrefixOpReg|NoSuf, { Acc|Word|Dword|Qword, RegC|Dword, RegD|Dword } + // The 64-bit form exists only for compatibility with older gas. +-monitorx, 0xf01fa, MWAITX|x64, AddrPrefixOpReg|NoSuf, { Acc|Dword|Qword, RegC|Qword, RegD|Qword } ++monitorx, 0xf01fa, MWAITX&x64, AddrPrefixOpReg|NoSuf, { Acc|Dword|Qword, RegC|Qword, RegD|Qword } + + mwaitx, 0xf01fb, MWAITX, NoSuf, {} + // The 64-bit form exists only for compatibility with older gas. +@@ -2963,30 +3018,34 @@ wrpkru, 0xf01ef, OSPKE, NoSuf, {} + + // RDPID instructions. + +-rdpid, 0xf30fc7/7, RDPID|No64, Modrm|IgnoreSize|NoSuf, { Reg32 } +-rdpid, 0xf30fc7/7, RDPID|x64, Modrm|NoSuf|NoRex64, { Reg64 } ++rdpid, 0xf30fc7/7, RDPID&No64, Modrm|IgnoreSize|NoSuf, { Reg32 } ++rdpid, 0xf30fc7/7, RDPID&x64, Modrm|NoSuf|NoRex64, { Reg64 } + + // RDPID instructions end. + + // PTWRITE instructions. + +-ptwrite, 0xf30fae/4, PTWRITE|No64, Modrm|IgnoreSize|No_bSuf|No_wSuf|No_sSuf, { Reg32|Unspecified|BaseIndex } +-ptwrite, 0xf30fae/4, PTWRITE|x64, Modrm|No_bSuf|No_wSuf|No_sSuf, { Reg32|Reg64|Unspecified|BaseIndex } ++ptwrite, 0xf30fae/4, PTWRITE&No64, Modrm|IgnoreSize|No_bSuf|No_wSuf|No_sSuf|No_qSuf, { Reg32|Unspecified|BaseIndex } ++ptwrite, 0xf30fae/4, PTWRITE&x64, Modrm|No_bSuf|No_wSuf|No_sSuf, { Reg32|Reg64|Unspecified|BaseIndex } + + // PTWRITE instructions end. + + // CET instructions. + + incsspd, 0xf30fae/5, SHSTK, Modrm|IgnoreSize|NoSuf, { Reg32 } +-incsspq, 0xf30fae/5, SHSTK|x64, Modrm|NoSuf, { Reg64 } ++incsspq, 0xf30fae/5, SHSTK&x64, Modrm|NoSuf, { Reg64 } + rdsspd, 0xf30f1e/1, SHSTK, Modrm|IgnoreSize|NoSuf, { Reg32 } +-rdsspq, 0xf30f1e/1, SHSTK|x64, Modrm|NoSuf, { Reg64 } ++rdsspq, 0xf30f1e/1, SHSTK&x64, Modrm|NoSuf, { Reg64 } + saveprevssp, 0xf30f01ea, SHSTK, NoSuf, {} + rstorssp, 0xf30f01/5, SHSTK, Modrm|NoSuf, { Qword|Unspecified|BaseIndex } + wrssd, 0x0f38f6, SHSTK, Modrm|IgnoreSize|NoSuf, { Reg32, Dword|Unspecified|BaseIndex } +-wrssq, 0x0f38f6, SHSTK|x64, Modrm|NoSuf|Size64, { Reg64, Qword|Unspecified|BaseIndex } ++wrssd, 0x66, SHSTK&APX_F, Modrm|NoSuf|EVexMap4, { Reg32, Dword|Unspecified|BaseIndex } ++wrssq, 0x0f38f6, SHSTK&x64, Modrm|NoSuf, { Reg64, Qword|Unspecified|BaseIndex } ++wrssq, 0x66, SHSTK&APX_F, Modrm|NoSuf|EVexMap4, { Reg64, Qword|Unspecified|BaseIndex } + wrussd, 0x660f38f5, SHSTK, Modrm|IgnoreSize|NoSuf, { Reg32, Dword|Unspecified|BaseIndex } +-wrussq, 0x660f38f5, SHSTK|x64, Modrm|NoSuf, { Reg64, Qword|Unspecified|BaseIndex } ++wrussd, 0x6665, SHSTK&APX_F, Modrm|NoSuf|EVexMap4, { Reg32, Dword|Unspecified|BaseIndex } ++wrussq, 0x660f38f5, SHSTK&x64, Modrm|NoSuf, { Reg64, Qword|Unspecified|BaseIndex } ++wrussq, 0x6665, SHSTK&APX_F, Modrm|NoSuf|EVexMap4, { Reg64, Qword|Unspecified|BaseIndex } + setssbsy, 0xf30f01e8, SHSTK, NoSuf, {} + clrssbsy, 0xf30fae/6, SHSTK, Modrm|NoSuf, { Qword|Unspecified|BaseIndex } + endbr64, 0xf30f1efa, IBT, NoSuf, {} +@@ -3011,7 +3070,7 @@ pconfig, 0x0f01c5, PCONFIG, NoSuf, {} + + // PBNDKB instruction. + +-pbndkb, 0x0f01c7, PBNDKB|x64, NoSuf, {} ++pbndkb, 0x0f01c7, PBNDKB, NoSuf, {} + + // PBNDKB instruction end. + +@@ -3034,7 +3093,9 @@ cldemote, 0x0f1c/0, CLDEMOTE, Modrm|Anysize|IgnoreSize|NoSuf, { BaseIndex } + // MOVDIR[I,64B] instructions. + + movdiri, 0xf38f9, MOVDIRI, Modrm|CheckOperandSize|IgnoreSize|No_bSuf|No_wSuf|No_sSuf, { Reg32|Reg64, Dword|Qword|Unspecified|BaseIndex } ++movdiri, 0xf9, MOVDIRI&APX_F, Modrm|CheckOperandSize|No_bSuf|No_wSuf|No_sSuf|EVexMap4, { Reg32|Reg64, Dword|Qword|Unspecified|BaseIndex } + movdir64b, 0x660f38f8, MOVDIR64B, Modrm|AddrPrefixOpReg|NoSuf, { Unspecified|BaseIndex, Reg16|Reg32|Reg64 } ++movdir64b, 0x66f8, MOVDIR64B&APX_F, Modrm|AddrPrefixOpReg|NoSuf|EVexMap4, { Unspecified|BaseIndex, Reg32|Reg64 } + + // MOVEDIR instructions end. + +@@ -3042,7 +3103,7 @@ movdir64b, 0x660f38f8, MOVDIR64B, Modrm|AddrPrefixOpReg|NoSuf, { Unspecified|Bas + + vcvtne2ps2bf16, 0xf272, AVX512_BF16, Modrm|Space0F38|VexVVVV|Masking|VexW0|Broadcast|Disp8ShiftVL|CheckOperandSize|NoSuf, { RegXMM|RegYMM|RegZMM|Dword|Unspecified|BaseIndex, RegXMM|RegYMM|RegZMM, RegXMM|RegYMM|RegZMM } + +-vcvtneps2bf16, 0xf372, AVX512_BF16|, Modrm|Space0F38||Masking|VexW0|Broadcast|NoSuf, { |Dword, } ++vcvtneps2bf16, 0xf372, AVX512_BF16&, Modrm|Space0F38||Masking|VexW0|Broadcast|NoSuf, { |Dword, } + + vdpbf16ps, 0xf352, AVX512_BF16, Modrm|Space0F38|VexVVVV|Masking|VexW0|Broadcast|Disp8ShiftVL|CheckOperandSize|NoSuf, { RegXMM|RegYMM|RegZMM|Dword|Unspecified|BaseIndex, RegXMM|RegYMM|RegZMM, RegXMM|RegYMM|RegZMM } + +@@ -3063,7 +3124,9 @@ vcvtneps2bf16, 0xf372, AVX_NE_CONVERT, Modrm||Space0F38|VexW0|NoSu + // ENQCMD instructions. + + enqcmd, 0xf20f38f8, ENQCMD, Modrm|AddrPrefixOpReg|NoSuf, { Unspecified|BaseIndex, Reg16|Reg32|Reg64 } ++enqcmd, 0xf2f8, APX_F(ENQCMD), Modrm|AddrPrefixOpReg|NoSuf|EVexMap4, { Unspecified|BaseIndex, Reg32|Reg64 } + enqcmds, 0xf30f38f8, ENQCMD, Modrm|AddrPrefixOpReg|NoSuf, { Unspecified|BaseIndex, Reg16|Reg32|Reg64 } ++enqcmds, 0xf3f8, APX_F(ENQCMD), Modrm|AddrPrefixOpReg|NoSuf|EVexMap4, { Unspecified|BaseIndex, Reg32|Reg64 } + + // ENQCMD instructions end. + +@@ -3081,25 +3144,25 @@ mcommit, 0xf30f01fa, MCOMMIT, NoSuf, {} + + // SNP instructions + +-psmash, 0xf30f01ff, SNP|x64, NoSuf, {} +-psmash, 0xf30f01ff, SNP|x64, AddrPrefixOpReg|NoSuf, { Acc|Dword|Qword } ++psmash, 0xf30f01ff, SNP&x64, NoSuf, {} ++psmash, 0xf30f01ff, SNP&x64, AddrPrefixOpReg|NoSuf, { Acc|Dword|Qword } + pvalidate, 0xf20f01ff, SNP, NoSuf, {} + pvalidate, 0xf20f01ff, SNP, AddrPrefixOpReg|NoSuf, { Acc|Word|Dword|Qword, RegC|Dword, RegD|Dword } +-rmpupdate, 0xf20f01fe, SNP|x64, NoSuf, {} +-rmpupdate, 0xf20f01fe, SNP|x64, AddrPrefixOpReg|NoSuf, { Acc|Dword|Qword, RegC|Qword } +-rmpadjust, 0xf30f01fe, SNP|x64, NoSuf, {} +-rmpadjust, 0xf30f01fe, SNP|x64, AddrPrefixOpReg|NoSuf, { Acc|Dword|Qword, RegC|Qword, RegD|Qword } ++rmpupdate, 0xf20f01fe, SNP&x64, NoSuf, {} ++rmpupdate, 0xf20f01fe, SNP&x64, AddrPrefixOpReg|NoSuf, { Acc|Dword|Qword, RegC|Qword } ++rmpadjust, 0xf30f01fe, SNP&x64, NoSuf, {} ++rmpadjust, 0xf30f01fe, SNP&x64, AddrPrefixOpReg|NoSuf, { Acc|Dword|Qword, RegC|Qword, RegD|Qword } + // The single-operand forms exist only for compatibility with older gas. + pvalidate, 0xf20f01ff, SNP, AddrPrefixOpReg|NoSuf, { Acc|Word|Dword|Qword } +-rmpupdate, 0xf20f01fe, SNP|x64, AddrPrefixOpReg|NoSuf, { Acc|Dword|Qword } +-rmpadjust, 0xf30f01fe, SNP|x64, AddrPrefixOpReg|NoSuf, { Acc|Dword|Qword } ++rmpupdate, 0xf20f01fe, SNP&x64, AddrPrefixOpReg|NoSuf, { Acc|Dword|Qword } ++rmpadjust, 0xf30f01fe, SNP&x64, AddrPrefixOpReg|NoSuf, { Acc|Dword|Qword } + + // SNP instructions end + + // RMPQUERY instruction + +-rmpquery, 0xf30f01fd, RMPQUERY|x64, NoSuf, {} +-rmpquery, 0xf30f01fd, RMPQUERY|x64, AddrPrefixOpReg|NoSuf, { Acc|Dword|Qword, RegC|Qword, RegD|Qword } ++rmpquery, 0xf30f01fd, RMPQUERY, NoSuf, {} ++rmpquery, 0xf30f01fd, RMPQUERY, AddrPrefixOpReg|NoSuf, { Acc|Dword|Qword, RegC|Qword, RegD|Qword } + + // RMPQUERY instruction end + +@@ -3124,26 +3187,26 @@ xresldtrk, 0xf20f01e9, TSXLDTRK, NoSuf, {} + + // AMX instructions. + +-ldtilecfg, 0x49/0, AMX_TILE|x64, Modrm|Vex128|Space0F38|VexW0|NoSuf, { Unspecified|BaseIndex } +-sttilecfg, 0x6649/0, AMX_TILE|x64, Modrm|Vex128|Space0F38|VexW0|NoSuf, { Unspecified|BaseIndex } ++ldtilecfg, 0x49/0, APX_F(AMX_TILE), Modrm|Vex128|EVex128|Space0F38|VexW0|NoSuf, { Unspecified|BaseIndex } ++sttilecfg, 0x6649/0, APX_F(AMX_TILE), Modrm|Vex128|EVex128|Space0F38|VexW0|NoSuf, { Unspecified|BaseIndex } + +-tcmmimfp16ps, 0x666c, AMX_COMPLEX|x64, Modrm|Vex128|Space0F38|VexVVVV|VexW0|SwapSources|NoSuf, { RegTMM, RegTMM, RegTMM } +-tcmmrlfp16ps, 0x6c, AMX_COMPLEX|x64, Modrm|Vex128|Space0F38|VexVVVV|VexW0|SwapSources|NoSuf, { RegTMM, RegTMM, RegTMM } ++tcmmimfp16ps, 0x666c, AMX_COMPLEX, Modrm|Vex128|Space0F38|VexVVVV|VexW0|SwapSources|NoSuf, { RegTMM, RegTMM, RegTMM } ++tcmmrlfp16ps, 0x6c, AMX_COMPLEX, Modrm|Vex128|Space0F38|VexVVVV|VexW0|SwapSources|NoSuf, { RegTMM, RegTMM, RegTMM } + +-tdpbf16ps, 0xf35c, AMX_BF16|x64, Modrm|Vex128|Space0F38|VexVVVV|VexW0|SwapSources|NoSuf, { RegTMM, RegTMM, RegTMM } +-tdpfp16ps, 0xf25c, AMX_FP16|x64, Modrm|Vex128|Space0F38|VexVVVV|VexW0|SwapSources|NoSuf, { RegTMM, RegTMM, RegTMM } +-tdpbssd, 0xf25e, AMX_INT8|x64, Modrm|Vex128|Space0F38|VexVVVV|VexW0|SwapSources|NoSuf, { RegTMM, RegTMM, RegTMM } +-tdpbuud, 0x5e, AMX_INT8|x64, Modrm|Vex128|Space0F38|VexVVVV|VexW0|SwapSources|NoSuf, { RegTMM, RegTMM, RegTMM } +-tdpbusd, 0x665e, AMX_INT8|x64, Modrm|Vex128|Space0F38|VexVVVV|VexW0|SwapSources|NoSuf, { RegTMM, RegTMM, RegTMM } +-tdpbsud, 0xf35e, AMX_INT8|x64, Modrm|Vex128|Space0F38|VexVVVV|VexW0|SwapSources|NoSuf, { RegTMM, RegTMM, RegTMM } ++tdpbf16ps, 0xf35c, AMX_BF16, Modrm|Vex128|Space0F38|VexVVVV|VexW0|SwapSources|NoSuf, { RegTMM, RegTMM, RegTMM } ++tdpfp16ps, 0xf25c, AMX_FP16, Modrm|Vex128|Space0F38|VexVVVV|VexW0|SwapSources|NoSuf, { RegTMM, RegTMM, RegTMM } ++tdpbssd, 0xf25e, AMX_INT8, Modrm|Vex128|Space0F38|VexVVVV|VexW0|SwapSources|NoSuf, { RegTMM, RegTMM, RegTMM } ++tdpbuud, 0x5e, AMX_INT8, Modrm|Vex128|Space0F38|VexVVVV|VexW0|SwapSources|NoSuf, { RegTMM, RegTMM, RegTMM } ++tdpbusd, 0x665e, AMX_INT8, Modrm|Vex128|Space0F38|VexVVVV|VexW0|SwapSources|NoSuf, { RegTMM, RegTMM, RegTMM } ++tdpbsud, 0xf35e, AMX_INT8, Modrm|Vex128|Space0F38|VexVVVV|VexW0|SwapSources|NoSuf, { RegTMM, RegTMM, RegTMM } + +-tileloadd, 0xf24b, AMX_TILE|x64, Sibmem|Vex128|Space0F38|VexW0|NoSuf, { Unspecified|BaseIndex, RegTMM } +-tileloaddt1, 0x664b, AMX_TILE|x64, Sibmem|Vex128|Space0F38|VexW0|NoSuf, { Unspecified|BaseIndex, RegTMM } +-tilestored, 0xf34b, AMX_TILE|x64, Sibmem|Vex128|Space0F38|VexW0|NoSuf, { RegTMM, Unspecified|BaseIndex } ++tileloadd, 0xf24b, APX_F(AMX_TILE), Sibmem|Vex128|EVex128|Space0F38|VexW0|NoSuf, { Unspecified|BaseIndex, RegTMM } ++tileloaddt1, 0x664b, APX_F(AMX_TILE), Sibmem|Vex128|EVex128|Space0F38|VexW0|NoSuf, { Unspecified|BaseIndex, RegTMM } ++tilestored, 0xf34b, APX_F(AMX_TILE), Sibmem|Vex128|EVex128|Space0F38|VexW0|NoSuf, { RegTMM, Unspecified|BaseIndex } + +-tilerelease, 0x49c0, AMX_TILE|x64, Vex128|Space0F38|VexW0|NoSuf, {} ++tilerelease, 0x49c0, AMX_TILE, Vex128|Space0F38|VexW0|NoSuf, {} + +-tilezero, 0xf249, AMX_TILE|x64, Modrm|Vex128|Space0F38|VexW0|NoSuf, { RegTMM } ++tilezero, 0xf249, AMX_TILE, Modrm|Vex128|Space0F38|VexW0|NoSuf, { RegTMM } + + // AMX instructions end. + +@@ -3166,19 +3229,19 @@ aesdecwide256kl, 0xf30f38d8/3, WideKL, Modrm|NoSuf, { Unspecified|BaseIndex } + // TDX instructions. + + tdcall, 0x660f01cc, TDX, NoSuf, {} +-seamret, 0x660f01cd, TDX|x64, NoSuf, {} +-seamops, 0x660f01ce, TDX|x64, NoSuf, {} +-seamcall, 0x660f01cf, TDX|x64, NoSuf, {} ++seamret, 0x660f01cd, TDX&x64, NoSuf, {} ++seamops, 0x660f01ce, TDX&x64, NoSuf, {} ++seamcall, 0x660f01cf, TDX&x64, NoSuf, {} + + // TDX instructions end. + + // UINTR instructions. + +-uiret, 0xf30f01ec, UINTR|x64, NoSuf, {} +-clui, 0xf30f01ee, UINTR|x64, NoSuf, {} +-stui, 0xf30f01ef, UINTR|x64, NoSuf, {} +-testui, 0xf30f01ed, UINTR|x64, NoSuf, {} +-senduipi, 0xf30fc7/6, UINTR|x64, Modrm|NoSuf|NoRex64, { Reg64 } ++uiret, 0xf30f01ec, UINTR, NoSuf, {} ++clui, 0xf30f01ee, UINTR, NoSuf, {} ++stui, 0xf30f01ef, UINTR, NoSuf, {} ++testui, 0xf30f01ed, UINTR, NoSuf, {} ++senduipi, 0xf30fc7/6, UINTR, Modrm|NoSuf|NoRex64, { Reg64 } + + // UINTR instructions end. + +@@ -3208,37 +3271,37 @@ vcmpph, 0xc2, AVX512_FP16, Modrm|Masking|Space0F3A|VexVVVV|VexW0|Broadcast|Disp8 + vcmpsh, 0xf3c2/0x, AVX512_FP16, Modrm|EVexLIG|Masking|Space0F3A|VexVVVV|VexW0|Disp8MemShift=1|NoSuf|ImmExt|SAE, { RegXMM|Word|Unspecified|BaseIndex, RegXMM, RegMask } + vcmpsh, 0xf3c2, AVX512_FP16, Modrm|EVexLIG|Masking|Space0F3A|VexVVVV|VexW0|Disp8MemShift=1|NoSuf|SAE, { Imm8, RegXMM|Word|Unspecified|BaseIndex, RegXMM, RegMask } + +-vcvtdq2ph, 0x5b, AVX512_FP16|, Modrm||Masking|EVexMap5|VexW0|Broadcast|NoSuf|, { |Dword, } +-vcvtudq2ph, 0xf27a, AVX512_FP16|, Modrm||Masking|EVexMap5|VexW0|Broadcast|NoSuf|, { |Dword, } ++vcvtdq2ph, 0x5b, AVX512_FP16&, Modrm||Masking|EVexMap5|VexW0|Broadcast|NoSuf|, { |Dword, } ++vcvtudq2ph, 0xf27a, AVX512_FP16&, Modrm||Masking|EVexMap5|VexW0|Broadcast|NoSuf|, { |Dword, } + +-vcvtqq2ph, 0x5b, AVX512_FP16|, Modrm||Masking|EVexMap5|VexW1|Broadcast|NoSuf||, { |Qword, RegXMM } +-vcvtuqq2ph, 0xf27a, AVX512_FP16|, Modrm||Masking|EVexMap5|VexW1|Broadcast|NoSuf||, { |Qword, RegXMM } ++vcvtqq2ph, 0x5b, AVX512_FP16&, Modrm||Masking|EVexMap5|VexW1|Broadcast|NoSuf||, { |Qword, RegXMM } ++vcvtuqq2ph, 0xf27a, AVX512_FP16&, Modrm||Masking|EVexMap5|VexW1|Broadcast|NoSuf||, { |Qword, RegXMM } + +-vcvtpd2ph, 0x665a, AVX512_FP16|, Modrm||Masking|EVexMap5|VexW1|Broadcast|NoSuf||, { |Qword, RegXMM } ++vcvtpd2ph, 0x665a, AVX512_FP16&, Modrm||Masking|EVexMap5|VexW1|Broadcast|NoSuf||, { |Qword, RegXMM } + +-vcvtps2phx, 0x661d, AVX512_FP16|, Modrm||Masking|EVexMap5|VexW0|Broadcast|NoSuf|, { |Dword, } ++vcvtps2phx, 0x661d, AVX512_FP16&, Modrm||Masking|EVexMap5|VexW0|Broadcast|NoSuf|, { |Dword, } + + vcvtw2ph, 0xf37d, AVX512_FP16, Modrm|Masking|EVexMap5|VexW0|Broadcast|Disp8ShiftVL|CheckOperandSize|NoSuf|StaticRounding|SAE, { RegXMM|RegYMM|RegZMM|Word|Unspecified|BaseIndex, RegXMM|RegYMM|RegZMM } + vcvtuw2ph, 0xf27d, AVX512_FP16, Modrm|Masking|EVexMap5|VexW0|Broadcast|Disp8ShiftVL|CheckOperandSize|NoSuf|StaticRounding|SAE, { RegXMM|RegYMM|RegZMM|Word|Unspecified|BaseIndex, RegXMM|RegYMM|RegZMM } + +-vcvtph2dq, 0x665b, AVX512_FP16|AVX512VL, Modrm|EVex128|Masking|EVexMap5|VexW0|Broadcast|Disp8MemShift=3|NoSuf, { RegXMM|Word|Qword|Unspecified|BaseIndex, RegXMM } +-vcvtph2dq, 0x665b, AVX512_FP16|AVX512VL, Modrm|EVex256|Masking|EVexMap5|VexW0|Broadcast|Disp8MemShift=4|NoSuf, { RegXMM|Word|Unspecified|BaseIndex, RegYMM } ++vcvtph2dq, 0x665b, AVX512_FP16&AVX512VL, Modrm|EVex128|Masking|EVexMap5|VexW0|Broadcast|Disp8MemShift=3|NoSuf, { RegXMM|Word|Qword|Unspecified|BaseIndex, RegXMM } ++vcvtph2dq, 0x665b, AVX512_FP16&AVX512VL, Modrm|EVex256|Masking|EVexMap5|VexW0|Broadcast|Disp8MemShift=4|NoSuf, { RegXMM|Word|Unspecified|BaseIndex, RegYMM } + vcvtph2dq, 0x665b, AVX512_FP16, Modrm|EVex512|Masking|EVexMap5|VexW0|Broadcast|Disp8MemShift=5|NoSuf|StaticRounding|SAE, { RegYMM|Word|Unspecified|BaseIndex, RegZMM } + +-vcvtph2udq, 0x79, AVX512_FP16|AVX512VL, Modrm|EVex128|Masking|EVexMap5|VexW0|Broadcast|Disp8MemShift=3|NoSuf, { RegXMM|Word|Qword|Unspecified|BaseIndex, RegXMM } +-vcvtph2udq, 0x79, AVX512_FP16|AVX512VL, Modrm|EVex256|Masking|EVexMap5|VexW0|Broadcast|Disp8MemShift=4|NoSuf, { RegXMM|Word|Unspecified|BaseIndex, RegYMM } ++vcvtph2udq, 0x79, AVX512_FP16&AVX512VL, Modrm|EVex128|Masking|EVexMap5|VexW0|Broadcast|Disp8MemShift=3|NoSuf, { RegXMM|Word|Qword|Unspecified|BaseIndex, RegXMM } ++vcvtph2udq, 0x79, AVX512_FP16&AVX512VL, Modrm|EVex256|Masking|EVexMap5|VexW0|Broadcast|Disp8MemShift=4|NoSuf, { RegXMM|Word|Unspecified|BaseIndex, RegYMM } + vcvtph2udq, 0x79, AVX512_FP16, Modrm|EVex512|Masking|EVexMap5|VexW0|Broadcast|Disp8MemShift=5|NoSuf|StaticRounding|SAE, { RegYMM|Word|Unspecified|BaseIndex, RegZMM } + +-vcvtph2qq, 0x667b, AVX512_FP16|AVX512VL, Modrm|EVex128|Masking|EVexMap5|VexW0|Broadcast|Disp8MemShift=2|NoSuf, { RegXMM|Word|Dword|Unspecified|BaseIndex, RegXMM } +-vcvtph2qq, 0x667b, AVX512_FP16|AVX512VL, Modrm|EVex256|Masking|EVexMap5|VexW0|Broadcast|Disp8MemShift=3|NoSuf, { RegXMM|Word|Qword|Unspecified|BaseIndex, RegYMM } ++vcvtph2qq, 0x667b, AVX512_FP16&AVX512VL, Modrm|EVex128|Masking|EVexMap5|VexW0|Broadcast|Disp8MemShift=2|NoSuf, { RegXMM|Word|Dword|Unspecified|BaseIndex, RegXMM } ++vcvtph2qq, 0x667b, AVX512_FP16&AVX512VL, Modrm|EVex256|Masking|EVexMap5|VexW0|Broadcast|Disp8MemShift=3|NoSuf, { RegXMM|Word|Qword|Unspecified|BaseIndex, RegYMM } + vcvtph2qq, 0x667b, AVX512_FP16, Modrm|EVex512|Masking|EVexMap5|VexW0|Broadcast|Disp8MemShift=4|NoSuf|StaticRounding|SAE, { RegXMM|Word|Unspecified|BaseIndex, RegZMM } + +-vcvtph2uqq, 0x6679, AVX512_FP16|AVX512VL, Modrm|EVex128|Masking|EVexMap5|VexW0|Broadcast|Disp8MemShift=2|NoSuf, { RegXMM|Word|Dword|Unspecified|BaseIndex, RegXMM } +-vcvtph2uqq, 0x6679, AVX512_FP16|AVX512VL, Modrm|EVex256|Masking|EVexMap5|VexW0|Broadcast|Disp8MemShift=3|NoSuf, { RegXMM|Word|Qword|Unspecified|BaseIndex, RegYMM } ++vcvtph2uqq, 0x6679, AVX512_FP16&AVX512VL, Modrm|EVex128|Masking|EVexMap5|VexW0|Broadcast|Disp8MemShift=2|NoSuf, { RegXMM|Word|Dword|Unspecified|BaseIndex, RegXMM } ++vcvtph2uqq, 0x6679, AVX512_FP16&AVX512VL, Modrm|EVex256|Masking|EVexMap5|VexW0|Broadcast|Disp8MemShift=3|NoSuf, { RegXMM|Word|Qword|Unspecified|BaseIndex, RegYMM } + vcvtph2uqq, 0x6679, AVX512_FP16, Modrm|EVex512|Masking|EVexMap5|VexW0|Broadcast|Disp8MemShift=4|NoSuf|StaticRounding|SAE, { RegXMM|Word|Unspecified|BaseIndex, RegZMM } + +-vcvtph2pd, 0x5a, AVX512_FP16|AVX512VL, Modrm|EVex128|Masking|EVexMap5|VexW0|Broadcast|Disp8MemShift=2|NoSuf, { RegXMM|Word|Dword|Unspecified|BaseIndex, RegXMM } +-vcvtph2pd, 0x5a, AVX512_FP16|AVX512VL, Modrm|EVex256|Masking|EVexMap5|VexW0|Broadcast|Disp8MemShift=3|NoSuf, { RegXMM|Word|Qword|Unspecified|BaseIndex, RegYMM } ++vcvtph2pd, 0x5a, AVX512_FP16&AVX512VL, Modrm|EVex128|Masking|EVexMap5|VexW0|Broadcast|Disp8MemShift=2|NoSuf, { RegXMM|Word|Dword|Unspecified|BaseIndex, RegXMM } ++vcvtph2pd, 0x5a, AVX512_FP16&AVX512VL, Modrm|EVex256|Masking|EVexMap5|VexW0|Broadcast|Disp8MemShift=3|NoSuf, { RegXMM|Word|Qword|Unspecified|BaseIndex, RegYMM } + vcvtph2pd, 0x5a, AVX512_FP16, Modrm|EVex512|Masking|EVexMap5|VexW0|Broadcast|Disp8MemShift=4|NoSuf|SAE, { RegXMM|Word|Unspecified|BaseIndex, RegZMM } + + vcvtph2w, 0x667d, AVX512_FP16, Modrm|Masking|EVexMap5|VexW0|Broadcast|Disp8ShiftVL|CheckOperandSize|NoSuf|StaticRounding|SAE, { RegXMM|RegYMM|RegZMM|Word|Unspecified|BaseIndex, RegXMM|RegYMM|RegZMM } +@@ -3258,24 +3321,24 @@ vcvtsh2ss, 0x13, AVX512_FP16, Modrm|EVexLIG|Masking|EVexMap6|VexVVVV|VexW0|Disp8 + + vcvtsh2si, 0xf32d, AVX512_FP16, Modrm|EVexLIG|EVexMap5|Disp8MemShift=1|NoSuf|StaticRounding|SAE, { RegXMM|Word|Unspecified|BaseIndex, Reg32|Reg64 } + +-vcvttph2dq, 0xf35b, AVX512_FP16|AVX512VL, Modrm|EVex128|Masking|EVexMap5|VexW0|Broadcast|Disp8MemShift=3|NoSuf, { RegXMM|Word|Qword|Unspecified|BaseIndex, RegXMM } +-vcvttph2dq, 0xf35b, AVX512_FP16|AVX512VL, Modrm|EVex256|Masking|EVexMap5|VexW0|Broadcast|Disp8MemShift=4|NoSuf, { RegXMM|Word|Unspecified|BaseIndex, RegYMM } ++vcvttph2dq, 0xf35b, AVX512_FP16&AVX512VL, Modrm|EVex128|Masking|EVexMap5|VexW0|Broadcast|Disp8MemShift=3|NoSuf, { RegXMM|Word|Qword|Unspecified|BaseIndex, RegXMM } ++vcvttph2dq, 0xf35b, AVX512_FP16&AVX512VL, Modrm|EVex256|Masking|EVexMap5|VexW0|Broadcast|Disp8MemShift=4|NoSuf, { RegXMM|Word|Unspecified|BaseIndex, RegYMM } + vcvttph2dq, 0xf35b, AVX512_FP16, Modrm|EVex512|Masking|EVexMap5|VexW0|Broadcast|Disp8MemShift=5|NoSuf|SAE, { RegYMM|Word|Unspecified|BaseIndex, RegZMM } + +-vcvttph2udq, 0x78, AVX512_FP16|AVX512VL, Modrm|EVex128|Masking|EVexMap5|VexW0|Broadcast|Disp8MemShift=3|NoSuf, { RegXMM|Word|Qword|Unspecified|BaseIndex, RegXMM } +-vcvttph2udq, 0x78, AVX512_FP16|AVX512VL, Modrm|EVex256|Masking|EVexMap5|VexW0|Broadcast|Disp8MemShift=4|NoSuf, { RegXMM|Word|Unspecified|BaseIndex, RegYMM } ++vcvttph2udq, 0x78, AVX512_FP16&AVX512VL, Modrm|EVex128|Masking|EVexMap5|VexW0|Broadcast|Disp8MemShift=3|NoSuf, { RegXMM|Word|Qword|Unspecified|BaseIndex, RegXMM } ++vcvttph2udq, 0x78, AVX512_FP16&AVX512VL, Modrm|EVex256|Masking|EVexMap5|VexW0|Broadcast|Disp8MemShift=4|NoSuf, { RegXMM|Word|Unspecified|BaseIndex, RegYMM } + vcvttph2udq, 0x78, AVX512_FP16, Modrm|EVex512|Masking|EVexMap5|VexW0|Broadcast|Disp8MemShift=5|NoSuf|SAE, { RegYMM|Word|Unspecified|BaseIndex, RegZMM } + +-vcvttph2qq, 0x667a, AVX512_FP16|AVX512VL, Modrm|EVex128|Masking|EVexMap5|VexW0|Broadcast|Disp8MemShift=2|NoSuf, { RegXMM|Word|Dword|Unspecified|BaseIndex, RegXMM } +-vcvttph2qq, 0x667a, AVX512_FP16|AVX512VL, Modrm|EVex256|Masking|EVexMap5|VexW0|Broadcast|Disp8MemShift=3|NoSuf, { RegXMM|Word|Qword|Unspecified|BaseIndex, RegYMM } ++vcvttph2qq, 0x667a, AVX512_FP16&AVX512VL, Modrm|EVex128|Masking|EVexMap5|VexW0|Broadcast|Disp8MemShift=2|NoSuf, { RegXMM|Word|Dword|Unspecified|BaseIndex, RegXMM } ++vcvttph2qq, 0x667a, AVX512_FP16&AVX512VL, Modrm|EVex256|Masking|EVexMap5|VexW0|Broadcast|Disp8MemShift=3|NoSuf, { RegXMM|Word|Qword|Unspecified|BaseIndex, RegYMM } + vcvttph2qq, 0x667a, AVX512_FP16, Modrm|EVex512|Masking|EVexMap5|VexW0|Broadcast|Disp8MemShift=4|NoSuf|SAE, { RegXMM|Word|Unspecified|BaseIndex, RegZMM } + +-vcvttph2uqq, 0x6678, AVX512_FP16|AVX512VL, Modrm|EVex128|Masking|EVexMap5|VexW0|Broadcast|Disp8MemShift=2|NoSuf, { RegXMM|Word|Dword|Unspecified|BaseIndex, RegXMM } +-vcvttph2uqq, 0x6678, AVX512_FP16|AVX512VL, Modrm|EVex256|Masking|EVexMap5|VexW0|Broadcast|Disp8MemShift=3|NoSuf, { RegXMM|Word|Qword|Unspecified|BaseIndex, RegYMM } ++vcvttph2uqq, 0x6678, AVX512_FP16&AVX512VL, Modrm|EVex128|Masking|EVexMap5|VexW0|Broadcast|Disp8MemShift=2|NoSuf, { RegXMM|Word|Dword|Unspecified|BaseIndex, RegXMM } ++vcvttph2uqq, 0x6678, AVX512_FP16&AVX512VL, Modrm|EVex256|Masking|EVexMap5|VexW0|Broadcast|Disp8MemShift=3|NoSuf, { RegXMM|Word|Qword|Unspecified|BaseIndex, RegYMM } + vcvttph2uqq, 0x6678, AVX512_FP16, Modrm|EVex512|Masking|EVexMap5|VexW0|Broadcast|Disp8MemShift=4|NoSuf|SAE, { RegXMM|Word|Unspecified|BaseIndex, RegZMM } + +-vcvtph2psx, 0x6613, AVX512_FP16|AVX512VL, Modrm|EVex128|Masking|EVexMap6|VexW0|Broadcast|Disp8MemShift=3|NoSuf, { RegXMM|Word|Qword|Unspecified|BaseIndex, RegXMM } +-vcvtph2psx, 0x6613, AVX512_FP16|AVX512VL, Modrm|EVex256|Masking|EVexMap6|VexW0|Broadcast|Disp8MemShift=4|NoSuf, { RegXMM|Word|Unspecified|BaseIndex, RegYMM } ++vcvtph2psx, 0x6613, AVX512_FP16&AVX512VL, Modrm|EVex128|Masking|EVexMap6|VexW0|Broadcast|Disp8MemShift=3|NoSuf, { RegXMM|Word|Qword|Unspecified|BaseIndex, RegXMM } ++vcvtph2psx, 0x6613, AVX512_FP16&AVX512VL, Modrm|EVex256|Masking|EVexMap6|VexW0|Broadcast|Disp8MemShift=4|NoSuf, { RegXMM|Word|Unspecified|BaseIndex, RegYMM } + vcvtph2psx, 0x6613, AVX512_FP16, Modrm|EVex512|Masking|EVexMap6|VexW0|Broadcast|Disp8MemShift=5|NoSuf|SAE, { RegYMM|Word|Unspecified|BaseIndex, RegZMM } + + vcvttph2w, 0x667c, AVX512_FP16, Modrm|Masking|EVexMap5|VexW0|Broadcast|Disp8ShiftVL|CheckOperandSize|NoSuf|SAE, { RegXMM|RegYMM|RegZMM|Word|Unspecified|BaseIndex, RegXMM|RegYMM|RegZMM } +@@ -3283,7 +3346,7 @@ vcvttph2uw, 0x7c, AVX512_FP16, Modrm|Masking|EVexMap5|VexW0|Broadcast|Disp8Shift + + vcvttsh2si, 0xf32c, AVX512_FP16, Modrm|EVexLIG|EVexMap5|Disp8MemShift=1|NoSuf|SAE, { RegXMM|Word|Unspecified|BaseIndex, Reg32|Reg64 } + +-vfpclassph, 0x66, AVX512_FP16|, Modrm||Masking|Space0F3A|VexW0|Broadcast|NoSuf|, { Imm8|Imm8S, |Word, RegMask } ++vfpclassph, 0x66, AVX512_FP16&, Modrm||Masking|Space0F3A|VexW0|Broadcast|NoSuf|, { Imm8|Imm8S, |Word, RegMask } + + vmovw, 0x666e, AVX512_FP16, D|Modrm|EVex128|VexWIG|EVexMap5|Disp8MemShift=1|NoSuf, { Word|Unspecified|BaseIndex, RegXMM } + vmovw, 0x667e, AVX512_FP16, D|RegMem|EVex128|VexWIG|EVexMap5|NoSuf, { RegXMM, Reg32 } +@@ -3300,14 +3363,14 @@ vrsqrtsh, 0x664f, AVX512_FP16, Modrm|EVexLIG|Masking|EVexMap6|VexVVVV|VexW0|Disp + + // PREFETCHI instructions. + +-prefetchit0, 0xf18/7, PREFETCHI|x64, Modrm|Anysize|IgnoreSize|NoSuf, { BaseIndex } +-prefetchit1, 0xf18/6, PREFETCHI|x64, Modrm|Anysize|IgnoreSize|NoSuf, { BaseIndex } ++prefetchit0, 0xf18/7, PREFETCHI, Modrm|Anysize|IgnoreSize|NoSuf, { BaseIndex } ++prefetchit1, 0xf18/6, PREFETCHI, Modrm|Anysize|IgnoreSize|NoSuf, { BaseIndex } + + // PREFETCHI instructions end. + + // CMPCCXADD instructions. + +-cmpxadd, 0x66e, CMPCCXADD|x64, Modrm|Vex|Space0F38|VexVVVV|SwapSources|CheckOperandSize|NoSuf, { Reg32|Reg64, Reg32|Reg64, Dword|Qword|Unspecified|BaseIndex } ++cmpxadd, 0x66e, APX_F(CMPCCXADD), Modrm|Vex|EVex128|Space0F38|VexVVVV|SwapSources|CheckOperandSize|NoSuf, { Reg32|Reg64, Reg32|Reg64, Dword|Qword|Unspecified|BaseIndex } + + // CMPCCXADD instructions end. + +@@ -3319,30 +3382,52 @@ wrmsrns, 0x0f01c6, WRMSRNS, NoSuf, {} + + // MSRLIST instructions. + +-rdmsrlist, 0xf20f01c6, MSRLIST|x64, NoSuf, {} +-wrmsrlist, 0xf30f01c6, MSRLIST|x64, NoSuf, {} ++rdmsrlist, 0xf20f01c6, MSRLIST, NoSuf, {} ++wrmsrlist, 0xf30f01c6, MSRLIST, NoSuf, {} + + // MSRLIST instructions end. + + // RAO-INT instructions. + +-aadd, 0xf38fc, RAO_INT, Modrm|IgnoreSize|CheckOperandSize|NoSuf, { Reg32|Reg64, Dword|Qword|Unspecified|BaseIndex } +-aand, 0x660f38fc, RAO_INT, Modrm|IgnoreSize|CheckOperandSize|NoSuf, { Reg32|Reg64, Dword|Qword|Unspecified|BaseIndex } +-aor, 0xf20f38fc, RAO_INT, Modrm|IgnoreSize|CheckOperandSize|NoSuf, { Reg32|Reg64, Dword|Qword|Unspecified|BaseIndex } +-axor, 0xf30f38fc, RAO_INT, Modrm|IgnoreSize|CheckOperandSize|NoSuf, { Reg32|Reg64, Dword|Qword|Unspecified|BaseIndex } ++ ++a, 0x0f38fc, RAO_INT, Modrm|IgnoreSize|CheckOperandSize|NoSuf, { Reg32|Reg64, Dword|Qword|Unspecified|BaseIndex } ++a, 0xfc, RAO_INT&APX_F, Modrm|CheckOperandSize|NoSuf|EVexMap4, { Reg32|Reg64, Dword|Qword|Unspecified|BaseIndex } ++ + + // RAO-INT instructions end. + + // LKGS instruction. + +-lkgs, 0xf20f00/6, LKGS|x64, Modrm|IgnoreSize|No_bSuf|No_sSuf|NoRex64, { Reg16|Reg32|Reg64 } +-lkgs, 0xf20f00/6, LKGS|x64, Modrm|IgnoreSize|No_bSuf|No_lSuf|No_sSuf|No_qSuf, { Word|Unspecified|BaseIndex } ++lkgs, 0xf20f00/6, LKGS, Modrm|IgnoreSize|No_bSuf|No_sSuf|NoRex64, { Reg16|Reg32|Reg64 } ++lkgs, 0xf20f00/6, LKGS, Modrm|IgnoreSize|No_bSuf|No_lSuf|No_sSuf|No_qSuf, { Word|Unspecified|BaseIndex } + + // LKGS instruction end. + + // FRED instructions. + +-erets, 0xf20f01ca, FRED|x64, NoSuf, {} +-eretu, 0xf30f01ca, FRED|x64, NoSuf, {} ++erets, 0xf20f01ca, FRED, NoSuf, {} ++eretu, 0xf30f01ca, FRED, NoSuf, {} + + // FRED instructions end. ++ ++// USER_MSR instructions. ++ ++urdmsr, 0xf20f38f8, USER_MSR, RegMem|NoSuf|NoRex64, { Reg64, Reg64 } ++urdmsr, 0xf2f8, USER_MSR&APX_F, RegMem|EVexMap4|VexW0|NoSuf, { Reg64, Reg64 } ++urdmsr, 0xf2f8/0, APX_F(USER_MSR), Modrm|Vex128|VexMap7|EVex128|VexW0|NoSuf, { Imm32, Reg64 } ++uwrmsr, 0xf30f38f8, USER_MSR, Modrm|NoSuf|NoRex64, { Reg64, Reg64 } ++uwrmsr, 0xf3f8, USER_MSR&APX_F, Modrm|EVexMap4|VexW0|NoSuf, { Reg64, Reg64 } ++// Immediates want to be first; md_assemble() takes care of swapping operands ++// accordingly. ++uwrmsr, 0xf3f8/0, APX_F(USER_MSR), Modrm|Vex128|VexMap7|EVex128|VexW0|NoSuf, { Imm32, Reg64 } ++ ++// USER_MSR instructions end. ++ ++// APX Push2/Pop2 instructions. ++ ++push2, 0xff/6, APX_F, Modrm|VexW0|EVexMap4|VexVVVV|ImplicitStackOp|No_bSuf|No_wSuf|No_lSuf|No_sSuf, { Reg64, Reg64 } ++push2p, 0xff/6, APX_F, Modrm|VexW1|EVexMap4|VexVVVV|ImplicitStackOp|No_bSuf|No_wSuf|No_lSuf|No_sSuf, { Reg64, Reg64 } ++pop2, 0x8f/0, APX_F, Modrm|VexW0|EVexMap4|VexVVVV|ImplicitStackOp|No_bSuf|No_wSuf|No_lSuf|No_sSuf, { Reg64, Reg64 } ++pop2p, 0x8f/0, APX_F, Modrm|VexW1|EVexMap4|VexVVVV|ImplicitStackOp|No_bSuf|No_wSuf|No_lSuf|No_sSuf, { Reg64, Reg64 } ++ ++// APX Push2/Pop2 instructions end. diff --git a/gdb-rhel-7328-fix-fortran-28801.patch b/gdb-rhel-7328-fix-fortran-28801.patch deleted file mode 100644 index d724494..0000000 --- a/gdb-rhel-7328-fix-fortran-28801.patch +++ /dev/null @@ -1,259 +0,0 @@ -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/gdb-rhel5.9-testcase-xlf-var-inside-mod.patch b/gdb-rhel5.9-testcase-xlf-var-inside-mod.patch deleted file mode 100644 index b130d1f..0000000 --- a/gdb-rhel5.9-testcase-xlf-var-inside-mod.patch +++ /dev/null @@ -1,731 +0,0 @@ -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/gdb-runtest-pie-override.patch b/gdb-runtest-pie-override.patch deleted file mode 100644 index 25c2bb8..0000000 --- a/gdb-runtest-pie-override.patch +++ /dev/null @@ -1,49 +0,0 @@ -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/gdb-test-expr-cumulative-archer.patch b/gdb-test-expr-cumulative-archer.patch deleted file mode 100644 index 28a903d..0000000 --- a/gdb-test-expr-cumulative-archer.patch +++ /dev/null @@ -1,223 +0,0 @@ -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/gdb-test-ivy-bridge.patch b/gdb-test-ivy-bridge.patch deleted file mode 100644 index ed82789..0000000 --- a/gdb-test-ivy-bridge.patch +++ /dev/null @@ -1,468 +0,0 @@ -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/gdb-test-pid0-core.patch b/gdb-test-pid0-core.patch deleted file mode 100644 index fea4def..0000000 --- a/gdb-test-pid0-core.patch +++ /dev/null @@ -1,92 +0,0 @@ -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/gdb-testsuite26997-fix-array-slices-m32.patch b/gdb-testsuite26997-fix-array-slices-m32.patch deleted file mode 100644 index 478001b..0000000 --- a/gdb-testsuite26997-fix-array-slices-m32.patch +++ /dev/null @@ -1,68 +0,0 @@ -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/gdb.spec b/gdb.spec index 24be06b..54dc37b 100644 --- a/gdb.spec +++ b/gdb.spec @@ -6,12 +6,25 @@ # --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. +# --define 'tests "TEST1 ... TESTN": Limit testing to specified tests. # 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} +%define _lto_cflags %{nil} + +# Only build on x86 for RHEL6 SCL, defining missing parallel make macros. +%if 0%{?scl:1} && 0%{?el6:1} +ExclusiveArch: %{ix86} x86_64 +%global make_build make %{?_smp_mflags} +%global make_install make %{?_smp_mflags} install DESTDIR=$RPM_BUILD_ROOT +%endif + +# Exclude aarch64 on RHEL7. +%if 0%{?scl:1} && 0%{?el7:1} +ExcludeArch: aarch64 +%endif %{?scl:%scl_package gdb} %{!?scl: @@ -22,24 +35,31 @@ } # If we're on Fedora or RHEL 9+, we will build the gdb-minimal package. -%if 0%{?fedora} || 0%{?rhel} > 8 +# Never build the -minimal package on SCLs, since it's unneeded there. +%if 0%{?fedora} || (0%{?rhel} > 8 && 0%{!?scl:1}) %global _build_minimal 1 %endif +# Include support for Guile? This is enabled on RHEL 8 and +# Fedora < 38. +%if (0%{?fedora:1} && 0%{?fedora} < 38) || (0%{?rhel:1} && 0%{?rhel} == 8) +%define use_guile 1 +%endif + Name: %{?scl_prefix}gdb # Freeze it when GDB gets branched -%global snapsrc 20200208 +%global snapsrc 20220501 # See timestamp of source gnulib installed into gnulib/ . -%global snapgnulib 20200630 +%global snapgnulib 20220501 %global tarname gdb-%{version} -Version: 10.2 +Version: 14.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: 15%{?dist} +Release: 3%{?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 +License: GPL-3.0-or-later AND BSD-3-Clause AND FSFAP AND LGPL-2.1-or-later AND GPL-2.0-or-later AND LGPL-2.0-or-later AND LicenseRef-Fedora-Public-Domain AND GFDL-1.3-or-later AND LGPL-2.0-or-later WITH GCC-exception-2.0 AND GPL-3.0-or-later WITH GCC-exception-3.1 AND GPL-2.0-or-later WITH GNU-compiler-exception # 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 @@ -58,10 +78,7 @@ URL: https://gnu.org/software/gdb/ %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 +%if 0%{!?rhel:1} Recommends: dnf-command(debuginfo-install) %endif @@ -72,12 +89,17 @@ Recommends: dnf-command(debuginfo-install) # below, but it cannot hurt either -- rdieter Conflicts: gdb-headless < 7.12-29 -Summary: A stub package for GNU source-level debugger +Summary: A GNU source-level debugger for C, C++, Fortran, Go and other languages 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'. +GDB, the GNU debugger, allows you to debug programs written in C, C++, +Fortran, Go, and other languages, by executing them in a controlled +fashion and printing their data. + +If you want to use GDB for development purposes, you should install +the 'gdb' package which will install 'gdb-headless' and possibly other +useful packages too. %package headless %endif @@ -90,7 +112,7 @@ Summary: A GNU source-level debugger for C, C++, Fortran, Go and other languages Obsoletes: gdb64 < 5.3.91 %endif -%ifarch %{arm} +%ifarch %{arm} riscv64 %global have_inproctrace 0 %else %global have_inproctrace 1 @@ -139,6 +161,9 @@ Recommends: default-yama-scope %if 0%{?fedora} >= 31 || 0%{?rhel} >= 9 %global librpmver 9 %endif +%if 0%{?fedora} >= 39 || 0%{?rhel} >= 10 +%global librpmver 10 +%endif %endif %endif %if 0%{?__isa_bits} == 64 @@ -154,13 +179,13 @@ BuildRequires: %{librpmname} Recommends: %{librpmname} %endif -%if 0%{?el6:1} +%if 0%{?el6:1} || 0%{?el7:1} # GDB C++11 requires devtoolset gcc. BuildRequires: %{?scl_prefix}gcc-c++ +%else +BuildRequires: 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). @@ -191,11 +216,9 @@ Source5: %{libstdcxxpython}.tar.xz Source6: gdbtui # libipt: Intel Processor Trace Decoder Library -%global libipt_version 2.0.4 +%global libipt_version 2.0.5 #=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. @@ -203,14 +226,15 @@ 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 +# System readline is too old prior to RHEL8. +%if 0%{!?rhel:1} || 0%{?rhel} > 7 +%global use_system_readline 1 +BuildRequires: readline-devel%{buildisa} >= 7.0 +%else +%global use_system_readline 0 +%endif -BuildRequires: gcc-c++ ncurses-devel%{buildisa} texinfo gettext flex bison +BuildRequires: ncurses-devel%{buildisa} texinfo gettext flex bison BuildRequires: expat-devel%{buildisa} %if 0%{!?rhel:1} || 0%{?rhel} > 6 BuildRequires: xz-devel%{buildisa} @@ -221,6 +245,7 @@ BuildRequires: zlib-devel%{buildisa} libselinux-devel%{buildisa} %if 0%{!?_without_python:1} %if 0%{?rhel:1} && 0%{?rhel} <= 7 BuildRequires: python-devel%{buildisa} +%global __python /usr/bin/python2 %else %global __python %{__python3} BuildRequires: python3-devel%{buildisa} @@ -241,10 +266,17 @@ BuildRequires: texlive-collection-latexrecommended BuildRequires: /usr/bin/pod2man %if 0%{!?rhel:1} || 0%{?rhel} > 7 BuildRequires: libbabeltrace-devel%{buildisa} -%if 0%{?rhel} < 9 + %if %{defined use_guile} + %if 0%{!?rhel:1} +BuildRequires: guile22-devel%{buildisa} + %endif + # Guile is only supported prior to RHEL9, where it was called "guile". + %if 0%{?rhel:1} && 0%{?rhel} < 9 BuildRequires: guile-devel%{buildisa} + %endif + %endif %endif -%endif + %global have_libipt 0 %if 0%{!?rhel:1} || 0%{?rhel} > 7 || (0%{?rhel} == 7 && 0%{?scl:1}) %ifarch %{ix86} x86_64 @@ -262,11 +294,32 @@ BuildRequires: libipt-devel%{buildisa} # Fedora < 32, and mpfr-4 on Fedora 32+ and RHEL-9+. BuildRequires: mpfr-devel%{buildisa} %endif +# RHEL6 doesn't have source-highlight. +%if 0%{!?rhel:1} || 0%{?rhel} > 6 BuildRequires: source-highlight-devel +%endif %if 0%{!?rhel:1} BuildRequires: xxhash-devel %endif + +# Special case: on RHEL8+, we simply require the system debuginfod. +# Otherwise, we require the SCL version. Except on RHEL6, where debuginfod +# is not supported at all. +%global have_debuginfod 0 +%global use_scl_for_debuginfod 0 +%if 0%{!?rhel:1} || 0%{?rhel} >= 8 +%global have_debuginfod 1 BuildRequires: elfutils-debuginfod-client-devel +%else +%if 0%{!?el6:1} && 0%{?scl:1} +%global have_debuginfod 1 +%global use_scl_for_debuginfod 1 +BuildRequires: elfutils-debuginfod-client-devel +%endif +%endif + +# Workaround for missing boost-devel dependency (rhbz 1718480) +BuildRequires: boost-devel %if 0%{?_with_testsuite:1} @@ -274,7 +327,7 @@ BuildRequires: elfutils-debuginfod-client-devel %global bits_local %{?_isa} %global bits_other %{?_isa} %ifarch s390x -%if 0%{!?rhel:1} || 0%{?rhel} < 8 +%if 0%{?rhel:1} && 0%{?rhel} < 8 %global bits_other (%{__isa_name}-32) %endif %else #!s390x @@ -289,14 +342,15 @@ BuildRequires: elfutils-debuginfod-client-devel BuildRequires: sharutils dejagnu # gcc-objc++ is not covered by the GDB testsuite. -BuildRequires: gcc gcc-c++ gcc-gfortran +# Test supported SCL toolchain components. +BuildRequires: %{?scl_testing_prefix}gcc %{?scl_testing_prefix}gcc-c++ %{?scl_testing_prefix}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 +# We don't support gcc-gdb-plugin on RHEL anymore. +%if 0%{!?rhel:1} +BuildRequires: %{?scl_prefix}gcc-gdb-plugin%{?_isa} %endif %if 0%{?rhel:1} && 0%{?rhel} < 7 BuildRequires: gcc-java libgcj%{bits_local} libgcj%{bits_other} @@ -331,8 +385,8 @@ BuildRequires: prelink 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 +# Fedora arm+ppc64le+s390x do not yet have fpc built. +%ifnarch %{arm} ppc64le s390x BuildRequires: fpc %endif %endif @@ -344,7 +398,7 @@ BuildRequires: gcc-gnat BuildRequires: libgnat%{bits_local} libgnat%{bits_other} %endif %else -%ifarch %{ix86} x86_64 ia64 ppc %{power64} alpha s390x %{arm} aarch64 +%ifarch %{ix86} x86_64 ia64 ppc %{power64} alpha s390x %{arm} aarch64 riscv64 %if 0%{!?rhel:1} BuildRequires: gcc-gnat BuildRequires: libgnat%{bits_local} libgnat%{bits_other} @@ -361,17 +415,17 @@ BuildRequires: libstdc++%{bits_local} libstdc++%{bits_other} 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 +%if 0%{?rhel} > 6 +BuildRequires: glibc-static%{bits_other} +%endif %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} +BuildRequires:valgrind%{bits_local} valgrind%{bits_other} %endif %if 0%{!?rhel:1} || 0%{?rhel} > 6 BuildRequires: xz @@ -379,10 +433,11 @@ BuildRequires: xz %if 0%{!?rhel:1} || 0%{?rhel} > 7 BuildRequires: rust %endif - -BuildRequires: %{?scl_prefix}elfutils-debuginfod +%if 0%{!?el6:1} +BuildRequires: elfutils-debuginfod +%endif %endif # 0%{?_with_testsuite:1} -BuildRequires: make +BuildRequires: make gmp-devel %{?scl:Requires:%scl_runtime} @@ -408,8 +463,8 @@ 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. +Fortran, Go, 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. @@ -420,8 +475,8 @@ 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. +Fortran, Go, 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. @@ -455,10 +510,6 @@ tar xJf %{SOURCE5} %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 . @@ -474,25 +525,58 @@ find -name "*.info*"|xargs rm -f # See README.local-patches for more details. %include %{PATCH9999} -# The above patches twiddle a .m4 file for configure, so update the affected -# configure files -pushd libiberty -autoconf -f -popd -pushd intl -autoconf -f -popd - find -name "*.orig" | xargs rm -f ! find -name "*.rej" # Should not happen. -# Change the version that gets printed at GDB startup, so it is RH specific. +# In the past a distro name prefix was added to the version string in +# version.in. +# +# However, placing text at the start of version.in can cause problems; +# GDB will have a version string that starts with text rather than a +# number as is the case with upstream GDB, and for most (all?) other +# distros. +# +# GDB's version string is exposed to users as part of the Python API, +# and it is not uncommon for users to try and grok the version number +# from this string. Having Fedora/RHEL GDB not start with the major +# version number can be unexpected, and might cause tools/script that +# work for other builds of GDB to fail with Fedora/RHEL GDB. +# +# So, we switched to use the more standard --with-pkgversion configure +# option. This ensures the distro name is still included in the 'gdb +# --version' output, but the text is no longer part of the string +# exposed in the Python API. +# +# Unfortunately, for RHEL the dist_name macro is not defined. At +# least not on RHEL 9 or earlier. So, if dist_name is not defined, +# but the rhel macro is, then we use a hard-coded RHEL appropriate +# string. +# +# FIXME: It would be nice to rewrite this using %elif, but this is not +# supported on older (pre 9) RHEL systems. + +%if 0%{?dist_name:1} + +%global pkgversion_configure_flag --with-pkgversion=%{dist_name} + +%else + +%if 0%{?fedora:1} +%global pkgversion_configure_flag --with-pkgversion=Fedora Linux +%endif + +%if 0%{?rhel:1} +%global pkgversion_configure_flag --with-pkgversion=Red Hat Enterprise Linux +%endif + +%endif + +# 2hange the version that gets printed by GDB. The 'version' here is +# usually the same as the original upstream version on which we are +# based. The 'release' is new information we're adding and identifies +# the modifications we've made to upstream. cat > 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} +%{?version_prefix:%version_prefix }%{version}-%{release} _FOO # Remove the info and other generated files added by the FSF release @@ -503,14 +587,11 @@ 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 +%if 0%{use_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 +%endif rm -rf zlib texinfo @@ -533,19 +614,22 @@ COMMON_GDB_CONFIGURE_FLAGS="\ --mandir=%{_mandir} \ --infodir=%{_infodir} \ --with-gdb-datadir=%{_datadir}/gdb \ - --enable-gdb-build-warnings=,-Wno-unused \ + --enable-gdb-build-warnings=,-Wno-unused,-Wno-deprecated-declarations,-Wno-unused-function,-Wno-stringop-overflow\ +%ifarch %{ix86} +,-Wno-format-overflow\ +%endif --enable-build-with-cxx \ -%ifnarch %{ix86} alpha ppc s390 s390x x86_64 ppc64 ppc64le sparc sparcv9 sparc64 %{arm} aarch64 +%ifnarch %{ix86} alpha ppc s390 s390x x86_64 ppc64 ppc64le sparc sparcv9 sparc64 %{arm} aarch64 riscv64 --disable-werror \ %else --enable-werror \ %endif --with-separate-debug-dir=/usr/lib/debug \ - --disable-sim \ + --disable-sim \ --disable-rpath \ --without-stage1-ldflags \ --disable-libmcheck \ -%if 0%{!?rhel:1} || 0%{?rhel} > 6 +%if 0%{use_system_readline} --with-system-readline \ %else --without-system-readline \ @@ -555,9 +639,7 @@ COMMON_GDB_CONFIGURE_FLAGS="\ --without-mmap \ %endif --enable-64-bit-bfd \ -%if 0%{!?rhel:1} || 0%{?rhel} > 6 - --with-mpfr \ -%else +%if 0%{?rhel:1} && 0%{?rhel} <= 6 --without-mpfr \ %endif --with-system-zlib \ @@ -566,7 +648,9 @@ COMMON_GDB_CONFIGURE_FLAGS="\ %else --without-lzma \ %endif +%if 0%{!?rhel:1} || 0%{?have_debuginfod} --with-debuginfod \ +%endif %if 0%{?rhel:1} --disable-libctf %endif @@ -597,15 +681,24 @@ GDB_MINIMAL_CONFIGURE_FLAGS="\ --disable-unit-tests \ --disable-source-highlight" -export CFLAGS="$RPM_OPT_FLAGS %{?_with_asan:-fsanitize=address}" -export LDFLAGS="%{?__global_ldflags} %{?_with_asan:-fsanitize=address}" +# Populate CFLAGS, LDFLAGS, CC, CXX, etc. +%set_build_flags +CFLAGS="$CFLAGS %{?_with_asan:-fsanitize=address}" +LDFLAGS="$LDFLAGS %{?_with_asan:-fsanitize=address}" +CXXFLAGS="$CXXFLAGS %{?_with_asan:-fsanitize=address}" -export CXXFLAGS="$CFLAGS" +# If using an SCL for debuginfod, add path to SCL's pkgconfig directory. +%if 0%{?have_debuginfod} && 0%{?use_scl_for_debuginfod} +export PKG_CONFIG_PATH=%{_libdir}/pkgconfig +%endif # --htmldir and --pdfdir are not used as they are used from %{gdb_build}. ../configure \ ${COMMON_GDB_CONFIGURE_FLAGS} \ ${GDB_MINIMAL_CONFIGURE_FLAGS} \ +%if 0%{?pkgversion_configure_flag:1} + "%{pkgversion_configure_flag}" \ +%endif --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 @@ -635,30 +728,6 @@ export LDFLAGS="%{?__global_ldflags} %{?_with_asan:-fsanitize=address}" 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 @@ -681,6 +750,13 @@ LDFLAGS="$LDFLAGS -L$PWD/libipt-%{libipt_version}-root%{_libdir}" export CXXFLAGS="$CFLAGS" +# For DTS11+, gcc defaults to c++17, causing issues with system-installed +# headers, e.g., python. Force to c++11. We coerce all builds to use c++11 +# to facilitate testing. +%if 0%{?rhel:1} && 0%{?rhel} < 8 +export CXXFLAGS="$CXXFLAGS -std=gnu++11" +%endif + # The configure flags we will use when building the full GDB. GDB_FULL_CONFIGURE_FLAGS="\ --with-system-gdbinit=%{_sysconfdir}/gdbinit \ @@ -698,7 +774,7 @@ $(: ppc64 host build crashes on ppc variant of libexpat.so ) \ %else --without-python \ %endif -%if 0%{!?rhel:1} || 0%{?rhel} == 8 +%if %{defined use_guile} --with-guile \ %else --without-guile \ @@ -723,6 +799,9 @@ $(: ppc64 host build crashes on ppc variant of libexpat.so ) \ ../configure \ ${COMMON_GDB_CONFIGURE_FLAGS} \ ${GDB_FULL_CONFIGURE_FLAGS} \ +%if 0%{?pkgversion_configure_flag:1} + "%{pkgversion_configure_flag}" \ +%endif --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 @@ -853,6 +932,11 @@ gcc -o ./orphanripper %{SOURCE2} -Wall -lutil -ggdb2 for test in \ gdb.base/readline-overflow.exp \ gdb.base/bigcore.exp \ +%if 0%{?rhel} < 7 + gdb.base/gnu-debugdata.exp \ + gdb.base/access-mem-running.exp \ + gdb.threads/access-mem-running-thread-exit.exp \ +%endif ; do mv -f ../../gdb/testsuite/$test ../gdb/testsuite/$test-DISABLED || : done @@ -861,7 +945,13 @@ gcc -o ./orphanripper %{SOURCE2} -Wall -lutil -ggdb2 # See also: gdb-runtest-pie-override.exp ###CHECK="$(echo $CHECK|sed 's#check//unix/[^ ]*#& &/-fPIC/-pie#g')" - ./orphanripper %make_build -k $CHECK || : +TESTS="" +%if 0%{?tests:1} + for test in %{tests}; do + TESTS="${TESTS:+$TESTS }$test" + done +%endif + ./orphanripper make %{?_smp_mflags} -k $CHECK TESTS="$TESTS" || : ) for t in sum log do @@ -943,7 +1033,7 @@ 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 + touch -r $RPM_BUILD_DIR/%{gdb_src}/gdb/version.in $i done %if 0%{?_enable_debug_packages:1} && 0%{!?_without_python:1} @@ -956,7 +1046,7 @@ done %endif # 0%{?_enable_debug_packages:1} && 0%{!?_without_python:1} # Compile python files -%if 0%{!?_without_python:1} +%if 0%{!?_without_python:1} && (0%{!?rhel:1} || 0%{?rhel} > 7) %py_byte_compile %{__python3} %{buildroot}%{_datadir}/gdb/python/gdb %endif @@ -989,7 +1079,7 @@ cp -a $RPM_BUILD_DIR/%{gdb_src}/%{libstdcxxpython}/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 + touch -r $RPM_BUILD_DIR/%{gdb_src}/gdb/version.in $i done %endif # 0%{!?_without_python:1} @@ -1007,10 +1097,11 @@ 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* +rm -f $RPM_BUILD_ROOT%{_infodir}/sframe-spec* # 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*} +rm -rf $RPM_BUILD_ROOT/%{_libdir}/lib{bfd*,opcodes*,iberty*,ctf*,sframe*} # pstack obsoletion @@ -1035,6 +1126,7 @@ ln -s gstack $RPM_BUILD_ROOT%{_bindir}/pstack # Documentation only for development. rm -f $RPM_BUILD_ROOT%{_infodir}/gdbint* rm -f $RPM_BUILD_ROOT%{_infodir}/stabs* +rm -f $RPM_BUILD_ROOT%{_infodir}/ctf-spec* # 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. @@ -1158,99 +1250,537 @@ fi %endif %changelog -* Mon Apr 15 2024 Keith Seitz - 10.2-15.el9 -- Fix i686 build error in gdb-rhel-10464-xsave-update-7of21.patch. - (Keith Seitz, RHEL-10464) +* Fri May 31 2024 Guinevere Larsen - 14.2-1.el9 +- Rebase to gdb-14.2 and update all bug references + (Resolves: RHEL-39554) + (Resolves: RHEL-39553) + (Resolves: RHEL-10550) + (Resolves: RHEL-39555) + (Resolves: RHEL-39585) + (Resolves: RHEL-36211) -* Thu Apr 11 2024 Keith Seitz - 10.2-14.el9 -- Backport "Fix GDB internal error by using text (instead of data) - section offset" - (Kevin Buettner, RHEL-17399) -- Backport "s390: Add arch14 record/replay support" - (Andreas Arnaz, RHEL-10550) -- Backport patches for x86 XSTATE update in gdb and gdbserver. - (John Baldwin et al, RHEL-10464) +* Wed May 29 2024 Guinevere Larsen - 14.2-3.el8 +- Remove riscv64-linux-gnu target. It was never meant to be added. -* 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) +* Thu May 16 2024 Guinevere Larsen - 14.2-2.el8 +- Backport "better support for $pc not saved" + (Andrew Burgess, RHEL-19390) -* 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) +* Mon May 13 2024 Guinevere Larsen +- Backport series Infcalls from B/P conditions in multi-threaded inferiors + (Andrew Burgess, RHEL-13298) -* Tue Oct 3 2023 Guinevere Larsen -- Backport "Fix crash in Fortran code" - (Tom Tromey, RHEL-7328) +* Mon May 13 2024 Keith Seitz +- Backport "gdb: s390: Add arch14 record/replay support" + (Andreas Arnez, RHEL-36225) +- Backport "Add support for Power11 options" + (Peter Bergner, RHEL-36518) +- Backport "Sync x86 disassembler with (proposed) gdb-15.1 release." + (many authors, RHEL-36527) -* Wed Mar 29 2023 Bruno Larsen - 10.2-11.el9 -- Backport "libiberty: prevent buffer overflow when decoding user input" - (Luís Ferreira, RHBZ2132600) +* Tue Apr 23 2024 Guinevere Larsen - 14.2-1.el8 +- Initial import for GTS14. -* Mon Mar 27 2023 Bruno Larsen -- Backport "[gdb/breakpoint] Fix assert in jit_event_handler" - (Tom de Vries, RHBZ 2130624) +* Tue Mar 12 2024 Alexandra Hájková - 14.2-1 +- Rebase to FSF GDB 14.2. -* 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" +* Wed Feb 21 2024 Richard W.M. Jones +- Bump and rebuild for riscv64 + +* Mon Jan 29 2024 Kevin Buettner - 14.1-8 +- Backport upstream workaround for GCC 14 problem which is causing + GDB internal errors (RHBZ 261580, Tom de Vries). + +* Thu Jan 25 2024 Guinevere Larsen +- Remove gdb-6.5-BEA-testsuite.patch, as it was upstreamed and + will make its way back with the next rebase. + +* Thu Jan 25 2024 Guinevere Larsen - 14.1-7 +- Backport "gdb: fix list . related crash" + +* Wed Jan 24 2024 Fedora Release Engineering +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Fri Jan 19 2024 Fedora Release Engineering +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Tue Jan 16 2024 Kevin Buettner - 14.1-4 +- Backport upstream commit bc23ea51f8a83e9524dfb553baa8baacb29e68a9, + potentially fixing RHBZ 2257562. + +* Thu Jan 11 2024 Alexandra Hájková - 14.1-3 +- Fix typo in gdb.spec. + +* Mon Jan 8 2024 Alexandra Hájková - 14.1-2 +- Backport upstream commits 7ae9ecfd801 and 8170efad364 to avoid + using _PyOS_ReadlineTState (RHBZ 2250652). + +* Fri Dec 8 2023 Kevin Buettner - 14.1-1 +- Rebase to FSF GDB 14.1. +- Update local patches: + gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch + gdb-6.6-buildid-locate-rpm.patch + gdb-6.6-buildid-locate.patch + gdb-container-rh-pkg.patch + gdb-core-open-vdso-warning.patch + gdb-fedora-libncursesw.patch + gdb-linux_perf-bundle.patch +- Update backported patches which didn't make it into 14.1: + gdb-rhbz-2232086-cpp-ify-mapped-symtab.patch + gdb-rhbz-2232086-generate-gdb-index-consistently.patch +- Drop upstreamed local patches: + gdb-6.5-sharedlibrary-path.patch +- Drop gdb-13.2 backports (which are now in gdb-14.1): + gdb-binutils29988-read_indexed_address.patch + gdb-bz2196395-debuginfod-legacy-openssl-crash.patch + gdb-bz2237392-dwarf-obstack-allocation.patch + gdb-bz2237515-debuginfod-double-free.patch + gdb-rhbz2192105-ftbs-dangling-pointer + gdb-rhbz2233961-CVE-2022-4806.patch + gdb-rhbz2233965-memory-leak.patch +- Adjust gdb.spec so that --with-mpfr is no longer passed to + configure; doing so, combined with some configury changes triggered + a latent build problem. + +* Mon Dec 4 2023 Kevin Buettner +- Remove gdb-6.5-missed-trap-on-step-test.patch. Testing what happens + when stepping over/through a statement which triggers a watchpoint + is being added, upstream, to gdb.base/watchpoint.exp. + +* Tue Nov 28 2023 Andrew Burgess +- Backport upstream commits 1f0fab7ff86, aa19bc1d259, acc117b57f7, + aff250145af, and 3644f41dc80. These commits reduce the size of the + generated gdb-index file, and also ensure that the gdb-index and + dwarf-5 index are generated consistently even as the number of + worker threads that GDB uses changes (RHBZ 2232086). + +* Thu Oct 19 2023 Alexandra Hájková +- Remove gdb-6.5-ia64-libunwind-leak-test.patch. + The patch doesn't include any actual fixes, the architecture + is end of life and the kernel is planning to drop IA64 support. + +* Wed Oct 11 2023 Guinevere Larsen +- Remove gdb-rhbz1186476-internal-error-unqualified-name-re-set-test.patch + as it was upstreamed back in 2010 with a different test name. + +* Mon Oct 2 2023 Kevin Buettner - 13.2-11 +- Backport upstream commit which prevents internal error when + generating an overly large gdb-index file. (RHBZ 1773651, Kevin + Buettner.) + +* Sun Oct 1 2023 Alexandra Hájková - 13.2-10 +- Backport upstream commit d28fbc7197b which fixes RHBZ 2233965 ( + CVE-2022-48065). + +* Thu Sep 28 2023 Kevin Buettner +- Remove gdb-6.5-sharedlibrary-path.patch, which was upstreamed in + commit 3ec033fab4a. + +* Tue Sep 19 2023 Keith Seitz +- Remove gdb-rhbz1553104-s390x-arch12-test.patch, which is more thoroughly tested + by binutils. + +* Mon Sep 18 2023 Alexandra Hájková - 13.2-8 +- Bump release to 13.2-9. + +* Sun Sep 17 2023 Alexandra Hájková - 13.2-8 +- Backport upstream commit 8f2c64de86b which fixes RHBZ 2233961, + CVE-2022-48064, (Alan Modra). + +* Fri Sep 15 2023 Keith Seitz - 13.2-8 +- migrated to SPDX license + +* Fri Sep 15 2023 Andrew Burgess +- Bump release to 13.2-8. + +* Thu Sep 14 2023 Andrew Burgess +- Backport upstream commit 54392c4df604f20, which fixes RHBZ 2237392. + +* Wed Sep 13 2023 Andrew Burgess +- Backport upstream commit f96328accde1e63, which fixes RHBZ 2237515. + +* Wed Aug 9 2023 Guinevere Larsen +- Remove gdb-6.7-testsuite-stable-results.patch, it only made the test + fail more. + +* Mon Aug 7 2023 Kevin Buettner - 13.2-7 +- Bump release. + +* Thu Aug 3 2023 Andrew Burgess +- Backport upstream commit f3eee586174, which fixes RHBZ 2196395. + +* Wed Jul 19 2023 Fedora Release Engineering +- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild + +* Fri Jul 07 2023 Python Maint +- Rebuilt for Python 3.12 + +* Tue Jul 4 2023 Andrew Burgess +- Remove gdb-test-pid0-core.patch. This work has been upstreamed in + commit 8bcead69665. + +* Sat Jul 1 2023 Mark Wielaard - 13.2-4 +- Adjust gdb-add-index.patch to be silent about which gdb. + +* Fri Jun 30 2023 Kevin Buettner - 13.2-3 +- Backport upstream changes which prevent repeated warnings from being + printed when loading a core file (RHBZ 2160211, Lancelot SIX). + +* Wed Jun 28 2023 Python Maint - 13.2-2 +- Rebuilt for Python 3.12 + +* Sun Jun 25 2023 Alexandra Hájková - 13.2-1 +- Rebase to FSF GDB 13.22. +- Remove gdb-rhbz2177655-aarch64-pauth-valid-regcache.patch. +- Remove gdb-rhbz2183595-rustc-inside_main.patch. + +* Tue Jun 13 2023 Python Maint +- Rebuilt for Python 3.12 + +* Tue Jun 13 2023 Python Maint +- Bootstrap for Python 3.12 + +* Sat May 20 2023 Andrew Burgess +- Remove gdb-lineno-makeup-test.patch. An equivalent test has now + been merged to upstream binutils-gdb in commit ef56b006501. + +* Tue May 16 2023 Andrew Burgess +- Remove gdb-ccache-workaround.patch. This patch works around + problems when using older versions of ccache, however, upstream GDB + now disables ccache during testing, see upstream commit 49b4de64242d. + +* Tue May 16 2023 Andrew Burgess +- Remove gdb-ppc-power7-test.patch, this patch is already covered by + upstream tests gdb.arch/powerpc-*.exp. + +* Sat May 6 2023 Alexandra Hájková +- Remove gdb-rhel5.9-testcase-xlf-var-inside-mod.patch, the patch adds + gdb.fortran/xlf-variable.exp test, the test can only be run on + PPC64 machines which are not supported anymore. + +* Thu May 4 2023 Kevin Buettner +- Fix C89-isms in gdb-6.6-buildid-locate-rpm.patch. (Florian Weimer, + RHBZ 2143992)'. This change merely restores changes introduced by + Keith's Nov 30 2022 commit, but which were inadvertently lost during + the GDB 13.1 backport. + +* Thu May 4 2023 Andrew Burgess +- Rewrite the changes to gdb-add-index.sh. If the user has set the + GDB environment variable then use that value, otherwise find a + suitable GDB executable by looking in various places. + +* Wed May 3 2023 Kevin Buettner 13.1-5 +- Backport "Pass const frame_info_ptr reference for + skip_[language_]trampoline". (Mark Wielaard, RHBZ 2192105, build/30413) + +* Tue May 2 2023 Andrew Burgess +- Remove gdb-opcodes-clflushopt-test.patch. This patch tests that GDB + can disassemble the clflushopt instruction correctly. Such + disassembly is a feature of libopcode and is covered by the gas + tests i386/x86-64-clflushopt.s and i386/clflushopt.s. Lets remove + this test from GDB and just rely on the gas tests instead. + +* Sat Apr 29 2023 Kevin Buettner +- Remove gdb-6.7-charsign-test.patch. This patch originally contained + some changes to GDB which were rejected by upstream maintainers. All + that remained was a testcase which had a number of failures due to + the rest of the work not being present in GDB. + +* Tue Apr 25 2023 Bruno Larsen +- Remove gdb-6.5-bz109921-DW_AT_decl_file-test.patch. That patch was + only a test for basic DWARF-2 support, ensuring that GDB found a + variable in a .h file; tests such as gdb.linespec/linespec.exp already + tests for it. + +* Mon Apr 24 2023 Bruno Larsen +- Remove gdb-6.5-last-address-space-byte-test.patch. It was used to + test for a regression in target_xfer_memory, a function that has + been removed from upstream back in 2006. + +* Thu Apr 13 2023 Alexandra Hájková +- Remove gdb-6.3-bz140532-ppc-unwinding-test.patch, it adds + powerpc-bcl-prologue.exp test which seems to be a subset of + upstream powerpc-prologue.exp + +* Tue Apr 11 2023 Keith Seitz +- Backport "Fix a potential illegal memory access in the BFD library..." + (Nick Clifton, binutils/29988) + +* Fri Mar 31 2023 Keith Seitz - 13.1-4 +- Backport "Fix crash in inside_main_func" + (Tom Tromey, RHBZ 2183595) + +* Thu Mar 30 2023 Alexandra Hájková - 12.1-3 +- Update gdb-6.6-buildid-locate.patch to fix RHBZ 2181221. + +* Wed Mar 29 2023 Andrew Burgess +- Used --with-pkgversion to place the distribution name in the version + string rather than placing the string directly into the version.in + file. + +* Fri Mar 24 2023 Kevin Buettner - 13.1-2 +- Backport fix for RHBZ 2177655. (Luis Machado) + +* Mon Mar 20 2023 Bruno Larsen +- Remove gdb-rhbz1350436-type-printers-error.patch since it is upstreamed. + +* Wed Mar 8 2023 Kevin Buettner - 13.1-1 +- Rebase to FSF GDB 13.1. +- Update gdb-6.3-rh-testversion-20041202.patch. +- Update gdb-6.3-bz140532-ppc-unwinding-test.patch. +- Update gdb-6.6-buildid-locate.patch. +- Update gdb-6.6-buildid-locate-rpm.patch. +- Remove 'Recommends: ' line for gcc-gdb-plugin for BZ2149246. +- Add 'define _lto_cflags %{nil}' to avoid ODR violations. +- Add -Wno-stringop-overflow to --enable-gdb-build-warnings to work around + gcc problem. + +* Fri Jan 27 2023 Kevin Buettner - 12.1-16 +- Tweak gdb-6.3-rh-testversion-20041202.patch so that $_gdb_major + and $_gdb_minor will be obtained correctly. + +* Thu Jan 26 2023 Bruno Larsen +- Remove gdb-rhbz1398387-tab-crash-test.patch as that test didn't + work anymore. + +* Tue Jan 24 2023 Keith Seitz - 12.1-15 +- NVR bump for failed build. + +* Mon Jan 23 2023 Kevin Buettner +- More tweaks to gdb-6.6-buildid-locate-rpm.patch, in which rpmTag + is replaced with rpmDbiTagVal. + +* Mon Jan 23 2023 Keith Seitz - 12.1-14 + From Sergey Mende: +- Backport upstream patch "gdb: call check_typedef at beginning of + dwarf_expr_context::fetch_result". (Simon Marchi) + + +* Fri Jan 20 2023 Kevin Buettner - 12.1-13 +- Backport fix for problems associated with GCC 13's self-move warning. + (Jan-Benedict Glaw) +- Tweak gdb-6.6-buildid-locate-rpm.patch so that running GDB's configure + script will not error out due to GCC 13's warnings. + +* Thu Jan 19 2023 Alexandra Hájková - 12.1-12 +- Backport replace deprecated distutils.sysconfig in python-config. + (Lancelot SIX) + +* Thu Jan 19 2023 Fedora Release Engineering +- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild + +* Mon Dec 19 2022 Andrew Burgess +- Backport upstream commits 38665d717a3 and c3efaf0afd9 to fix RHBZ + 2152431. + +* Fri Dec 16 2022 Keith Seitz +- Remove gdb-6.6-buildid-locate-rpm-scl.patch and + gdb-bz601887-dwarf4-rh-test.patch. + +* Fri Dec 9 2022 Andrew Burgess +- Remove gdb-fortran-frame-string.patch, a version of this test has + now been upstreamed. + +* Fri Dec 9 2022 Andrew Burgess +- Remove gdb-bfd-aliasing.patch. + +* Fri Dec 9 2022 Andrew Burgess +- Remove gdb-entryval-crash-1of3.patch, gdb-entryval-crash-2of3.patch, + and gdb-entryval-crash-3of3.patch. + +* Wed Dec 7 2022 Keith Seitz - 12.1-10 +- Disable Guile support for F38+, RHBZ 2151328. + +* Mon Dec 5 2022 Keith Seitz +- Remove gdb-physname-pr11734-test.patch, + gdb-physname-pr12273-test.patch, gdb-runtest-pie-override.patch, + gdb-test-expr-cumulative-archer.patch. + +* Thu Dec 1 2022 Kevin Buettner +- Remove gdb-6.3-threaded-watchpoints2-20050225.patch. The test in this + patch is a tweaked version of upstream test gdb.threads/watchthreads.exp + from 2004. It doesn't actually test anything new. + +* Thu Dec 1 2022 Bruno Larsen +- Remove gdb-rhbz1325795-framefilters-test.patch. This test doesn't + pass in the curret state, and the code that introduced the original + problem has been changed beyong recognition at this point. + +* Wed Nov 30 2022 Keith Seitz +- Backport "libiberty: Fix C89-isms in configure tests" and do likewise in + gdb-6.6-buildid-locate-rpm.patch. + (Florian Weimer, RHBZ 2143992) + +* Wed Nov 23 2022 Kevin Buettner +- Remove gdb-6.3-inheritancetest-20050726.patch. Upstream testcase + gdb.cp/impl-this.exp tests the printing of an instance variable from + an inherited class in the "print c" test. + +* Fri Nov 18 2022 Kevin Buettner +- Remove gdb-6.3-test-movedir-20050125.patch. Upstream test + gdb.base/fullname.exp provides coverage for this case and more. + +* Thu Nov 3 2022 Keith Seitz - 12.1-9 +- Add patch to fix ODR violations on powerpc and + enable LTO builds. (Keith Seitz, sw build/23395) + +* Tue Oct 18 2022 Bruno Larsen - 12.1-8 +- Backport fix to gdb.base/break-main-file-remove-fail.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) +* Tue Oct 18 2022 Bruno Larsen - 12.1-7 +- Remove patch gdb-6.3-test-dtorfix. + Was upstreamed, will be back in the next rebase. -* Mon Apr 11 2022 Bruno Larsen -- Backport Add Power 10 PLT instruction patterns - (Carl Love, RHBZ 1870017) +* Thu Oct 13 2022 Alexandra Hájková - 12.1-7 +- Bump the release number. -* Mon Nov 1 2021 Keith Seitz - 10.2-9.el9 -- Backport IBM arch14 updates. - (Andreas Krebbel, RHBZ 2012819) +* Tue Oct 11 2022 Alexandra Hájková - 12.1-6 +- Backport upstream patch "Add support for readline 8.2". (Andreas Schwab) -* Mon Aug 09 2021 Mohan Boddu - 10.2-8.el9 -- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags - Related: rhbz#1991688 +* Fri Oct 7 2022 Alexandra Hájková - 12.1-6 +- Update gdb-6.6-buildid-locate.patch to fix RHBZ 2122947. -* Wed Jul 28 2021 Keith Seitz - 10.2-7.el9 -- Disable compile feature on RHEL9; remove gcc-gdb-plugin requirements. +* Thu Jul 28 2022 Amit Shah +- Use the dist_name macro to identify the distribution -* 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) +* Thu Jul 21 2022 Fedora Release Engineering +- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild -* 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) +* Mon Jun 13 2022 Python Maint +- Rebuilt for Python 3.11 -* 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) +* Mon Jun 13 2022 Python Maint - 12.1-2 +- Bootstrap for Python 3.11 -* 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 12 2022 Kevin Buettner - 12.1-1 +- Rebase to FSF GDB 12.1. +- Update gdb-6.6-buildid-locate.patch. +- Update gdb-6.6-buildid-locate-rpm.patch. +- Dropped backported patches from GDB 11.1 and 11.2. -* Thu May 27 2021 Keith Seitz - 10.2-2 -- Backport "Correct recording of 'store on condition' insns" - (Andreas Arnaz, RH BZ 1903375) +* Wed Mar 30 2022 Kevin Buettner - 11.2-3 +- Backport upstream patch which removes sizes from debuginfod download + messages when the size is not available (RHBZ 2068280, Aaron Merey). + +* Wed Feb 9 2022 Kevin Buettner - 11.2-2 +- On ix86, add -Wno-format-overflow to --enable-gdb-build-warnings. + (This is a workaround for the bogus warning/error that we now see + on i686 regarding a "may write a terminating nul past the end of + the destination" message for the sprintf() call in + global_symbol_searcher::search() in gdb/symtab.c.) + +* Wed Feb 9 2022 Kevin Buettner - 11.2-1 +- Rebase to FSF GDB 11.2. + +* Mon Jan 31 2022 Kevin Buettner - 11.1-12 +- Fix "sect_index_data not initialized" internal error. (RHBZ 2042664, + Kevin Buettner). + +* Mon Jan 31 2022 Keith Seitz - 11.1-11 +- Fix buld issues. (RHBZ 2042257, Keith Seitz, Andrew Burgess) +- Update libipt to 2.0.5. + +* Thu Jan 20 2022 Fedora Release Engineering +- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild + +* Wed Jan 12 2022 Alexandra Hájková - 11.1-9 +- Remove gdb-6.3-inferior-notification-20050721.patch + which adds problematic attach-32 test. + +* Tue Jan 11 2022 Alexandra Hájková - 11.1-8 +- Backport upstream patch "[PR gdb/27026] CTRL-C is ignored + when debug info is downloaded" (RHBZ 2024875, Aaron Merey). + +* Tue Jan 11 2022 Alexandra Hájková - 11.1-8 +- Backport upstream patch "rework "set debuginfod" commands" + (RHBZ 2024875, Simon Marchi). + +* Tue Jan 11 2022 Alexandra Hájková - 11.1-8 +- Backport upstream patch "Fix unittest.exp failure due to 'set debuginfod' addition" + (RHBZ 2024875, Tom Tromey). + +* Mon Jan 10 2022 Alexandra Hájková - 11.1-8 +- Add -Wno-unused-function to --enable-gdb-build-warnings to prevent the build failure: + "../../gdb/c-exp.y:3455:1: error: 'void c_print_token(FILE*, int, YYSTYPE)' + defined but not used [-Werror=unused-function]" + +* Mon Jan 10 2022 Alexandra Hájková - 11.1-8 +- Backport upstream patch "gdb: add set/show commands for managing debuginfod" + (RHBZ 2024875, Aaron Merey). + +* Mon Jan 10 2022 Alexandra Hájková - 11.1-8 +- Backport upstream patch "gdb.texinfo: Expand documentation for debuginfod" + (RHBZ 2024875, Aaron Merey). + +* Mon Dec 6 2021 Kevin Buettner - 11.1-7 +- Add -Wno-deprecated-declarations to --enable-gdb-build-warnings to work + around the python 3.11 deprecation of Py_SetProgramName. + +* Fri Nov 12 2021 Timm Bäder - 11.1-6 +- Use %%set_build_flags to populate all relevant build flags + +* Wed Nov 10 2021 Kevin Buettner - 11.1-5 +- Backport upstream fix and test case for a dprintf bug (RHBZ 2022177, Kevin + Buettner). + +* Tue Nov 9 2021 Bruno Larsen - 11.1-4 +- Backport manpage update to be closer to -help (RHBZ 853071) + +* Wed Nov 3 2021 Kevin Buettner - 11.1-3 +- Make adjustments to gdb-6.6-buildid-locate.patch, provided by Tom de Vries. + +* Mon Oct 11 2021 Kevin Buettner - 11.1-2 +- Backport upstream patch which papers over Fortran lexical analyzer + bug (RHBZ 2012976, Tom de Vries). + +* Mon Oct 04 2021 Kevin Buettner - 11.1-1 +- Rebase to FSF GDB 11.1. +- Adjust build-id related patches. +- Drop backported patches which are no longer relevant. +- Bump 'snapgnulib' date. + +* Thu Sep 30 2021 Alexandra Hájková - 10.2-9 +- Backport test for RHBZ 1976887 (Kevin Buettner). + +* Thu Sep 30 2021 Alexandra Hájková - 10.2-9 +- Backport upstream patch which fixes internal-error: Unexpected + type field location kind (RHBZ 1976887, Alexandra Hájková). + +* Wed Sep 22 2021 Bruno Larsen - 10.2-8 +- Backport "[gdb] Improve early exits for env var in debuginfod-support.c" + (Tom de Vries) + +* Wed Sep 22 2021 Bruno Larsen - 10.2-8 +- Backport "[gdb/cli] Don't assert on empty string for core-file" + (Tom de Vries) + +* Tue Sep 21 2021 Peter Robinson 10.2-7 +- Use guile 2.2 (rhbz #1901353) + +* Wed Jul 21 2021 Fedora Release Engineering 10.2-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild + +* Tue Jul 20 2021 Kevin Buettner - 10.2-5 +- Remove autoconf invocations from spec file. +- Remove BuildRequires: autoconf. + +* Mon Jun 14 2021 Kevin Buettner - 10.2-4 +- Backport upstream patches which fix multi-threaded debugging for + glibc-2.34 (RHBZ 1971096, Simon Marchi, Kevin Buettner). + +* Fri Jun 11 2021 Keith Seitz - 10.2-3 - 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) +- Backport "[gdb/server] Don't overwrite fs/gs_base with -m32" +- (Tom de Vries) -* Tue May 25 2021 Kevin Buettner - 10.2-1 +* Sun Jun 06 2021 Python Maint +- Rebuilt for Python 3.10 + +* Thu Jun 03 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. @@ -1287,61 +1817,61 @@ fi gdb-rhbz1964167-fortran-whitespace_array.patch gdb-rhbz1964167-move-fortran-expr-handling.patch -* Wed Mar 31 2021 Keith Seitz - 10.1-14 +* Tue Jun 01 2021 Python Maint +- Bootstrap for Python 3.10 + +* Wed Mar 31 2021 Keith Seitz - 10.1-18 - 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) +* Wed Mar 31 2021 Jonathan Wakely - 10.1-17 +- Rebuilt for removed libstdc++ symbols (#1937698) * Tue Mar 23 2021 Kevin Buettner - Remove spec file workaround for RHBZ 1912913. -* Fri Mar 19 2021 Kevin Buettner - 10.1-12 +* Fri Mar 19 2021 Kevin Buettner - 10.1-16 - Fix potential hang during gdbserver testing (RHBZ 1941080, Kevin Buettner). -* Thu Mar 18 2021 Keith Seitz - 10.1-11 +* Thu Mar 18 2021 Keith Seitz - Disable libctf on RHEL (RHBZ 1935517). -* Thu Mar 11 2021 Kevin Buettner - 10.1-10 +* Thu Mar 11 2021 Kevin Buettner - 10.1-15 - Update libipt to version 2.0.4. -* Fri Mar 05 2021 Kevin Buettner - 10.1-9 +* Fri Mar 05 2021 Kevin Buettner - 10.1-14 - Backport patches which fix frame_id_p assertion failure (RHBZ 1909902, Pedro Alves). -* Fri Mar 5 2021 Jan Kratochvil - 10.1-8 +* Fri Mar 5 2021 Jan Kratochvil - 10.1-13 - Drop gdb-vla-intel-fortran-vla-strings.patch as it was still regressing the testsuite. -* Thu Mar 4 2021 Jan Kratochvil +* Thu Mar 4 2021 Jan Kratochvil - 10.1-12 - Fix gdb-vla-intel-fortran-vla-strings.patch to no longer modify cached inferior types. -* Thu Mar 4 2021 Jan Kratochvil +* Thu Mar 4 2021 Jan Kratochvil - 10.1-11 - 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. +* Thu Mar 4 2021 Jan Kratochvil - 10.1-10 +- Reapply 10.1-8 after it has been accidentally reverted by 10.1-9. -* Wed Feb 24 2021 Kevin Buettner - 10.1-7 +* Wed Feb 24 2021 Kevin Buettner - 10.1-9 - Fix aarch64 build problem (RHBZ 1932645, Kevin Buettner). -* Fri Feb 19 2021 Jan Kratochvil +* Fri Feb 19 2021 Jan Kratochvil - 10.1-8 - Fix gdb-vla-intel-fortran-vla-strings.patch for compatiblity with GraalVM. -* Thu Feb 18 2021 Kevin Buettner +* Thu Feb 18 2021 Kevin Buettner - 10.1-7 - Fix gnulib related build problem (RHBZ 1930528, Kevin Buettner). -* Wed Feb 17 2021 Kevin Buettner +* Wed Feb 17 2021 Kevin Buettner - 10.1-6 - 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+. diff --git a/libiberty-infinite-recursion-fix-1-of-3.patch b/libiberty-infinite-recursion-fix-1-of-3.patch deleted file mode 100644 index 0800f98..0000000 --- a/libiberty-infinite-recursion-fix-1-of-3.patch +++ /dev/null @@ -1,119 +0,0 @@ -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/libiberty-infinite-recursion-fix-2-of-3.patch b/libiberty-infinite-recursion-fix-2-of-3.patch deleted file mode 100644 index e7dc83d..0000000 --- a/libiberty-infinite-recursion-fix-2-of-3.patch +++ /dev/null @@ -1,85 +0,0 @@ -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/libiberty-infinite-recursion-fix-3-of-3.patch b/libiberty-infinite-recursion-fix-3-of-3.patch deleted file mode 100644 index 73d9c49..0000000 --- a/libiberty-infinite-recursion-fix-3-of-3.patch +++ /dev/null @@ -1,23 +0,0 @@ -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/libiberty-rhbz-2132600-prevent-buffer-overflow.patch b/libiberty-rhbz-2132600-prevent-buffer-overflow.patch deleted file mode 100644 index a0f5076..0000000 --- a/libiberty-rhbz-2132600-prevent-buffer-overflow.patch +++ /dev/null @@ -1,27 +0,0 @@ -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 b/sources index 1209778..1451359 100644 --- a/sources +++ b/sources @@ -1,4 +1,3 @@ -SHA512 (gdb-10.2.tar.xz) = 3653762ac008e065c37cd641653184c9ff7ce51ee2222ade1122bec9d6cc64dffd4fb74888ef11ac1942064a08910e96b7865112ad37f4602eb0a16bed074caa SHA512 (gdb-libstdc++-v3-python-8.1.1-20180626.tar.xz) = a8b1c54dd348cfeb37da73f968742896be3dd13a4215f8d8519870c2abea915f5176c3fa6989ddd10f20020a16f0fab20cbae68ee8d58a82234d8778023520f8 -SHA512 (v2.0.4.tar.gz) = 596d2dac25fdbd3e5660d7e1feeb7e8d5d359d1d0e19b62ef593449037df236db1d4d98820f0031061b5573ed67797a85a77fb9991e215abaabc4bfe16ceaec8 - +SHA512 (gdb-14.2.tar.xz) = 7e07941f1fe661288cc571b4964012ceabc1760624fce20320db2f470c01439b2386f859b5288da13204b758e2e3b22a74c68c012178db93b9529b06f1e22ede +SHA512 (v2.0.5.tar.gz) = 2e7ac2aede84671b15597d9c56dbe077a81357bbf44b6684802592246fb7729b4a5743238ddf02f6ea143b4d29872f581408135f9c1ea1ccc99dab905916d98d diff --git a/testing-custom-inputrc.patch b/testing-custom-inputrc.patch deleted file mode 100644 index c95f7d1..0000000 --- a/testing-custom-inputrc.patch +++ /dev/null @@ -1,52 +0,0 @@ -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/v1.5-libipt-static.patch b/v1.5-libipt-static.patch deleted file mode 100644 index 69e1d1a..0000000 --- a/v1.5-libipt-static.patch +++ /dev/null @@ -1,13 +0,0 @@ -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();