From 4ee4cc50161308d6c271ea477795d1d594ae2e7be0851d70d400ca0c09403dfc Mon Sep 17 00:00:00 2001 From: Michael Matz Date: Thu, 28 Oct 2021 13:16:07 +0000 Subject: [PATCH 1/2] Accepting request 927907 from home:tomdevries:branches:devel:gcc-gdb-gdb-11-1-update - Maintenance scripts: * Add KFAILs in qa.sh. * Add missing '-a' in gdb.log greps in qa.sh. - Disable big endian powerpc. - Maintenance scripts: * Fix patch filtering in clean.sh. * Add KFAIL in qa.sh. - Patches added: * gdb-testsuite-add-checks-to-gdb.arch-i386-sse.exp.patch * gdb-testsuite-add-gdb.testsuite-dump-system-info.exp.patch * gdb-testsuite-add-kfail-in-gdb.threads-fork-plus-threads.exp.patch * gdb-testsuite-factor-out-dump_info-in-gdb.testsuite-dump-system-info.exp.patch * gdb-testsuite-fix-fail-in-gdb.threads-fork-and-threads.exp.patch * gdb-testsuite-fix-gdb.threads-linux-dp.exp.patch * gdb-testsuite-fix-port-detection-in-gdb.debuginfod-fetch_src_and_symbols.exp.patch * gdb-testsuite-handle-recursive-internal-problem-in-gdb_internal_error_resync.patch * gdb-testsuite-handle-runto-fail-in-gdb.mi-mi-var-cp.exp.patch * gdb-tui-fix-breakpoint-display-functionality.patch * gdb-testsuite-Fix-gdb.threads-thread-specific-bp.exp.patch - Patches dropped: * fix-gdb.threads-linux-dp.exp.patch - Added maintenance script: * qa.sh - Drop 32bit packages for s390x. - Fix SLE-15 s390x: unresolvable, nothing provides glibc-devel-static-32bit. - Disable test-case gdb.base/break-interp.exp for SLE-11. It causes a "glibc detected *** expect: double free or corruption (out)" in expect and a subsequent runtest abort. This might be the cause of the package build failure due to "Job seems to be stuck here, killed. (after 8hrs of inactivity)" - Patches added: * gdb-testsuite-fix-gdb.base-step-over-syscall.exp-with-m32-amd-case.patch * gdb-testsuite-fix-gdb.ada-big_packed_array.exp-xfail-for-m32.patch * gdb-testsuite-fix-race-in-gdb.threads-detach-step-over.exp.patch * fix-gdb.multi-multi-term-settings.exp-race.patch * gdb-testsuite-update-test-gdb.base-step-over-syscall.exp.patch - Rebase to 11.1 release (as in fedora 35 @ 9cd9368): * GDB now supports general memory tagging functionality if the underlying architecture supports the proper primitives and hooks. Currently this is enabled only for AArch64 MTE. * GDB will now look for the .gdbinit file in a config directory before looking for ~/.gdbinit. The file is searched for in the following locations: $XDG_CONFIG_HOME/gdb/gdbinit, $HOME/.config/gdb/gdbinit, $HOME/.gdbinit. * GDB will now load and process commands from ~/.config/gdb/gdbearlyinit or ~/.gdbearlyinit if these files are present. These files are processed earlier than any of the other initialization files and can affect parts of GDB's startup that previously had already been completed before the initialization files were read, for example styling of the initial GDB greeting. * GDB now has two new options "--early-init-command" and "--early-init-eval-command" with corresponding short options "-eix" and "-eiex" that allow options (that would normally appear in a gdbearlyinit file) to be passed on the command line. * set startup-quietly on|off show startup-quietly When 'on', this causes GDB to act as if "-silent" were passed on the command line. This command needs to be added to an early initialization file (e.g. ~/.config/gdb/gdbearlyinit) in order to affect GDB. * For RISC-V targets, the target feature "org.gnu.gdb.riscv.vector" is now understood by GDB, and can be used to describe the vector registers of a target. * TUI windows now support mouse actions. The mouse wheel scrolls the appropriate window. * Key combinations that do not have a specific action on the focused window are passed to GDB. For example, you now can use Ctrl-Left/Ctrl-Right to move between words in the command window regardless of which window is in focus. Previously you would need to focus on the command window for such key combinations to work. * set python ignore-environment on|off show python ignore-environment When 'on', this causes GDB's builtin Python to ignore any environment variables that would otherwise affect how Python behaves. This command needs to be added to an early initialization file (e.g. ~/.config/gdb/gdbearlyinit) in order to affect GDB. * set python dont-write-bytecode auto|on|off show python dont-write-bytecode When 'on', this causes GDB's builtin Python to not write any byte-code (.pyc files) to disk. This command needs to be added to an early initialization file (e.g. ~/.config/gdb/gdbearlyinit) in order to affect GDB. When 'off' byte-code will always be written. When set to 'auto' (the default) Python will check the PYTHONDONTWRITEBYTECODE environment variable. * break [PROBE_MODIFIER] [LOCATION] [thread THREADNUM] [-force-condition] [if CONDITION] This command would previously refuse setting a breakpoint if the CONDITION expression is invalid at a location. It now accepts and defines the breakpoint if there is at least one location at which the CONDITION is valid. The locations for which the CONDITION is invalid, are automatically disabled. If CONDITION is invalid at all of the locations, setting the breakpoint is still rejected. However, the '-force-condition' flag can be used in this case for forcing GDB to define the breakpoint, making all the current locations automatically disabled. This may be useful if the user knows the condition will become meaningful at a future location, e.g. due to a shared library load. - Update libipt to v2.0.4. Dropped obsoleted patch: * v1.5-libipt-static.patch - Obsoleted fedora patches dropped: * gdb-moribund-utrace-workaround.patch * gdb-save-restore-file-offset-while-reading-notes-in-core-file.patch * gdb-vla-intel-fix-print-char-array.patch * gdb-vla-intel-fortran-strides.patch * gdb-vla-intel-fortran-vla-strings.patch * gdb-vla-intel-stringbt-fix.patch * gdb-vla-intel-tests.patch - Obsoleted fedora fixup patches dropped: * fixup-2-gdb-archer-vla-tests.patch * fixup-2-gdb-rhbz1156192-recursive-dlopen-test.patch * fixup-3-gdb-archer-vla-tests.patch * fixup-gdb-6.3-test-pie-20050107.patch * fixup-gdb-6.3-threaded-watchpoints2-20050225.patch * fixup-gdb-6.5-sharedlibrary-path.patch * fixup-gdb-6.8-bz442765-threaded-exec-test.patch * fixup-gdb-archer-vla-tests.patch * fixup-gdb-base-gnu-ifunc-strstr-workaround-exp.patch * fixup-gdb-btrobust.patch * fixup-gdb-bz634108-solib_address.patch * fixup-gdb-dts-rhel6-python-compat.patch * fixup-gdb-gnat-dwarf-crash-3of3.patch * fixup-gdb-rhbz1156192-recursive-dlopen-test.patch * fixup-gdb-test-ivy-bridge.patch * fixup-gdb-vla-intel-fortran-vla-strings.patch * fixup-gdb-vla-intel-tests.patch - Obsoleted patches dropped: * amd64-linux-siginfo-include-order.patch * gdb-powerpc-remove-512-bytes-region-limit-if-2nd-dawr-is-avaliable.patch * gdb-support-dw-lle-start-end.patch * gdb-symtab-fix-infinite-recursion-in-dwarf2_cu-get_builder-again.patch * gdb-symtab-fix-language-of-frame-without-debug-info.patch * gdb-symtab-read-cu-base-address-for-enqueued-cu.patch * gdb-symtab-use-early-continue-in-find_pc_sect_compunit.patch * gdb-testsuite-catch-condition-evaluation-errors-in-gdb-assert.patch * gdb-testsuite-detect-gdb-prompt-after-monitor-exit.patch * gdb-testsuite-disable-selftests-for-factory.patch * gdb-testsuite-fix-control-flow-in-gdb-reverse-insn-reverse-exp.patch * gdb-testsuite-fix-failure-in-gdb-base-step-over-no-symbols-exp.patch * gdb-testsuite-fix-gdb-dlang-watch-loc-exp-on-ppc64.patch * gdb-testsuite-fix-gdb-reverse-insn-reverse-x86-c-for-m32.patch * gdb-testsuite-fix-gdb.arch-amd64-stap-three-arg-disp.s.patch * gdb-testsuite-fix-unset-of-debuginfod_urls-in-default_gdb_init.patch * gdb-testsuite-fix-xfail-handling-in-gdb.threads-gcore-thread.exp.patch * gdb-testsuite-gdb-base-morestack-exp-no-clang.patch * gdb-testsuite-gdb-tui-new-layout-exp-partly-require-tcl86.patch * gdb-testsuite-handle-sigill-in-gdb-reverse-insn-reverse-exp.patch * gdb-testsuite-ignore-debuginfod_urls.patch * gdb-testsuite-prevent-pagination-in-gdb-internalflags.patch * gdb-threads-fix-lin_thread_get_thread_signals-for-glibc-2.28.patch * gdb-try-to-load-libthread_db-only-after-reading-all-shared-libraries-when-attaching.patch * gdb-tui-fix-len_without_escapes-in-tui-disasm.c.patch - Fedora patches updated: * gdb-6.3-bz140532-ppc-unwinding-test.patch * gdb-6.3-bz202689-exec-from-pthread-test.patch * gdb-6.3-gstack-20050411.patch * gdb-6.3-inheritancetest-20050726.patch * gdb-6.3-mapping-zero-inode-test.patch * gdb-6.3-test-dtorfix-20050121.patch * gdb-6.3-test-movedir-20050125.patch * gdb-6.3-threaded-watchpoints2-20050225.patch * gdb-6.5-bz109921-DW_AT_decl_file-test.patch * gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch * gdb-6.5-bz218379-ppc-solib-trampoline-test.patch * gdb-6.5-bz243845-stale-testing-zombie-test.patch * gdb-6.5-ia64-libunwind-leak-test.patch * gdb-6.5-last-address-space-byte-test.patch * gdb-6.5-readline-long-line-crash-test.patch * gdb-6.5-section-num-fixup-test.patch * gdb-6.5-sharedlibrary-path.patch * gdb-6.6-buildid-locate-rpm-scl.patch * gdb-6.6-buildid-locate-rpm.patch * gdb-6.6-buildid-locate-solib-missing-ids.patch * gdb-6.6-buildid-locate.patch * gdb-6.6-bz229517-gcore-without-terminal.patch * gdb-6.6-bz230000-power6-disassembly-test.patch * gdb-6.6-bz237572-ppc-atomic-sequence-test.patch * gdb-6.8-bz442765-threaded-exec-test.patch * gdb-bz601887-dwarf4-rh-test.patch * gdb-bz634108-solib_address.patch * gdb-ccache-workaround.patch * gdb-container-rh-pkg.patch * gdb-fedora-libncursesw.patch * gdb-fortran-frame-string.patch * gdb-glibc-strstr-workaround.patch * gdb-lineno-makeup-test.patch * gdb-linux_perf-bundle.patch * gdb-physname-pr11734-test.patch * gdb-ppc-power7-test.patch * gdb-rhbz1156192-recursive-dlopen-test.patch * gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch * gdb-rhbz1350436-type-printers-error.patch * gdb-rhbz1398387-tab-crash-test.patch * gdb-test-dw2-aranges.patch * gdb-test-ivy-bridge.patch * gdb-test-pid0-core.patch - Patches updated: * gdb-fix-selftest-fails-with-gdb-build-with-O2-flto.patch * gdb-gcore-bash.patch - Fedora patches added: * gdb-6.3-attach-see-vdso-test.patch * gdb-6.3-inferior-notification-20050721.patch * gdb-6.5-gcore-buffer-limit-test.patch * gdb-6.5-missed-trap-on-step-test.patch * gdb-rhbz1976887-field-location-kind.patch * gdb-rhbz2012976-paper-over-fortran-lex-problems.patch * gdb-test-for-rhbz1976887.patch - Fedora fixup patches added: * fixup-2-gdb-6.6-buildid-locate.patch * fixup-gdb-glibc-strstr-workaround.patch * fixup-gdb-linux_perf-bundle.patch * fixup-gdb-rhbz1325795-framefilters-test.patch * fixup-gdb-rhbz1553104-s390x-arch12-test.patch - Patches added: * fix-gdb.mi-new-ui-mi-sync.exp.patch * fix-gdb.threads-linux-dp.exp.patch * gdb-add-index.sh-fix-bashism.patch * gdb-build-add-cxx_dialect-to-cxx.patch * gdb-build-make-c-exp.y-work-with-bison-3.8.patch * gdb-python-finishbreakpoint-update.patch * gdb-symtab-add-call_site_eq-and-call_site_hash.patch * gdb-symtab-c-ify-call_site.patch * gdb-symtab-fix-htab_find_slot-call-in-read_call_site_scope.patch * gdb-symtab-remove-compunit_call_site_htab.patch * gdb-symtab-use-unrelocated-addresses-in-call_site.patch * gdb-testsuite-add-nopie-in-two-test-cases.patch * gdb-testsuite-fix-fail-in-gdb.base-annota1.exp.patch * gdb-testsuite-fix-fail-in-gdb.tui-corefile-run.exp.patch * gdb-testsuite-fix-gdb.base-dcache-flush.exp.patch * gdb-testsuite-fix-gdb.gdb-selftest.exp.patch * gdb-testsuite-fix-gdb.python-py-events.exp.patch * gdb-testsuite-fix-gdb.server-server-kill.exp-with-m32.patch * gdb-testsuite-fix-gdb.threads-check-libthread-db.exp-with-glibc-2.34.patch * gdb-testsuite-handle-supports_memtag-in-gdb.base-gdb-caching-proc.exp.patch * gdb-testsuite-prevent-compilation-fails-with-unix-fpie-pie.patch * gdb-testsuite-refactor-regexp-in-gdb.base-annota1.exp.patch * gdb-testsuite-support-fpie-fno-pie-pie-no-pie-in-gdb_compile_rust.patch * gdb-testsuite-use-compiler-generated-instead-of-gas-generated-stabs.patch - Fedora patches replaced: * fixup-gdb-6.6-buildid-locate.patch - Added maintenance scripts: * import-patches.sh * clean.sh OBS-URL: https://build.opensuse.org/request/show/927907 OBS-URL: https://build.opensuse.org/package/show/devel:gcc/gdb?expand=0&rev=289 --- amd64-linux-siginfo-include-order.patch | 59 - clean.sh | 46 + fix-gdb.mi-new-ui-mi-sync.exp.patch | 23 + ...b.multi-multi-term-settings.exp-race.patch | 182 + fixup-2-gdb-6.6-buildid-locate.patch | 20 + fixup-2-gdb-archer-vla-tests.patch | 41 - ...db-rhbz1156192-recursive-dlopen-test.patch | 51 - fixup-3-gdb-archer-vla-tests.patch | 24 - fixup-gdb-6.3-test-pie-20050107.patch | 90 - ...b-6.3-threaded-watchpoints2-20050225.patch | 22 - fixup-gdb-6.5-sharedlibrary-path.patch | 41 - fixup-gdb-6.6-buildid-locate.patch | 33 +- ...-gdb-6.8-bz442765-threaded-exec-test.patch | 19 - fixup-gdb-archer-vla-tests.patch | 26 - ...base-gnu-ifunc-strstr-workaround-exp.patch | 29 - fixup-gdb-btrobust.patch | 28 - fixup-gdb-bz634108-solib_address.patch | 16 - fixup-gdb-dts-rhel6-python-compat.patch | 49 - fixup-gdb-glibc-strstr-workaround.patch | 19 + fixup-gdb-gnat-dwarf-crash-3of3.patch | 51 - fixup-gdb-linux_perf-bundle.patch | 24 + ...db-rhbz1156192-recursive-dlopen-test.patch | 18 - fixup-gdb-rhbz1325795-framefilters-test.patch | 19 + fixup-gdb-rhbz1553104-s390x-arch12-test.patch | 19 + fixup-gdb-test-ivy-bridge.patch | 19 - fixup-gdb-vla-intel-fortran-vla-strings.patch | 340 -- fixup-gdb-vla-intel-tests.patch | 157 - gdb-10.1.tar.bz2 | 3 - gdb-11.1.tar.bz2 | 3 + gdb-6.3-attach-see-vdso-test.patch | 120 + gdb-6.3-bz140532-ppc-unwinding-test.patch | 12 +- gdb-6.3-bz202689-exec-from-pthread-test.patch | 6 +- gdb-6.3-gstack-20050411.patch | 12 +- gdb-6.3-inferior-notification-20050721.patch | 324 ++ gdb-6.3-inheritancetest-20050726.patch | 5 +- gdb-6.3-mapping-zero-inode-test.patch | 6 +- gdb-6.3-test-dtorfix-20050121.patch | 4 +- gdb-6.3-test-movedir-20050125.patch | 12 +- gdb-6.3-test-pie-20050107.patch | 2027 --------- gdb-6.3-test-self-20050110.patch | 42 - gdb-6.3-threaded-watchpoints2-20050225.patch | 23 +- gdb-6.5-bz109921-DW_AT_decl_file-test.patch | 10 +- ...337-resolve-tls-without-debuginfo-v2.patch | 10 +- ...5-bz218379-ppc-solib-trampoline-test.patch | 15 +- ...379-solib-trampoline-lookup-lock-fix.patch | 27 - ...5-bz243845-stale-testing-zombie-test.patch | 11 +- gdb-6.5-gcore-buffer-limit-test.patch | 154 + gdb-6.5-ia64-libunwind-leak-test.patch | 17 +- gdb-6.5-last-address-space-byte-test.patch | 6 +- gdb-6.5-missed-trap-on-step-test.patch | 95 + gdb-6.5-readline-long-line-crash-test.patch | 18 +- gdb-6.5-section-num-fixup-test.patch | 17 +- gdb-6.5-sharedlibrary-path.patch | 41 +- gdb-6.6-buildid-locate-core-as-arg.patch | 196 - gdb-6.6-buildid-locate-rpm-scl.patch | 4 +- gdb-6.6-buildid-locate-rpm.patch | 40 +- ...6.6-buildid-locate-solib-missing-ids.patch | 13 +- gdb-6.6-buildid-locate.patch | 114 +- gdb-6.6-bz229517-gcore-without-terminal.patch | 6 +- ...6.6-bz230000-power6-disassembly-test.patch | 2 +- ....6-bz237572-ppc-atomic-sequence-test.patch | 6 +- gdb-6.8-bz442765-threaded-exec-test.patch | 2 +- gdb-6.8-quit-never-aborts.patch | 78 - gdb-add-index.sh-fix-bashism.patch | 21 + gdb-archer-pie-addons-keep-disabled.patch | 89 - gdb-archer-pie-addons.patch | 39 - gdb-archer-vla-tests.patch | 3737 ----------------- gdb-archer.patch | 187 - gdb-attach-fail-reasons-5of5.patch | 356 -- ...oint-fix-assert-in-jit_event_handler.patch | 114 - ...n-create_exception_master_breakpoint.patch | 53 - gdb-btrobust.patch | 45 - gdb-build-add-cxx_dialect-to-cxx.patch | 193 + gdb-build-hardcode-with-included-regex.patch | 153 - ...ild-make-c-exp.y-work-with-bison-3.8.patch | 37 + gdb-bz1219747-attach-kills.patch | 178 - gdb-bz601887-dwarf4-rh-test.patch | 4 +- gdb-bz634108-solib_address.patch | 2 +- gdb-ccache-workaround.patch | 4 +- gdb-config.patch | 56 - gdb-container-rh-pkg.patch | 2 +- ...ting-path-in-debuginfod-source-query.patch | 69 - gdb-dts-rhel6-python-compat.patch | 315 -- gdb-fedora-libncursesw.patch | 12 +- ...me-in-not-in-executable-format-error.patch | 27 - ...nal-error-in-process_event_stop_test.patch | 267 -- ...on-matching-in-find_pc_sect_compunit.patch | 105 - ...st-fails-with-gdb-build-with-O2-flto.patch | 19 - ...-remote-async-inferior-event-handler.patch | 28 - gdb-fortran-fix-print-dynamic-array.patch | 14 - gdb-fortran-frame-string.patch | 8 +- gdb-gcore-bash.patch | 2 +- gdb-glibc-strstr-workaround.patch | 10 +- gdb-gnat-dwarf-crash-3of3.patch | 219 - ...le-no-upper-bound-in-value-subscript.patch | 43 - gdb-jit-reader-multilib.patch | 46 - gdb-lineno-makeup-test.patch | 4 +- gdb-linux_perf-bundle.patch | 2 +- gdb-moribund-utrace-workaround.patch | 25 - gdb-physname-pr11734-test.patch | 15 +- ...egion-limit-if-2nd-dawr-is-avaliable.patch | 72 - gdb-ppc-power7-test.patch | 4 +- gdb-python-finishbreakpoint-update.patch | 453 ++ gdb-rhbz1156192-recursive-dlopen-test.patch | 29 +- ...bz1261564-aarch64-hw-watchpoint-test.patch | 2 +- gdb-rhbz1350436-type-printers-error.patch | 6 +- gdb-rhbz1398387-tab-crash-test.patch | 2 +- gdb-rhbz1976887-field-location-kind.patch | 30 + ...2976-paper-over-fortran-lex-problems.patch | 185 + ...set-while-reading-notes-in-core-file.patch | 88 - gdb-support-dw-lle-start-end.patch | 45 - ...-add-call_site_eq-and-call_site_hash.patch | 110 + gdb-symtab-c-ify-call_site.patch | 317 ++ ...nd_slot-call-in-read_call_site_scope.patch | 68 + ...rsion-in-dwarf2_cu-get_builder-again.patch | 167 - ...language-of-frame-without-debug-info.patch | 248 -- ...read-cu-base-address-for-enqueued-cu.patch | 178 - ...ymtab-remove-compunit_call_site_htab.patch | 133 + ...ly-continue-in-find_pc_sect_compunit.patch | 149 - ...e-unrelocated-addresses-in-call_site.patch | 194 + gdb-test-dw2-aranges.patch | 2 +- gdb-test-for-rhbz1976887.patch | 592 +++ gdb-test-ivy-bridge.patch | 85 +- gdb-test-pid0-core.patch | 10 +- ...x-gdb.threads-thread-specific-bp.exp.patch | 62 + ...-add-checks-to-gdb.arch-i386-sse.exp.patch | 88 + ...d-gdb.testsuite-dump-system-info.exp.patch | 81 + ...in-gdb.threads-fork-plus-threads.exp.patch | 57 + ...estsuite-add-nopie-in-two-test-cases.patch | 51 + ...tion-evaluation-errors-in-gdb-assert.patch | 68 - ...detect-gdb-prompt-after-monitor-exit.patch | 71 - ...tsuite-disable-selftests-for-factory.patch | 65 - ...n-gdb.testsuite-dump-system-info.exp.patch | 70 + ...flow-in-gdb-reverse-insn-reverse-exp.patch | 76 - ...ite-fix-fail-in-gdb.base-annota1.exp.patch | 48 + ...-in-gdb.threads-fork-and-threads.exp.patch | 144 + ...fix-fail-in-gdb.tui-corefile-run.exp.patch | 64 + ...in-gdb-base-step-over-no-symbols-exp.patch | 52 - ...fix-gdb-dlang-watch-loc-exp-on-ppc64.patch | 123 - ...b-reverse-insn-reverse-x86-c-for-m32.patch | 95 - ...a-big_packed_array.exp-xfail-for-m32.patch | 53 + ...gdb.arch-amd64-stap-three-arg-disp.s.patch | 71 - ...tsuite-fix-gdb.base-dcache-flush.exp.patch | 48 + ...p-over-syscall.exp-with-m32-amd-case.patch | 71 + gdb-testsuite-fix-gdb.gdb-selftest.exp.patch | 44 + ...stsuite-fix-gdb.python-py-events.exp.patch | 50 + ...-gdb.server-server-kill.exp-with-m32.patch | 51 + ...eck-libthread-db.exp-with-glibc-2.34.patch | 49 + ...stsuite-fix-gdb.threads-linux-dp.exp.patch | 53 + ...debuginfod-fetch_src_and_symbols.exp.patch | 52 + ...-in-gdb.threads-detach-step-over.exp.patch | 72 + ...-debuginfod_urls-in-default_gdb_init.patch | 33 - ...ling-in-gdb.threads-gcore-thread.exp.patch | 80 - ...uite-gdb-base-morestack-exp-no-clang.patch | 43 - ...-new-layout-exp-partly-require-tcl86.patch | 25 - ...problem-in-gdb_internal_error_resync.patch | 68 + ...e-runto-fail-in-gdb.mi-mi-var-cp.exp.patch | 164 + ...gill-in-gdb-reverse-insn-reverse-exp.patch | 170 - ...tag-in-gdb.base-gdb-caching-proc.exp.patch | 56 + gdb-testsuite-ignore-debuginfod_urls.patch | 49 - ...compilation-fails-with-unix-fpie-pie.patch | 125 + ...vent-pagination-in-gdb-internalflags.patch | 66 - ...actor-regexp-in-gdb.base-annota1.exp.patch | 79 + ...o-pie-pie-no-pie-in-gdb_compile_rust.patch | 95 + ...-test-gdb.base-step-over-syscall.exp.patch | 241 ++ ...rated-instead-of-gas-generated-stabs.patch | 74 + ...ad_get_thread_signals-for-glibc-2.28.patch | 167 - ...-all-shared-libraries-when-attaching.patch | 77 - ...fix-breakpoint-display-functionality.patch | 115 + ...-len_without_escapes-in-tui-disasm.c.patch | 71 - gdb-vla-intel-fix-print-char-array.patch | 59 - gdb-vla-intel-fortran-strides.patch | 1778 -------- gdb-vla-intel-fortran-vla-strings.patch | 1086 ----- gdb-vla-intel-stringbt-fix.patch | 167 - gdb-vla-intel-tests.patch | 350 -- gdb.changes | 263 ++ gdb.spec | 467 +- import-patches.sh | 70 + qa.sh | 256 ++ v1.5-libipt-static.patch | 11 - v2.0.2.tar.gz | 3 - v2.0.4.tar.gz | 3 + 182 files changed, 6784 insertions(+), 15971 deletions(-) delete mode 100644 amd64-linux-siginfo-include-order.patch create mode 100644 clean.sh create mode 100644 fix-gdb.mi-new-ui-mi-sync.exp.patch create mode 100644 fix-gdb.multi-multi-term-settings.exp-race.patch create mode 100644 fixup-2-gdb-6.6-buildid-locate.patch delete mode 100644 fixup-2-gdb-archer-vla-tests.patch delete mode 100644 fixup-2-gdb-rhbz1156192-recursive-dlopen-test.patch delete mode 100644 fixup-3-gdb-archer-vla-tests.patch delete mode 100644 fixup-gdb-6.3-test-pie-20050107.patch delete mode 100644 fixup-gdb-6.3-threaded-watchpoints2-20050225.patch delete mode 100644 fixup-gdb-6.5-sharedlibrary-path.patch delete mode 100644 fixup-gdb-6.8-bz442765-threaded-exec-test.patch delete mode 100644 fixup-gdb-archer-vla-tests.patch delete mode 100644 fixup-gdb-base-gnu-ifunc-strstr-workaround-exp.patch delete mode 100644 fixup-gdb-btrobust.patch delete mode 100644 fixup-gdb-bz634108-solib_address.patch delete mode 100644 fixup-gdb-dts-rhel6-python-compat.patch create mode 100644 fixup-gdb-glibc-strstr-workaround.patch delete mode 100644 fixup-gdb-gnat-dwarf-crash-3of3.patch create mode 100644 fixup-gdb-linux_perf-bundle.patch delete mode 100644 fixup-gdb-rhbz1156192-recursive-dlopen-test.patch create mode 100644 fixup-gdb-rhbz1325795-framefilters-test.patch create mode 100644 fixup-gdb-rhbz1553104-s390x-arch12-test.patch delete mode 100644 fixup-gdb-test-ivy-bridge.patch delete mode 100644 fixup-gdb-vla-intel-fortran-vla-strings.patch delete mode 100644 fixup-gdb-vla-intel-tests.patch delete mode 100644 gdb-10.1.tar.bz2 create mode 100644 gdb-11.1.tar.bz2 create mode 100644 gdb-6.3-attach-see-vdso-test.patch create mode 100644 gdb-6.3-inferior-notification-20050721.patch delete mode 100644 gdb-6.3-test-pie-20050107.patch delete mode 100644 gdb-6.3-test-self-20050110.patch delete mode 100644 gdb-6.5-bz218379-solib-trampoline-lookup-lock-fix.patch create mode 100644 gdb-6.5-gcore-buffer-limit-test.patch create mode 100644 gdb-6.5-missed-trap-on-step-test.patch delete mode 100644 gdb-6.6-buildid-locate-core-as-arg.patch delete mode 100644 gdb-6.8-quit-never-aborts.patch create mode 100644 gdb-add-index.sh-fix-bashism.patch delete mode 100644 gdb-archer-pie-addons-keep-disabled.patch delete mode 100644 gdb-archer-pie-addons.patch delete mode 100644 gdb-archer-vla-tests.patch delete mode 100644 gdb-archer.patch delete mode 100644 gdb-attach-fail-reasons-5of5.patch delete mode 100644 gdb-breakpoint-fix-assert-in-jit_event_handler.patch delete mode 100644 gdb-breakpoints-handle-glibc-with-debuginfo-in-create_exception_master_breakpoint.patch delete mode 100644 gdb-btrobust.patch create mode 100644 gdb-build-add-cxx_dialect-to-cxx.patch delete mode 100644 gdb-build-hardcode-with-included-regex.patch create mode 100644 gdb-build-make-c-exp.y-work-with-bison-3.8.patch delete mode 100644 gdb-bz1219747-attach-kills.patch delete mode 100644 gdb-config.patch delete mode 100644 gdb-don-t-return-non-existing-path-in-debuginfod-source-query.patch delete mode 100644 gdb-dts-rhel6-python-compat.patch delete mode 100644 gdb-fix-filename-in-not-in-executable-format-error.patch delete mode 100644 gdb-fix-internal-error-in-process_event_stop_test.patch delete mode 100644 gdb-fix-section-matching-in-find_pc_sect_compunit.patch delete mode 100644 gdb-fix-use-of-invalid-pointer-in-remote-async-inferior-event-handler.patch delete mode 100644 gdb-fortran-fix-print-dynamic-array.patch delete mode 100644 gdb-gnat-dwarf-crash-3of3.patch delete mode 100644 gdb-handle-no-upper-bound-in-value-subscript.patch delete mode 100644 gdb-jit-reader-multilib.patch delete mode 100644 gdb-moribund-utrace-workaround.patch delete mode 100644 gdb-powerpc-remove-512-bytes-region-limit-if-2nd-dawr-is-avaliable.patch create mode 100644 gdb-python-finishbreakpoint-update.patch create mode 100644 gdb-rhbz1976887-field-location-kind.patch create mode 100644 gdb-rhbz2012976-paper-over-fortran-lex-problems.patch delete mode 100644 gdb-save-restore-file-offset-while-reading-notes-in-core-file.patch delete mode 100644 gdb-support-dw-lle-start-end.patch create mode 100644 gdb-symtab-add-call_site_eq-and-call_site_hash.patch create mode 100644 gdb-symtab-c-ify-call_site.patch create mode 100644 gdb-symtab-fix-htab_find_slot-call-in-read_call_site_scope.patch delete mode 100644 gdb-symtab-fix-infinite-recursion-in-dwarf2_cu-get_builder-again.patch delete mode 100644 gdb-symtab-fix-language-of-frame-without-debug-info.patch delete mode 100644 gdb-symtab-read-cu-base-address-for-enqueued-cu.patch create mode 100644 gdb-symtab-remove-compunit_call_site_htab.patch delete mode 100644 gdb-symtab-use-early-continue-in-find_pc_sect_compunit.patch create mode 100644 gdb-symtab-use-unrelocated-addresses-in-call_site.patch create mode 100644 gdb-test-for-rhbz1976887.patch create mode 100644 gdb-testsuite-Fix-gdb.threads-thread-specific-bp.exp.patch create mode 100644 gdb-testsuite-add-checks-to-gdb.arch-i386-sse.exp.patch create mode 100644 gdb-testsuite-add-gdb.testsuite-dump-system-info.exp.patch create mode 100644 gdb-testsuite-add-kfail-in-gdb.threads-fork-plus-threads.exp.patch create mode 100644 gdb-testsuite-add-nopie-in-two-test-cases.patch delete mode 100644 gdb-testsuite-catch-condition-evaluation-errors-in-gdb-assert.patch delete mode 100644 gdb-testsuite-detect-gdb-prompt-after-monitor-exit.patch delete mode 100644 gdb-testsuite-disable-selftests-for-factory.patch create mode 100644 gdb-testsuite-factor-out-dump_info-in-gdb.testsuite-dump-system-info.exp.patch delete mode 100644 gdb-testsuite-fix-control-flow-in-gdb-reverse-insn-reverse-exp.patch create mode 100644 gdb-testsuite-fix-fail-in-gdb.base-annota1.exp.patch create mode 100644 gdb-testsuite-fix-fail-in-gdb.threads-fork-and-threads.exp.patch create mode 100644 gdb-testsuite-fix-fail-in-gdb.tui-corefile-run.exp.patch delete mode 100644 gdb-testsuite-fix-failure-in-gdb-base-step-over-no-symbols-exp.patch delete mode 100644 gdb-testsuite-fix-gdb-dlang-watch-loc-exp-on-ppc64.patch delete mode 100644 gdb-testsuite-fix-gdb-reverse-insn-reverse-x86-c-for-m32.patch create mode 100644 gdb-testsuite-fix-gdb.ada-big_packed_array.exp-xfail-for-m32.patch delete mode 100644 gdb-testsuite-fix-gdb.arch-amd64-stap-three-arg-disp.s.patch create mode 100644 gdb-testsuite-fix-gdb.base-dcache-flush.exp.patch create mode 100644 gdb-testsuite-fix-gdb.base-step-over-syscall.exp-with-m32-amd-case.patch create mode 100644 gdb-testsuite-fix-gdb.gdb-selftest.exp.patch create mode 100644 gdb-testsuite-fix-gdb.python-py-events.exp.patch create mode 100644 gdb-testsuite-fix-gdb.server-server-kill.exp-with-m32.patch create mode 100644 gdb-testsuite-fix-gdb.threads-check-libthread-db.exp-with-glibc-2.34.patch create mode 100644 gdb-testsuite-fix-gdb.threads-linux-dp.exp.patch create mode 100644 gdb-testsuite-fix-port-detection-in-gdb.debuginfod-fetch_src_and_symbols.exp.patch create mode 100644 gdb-testsuite-fix-race-in-gdb.threads-detach-step-over.exp.patch delete mode 100644 gdb-testsuite-fix-unset-of-debuginfod_urls-in-default_gdb_init.patch delete mode 100644 gdb-testsuite-fix-xfail-handling-in-gdb.threads-gcore-thread.exp.patch delete mode 100644 gdb-testsuite-gdb-base-morestack-exp-no-clang.patch delete mode 100644 gdb-testsuite-gdb-tui-new-layout-exp-partly-require-tcl86.patch create mode 100644 gdb-testsuite-handle-recursive-internal-problem-in-gdb_internal_error_resync.patch create mode 100644 gdb-testsuite-handle-runto-fail-in-gdb.mi-mi-var-cp.exp.patch delete mode 100644 gdb-testsuite-handle-sigill-in-gdb-reverse-insn-reverse-exp.patch create mode 100644 gdb-testsuite-handle-supports_memtag-in-gdb.base-gdb-caching-proc.exp.patch delete mode 100644 gdb-testsuite-ignore-debuginfod_urls.patch create mode 100644 gdb-testsuite-prevent-compilation-fails-with-unix-fpie-pie.patch delete mode 100644 gdb-testsuite-prevent-pagination-in-gdb-internalflags.patch create mode 100644 gdb-testsuite-refactor-regexp-in-gdb.base-annota1.exp.patch create mode 100644 gdb-testsuite-support-fpie-fno-pie-pie-no-pie-in-gdb_compile_rust.patch create mode 100644 gdb-testsuite-update-test-gdb.base-step-over-syscall.exp.patch create mode 100644 gdb-testsuite-use-compiler-generated-instead-of-gas-generated-stabs.patch delete mode 100644 gdb-threads-fix-lin_thread_get_thread_signals-for-glibc-2.28.patch delete mode 100644 gdb-try-to-load-libthread_db-only-after-reading-all-shared-libraries-when-attaching.patch create mode 100644 gdb-tui-fix-breakpoint-display-functionality.patch delete mode 100644 gdb-tui-fix-len_without_escapes-in-tui-disasm.c.patch delete mode 100644 gdb-vla-intel-fix-print-char-array.patch delete mode 100644 gdb-vla-intel-fortran-strides.patch delete mode 100644 gdb-vla-intel-fortran-vla-strings.patch delete mode 100644 gdb-vla-intel-stringbt-fix.patch delete mode 100644 gdb-vla-intel-tests.patch create mode 100644 import-patches.sh create mode 100644 qa.sh delete mode 100644 v1.5-libipt-static.patch delete mode 100644 v2.0.2.tar.gz create mode 100644 v2.0.4.tar.gz diff --git a/amd64-linux-siginfo-include-order.patch b/amd64-linux-siginfo-include-order.patch deleted file mode 100644 index 494e859..0000000 --- a/amd64-linux-siginfo-include-order.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 8488c357ce4fc309d49c7b0224cf9574b68e8116 Mon Sep 17 00:00:00 2001 -From: Kevin Buettner -Date: Thu, 18 Feb 2021 22:46:58 -0700 -Subject: [PATCH] amd64-linux-siginfo.c: Adjust include order to avoid gnulib - error - -On Fedora rawhide, after updating to glibc-2.33, I'm seeing the -following build failure: - - CXX nat/amd64-linux-siginfo.o -In file included from /usr/include/bits/sigstksz.h:24, - from /usr/include/signal.h:315, - from ../gnulib/import/signal.h:52, - from /ironwood1/sourceware-git/rawhide-gnulib/bld/../../worktree-gnulib/gdbserver/../gdb/nat/amd64-linux-siginfo.c:20: -../gnulib/import/unistd.h:663:3: error: #error "Please include config.h first." - 663 | #error "Please include config.h first." - | ^~~~~ - -glibc-2.33 has changed signal.h to now include which, -in turn, includes . For a gdb build, this causes the gnulib -version of unistd.h to be pulled in first. The build failure shown -above happens because gnulib's config.h has not been included before -the include of . - -The fix is simple - we just rearrange the order of the header file -includes to make sure that gdbsupport/commondefs.h is included before -attempting to include signal.h. Note that gdbsupport/commondefs.h -includes . - -Build and regression tested on Fedora 33. On Fedora rawhide, GDB -builds again. - -gdb/ChangeLog: - - * nat/amd64-linux-siginfo.c: Include "gdbsupport/common-defs.h" - (which in turn includes ) before include - of . ---- - gdb/ChangeLog | 6 ++++++ - gdb/nat/amd64-linux-siginfo.c | 2 +- - 2 files changed, 7 insertions(+), 1 deletion(-) - -diff --git a/gdb/nat/amd64-linux-siginfo.c b/gdb/nat/amd64-linux-siginfo.c -index 0c932814ec8..e2d2db6e112 100644 ---- a/gdb/nat/amd64-linux-siginfo.c -+++ b/gdb/nat/amd64-linux-siginfo.c -@@ -17,8 +17,8 @@ - You should have received a copy of the GNU General Public License - along with this program. If not, see . */ - --#include - #include "gdbsupport/common-defs.h" -+#include - #include "amd64-linux-siginfo.h" - - #define GDB_SI_SIZE 128 --- -2.32.0 - diff --git a/clean.sh b/clean.sh new file mode 100644 index 0000000..ae5f1e1 --- /dev/null +++ b/clean.sh @@ -0,0 +1,46 @@ +#!/bin/sh + +dryrun=false +while [ $# -gt 0 ]; do + case $1 in + -dryrun|--dryrun|-dry-run|--dry-run) + dryrun=true + ;; + *) + echo "Don't know how to handle arg: $1" + exit 1 + esac + shift +done + +first=true +for f in *.patch; do + if grep -q "^Patch.*[ \t]$f" gdb.spec; then + continue + fi + + if $dryrun; then + if $first; then + echo "Patches not mentioned in gdb.spec:" + fi + first=false + + echo "$f" + + continue + fi + + ( set -x; osc remove -f "$f" ) +done + +files=$(echo ./*~) +if [ "$files" != "./*~" ]; then + if $dryrun; then + echo "Backup files:" + echo "$files" + else + for f in $files; do + ( set -x; rm -f "$f" ) + done + fi +fi diff --git a/fix-gdb.mi-new-ui-mi-sync.exp.patch b/fix-gdb.mi-new-ui-mi-sync.exp.patch new file mode 100644 index 0000000..0043a92 --- /dev/null +++ b/fix-gdb.mi-new-ui-mi-sync.exp.patch @@ -0,0 +1,23 @@ +Fix gdb.mi/new-ui-mi-sync.exp + +--- + gdb/testsuite/gdb.mi/new-ui-mi-sync.exp | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/gdb/testsuite/gdb.mi/new-ui-mi-sync.exp b/gdb/testsuite/gdb.mi/new-ui-mi-sync.exp +index 887bd60abcd..18072d4e668 100644 +--- a/gdb/testsuite/gdb.mi/new-ui-mi-sync.exp ++++ b/gdb/testsuite/gdb.mi/new-ui-mi-sync.exp +@@ -83,7 +83,11 @@ proc do_test {sync_command} { + # in the separate MI UI. Note the "run" variant usually triggers + # =thread-group-started/=thread-created/=library-loaded as well. + with_spawn_id $gdb_main_spawn_id { +- gdb_test "add-inferior" "Added inferior 2 on connection .*" ++ gdb_test_multiple "add-inferior" "" { ++ -re "\r\nAdded inferior 2 on connection .*\[\r\n\]+$gdb_prompt " { ++ pass $gdb_test_name ++ } ++ } + } + + # Interrupt the program. diff --git a/fix-gdb.multi-multi-term-settings.exp-race.patch b/fix-gdb.multi-multi-term-settings.exp-race.patch new file mode 100644 index 0000000..7d5d43e --- /dev/null +++ b/fix-gdb.multi-multi-term-settings.exp-race.patch @@ -0,0 +1,182 @@ +Fix gdb.multi/multi-term-settings.exp race + +The gdb.multi/multi-term-settings.exp testcase sometimes fails like so: + + Running /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.multi/multi-term-settings.exp ... + FAIL: gdb.multi/multi-term-settings.exp: inf1_how=attach: inf2_how=attach: stop with control-c (SIGINT) + +It's easier to reproduce if you stress the machine at the same time, like e.g.: + + $ stress -c 24 + +Looking at gdb.log, we see: + + (gdb) attach 60422 + Attaching to program: build/gdb/testsuite/outputs/gdb.multi/multi-term-settings/multi-term-settings, process 60422 + [New Thread 60422.60422] + Reading symbols from /lib/x86_64-linux-gnu/libc.so.6... + Reading symbols from /usr/lib/debug//lib/x86_64-linux-gnu/libc-2.31.so... + Reading symbols from /lib64/ld-linux-x86-64.so.2... + (No debugging symbols found in /lib64/ld-linux-x86-64.so.2) + 0x00007f2fc2485334 in __GI___clock_nanosleep (clock_id=, clock_id@entry =0, flags=flags@entry =0, req=req@entry =0x7ffe23126940, rem=rem@entry =0x0) at ../sysdeps/unix/sysv/linux/clock_nanosleep.c:78 + 78 ../sysdeps/unix/sysv/linux/clock_nanosleep.c: No such file or directory. + (gdb) PASS: gdb.multi/multi-term-settings.exp: inf1_how=attach: inf2_how=attach: inf2: attach + set schedule-multiple on + (gdb) PASS: gdb.multi/multi-term-settings.exp: inf1_how=attach: inf2_how=attach: set schedule-multiple on + info inferiors + Num Description Connection Executable + 1 process 60404 1 (extended-remote localhost:2349) build/gdb/testsuite/outputs/gdb.multi/multi-term-settings/multi-term-settings + * 2 process 60422 1 (extended-remote localhost:2349) build/gdb/testsuite/outputs/gdb.multi/multi-term-settings/multi-term-settings + (gdb) PASS: gdb.multi/multi-term-settings.exp: inf1_how=attach: inf2_how=attach: info inferiors + pid=60422, count=46 + pid=60422, count=47 + pid=60422, count=48 + pid=60422, count=49 + pid=60422, count=50 + pid=60422, count=51 + pid=60422, count=52 + pid=60422, count=53 + pid=60422, count=54 + pid=60422, count=55 + pid=60422, count=56 + pid=60422, count=57 + pid=60422, count=58 + pid=60422, count=59 + pid=60422, count=60 + pid=60422, count=61 + pid=60422, count=62 + pid=60422, count=63 + pid=60422, count=64 + pid=60422, count=65 + pid=60422, count=66 + pid=60422, count=67 + pid=60422, count=68 + pid=60422, count=69 + pid=60404, count=54 + pid=60404, count=55 + pid=60404, count=56 + pid=60404, count=57 + pid=60404, count=58 + PASS: gdb.multi/multi-term-settings.exp: inf1_how=attach: inf2_how=attach: continue + Quit + (gdb) FAIL: gdb.multi/multi-term-settings.exp: inf1_how=attach: inf2_how=attach: stop with control-c (SIGINT) + +If you look at the testcase's sources, you'll see that the intention +is to resumes the program with "continue", wait to see a few of those +"pid=..., count=..." lines, and then interrupt the program with +Ctrl-C. But somehow, that resulted in GDB printing "Quit", instead of +the Ctrl-C stopping the program with SIGINT. + +Here's what is happening: + + #1 - those "pid=..., count=..." lines we see above weren't actually + output by the inferior after it has been continued (see #1). + Note that "inf1_how" and "inf2_how" are "attach". What happened + is that those "pid=..., count=..." lines were output by the + inferiors _before_ they were attached to. We see them at that + point instead of earlier, because that's where the testcase + reads from the inferiors' spawn_ids. + + #2 - The testcase mistakenly thinks those "pid=..., count=..." lines + happened after the continue was processed by GDB, meaning it has + waited enough, and so sends the Ctrl-C. GDB hasn't yet passed + the terminal to the inferior, so the Ctrl-C results in that + Quit. + +The fix here is twofold: + + #1 - flush inferior output right after attaching + + #2 - consume the "Continuing" printed by "continue", indicating the + inferior has the terminal. This is the same as done throughout + the testsuite to handle this exact problem of sending Ctrl-C too + soon. + +gdb/testsuite/ChangeLog: +yyyy-mm-dd Pedro Alves > + + * gdb.multi/multi-term-settings.exp (create_inferior): Flush + inferior output. + (coretest): Use $gdb_test_name. After issuing "continue", wait + for "Continuing". + +Change-Id: Iba7671dfe1eee6b98d29cfdb05a1b9aa2f9defb9 + +--- + gdb/testsuite/gdb.multi/multi-term-settings.exp | 40 +++++++++++++++++++++---- + 1 file changed, 34 insertions(+), 6 deletions(-) + +diff --git a/gdb/testsuite/gdb.multi/multi-term-settings.exp b/gdb/testsuite/gdb.multi/multi-term-settings.exp +index 20ec03d94b3..dcc6f2ece0f 100644 +--- a/gdb/testsuite/gdb.multi/multi-term-settings.exp ++++ b/gdb/testsuite/gdb.multi/multi-term-settings.exp +@@ -95,6 +95,22 @@ proc create_inferior {which_inf inf_how} { + if {[gdb_test "attach $testpid" \ + "Attaching to program: .*, process $testpid.*(in|at).*" \ + "attach"] == 0} { ++ ++ # The program is now stopped, but if testing against ++ # gdbserver, then the inferior's output emmitted before it ++ # stopped isn't flushed unless we explicitly do so, ++ # because it is on a different spawn_id. Do it now, to ++ # avoid confusing tests further below. ++ gdb_test_multiple "" "flush inferior output" { ++ -timeout 1 ++ -i $test_spawn_id -re "pid=" { ++ exp_continue ++ } ++ timeout { ++ pass $gdb_test_name ++ } ++ } ++ + return $test_spawn_id + } + } else { +@@ -179,9 +195,9 @@ proc coretest {inf1_how inf2_how} { + uplevel 1 { + if {$count1 >= 3 && $count2 >= 3} { + if $expect_ttou { +- fail "$test (expected SIGTTOU)" ++ fail "$gdb_test_name (expected SIGTTOU)" + } else { +- pass $test ++ pass $gdb_test_name + } + } else { + exp_continue +@@ -195,8 +211,20 @@ proc coretest {inf1_how inf2_how} { + set count1 0 + set count2 0 + +- set test "continue" +- gdb_test_multiple $test $test { ++ # We're going to interrupt with Ctrl-C. For this to work we must ++ # be sure to consume the "Continuing." message first, or GDB may ++ # still own the terminal. Also, note that in the attach case, we ++ # flushed inferior output right after attaching, so that we're ++ # sure that the "pid=" lines we see are emitted by the inferior ++ # after it is continued, instead of having been emitted before it ++ # was attached to. ++ gdb_test_multiple "continue" "continue, hand over terminal" { ++ -re "Continuing" { ++ pass $gdb_test_name ++ } ++ } ++ ++ gdb_test_multiple "" "continue" { + -i $infs_spawn_ids -re "pid=$pid1, count=" { + incr count1 + pass_or_exp_continue +@@ -207,9 +235,9 @@ proc coretest {inf1_how inf2_how} { + } + -i $gdb_spawn_id -re "received signal SIGTTOU.*$gdb_prompt " { + if $expect_ttou { +- pass "$test (expected SIGTTOU)" ++ pass "$gdb_test_name (expected SIGTTOU)" + } else { +- fail "$test (SIGTTOU)" ++ fail "$gdb_test_name (SIGTTOU)" + } + } + } diff --git a/fixup-2-gdb-6.6-buildid-locate.patch b/fixup-2-gdb-6.6-buildid-locate.patch new file mode 100644 index 0000000..f42561c --- /dev/null +++ b/fixup-2-gdb-6.6-buildid-locate.patch @@ -0,0 +1,20 @@ +fixup-2-gdb-6.6-buildid-locate.patch + +--- + gdb/testsuite/lib/gdb.exp | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp +index e2ce31cc553..2b94f79d132 100644 +--- a/gdb/testsuite/lib/gdb.exp ++++ b/gdb/testsuite/lib/gdb.exp +@@ -131,7 +131,8 @@ if ![info exists INTERNAL_GDBFLAGS] { + "-nx" \ + "-data-directory $BUILD_DATA_DIRECTORY" \ + {-iex "set height 0"} \ +- {-iex "set width 0"}]] ++ {-iex "set width 0"} \ ++ {-iex "set build-id-verbose 0"}]] + } + + # The variable gdb_prompt is a regexp which matches the gdb prompt. diff --git a/fixup-2-gdb-archer-vla-tests.patch b/fixup-2-gdb-archer-vla-tests.patch deleted file mode 100644 index 8fd6a69..0000000 --- a/fixup-2-gdb-archer-vla-tests.patch +++ /dev/null @@ -1,41 +0,0 @@ -fixup-2-gdb-archer-vla-tests - -Fixup gdb-archer-vla-tests.patch - ---- - gdb/testsuite/gdb.opt/fortran-string.exp | 11 +++++++++-- - gdb/testsuite/gdb.opt/fortran-string.f90 | 1 + - 2 files changed, 10 insertions(+), 2 deletions(-) - -diff --git a/gdb/testsuite/gdb.opt/fortran-string.exp b/gdb/testsuite/gdb.opt/fortran-string.exp -index 90a2bdf..5255424 100644 ---- a/gdb/testsuite/gdb.opt/fortran-string.exp -+++ b/gdb/testsuite/gdb.opt/fortran-string.exp -@@ -34,6 +34,13 @@ if ![runto $srcfile:[gdb_get_line_number "s = s"]] then { - continue - } - --gdb_test "frame" ".*s='foo'.*" --gdb_test "ptype s" "type = character\\*3" -+gdb_test "info args" ".*s = 'foo'.*" -+gdb_test_multiple "ptype s" "" { -+ -re -wrap "type = character \\(3\\)" { -+ pass $gdb_test_name -+ } -+ -re -wrap "type = character\\*3" { -+ pass $gdb_test_name -+ } -+} - gdb_test "p s" "\\$\[0-9\]* = 'foo'" -diff --git a/gdb/testsuite/gdb.opt/fortran-string.f90 b/gdb/testsuite/gdb.opt/fortran-string.f90 -index e48d520..e3bb6ad 100644 ---- a/gdb/testsuite/gdb.opt/fortran-string.f90 -+++ b/gdb/testsuite/gdb.opt/fortran-string.f90 -@@ -21,6 +21,7 @@ - subroutine f(s) - character*(*) s - s = s -+ print *, s - end - - program main diff --git a/fixup-2-gdb-rhbz1156192-recursive-dlopen-test.patch b/fixup-2-gdb-rhbz1156192-recursive-dlopen-test.patch deleted file mode 100644 index a3eae90..0000000 --- a/fixup-2-gdb-rhbz1156192-recursive-dlopen-test.patch +++ /dev/null @@ -1,51 +0,0 @@ -Fixup gdb-rhbz1156192-recursive-dlopen-test.patch - -- Fix __malloc_check usage to fix "free: invalid pointer" error with - GLIBC_TUNABLES=glibc.malloc.check=3. -- Handle older libc, for which we run into glibc PR17702: - Inconsistency detected by ld.so: dl-open.c: 222: dl_open_worker: Assertion \ - `_dl_debug_initialize (0, args->nsid)->r_state == RT_CONSISTENT' failed! - ---- - gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.c | 1 + - .../gdb.base/gdb-rhbz1156192-recursive-dlopen.exp | 15 +++++++++++++++ - 2 files changed, 16 insertions(+) - -diff --git a/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.c b/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.c -index 17b29904ef..7696666c16 100644 ---- a/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.c -+++ b/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.c -@@ -94,6 +94,7 @@ custom_malloc_hook (size_t size, const void *caller) - /* Called recursively. */ - result = malloc (size); - /* Restore new hooks. */ -+ old_malloc_hook = __malloc_hook; - __malloc_hook = custom_malloc_hook; - return result; - } -diff --git a/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.exp b/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.exp -index 6e4d3621a3..28e6e465ee 100644 ---- a/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.exp -+++ b/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.exp -@@ -49,6 +49,21 @@ if { [prepare_for_testing ${testfile}.exp ${executable} ${srcfile} \ - return -1 - } - -+set supported 0 -+gdb_test_multiple "run" "initial trial run" { -+ -re -wrap "exited normally.*" { -+ set supported 1 -+ pass $gdb_test_name -+ } -+ -re -wrap "exited with code.*" { -+ untested "failed at $gdb_test_name" -+ } -+} -+ -+if { $supported == 0 } { -+ return -1 -+} -+ - proc do_test { has_libfoo has_libbar } { - global hex binfile_lib2 binfile_lib1 gdb_prompt - set libbar_match "[string_to_regexp $binfile_lib2]" diff --git a/fixup-3-gdb-archer-vla-tests.patch b/fixup-3-gdb-archer-vla-tests.patch deleted file mode 100644 index f2c91a4..0000000 --- a/fixup-3-gdb-archer-vla-tests.patch +++ /dev/null @@ -1,24 +0,0 @@ -diff --git a/gdb/testsuite/gdb.cp/gdb9593.exp b/gdb/testsuite/gdb.cp/gdb9593.exp -index ef404244028..70afbcc3bc9 100644 ---- a/gdb/testsuite/gdb.cp/gdb9593.exp -+++ b/gdb/testsuite/gdb.cp/gdb9593.exp -@@ -141,9 +141,16 @@ gdb_test "step" \ - ".*function1 ().*" \ - "step into finish, for until" - --gdb_test "until" \ -- ".*function1 ().*" \ -- "until with no argument 1" -+gdb_test_multiple "until" "until with no argument 1" { -+ -re -wrap ".*function1 ().*" { -+ pass $gdb_test_name -+ } -+ -re -wrap ".*$hex\t80\t \}" { -+ # PR gcc/97774 - "Incorrect line info for try/catch" -+ # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97774 -+ xfail $gdb_test_name -+ } -+} - - set line [gdb_get_line_number "marker for until" $testfile.cc] - diff --git a/fixup-gdb-6.3-test-pie-20050107.patch b/fixup-gdb-6.3-test-pie-20050107.patch deleted file mode 100644 index fd6e021..0000000 --- a/fixup-gdb-6.3-test-pie-20050107.patch +++ /dev/null @@ -1,90 +0,0 @@ -fixup-gdb-6.3-test-pie-20050107.patch - ---- - gdb/testsuite/gdb.pie/attach.exp | 4 ++-- - gdb/testsuite/gdb.pie/break.exp | 2 +- - gdb/testsuite/gdb.pie/corefile.exp | 15 +++++++-------- - 3 files changed, 10 insertions(+), 11 deletions(-) - -diff --git a/gdb/testsuite/gdb.pie/attach.exp b/gdb/testsuite/gdb.pie/attach.exp -index 648c92608c3..2af242618de 100644 ---- a/gdb/testsuite/gdb.pie/attach.exp -+++ b/gdb/testsuite/gdb.pie/attach.exp -@@ -148,13 +148,13 @@ proc do_attach_tests {} { - -re "Load new symbol table from.*y or n.*$" { - send_gdb "y\n" - gdb_expect { -- -re "Reading symbols from $escapedbinfile\.\.\.*done.*$gdb_prompt $"\ -+ -re "Reading symbols from $escapedbinfile\.\.\.*$gdb_prompt $"\ - {pass "(re)set file, before attach1"} - -re "$gdb_prompt $" {fail "(re)set file, before attach1"} - timeout {fail "(timeout) (re)set file, before attach1"} - } - } -- -re "Reading symbols from $escapedbinfile\.\.\.*done.*$gdb_prompt $"\ -+ -re "Reading symbols from $escapedbinfile\.\.\.*$gdb_prompt $"\ - {pass "set file, before attach1"} - -re "$gdb_prompt $" {fail "set file, before attach1"} - timeout {fail "(timeout) set file, before attach1"} -diff --git a/gdb/testsuite/gdb.pie/break.exp b/gdb/testsuite/gdb.pie/break.exp -index 97b87397c27..3e07d6a8b31 100644 ---- a/gdb/testsuite/gdb.pie/break.exp -+++ b/gdb/testsuite/gdb.pie/break.exp -@@ -319,7 +319,7 @@ if ![runto_main] then { fail "break tests suppressed" } - - send_gdb "catch\n" - gdb_expect { -- -re "Catch requires an event name.*$gdb_prompt $"\ -+ -re "List of catch subcommands:.*$gdb_prompt $"\ - {pass "catch requires an event name"} - -re "$gdb_prompt $"\ - {fail "catch requires an event name"} -diff --git a/gdb/testsuite/gdb.pie/corefile.exp b/gdb/testsuite/gdb.pie/corefile.exp -index ca4b01be3eb..2194ccc926c 100644 ---- a/gdb/testsuite/gdb.pie/corefile.exp -+++ b/gdb/testsuite/gdb.pie/corefile.exp -@@ -83,11 +83,10 @@ if { $found == 0 } { - } - } - --# Try to clean up after ourselves. --remote_file build delete [file join $coredir coremmap.data] --remote_exec build "rmdir $coredir" -- - if { $found == 0 } { -+ # Try to clean up after ourselves. -+ remote_file build delete [file join $coredir coremmap.data] -+ remote_exec build "rmdir $coredir" - warning "can't generate a core file - core tests suppressed - check ulimit -c" - return 0 - } -@@ -110,13 +109,13 @@ if { $found == 0 } { - - gdb_exit - if $verbose>1 then { -- send_user "Spawning $GDB -nw $GDBFLAGS -core=[standard_output_file corefile]\n" -+ send_user "Spawning $GDB -nw $INTERNAL_GDBFLAGS $GDBFLAGS -core=[standard_output_file corefile]\n" - } - - set oldtimeout $timeout - set timeout [expr "$timeout + 60"] - verbose "Timeout is now $timeout seconds" 2 --eval "spawn $GDB -nw $GDBFLAGS -core=[standard_output_file corefile]" -+eval "spawn $GDB -nw $INTERNAL_GDBFLAGS $GDBFLAGS -core=[standard_output_file corefile]" - expect { - -re "Couldn't find .* registers in core file.*$gdb_prompt $" { - fail "args: -core=corefile (couldn't find regs)" -@@ -143,11 +142,11 @@ expect { - close; - - if $verbose>1 then { -- send_user "Spawning $GDB -nw $GDBFLAGS $binfile -core=[standard_output_file corefile]\n" -+ send_user "Spawning $GDB -nw $INTERNAL_GDBFLAGS $GDBFLAGS $binfile -core=[standard_output_file corefile]\n" - } - - --eval "spawn $GDB -nw $GDBFLAGS $binfile -core=[standard_output_file corefile]"; -+eval "spawn $GDB -nw $INTERNAL_GDBFLAGS $GDBFLAGS $binfile -core=[standard_output_file corefile]"; - expect { - -re "Core was generated by .*coremaker.*\r\n\#0 .*\(\).*\r\n$gdb_prompt $" { - pass "args: execfile -core=corefile" diff --git a/fixup-gdb-6.3-threaded-watchpoints2-20050225.patch b/fixup-gdb-6.3-threaded-watchpoints2-20050225.patch deleted file mode 100644 index dc1f097..0000000 --- a/fixup-gdb-6.3-threaded-watchpoints2-20050225.patch +++ /dev/null @@ -1,22 +0,0 @@ -Fixup - ---- - gdb/testsuite/gdb.threads/watchthreads-threaded.exp | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/gdb/testsuite/gdb.threads/watchthreads-threaded.exp b/gdb/testsuite/gdb.threads/watchthreads-threaded.exp -index e9cdd59771c..29c470292af 100644 ---- a/gdb/testsuite/gdb.threads/watchthreads-threaded.exp -+++ b/gdb/testsuite/gdb.threads/watchthreads-threaded.exp -@@ -85,9 +85,9 @@ for {set i 0} {$i < 30} {incr i} { - { set args_2 1; set test_flag 1 } - -re "Hardware watchpoint 4: args\\\[3\\\].*Old value = 0.*New value = 1.*main \\\(\\\) at .*watchthreads-threaded.c:$init_line.*$gdb_prompt $" - { set args_3 1; set test_flag 1 } -- -re "Hardware watchpoint 3: args\\\[2\\\].*Old value = $args_2.*New value = [expr $args_2+1].*in thread_function \\\(arg=0x2\\\) at .*watchthreads-threaded.c:$inc_line.*$gdb_prompt $" -+ -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].*in thread_function \\\(arg=0x3\\\) at .*watchthreads-threaded.c:$inc_line.*$gdb_prompt $" -+ -re "Hardware watchpoint 4: args\\\[3\\\].*Old value = $args_3.*New value = [expr $args_3+1].*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 diff --git a/fixup-gdb-6.5-sharedlibrary-path.patch b/fixup-gdb-6.5-sharedlibrary-path.patch deleted file mode 100644 index 9a32fed..0000000 --- a/fixup-gdb-6.5-sharedlibrary-path.patch +++ /dev/null @@ -1,41 +0,0 @@ -[gdb/testsuite] Fixup gdb.threads/tls-sepdebug.exp - -On factory, due to --as-needed we end up with a tls-sepdebug-main without -dependency on tls-sepdebug-shared.so: -... -$ ldd tls-sepdebug-main - linux-vdso.so.1 (0x00007fffe7fcf000) - libc.so.6 => /lib64/libc.so.6 (0x00007f205f05f000) - /lib64/ld-linux-x86-64.so.2 (0x00007f205f232000) -... - -Fix this by actually using the variable var (defined in -tls-sepdebug-shared.so) in tls-sepdebug-main. - -Likewise, we end up without a dependency on libpthread.so.0, which we need to -read tls vars. Add a call to pthread_testcancel, as in -gdb.threads/tls-var-main.c - ---- - gdb/testsuite/gdb.threads/tls-sepdebug-main.c | 8 +++++++- - 1 file changed, 7 insertions(+), 1 deletion(-) - -diff --git a/gdb/testsuite/gdb.threads/tls-sepdebug-main.c b/gdb/testsuite/gdb.threads/tls-sepdebug-main.c -index ea5d0174d6a..87803f6d27e 100644 ---- a/gdb/testsuite/gdb.threads/tls-sepdebug-main.c -+++ b/gdb/testsuite/gdb.threads/tls-sepdebug-main.c -@@ -19,7 +19,13 @@ - 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() - { -- return 0; -+ /* Ensure we link against pthreads even with --as-needed. */ -+ pthread_testcancel(); -+ return var; - } diff --git a/fixup-gdb-6.6-buildid-locate.patch b/fixup-gdb-6.6-buildid-locate.patch index bc30447..3627111 100644 --- a/fixup-gdb-6.6-buildid-locate.patch +++ b/fixup-gdb-6.6-buildid-locate.patch @@ -1,20 +1,23 @@ -[gdb/testsuite] Fixup buildid-locate +fixup-gdb-6.6-buildid-locate.patch --- - gdb/testsuite/gdb.base/gdbinit-history.exp | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) + gdb/build-id.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) -diff --git a/gdb/testsuite/gdb.base/gdbinit-history.exp b/gdb/testsuite/gdb.base/gdbinit-history.exp -index baa1b49153..1e9eabbb73 100644 ---- a/gdb/testsuite/gdb.base/gdbinit-history.exp -+++ b/gdb/testsuite/gdb.base/gdbinit-history.exp -@@ -181,7 +181,8 @@ proc test_empty_history_filename { } { - global env - global gdb_prompt +diff --git a/gdb/build-id.c b/gdb/build-id.c +index 830098688d5..a1920ab5a09 100644 +--- a/gdb/build-id.c ++++ b/gdb/build-id.c +@@ -1314,10 +1314,10 @@ find_separate_debug_file_by_buildid (struct objfile *objfile, + return std::string (); + } -- set common_history [list "set height 0" "set width 0"] -+ set common_history [list "set height 0" "set width 0" \ -+ "set build-id-verbose 0"] +-extern void _initialize_build_id (void); ++void _initialize_build_id (); - set test_dir [standard_output_file history_test] - remote_exec host "mkdir -p $test_dir" + void +-_initialize_build_id (void) ++_initialize_build_id () + { + add_setshow_zinteger_cmd ("build-id-verbose", no_class, &build_id_verbose, + _("\ diff --git a/fixup-gdb-6.8-bz442765-threaded-exec-test.patch b/fixup-gdb-6.8-bz442765-threaded-exec-test.patch deleted file mode 100644 index 71abb17..0000000 --- a/fixup-gdb-6.8-bz442765-threaded-exec-test.patch +++ /dev/null @@ -1,19 +0,0 @@ -Fixup gdb-6.8-bz442765-threaded-exec-test.patch - ---- - gdb/testsuite/gdb.threads/threaded-exec.exp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/gdb/testsuite/gdb.threads/threaded-exec.exp b/gdb/testsuite/gdb.threads/threaded-exec.exp -index 8c43162b36e..23f6339d8ff 100644 ---- a/gdb/testsuite/gdb.threads/threaded-exec.exp -+++ b/gdb/testsuite/gdb.threads/threaded-exec.exp -@@ -37,7 +37,7 @@ gdb_reinitialize_dir $srcdir/$subdir - - gdb_load ${binfile_nothreads} - --gdb_run_cmd ${binfile_nothreads} ${binfile_threads} 0 -+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/fixup-gdb-archer-vla-tests.patch b/fixup-gdb-archer-vla-tests.patch deleted file mode 100644 index 6eefe62..0000000 --- a/fixup-gdb-archer-vla-tests.patch +++ /dev/null @@ -1,26 +0,0 @@ -Fixup gdb-archer-vla-tests.patch - ---- - gdb/testsuite/gdb.pascal/arrays.exp | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/gdb/testsuite/gdb.pascal/arrays.exp b/gdb/testsuite/gdb.pascal/arrays.exp -index 22acdb86d87..6a176732599 100644 ---- a/gdb/testsuite/gdb.pascal/arrays.exp -+++ b/gdb/testsuite/gdb.pascal/arrays.exp -@@ -89,11 +89,15 @@ gdb_test "print s" ".* = 'test'#0'string'" "Print string containing null-char" - - if { $fpc_generates_dwarf_for_dynamic_arrays == 0} { - setup_xfail "*-*-*" -+} else { -+ setup_kfail "*-*-*" pascal/26106 - } - gdb_test "print DynArrStr" ".* = \\{'dstr0', 'dstr1', 'dstr2', 'dstr3', 'dstr4', 'dstr5', 'dstr6', 'dstr7', 'dstr8', 'dstr9', 'dstr10', 'dstr11', 'dstr12'\\}" "Print dynamic array of string" - - if { $fpc_generates_dwarf_for_dynamic_arrays == 0} { - setup_xfail "*-*-*" -+} else { -+ setup_kfail "*-*-*" pascal/26855 - } - gdb_test "print StatArrStr" ".* = \\{'str0', 'str1', 'str2', 'str3', 'str4', 'str5', 'str6', 'str7', 'str8', 'str9', 'str10', 'str11', 'str12'\\}" "Print static array of string" - diff --git a/fixup-gdb-base-gnu-ifunc-strstr-workaround-exp.patch b/fixup-gdb-base-gnu-ifunc-strstr-workaround-exp.patch deleted file mode 100644 index 65de533..0000000 --- a/fixup-gdb-base-gnu-ifunc-strstr-workaround-exp.patch +++ /dev/null @@ -1,29 +0,0 @@ -Fixup gdb.base/gnu-ifunc-strstr-workaround.exp - ---- - gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp | 8 ++++++-- - 1 file changed, 6 insertions(+), 2 deletions(-) - -diff --git a/gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp b/gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp -index 4aa710b914..889f8c6f58 100644 ---- a/gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp -+++ b/gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp -@@ -43,6 +43,10 @@ gdb_test_multiple $test $test { - untested "$test (no DWARF)" - return 0 - } -+ -re "type = \\(\\)\r\n$gdb_prompt $" { -+ untested "$test (no DWARF)" -+ return 0 -+ } - } - - set addr "" -@@ -111,5 +115,5 @@ gdb_test_multiple "print strstr" $test { - } - } - --gdb_test {print strstr("abc","b")} { = 0x[0-9a-f]+ "bc"} --gdb_test {print strstr("def","e")} { = 0x[0-9a-f]+ "ef"} -+gdb_test {print (char *)strstr("abc","b")} { = 0x[0-9a-f]+ "bc"} -+gdb_test {print (char *)strstr("def","e")} { = 0x[0-9a-f]+ "ef"} diff --git a/fixup-gdb-btrobust.patch b/fixup-gdb-btrobust.patch deleted file mode 100644 index ca596ac..0000000 --- a/fixup-gdb-btrobust.patch +++ /dev/null @@ -1,28 +0,0 @@ -diff --git a/gdb/testsuite/gdb.python/py-framefilter.exp b/gdb/testsuite/gdb.python/py-framefilter.exp -index 300a5be840d..68cb7d8d7e7 100644 ---- a/gdb/testsuite/gdb.python/py-framefilter.exp -+++ b/gdb/testsuite/gdb.python/py-framefilter.exp -@@ -277,9 +277,20 @@ gdb_test_multiple "bt 1" $test { - # Now verify that we can see a quit. - gdb_test_no_output "python name_error = KeyboardInterrupt" \ - "Change ErrorFilter to throw KeyboardInterrupt" --gdb_test "bt 1" "Quit" "bt 1 with KeyboardInterrupt" -- -- -+set re1 [multi_line \ -+ "Python Exception whoops: " \ -+ "\\(More stack frames follow\.\.\.\\)"] -+set re2 [multi_line \ -+ "Python Exception whoops: " \ -+ "\\(More stack frames follow\.\.\.\\)"] -+gdb_test_multiple "bt 1" "" { -+ -re -wrap $re1 { -+ pass $gdb_test_name -+ } -+ -re -wrap $re2 { -+ pass $gdb_test_name -+ } -+} - # Test with no debuginfo - - # We cannot use prepare_for_testing as we have to set the safe-patch diff --git a/fixup-gdb-bz634108-solib_address.patch b/fixup-gdb-bz634108-solib_address.patch deleted file mode 100644 index 0d5c344..0000000 --- a/fixup-gdb-bz634108-solib_address.patch +++ /dev/null @@ -1,16 +0,0 @@ -Fixup gdb-bz634108-solib_address.patch - ---- - gdb/testsuite/gdb.python/rh634108-solib_address.exp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/gdb/testsuite/gdb.python/rh634108-solib_address.exp b/gdb/testsuite/gdb.python/rh634108-solib_address.exp -index c0451cf09ed..99e6aaba831 100644 ---- a/gdb/testsuite/gdb.python/rh634108-solib_address.exp -+++ b/gdb/testsuite/gdb.python/rh634108-solib_address.exp -@@ -21,4 +21,4 @@ gdb_start - # Skip all tests if Python scripting is not enabled. - if { [skip_python_tests] } { continue } - --gdb_test "python print gdb.solib_name(-1)" "None" "gdb.solib_name exists" -+gdb_test "python print (gdb.solib_name(-1))" "None" "gdb.solib_name exists" diff --git a/fixup-gdb-dts-rhel6-python-compat.patch b/fixup-gdb-dts-rhel6-python-compat.patch deleted file mode 100644 index 2e32abc..0000000 --- a/fixup-gdb-dts-rhel6-python-compat.patch +++ /dev/null @@ -1,49 +0,0 @@ -Fixup gdb-dts-rhel6-python-compat.patch - ---- - gdb/python/lib/gdb/command/backtrace.py | 12 +++++++++--- - gdb/testsuite/gdb.base/help.exp | 4 +++- - 2 files changed, 12 insertions(+), 4 deletions(-) - -diff --git a/gdb/python/lib/gdb/command/backtrace.py b/gdb/python/lib/gdb/command/backtrace.py -index eeea9093e8..5059b6518a 100644 ---- a/gdb/python/lib/gdb/command/backtrace.py -+++ b/gdb/python/lib/gdb/command/backtrace.py -@@ -81,13 +81,19 @@ Use of the 'raw' qualifier avoids any filtering by loadable modules. - # FIXME: provide option to start at selected frame - # However, should still number as if starting from newest - newest_frame = gdb.newest_frame() -- iter = itertools.imap (FrameWrapper, -- FrameIterator (newest_frame)) -+ if sys.version_info.major >= 3: -+ iter = map (FrameWrapper, FrameIterator (newest_frame)) -+ else: -+ iter = itertools.imap (FrameWrapper, -+ FrameIterator (newest_frame)) - if filter: - iter = gdb.backtrace.create_frame_filter (iter) - - # Now wrap in an iterator that numbers the frames. -- iter = itertools.izip (itertools.count (0), iter) -+ if sys.version_info.major >= 3: -+ iter = zip (itertools.count (0), iter) -+ else: -+ iter = itertools.izip (itertools.count (0), iter) - - # Reverse if the user wanted that. - if self.reverse.value: -diff --git a/gdb/testsuite/gdb.base/help.exp b/gdb/testsuite/gdb.base/help.exp -index 0b6893cf79..af5fb232ce 100644 ---- a/gdb/testsuite/gdb.base/help.exp -+++ b/gdb/testsuite/gdb.base/help.exp -@@ -129,7 +129,9 @@ gdb_test "apropos apropos" "apropos -- Search for commands matching a REGEXP.*" - - # Test apropos for commands having aliases. - gdb_test "apropos Print backtrace of all stack frames, or innermost COUNT frames\." \ -- "backtrace, where, bt -- Print backtrace of all stack frames, or innermost COUNT frames\." -+ [multi_line \ -+ "backtrace, where, bt -- Print backtrace of all stack frames, or innermost COUNT frames\." \ -+ "new-backtrace -- Print backtrace of all stack frames, or innermost COUNT frames\."] - - # Test help for commands having aliases. - gdb_test "help bt" "backtrace, where, bt\[\r\n\]+Print backtrace of all stack frames, or innermost COUNT frames\..*" diff --git a/fixup-gdb-glibc-strstr-workaround.patch b/fixup-gdb-glibc-strstr-workaround.patch new file mode 100644 index 0000000..b0037e0 --- /dev/null +++ b/fixup-gdb-glibc-strstr-workaround.patch @@ -0,0 +1,19 @@ +fixup-gdb-glibc-strstr-workaround.patch + +--- + gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp b/gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp +index 889f8c6f584..052bd84d420 100644 +--- a/gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp ++++ b/gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp +@@ -68,7 +68,7 @@ gdb_test_multiple $test $test { + set addr $expect_out(1,string) + pass "$test (fixed glibc)" + } +- -re " = {char \\*\\(const char \\*, const char \\*\\)} 0x\[0-9a-f\]+ \r\n$gdb_prompt $" { ++ -re " = {char \\*\\(const char \\*, const char \\*\\)} 0x\[0-9a-f\]+ <(__GI_)?strstr>\r\n$gdb_prompt $" { + untested "$test (gnu-ifunc not in use by glibc)" + return 0 + } diff --git a/fixup-gdb-gnat-dwarf-crash-3of3.patch b/fixup-gdb-gnat-dwarf-crash-3of3.patch deleted file mode 100644 index d48b4e1..0000000 --- a/fixup-gdb-gnat-dwarf-crash-3of3.patch +++ /dev/null @@ -1,51 +0,0 @@ -Fixup gdb-gnat-dwarf-crash-3of3.patch - ---- - gdb/testsuite/gdb.threads/attach-stopped.exp | 20 ++++++++++++++------ - 1 file changed, 14 insertions(+), 6 deletions(-) - -diff --git a/gdb/testsuite/gdb.threads/attach-stopped.exp b/gdb/testsuite/gdb.threads/attach-stopped.exp -index 7c06d849b14..097e8b2a683 100644 ---- a/gdb/testsuite/gdb.threads/attach-stopped.exp -+++ b/gdb/testsuite/gdb.threads/attach-stopped.exp -@@ -63,10 +63,10 @@ proc corefunc { threadtype } { - set test "$threadtype: set file, before attach1 to stopped process" - gdb_test_multiple "file $binfile" "$test" { - -re "Load new symbol table from.*y or n. $" { -- gdb_test "y" "Reading symbols from $escapedbinfile\.\.\.*done." \ -+ gdb_test "y" "Reading symbols from $escapedbinfile\.\.\.*" \ - "$test (re-read)" - } -- -re "Reading symbols from $escapedbinfile\.\.\.*done.*$gdb_prompt $" { -+ -re "Reading symbols from $escapedbinfile\.\.\.*$gdb_prompt $" { - pass "$test" - } - } -@@ -93,15 +93,23 @@ proc corefunc { threadtype } { - sleep 2 - - if [catch {open /proc/${testpid}/status r} fileid] { -- set line2 "NOTFOUND" -+ set line "NOTFOUND" - } else { -- gets $fileid line1; -- gets $fileid line2; -+ while { 1 } { -+ if { [gets $fileid line] < 0 } { -+ set line "EOF" -+ break -+ } -+ if {[string match "State:*" $line]} { -+ break -+ } -+ } - close $fileid; - } - - set test "$threadtype: attach1, exit leaves process stopped" -- if {[string match "*(stopped)*" $line2]} { -+ verbose -log "line: $line" -+ if {[string match "*(stopped)*" $line]} { - pass $test - } else { - fail $test diff --git a/fixup-gdb-linux_perf-bundle.patch b/fixup-gdb-linux_perf-bundle.patch new file mode 100644 index 0000000..ecb91c2 --- /dev/null +++ b/fixup-gdb-linux_perf-bundle.patch @@ -0,0 +1,24 @@ +diff --git a/gdb/gdb.c b/gdb/gdb.c +index 82e9e6da210..b5e28445630 100644 +--- a/gdb/gdb.c ++++ b/gdb/gdb.c +@@ -20,19 +20,11 @@ + #include "main.h" + #include "interps.h" + +-#ifdef PERF_ATTR_SIZE_VER5_BUNDLE +-extern "C" void __libipt_init(void); +-#endif +- + int + main (int argc, char **argv) + { + struct captured_main_args args; + +-#ifdef PERF_ATTR_SIZE_VER5_BUNDLE +- __libipt_init(); +-#endif +- + memset (&args, 0, sizeof args); + args.argc = argc; + args.argv = argv; diff --git a/fixup-gdb-rhbz1156192-recursive-dlopen-test.patch b/fixup-gdb-rhbz1156192-recursive-dlopen-test.patch deleted file mode 100644 index a953308..0000000 --- a/fixup-gdb-rhbz1156192-recursive-dlopen-test.patch +++ /dev/null @@ -1,18 +0,0 @@ -Fixup gdb-rhbz1156192-recursive-dlopen-test.patch - ---- - gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.exp | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.exp b/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.exp -index 2c32676e504..6e4d3621a3e 100644 ---- a/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.exp -+++ b/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.exp -@@ -101,6 +101,7 @@ proc test_stop_on_solib_events { } { - gdb_test_no_output "set stop-on-solib-events 1" "setting stop-on-solib-events" - - gdb_run_cmd -+ gdb_test "" "Wait for first prompt" - foreach l $solib_event_order { - incr pass - with_test_prefix "pass #$pass" { diff --git a/fixup-gdb-rhbz1325795-framefilters-test.patch b/fixup-gdb-rhbz1325795-framefilters-test.patch new file mode 100644 index 0000000..5ce78c7 --- /dev/null +++ b/fixup-gdb-rhbz1325795-framefilters-test.patch @@ -0,0 +1,19 @@ +fixup-gdb-rhbz1325795-framefilters-test.patch + +--- + gdb/testsuite/gdb.python/py-framefilter-thread.exp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/gdb/testsuite/gdb.python/py-framefilter-thread.exp b/gdb/testsuite/gdb.python/py-framefilter-thread.exp +index 71f97463372..156a4d7bbf3 100644 +--- a/gdb/testsuite/gdb.python/py-framefilter-thread.exp ++++ b/gdb/testsuite/gdb.python/py-framefilter-thread.exp +@@ -39,7 +39,7 @@ 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" ++gdb_test "bt no-filters" " in (\\.?_*clone3?|thread_start) \[^\r\n\]*" "bt no-filters" + + # #2 0x00007ffff75f228d in 941595343737041 () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:113^M + # vs. diff --git a/fixup-gdb-rhbz1553104-s390x-arch12-test.patch b/fixup-gdb-rhbz1553104-s390x-arch12-test.patch new file mode 100644 index 0000000..68d2d0d --- /dev/null +++ b/fixup-gdb-rhbz1553104-s390x-arch12-test.patch @@ -0,0 +1,19 @@ +fixup-gdb-rhbz1553104-s390x-arch12-test.patch + +--- + gdb/testsuite/gdb.arch/s390x-arch12.exp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/gdb/testsuite/gdb.arch/s390x-arch12.exp b/gdb/testsuite/gdb.arch/s390x-arch12.exp +index 4e902ff960d..246c1e1c69a 100644 +--- a/gdb/testsuite/gdb.arch/s390x-arch12.exp ++++ b/gdb/testsuite/gdb.arch/s390x-arch12.exp +@@ -20,7 +20,7 @@ + + set testfile "s390x-arch12" + set uufile "${srcdir}/${subdir}/${testfile}.o.uu" +-set ofile "${srcdir}/${subdir}/${testfile}.o" ++set ofile [standard_output_file ${testfile}.o] + + if { [catch "system \"uudecode -o ${ofile} ${uufile}\"" ] != 0 } { + untested "failed uudecode" diff --git a/fixup-gdb-test-ivy-bridge.patch b/fixup-gdb-test-ivy-bridge.patch deleted file mode 100644 index c773dea..0000000 --- a/fixup-gdb-test-ivy-bridge.patch +++ /dev/null @@ -1,19 +0,0 @@ -Fix gdb-test-ivy-bridge.patch - ---- - gdb/testsuite/gdb.arch/amd64-ivy-bridge.exp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/gdb/testsuite/gdb.arch/amd64-ivy-bridge.exp b/gdb/testsuite/gdb.arch/amd64-ivy-bridge.exp -index d1b1f27db4..ee4b8d4162 100644 ---- a/gdb/testsuite/gdb.arch/amd64-ivy-bridge.exp -+++ b/gdb/testsuite/gdb.arch/amd64-ivy-bridge.exp -@@ -20,7 +20,7 @@ if {![istarget "x86_64-*-*"]} then { - set testfile amd64-ivy-bridge - set test compilation - if [prepare_for_testing ${testfile}.exp ${testfile}.x ${testfile}.S [list debug "additional_flags=-m64 -nostdlib"]] { -- fail $test -+ unsupported $test - return -1 - } - pass $test diff --git a/fixup-gdb-vla-intel-fortran-vla-strings.patch b/fixup-gdb-vla-intel-fortran-vla-strings.patch deleted file mode 100644 index e6b2edd..0000000 --- a/fixup-gdb-vla-intel-fortran-vla-strings.patch +++ /dev/null @@ -1,340 +0,0 @@ -fixup gdb-vla-intel-fortran-vla-strings.patch - ---- - gdb/f-typeprint.c | 2 +- - gdb/testsuite/gdb.dwarf2/dynarr-ptr.exp | 4 +-- - gdb/testsuite/gdb.fortran/mixed-lang-stack.exp | 5 +++ - gdb/testsuite/gdb.fortran/pointer-to-pointer.exp | 6 +++- - gdb/testsuite/gdb.fortran/pointers.exp | 42 ++++++++++++------------ - gdb/testsuite/gdb.fortran/print_type.exp | 18 +++++----- - gdb/testsuite/gdb.fortran/vla-strings.exp | 12 +++---- - gdb/testsuite/gdb.fortran/vla-value.exp | 8 ++--- - 8 files changed, 53 insertions(+), 44 deletions(-) - -diff --git a/gdb/f-typeprint.c b/gdb/f-typeprint.c -index 9c746fa91c3..c33bd68fe0f 100644 ---- a/gdb/f-typeprint.c -+++ b/gdb/f-typeprint.c -@@ -250,7 +250,7 @@ f_type_print_varspec_suffix (struct type *type, struct ui_file *stream, - case TYPE_CODE_REF: - f_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, 1, 0, - arrayprint_recurse_level, false); -- fprintf_filtered (stream, ")"); -+ fprintf_filtered (stream, " )"); - break; - - case TYPE_CODE_FUNC: -diff --git a/gdb/testsuite/gdb.dwarf2/dynarr-ptr.exp b/gdb/testsuite/gdb.dwarf2/dynarr-ptr.exp -index 2f6b17c6dc5..35a4fd78e19 100644 ---- a/gdb/testsuite/gdb.dwarf2/dynarr-ptr.exp -+++ b/gdb/testsuite/gdb.dwarf2/dynarr-ptr.exp -@@ -179,7 +179,7 @@ gdb_test "print foo.three_ptr'length" \ - " = 3" - - gdb_test "ptype foo.three_ptr" \ -- " = access array \\(<>\\) of integer" -+ " = access array \\(1 \.\. 3\\) of integer" - - # foo.three_ptr_tdef.all - -@@ -289,7 +289,7 @@ gdb_test "print foo.five_ptr'length" \ - " = 5" - - gdb_test "ptype foo.five_ptr" \ -- " = access array \\(<>\\) of integer" -+ " = access array \\(2 \.\. 6\\) of integer" - - # foo.five_ptr_tdef.all - -diff --git a/gdb/testsuite/gdb.fortran/mixed-lang-stack.exp b/gdb/testsuite/gdb.fortran/mixed-lang-stack.exp -index edf2508537d..617c6a36292 100644 ---- a/gdb/testsuite/gdb.fortran/mixed-lang-stack.exp -+++ b/gdb/testsuite/gdb.fortran/mixed-lang-stack.exp -@@ -54,6 +54,7 @@ proc run_tests { lang } { - if { $lang == "c" || $lang == "c++" } { - gdb_test "set language c" \ - "Warning: the current language does not match this frame." -+ setup_kfail *-*-* bsc#1178580 - } else { - gdb_test_no_output "set language $lang" - } -@@ -156,6 +157,10 @@ proc run_tests { lang } { - "g = ${g_pattern}" \ - "_e = 6" ] - -+ if { $lang == "c" || $lang == "c++" } { -+ setup_kfail *-*-* bsc#1178580 -+ } -+ - gdb_test "info args" $args_pattern \ - "info args in frame #7" - } -diff --git a/gdb/testsuite/gdb.fortran/pointer-to-pointer.exp b/gdb/testsuite/gdb.fortran/pointer-to-pointer.exp -index 4c643c29903..c93300746de 100644 ---- a/gdb/testsuite/gdb.fortran/pointer-to-pointer.exp -+++ b/gdb/testsuite/gdb.fortran/pointer-to-pointer.exp -@@ -43,7 +43,11 @@ set l_buffer_type [multi_line \ - "Type l_buffer" \ - " $real4 :: alpha\\(:\\)" \ - "End Type l_buffer" ] -+set l_buffer_type_2 [multi_line \ -+ "Type l_buffer" \ -+ " $real4 :: alpha\\(5\\)" \ -+ "End Type l_buffer" ] - --gdb_test "ptype buffer" "type = PTR TO -> \\( ${l_buffer_type} \\)" -+gdb_test "ptype buffer" "type = PTR TO -> \\( ${l_buffer_type_2} \\)" - gdb_test "ptype *buffer" "type = ${l_buffer_type}" - gdb_test "ptype buffer%alpha" "type = $real4 \\(5\\)" -diff --git a/gdb/testsuite/gdb.fortran/pointers.exp b/gdb/testsuite/gdb.fortran/pointers.exp -index 916897005f2..ddcc1036765 100644 ---- a/gdb/testsuite/gdb.fortran/pointers.exp -+++ b/gdb/testsuite/gdb.fortran/pointers.exp -@@ -35,28 +35,28 @@ set complex [fortran_complex4] - - gdb_breakpoint [gdb_get_line_number "Before pointer assignment"] - gdb_continue_to_breakpoint "Before pointer assignment" --gdb_test "print logp" "= \\(PTR TO -> \\( $logical\\)\\) 0x0" "print logp, not associated" -+gdb_test "print logp" "= \\(PTR TO -> \\( $logical \\)\\) 0x0" "print logp, not associated" - gdb_test "print *logp" "Cannot access memory at address 0x0" "print *logp, not associated" --gdb_test "print comp" "= \\(PTR TO -> \\( $complex\\)\\) 0x0" "print comp, not associated" -+gdb_test "print comp" "= \\(PTR TO -> \\( $complex \\)\\) 0x0" "print comp, not associated" - gdb_test "print *comp" "Cannot access memory at address 0x0" "print *comp, not associated" --gdb_test "print charp" "= \\(PTR TO -> \\( character\\*1\\)\\) 0x0" "print charp, not associated" -+gdb_test "print charp" "= \\(PTR TO -> \\( character\\*1 \\)\\) 0x0" "print charp, not associated" - gdb_test "print *charp" "Cannot access memory at address 0x0" "print *charp, not associated" --gdb_test "print charap" "= \\(PTR TO -> \\( character\\*3\\)\\) 0x0" "print charap, not associated" -+gdb_test "print charap" "= \\(PTR TO -> \\( character\\*3 \\)\\) 0x0" "print charap, not associated" - gdb_test "print *charap" "Cannot access memory at address 0x0" "print *charap, not associated" --gdb_test "print intp" "= \\(PTR TO -> \\( $int\\)\\) 0x0" "print intp, not associated" -+gdb_test "print intp" "= \\(PTR TO -> \\( $int \\)\\) 0x0" "print intp, not associated" - gdb_test "print *intp" "Cannot access memory at address 0x0" "print *intp, not associated" - set test "print intap, not associated" - gdb_test_multiple "print intap" $test { -- -re " = \\(PTR TO -> \\( $int \\(:,:\\)\\)\\) \r\n$gdb_prompt $" { -+ -re " = \\(PTR TO -> \\( $int \\(:,:\\) \\)\\) \r\n$gdb_prompt $" { - pass $test - } - -re " = \r\n$gdb_prompt $" { - pass $test - } - } --gdb_test "print realp" "= \\(PTR TO -> \\( $real\\)\\) 0x0" "print realp, not associated" -+gdb_test "print realp" "= \\(PTR TO -> \\( $real \\)\\) 0x0" "print realp, not associated" - gdb_test "print *realp" "Cannot access memory at address 0x0" "print *realp, not associated" --gdb_test "print \$my_var = intp" "= \\(PTR TO -> \\( $int\\)\\) 0x0" -+gdb_test "print \$my_var = intp" "= \\(PTR TO -> \\( $int \\)\\) 0x0" - set test "print cyclicp1, not associated" - gdb_test_multiple "print cyclicp1" $test { - -re "= \\( i = -?\\d+, p = 0x0 \\)\r\n$gdb_prompt $" { -@@ -68,10 +68,10 @@ gdb_test_multiple "print cyclicp1" $test { - } - set test "print cyclicp1%p, not associated" - gdb_test_multiple "print cyclicp1%p" $test { -- -re "= \\(PTR TO -> \\( Type typewithpointer\\)\\) 0x0\r\n$gdb_prompt $" { -+ -re "= \\(PTR TO -> \\( Type typewithpointer \\)\\) 0x0\r\n$gdb_prompt $" { - pass $test - } -- -re "= \\(PTR TO -> \\( Type typewithpointer\\)\\) \r\n$gdb_prompt $" { -+ -re "= \\(PTR TO -> \\( Type typewithpointer \\)\\) \r\n$gdb_prompt $" { - pass $test - } - } -@@ -84,15 +84,15 @@ gdb_test "print *(twop)%ivla2" "= " - - gdb_breakpoint [gdb_get_line_number "After value assignment"] - gdb_continue_to_breakpoint "After value assignment" --gdb_test "print logp" "= \\(PTR TO -> \\( $logical\\)\\) $hex\( <.*>\)?" -+gdb_test "print logp" "= \\(PTR TO -> \\( $logical \\)\\) $hex\( <.*>\)?" - gdb_test "print *logp" "= \\.TRUE\\." --gdb_test "print comp" "= \\(PTR TO -> \\( $complex\\)\\) $hex\( <.*>\)?" -+gdb_test "print comp" "= \\(PTR TO -> \\( $complex \\)\\) $hex\( <.*>\)?" - gdb_test "print *comp" "= \\(1,2\\)" --gdb_test "print charp" "= \\(PTR TO -> \\( character\\*1\\)\\) $hex\( <.*>\)?" -+gdb_test "print charp" "= \\(PTR TO -> \\( character\\*1 \\)\\) $hex\( <.*>\)?" - gdb_test "print *charp" "= 'a'" --gdb_test "print charap" "= \\(PTR TO -> \\( character\\*3\\)\\) $hex\( <.*>\)?" -+gdb_test "print charap" "= \\(PTR TO -> \\( character\\*3 \\)\\) $hex\( <.*>\)?" - gdb_test "print *charap" "= 'abc'" --gdb_test "print intp" "= \\(PTR TO -> \\( $int\\)\\) $hex\( <.*>\)?" -+gdb_test "print intp" "= \\(PTR TO -> \\( $int \\)\\) $hex\( <.*>\)?" - gdb_test "print *intp" "= 10" - set test_name "print intap, associated" - gdb_test_multiple "print intap" $test_name { -@@ -114,16 +114,16 @@ gdb_test_multiple "print intvlap" $test_name { - pass $test_name - } - } --gdb_test "print realp" "= \\(PTR TO -> \\( $real\\)\\) $hex\( <.*>\)?" -+gdb_test "print realp" "= \\(PTR TO -> \\( $real \\)\\) $hex\( <.*>\)?" - gdb_test "print *realp" "= 3\\.14000\\d+" --gdb_test "print arrayOfPtr(2)%p" "= \\(PTR TO -> \\( Type two\\)\\) $hex\( <.*>\)?" -+gdb_test "print arrayOfPtr(2)%p" "= \\(PTR TO -> \\( Type two \\)\\) $hex\( <.*>\)?" - gdb_test "print *(arrayOfPtr(2)%p)" "= \\( ivla1 = \\(11, 12, 13\\), ivla2 = \\(\\( 211, 221\\) \\( 212, 222\\) \\) \\)" - set test_name "print arrayOfPtr(3)%p" - gdb_test_multiple $test_name $test_name { -- -re "= \\(PTR TO -> \\( Type two\\)\\) \r\n$gdb_prompt $" { -+ -re "= \\(PTR TO -> \\( Type two \\)\\) \r\n$gdb_prompt $" { - pass $test_name - } -- -re "= \\(PTR TO -> \\( Type two\\)\\) 0x0\r\n$gdb_prompt $" { -+ -re "= \\(PTR TO -> \\( Type two \\)\\) 0x0\r\n$gdb_prompt $" { - pass $test_name - } - } -@@ -137,7 +137,7 @@ gdb_test_multiple "print *(arrayOfPtr(3)%p)" $test_name { - } - } - gdb_test "print cyclicp1" "= \\( i = 1, p = $hex\( <.*>\)? \\)" --gdb_test "print cyclicp1%p" "= \\(PTR TO -> \\( Type typewithpointer\\)\\) $hex\( <.*>\)?" -+gdb_test "print cyclicp1%p" "= \\(PTR TO -> \\( Type typewithpointer \\)\\) $hex\( <.*>\)?" - gdb_test "print *((integer*) &inta + 2)" "= 3" "print temporary pointer, array" - gdb_test "print *((integer*) &intvla + 3)" "= 4" "print temporary pointer, allocated vla" --gdb_test "print \$pc" "= \\(PTR TO -> \\( void \\(\\) \\(\\)\\)\\) $hex " "Print program counter" -+gdb_test "print \$pc" "= \\(PTR TO -> \\( void \\(\\) \\(\\) \\)\\) $hex " "Print program counter" -diff --git a/gdb/testsuite/gdb.fortran/print_type.exp b/gdb/testsuite/gdb.fortran/print_type.exp -index 5a4aa35d7cb..529a78e5b89 100755 ---- a/gdb/testsuite/gdb.fortran/print_type.exp -+++ b/gdb/testsuite/gdb.fortran/print_type.exp -@@ -43,7 +43,7 @@ set complex [fortran_complex4] - # matches the string TYPE. - proc check_pointer_type { var_name type } { - gdb_test "ptype ${var_name}" \ -- "type = PTR TO -> \\( ${type}\\)" -+ "type = PTR TO -> \\( ${type} \\)" - } - - gdb_breakpoint [gdb_get_line_number "Before pointer assignment"] -@@ -88,7 +88,7 @@ gdb_test "ptype twop" \ - [multi_line "type = PTR TO -> \\( Type two" \ - " $int, allocatable :: ivla1\\(:\\)" \ - " $int, allocatable :: ivla2\\(:,:\\)" \ -- "End Type two\\)"] -+ "End Type two \\)"] - - - gdb_breakpoint [gdb_get_line_number "After value assignment"] -@@ -101,18 +101,18 @@ gdb_test "ptype intv" "type = $int" - gdb_test "ptype inta" "type = $int \\(10,2\\)" - gdb_test "ptype realv" "type = $real" - --gdb_test "ptype logp" "type = PTR TO -> \\( $logical\\)" --gdb_test "ptype comp" "type = PTR TO -> \\( $complex\\)" --gdb_test "ptype charp" "type = PTR TO -> \\( character\\*1\\)" --gdb_test "ptype charap" "type = PTR TO -> \\( character\\*3\\)" --gdb_test "ptype intp" "type = PTR TO -> \\( $int\\)" -+gdb_test "ptype logp" "type = PTR TO -> \\( $logical \\)" -+gdb_test "ptype comp" "type = PTR TO -> \\( $complex \\)" -+gdb_test "ptype charp" "type = PTR TO -> \\( character\\*1 \\)" -+gdb_test "ptype charap" "type = PTR TO -> \\( character\\*3 \\)" -+gdb_test "ptype intp" "type = PTR TO -> \\( $int \\)" - set test "ptype intap" - gdb_test_multiple $test $test { - -re "type = $int \\(10,2\\)\r\n$gdb_prompt $" { - pass $test - } -- -re "type = PTR TO -> \\( $int \\(10,2\\)\\)\r\n$gdb_prompt $" { -+ -re "type = PTR TO -> \\( $int \\(10,2\\) \\)\r\n$gdb_prompt $" { - pass $test - } - } --gdb_test "ptype realp" "type = PTR TO -> \\( $real\\)" -+gdb_test "ptype realp" "type = PTR TO -> \\( $real \\)" -diff --git a/gdb/testsuite/gdb.fortran/vla-strings.exp b/gdb/testsuite/gdb.fortran/vla-strings.exp -index 5d0662823a0..484fdcb652a 100644 ---- a/gdb/testsuite/gdb.fortran/vla-strings.exp -+++ b/gdb/testsuite/gdb.fortran/vla-strings.exp -@@ -32,7 +32,7 @@ gdb_breakpoint [gdb_get_line_number "var_char-allocated-1"] - gdb_continue_to_breakpoint "var_char-allocated-1" - set test "whatis var_char first time" - gdb_test_multiple "whatis var_char" $test { -- -re "type = PTR TO -> \\( character\\*10\\)\r\n$gdb_prompt $" { -+ -re "type = PTR TO -> \\( character\\*10 \\)\r\n$gdb_prompt $" { - pass $test - } - -re "type = character\\*10\r\n$gdb_prompt $" { -@@ -41,7 +41,7 @@ gdb_test_multiple "whatis var_char" $test { - } - set test "ptype var_char first time" - gdb_test_multiple "ptype var_char" $test { -- -re "type = PTR TO -> \\( character\\*10\\)\r\n$gdb_prompt $" { -+ -re "type = PTR TO -> \\( character\\*10 \\)\r\n$gdb_prompt $" { - pass $test - } - -re "type = character\\*10\r\n$gdb_prompt $" { -@@ -59,7 +59,7 @@ gdb_breakpoint [gdb_get_line_number "var_char-filled-1"] - gdb_continue_to_breakpoint "var_char-filled-1" - set test "print var_char, var_char-filled-1" - gdb_test_multiple "print var_char" $test { -- -re "= \\(PTR TO -> \\( character\\*3\\)\\) $hex\r\n$gdb_prompt $" { -+ -re "= \\(PTR TO -> \\( character\\*3 \\)\\) $hex\r\n$gdb_prompt $" { - gdb_test "print *var_char" "= 'foo'" "print *var_char, var_char-filled-1" - pass $test - } -@@ -69,7 +69,7 @@ gdb_test_multiple "print var_char" $test { - } - set test "ptype var_char, var_char-filled-1" - gdb_test_multiple "ptype var_char" $test { -- -re "type = PTR TO -> \\( character\\*3\\)\r\n$gdb_prompt $" { -+ -re "type = PTR TO -> \\( character\\*3 \\)\r\n$gdb_prompt $" { - pass $test - } - -re "type = character\\*3\r\n$gdb_prompt $" { -@@ -84,7 +84,7 @@ gdb_breakpoint [gdb_get_line_number "var_char-filled-2"] - gdb_continue_to_breakpoint "var_char-filled-2" - set test "print var_char, var_char-filled-2" - gdb_test_multiple "print var_char" $test { -- -re "= \\(PTR TO -> \\( character\\*6\\)\\) $hex\r\n$gdb_prompt $" { -+ -re "= \\(PTR TO -> \\( character\\*6 \\)\\) $hex\r\n$gdb_prompt $" { - gdb_test "print *var_char" "= 'foobar'" "print *var_char, var_char-filled-2" - pass $test - } -@@ -94,7 +94,7 @@ gdb_test_multiple "print var_char" $test { - } - set test "ptype var_char, var_char-filled-2" - gdb_test_multiple "ptype var_char" $test { -- -re "type = PTR TO -> \\( character\\*6\\)\r\n$gdb_prompt $" { -+ -re "type = PTR TO -> \\( character\\*6 \\)\r\n$gdb_prompt $" { - pass $test - } - -re "type = character\\*6\r\n$gdb_prompt $" { -diff --git a/gdb/testsuite/gdb.fortran/vla-value.exp b/gdb/testsuite/gdb.fortran/vla-value.exp -index 49f22e7904e..be0a2d47fdf 100644 ---- a/gdb/testsuite/gdb.fortran/vla-value.exp -+++ b/gdb/testsuite/gdb.fortran/vla-value.exp -@@ -37,7 +37,7 @@ gdb_breakpoint [gdb_get_line_number "vla1-init"] - gdb_continue_to_breakpoint "vla1-init" - gdb_test "print vla1" " = " "print non-allocated vla1" - gdb_test "print &vla1" \ -- " = \\\(PTR TO -> \\\( $real, allocatable \\\(:,:,:\\\)\\\)\\\) $hex" \ -+ " = \\\(PTR TO -> \\\( $real, allocatable \\\(:,:,:\\\) \\\)\\\) $hex" \ - "print non-allocated &vla1" - gdb_test "print vla1(1,1,1)" "no such vector element \\\(vector not allocated\\\)" \ - "print member in non-allocated vla1 (1)" -@@ -58,7 +58,7 @@ with_timeout_factor 15 { - "step over value assignment of vla1" - } - gdb_test "print &vla1" \ -- " = \\\(PTR TO -> \\\( $real, allocatable \\\(10,10,10\\\)\\\)\\\) $hex" \ -+ " = \\\(PTR TO -> \\\( $real, allocatable \\\(10,10,10\\\) \\\)\\\) $hex" \ - "print allocated &vla1" - gdb_test "print vla1(3, 6, 9)" " = 1311" "print allocated vla1(3,6,9)" - gdb_test "print vla1(1, 3, 8)" " = 1311" "print allocated vla1(1,3,8)" -@@ -78,7 +78,7 @@ gdb_test "print vla1(9, 9, 9)" " = 999" \ - # Try to access values in undefined pointer to VLA (dangling) - gdb_test "print pvla" " = " "print undefined pvla" - gdb_test "print &pvla" \ -- " = \\\(PTR TO -> \\\( $real \\\(:,:,:\\\)\\\)\\\) $hex" \ -+ " = \\\(PTR TO -> \\\( $real \\\(:,:,:\\\) \\\)\\\) $hex" \ - "print non-associated &pvla" - gdb_test "print pvla(1, 3, 8)" "no such vector element \\\(vector not associated\\\)" \ - "print undefined pvla(1,3,8)" -@@ -87,7 +87,7 @@ gdb_test "print pvla(1, 3, 8)" "no such vector element \\\(vector not associated - gdb_breakpoint [gdb_get_line_number "pvla-associated"] - gdb_continue_to_breakpoint "pvla-associated" - gdb_test "print &pvla" \ -- " = \\\(PTR TO -> \\\( $real \\\(10,10,10\\\)\\\)\\\) $hex" \ -+ " = \\\(PTR TO -> \\\( $real \\\(10,10,10\\\) \\\)\\\) $hex" \ - "print associated &pvla" - gdb_test "print pvla(3, 6, 9)" " = 42" "print associated pvla(3,6,9)" - gdb_test "print pvla(1, 3, 8)" " = 1001" "print associated pvla(1,3,8)" diff --git a/fixup-gdb-vla-intel-tests.patch b/fixup-gdb-vla-intel-tests.patch deleted file mode 100644 index 9aa5d6a..0000000 --- a/fixup-gdb-vla-intel-tests.patch +++ /dev/null @@ -1,157 +0,0 @@ -Fixup gdb-vla-intel-tests.patch - ---- - gdb/testsuite/gdb.fortran/ptr-indentation.exp | 2 +- - gdb/testsuite/gdb.fortran/ptype-on-functions.exp | 2 +- - gdb/testsuite/gdb.fortran/vla-ptr-info.exp | 2 +- - gdb/testsuite/gdb.fortran/vla-stringsold.exp | 36 ++++++++++++------------ - gdb/testsuite/gdb.fortran/whatis_type.exp | 4 +-- - 5 files changed, 23 insertions(+), 23 deletions(-) - -diff --git a/gdb/testsuite/gdb.fortran/ptr-indentation.exp b/gdb/testsuite/gdb.fortran/ptr-indentation.exp -index 5e459fdb62e..209809a2922 100644 ---- a/gdb/testsuite/gdb.fortran/ptr-indentation.exp -+++ b/gdb/testsuite/gdb.fortran/ptr-indentation.exp -@@ -37,5 +37,5 @@ gdb_continue_to_breakpoint "BP1" - gdb_test "ptype tinsta" \ - [multi_line "type = Type tuserdef" \ - " $int :: i" \ -- " PTR TO -> \\( $real :: ptr\\)" \ -+ " PTR TO -> \\( $real :: ptr \\)" \ - "End Type tuserdef"] -diff --git a/gdb/testsuite/gdb.fortran/ptype-on-functions.exp b/gdb/testsuite/gdb.fortran/ptype-on-functions.exp -index 761432ea82e..93e984af243 100644 ---- a/gdb/testsuite/gdb.fortran/ptype-on-functions.exp -+++ b/gdb/testsuite/gdb.fortran/ptype-on-functions.exp -@@ -42,7 +42,7 @@ gdb_test "ptype say_numbers" \ - "type = void \\(integer\\(kind=4\\), integer\\(kind=4\\), integer\\(kind=4\\)\\)" - - gdb_test "ptype fun_ptr" \ -- "type = PTR TO -> \\( integer\\(kind=4\\) \\(\\) \\(REF TO -> \\( integer\\(kind=4\\)\\)\\)\\)" -+ "type = PTR TO -> \\( integer\\(kind=4\\) \\(\\) \\(REF TO -> \\( integer\\(kind=4\\) \\)\\) \\)" - - gdb_test "ptype say_string" \ - "type = void \\(character\\*\\(\\*\\), integer\\(kind=\\d+\\)\\)" -diff --git a/gdb/testsuite/gdb.fortran/vla-ptr-info.exp b/gdb/testsuite/gdb.fortran/vla-ptr-info.exp -index ca8541bf92f..7ead9191b93 100644 ---- a/gdb/testsuite/gdb.fortran/vla-ptr-info.exp -+++ b/gdb/testsuite/gdb.fortran/vla-ptr-info.exp -@@ -33,5 +33,5 @@ set real4 [fortran_real4] - # Check the status of a pointer to a dynamic array. - gdb_breakpoint [gdb_get_line_number "pvla-associated"] - gdb_continue_to_breakpoint "pvla-associated" --gdb_test "print &pvla" " = \\(PTR TO -> \\( $real4 \\(10,10,10\\)\\)\\) ${hex}" \ -+gdb_test "print &pvla" " = \\(PTR TO -> \\( $real4 \\(10,10,10\\) \\)\\) ${hex}" \ - "print pvla pointer information" -diff --git a/gdb/testsuite/gdb.fortran/vla-stringsold.exp b/gdb/testsuite/gdb.fortran/vla-stringsold.exp -index 7d7876d71ab..c1bf7ef763a 100644 ---- a/gdb/testsuite/gdb.fortran/vla-stringsold.exp -+++ b/gdb/testsuite/gdb.fortran/vla-stringsold.exp -@@ -31,11 +31,11 @@ if ![runto MAIN__] then { - gdb_breakpoint [gdb_get_line_number "var_char-allocated-1"] - gdb_continue_to_breakpoint "var_char-allocated-1" - gdb_test "print var_char" \ -- " = \\(PTR TO -> \\( character\\*10\\)\\) ${hex}" \ -+ " = \\(PTR TO -> \\( character\\*10 \\)\\) ${hex}" \ - "print var_char after allocated first time" --gdb_test "whatis var_char" "type = PTR TO -> \\( character\\*10\\)" \ -+gdb_test "whatis var_char" "type = PTR TO -> \\( character\\*10 \\)" \ - "whatis var_char first time" --gdb_test "ptype var_char" "type = PTR TO -> \\( character\\*10\\)" \ -+gdb_test "ptype var_char" "type = PTR TO -> \\( character\\*10 \\)" \ - "ptype var_char first time" - gdb_test "next" "\\d+.*var_char = 'foo'.*" \ - "next to allocation status of var_char" -@@ -44,13 +44,13 @@ gdb_test "print l" " = .TRUE." "print allocation status first time" - gdb_breakpoint [gdb_get_line_number "var_char-filled-1"] - gdb_continue_to_breakpoint "var_char-filled-1" - gdb_test "print var_char" \ -- " = \\(PTR TO -> \\( character\\*3\\)\\) ${hex}" \ -+ " = \\(PTR TO -> \\( character\\*3 \\)\\) ${hex}" \ - "print var_char after filled first time" - gdb_test "print *var_char" " = 'foo'" \ - "print *var_char after filled first time" --gdb_test "whatis var_char" "type = PTR TO -> \\( character\\*3\\)" \ -+gdb_test "whatis var_char" "type = PTR TO -> \\( character\\*3 \\)" \ - "whatis var_char after filled first time" --gdb_test "ptype var_char" "type = PTR TO -> \\( character\\*3\\)" \ -+gdb_test "ptype var_char" "type = PTR TO -> \\( character\\*3 \\)" \ - "ptype var_char after filled first time" - gdb_test "print var_char(1)" " = 102 'f'" "print var_char(1)" - gdb_test "print var_char(3)" " = 111 'o'" "print var_char(3)" -@@ -58,44 +58,44 @@ gdb_test "print var_char(3)" " = 111 'o'" "print var_char(3)" - gdb_breakpoint [gdb_get_line_number "var_char-filled-2"] - gdb_continue_to_breakpoint "var_char-filled-2" - gdb_test "print var_char" \ -- " = \\(PTR TO -> \\( character\\*6\\)\\) ${hex}" \ -+ " = \\(PTR TO -> \\( character\\*6 \\)\\) ${hex}" \ - "print var_char after allocated second time" - gdb_test "print *var_char" " = 'foobar'" \ - "print *var_char after allocated second time" --gdb_test "whatis var_char" "type = PTR TO -> \\( character\\*6\\)" \ -+gdb_test "whatis var_char" "type = PTR TO -> \\( character\\*6 \\)" \ - "whatis var_char second time" --gdb_test "ptype var_char" "type = PTR TO -> \\( character\\*6\\)" \ -+gdb_test "ptype var_char" "type = PTR TO -> \\( character\\*6 \\)" \ - "ptype var_char second time" - - gdb_breakpoint [gdb_get_line_number "var_char-empty"] - gdb_continue_to_breakpoint "var_char-empty" - gdb_test "print var_char" \ -- " = \\(PTR TO -> \\( character\\*0\\)\\) ${hex}" \ -+ " = \\(PTR TO -> \\( character\\*0 \\)\\) ${hex}" \ - "print var_char after set empty" - gdb_test "print *var_char" " = \"\"" "print *var_char after set empty" --gdb_test "whatis var_char" "type = PTR TO -> \\( character\\*0\\)" \ -+gdb_test "whatis var_char" "type = PTR TO -> \\( character\\*0 \\)" \ - "whatis var_char after set empty" --gdb_test "ptype var_char" "type = PTR TO -> \\( character\\*0\\)" \ -+gdb_test "ptype var_char" "type = PTR TO -> \\( character\\*0 \\)" \ - "ptype var_char after set empty" - - gdb_breakpoint [gdb_get_line_number "var_char-allocated-3"] - gdb_continue_to_breakpoint "var_char-allocated-3" - gdb_test "print var_char" \ -- " = \\(PTR TO -> \\( character\\*21\\)\\) ${hex}" \ -+ " = \\(PTR TO -> \\( character\\*21 \\)\\) ${hex}" \ - "print var_char after allocated third time" --gdb_test "whatis var_char" "type = PTR TO -> \\( character\\*21\\)" \ -+gdb_test "whatis var_char" "type = PTR TO -> \\( character\\*21 \\)" \ - "whatis var_char after allocated third time" --gdb_test "ptype var_char" "type = PTR TO -> \\( character\\*21\\)" \ -+gdb_test "ptype var_char" "type = PTR TO -> \\( character\\*21 \\)" \ - "ptype var_char after allocated third time" - - gdb_breakpoint [gdb_get_line_number "var_char_p-associated"] - gdb_continue_to_breakpoint "var_char_p-associated" - gdb_test "print var_char_p" \ -- " = \\(PTR TO -> \\( character\\*7\\)\\) ${hex}" \ -+ " = \\(PTR TO -> \\( character\\*7 \\)\\) ${hex}" \ - "print var_char_p after associated" - gdb_test "print *var_char_p" " = 'johndoe'" \ - "print *var_char_ after associated" --gdb_test "whatis var_char_p" "type = PTR TO -> \\( character\\*7\\)" \ -+gdb_test "whatis var_char_p" "type = PTR TO -> \\( character\\*7 \\)" \ - "whatis var_char_p after associated" --gdb_test "ptype var_char_p" "type = PTR TO -> \\( character\\*7\\)" \ -+gdb_test "ptype var_char_p" "type = PTR TO -> \\( character\\*7 \\)" \ - "ptype var_char_p after associated" -diff --git a/gdb/testsuite/gdb.fortran/whatis_type.exp b/gdb/testsuite/gdb.fortran/whatis_type.exp -index e2a56a63410..4b0cbf9c28d 100644 ---- a/gdb/testsuite/gdb.fortran/whatis_type.exp -+++ b/gdb/testsuite/gdb.fortran/whatis_type.exp -@@ -44,7 +44,7 @@ gdb_test "whatis t2" "type = Type t2" - gdb_test "whatis t2v" "type = Type t2" - gdb_test "whatis t3" "type = Type t3" - gdb_test "whatis t3v" "type = Type t3" --gdb_test "whatis t3p" "type = PTR TO -> \\( Type t3\\)" -+gdb_test "whatis t3p" "type = PTR TO -> \\( Type t3 \\)" - - gdb_test "ptype t1" \ - [multi_line "type = Type t1" \ -@@ -73,4 +73,4 @@ gdb_test "ptype t3p" \ - [multi_line "type = PTR TO -> \\( Type t3" \ - " $int :: t3_i" \ - " Type t2 :: t2_n" \ -- "End Type t3\\)"] -+ "End Type t3 \\)"] diff --git a/gdb-10.1.tar.bz2 b/gdb-10.1.tar.bz2 deleted file mode 100644 index 8d02313..0000000 --- a/gdb-10.1.tar.bz2 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:707fcf55bb2ce2bb4afdfa3ec922063d7bf9fed5e91943be6f36e7cad8e98a88 -size 31081288 diff --git a/gdb-11.1.tar.bz2 b/gdb-11.1.tar.bz2 new file mode 100644 index 0000000..fd4b7e1 --- /dev/null +++ b/gdb-11.1.tar.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fe14d640ad78b741f6b2751612aa9e40f752daaf0b6459cd01a4133379413d6e +size 29356796 diff --git a/gdb-6.3-attach-see-vdso-test.patch b/gdb-6.3-attach-see-vdso-test.patch new file mode 100644 index 0000000..5321c5f --- /dev/null +++ b/gdb-6.3-attach-see-vdso-test.patch @@ -0,0 +1,120 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +Date: Fri, 27 Oct 2017 21:07:50 +0200 +Subject: gdb-6.3-attach-see-vdso-test.patch + +;; Test kernel VDSO decoding while attaching to an i386 process. +;;=fedoratest + +diff --git a/gdb/testsuite/gdb.base/attach-see-vdso.c b/gdb/testsuite/gdb.base/attach-see-vdso.c +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.base/attach-see-vdso.c +@@ -0,0 +1,25 @@ ++/* This testcase is part of GDB, the GNU debugger. ++ ++ Copyright 2007 Free Software Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 2 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program; if not, write to the Free Software ++ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ ++ ++#include ++ ++int main () ++{ ++ pause (); ++ return 1; ++} +diff --git a/gdb/testsuite/gdb.base/attach-see-vdso.exp b/gdb/testsuite/gdb.base/attach-see-vdso.exp +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.base/attach-see-vdso.exp +@@ -0,0 +1,77 @@ ++# Copyright 2007 ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 2 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program; if not, write to the Free Software ++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++ ++# This file was created by Jan Kratochvil . ++ ++# This test only works on Linux ++if { ![istarget "*-*-linux-gnu*"] } { ++ return 0 ++} ++ ++if {[use_gdb_stub]} { ++ untested "skipping test because of use_gdb_stub" ++ return -1 ++} ++ ++set testfile "attach-see-vdso" ++set srcfile ${testfile}.c ++set binfile [standard_output_file ${testfile}] ++set escapedbinfile [string_to_regexp [standard_output_file ${testfile}]] ++ ++# The kernel VDSO is used for the syscalls returns only on i386 (not x86_64). ++# ++if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-m32}] != "" } { ++ gdb_suppress_entire_file "Testcase nonthraded compile failed, so all tests in this file will automatically fail." ++} ++ ++if [get_compiler_info ${binfile}] { ++ return -1 ++} ++ ++# Start the program running and then wait for a bit, to be sure ++# that it can be attached to. ++ ++set testpid [eval exec $binfile &] ++ ++# Avoid some race: ++sleep 2 ++ ++# Start with clean gdb ++gdb_exit ++gdb_start ++gdb_reinitialize_dir $srcdir/$subdir ++# Never call: gdb_load ${binfile} ++# as the former problem would not reproduce otherwise. ++ ++set test "attach" ++gdb_test_multiple "attach $testpid" "$test" { ++ -re "Attaching to process $testpid\r?\n.*$gdb_prompt $" { ++ pass "$test" ++ } ++} ++ ++gdb_test "bt" "#0 *0x\[0-9a-f\]* in \[^?\].*" "backtrace decodes VDSO" ++ ++# Exit and detach the process. ++ ++gdb_exit ++ ++# Make sure we don't leave a process around to confuse ++# the next test run (and prevent the compile by keeping ++# the text file busy), in case the "set should_exit" didn't ++# work. ++ ++remote_exec build "kill -9 ${testpid}" diff --git a/gdb-6.3-bz140532-ppc-unwinding-test.patch b/gdb-6.3-bz140532-ppc-unwinding-test.patch index 25c77e7..714b62c 100644 --- a/gdb-6.3-bz140532-ppc-unwinding-test.patch +++ b/gdb-6.3-bz140532-ppc-unwinding-test.patch @@ -24,7 +24,7 @@ new file mode 100644 + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU 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. */ @@ -107,7 +107,7 @@ new file mode 100644 + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU 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. */ @@ -210,7 +210,7 @@ new file mode 100644 + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU 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. */ @@ -237,15 +237,15 @@ new file mode 100644 +# 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. ++# 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. diff --git a/gdb-6.3-bz202689-exec-from-pthread-test.patch b/gdb-6.3-bz202689-exec-from-pthread-test.patch index a283f9f..0556260 100644 --- a/gdb-6.3-bz202689-exec-from-pthread-test.patch +++ b/gdb-6.3-bz202689-exec-from-pthread-test.patch @@ -73,15 +73,15 @@ new file mode 100644 +# 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. */ ++# 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 diff --git a/gdb-6.3-gstack-20050411.patch b/gdb-6.3-gstack-20050411.patch index 2fd4b3a..945db5e 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 +@@ -1753,7 +1753,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: +@@ -1802,7 +1802,25 @@ install-guile: install-python: $(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(GDB_DATADIR)/python/gdb @@ -52,7 +52,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 \ -@@ -1798,6 +1816,18 @@ uninstall: force $(CONFIG_UNINSTALL) +@@ -1825,6 +1843,18 @@ uninstall: force $(CONFIG_UNINSTALL) fi @$(MAKE) DO=uninstall "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do @@ -67,7 +67,7 @@ diff --git a/gdb/Makefile.in b/gdb/Makefile.in + fi ; \ + rm -f $(DESTDIR)$(bindir)/$$transformed_name$(EXEEXT) \ + $(DESTDIR)$(man1dir)/$$transformed_name.1 -+ ++ # The C++ name parser can be built standalone for testing. test-cp-name-parser.o: cp-name-parser.c $(COMPILE) -DTEST_CPNAMES cp-name-parser.c @@ -109,7 +109,7 @@ new file mode 100644 + +# Run GDB, strip out unwanted noise. +# --readnever is no longer used since .gdb_index is now in use. -+$GDB --quiet -nx $GDBARGS /proc/$1/exe $1 <&1 | ++$GDB --quiet -nx $GDBARGS /proc/$1/exe $1 <&1 | +set width 0 +set height 0 +set pagination no @@ -153,7 +153,7 @@ new file mode 100644 + /* Use the most simple notification not to get caught by attach on exiting + the function. */ + write (1, msg, strlen (msg)); -+ ++ + for (;;); +} + diff --git a/gdb-6.3-inferior-notification-20050721.patch b/gdb-6.3-inferior-notification-20050721.patch new file mode 100644 index 0000000..9ee912c --- /dev/null +++ b/gdb-6.3-inferior-notification-20050721.patch @@ -0,0 +1,324 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Jeff Johnston +Date: Fri, 27 Oct 2017 21:07:50 +0200 +Subject: gdb-6.3-inferior-notification-20050721.patch + +;; Notify observers that the inferior has been created +;;=fedoratest + +2005-07-21 Jeff Johnston + + * gdb.base/attach-32.exp: New test for attaching in 32-bit + mode on 64-bit systems. + * gdb.base/attach-32.c: Ditto. + * gdb.base/attach-32b.c: Ditto. + +2007-12-26 Jan Kratochvil + + * gdb.base/attach-32.exp: Fix forgotten $GDBFLAGS as set. + +diff --git a/gdb/testsuite/gdb.base/attach-32.c b/gdb/testsuite/gdb.base/attach-32.c +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.base/attach-32.c +@@ -0,0 +1,20 @@ ++/* This program is intended to be started outside of gdb, and then ++ attached to by gdb. Thus, it simply spins in a loop. The loop ++ is exited when & if the variable 'should_exit' is non-zero. (It ++ is initialized to zero in this program, so the loop will never ++ exit unless/until gdb sets the variable to non-zero.) ++ */ ++#include ++ ++int should_exit = 0; ++ ++int main () ++{ ++ int local_i = 0; ++ ++ while (! should_exit) ++ { ++ local_i++; ++ } ++ return 0; ++} +diff --git a/gdb/testsuite/gdb.base/attach-32.exp b/gdb/testsuite/gdb.base/attach-32.exp +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.base/attach-32.exp +@@ -0,0 +1,246 @@ ++# Copyright 2005 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 2 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program; if not, write to the Free Software ++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++# ++# This test was based on attach.exp and modified for 32/64 bit Linux systems. */ ++ ++# On HP-UX 11.0, this test is causing a process running the program ++# "attach" to be left around spinning. Until we figure out why, I am ++# commenting out the test to avoid polluting tiamat (our 11.0 nightly ++# test machine) with these processes. RT ++# ++# Setting the magic bit in the target app should work. I added a ++# "kill", and also a test for the R3 register warning. JB ++if { ![istarget "x86_64*-*linux*"] ++ && ![istarget "powerpc64*-*linux*"]} { ++ return 0 ++} ++ ++# are we on a target board ++if {[use_gdb_stub]} { ++ untested "skipping test because of use_gdb_stub" ++ return -1 ++} ++ ++set testfile "attach-32" ++set srcfile ${testfile}.c ++set srcfile2 ${testfile}b.c ++set binfile [standard_output_file ${testfile}] ++set binfile2 [standard_output_file ${testfile}b] ++set escapedbinfile [string_to_regexp [standard_output_file ${testfile}]] ++ ++#execute_anywhere "rm -f ${binfile} ${binfile2}" ++remote_exec build "rm -f ${binfile} ${binfile2}" ++# For debugging this test ++# ++#log_user 1 ++ ++# build the first test case ++# ++if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug "additional_flags=-m32"]] != "" } { ++ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." ++} ++ ++# Build the in-system-call test ++ ++if { [gdb_compile "${srcdir}/${subdir}/${srcfile2}" "${binfile2}" executable [list debug "additional_flags=-m32"]] != "" } { ++ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." ++} ++ ++if [get_compiler_info ${binfile}] { ++ return -1 ++} ++ ++proc do_attach_tests {} { ++ global gdb_prompt ++ global binfile ++ global escapedbinfile ++ global srcfile ++ global testfile ++ global objdir ++ global subdir ++ global timeout ++ global testpid ++ ++ # Verify that we can "see" the variable "should_exit" in the ++ # program, and that it is zero. ++ ++ gdb_test "print should_exit" " = 0" "after attach-32, print should_exit" ++ ++ # Verify that we can modify the variable "should_exit" in the ++ # program. ++ ++ gdb_test "set should_exit=1" "" "after attach-32, set should_exit" ++ ++ # Verify that the modification really happened. ++ ++ send_gdb "tbreak 19\n" ++ gdb_expect { ++ -re "reakpoint .*at.*$srcfile, line 19.*$gdb_prompt $" { ++ pass "after attach-32, set tbreak postloop" ++ } ++ -re "$gdb_prompt $" { ++ fail "after attach-32, set tbreak postloop" ++ } ++ timeout { ++ fail "(timeout) after attach-32, set tbreak postloop" ++ } ++ } ++ send_gdb "continue\n" ++ gdb_expect { ++ -re "main.*at.*$srcfile:19.*$gdb_prompt $" { ++ pass "after attach-32, reach tbreak postloop" ++ } ++ -re "$gdb_prompt $" { ++ fail "after attach-32, reach tbreak postloop" ++ } ++ timeout { ++ fail "(timeout) after attach-32, reach tbreak postloop" ++ } ++ } ++ ++ # Allow the test process to exit, to cleanup after ourselves. ++ ++ gdb_test "continue" {\[Inferior .* exited normally\]} "after attach-32, exit" ++ ++ # Make sure we don't leave a process around to confuse ++ # the next test run (and prevent the compile by keeping ++ # the text file busy), in case the "set should_exit" didn't ++ # work. ++ ++ remote_exec build "kill -9 ${testpid}" ++ ++ # Start the program running and then wait for a bit, to be sure ++ # that it can be attached to. ++ ++ set testpid [eval exec $binfile &] ++ exec sleep 2 ++ if { [istarget "*-*-cygwin*"] } { ++ # testpid is the Cygwin PID, GDB uses the Windows PID, which might be ++ # different due to the way fork/exec works. ++ set testpid [ exec ps -e | gawk "{ if (\$1 == $testpid) print \$4; }" ] ++ } ++ ++ # Verify that we can attach to the process, and find its a.out ++ # when we're cd'd to some directory that doesn't contain the ++ # a.out. (We use the source path set by the "dir" command.) ++ ++ gdb_test "dir ${objdir}/${subdir}" "Source directories searched: .*" \ ++ "set source path" ++ ++ gdb_test "cd /tmp" "Working directory /tmp." \ ++ "cd away from process working directory" ++ ++ # Explicitly flush out any knowledge of the previous attachment. ++ ++ set test "before attach-32-3, flush symbols" ++ gdb_test_multiple "symbol" "$test" { ++ -re "Discard symbol table from.*y or n. $" { ++ gdb_test "y" "No symbol file now." \ ++ "$test" ++ } ++ -re "No symbol file now.*$gdb_prompt $" { ++ pass "$test" ++ } ++ } ++ ++ gdb_test "exec" "No executable file now." \ ++ "before attach-32-3, flush exec" ++ ++ gdb_test "attach $testpid" \ ++ "Attaching to process $testpid.*Reading symbols from $escapedbinfile.*main.*at .*" \ ++ "attach-32 when process' a.out not in cwd" ++ ++ set test "after attach-32-3, exit" ++ gdb_test_multiple "kill" "$test" { ++ -re "Kill the program being debugged.*y or n. $" { ++ gdb_test "y" "" "$test" ++ } ++ } ++ ++ # Another "don't leave a process around" ++ remote_exec build "kill -9 ${testpid}" ++} ++ ++proc do_call_attach_tests {} { ++ global gdb_prompt ++ global binfile2 ++ global testpid ++ ++ # See if other registers are problems ++ ++ set test "info other register" ++ gdb_test_multiple "i r r3" "$test" { ++ -re "warning: reading register.*$gdb_prompt $" { ++ fail "$test" ++ } ++ -re "r3.*$gdb_prompt $" { ++ pass "$test" ++ } ++ } ++ ++ # Get rid of the process ++ ++ gdb_test "p should_exit = 1" ++ gdb_test "c" {\[Inferior .* exited normally\]} ++ ++ # Be paranoid ++ ++ remote_exec build "kill -9 ${testpid}" ++} ++ ++ ++# Start with a fresh gdb ++ ++gdb_exit ++set testpid [eval exec $binfile &] ++exec sleep 3 ++if { [istarget "*-*-cygwin*"] } { ++ # testpid is the Cygwin PID, GDB uses the Windows PID, which might be ++ # different due to the way fork/exec works. ++ set testpid [ exec ps -e | gawk "{ if (\$1 == $testpid) print \$4; }" ] ++} ++ ++set GDBFLAGS_orig $GDBFLAGS ++set GDBFLAGS "-iex \"set height 0\" --pid=$testpid" ++gdb_start ++set GDBFLAGS $GDBFLAGS_orig ++ ++gdb_reinitialize_dir $srcdir/$subdir ++ ++# This is a test of gdb's ability to attach to a running process. ++ ++do_attach_tests ++ ++# Test attaching when the target is inside a system call ++ ++gdb_exit ++set testpid [eval exec $binfile2 &] ++exec sleep 3 ++if { [istarget "*-*-cygwin*"] } { ++ # testpid is the Cygwin PID, GDB uses the Windows PID, which might be ++ # different due to the way fork/exec works. ++ set testpid [ exec ps -e | gawk "{ if (\$1 == $testpid) print \$4; }" ] ++} ++ ++set GDBFLAGS_orig $GDBFLAGS ++set GDBFLAGS "-iex \"set height 0\" --pid=$testpid" ++gdb_start ++set GDBFLAGS $GDBFLAGS_orig ++ ++gdb_reinitialize_dir $srcdir/$subdir ++do_call_attach_tests ++ ++return 0 +diff --git a/gdb/testsuite/gdb.base/attach-32b.c b/gdb/testsuite/gdb.base/attach-32b.c +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.base/attach-32b.c +@@ -0,0 +1,24 @@ ++/* This program is intended to be started outside of gdb, and then ++ attached to by gdb. Thus, it simply spins in a loop. The loop ++ is exited when & if the variable 'should_exit' is non-zero. (It ++ is initialized to zero in this program, so the loop will never ++ exit unless/until gdb sets the variable to non-zero.) ++ */ ++#include ++#include ++#include ++ ++int should_exit = 0; ++ ++int main () ++{ ++ int local_i = 0; ++ ++ sleep( 10 ); /* System call causes register fetch to fail */ ++ /* This is a known HPUX "feature" */ ++ while (! should_exit) ++ { ++ local_i++; ++ } ++ return (0); ++} diff --git a/gdb-6.3-inheritancetest-20050726.patch b/gdb-6.3-inheritancetest-20050726.patch index cb9f7bb..ef7aba2 100644 --- a/gdb-6.3-inheritancetest-20050726.patch +++ b/gdb-6.3-inheritancetest-20050726.patch @@ -17,7 +17,7 @@ diff --git a/gdb/testsuite/gdb.cp/b146835.cc b/gdb/testsuite/gdb.cp/b146835.cc new file mode 100644 --- /dev/null +++ b/gdb/testsuite/gdb.cp/b146835.cc -@@ -0,0 +1,32 @@ +@@ -0,0 +1,31 @@ +#include "b146835.h" +#include + @@ -49,7 +49,6 @@ new file mode 100644 + 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 @@ -71,7 +70,7 @@ new file mode 100644 +# +# 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. ++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Check that GDB can properly print an inherited member variable +# (Bugzilla 146835) diff --git a/gdb-6.3-mapping-zero-inode-test.patch b/gdb-6.3-mapping-zero-inode-test.patch index 9243fef..6fcf76a 100644 --- a/gdb-6.3-mapping-zero-inode-test.patch +++ b/gdb-6.3-mapping-zero-inode-test.patch @@ -150,15 +150,15 @@ new file mode 100644 +# 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. ++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Test GDB's handling of gcore for mapping with a name but zero inode. + diff --git a/gdb-6.3-test-dtorfix-20050121.patch b/gdb-6.3-test-dtorfix-20050121.patch index f9324d6..a3bcaf5 100644 --- a/gdb-6.3-test-dtorfix-20050121.patch +++ b/gdb-6.3-test-dtorfix-20050121.patch @@ -131,7 +131,7 @@ new file mode 100644 +# +# 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. ++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Check that GDB can break at multiple forms of constructors. + @@ -160,7 +160,7 @@ new file mode 100644 +# 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" diff --git a/gdb-6.3-test-movedir-20050125.patch b/gdb-6.3-test-movedir-20050125.patch index 06602b2..1c894c8 100644 --- a/gdb-6.3-test-movedir-20050125.patch +++ b/gdb-6.3-test-movedir-20050125.patch @@ -16,7 +16,7 @@ diff --git a/gdb/testsuite/gdb.base/move-dir.c b/gdb/testsuite/gdb.base/move-dir new file mode 100644 --- /dev/null +++ b/gdb/testsuite/gdb.base/move-dir.c -@@ -0,0 +1,10 @@ +@@ -0,0 +1,9 @@ +#include +#include +#include "move-dir.h" @@ -26,7 +26,6 @@ new file mode 100644 + 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 @@ -39,15 +38,15 @@ new file mode 100644 +# 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. ++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +set testfile "move-dir" +set srcfile ${testfile}.c @@ -93,11 +92,10 @@ diff --git a/gdb/testsuite/gdb.base/move-dir.h b/gdb/testsuite/gdb.base/move-dir new file mode 100644 --- /dev/null +++ b/gdb/testsuite/gdb.base/move-dir.h -@@ -0,0 +1,7 @@ +@@ -0,0 +1,6 @@ +#include + +void other() { + const char* ostring = "other"; + printf ("%s\n", ostring);; +} -+ diff --git a/gdb-6.3-test-pie-20050107.patch b/gdb-6.3-test-pie-20050107.patch deleted file mode 100644 index 09b6726..0000000 --- a/gdb-6.3-test-pie-20050107.patch +++ /dev/null @@ -1,2027 +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-pie-20050107.patch - -;; VSYSCALL and PIE -;;=fedoratest - -diff --git a/gdb/testsuite/gdb.pie/attach.c b/gdb/testsuite/gdb.pie/attach.c -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.pie/attach.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.pie/attach.exp b/gdb/testsuite/gdb.pie/attach.exp -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.pie/attach.exp -@@ -0,0 +1,416 @@ -+# Copyright 1997, 1999, 2002 Free Software Foundation, Inc. -+ -+# This program is free software; you can 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. */ -+ -+# 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 "hppa*-*-hpux*"] } { -+ return 0 -+} -+ -+# are we on a target board -+if [is_remote target] then { -+ return 0 -+} -+ -+set testfile "attach" -+set srcfile ${testfile}.c -+set srcfile2 ${testfile}2.c -+set binfile [standard_output_file ${testfile}] -+set binfile2 [standard_output_file ${testfile}2] -+set escapedbinfile [string_to_regexp [standard_output_file ${testfile}]] -+set cleanupfile [standard_output_file ${testfile}.awk] -+ -+#execute_anywhere "rm -f ${binfile} ${binfile2}" -+remote_exec build "rm -f ${binfile} ${binfile2}" -+# For debugging this test -+# -+#log_user 1 -+ -+# Clean out any old files from past runs. -+# -+remote_exec build "${cleanupfile}" -+ -+# build the first test case -+# -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug "additional_flags= -fpie -pie"}] != "" } { -+ 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 {debug "additional_flags= -fpie -pie"}] != "" } { -+ 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 subdir -+ global timeout -+ -+ # 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 -+ -+ # Verify that we cannot attach to nonsense. -+ # -+ send_gdb "attach abc\n" -+ gdb_expect { -+ -re ".*Illegal process-id: abc.*$gdb_prompt $"\ -+ {pass "attach to nonsense is prohibited"} -+ -re "Attaching to.*, process .*couldn't open /proc file.*$gdb_prompt $"\ -+ { -+ # Response expected from /proc-based systems. -+ pass "attach to nonsense is prohibited" -+ } -+ -re "Attaching to.*$gdb_prompt $"\ -+ {fail "attach to nonsense is prohibited (bogus pid allowed)"} -+ -re "$gdb_prompt $" {fail "attach to nonsense is prohibited"} -+ timeout {fail "(timeout) attach to nonsense is prohibited"} -+ } -+ -+ # Verify that we cannot attach to what appears to be a valid -+ # process ID, but is a process that doesn't exist. Traditionally, -+ # most systems didn't have a process with ID 0, so we take that as -+ # the default. However, there are a few exceptions. -+ # -+ set boguspid 0 -+ if { [istarget "*-*-*bsd*"] } { -+ # In FreeBSD 5.0, PID 0 is used for "swapper". Use -1 instead -+ # (which should have the desired effect on any version of -+ # FreeBSD, and probably other *BSD's too). -+ set boguspid -1 -+ } -+ send_gdb "attach $boguspid\n" -+ gdb_expect { -+ -re "Attaching to.*, process $boguspid.*No such process.*$gdb_prompt $"\ -+ { -+ # Response expected on ptrace-based systems (i.e. HP-UX 10.20). -+ pass "attach to nonexistent process is prohibited" -+ } -+ -re "Attaching to.*, process $boguspid failed.*Hint.*$gdb_prompt $"\ -+ { -+ # Response expected on ttrace-based systems (i.e. HP-UX 11.0). -+ pass "attach to nonexistent process is prohibited" -+ } -+ -re "Attaching to.*, process $boguspid.*denied.*$gdb_prompt $"\ -+ {pass "attach to nonexistent process is prohibited"} -+ -re "Attaching to.*, process $boguspid.*not permitted.*$gdb_prompt $"\ -+ {pass "attach to nonexistent process is prohibited"} -+ -re "Attaching to.*, process .*couldn't open /proc file.*$gdb_prompt $"\ -+ { -+ # Response expected from /proc-based systems. -+ pass "attach to nonexistent process is prohibited" -+ } -+ -re "$gdb_prompt $" {fail "attach to nonexistent process is prohibited"} -+ timeout { -+ fail "(timeout) attach to nonexistent process is prohibited" -+ } -+ } -+ -+ # Verify that we can attach to the process by first giving its -+ # executable name via the file command, and using attach with -+ # the process ID. -+ # -+ # (Actually, the test system appears to do this automatically -+ # for us. So, we must also be prepared to be asked if we want -+ # to discard an existing set of symbols.) -+ # -+ send_gdb "file $binfile\n" -+ gdb_expect { -+ -re "Load new symbol table from.*y or n.*$" { -+ send_gdb "y\n" -+ gdb_expect { -+ -re "Reading symbols from $escapedbinfile\.\.\.*done.*$gdb_prompt $"\ -+ {pass "(re)set file, before attach1"} -+ -re "$gdb_prompt $" {fail "(re)set file, before attach1"} -+ timeout {fail "(timeout) (re)set file, before attach1"} -+ } -+ } -+ -re "Reading symbols from $escapedbinfile\.\.\.*done.*$gdb_prompt $"\ -+ {pass "set file, before attach1"} -+ -re "$gdb_prompt $" {fail "set file, before attach1"} -+ timeout {fail "(timeout) set file, before attach1"} -+ } -+ -+ send_gdb "attach $testpid\n" -+ gdb_expect { -+ -re "Attaching to program.*`?$escapedbinfile'?, process $testpid.*main.*at .*$srcfile:.*$gdb_prompt $"\ -+ {pass "attach1, after setting file"} -+ -re "$gdb_prompt $" {fail "attach1, after setting file"} -+ timeout {fail "(timeout) attach1, after setting file"} -+ } -+ -+ # Verify that we can "see" the variable "should_exit" in the -+ # program, and that it is zero. -+ # -+ send_gdb "print should_exit\n" -+ gdb_expect { -+ -re ".* = 0.*$gdb_prompt $"\ -+ {pass "after attach1, print should_exit"} -+ -re "$gdb_prompt $" {fail "after attach1, print should_exit"} -+ timeout {fail "(timeout) after attach1, print should_exit"} -+ } -+ -+ # Detach the process. -+ # -+ send_gdb "detach\n" -+ gdb_expect { -+ -re "Detaching from program: .*$escapedbinfile.*$gdb_prompt $"\ -+ {pass "attach1 detach"} -+ -re "$gdb_prompt $" {fail "attach1 detach"} -+ timeout {fail "(timeout) attach1 detach"} -+ } -+ -+ # Wait a bit for gdb to finish detaching -+ # -+ exec sleep 5 -+ -+ # Purge the symbols from gdb's brain. (We want to be certain -+ # the next attach, which won't be preceded by a "file" command, -+ # is really getting the executable file without our help.) -+ # -+ set old_timeout $timeout -+ set timeout 15 -+ send_gdb "file\n" -+ gdb_expect { -+ -re ".*gdb internal error.*$" { -+ fail "Internal error, prob. Memory corruption" -+ } -+ -re "No executable file now.*Discard symbol table.*y or n.*$" { -+ send_gdb "y\n" -+ gdb_expect { -+ -re "No symbol file now.*$gdb_prompt $"\ -+ {pass "attach1, purging symbols after detach"} -+ -re "$gdb_prompt $" {fail "attach1, purging symbols after detach"} -+ timeout {fail "(timeout) attach1, purging symbols after detach"} -+ } -+ } -+ -re "$gdb_prompt $" {fail "attach1, purging file after detach"} -+ timeout { -+ fail "(timeout) attach1, purging file after detach" -+ } -+ } -+ set timeout $old_timeout -+ -+ # Verify that we can attach to the process just by giving the -+ # process ID. -+ # -+ send_gdb "attach $testpid\n" -+ gdb_expect { -+ -re "Attaching to process $testpid.*Reading symbols from $escapedbinfile.*main.*at .*$gdb_prompt $"\ -+ {pass "attach2"} -+ -re "$gdb_prompt $" {fail "attach2"} -+ timeout {fail "(timeout) attach2"} -+ } -+ -+ # Verify that we can modify the variable "should_exit" in the -+ # program. -+ # -+ send_gdb "set should_exit=1\n" -+ gdb_expect { -+ -re "$gdb_prompt $" {pass "after attach2, set should_exit"} -+ timeout {fail "(timeout) after attach2, 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 attach2, set tbreak postloop"} -+ -re "$gdb_prompt $" {fail "after attach2, set tbreak postloop"} -+ timeout {fail "(timeout) after attach2, set tbreak postloop"} -+ } -+ send_gdb "continue\n" -+ gdb_expect { -+ -re "main.*at.*$srcfile:19.*$gdb_prompt $"\ -+ {pass "after attach2, reach tbreak postloop"} -+ -re "$gdb_prompt $" {fail "after attach2, reach tbreak postloop"} -+ timeout {fail "(timeout) after attach2, reach tbreak postloop"} -+ } -+ -+ # Allow the test process to exit, to cleanup after ourselves. -+ # -+ gdb_test "continue" {\[Inferior .* exited normally\]} "after attach2, 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 -+ -+ # 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.) -+ # -+ send_gdb "dir [file dirname [standard_output_file ${testfile}]]\n" -+ gdb_expect { -+ -re ".*Source directories searched: .*$gdb_prompt $"\ -+ {pass "set source path"} -+ -re "$gdb_prompt $" {fail "set source path"} -+ timeout {fail "(timeout) set source path"} -+ } -+ -+ send_gdb "cd /tmp\n" -+ gdb_expect { -+ -re ".*Working directory /tmp.*$gdb_prompt $"\ -+ {pass "cd away from process' a.out"} -+ -re "$gdb_prompt $" {fail "cd away from process' a.out"} -+ timeout {fail "(timeout) cd away from process' a.out"} -+ } -+ -+ # Explicitly flush out any knowledge of the previous attachment. -+ send_gdb "symbol\n" -+ gdb_expect { -+ -re ".*Discard symbol table from.*y or n. $"\ -+ {send_gdb "y\n" -+ gdb_expect { -+ -re ".*No symbol file now.*$gdb_prompt $"\ -+ {pass "before attach3, flush symbols"} -+ -re "$gdb_prompt $" {fail "before attach3, flush symbols"} -+ timeout {fail "(timeout) before attach3, flush symbols"} -+ } -+ } -+ -re ".*No symbol file now.*$gdb_prompt $"\ -+ {pass "before attach3, flush symbols"} -+ -re "$gdb_prompt $" {fail "before attach3, flush symbols"} -+ timeout {fail "(timeout) before attach3, flush symbols"} -+ } -+ send_gdb "exec\n" -+ gdb_expect { -+ -re ".*No executable file now.*$gdb_prompt $"\ -+ {pass "before attach3, flush exec"} -+ -re "$gdb_prompt $" {fail "before attach3, flush exec"} -+ timeout {fail "(timeout) before attach3, flush exec"} -+ } -+ -+ send_gdb "attach $testpid\n" -+ gdb_expect { -+ -re "Attaching to process $testpid.*Reading symbols from $escapedbinfile.*main.*at .*$gdb_prompt $"\ -+ {pass "attach when process' a.out not in cwd"} -+ -re "$gdb_prompt $" {fail "attach when process' a.out not in cwd"} -+ timeout {fail "(timeout) attach when process' a.out not in cwd"} -+ } -+ -+ send_gdb "kill\n" -+ gdb_expect { -+ -re ".*Kill the program being debugged.*y or n. $"\ -+ {send_gdb "y\n" -+ gdb_expect { -+ -re "$gdb_prompt $" {pass "after attach3, exit"} -+ timeout {fail "(timeout) after attach3, exit"} -+ } -+ } -+ -re "$gdb_prompt $" {fail "after attach3, exit"} -+ timeout {fail "(timeout) after attach3, exit"} -+ } -+ -+ # Another "don't leave a process around" -+ remote_exec build "kill -9 ${testpid}" -+} -+ -+proc do_call_attach_tests {} { -+ global gdb_prompt -+ global binfile2 -+ -+ # Start the program running and then wait for a bit, to be sure -+ # that it can be attached to. -+ # -+ set testpid [eval exec $binfile2 &] -+ exec sleep 2 -+ -+ # Attach -+ # -+ gdb_test "file $binfile2" ".*" "force switch to gdb64, if necessary" -+ send_gdb "attach $testpid\n" -+ gdb_expect { -+ -re ".*warning: reading register.*I.*O error.*$gdb_prompt $" { -+ fail "attach call, read register 3 error" -+ } -+ -re "Attaching to.*process $testpid.*$gdb_prompt $" { -+ # libc is relocated, not relocated, therefore not printed. -+ pass "attach call" -+ } -+ -re "$gdb_prompt $" {fail "attach call"} -+ timeout {fail "(timeout) attach call"} -+ } -+ -+ # See if other registers are problems -+ # -+ send_gdb "i r r3\n" -+ gdb_expect { -+ -re ".*warning: reading register.*$gdb_prompt $" { -+ pass "CHFts23490: known bug" -+ } -+ -re ".*r3.*$gdb_prompt $" { -+ pass "Bug fixed, Yayyy!" -+ } -+ timeout { fail "timeout on info reg" } -+ } -+ -+ # 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 -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfile} -+ -+# 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 -+gdb_start -+ -+gdb_reinitialize_dir $srcdir/$subdir -+do_call_attach_tests -+ -+return 0 -diff --git a/gdb/testsuite/gdb.pie/attach2.c b/gdb/testsuite/gdb.pie/attach2.c -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.pie/attach2.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/testsuite/gdb.pie/break.c b/gdb/testsuite/gdb.pie/break.c -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.pie/break.c -@@ -0,0 +1,146 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 1992, 1993, 1994, 1995, 1999, 2002, 2003 Free Software -+ Foundation, Inc. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 2 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program; if not, write to the Free Software -+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -+ -+ Please email any bugs, comments, and/or additions to this file to: -+ bug-gdb@prep.ai.mit.edu */ -+ -+#ifdef vxworks -+ -+# include -+ -+/* VxWorks does not supply atoi. */ -+static int -+atoi (z) -+ char *z; -+{ -+ int i = 0; -+ -+ while (*z >= '0' && *z <= '9') -+ i = i * 10 + (*z++ - '0'); -+ return i; -+} -+ -+/* I don't know of any way to pass an array to VxWorks. This function -+ can be called directly from gdb. */ -+ -+vxmain (arg) -+char *arg; -+{ -+ char *argv[2]; -+ -+ argv[0] = ""; -+ argv[1] = arg; -+ main (2, argv, (char **) 0); -+} -+ -+#else /* ! vxworks */ -+# include -+# include -+#endif /* ! vxworks */ -+ -+#ifdef PROTOTYPES -+extern int marker1 (void); -+extern int marker2 (int a); -+extern void marker3 (char *a, char *b); -+extern void marker4 (long d); -+#else -+extern int marker1 (); -+extern int marker2 (); -+extern void marker3 (); -+extern void marker4 (); -+#endif -+ -+/* -+ * This simple classical example of recursion is useful for -+ * testing stack backtraces and such. -+ */ -+ -+#ifdef PROTOTYPES -+int factorial(int); -+ -+int -+main (int argc, char **argv, char **envp) -+#else -+int -+main (argc, argv, envp) -+int argc; -+char *argv[], **envp; -+#endif -+{ -+#ifdef usestubs -+ set_debug_traps(); /* set breakpoint 5 here */ -+ breakpoint(); -+#endif -+ if (argc == 12345) { /* an unlikely value < 2^16, in case uninited */ /* set breakpoint 6 here */ -+ fprintf (stderr, "usage: factorial \n"); -+ return 1; -+ } -+ printf ("%d\n", factorial (atoi ("6"))); /* set breakpoint 1 here */ -+ /* set breakpoint 12 here */ -+ marker1 (); /* set breakpoint 11 here */ -+ marker2 (43); /* set breakpoint 20 here */ -+ marker3 ("stack", "trace"); /* set breakpoint 21 here */ -+ marker4 (177601976L); -+ argc = (argc == 12345); /* This is silly, but we can step off of it */ /* set breakpoint 2 here */ -+ return argc; /* set breakpoint 10 here */ -+} -+ -+#ifdef PROTOTYPES -+int factorial (int value) -+#else -+int factorial (value) -+int value; -+#endif -+{ -+ if (value > 1) { /* set breakpoint 7 here */ -+ value *= factorial (value - 1); -+ } -+ return (value); /* set breakpoint 19 here */ -+} -+ -+#ifdef PROTOTYPES -+int multi_line_if_conditional (int a, int b, int c) -+#else -+int multi_line_if_conditional (a, b, c) -+ int a, b, c; -+#endif -+{ -+ if (a /* set breakpoint 3 here */ -+ && b -+ && c) -+ return 0; -+ else -+ return 1; -+} -+ -+#ifdef PROTOTYPES -+int multi_line_while_conditional (int a, int b, int c) -+#else -+int multi_line_while_conditional (a, b, c) -+ int a, b, c; -+#endif -+{ -+ while (a /* set breakpoint 4 here */ -+ && b -+ && c) -+ { -+ a--, b--, c--; -+ } -+ return 0; -+} -diff --git a/gdb/testsuite/gdb.pie/break.exp b/gdb/testsuite/gdb.pie/break.exp -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.pie/break.exp -@@ -0,0 +1,954 @@ -+# Copyright 1988, 1990, 1991, 1992, 1994, 1995, 1996, 1997, 1998, 1999, -+# 2000, 2002, 2003, 2004 -+# Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 2 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program; if not, write to the Free Software -+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -+ -+# Please email any bugs, comments, and/or additions to this file to: -+# bug-gdb@prep.ai.mit.edu -+ -+# This file was written by Rob Savoye. (rob@cygnus.com) -+ -+# Test the same stuff but with PIE executables -+ -+set testfile "break" -+set srcfile ${testfile}.c -+set srcfile1 ${testfile}1.c -+set binfile [standard_output_file ${testfile}] -+ -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}0.o" object {debug "additional_flags=-w -fpie -pie"}] != "" } { -+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." -+} -+ -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile1}" "${binfile}1.o" object {debug "additional_flags=-w -fpie -pie"}] != "" } { -+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." -+} -+ -+if { [gdb_compile "${binfile}0.o ${binfile}1.o" "${binfile}" executable {debug "additional_flags=-w -fpie -pie"}] != "" } { -+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." -+} -+ -+if [get_compiler_info ${binfile}] { -+ return -1 -+} -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfile} -+ -+if [target_info exists gdb_stub] { -+ gdb_step_for_stub; -+} -+# -+# test simple breakpoint setting commands -+# -+ -+# Test deleting all breakpoints when there are none installed, -+# GDB should not prompt for confirmation. -+# Note that gdb-init.exp provides a "delete_breakpoints" proc -+# for general use elsewhere. -+ -+send_gdb "delete breakpoints\n" -+gdb_expect { -+ -re "Delete all breakpoints.*$" { -+ send_gdb "y\n" -+ gdb_expect { -+ -re "$gdb_prompt $" { -+ fail "Delete all breakpoints when none (unexpected prompt)" -+ } -+ timeout { fail "Delete all breakpoints when none (timeout after unexpected prompt)" } -+ } -+ } -+ -re ".*$gdb_prompt $" { pass "Delete all breakpoints when none" } -+ timeout { fail "Delete all breakpoints when none (timeout)" } -+} -+ -+# -+# test break at function -+# -+gdb_test "break main" \ -+ "Breakpoint.*at.* file .*$srcfile, line.*" \ -+ "breakpoint function" -+ -+# -+# test break at quoted function -+# -+gdb_test "break \"marker2\"" \ -+ "Breakpoint.*at.* file .*$srcfile1, line.*" \ -+ "breakpoint quoted function" -+ -+# -+# test break at function in file -+# -+gdb_test "break $srcfile:factorial" \ -+ "Breakpoint.*at.* file .*$srcfile, line.*" \ -+ "breakpoint function in file" -+ -+set bp_location1 [gdb_get_line_number "set breakpoint 1 here"] -+ -+# -+# test break at line number -+# -+# Note that the default source file is the last one whose source text -+# was printed. For native debugging, before we've executed the -+# program, this is the file containing main, but for remote debugging, -+# it's wherever the processor was stopped when we connected to the -+# board. So, to be sure, we do a list command. -+# -+gdb_test "list main" \ -+ ".*main \\(argc, argv, envp\\).*" \ -+ "use `list' to establish default source file" -+gdb_test "break $bp_location1" \ -+ "Breakpoint.*at.* file .*$srcfile, line $bp_location1\\." \ -+ "breakpoint line number" -+ -+# -+# test duplicate breakpoint -+# -+gdb_test "break $bp_location1" \ -+ "Note: breakpoint \[0-9\]+ also set at pc.*Breakpoint \[0-9\]+ at.* file .*$srcfile, line $bp_location1\\." \ -+ "breakpoint duplicate" -+ -+set bp_location2 [gdb_get_line_number "set breakpoint 2 here"] -+ -+# -+# test break at line number in file -+# -+gdb_test "break $srcfile:$bp_location2" \ -+ "Breakpoint.*at.* file .*$srcfile, line $bp_location2\\." \ -+ "breakpoint line number in file" -+ -+set bp_location3 [gdb_get_line_number "set breakpoint 3 here"] -+set bp_location4 [gdb_get_line_number "set breakpoint 4 here"] -+ -+# -+# Test putting a break at the start of a multi-line if conditional. -+# Verify the breakpoint was put at the start of the conditional. -+# -+gdb_test "break multi_line_if_conditional" \ -+ "Breakpoint.*at.* file .*$srcfile, line $bp_location3\\." \ -+ "breakpoint at start of multi line if conditional" -+ -+gdb_test "break multi_line_while_conditional" \ -+ "Breakpoint.*at.* file .*$srcfile, line $bp_location4\\." \ -+ "breakpoint at start of multi line while conditional" -+ -+set bp_location5 [gdb_get_line_number "set breakpoint 5 here"] -+set bp_location6 [gdb_get_line_number "set breakpoint 6 here"] -+ -+# -+# check to see what breakpoints are set -+# -+if [target_info exists gdb_stub] { -+ set main_line $bp_location5 -+} else { -+ set main_line $bp_location6 -+} -+ -+set proto "" -+ -+set bp_location7 [gdb_get_line_number "set breakpoint 7 here"] -+set bp_location8 [gdb_get_line_number "set breakpoint 8 here" $srcfile1] -+set bp_location9 [gdb_get_line_number "set breakpoint 9 here" $srcfile1] -+ -+# Test a pending breakpoint in PIE executable does not crash later GDB. -+gdb_breakpoint "non_existent_function" allow-pending -+ -+gdb_test "info break" \ -+ "Num\[ \]+Type\[ \]+Disp Enb Address\[ \]+What.* -+\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$main_line.* -+\[0-9\]+\[\t \]+breakpoint keep y.* in marker2 at .*$srcfile1:($bp_location8|$bp_location9).* -+\[0-9\]+\[\t \]+breakpoint keep y.* in factorial$proto at .*$srcfile:$bp_location7.* -+\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$bp_location1.* -+\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$bp_location1.* -+\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$bp_location2.* -+\[0-9\]+\[\t \]+breakpoint keep y.* in multi_line_if_conditional at .*$srcfile:$bp_location3.* -+\[0-9\]+\[\t \]+breakpoint keep y.* in multi_line_while_conditional at .*$srcfile:$bp_location4.* -+\[0-9\]+\[\t \]+breakpoint keep y.* *non_existent_function" \ -+ "breakpoint info" -+ -+# FIXME: The rest of this test doesn't work with anything that can't -+# handle arguments. -+# Huh? There doesn't *appear* to be anything that passes arguments -+# below. -+if [istarget "mips-idt-*"] then { -+ return -+} -+ -+# -+# run until the breakpoint at main is hit. For non-stubs-using targets. -+# -+if ![target_info exists use_gdb_stub] { -+ if [istarget "*-*-vxworks*"] then { -+ send_gdb "run vxmain \"2\"\n" -+ set timeout 120 -+ verbose "Timeout is now $timeout seconds" 2 -+ } else { -+ send_gdb "run\n" -+ } -+ gdb_expect { -+ -re "The program .* has been started already.*y or n. $" { -+ send_gdb "y\n" -+ exp_continue -+ } -+ -re "Starting program.*Breakpoint \[0-9\]+,.*main .*argc.*argv.* at .*$srcfile:$bp_location6.*$bp_location6\[\t \]+if .argc.* \{.*$gdb_prompt $"\ -+ { pass "run until function breakpoint" } -+ -re ".*$gdb_prompt $" { fail "run until function breakpoint" } -+ timeout { fail "run until function breakpoint (timeout)" } -+ } -+} else { -+ if ![target_info exists gdb_stub] { -+ gdb_test continue ".*Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:$bp_location6.*$bp_location6\[\t \]+if .argc.*\{.*" "stub continue" -+ } -+} -+ -+# -+# run until the breakpoint at a line number -+# -+gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:$bp_location1.*$bp_location1\[\t \]+printf.*factorial.*" \ -+ "run until breakpoint set at a line number" -+ -+# -+# Run until the breakpoint set in a function in a file -+# -+for {set i 6} {$i >= 1} {incr i -1} { -+ gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, factorial \\(value=$i\\) at .*$srcfile:$bp_location7.*$bp_location7\[\t \]+.*if .value > 1. \{.*" \ -+ "run until file:function($i) breakpoint" -+} -+ -+# -+# Run until the breakpoint set at a quoted function -+# -+gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, (0x\[0-9a-f\]+ in )?marker2 \\(a=43\\) at .*$srcfile1:($bp_location8|$bp_location9).*" \ -+ "run until quoted breakpoint" -+# -+# run until the file:function breakpoint at a line number in a file -+# -+gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:$bp_location2.*$bp_location2\[\t \]+argc = \\(argc == 12345\\);.*" \ -+ "run until file:linenum breakpoint" -+ -+# Test break at offset +1 -+set bp_location10 [gdb_get_line_number "set breakpoint 10 here"] -+ -+gdb_test "break +1" \ -+ "Breakpoint.*at.* file .*$srcfile, line $bp_location10\\." \ -+ "breakpoint offset +1" -+ -+# Check to see if breakpoint is hit when stepped onto -+ -+gdb_test "step" \ -+ ".*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:$bp_location10.*$bp_location10\[\t \]+return argc;.*breakpoint 10 here.*" \ -+ "step onto breakpoint" -+ -+# -+# delete all breakpoints so we can start over, course this can be a test too -+# -+delete_breakpoints -+ -+# -+# test temporary breakpoint at function -+# -+ -+gdb_test "tbreak main" "reakpoint.*at.* file .*$srcfile, line.*" "Temporary breakpoint function" -+ -+# -+# test break at function in file -+# -+ -+gdb_test "tbreak $srcfile:factorial" "reakpoint.*at.* file .*$srcfile, line.*" \ -+ "Temporary breakpoint function in file" -+ -+# -+# test break at line number -+# -+send_gdb "tbreak $bp_location1\n" -+gdb_expect { -+ -re "reakpoint.*at.* file .*$srcfile, line $bp_location1.*$gdb_prompt $" { pass "Temporary breakpoint line number #1" } -+ -re ".*$gdb_prompt $" { pass "Temporary breakpoint line number #1" } -+ timeout { fail "breakpoint line number #1 (timeout)" } -+} -+ -+gdb_test "tbreak $bp_location6" "reakpoint.*at.* file .*$srcfile, line $bp_location6.*" "Temporary breakpoint line number #2" -+ -+# -+# test break at line number in file -+# -+send_gdb "tbreak $srcfile:$bp_location2\n" -+gdb_expect { -+ -re "reakpoint.*at.* file .*$srcfile, line $bp_location2.*$gdb_prompt $" { pass "Temporary breakpoint line number in file #1" } -+ -re ".*$gdb_prompt $" { pass "Temporary breakpoint line number in file #1" } -+ timeout { fail "Temporary breakpoint line number in file #1 (timeout)" } -+} -+ -+set bp_location11 [gdb_get_line_number "set breakpoint 11 here"] -+gdb_test "tbreak $srcfile:$bp_location11" "reakpoint.*at.* file .*$srcfile, line $bp_location11.*" "Temporary breakpoint line number in file #2" -+ -+# -+# check to see what breakpoints are set (temporary this time) -+# -+gdb_test "info break" "Num.*Type.*Disp Enb Address.*What.*\[\r\n\] -+\[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:$main_line.*\[\r\n\] -+\[0-9\]+\[\t \]+breakpoint del.*y.*in factorial$proto at .*$srcfile:$bp_location7.*\[\r\n\] -+\[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:$bp_location1.*\[\r\n\] -+\[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:$bp_location6.*\[\r\n\] -+\[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:$bp_location2.*\[\r\n\] -+\[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:$bp_location11.*" \ -+ "Temporary breakpoint info" -+ -+ -+#*********** -+ -+# Verify that catchpoints for fork, vfork and exec don't trigger -+# inappropriately. (There are no calls to those system functions -+# in this test program.) -+# -+if ![runto_main] then { fail "break tests suppressed" } -+ -+send_gdb "catch\n" -+gdb_expect { -+ -re "Catch requires an event name.*$gdb_prompt $"\ -+ {pass "catch requires an event name"} -+ -re "$gdb_prompt $"\ -+ {fail "catch requires an event name"} -+ timeout {fail "(timeout) catch requires an event name"} -+} -+ -+ -+set name "set catch fork, never expected to trigger" -+send_gdb "catch fork\n" -+gdb_expect { -+ -re "Catchpoint \[0-9\]* .fork..*$gdb_prompt $" -+ {pass $name} -+ -re "Catch of fork not yet implemented.*$gdb_prompt $" -+ {pass $name} -+ -re "$gdb_prompt $" -+ {fail $name} -+ timeout {fail "(timeout) $name"} -+} -+ -+ -+set name "set catch vfork, never expected to trigger" -+send_gdb "catch vfork\n" -+ -+# If we are on HP-UX 10.20, we expect an error message to be -+# printed if we type "catch vfork" at the gdb gdb_prompt. This is -+# because on HP-UX 10.20, we cannot catch vfork events. -+ -+if [istarget "hppa*-hp-hpux10.20"] then { -+ gdb_expect { -+ -re "Catch of vfork events not supported on HP-UX 10.20..*$gdb_prompt $" -+ {pass $name} -+ -re "$gdb_prompt $" -+ {fail $name} -+ timeout {fail "(timeout) $name"} -+ } -+} else { -+ gdb_expect { -+ -re "Catchpoint \[0-9\]* .vfork..*$gdb_prompt $" -+ {pass $name} -+ -re "Catch of vfork not yet implemented.*$gdb_prompt $" -+ {pass $name} -+ -re "$gdb_prompt $" -+ {fail $name} -+ timeout {fail "(timeout) $name"} -+ } -+} -+ -+set name "set catch exec, never expected to trigger" -+send_gdb "catch exec\n" -+gdb_expect { -+ -re "Catchpoint \[0-9\]* .exec..*$gdb_prompt $" -+ {pass $name} -+ -re "Catch of exec not yet implemented.*$gdb_prompt $" -+ {pass $name} -+ -re "$gdb_prompt $" {fail $name} -+ timeout {fail "(timeout) $name"} -+} -+ -+# Verify that GDB responds gracefully when asked to set a breakpoint -+# on a nonexistent source line. -+# -+gdb_test_no_output "set breakpoint pending off" -+gdb_test "break 999" \ -+ "No line 999 in the current file." \ -+ "break on non-existent source line" -+ -+# Run to the desired default location. If not positioned here, the -+# tests below don't work. -+# -+gdb_test "until $bp_location1" "main .* at .*:$bp_location1.*" "until bp_location1" -+ -+ -+# Verify that GDB allows one to just say "break", which is treated -+# as the "default" breakpoint. Note that GDB gets cute when printing -+# the informational message about other breakpoints at the same -+# location. We'll hit that bird with this stone too. -+# -+send_gdb "break\n" -+gdb_expect { -+ -re "Breakpoint \[0-9\]*.*$gdb_prompt $"\ -+ {pass "break on default location, 1st time"} -+ -re "$gdb_prompt $"\ -+ {fail "break on default location, 1st time"} -+ timeout {fail "(timeout) break on default location, 1st time"} -+} -+ -+send_gdb "break\n" -+gdb_expect { -+ -re "Note: breakpoint \[0-9\]* also set at .*Breakpoint \[0-9\]*.*$gdb_prompt $"\ -+ {pass "break on default location, 2nd time"} -+ -re "$gdb_prompt $"\ -+ {fail "break on default location, 2nd time"} -+ timeout {fail "(timeout) break on default location, 2nd time"} -+} -+ -+send_gdb "break\n" -+gdb_expect { -+ -re "Note: breakpoints \[0-9\]* and \[0-9\]* also set at .*Breakpoint \[0-9\]*.*$gdb_prompt $"\ -+ {pass "break on default location, 3rd time"} -+ -re "$gdb_prompt $"\ -+ {fail "break on default location, 3rd time"} -+ timeout {fail "(timeout) break on default location, 3rd time"} -+} -+ -+send_gdb "break\n" -+gdb_expect { -+ -re "Note: breakpoints \[0-9\]*, \[0-9\]* and \[0-9\]* also set at .*Breakpoint \[0-9\]*.*$gdb_prompt $"\ -+ {pass "break on default location, 4th time"} -+ -re "$gdb_prompt $"\ -+ {fail "break on default location, 4th time"} -+ timeout {fail "(timeout) break on default location, 4th time"} -+} -+ -+# Verify that a "silent" breakpoint can be set, and that GDB is indeed -+# "silent" about its triggering. -+# -+if ![runto_main] then { fail "break tests suppressed" } -+ -+send_gdb "break $bp_location1\n" -+gdb_expect { -+ -re "Breakpoint (\[0-9\]*) at .*, line $bp_location1.*$gdb_prompt $"\ -+ {pass "set to-be-silent break bp_location1"} -+ -re "$gdb_prompt $"\ -+ {fail "set to-be-silent break bp_location1"} -+ timeout {fail "(timeout) set to-be-silent break bp_location1"} -+} -+ -+send_gdb "commands $expect_out(1,string)\n" -+send_gdb "silent\n" -+send_gdb "end\n" -+gdb_expect { -+ -re ".*$gdb_prompt $"\ -+ {pass "set silent break bp_location1"} -+ timeout {fail "(timeout) set silent break bp_location1"} -+} -+ -+send_gdb "info break $expect_out(1,string)\n" -+gdb_expect { -+ -re "\[0-9\]*\[ \t\]*breakpoint.*:$bp_location1\r\n\[ \t\]*silent.*$gdb_prompt $"\ -+ {pass "info silent break bp_location1"} -+ -re "$gdb_prompt $"\ -+ {fail "info silent break bp_location1"} -+ timeout {fail "(timeout) info silent break bp_location1"} -+} -+send_gdb "continue\n" -+gdb_expect { -+ -re "Continuing.\r\n$gdb_prompt $"\ -+ {pass "hit silent break bp_location1"} -+ -re "$gdb_prompt $"\ -+ {fail "hit silent break bp_location1"} -+ timeout {fail "(timeout) hit silent break bp_location1"} -+} -+send_gdb "bt\n" -+gdb_expect { -+ -re "#0 main .* at .*:$bp_location1.*$gdb_prompt $"\ -+ {pass "stopped for silent break bp_location1"} -+ -re "$gdb_prompt $"\ -+ {fail "stopped for silent break bp_location1"} -+ timeout {fail "(timeout) stopped for silent break bp_location1"} -+} -+ -+# Verify that GDB can at least parse a breakpoint with the -+# "thread" keyword. (We won't attempt to test here that a -+# thread-specific breakpoint really triggers appropriately. -+# The gdb.threads subdirectory contains tests for that.) -+# -+set bp_location12 [gdb_get_line_number "set breakpoint 12 here"] -+send_gdb "break $bp_location12 thread 999\n" -+gdb_expect { -+ -re "Unknown thread 999.*$gdb_prompt $"\ -+ {pass "thread-specific breakpoint on non-existent thread disallowed"} -+ -re "$gdb_prompt $"\ -+ {fail "thread-specific breakpoint on non-existent thread disallowed"} -+ timeout {fail "(timeout) thread-specific breakpoint on non-existent thread disallowed"} -+} -+ -+gdb_test "break $bp_location12 thread foo" \ -+ "Invalid thread ID: foo" \ -+ "thread-specific breakpoint on bogus thread ID disallowed" -+ -+# Verify that GDB responds gracefully to a breakpoint command with -+# trailing garbage. -+# -+send_gdb "break $bp_location12 foo\n" -+gdb_expect { -+ -re "malformed linespec error: unexpected string, \"foo\"\r\n$gdb_prompt $"\ -+ {pass "breakpoint with trailing garbage disallowed"} -+ -re "$gdb_prompt $"\ -+ {fail "breakpoint with trailing garbage disallowed"} -+ timeout {fail "(timeout) breakpoint with trailing garbage disallowed"} -+} -+ -+# Verify that GDB responds gracefully to a "clear" command that has -+# no matching breakpoint. (First, get us off the current source line, -+# which we know has a breakpoint.) -+# -+send_gdb "next\n" -+gdb_expect { -+ -re ".*$gdb_prompt $"\ -+ {pass "step over breakpoint"} -+ timeout {fail "(timeout) step over breakpoint"} -+} -+send_gdb "clear 81\n" -+gdb_expect { -+ -re "No breakpoint at 81..*$gdb_prompt $"\ -+ {pass "clear line has no breakpoint disallowed"} -+ -re "$gdb_prompt $"\ -+ {fail "clear line has no breakpoint disallowed"} -+ timeout {fail "(timeout) clear line has no breakpoint disallowed"} -+} -+send_gdb "clear\n" -+gdb_expect { -+ -re "No breakpoint at this line..*$gdb_prompt $"\ -+ {pass "clear current line has no breakpoint disallowed"} -+ -re "$gdb_prompt $"\ -+ {fail "clear current line has no breakpoint disallowed"} -+ timeout {fail "(timeout) clear current line has no breakpoint disallowed"} -+} -+ -+# Verify that we can set and clear multiple breakpoints. -+# -+# We don't test that it deletes the correct breakpoints. We do at -+# least test that it deletes more than one breakpoint. -+# -+gdb_test "break marker3" "Breakpoint.*at.*" "break marker3 #1" -+gdb_test "break marker3" "Breakpoint.*at.*" "break marker3 #2" -+gdb_test "clear marker3" {Deleted breakpoints [0-9]+ [0-9]+.*} -+ -+# Verify that a breakpoint can be set via a convenience variable. -+# -+send_gdb "set \$foo=$bp_location11\n" -+gdb_expect { -+ -re "$gdb_prompt $"\ -+ {pass "set convenience variable \$foo to bp_location11"} -+ timeout {fail "(timeout) set convenience variable \$foo to bp_location11"} -+} -+send_gdb "break \$foo\n" -+gdb_expect { -+ -re "Breakpoint (\[0-9\]*) at .*, line $bp_location11.*$gdb_prompt $"\ -+ {pass "set breakpoint via convenience variable"} -+ -re "$gdb_prompt $"\ -+ {fail "set breakpoint via convenience variable"} -+ timeout {fail "(timeout) set breakpoint via convenience variable"} -+} -+ -+# Verify that GDB responds gracefully to an attempt to set a -+# breakpoint via a convenience variable whose type is not integer. -+# -+send_gdb "set \$foo=81.5\n" -+gdb_expect { -+ -re "$gdb_prompt $"\ -+ {pass "set convenience variable \$foo to 81.5"} -+ timeout {fail "(timeout) set convenience variable \$foo to 81.5"} -+} -+send_gdb "break \$foo\n" -+gdb_expect { -+ -re "Convenience variables used in line specs must have integer values..*$gdb_prompt $"\ -+ {pass "set breakpoint via non-integer convenience variable disallowed"} -+ -re "$gdb_prompt $"\ -+ {fail "set breakpoint via non-integer convenience variable disallowed"} -+ timeout {fail "(timeout) set breakpoint via non-integer convenience variable disallowed"} -+} -+ -+# Verify that we can set and trigger a breakpoint in a user-called function. -+# -+send_gdb "break marker2\n" -+gdb_expect { -+ -re "Breakpoint (\[0-9\]*) at .*, line ($bp_location8|$bp_location9).*$gdb_prompt $"\ -+ {pass "set breakpoint on to-be-called function"} -+ -re "$gdb_prompt $"\ -+ {fail "set breakpoint on to-be-called function"} -+ timeout {fail "(timeout) set breakpoint on to-be-called function"} -+} -+send_gdb "print marker2(99)\n" -+gdb_expect { -+ -re "The program being debugged stopped while in a function called from GDB.\r\nEvaluation of the expression containing the function\r\n.marker2$proto. will be abandoned.\r\nWhen the function is done executing, GDB will silently stop.\r\n$gdb_prompt $"\ -+ {pass "hit breakpoint on called function"} -+ -re "$gdb_prompt $"\ -+ {fail "hit breakpoint on called function"} -+ timeout {fail "(timeout) hit breakpoint on called function"} -+} -+ -+# As long as we're stopped (breakpointed) in a called function, -+# verify that we can successfully backtrace & such from here. -+# -+# In this and the following test, the _sr4export check apparently is needed -+# for hppa*-*-hpux. -+# -+send_gdb "bt\n" -+gdb_expect { -+ -re "#0\[ \t\]*($hex in )?marker2.*:($bp_location8|$bp_location9)\r\n#1.*_sr4export.*$gdb_prompt $"\ -+ {pass "backtrace while in called function"} -+ -re "#0\[ \t\]*($hex in )?marker2.*:($bp_location8|$bp_location9)\r\n#1.*function called from gdb.*$gdb_prompt $"\ -+ {pass "backtrace while in called function"} -+ -re "$gdb_prompt $"\ -+ {fail "backtrace while in called function"} -+ timeout {fail "(timeout) backtrace while in called function"} -+} -+ -+# Return from the called function. For remote targets, it's important to do -+# this before runto_main, which otherwise may silently stop on the dummy -+# breakpoint inserted by GDB at the program's entry point. -+# -+send_gdb "finish\n" -+gdb_expect { -+ -re "Run till exit from .*marker2.* at .*($bp_location8|$bp_location9)\r\n.* in _sr4export.*$gdb_prompt $"\ -+ {pass "finish from called function"} -+ -re "Run till exit from .*marker2.* at .*($bp_location8|$bp_location9)\r\n.*function called from gdb.*$gdb_prompt $"\ -+ {pass "finish from called function"} -+ -re "Run till exit from .*marker2.* at .*($bp_location8|$bp_location9)\r\n.*Value returned.*$gdb_prompt $"\ -+ {pass "finish from called function"} -+ -re "$gdb_prompt $"\ -+ {fail "finish from called function"} -+ timeout {fail "(timeout) finish from called function"} -+} -+ -+# Verify that GDB responds gracefully to a "finish" command with -+# arguments. -+# -+if ![runto_main] then { fail "break tests suppressed" } -+ -+send_gdb "finish 123\n" -+gdb_expect { -+ -re "The \"finish\" command does not take any arguments.\r\n$gdb_prompt $"\ -+ {pass "finish with arguments disallowed"} -+ -re "$gdb_prompt $"\ -+ {fail "finish with arguments disallowed"} -+ timeout {fail "(timeout) finish with arguments disallowed"} -+} -+ -+# Verify that GDB responds gracefully to a request to "finish" from -+# the outermost frame. On a stub that never exits, this will just -+# run to the stubs routine, so we don't get this error... Thus the -+# second condition. -+# -+ -+send_gdb "finish\n" -+gdb_expect { -+ -re "\"finish\" not meaningful in the outermost frame.\r\n$gdb_prompt $"\ -+ {pass "finish from outermost frame disallowed"} -+ -re "Run till exit from.*\r\n$gdb_prompt $" { -+ pass "finish from outermost frame disallowed" -+ } -+ -re "$gdb_prompt $"\ -+ {fail "finish from outermost frame disallowed"} -+ timeout {fail "(timeout) finish from outermost frame disallowed"} -+} -+ -+# Verify that we can explicitly ask GDB to stop on all shared library -+# events, and that it does so. -+# -+if [istarget "hppa*-*-hpux*"] then { -+ if ![runto_main] then { fail "break tests suppressed" } -+ -+ send_gdb "set stop-on-solib-events 1\n" -+ gdb_expect { -+ -re "$gdb_prompt $"\ -+ {pass "set stop-on-solib-events"} -+ timeout {fail "(timeout) set stop-on-solib-events"} -+ } -+ -+ send_gdb "run\n" -+ gdb_expect { -+ -re ".*Start it from the beginning.*y or n. $"\ -+ {send_gdb "y\n" -+ gdb_expect { -+ -re ".*Stopped due to shared library event.*$gdb_prompt $"\ -+ {pass "triggered stop-on-solib-events"} -+ -re "$gdb_prompt $"\ -+ {fail "triggered stop-on-solib-events"} -+ timeout {fail "(timeout) triggered stop-on-solib-events"} -+ } -+ } -+ -re "$gdb_prompt $"\ -+ {fail "rerun for stop-on-solib-events"} -+ timeout {fail "(timeout) rerun for stop-on-solib-events"} -+ } -+ -+ send_gdb "set stop-on-solib-events 0\n" -+ gdb_expect { -+ -re "$gdb_prompt $"\ -+ {pass "reset stop-on-solib-events"} -+ timeout {fail "(timeout) reset stop-on-solib-events"} -+ } -+} -+ -+# Hardware breakpoints are unsupported on HP-UX. Verify that GDB -+# gracefully responds to requests to create them. -+# -+if [istarget "hppa*-*-hpux*"] then { -+ if ![runto_main] then { fail "break tests suppressed" } -+ -+ send_gdb "hbreak\n" -+ gdb_expect { -+ -re "No hardware breakpoint support in the target.*$gdb_prompt $"\ -+ {pass "hw breaks disallowed"} -+ -re "$gdb_prompt $"\ -+ {fail "hw breaks disallowed"} -+ timeout {fail "(timeout) hw breaks disallowed"} -+ } -+ -+ send_gdb "thbreak\n" -+ gdb_expect { -+ -re "No hardware breakpoint support in the target.*$gdb_prompt $"\ -+ {pass "temporary hw breaks disallowed"} -+ -re "$gdb_prompt $"\ -+ {fail "temporary hw breaks disallowed"} -+ timeout {fail "(timeout) temporary hw breaks disallowed"} -+ } -+} -+ -+#******** -+ -+ -+# -+# Test "next" over recursive function call. -+# -+ -+proc test_next_with_recursion {} { -+ global gdb_prompt -+ global decimal -+ global binfile -+ -+ if [target_info exists use_gdb_stub] { -+ # Reload the program. -+ delete_breakpoints -+ gdb_load ${binfile}; -+ } else { -+ # FIXME: should be using runto -+ gdb_test "kill" "" "kill program" "Kill the program being debugged.*y or n. $" "y" -+ -+ delete_breakpoints -+ } -+ -+ gdb_test "break factorial" "Breakpoint $decimal at .*" "break at factorial" -+ -+ # Run until we call factorial with 6 -+ -+ if [istarget "*-*-vxworks*"] then { -+ send_gdb "run vxmain \"6\"\n" -+ } else { -+ gdb_run_cmd -+ } -+ gdb_expect { -+ -re "Break.* factorial .value=6. .*$gdb_prompt $" {} -+ -re ".*$gdb_prompt $" { -+ fail "run to factorial(6)"; -+ gdb_suppress_tests; -+ } -+ timeout { fail "run to factorial(6) (timeout)" ; gdb_suppress_tests } -+ } -+ -+ # Continue until we call factorial recursively with 5. -+ -+ if [gdb_test "continue" \ -+ "Continuing.*Break.* factorial .value=5. .*" \ -+ "continue to factorial(5)"] then { gdb_suppress_tests } -+ -+ # Do a backtrace just to confirm how many levels deep we are. -+ -+ if [gdb_test "backtrace" \ -+ "#0\[ \t\]+ factorial .value=5..*" \ -+ "backtrace from factorial(5)"] then { gdb_suppress_tests } -+ -+ # Now a "next" should position us at the recursive call, which -+ # we will be performing with 4. -+ -+ if [gdb_test "next" \ -+ ".* factorial .value - 1.;.*" \ -+ "next to recursive call"] then { gdb_suppress_tests } -+ -+ # Disable the breakpoint at the entry to factorial by deleting them all. -+ # The "next" should run until we return to the next line from this -+ # recursive call to factorial with 4. -+ # Buggy versions of gdb will stop instead at the innermost frame on -+ # the line where we are trying to "next" to. -+ -+ delete_breakpoints -+ -+ if [istarget "mips*tx39-*"] { -+ set timeout 60 -+ } -+ # We used to set timeout here for all other targets as well. This -+ # is almost certainly wrong. The proper timeout depends on the -+ # target system in use, and how we communicate with it, so there -+ # is no single value appropriate for all targets. The timeout -+ # should be established by the Dejagnu config file(s) for the -+ # board, and respected by the test suite. -+ # -+ # For example, if I'm running GDB over an SSH tunnel talking to a -+ # portmaster in California talking to an ancient 68k board running -+ # a crummy ROM monitor (a situation I can only wish were -+ # hypothetical), then I need a large timeout. But that's not the -+ # kind of knowledge that belongs in this file. -+ -+ gdb_test next "\[0-9\]*\[\t \]+return \\(value\\);.*" \ -+ "next over recursive call" -+ -+ # OK, we should be back in the same stack frame we started from. -+ # Do a backtrace just to confirm. -+ -+ set result [gdb_test "backtrace" \ -+ "#0\[ \t\]+ factorial .value=120.*\r\n#1\[ \t\]+ \[0-9a-fx\]+ in factorial .value=6..*" \ -+ "backtrace from factorial(5.1)"] -+ if { $result != 0 } { gdb_suppress_tests } -+ -+ if [target_info exists gdb,noresults] { gdb_suppress_tests } -+ gdb_continue_to_end "recursive next test" -+ gdb_stop_suppressing_tests; -+} -+ -+test_next_with_recursion -+ -+ -+#******** -+ -+# build a new file with optimization enabled so that we can try breakpoints -+# on targets with optimized prologues -+ -+set binfileo2 [standard_output_file ${testfile}o2] -+ -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}O0.o" object {debug "additional_flags=-w -O2 -fpie -pie"}] != "" } { -+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." -+} -+ -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile1}" "${binfile}O1.o" object {debug "additional_flags=-w -O2 -fpie -pie"}] != "" } { -+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." -+} -+ -+if { [gdb_compile "${binfile}O0.o ${binfile}O1.o" "${binfileo2}" executable {debug "additional_flags=-w -fpie -pie"}] != "" } { -+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." -+} -+ -+if [get_compiler_info ${binfileo2}] { -+ return -1 -+} -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfileo2} -+ -+if [target_info exists gdb_stub] { -+ gdb_step_for_stub; -+} -+ -+# -+# test break at function -+# -+gdb_test "break main" \ -+ "Breakpoint.*at.* file .*$srcfile, line.*" \ -+ "breakpoint function, optimized file" -+ -+# -+# test break at function -+# -+gdb_test "break marker4" \ -+ "Breakpoint.*at.* file .*$srcfile1, line.*" \ -+ "breakpoint small function, optimized file" -+ -+# -+# run until the breakpoint at main is hit. For non-stubs-using targets. -+# -+if ![target_info exists use_gdb_stub] { -+ if [istarget "*-*-vxworks*"] then { -+ send_gdb "run vxmain \"2\"\n" -+ set timeout 120 -+ verbose "Timeout is now $timeout seconds" 2 -+ } else { -+ send_gdb "run\n" -+ } -+ gdb_expect { -+ -re "The program .* has been started already.*y or n. $" { -+ send_gdb "y\n" -+ exp_continue -+ } -+ -re "Starting program.*Breakpoint \[0-9\]+,.*main .*argc.*argv.* at .*$srcfile:$bp_location6.*$bp_location6\[\t \]+if .argc.* \{.*$gdb_prompt $"\ -+ { pass "run until function breakpoint, optimized file" } -+ -re "Starting program.*Breakpoint \[0-9\]+,.*main .*argc.*argv.* at .*$gdb_prompt $"\ -+ { pass "run until function breakpoint, optimized file (code motion)" } -+ -re ".*$gdb_prompt $" { fail "run until function breakpoint, optimized file" } -+ timeout { fail "run until function breakpoint, optimized file (timeout)" } -+ } -+} else { -+ if ![target_info exists gdb_stub] { -+ gdb_test continue ".*Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:$bp_location6.*$bp_location6\[\t \]+if .argc.*\{.*" "stub continue, optimized file" -+ } -+} -+ -+# -+# run until the breakpoint at a small function -+# -+ -+# -+# Add a second pass pattern. The behavior differs here between stabs -+# and dwarf for one-line functions. Stabs preserves two line symbols -+# (one before the prologue and one after) with the same line number, -+# but dwarf regards these as duplicates and discards one of them. -+# Therefore the address after the prologue (where the breakpoint is) -+# has no exactly matching line symbol, and GDB reports the breakpoint -+# as if it were in the middle of a line rather than at the beginning. -+ -+set bp_location13 [gdb_get_line_number "set breakpoint 13 here" $srcfile1] -+set bp_location14 [gdb_get_line_number "set breakpoint 14 here" $srcfile1] -+send_gdb "continue\n" -+gdb_expect { -+ -re "Breakpoint $decimal, marker4 \\(d=177601976\\) at .*$srcfile1:$bp_location13\[\r\n\]+$bp_location13\[\t \]+void marker4.*" { -+ pass "run until breakpoint set at small function, optimized file" -+ } -+ -re "Breakpoint $decimal, $hex in marker4 \\(d=177601976\\) at .*$srcfile1:$bp_location13\[\r\n\]+$bp_location13\[\t \]+void marker4.*" { -+ pass "run until breakpoint set at small function, optimized file" -+ } -+ -re "Breakpoint $decimal, marker4 \\(d=177601976\\) at .*$srcfile1:$bp_location14\[\r\n\]+$bp_location14\[\t \]+void marker4.*" { -+ # marker4() is defined at line 46 when compiled with -DPROTOTYPES -+ pass "run until breakpoint set at small function, optimized file (line bp_location14)" -+ } -+ -re ".*$gdb_prompt " { -+ fail "run until breakpoint set at small function, optimized file" -+ } -+ timeout { -+ fail "run until breakpoint set at small function, optimized file (timeout)" -+ } -+} -+ -+ -+# Reset the default arguments for VxWorks -+if [istarget "*-*-vxworks*"] { -+ set timeout 10 -+ verbose "Timeout is now $timeout seconds" 2 -+ send_gdb "set args main\n" -+ gdb_expect -re ".*$gdb_prompt $" {} -+} -diff --git a/gdb/testsuite/gdb.pie/break1.c b/gdb/testsuite/gdb.pie/break1.c -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.pie/break1.c -@@ -0,0 +1,44 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 1992, 1993, 1994, 1995, 1999, 2002, 2003 Free Software -+ Foundation, Inc. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 2 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program; if not, write to the Free Software -+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -+ -+ Please email any bugs, comments, and/or additions to this file to: -+ bug-gdb@prep.ai.mit.edu */ -+ -+/* The code for this file was extracted from the gdb testsuite -+ testcase "break.c". */ -+ -+/* The following functions do nothing useful. They are included -+ simply as places to try setting breakpoints at. They are -+ explicitly "one-line functions" to verify that this case works -+ (some versions of gcc have or have had problems with this). -+ -+ These functions are in a separate source file to prevent an -+ optimizing compiler from inlining them and optimizing them away. */ -+ -+#ifdef PROTOTYPES -+int marker1 (void) { return (0); } /* set breakpoint 15 here */ -+int marker2 (int a) { return (1); } /* set breakpoint 8 here */ -+void marker3 (char *a, char *b) {} /* set breakpoint 17 here */ -+void marker4 (long d) {} /* set breakpoint 14 here */ -+#else -+int marker1 () { return (0); } /* set breakpoint 16 here */ -+int marker2 (a) int a; { return (1); } /* set breakpoint 9 here */ -+void marker3 (a, b) char *a, *b; {} /* set breakpoint 18 here */ -+void marker4 (d) long d; {} /* set breakpoint 13 here */ -+#endif -diff --git a/gdb/testsuite/gdb.pie/corefile.exp b/gdb/testsuite/gdb.pie/corefile.exp -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.pie/corefile.exp -@@ -0,0 +1,233 @@ -+# Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000 -+# Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 2 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program; if not, write to the Free Software -+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -+ -+# This file was written by Fred Fish. (fnf@cygnus.com) -+ -+# are we on a target board -+if ![isnative] then { -+ return -+} -+ -+set testfile "coremaker" -+set srcfile ${testfile}.c -+set binfile [standard_output_file ${testfile}] -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug "additional_flags=-fpie -pie"}] != "" } { -+ 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; -+} -+ -+# Create a core file named "corefile" rather than just "core", to -+# avoid problems with sys admin types that like to regularly prune all -+# files named "core" from the system. -+# -+# Arbitrarily try setting the core size limit to "unlimited" since -+# this does not hurt on systems where the command does not work and -+# allows us to generate a core on systems where it does. -+# -+# Some systems append "core" to the name of the program; others append -+# the name of the program to "core"; still others (like Linux, as of -+# May 2003) create cores named "core.PID". In the latter case, we -+# could have many core files lying around, and it may be difficult to -+# tell which one is ours, so let's run the program in a subdirectory. -+set found 0 -+set coredir [standard_output_file coredir.[getpid]] -+file mkdir $coredir -+catch "system \"(cd ${coredir}; ulimit -c unlimited; ${binfile}; true) >/dev/null 2>&1\"" -+# remote_exec host "${binfile}" -+foreach i "${coredir}/core ${coredir}/core.coremaker.c ${binfile}.core" { -+ if [remote_file build exists $i] { -+ remote_exec build "mv $i [standard_output_file corefile]" -+ set found 1 -+ } -+} -+# Check for "core.PID". -+if { $found == 0 } { -+ set names [glob -nocomplain -directory $coredir core.*] -+ if {[llength $names] == 1} { -+ set corefile [file join $coredir [lindex $names 0]] -+ remote_exec build "mv $corefile [standard_output_file corefile]" -+ set found 1 -+ } -+} -+if { $found == 0 } { -+ # The braindamaged HPUX shell quits after the ulimit -c above -+ # without executing ${binfile}. So we try again without the -+ # ulimit here if we didn't find a core file above. -+ # Oh, I should mention that any "braindamaged" non-Unix system has -+ # the same problem. I like the cd bit too, it's really neat'n stuff. -+ catch "system \"(cd [file dirname [standard_output_file ${binfile}]]; ${binfile}; true) >/dev/null 2>&1\"" -+ foreach i "[standard_output_file core] [standard_output_file core.coremaker.c] ${binfile}.core" { -+ if [remote_file build exists $i] { -+ remote_exec build "mv $i [standard_output_file corefile]" -+ set found 1 -+ } -+ } -+} -+ -+# Try to clean up after ourselves. -+remote_file build delete [file join $coredir coremmap.data] -+remote_exec build "rmdir $coredir" -+ -+if { $found == 0 } { -+ warning "can't generate a core file - core tests suppressed - check ulimit -c" -+ return 0 -+} -+ -+# -+# Test that we can simply startup with a "-core=corefile" command line arg -+# and recognize that the core file is a valid, usable core file. -+# To do this, we must shutdown the currently running gdb and restart -+# with the -core args. We can't use gdb_start because it looks for -+# the first gdb prompt, and the message we are looking for occurs -+# before the first prompt. Also, we can't include GDBFLAGS because -+# if it is empty, this confuses gdb with an empty argument that it -+# grumbles about (said grumbling currently being ignored in gdb_start). -+# **FIXME** -+# -+# Another problem is that on some systems (solaris for example), there -+# is apparently a limit on the length of a fully specified path to -+# the coremaker executable, at about 80 chars. For this case, consider -+# it a pass, but note that the program name is bad. -+ -+gdb_exit -+if $verbose>1 then { -+ send_user "Spawning $GDB -nw $GDBFLAGS -core=[standard_output_file corefile]\n" -+} -+ -+set oldtimeout $timeout -+set timeout [expr "$timeout + 60"] -+verbose "Timeout is now $timeout seconds" 2 -+eval "spawn $GDB -nw $GDBFLAGS -core=[standard_output_file corefile]" -+expect { -+ -re "Couldn't find .* registers in core file.*$gdb_prompt $" { -+ fail "args: -core=corefile (couldn't find regs)" -+ } -+ -re "Core was generated by .*coremaker.*\r\n\#0 .*\(\).*\r\n$gdb_prompt $" { -+ pass "args: -core=corefile" -+ } -+ -re "Core was generated by .*\r\n\#0 .*\(\).*\r\n$gdb_prompt $" { -+ pass "args: -core=corefile (with bad program name)" -+ } -+ -re ".*registers from core file: File in wrong format.* $" { -+ fail "args: -core=corefile (could not read registers from core file)" -+ } -+ -re ".*$gdb_prompt $" { fail "args: -core=corefile" } -+ timeout { fail "(timeout) starting with -core" } -+} -+ -+ -+# -+# Test that startup with both an executable file and -core argument. -+# See previous comments above, they are still applicable. -+# -+ -+close; -+ -+if $verbose>1 then { -+ send_user "Spawning $GDB -nw $GDBFLAGS $binfile -core=[standard_output_file corefile]\n" -+} -+ -+ -+eval "spawn $GDB -nw $GDBFLAGS $binfile -core=[standard_output_file corefile]"; -+expect { -+ -re "Core was generated by .*coremaker.*\r\n\#0 .*\(\).*\r\n$gdb_prompt $" { -+ pass "args: execfile -core=corefile" -+ } -+ -re "Core was generated by .*\r\n\#0 .*\(\).*\r\n$gdb_prompt $" { -+ pass "args: execfile -core=corefile (with bad program name)" -+ } -+ -re ".*registers from core file: File in wrong format.* $" { -+ fail "args: execfile -core=corefile (could not read registers from core file)" -+ } -+ -re ".*$gdb_prompt $" { fail "args: execfile -core=corefile" } -+ timeout { fail "(timeout) starting with -core" } -+} -+set timeout $oldtimeout -+verbose "Timeout is now $timeout seconds" 2 -+ -+close; -+ -+# Now restart normally. -+ -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfile} -+ -+# Test basic corefile recognition via core-file command. -+ -+send_gdb "core-file [standard_output_file corefile]\n" -+gdb_expect { -+ -re ".* program is being debugged already.*y or n. $" { -+ # gdb_load may connect us to a gdbserver. -+ send_gdb "y\n" -+ exp_continue; -+ } -+ -re "Core was generated by .*coremaker.*\r\n\#0 .*\(\).*\r\n$gdb_prompt $" { -+ pass "core-file command" -+ } -+ -re "Core was generated by .*\r\n\#0 .*\(\).*\r\n$gdb_prompt $" { -+ pass "core-file command (with bad program name)" -+ } -+ -re ".*registers from core file: File in wrong format.* $" { -+ fail "core-file command (could not read registers from core file)" -+ } -+ -re ".*$gdb_prompt $" { fail "core-file command" } -+ timeout { fail "(timeout) core-file command" } -+} -+ -+# Test correct mapping of corefile sections by printing some variables. -+ -+gdb_test "print coremaker_data" "\\\$$decimal = 202" -+gdb_test "print coremaker_bss" "\\\$$decimal = 10" -+gdb_test "print coremaker_ro" "\\\$$decimal = 201" -+ -+gdb_test "print func2::coremaker_local" "\\\$$decimal = \\{0, 1, 2, 3, 4\\}" -+ -+# Somehow we better test the ability to read the registers out of the core -+# file correctly. I don't think the other tests do this. -+ -+gdb_test "bt" "abort.*func2.*func1.*main.*" "backtrace in corefile.exp" -+gdb_test "up" "#\[0-9\]* *\[0-9xa-fH'\]* in .* \\(.*\\).*" "up in corefile.exp" -+ -+# Test ability to read mmap'd data -+ -+gdb_test "x/8bd buf1" ".*:.*0.*1.*2.*3.*4.*5.*6.*7" "accessing original mmap data in core file" -+setup_xfail "*-*-sunos*" "*-*-ultrix*" "*-*-aix*" -+set test "accessing mmapped data in core file" -+gdb_test_multiple "x/8bd buf2" "$test" { -+ -re ".*:.*0.*1.*2.*3.*4.*5.*6.*7.*$gdb_prompt $" { -+ pass "$test" -+ } -+ -re "0x\[f\]*:.*Cannot access memory at address 0x\[f\]*.*$gdb_prompt $" { -+ fail "$test (mapping failed at runtime)" -+ } -+ -re "0x.*:.*Cannot access memory at address 0x.*$gdb_prompt $" { -+ fail "$test (mapping address not found in core file)" -+ } -+} -+ -+# test reinit_frame_cache -+ -+gdb_load ${binfile} -+gdb_test "up" "#\[0-9\]* *\[0-9xa-fH'\]* in .* \\(.*\\).*" "up in corefile.exp (reinit)" -+ -+gdb_test "core" "No core file now." -diff --git a/gdb/testsuite/gdb.pie/coremaker.c b/gdb/testsuite/gdb.pie/coremaker.c -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.pie/coremaker.c -@@ -0,0 +1,142 @@ -+/* Copyright 1992, 1993, 1994, 1995, 1996, 1999 -+ Free Software Foundation, Inc. -+ -+ This file is part of GDB. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 2 of the License, or (at -+ your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, but -+ WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program; if not, write to the Free Software -+ Foundation, Inc., 59 Temple Place - Suite 330, -+ Boston, MA 02111-1307, USA. */ -+ -+/* Simple little program that just generates a core dump from inside some -+ nested function calls. */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#ifndef __STDC__ -+#define const /**/ -+#endif -+ -+#define MAPSIZE (8 * 1024) -+ -+/* Don't make these automatic vars or we will have to walk back up the -+ stack to access them. */ -+ -+char *buf1; -+char *buf2; -+ -+int coremaker_data = 1; /* In Data section */ -+int coremaker_bss; /* In BSS section */ -+ -+const int coremaker_ro = 201; /* In Read-Only Data section */ -+ -+/* Note that if the mapping fails for any reason, we set buf2 -+ to -1 and the testsuite notices this and reports it as -+ a failure due to a mapping error. This way we don't have -+ to test for specific errors when running the core maker. */ -+ -+void -+mmapdata () -+{ -+ int j, fd; -+ -+ /* Allocate and initialize a buffer that will be used to write -+ the file that is later mapped in. */ -+ -+ buf1 = (char *) malloc (MAPSIZE); -+ for (j = 0; j < MAPSIZE; ++j) -+ { -+ buf1[j] = j; -+ } -+ -+ /* Write the file to map in */ -+ -+ fd = open ("coremmap.data", O_CREAT | O_RDWR, 0666); -+ if (fd == -1) -+ { -+ perror ("coremmap.data open failed"); -+ buf2 = (char *) -1; -+ return; -+ } -+ write (fd, buf1, MAPSIZE); -+ -+ /* Now map the file into our address space as buf2 */ -+ -+ buf2 = (char *) mmap (0, MAPSIZE, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0); -+ if (buf2 == (char *) -1) -+ { -+ perror ("mmap failed"); -+ return; -+ } -+ -+ /* Verify that the original data and the mapped data are identical. -+ If not, we'd rather fail now than when trying to access the mapped -+ data from the core file. */ -+ -+ for (j = 0; j < MAPSIZE; ++j) -+ { -+ if (buf1[j] != buf2[j]) -+ { -+ fprintf (stderr, "mapped data is incorrect"); -+ buf2 = (char *) -1; -+ return; -+ } -+ } -+} -+ -+void -+func2 () -+{ -+ int coremaker_local[5]; -+ int i; -+ -+#ifdef SA_FULLDUMP -+ /* Force a corefile that includes the data section for AIX. */ -+ { -+ struct sigaction sa; -+ -+ sigaction (SIGABRT, (struct sigaction *)0, &sa); -+ sa.sa_flags |= SA_FULLDUMP; -+ sigaction (SIGABRT, &sa, (struct sigaction *)0); -+ } -+#endif -+ -+ /* Make sure that coremaker_local doesn't get optimized away. */ -+ for (i = 0; i < 5; i++) -+ coremaker_local[i] = i; -+ coremaker_bss = 0; -+ for (i = 0; i < 5; i++) -+ coremaker_bss += coremaker_local[i]; -+ coremaker_data = coremaker_ro + 1; -+ abort (); -+} -+ -+void -+func1 () -+{ -+ func2 (); -+} -+ -+int main () -+{ -+ mmapdata (); -+ func1 (); -+ return 0; -+} -+ diff --git a/gdb-6.3-test-self-20050110.patch b/gdb-6.3-test-self-20050110.patch deleted file mode 100644 index 1128183..0000000 --- a/gdb-6.3-test-self-20050110.patch +++ /dev/null @@ -1,42 +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-self-20050110.patch - -;; Get selftest working with sep-debug-info -;;=fedoratest - -2004-02-23 Elena Zannoni - - * gdb.gdb/selftest.exp: Make sure that the debug directory is - set up properly. - * gdb.gdb/complaints.exp: Ditto. - * gdb.gdb/xfullpath.exp: Ditto. - * gdb.gdb/observer.exp: Ditto. - -diff --git a/gdb/testsuite/lib/selftest-support.exp b/gdb/testsuite/lib/selftest-support.exp ---- a/gdb/testsuite/lib/selftest-support.exp -+++ b/gdb/testsuite/lib/selftest-support.exp -@@ -152,18 +152,18 @@ proc do_self_tests {function body} { - } - - # Remove any old copy lying around. -- remote_file host delete $xgdb -+ #remote_file host delete $xgdb - - gdb_start -- set file [remote_download host $GDB_FULLPATH $xgdb] -+ #set file [remote_download host $GDB_FULLPATH $xgdb] - -- set result [selftest_setup $file $function] -+ set result [selftest_setup $GDB_FULLPATH $function] - if {$result == 0} then { - set result [uplevel $body] - } - - gdb_exit -- catch "remote_file host delete $file" -+ #catch "remote_file host delete $file" - - if {$result < 0} then { - warning "Couldn't test self" diff --git a/gdb-6.3-threaded-watchpoints2-20050225.patch b/gdb-6.3-threaded-watchpoints2-20050225.patch index 8e5c1a1..7f02ba7 100644 --- a/gdb-6.3-threaded-watchpoints2-20050225.patch +++ b/gdb-6.3-threaded-watchpoints2-20050225.patch @@ -54,7 +54,7 @@ diff --git a/gdb/testsuite/gdb.threads/watchthreads-threaded.c b/gdb/testsuite/g new file mode 100644 --- /dev/null +++ b/gdb/testsuite/gdb.threads/watchthreads-threaded.c -@@ -0,0 +1,66 @@ +@@ -0,0 +1,65 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2002, 2003, 2004, 2005 Free Software Foundation, Inc. @@ -72,8 +72,8 @@ new file mode 100644 + 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. -+ ++ Boston, MA 02111-1307, USA. ++ + This file is copied from schedlock.c. */ + +#include @@ -120,7 +120,6 @@ new file mode 100644 + + pthread_exit(NULL); +} -+ diff --git a/gdb/testsuite/gdb.threads/watchthreads-threaded.exp b/gdb/testsuite/gdb.threads/watchthreads-threaded.exp new file mode 100644 --- /dev/null @@ -142,7 +141,7 @@ new file mode 100644 +# +# 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. ++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Check that GDB can support multiple watchpoints across threads. + @@ -213,9 +212,9 @@ new file mode 100644 + { set args_2 1; set test_flag 1 } + -re "Hardware watchpoint 4: args\\\[3\\\].*Old value = 0.*New value = 1.*main \\\(\\\) at .*watchthreads-threaded.c:$init_line.*$gdb_prompt $" + { set args_3 1; set test_flag 1 } -+ -re "Hardware watchpoint 3: args\\\[2\\\].*Old value = $args_2.*New value = [expr $args_2+1].*in thread_function \\\(arg=0x2\\\) at .*watchthreads-threaded.c:$inc_line.*$gdb_prompt $" ++ -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].*in thread_function \\\(arg=0x3\\\) at .*watchthreads-threaded.c:$inc_line.*$gdb_prompt $" ++ -re "Hardware watchpoint 4: args\\\[3\\\].*Old value = $args_3.*New value = [expr $args_3+1].*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 @@ -232,7 +231,7 @@ new file mode 100644 +# Verify that we hit first watchpoint in child thread. +set message "watchpoint on args\[2\] hit in thread" +if { $args_2 > 1 } { -+ pass $message ++ pass $message +} else { + fail $message +} @@ -240,15 +239,15 @@ new file mode 100644 +# Verify that we hit second watchpoint in child thread. +set message "watchpoint on args\[3\] hit in thread" +if { $args_3 > 1 } { -+ pass $message ++ pass $message +} else { -+ fail $message ++ 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 ++ pass $message +} else { -+ fail $message ++ fail $message +} diff --git a/gdb-6.5-bz109921-DW_AT_decl_file-test.patch b/gdb-6.5-bz109921-DW_AT_decl_file-test.patch index 463b9cf..f64a643 100644 --- a/gdb-6.5-bz109921-DW_AT_decl_file-test.patch +++ b/gdb-6.5-bz109921-DW_AT_decl_file-test.patch @@ -42,7 +42,7 @@ new file mode 100644 + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU 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, @@ -66,12 +66,12 @@ new file mode 100644 +# 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. @@ -86,7 +86,7 @@ new file mode 100644 + && ![istarget *-*-openbsd*] + && ![istarget arm-*-eabi*] + && ![istarget powerpc-*-eabi*]} { -+ return 0 ++ return 0 +} + +set testfile "dw2-included" @@ -125,7 +125,7 @@ new file mode 100644 + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU 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, 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 84e355a..722c5e9 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,17 @@ 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) +@@ -1306,6 +1306,10 @@ 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 ()); - } + /* VOIDPRINT is true to indicate that we do want to print a void + value, so invert it for parse_expression. */ + expression_up expr = parse_expression (exp, nullptr, !voidprint); 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-bz218379-ppc-solib-trampoline-test.patch b/gdb-6.5-bz218379-ppc-solib-trampoline-test.patch index 807e82e..9a83337 100644 --- a/gdb-6.5-bz218379-ppc-solib-trampoline-test.patch +++ b/gdb-6.5-bz218379-ppc-solib-trampoline-test.patch @@ -26,7 +26,7 @@ new file mode 100644 + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU 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. @@ -45,22 +45,27 @@ diff --git a/gdb/testsuite/gdb.base/step-over-trampoline.exp b/gdb/testsuite/gdb new file mode 100644 --- /dev/null +++ b/gdb/testsuite/gdb.base/step-over-trampoline.exp -@@ -0,0 +1,54 @@ +@@ -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 +# 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. ++# 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 ++} + +if $tracelevel then { + strace $tracelevel 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 fc1c1c7..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-bz243845-stale-testing-zombie-test.patch b/gdb-6.5-bz243845-stale-testing-zombie-test.patch index 1a93b6d..77d274a 100644 --- a/gdb-6.5-bz243845-stale-testing-zombie-test.patch +++ b/gdb-6.5-bz243845-stale-testing-zombie-test.patch @@ -10,26 +10,27 @@ diff --git a/gdb/testsuite/gdb.base/tracefork-zombie.exp b/gdb/testsuite/gdb.bas new file mode 100644 --- /dev/null +++ b/gdb/testsuite/gdb.base/tracefork-zombie.exp -@@ -0,0 +1,75 @@ +@@ -0,0 +1,76 @@ +# Copyright 2007 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. -+# ++# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. -+# ++# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +# are we on a target board -+if [is_remote target] then { -+ return 0 ++if {[use_gdb_stub]} { ++ untested "skipping test because of use_gdb_stub" ++ return -1 +} + +# Start the program running and then wait for a bit, to be sure diff --git a/gdb-6.5-gcore-buffer-limit-test.patch b/gdb-6.5-gcore-buffer-limit-test.patch new file mode 100644 index 0000000..c26c3c4 --- /dev/null +++ b/gdb-6.5-gcore-buffer-limit-test.patch @@ -0,0 +1,154 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +Date: Fri, 27 Oct 2017 21:07:50 +0200 +Subject: gdb-6.5-gcore-buffer-limit-test.patch + +;; Test gcore memory and time requirements for large inferiors. +;;=fedoratest + +diff --git a/gdb/testsuite/gdb.base/gcore-excessive-memory.c b/gdb/testsuite/gdb.base/gcore-excessive-memory.c +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.base/gcore-excessive-memory.c +@@ -0,0 +1,37 @@ ++/* This testcase is part of GDB, the GNU debugger. ++ ++ Copyright 2008 Free Software Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 2 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program; if not, write to the Free Software ++ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++ ++ Please email any bugs, comments, and/or additions to this file to: ++ bug-gdb@prep.ai.mit.edu */ ++ ++#include ++#include ++ ++#define MEGS 64 ++ ++int main() ++{ ++ void *mem; ++ ++ mem = malloc (MEGS * 1024ULL * 1024ULL); ++ ++ for (;;) ++ sleep (1); ++ ++ return 0; ++} +diff --git a/gdb/testsuite/gdb.base/gcore-excessive-memory.exp b/gdb/testsuite/gdb.base/gcore-excessive-memory.exp +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.base/gcore-excessive-memory.exp +@@ -0,0 +1,99 @@ ++# Copyright 2008 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 2 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program; if not, write to the Free Software ++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++ ++if {[use_gdb_stub]} { ++ untested "skipping test because of use_gdb_stub" ++ return -1 ++} ++ ++set testfile gcore-excessive-memory ++set srcfile ${testfile}.c ++set shfile [standard_output_file ${testfile}-gdb.sh] ++set corefile [standard_output_file ${testfile}.core] ++set binfile [standard_output_file ${testfile}] ++if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { ++ untested "Couldn't compile test program" ++ return -1 ++} ++ ++set f [open "|getconf PAGESIZE" "r"] ++gets $f pagesize ++close $f ++ ++set pid_of_bin [eval exec $binfile &] ++sleep 2 ++ ++# Get things started. ++ ++gdb_exit ++gdb_start ++gdb_reinitialize_dir $srcdir/$subdir ++gdb_load ${binfile} ++ ++set pid_of_gdb [exp_pid -i [board_info host fileid]] ++ ++gdb_test "attach $pid_of_bin" "Attaching to .*" "attach" ++gdb_test "up 99" "in main .*" "verify we can get to main" ++ ++proc memory_v_pages_get {} { ++ global pid_of_gdb pagesize ++ set fd [open "/proc/$pid_of_gdb/statm"] ++ gets $fd line ++ close $fd ++ # number of pages of virtual memory ++ scan $line "%d" drs ++ return $drs ++} ++ ++set pages_found [memory_v_pages_get] ++ ++# It must be definitely less than `MEGS' of `gcore-excessive-memory.c'. ++set mb_gcore_reserve 4 ++verbose -log "pages_found = $pages_found, mb_gcore_reserve = $mb_gcore_reserve" ++set kb_found [expr $pages_found * $pagesize / 1024] ++set kb_permit [expr $kb_found + 1 * 1024 + $mb_gcore_reserve * 1024] ++verbose -log "kb_found = $kb_found, kb_permit = $kb_permit" ++ ++# Create the ulimit wrapper. ++set f [open $shfile "w"] ++puts $f "#! /bin/sh" ++puts $f "ulimit -v $kb_permit" ++puts $f "exec $GDB \"\$@\"" ++close $f ++remote_exec host "chmod +x $shfile" ++ ++gdb_exit ++set GDBold $GDB ++set GDB "$shfile" ++gdb_start ++set GDB $GDBold ++ ++gdb_reinitialize_dir $srcdir/$subdir ++gdb_load ${binfile} ++ ++set pid_of_gdb [exp_pid -i [board_info host fileid]] ++ ++gdb_test "attach $pid_of_bin" "Attaching to .*" "attach" ++gdb_test "up 99" "in main .*" "verify we can get to main" ++ ++verbose -log "kb_found before gcore = [expr [memory_v_pages_get] * $pagesize / 1024]" ++ ++gdb_test "gcore $corefile" "Saved corefile \[^\n\r\]*" "Save the core file" ++ ++verbose -log "kb_found after gcore = [expr [memory_v_pages_get] * $pagesize / 1024]" ++ ++# Cleanup. ++exec kill -9 $pid_of_bin diff --git a/gdb-6.5-ia64-libunwind-leak-test.patch b/gdb-6.5-ia64-libunwind-leak-test.patch index 5ae1607..5fdb523 100644 --- a/gdb-6.5-ia64-libunwind-leak-test.patch +++ b/gdb-6.5-ia64-libunwind-leak-test.patch @@ -24,7 +24,7 @@ new file mode 100644 + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU 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. @@ -44,22 +44,27 @@ diff --git a/gdb/testsuite/gdb.base/unwind-leak.exp b/gdb/testsuite/gdb.base/unw new file mode 100644 --- /dev/null +++ b/gdb/testsuite/gdb.base/unwind-leak.exp -@@ -0,0 +1,83 @@ +@@ -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. ++# 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 @@ -104,7 +109,7 @@ new file mode 100644 +verbose -log "cycles = $cycles, permit_kb = $permit_kb" + +set fail 0 -+set test "breakpoint stop/continue cycles" ++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} $" { diff --git a/gdb-6.5-last-address-space-byte-test.patch b/gdb-6.5-last-address-space-byte-test.patch index 42e3bf4..a657b07 100644 --- a/gdb-6.5-last-address-space-byte-test.patch +++ b/gdb-6.5-last-address-space-byte-test.patch @@ -17,15 +17,15 @@ new file mode 100644 +# 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. ++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +if $tracelevel then { + strace $tracelevel diff --git a/gdb-6.5-missed-trap-on-step-test.patch b/gdb-6.5-missed-trap-on-step-test.patch new file mode 100644 index 0000000..948adde --- /dev/null +++ b/gdb-6.5-missed-trap-on-step-test.patch @@ -0,0 +1,95 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +Date: Fri, 27 Oct 2017 21:07:50 +0200 +Subject: gdb-6.5-missed-trap-on-step-test.patch + +;; Test hiding unexpected breakpoints on intentional step commands. +;;=fedoratest + +Fix has been committed to: + gdb-6.6-scheduler_locking-step-sw-watchpoints2.patch + +diff --git a/gdb/testsuite/gdb.base/watchpoint-during-step.c b/gdb/testsuite/gdb.base/watchpoint-during-step.c +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.base/watchpoint-during-step.c +@@ -0,0 +1,30 @@ ++/* This testcase is part of GDB, the GNU debugger. ++ ++ Copyright 2007 Free Software Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 2 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program; if not, write to the Free Software ++ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++ ++ Please email any bugs, comments, and/or additions to this file to: ++ bug-gdb@prep.ai.mit.edu */ ++ ++static int var; ++ ++int main() ++{ ++ var = 1; ++ var = 2; ++ var = 3; ++ return 0; ++} +diff --git a/gdb/testsuite/gdb.base/watchpoint-during-step.exp b/gdb/testsuite/gdb.base/watchpoint-during-step.exp +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.base/watchpoint-during-step.exp +@@ -0,0 +1,44 @@ ++# Copyright 2007 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 2 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program; if not, write to the Free Software ++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++ ++set testfile watchpoint-during-step ++set srcfile ${testfile}.c ++set binfile [standard_output_file ${testfile}] ++if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { ++ untested "Couldn't compile test program" ++ return -1 ++} ++ ++# Get things started. ++ ++gdb_exit ++gdb_start ++gdb_reinitialize_dir $srcdir/$subdir ++gdb_load ${binfile} ++ ++runto_main ++ ++gdb_breakpoint [gdb_get_line_number "var = 2"] ++gdb_continue_to_breakpoint "Find the first var set" ++ ++gdb_test "step" ".*var = 3;" "Step to the next var set" ++ ++gdb_test "watch var" "atchpoint .*: var" "Set the watchpoint" ++ ++# Here is the target point. Be careful to not have breakpoint set on the line ++# we step from as in this case it is a valid upstream KFAIL gdb/38 ++ ++gdb_test "step" ".*Old value = 2.*New value = 3.*" "Catch the watchpoint" diff --git a/gdb-6.5-readline-long-line-crash-test.patch b/gdb-6.5-readline-long-line-crash-test.patch index 053ba1e..880006c 100644 --- a/gdb-6.5-readline-long-line-crash-test.patch +++ b/gdb-6.5-readline-long-line-crash-test.patch @@ -12,22 +12,22 @@ diff --git a/gdb/testsuite/gdb.base/readline-overflow.exp b/gdb/testsuite/gdb.ba new file mode 100644 --- /dev/null +++ b/gdb/testsuite/gdb.base/readline-overflow.exp -@@ -0,0 +1,104 @@ +@@ -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. ++# 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 @@ -46,20 +46,12 @@ new file mode 100644 + +global env + -+save_vars { env(INPUTRC) env(GDBHISTFILE) env(HISTSIZE) TERM timeout } { ++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 + -+ # Don't let a .inputrc file or an existing setting of INPUTRC mess up -+ # the test results. Even if /dev/null doesn't exist on the particular -+ # platform, the readline library will use the default setting just by -+ # failing to open the file. OTOH, opening /dev/null successfully will -+ # also result in the default settings being used since nothing will be -+ # read from this file. -+ set env(INPUTRC) "/dev/null" -+ + set timeout 600 + + set env(GDBHISTFILE) "${srcdir}/${subdir}/gdb_history" diff --git a/gdb-6.5-section-num-fixup-test.patch b/gdb-6.5-section-num-fixup-test.patch index 198c3e4..3382769 100644 --- a/gdb-6.5-section-num-fixup-test.patch +++ b/gdb-6.5-section-num-fixup-test.patch @@ -24,7 +24,7 @@ new file mode 100644 + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU 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. @@ -51,7 +51,7 @@ new file mode 100644 + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU 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. @@ -68,22 +68,27 @@ diff --git a/gdb/testsuite/gdb.base/datalib.exp b/gdb/testsuite/gdb.base/datalib new file mode 100644 --- /dev/null +++ b/gdb/testsuite/gdb.base/datalib.exp -@@ -0,0 +1,51 @@ +@@ -0,0 +1,56 @@ +# Copyright 2008 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. -+# ++# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. -+# ++# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software -+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++ ++if {[use_gdb_stub]} { ++ untested "skipping test because of use_gdb_stub" ++ return -1 ++} + +set testfile datalib +set srcfilemain ${testfile}-main.c diff --git a/gdb-6.5-sharedlibrary-path.patch b/gdb-6.5-sharedlibrary-path.patch index 51f168d..6d90d14 100644 --- a/gdb-6.5-sharedlibrary-path.patch +++ b/gdb-6.5-sharedlibrary-path.patch @@ -33,7 +33,7 @@ diff --git a/gdb/testsuite/gdb.threads/tls-sepdebug-main.c b/gdb/testsuite/gdb.t new file mode 100644 --- /dev/null +++ b/gdb/testsuite/gdb.threads/tls-sepdebug-main.c -@@ -0,0 +1,25 @@ +@@ -0,0 +1,31 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2006 Free Software Foundation, Inc. @@ -47,7 +47,7 @@ new file mode 100644 + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU 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. @@ -55,9 +55,15 @@ new file mode 100644 + 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() +{ -+ return 0; ++ /* 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 @@ -77,7 +83,7 @@ new file mode 100644 + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU 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. @@ -90,22 +96,29 @@ diff --git a/gdb/testsuite/gdb.threads/tls-sepdebug.exp b/gdb/testsuite/gdb.thre new file mode 100644 --- /dev/null +++ b/gdb/testsuite/gdb.threads/tls-sepdebug.exp -@@ -0,0 +1,87 @@ +@@ -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. ++# 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 @@ -158,22 +171,22 @@ new file mode 100644 + 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-core-as-arg.patch b/gdb-6.6-buildid-locate-core-as-arg.patch deleted file mode 100644 index 4486ca3..0000000 --- a/gdb-6.6-buildid-locate-core-as-arg.patch +++ /dev/null @@ -1,196 +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-core-as-arg.patch - -;;=push+jan - -http://sourceware.org/ml/gdb-patches/2010-01/msg00558.html - -[ Fixed up since the mail. ] - -On Thu, 21 Jan 2010 18:17:15 +0100, Doug Evans wrote: -> Not an exhaustive list, but if we go down the path of converting "gdb -> corefile" to "gdb -c corefile", then we also need to think about "file -> corefile" being converted to "core corefile" [or "target core -> corefile", "core" is apparently deprecated in favor of "target core"] -> and "target exec corefile" -> "target core corefile". Presumably -> "file corefile" (and "target exec corefile") would discard the -> currently selected executable. But maybe not. Will that be confusing -> for users? I don't know. - -While thinking about it overriding some GDB _commands_ was not my intention. - -There is a general assumption if I have a shell COMMAND and some FILE I can do -$ COMMAND FILE -and COMMAND will appropriately load the FILE. - -FSF GDB currently needs to specify also the executable file for core files -which already inhibits this intuitive expectation. OTOH with the build-id -locating patch which could allow such intuitive start notneeding the -executable file. Still it currently did not work due to the required "-c": -$ COMMAND -c COREFILE - -Entering "file", "core-file" or "attach" commands is already explicit enough -so that it IMO should do what the command name says without any -autodetections. The second command line argument -(captured_main->pid_or_core_arg) is also autodetected (for PID or CORE) but -neither "attach" accepts a core file nor "core-file" accepts a PID. - -The patch makes sense only with the build-id patchset so this is not submit -for FSF GDB inclusion yet. I am fine with your patch (+/- Hui Zhu's pending -bfd_check_format_matches) as the patch below is its natural extension. - -Sorry for the delay, -Jan - -2010-01-25 Jan Kratochvil - - * exceptions.h (enum errors ): New. - * exec.c: Include exceptions.h. - (exec_file_attach ): Call throw_error (IS_CORE_ERROR, ...). - * main.c (exec_or_core_file_attach): New. - (captured_main ): Set also corearg. - (captured_main ): New variable func. - Call exec_or_core_file_attach if COREARG matches EXECARG. Call - symbol_file_add_main only if CORE_BFD remained NULL. - -Http://sourceware.org/ml/gdb-patches/2010-01/msg00517.html -2010-01-20 Doug Evans - - * exec.c (exec_file_attach): Print a more useful error message if the - user did "gdb core". - -diff --git a/gdb/exec.c b/gdb/exec.c ---- a/gdb/exec.c -+++ b/gdb/exec.c -@@ -18,6 +18,8 @@ - along with this program. If not, see . */ - - #include "defs.h" -+#include "arch-utils.h" -+#include "exceptions.h" - #include "frame.h" - #include "inferior.h" - #include "target.h" -@@ -495,12 +497,27 @@ exec_file_attach (const char *filename, int from_tty) - - if (!bfd_check_format_matches (exec_bfd, bfd_object, &matching)) - { -+ int is_core; -+ -+ /* If the user accidentally did "gdb core", print a useful -+ error message. Check it only after bfd_object has been checked as -+ a valid executable may get recognized for example also as -+ "trad-core". */ -+ is_core = bfd_check_format (exec_bfd, bfd_core); -+ - /* Make sure to close exec_bfd, or else "run" might try to use - it. */ - exec_close (); -- error (_("\"%ps\": not in executable format: %s"), -- styled_string (file_name_style.style (), scratch_pathname), -- gdb_bfd_errmsg (bfd_get_error (), matching).c_str ()); -+ -+ if (is_core != 0) -+ throw_error (IS_CORE_ERROR, -+ _("\"%s\" is a core file.\n" -+ "Please specify an executable to debug."), -+ scratch_pathname); -+ else -+ error (_("\"%ps\": not in executable format: %s"), -+ styled_string (file_name_style.style (), scratch_pathname), -+ gdb_bfd_errmsg (bfd_get_error (), matching).c_str ()); - } - - if (build_section_table (exec_bfd, §ions, §ions_end)) -diff --git a/gdb/main.c b/gdb/main.c ---- a/gdb/main.c -+++ b/gdb/main.c -@@ -524,6 +524,34 @@ struct cmdarg - char *string; - }; - -+/* Call exec_file_attach. If it detected FILENAME is a core file call -+ core_file_command. Print the original exec_file_attach error only if -+ core_file_command failed to find a matching executable. */ -+ -+static void -+exec_or_core_file_attach (const char *filename, int from_tty) -+{ -+ gdb_assert (exec_bfd == NULL); -+ -+ try -+ { -+ exec_file_attach (filename, from_tty); -+ } -+ catch (gdb_exception_error &e) -+ { -+ if (e.error == IS_CORE_ERROR) -+ { -+ core_file_command ((char *) filename, from_tty); -+ -+ /* Iff the core file found its executable suppress the error message -+ from exec_file_attach. */ -+ if (exec_bfd != NULL) -+ return; -+ } -+ throw_exception (std::move (e)); -+ } -+} -+ - static void - captured_main_1 (struct captured_main_args *context) - { -@@ -959,6 +987,8 @@ captured_main_1 (struct captured_main_args *context) - { - symarg = argv[optind]; - execarg = argv[optind]; -+ if (optind + 1 == argc && corearg == NULL) -+ corearg = argv[optind]; - optind++; - } - -@@ -1114,12 +1144,25 @@ captured_main_1 (struct captured_main_args *context) - && symarg != NULL - && strcmp (execarg, symarg) == 0) - { -+ catch_command_errors_const_ftype *func; -+ -+ /* Call exec_or_core_file_attach only if the file was specified as -+ a command line argument (and not an a command line option). */ -+ if (corearg != NULL && strcmp (corearg, execarg) == 0) -+ { -+ func = exec_or_core_file_attach; -+ corearg = NULL; -+ } -+ else -+ func = exec_file_attach; -+ - /* The exec file and the symbol-file are the same. If we can't - open it, better only print one error message. -- catch_command_errors returns non-zero on success! */ -- ret = catch_command_errors (exec_file_attach, execarg, -- !batch_flag); -- if (ret != 0) -+ catch_command_errors returns non-zero on success! -+ Do not load EXECARG as a symbol file if it has been already processed -+ as a core file. */ -+ ret = catch_command_errors (func, execarg, !batch_flag); -+ if (ret != 0 && core_bfd == NULL) - ret = catch_command_errors (symbol_file_add_main_adapter, - symarg, !batch_flag); - } -diff --git a/gdbsupport/common-exceptions.h b/gdbsupport/common-exceptions.h ---- a/gdbsupport/common-exceptions.h -+++ b/gdbsupport/common-exceptions.h -@@ -106,6 +106,9 @@ enum errors { - "_ERROR" is appended to the name. */ - MAX_COMPLETIONS_REACHED_ERROR, - -+ /* Attempt to load a core file as executable. */ -+ IS_CORE_ERROR, -+ - /* Add more errors here. */ - NR_ERRORS - }; diff --git a/gdb-6.6-buildid-locate-rpm-scl.patch b/gdb-6.6-buildid-locate-rpm-scl.patch index f94e73c..6cf86d9 100644 --- a/gdb-6.6-buildid-locate-rpm-scl.patch +++ b/gdb-6.6-buildid-locate-rpm-scl.patch @@ -98,7 +98,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c -@@ -3025,6 +3025,16 @@ read_gdb_index_from_buffer (const char *filename, +@@ -2801,6 +2801,16 @@ read_gdb_index_from_buffer (const char *filename, "set use-deprecated-index-sections on". */ if (version < 6 && !deprecated_ok) { @@ -115,7 +115,7 @@ diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c static int warning_printed = 0; if (!warning_printed) { -@@ -3036,6 +3046,10 @@ to use the section anyway."), +@@ -2812,6 +2822,10 @@ to use the section anyway."), warning_printed = 1; } return 0; diff --git a/gdb-6.6-buildid-locate-rpm.patch b/gdb-6.6-buildid-locate-rpm.patch index b68f723..e425b97 100644 --- a/gdb-6.6-buildid-locate-rpm.patch +++ b/gdb-6.6-buildid-locate-rpm.patch @@ -14,7 +14,7 @@ diff --git a/gdb/aclocal.m4 b/gdb/aclocal.m4 +# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- +# serial 1 (pkg-config-0.24) -+# ++# +# Copyright © 2004 Scott James Remnant . +# +# This program is free software; you can redistribute it and/or modify @@ -133,11 +133,11 @@ diff --git a/gdb/aclocal.m4 b/gdb/aclocal.m4 +See the pkg-config man page for more details.]) + +if test $pkg_failed = yes; then -+ AC_MSG_RESULT([no]) ++ AC_MSG_RESULT([no]) + _PKG_SHORT_ERRORS_SUPPORTED + if test $_pkg_short_errors_supported = yes; then + $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` -+ else ++ else + $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` + fi + # Put the nasty error message in config.log where it belongs @@ -154,7 +154,7 @@ diff --git a/gdb/aclocal.m4 b/gdb/aclocal.m4 +_PKG_TEXT])[]dnl + ]) +elif test $pkg_failed = untried; then -+ AC_MSG_RESULT([no]) ++ AC_MSG_RESULT([no]) + m4_default([$4], [AC_MSG_FAILURE( +[The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full @@ -336,7 +336,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c + + /* Already failed the initialization before? */ + if (init_tried) -+ return 0; ++ return 0; + init_tried = 1; + +#ifdef DLOPEN_LIBRPM @@ -696,7 +696,7 @@ 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 @@ +@@ -246,6 +249,9 @@ /* Define if you have the mpfr library. */ #undef HAVE_LIBMPFR @@ -709,7 +709,7 @@ 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 +@@ -771,6 +771,11 @@ PKG_CONFIG HAVE_NATIVE_GCORE_TARGET TARGET_OBS subdirs @@ -721,7 +721,7 @@ diff --git a/gdb/configure b/gdb/configure GDB_DATADIR DEBUGDIR MAKEINFO_EXTRA_FLAGS -@@ -873,6 +878,7 @@ with_gdb_datadir +@@ -876,6 +881,7 @@ with_gdb_datadir with_relocated_sources with_auto_load_dir with_auto_load_safe_path @@ -729,7 +729,7 @@ diff --git a/gdb/configure b/gdb/configure enable_targets enable_64_bit_bfd enable_gdbmi -@@ -949,6 +955,8 @@ PKG_CONFIG_PATH +@@ -953,6 +959,8 @@ PKG_CONFIG_PATH PKG_CONFIG_LIBDIR DEBUGINFOD_CFLAGS DEBUGINFOD_LIBS @@ -738,7 +738,7 @@ diff --git a/gdb/configure b/gdb/configure YACC YFLAGS XMKMF' -@@ -1621,6 +1629,8 @@ Optional Packages: +@@ -1625,6 +1633,8 @@ Optional Packages: do not restrict auto-loaded files locations --with-debuginfod Enable debuginfo lookups with debuginfod (auto/yes/no) @@ -747,7 +747,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: +@@ -1705,6 +1715,8 @@ Some influential environment variables: C compiler flags for DEBUGINFOD, overriding pkg-config DEBUGINFOD_LIBS linker flags for DEBUGINFOD, overriding pkg-config @@ -756,7 +756,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 +@@ -6616,6 +6628,494 @@ _ACEOF { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_auto_load_safe_path" >&5 $as_echo "$with_auto_load_safe_path" >&6; } @@ -1148,7 +1148,7 @@ diff --git a/gdb/configure b/gdb/configure + + +if test $pkg_failed = yes; then -+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then @@ -1166,7 +1166,7 @@ diff --git a/gdb/configure b/gdb/configure + + HAVE_LIBRPM=false +elif test $pkg_failed = untried; then -+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + HAVE_LIBRPM=false +else @@ -1254,7 +1254,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, +@@ -153,6 +153,199 @@ AC_DEFINE_DIR(AUTO_LOAD_SAFE_PATH, escape_dir, [Directories safe to hold auto-loaded files.]) AC_MSG_RESULT([$with_auto_load_safe_path]) @@ -1450,14 +1450,14 @@ diff --git a/gdb/configure.ac b/gdb/configure.ac + fi + fi +fi -+ ++ AC_CONFIG_SUBDIRS(testsuite) # Check whether to support alternative target configurations diff --git a/gdb/event-top.c b/gdb/event-top.c --- a/gdb/event-top.c +++ b/gdb/event-top.c -@@ -42,6 +42,7 @@ +@@ -41,6 +41,7 @@ #include "gdbsupport/gdb_select.h" #include "gdbsupport/gdb-sigmask.h" #include "async-event.h" @@ -1465,7 +1465,7 @@ diff --git a/gdb/event-top.c b/gdb/event-top.c /* readline include files. */ #include "readline/readline.h" -@@ -364,6 +365,8 @@ display_gdb_prompt (const char *new_prompt) +@@ -363,6 +364,8 @@ display_gdb_prompt (const char *new_prompt) /* Reset the nesting depth used when trace-commands is set. */ reset_command_nest_depth (); @@ -1489,11 +1489,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); +@@ -342,6 +342,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 fa76558..0c80173 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, +@@ -1350,14 +1350,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, +@@ -1372,23 +1386,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 65e65d0..a96c372 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 * +@@ -115,7 +115,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 * +@@ -120,7 +120,7 @@ static inline char * bfd_strdup (const char *str) { size_t len = strlen (str) + 1; @@ -540,18 +540,18 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c + /* There can be multiple build-id symlinks pointing to real files + with the same build-id (such as hard links). Some of the real + files may not be installed. */ ++ ++ string_appendf (link, ".%u", seqno); ++ } - /* We expect to be silent on the non-existing files. */ - gdb_bfd_ref_ptr debug_bfd = gdb_bfd_open (filename.get (), gnutarget); -+ string_appendf (link, ".%u", seqno); -+ } ++ ret_link = link; - if (debug_bfd == NULL) - { - if (separate_debug_file_debug) - printf_unfiltered (_(" no, unable to open.\n")); -+ ret_link = link; -+ + struct stat statbuf_trash; + + /* `access' automatically dereferences LINK. */ @@ -574,11 +574,11 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c + + continue; + } - -- return {}; ++ + /* We expect to be silent on the non-existing files. */ + gdb_bfd_ref_ptr debug_bfd = gdb_bfd_open (filename.get (), gnutarget, -1); -+ + +- return {}; + if (debug_bfd == NULL) + { + if (separate_debug_file_debug) @@ -699,7 +699,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c +{ + gdb_bfd_ref_ptr abfd; + char *result; -+ ++ + abfd = build_id_to_exec_bfd (build_id->size, build_id->data, link_return); + if (abfd == NULL) + return NULL; @@ -890,7 +890,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c + 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,7 +906,7 @@ 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) +@@ -223,3 +897,22 @@ find_separate_debug_file_by_buildid (struct objfile *objfile) return std::string (); } @@ -926,7 +926,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 @@ -950,7 +951,7 @@ diff --git a/gdb/build-id.h b/gdb/build-id.h 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); @@ -978,9 +979,9 @@ diff --git a/gdb/build-id.h b/gdb/build-id.h 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) +@@ -710,7 +710,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)) + if (!objfile->has_partial_symbols ()) { - std::string debugfile = find_separate_debug_file_by_buildid (objfile); + std::string debugfile = find_separate_debug_file_by_buildid (objfile, @@ -1002,7 +1003,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) +@@ -356,6 +360,8 @@ add_to_thread_list (asection *asect, asection *reg_sect) switch_to_thread (thr); /* Yes, make it current. */ } @@ -1011,7 +1012,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) +@@ -392,19 +398,26 @@ core_file_command (const char *filename, int from_tty) static void locate_exec_from_corefile_build_id (bfd *abfd, int from_tty) { @@ -1031,16 +1032,17 @@ diff --git a/gdb/corelow.c b/gdb/corelow.c 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, +@@ -1209,4 +1222,11 @@ _initialize_corelow () + maintenance_print_core_file_backed_mappings, _("Print core file's file-backed mappings."), &maintenanceprintlist); + @@ -1054,7 +1056,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. +@@ -21415,6 +21415,27 @@ information files. @end table @@ -1107,16 +1109,7 @@ 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 -@@ -2218,7 +2218,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) - { -@@ -5980,7 +5980,7 @@ get_gdb_index_contents_from_section (objfile *obj, T *section_owner) +@@ -5447,7 +5447,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) { @@ -1125,7 +1118,7 @@ diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c if (build_id == nullptr) return {}; -@@ -5993,7 +5993,7 @@ get_gdb_index_contents_from_cache (objfile *obj, dwarf2_per_bfd *dwarf2_per_bfd) +@@ -5460,7 +5460,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,7 +1130,7 @@ 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) +@@ -1272,7 +1272,9 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags) && objfile->separate_debug_objfile == NULL && objfile->separate_debug_objfile_backlink == NULL) { @@ -1148,7 +1141,7 @@ diff --git a/gdb/elfread.c b/gdb/elfread.c 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) +@@ -1287,7 +1289,7 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags) else { has_dwarf2 = false; @@ -1157,7 +1150,7 @@ diff --git a/gdb/elfread.c b/gdb/elfread.c if (build_id != nullptr) { -@@ -1338,6 +1340,10 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags) +@@ -1312,6 +1314,10 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags) has_dwarf2 = true; } } @@ -1171,16 +1164,16 @@ diff --git a/gdb/elfread.c b/gdb/elfread.c 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,7 +1185,7 @@ 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 +@@ -812,6 +812,10 @@ struct objfile bool skip_jit_symbol_lookup = false; }; @@ -1235,7 +1228,7 @@ diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c 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, +@@ -1348,9 +1349,51 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm, continue; } @@ -1277,8 +1270,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,7 +1286,7 @@ 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) +@@ -1178,7 +1178,7 @@ open_source_file (struct symtab *s) srcpath += s->filename; } @@ -1305,9 +1298,9 @@ diff --git a/gdb/source.c b/gdb/source.c 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); +@@ -332,12 +332,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,9 +1314,9 @@ 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 @@ -1361,6 +1354,19 @@ diff --git a/gdb/testsuite/gdb.base/corefile.exp b/gdb/testsuite/gdb.base/corefi + gdb_test "info files" "Local exec file:\r\n\[ \t\]*`[string_to_regexp $debugdir/$buildid]', file type .*" + pass $wholetest +} +diff --git a/gdb/testsuite/gdb.base/gdbinit-history.exp b/gdb/testsuite/gdb.base/gdbinit-history.exp +--- a/gdb/testsuite/gdb.base/gdbinit-history.exp ++++ b/gdb/testsuite/gdb.base/gdbinit-history.exp +@@ -185,7 +185,8 @@ proc test_empty_history_filename { } { + global env + global gdb_prompt + +- set common_history [list "set height 0" "set width 0"] ++ set common_history [list "set height 0" "set width 0" \ ++ "set build-id-verbose 0"] + + set test_dir [standard_output_file history_test] + remote_exec host "mkdir -p $test_dir" diff --git a/gdb/testsuite/gdb.base/new-ui-pending-input.exp b/gdb/testsuite/gdb.base/new-ui-pending-input.exp --- a/gdb/testsuite/gdb.base/new-ui-pending-input.exp +++ b/gdb/testsuite/gdb.base/new-ui-pending-input.exp @@ -1375,7 +1381,7 @@ 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 { } { +@@ -2130,6 +2130,17 @@ proc default_gdb_start { } { } } @@ -1396,7 +1402,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 } { +@@ -322,6 +322,16 @@ proc default_mi_gdb_start { args } { warning "Couldn't set the width to 0." } } diff --git a/gdb-6.6-bz229517-gcore-without-terminal.patch b/gdb-6.6-bz229517-gcore-without-terminal.patch index 7eaed58..863f615 100644 --- a/gdb-6.6-bz229517-gcore-without-terminal.patch +++ b/gdb-6.6-bz229517-gcore-without-terminal.patch @@ -79,15 +79,15 @@ new file mode 100644 +# 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. ++# 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 diff --git a/gdb-6.6-bz230000-power6-disassembly-test.patch b/gdb-6.6-bz230000-power6-disassembly-test.patch index 757c747..5b7ba1d 100644 --- a/gdb-6.6-bz230000-power6-disassembly-test.patch +++ b/gdb-6.6-bz230000-power6-disassembly-test.patch @@ -31,7 +31,7 @@ new file mode 100644 +# +# 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. ++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Test PowerPC Power6 instructions disassembly. + diff --git a/gdb-6.6-bz237572-ppc-atomic-sequence-test.patch b/gdb-6.6-bz237572-ppc-atomic-sequence-test.patch index 0c44ef2..6d04711 100644 --- a/gdb-6.6-bz237572-ppc-atomic-sequence-test.patch +++ b/gdb-6.6-bz237572-ppc-atomic-sequence-test.patch @@ -29,7 +29,7 @@ new file mode 100644 + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -+ ++ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, @@ -202,12 +202,12 @@ new file mode 100644 +# 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. */ diff --git a/gdb-6.8-bz442765-threaded-exec-test.patch b/gdb-6.8-bz442765-threaded-exec-test.patch index 6468888..e1d8f8b 100644 --- a/gdb-6.8-bz442765-threaded-exec-test.patch +++ b/gdb-6.8-bz442765-threaded-exec-test.patch @@ -175,7 +175,7 @@ diff --git a/gdb/testsuite/gdb.threads/threaded-exec.exp b/gdb/testsuite/gdb.thr +gdb_load ${binfile_nothreads} -gdb_run_cmd -+gdb_run_cmd ${binfile_nothreads} ${binfile_threads} 0 ++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-6.8-quit-never-aborts.patch b/gdb-6.8-quit-never-aborts.patch deleted file mode 100644 index 3f779c6..0000000 --- a/gdb-6.8-quit-never-aborts.patch +++ /dev/null @@ -1,78 +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-quit-never-aborts.patch - -;; Make the GDB quit processing non-abortable to cleanup everything properly. -;;=fedora: It was useful only after gdb-6.8-attach-signalled-detach-stopped.patch . - -We may abort the process of detaching threads with multiple SIGINTs - which are -being sent during a testcase terminating its child GDB. - -Some of the threads may not be properly PTRACE_DETACHed which hurts if they -should have been detached with SIGSTOP (as they are accidentally left running -on the debugger termination). - -diff --git a/gdb/defs.h b/gdb/defs.h ---- a/gdb/defs.h -+++ b/gdb/defs.h -@@ -177,6 +177,10 @@ extern void default_quit_handler (void); - /* Flag that function quit should call quit_force. */ - extern volatile int sync_quit_force_run; - -+#ifdef NEED_DETACH_SIGSTOP -+extern int quit_flag_cleanup; -+#endif -+ - extern void quit (void); - - /* Helper for the QUIT macro. */ -diff --git a/gdb/extension.c b/gdb/extension.c ---- a/gdb/extension.c -+++ b/gdb/extension.c -@@ -769,6 +769,11 @@ check_quit_flag (void) - { - int result = 0; - -+#ifdef NEED_DETACH_SIGSTOP -+ if (quit_flag_cleanup) -+ return 0; -+#endif -+ - for (const struct extension_language_defn *extlang : extension_languages) - { - if (extlang->ops != nullptr -diff --git a/gdb/top.c b/gdb/top.c ---- a/gdb/top.c -+++ b/gdb/top.c -@@ -1770,7 +1770,13 @@ quit_force (int *exit_arg, int from_tty) - else if (return_child_result) - exit_code = return_child_result_value; - -+#ifndef NEED_DETACH_SIGSTOP - /* We want to handle any quit errors and exit regardless. */ -+#else -+ /* We want to handle any quit errors and exit regardless but we should never -+ get user-interrupted to properly detach the inferior. */ -+ quit_flag_cleanup = 1; -+#endif - - /* Get out of tfind mode, and kill or detach all inferiors. */ - try -diff --git a/gdb/utils.c b/gdb/utils.c ---- a/gdb/utils.c -+++ b/gdb/utils.c -@@ -103,6 +103,13 @@ static std::chrono::steady_clock::duration prompt_for_continue_wait_time; - - static bool debug_timestamp = false; - -+#ifdef NEED_DETACH_SIGSTOP -+/* Nonzero means we are already processing the quitting cleanups and we should -+ no longer get aborted. */ -+ -+int quit_flag_cleanup; -+#endif -+ - /* True means that strings with character values >0x7F should be printed - as octal escapes. False means just print the value (e.g. it's an - international character, and the terminal or window can cope.) */ diff --git a/gdb-add-index.sh-fix-bashism.patch b/gdb-add-index.sh-fix-bashism.patch new file mode 100644 index 0000000..6ca00b1 --- /dev/null +++ b/gdb-add-index.sh-fix-bashism.patch @@ -0,0 +1,21 @@ +[gdb-add-index.sh] Fix bashism + +--- + gdb/contrib/gdb-add-index.sh | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/gdb/contrib/gdb-add-index.sh b/gdb/contrib/gdb-add-index.sh +index 734110caa3b..00d3ae8b0ae 100755 +--- a/gdb/contrib/gdb-add-index.sh ++++ b/gdb/contrib/gdb-add-index.sh +@@ -38,7 +38,9 @@ fi + file="$1" + + if test -L "$file"; then +- if ! command -v readlink >/dev/null 2>&1; then ++ target=$(readlink "$file") ++ st=$? ++ if [ $st -eq 127 ]; then + echo "$myname: 'readlink' missing. Failed to follow symlink $1." 1>&2 + exit 1 + fi diff --git a/gdb-archer-pie-addons-keep-disabled.patch b/gdb-archer-pie-addons-keep-disabled.patch deleted file mode 100644 index e2702a5..0000000 --- a/gdb-archer-pie-addons-keep-disabled.patch +++ /dev/null @@ -1,89 +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-archer-pie-addons-keep-disabled.patch - -;;=push+jan: Breakpoints disabling matching should not be based on address. - -diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c ---- a/gdb/breakpoint.c -+++ b/gdb/breakpoint.c -@@ -15431,6 +15431,50 @@ static struct cmd_list_element *enablebreaklist = NULL; - - cmd_list_element *commands_cmd_element = nullptr; - -+void -+breakpoints_relocate (struct objfile *objfile, section_offsets &delta) -+{ -+ struct bp_location *bl, **blp_tmp; -+ int changed = 0; -+ -+ gdb_assert (objfile->separate_debug_objfile_backlink == NULL); -+ -+ ALL_BP_LOCATIONS (bl, blp_tmp) -+ { -+ struct obj_section *osect; -+ -+ /* BL->SECTION can be correctly NULL for breakpoints with multiple -+ locations expanded through symtab. */ -+ -+ ALL_OBJFILE_OSECTIONS (objfile, osect) -+ { -+ CORE_ADDR relocated_address; -+ CORE_ADDR delta_offset; -+ -+ delta_offset = delta[osect->the_bfd_section->index]; -+ if (delta_offset == 0) -+ continue; -+ relocated_address = bl->address + delta_offset; -+ -+ if (obj_section_addr (osect) <= relocated_address -+ && relocated_address < obj_section_endaddr (osect)) -+ { -+ if (bl->inserted) -+ remove_breakpoint (bl); -+ -+ bl->address += delta_offset; -+ bl->requested_address += delta_offset; -+ -+ changed = 1; -+ } -+ } -+ } -+ -+ if (changed) -+ std::sort (bp_locations, bp_locations + bp_locations_count, -+ bp_location_is_less_than); -+} -+ - void _initialize_breakpoint (); - void - _initialize_breakpoint () -diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h ---- a/gdb/breakpoint.h -+++ b/gdb/breakpoint.h -@@ -1691,6 +1691,9 @@ extern const char *ep_parse_optional_if_clause (const char **arg); - UIOUT iff debugging multiple threads. */ - extern void maybe_print_thread_hit_breakpoint (struct ui_out *uiout); - -+extern void breakpoints_relocate (struct objfile *objfile, -+ section_offsets &delta); -+ - /* Print the specified breakpoint. */ - extern void print_breakpoint (breakpoint *bp); - -diff --git a/gdb/objfiles.c b/gdb/objfiles.c ---- a/gdb/objfiles.c -+++ b/gdb/objfiles.c -@@ -742,6 +742,11 @@ objfile_relocate1 (struct objfile *objfile, - obj_section_addr (s)); - } - -+ /* Final call of breakpoint_re_set can keep breakpoint locations disabled if -+ their addresses match. */ -+ if (objfile->separate_debug_objfile_backlink == NULL) -+ breakpoints_relocate (objfile, delta); -+ - /* Data changed. */ - return 1; - } diff --git a/gdb-archer-pie-addons.patch b/gdb-archer-pie-addons.patch deleted file mode 100644 index d22ae19..0000000 --- a/gdb-archer-pie-addons.patch +++ /dev/null @@ -1,39 +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-archer-pie-addons.patch - -;;=push+jan: May get obsoleted by Tom's unrelocated objfiles patch. - -diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h ---- a/gdb/gdbtypes.h -+++ b/gdb/gdbtypes.h -@@ -649,6 +649,7 @@ enum field_loc_kind - { - FIELD_LOC_KIND_BITPOS, /**< bitpos */ - FIELD_LOC_KIND_ENUMVAL, /**< enumval */ -+ /* This address is unrelocated by the objfile's ANOFFSET. */ - FIELD_LOC_KIND_PHYSADDR, /**< physaddr */ - FIELD_LOC_KIND_PHYSNAME, /**< physname */ - FIELD_LOC_KIND_DWARF_BLOCK /**< dwarf_block */ -@@ -699,6 +700,7 @@ union field_location - field. Otherwise, physname is the mangled label of the - static field. */ - -+ /* This address is unrelocated by the objfile's ANOFFSET. */ - CORE_ADDR physaddr; - const char *physname; - -diff --git a/gdb/value.c b/gdb/value.c ---- a/gdb/value.c -+++ b/gdb/value.c -@@ -2850,7 +2850,8 @@ value_static_field (struct type *type, int fieldno) - { - case FIELD_LOC_KIND_PHYSADDR: - retval = value_at_lazy (type->field (fieldno).type (), -- TYPE_FIELD_STATIC_PHYSADDR (type, fieldno)); -+ TYPE_FIELD_STATIC_PHYSADDR (type, fieldno) -+ + (TYPE_OBJFILE (type) == NULL ? 0 : TYPE_OBJFILE (type)->section_offsets[SECT_OFF_TEXT (TYPE_OBJFILE (type))])); - break; - case FIELD_LOC_KIND_PHYSNAME: - { diff --git a/gdb-archer-vla-tests.patch b/gdb-archer-vla-tests.patch deleted file mode 100644 index 3988047..0000000 --- a/gdb-archer-vla-tests.patch +++ /dev/null @@ -1,3737 +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-archer-vla-tests.patch - -;;=fedoratest - -diff --git a/gdb/testsuite/gdb.ada/packed_array.exp b/gdb/testsuite/gdb.ada/packed_array.exp ---- a/gdb/testsuite/gdb.ada/packed_array.exp -+++ b/gdb/testsuite/gdb.ada/packed_array.exp -@@ -53,5 +53,11 @@ gdb_test_multiple "$test" "$test" { - # are. Observed with (FSF GNU Ada 4.5.3 20110124). - xfail $test - } -+ -re "= \\(\\)\[\r\n\]+$gdb_prompt $" { -+ # archer-jankratochvil-vla resolves it as a dynamic type resolved as an -+ # empty array [0..-1]. -+ # DW_AT_upper_bound : (DW_OP_fbreg: -48; DW_OP_deref) -+ xfail $test -+ } - } - -diff --git a/gdb/testsuite/gdb.arch/x86_64-vla-pointer-foo.S b/gdb/testsuite/gdb.arch/x86_64-vla-pointer-foo.S -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.arch/x86_64-vla-pointer-foo.S -@@ -0,0 +1,358 @@ -+ .file "x86_64-vla-pointer.c" -+ .text -+.Ltext0: -+ .globl foo -+ .type foo, @function -+foo: -+.LFB0: -+ .file 1 "gdb.arch/x86_64-vla-pointer.c" -+ # gdb.arch/x86_64-vla-pointer.c:22 -+ .loc 1 22 0 -+ .cfi_startproc -+# BLOCK 2 seq:0 -+# PRED: ENTRY (FALLTHRU) -+ pushq %rbp -+ .cfi_def_cfa_offset 16 -+ .cfi_offset 6, -16 -+ movq %rsp, %rbp -+ .cfi_def_cfa_register 6 -+ pushq %rbx -+ subq $56, %rsp -+ .cfi_offset 3, -24 -+ movl %edi, -52(%rbp) -+ # gdb.arch/x86_64-vla-pointer.c:22 -+ .loc 1 22 0 -+ movq %rsp, %rax -+ movq %rax, %rsi -+ # gdb.arch/x86_64-vla-pointer.c:23 -+ .loc 1 23 0 -+ movl -52(%rbp), %eax -+ movslq %eax, %rdx -+ subq $1, %rdx -+ movq %rdx, -32(%rbp) -+ movslq %eax, %rdx -+ movq %rdx, %r8 -+ movl $0, %r9d -+ # gdb.arch/x86_64-vla-pointer.c:24 -+ .loc 1 24 0 -+ movslq %eax, %rdx -+ movq %rdx, %rcx -+ movl $0, %ebx -+ cltq -+ movl $16, %edx -+ subq $1, %rdx -+ addq %rdx, %rax -+ movl $16, %ebx -+ movl $0, %edx -+ divq %rbx -+ imulq $16, %rax, %rax -+ subq %rax, %rsp -+ movq %rsp, %rax -+ addq $0, %rax -+ movq %rax, -40(%rbp) -+ # gdb.arch/x86_64-vla-pointer.c:27 -+ .loc 1 27 0 -+ movl $0, -20(%rbp) -+# SUCC: 4 [100.0%] -+ jmp .L2 -+# BLOCK 3 seq:1 -+# PRED: 4 -+.L3: -+ # gdb.arch/x86_64-vla-pointer.c:28 -+ .loc 1 28 0 discriminator 3 -+ movl -20(%rbp), %eax -+ movl %eax, %ecx -+ movq -40(%rbp), %rdx -+ movl -20(%rbp), %eax -+ cltq -+ movb %cl, (%rdx,%rax) -+# SUCC: 4 (FALLTHRU,DFS_BACK) -+ # gdb.arch/x86_64-vla-pointer.c:27 -+ .loc 1 27 0 discriminator 3 -+ addl $1, -20(%rbp) -+# BLOCK 4 seq:2 -+# PRED: 3 (FALLTHRU,DFS_BACK) 2 [100.0%] -+.L2: -+ # gdb.arch/x86_64-vla-pointer.c:27 -+ .loc 1 27 0 is_stmt 0 discriminator 1 -+ movl -20(%rbp), %eax -+ cmpl -52(%rbp), %eax -+# SUCC: 3 5 (FALLTHRU) -+ jl .L3 -+# BLOCK 5 seq:3 -+# PRED: 4 (FALLTHRU) -+ # gdb.arch/x86_64-vla-pointer.c:30 -+ .loc 1 30 0 is_stmt 1 -+ movq -40(%rbp), %rax -+ movb $0, (%rax) -+ movq %rsi, %rsp -+ # gdb.arch/x86_64-vla-pointer.c:31 -+ .loc 1 31 0 -+ nop -+ movq -8(%rbp), %rbx -+ leave -+ .cfi_def_cfa 7, 8 -+# SUCC: EXIT [100.0%] -+ ret -+ .cfi_endproc -+.LFE0: -+ .size foo, .-foo -+.Letext0: -+ .section .debug_info,"",@progbits -+.Ldebug_info0: -+ .long 0xa5 # 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 .LASF3 # DW_AT_producer: "GNU C11 6.2.1 20160916 (Red Hat 6.2.1-2) -mtune=generic -march=x86-64 -g" -+ .byte 0xc # DW_AT_language -+ .long .LASF4 # DW_AT_name: "gdb.arch/x86_64-vla-pointer.c" -+ .long .LASF5 # DW_AT_comp_dir: "/home/jkratoch/redhat/fedora/gdb/master/gdb-7.12/gdb/testsuite" -+ .quad .Ltext0 # DW_AT_low_pc -+ .quad .Letext0-.Ltext0 # DW_AT_high_pc -+ .long .Ldebug_line0 # DW_AT_stmt_list -+ .uleb128 0x2 # (DIE (0x2d) DW_TAG_subprogram) -+ # DW_AT_external -+ .ascii "foo\0" # DW_AT_name -+ .byte 0x1 # DW_AT_decl_file (gdb.arch/x86_64-vla-pointer.c) -+ .byte 0x15 # DW_AT_decl_line -+ # DW_AT_prototyped -+ .quad .LFB0 # DW_AT_low_pc -+ .quad .LFE0-.LFB0 # DW_AT_high_pc -+ .uleb128 0x1 # DW_AT_frame_base -+ .byte 0x9c # DW_OP_call_frame_cfa -+ # DW_AT_GNU_all_call_sites -+ .long 0x80 # DW_AT_sibling -+ .uleb128 0x3 # (DIE (0x4a) DW_TAG_formal_parameter) -+ .long .LASF6 # DW_AT_name: "size" -+ .byte 0x1 # DW_AT_decl_file (gdb.arch/x86_64-vla-pointer.c) -+ .byte 0x15 # DW_AT_decl_line -+ .long 0x80 # DW_AT_type -+ .uleb128 0x3 # DW_AT_location -+ .byte 0x91 # DW_OP_fbreg -+ .sleb128 -68 -+ .uleb128 0x4 # (DIE (0x59) DW_TAG_typedef) -+ .long .LASF7 # DW_AT_name: "array_t" -+ .byte 0x1 # DW_AT_decl_file (gdb.arch/x86_64-vla-pointer.c) -+ .byte 0x17 # DW_AT_decl_line -+ .long 0x87 # DW_AT_type -+ .uleb128 0x5 # (DIE (0x64) DW_TAG_variable) -+ .long .LASF0 # DW_AT_name: "array" -+ .byte 0x1 # DW_AT_decl_file (gdb.arch/x86_64-vla-pointer.c) -+ .byte 0x18 # DW_AT_decl_line -+ .long 0x59 # DW_AT_type -+ .uleb128 0x3 # DW_AT_location -+ .byte 0x91 # DW_OP_fbreg -+ .sleb128 -56 -+ .byte 0x6 # DW_OP_deref -+ .uleb128 0x6 # (DIE (0x73) DW_TAG_variable) -+ .ascii "i\0" # DW_AT_name -+ .byte 0x1 # DW_AT_decl_file (gdb.arch/x86_64-vla-pointer.c) -+ .byte 0x19 # DW_AT_decl_line -+ .long 0x80 # DW_AT_type -+ .uleb128 0x2 # DW_AT_location -+ .byte 0x91 # DW_OP_fbreg -+ .sleb128 -36 -+ .byte 0 # end of children of DIE 0x2d -+ .uleb128 0x7 # (DIE (0x80) DW_TAG_base_type) -+ .byte 0x4 # DW_AT_byte_size -+ .byte 0x5 # DW_AT_encoding -+ .ascii "int\0" # DW_AT_name -+ .uleb128 0x8 # (DIE (0x87) DW_TAG_array_type) -+ .long 0xa1 # DW_AT_type -+ .long 0x9a # DW_AT_sibling -+ .uleb128 0x9 # (DIE (0x90) DW_TAG_subrange_type) -+ .long 0x9a # DW_AT_type -+ .uleb128 0x3 # DW_AT_upper_bound -+ .byte 0x91 # DW_OP_fbreg -+ .sleb128 -48 -+ .byte 0x6 # DW_OP_deref -+ .byte 0 # end of children of DIE 0x87 -+ .uleb128 0xa # (DIE (0x9a) DW_TAG_base_type) -+ .byte 0x8 # DW_AT_byte_size -+ .byte 0x7 # DW_AT_encoding -+ .long .LASF1 # DW_AT_name: "sizetype" -+ .uleb128 0xa # (DIE (0xa1) DW_TAG_base_type) -+ .byte 0x1 # DW_AT_byte_size -+ .byte 0x6 # DW_AT_encoding -+ .long .LASF2 # DW_AT_name: "char" -+ .byte 0 # end of children of DIE 0xb -+ .section .debug_abbrev,"",@progbits -+.Ldebug_abbrev0: -+ .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 0x7 # (DW_FORM_data8) -+ .uleb128 0x10 # (DW_AT_stmt_list) -+ .uleb128 0x17 # (DW_FORM_sec_offset) -+ .byte 0 -+ .byte 0 -+ .uleb128 0x2 # (abbrev code) -+ .uleb128 0x2e # (TAG: DW_TAG_subprogram) -+ .byte 0x1 # DW_children_yes -+ .uleb128 0x3f # (DW_AT_external) -+ .uleb128 0x19 # (DW_FORM_flag_present) -+ .uleb128 0x3 # (DW_AT_name) -+ .uleb128 0x8 # (DW_FORM_string) -+ .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 0x11 # (DW_AT_low_pc) -+ .uleb128 0x1 # (DW_FORM_addr) -+ .uleb128 0x12 # (DW_AT_high_pc) -+ .uleb128 0x7 # (DW_FORM_data8) -+ .uleb128 0x40 # (DW_AT_frame_base) -+ .uleb128 0x18 # (DW_FORM_exprloc) -+ .uleb128 0x2117 # (DW_AT_GNU_all_call_sites) -+ .uleb128 0x19 # (DW_FORM_flag_present) -+ .uleb128 0x1 # (DW_AT_sibling) -+ .uleb128 0x13 # (DW_FORM_ref4) -+ .byte 0 -+ .byte 0 -+ .uleb128 0x3 # (abbrev code) -+ .uleb128 0x5 # (TAG: DW_TAG_formal_parameter) -+ .byte 0 # DW_children_no -+ .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 0x49 # (DW_AT_type) -+ .uleb128 0x13 # (DW_FORM_ref4) -+ .uleb128 0x2 # (DW_AT_location) -+ .uleb128 0x18 # (DW_FORM_exprloc) -+ .byte 0 -+ .byte 0 -+ .uleb128 0x4 # (abbrev code) -+ .uleb128 0x16 # (TAG: DW_TAG_typedef) -+ .byte 0 # DW_children_no -+ .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 0x49 # (DW_AT_type) -+ .uleb128 0x13 # (DW_FORM_ref4) -+ .byte 0 -+ .byte 0 -+ .uleb128 0x5 # (abbrev code) -+ .uleb128 0x34 # (TAG: DW_TAG_variable) -+ .byte 0 # DW_children_no -+ .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 0x49 # (DW_AT_type) -+ .uleb128 0x13 # (DW_FORM_ref4) -+ .uleb128 0x2 # (DW_AT_location) -+ .uleb128 0x18 # (DW_FORM_exprloc) -+ .byte 0 -+ .byte 0 -+ .uleb128 0x6 # (abbrev code) -+ .uleb128 0x34 # (TAG: DW_TAG_variable) -+ .byte 0 # DW_children_no -+ .uleb128 0x3 # (DW_AT_name) -+ .uleb128 0x8 # (DW_FORM_string) -+ .uleb128 0x3a # (DW_AT_decl_file) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x3b # (DW_AT_decl_line) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x49 # (DW_AT_type) -+ .uleb128 0x13 # (DW_FORM_ref4) -+ .uleb128 0x2 # (DW_AT_location) -+ .uleb128 0x18 # (DW_FORM_exprloc) -+ .byte 0 -+ .byte 0 -+ .uleb128 0x7 # (abbrev code) -+ .uleb128 0x24 # (TAG: DW_TAG_base_type) -+ .byte 0 # 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 0 -+ .byte 0 -+ .uleb128 0x8 # (abbrev code) -+ .uleb128 0x1 # (TAG: DW_TAG_array_type) -+ .byte 0x1 # DW_children_yes -+ .uleb128 0x49 # (DW_AT_type) -+ .uleb128 0x13 # (DW_FORM_ref4) -+ .uleb128 0x1 # (DW_AT_sibling) -+ .uleb128 0x13 # (DW_FORM_ref4) -+ .byte 0 -+ .byte 0 -+ .uleb128 0x9 # (abbrev code) -+ .uleb128 0x21 # (TAG: DW_TAG_subrange_type) -+ .byte 0 # DW_children_no -+ .uleb128 0x49 # (DW_AT_type) -+ .uleb128 0x13 # (DW_FORM_ref4) -+ .uleb128 0x2f # (DW_AT_upper_bound) -+ .uleb128 0x18 # (DW_FORM_exprloc) -+ .byte 0 -+ .byte 0 -+ .uleb128 0xa # (abbrev code) -+ .uleb128 0x24 # (TAG: DW_TAG_base_type) -+ .byte 0 # 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 0xe # (DW_FORM_strp) -+ .byte 0 -+ .byte 0 -+ .byte 0 -+ .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 0 # Size of Segment Descriptor -+ .value 0 # Pad to 16 byte boundary -+ .value 0 -+ .quad .Ltext0 # Address -+ .quad .Letext0-.Ltext0 # Length -+ .quad 0 -+ .quad 0 -+ .section .debug_line,"",@progbits -+.Ldebug_line0: -+ .section .debug_str,"MS",@progbits,1 -+.LASF4: -+ .string "gdb.arch/x86_64-vla-pointer.c" -+.LASF7: -+ .string "array_t" -+.LASF3: -+ .string "GNU C11 6.2.1 20160916 (Red Hat 6.2.1-2) -mtune=generic -march=x86-64 -g" -+.LASF2: -+ .string "char" -+.LASF1: -+ .string "sizetype" -+.LASF5: -+ .string "/home/jkratoch/redhat/fedora/gdb/master/gdb-7.12/gdb/testsuite" -+.LASF6: -+ .string "size" -+.LASF0: -+ .string "array" -+ .ident "GCC: (GNU) 6.2.1 20160916 (Red Hat 6.2.1-2)" -+ .section .note.GNU-stack,"",@progbits -diff --git a/gdb/testsuite/gdb.arch/x86_64-vla-pointer.c b/gdb/testsuite/gdb.arch/x86_64-vla-pointer.c -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.arch/x86_64-vla-pointer.c -@@ -0,0 +1,45 @@ -+/* 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 . */ -+ -+#if 0 -+ -+void -+foo (int size) -+{ -+ typedef char array_t[size]; -+ array_t array; -+ int i; -+ -+ for (i = 0; i < size; i++) -+ array[i] = i; -+ -+ array[0] = 0; /* break-here */ -+} -+ -+#else -+ -+void foo (int size); -+ -+int -+main (void) -+{ -+ foo (26); -+ foo (78); -+ return 0; -+} -+ -+#endif -diff --git a/gdb/testsuite/gdb.arch/x86_64-vla-pointer.exp b/gdb/testsuite/gdb.arch/x86_64-vla-pointer.exp -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.arch/x86_64-vla-pointer.exp -@@ -0,0 +1,65 @@ -+# 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 . -+ -+if ![istarget "x86_64-*-*"] then { -+ verbose "Skipping over gdb.arch/x86_64-vla-pointer.exp test made only for x86_64." -+ return -+} -+ -+set testfile x86_64-vla-pointer -+set srcasmfile ${testfile}-foo.S -+set srcfile ${testfile}.c -+set binfile [standard_output_file ${testfile}] -+set binobjfile [standard_output_file ${testfile}-foo.o] -+if { [gdb_compile "${srcdir}/${subdir}/${srcasmfile}" "${binobjfile}" object {}] != "" } { -+ untested "Couldn't compile test program" -+ return -1 -+} -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile} ${binobjfile}" "${binfile}" executable {}] != "" } { -+ untested "Couldn't compile test program" -+ return -1 -+} -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfile} -+ -+if ![runto_main] { -+ untested x86_64-vla-pointer -+ return -1 -+} -+ -+gdb_breakpoint $srcfile:[gdb_get_line_number "break-here"] -+ -+gdb_continue_to_breakpoint "break-here" -+ -+gdb_test "whatis array" "type = array_t" "first: whatis array" -+gdb_test "whatis array_t" "type = char \\\[variable length\\\]" "first: whatis array_t" -+gdb_test "ptype array" "type = char \\\[26\\\]" "first: ptype array" -+ -+gdb_test "whatis *array" "type = char" "first: whatis *array" -+gdb_test "ptype *array" "type = char" "first: ptype *array" -+ -+gdb_test "p array\[1\]" "\\$\[0-9\] = 1 '\\\\001'" -+gdb_test "p array\[2\]" "\\$\[0-9\] = 2 '\\\\002'" -+gdb_test "p array\[3\]" "\\$\[0-9\] = 3 '\\\\003'" -+gdb_test "p array\[4\]" "\\$\[0-9\] = 4 '\\\\004'" -+ -+gdb_continue_to_breakpoint "break_here" -+ -+gdb_test "whatis array" "type = array_t" "second: whatis array" -+gdb_test "whatis array_t" "type = char \\\[variable length\\\]" "second: whatis array_t" -+gdb_test "ptype array" "type = char \\\[78\\\]" "second: ptype array" -diff --git a/gdb/testsuite/gdb.arch/x86_64-vla-typedef-foo.S b/gdb/testsuite/gdb.arch/x86_64-vla-typedef-foo.S -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.arch/x86_64-vla-typedef-foo.S -@@ -0,0 +1,455 @@ -+ .file "x86_64-vla-typedef.c" -+ .section .debug_abbrev,"",@progbits -+.Ldebug_abbrev0: -+ .section .debug_info,"",@progbits -+.Ldebug_info0: -+ .section .debug_line,"",@progbits -+.Ldebug_line0: -+ .text -+.Ltext0: -+.globl foo -+ .type foo, @function -+foo: -+.LFB2: -+ .file 1 "x86_64-vla-typedef.c" -+ .loc 1 22 0 -+ pushq %rbp -+.LCFI0: -+ movq %rsp, %rbp -+.LCFI1: -+ subq $64, %rsp -+.LCFI2: -+ movl %edi, -36(%rbp) -+ .loc 1 22 0 -+ movq %rsp, %rax -+ movq %rax, -48(%rbp) -+ .loc 1 23 0 -+ movl -36(%rbp), %edx -+ movslq %edx,%rax -+ subq $1, %rax -+ movq %rax, -24(%rbp) -+ .loc 1 24 0 -+ movslq %edx,%rax -+ addq $15, %rax -+ addq $15, %rax -+ shrq $4, %rax -+ salq $4, %rax -+ subq %rax, %rsp -+ movq %rsp, -56(%rbp) -+ movq -56(%rbp), %rax -+ addq $15, %rax -+ shrq $4, %rax -+ salq $4, %rax -+ movq %rax, -56(%rbp) -+ movq -56(%rbp), %rax -+ movq %rax, -16(%rbp) -+ .loc 1 27 0 -+ movl $0, -4(%rbp) -+ jmp .L2 -+.L3: -+ .loc 1 28 0 -+ movl -4(%rbp), %esi -+ movl -4(%rbp), %eax -+ movl %eax, %ecx -+ movq -16(%rbp), %rdx -+ movslq %esi,%rax -+ movb %cl, (%rdx,%rax) -+ .loc 1 27 0 -+ addl $1, -4(%rbp) -+.L2: -+ movl -4(%rbp), %eax -+ cmpl -36(%rbp), %eax -+ jl .L3 -+ .loc 1 30 0 -+ .globl break_here -+break_here: -+ movq -16(%rbp), %rax -+ movb $0, (%rax) -+ movq -48(%rbp), %rsp -+ .loc 1 31 0 -+ leave -+ ret -+.LFE2: -+ .size foo, .-foo -+ .section .debug_frame,"",@progbits -+.Lframe0: -+ .long .LECIE0-.LSCIE0 -+.LSCIE0: -+ .long 0xffffffff -+ .byte 0x1 -+ .string "" -+ .uleb128 0x1 -+ .sleb128 -8 -+ .byte 0x10 -+ .byte 0xc -+ .uleb128 0x7 -+ .uleb128 0x8 -+ .byte 0x90 -+ .uleb128 0x1 -+ .align 8 -+.LECIE0: -+.LSFDE0: -+ .long .LEFDE0-.LASFDE0 -+.LASFDE0: -+ .long .Lframe0 -+ .quad .LFB2 -+ .quad .LFE2-.LFB2 -+ .byte 0x4 -+ .long .LCFI0-.LFB2 -+ .byte 0xe -+ .uleb128 0x10 -+ .byte 0x86 -+ .uleb128 0x2 -+ .byte 0x4 -+ .long .LCFI1-.LCFI0 -+ .byte 0xd -+ .uleb128 0x6 -+ .align 8 -+.LEFDE0: -+ .section .eh_frame,"a",@progbits -+.Lframe1: -+ .long .LECIE1-.LSCIE1 -+.LSCIE1: -+ .long 0x0 -+ .byte 0x1 -+ .string "zR" -+ .uleb128 0x1 -+ .sleb128 -8 -+ .byte 0x10 -+ .uleb128 0x1 -+ .byte 0x3 -+ .byte 0xc -+ .uleb128 0x7 -+ .uleb128 0x8 -+ .byte 0x90 -+ .uleb128 0x1 -+ .align 8 -+.LECIE1: -+.LSFDE1: -+ .long .LEFDE1-.LASFDE1 -+.LASFDE1: -+ .long .LASFDE1-.Lframe1 -+ .long .LFB2 -+ .long .LFE2-.LFB2 -+ .uleb128 0x0 -+ .byte 0x4 -+ .long .LCFI0-.LFB2 -+ .byte 0xe -+ .uleb128 0x10 -+ .byte 0x86 -+ .uleb128 0x2 -+ .byte 0x4 -+ .long .LCFI1-.LCFI0 -+ .byte 0xd -+ .uleb128 0x6 -+ .align 8 -+.LEFDE1: -+ .text -+.Letext0: -+ .section .debug_loc,"",@progbits -+.Ldebug_loc0: -+.LLST0: -+ .quad .LFB2-.Ltext0 -+ .quad .LCFI0-.Ltext0 -+ .value 0x2 -+ .byte 0x77 -+ .sleb128 8 -+ .quad .LCFI0-.Ltext0 -+ .quad .LCFI1-.Ltext0 -+ .value 0x2 -+ .byte 0x77 -+ .sleb128 16 -+ .quad .LCFI1-.Ltext0 -+ .quad .LFE2-.Ltext0 -+ .value 0x2 -+ .byte 0x76 -+ .sleb128 16 -+ .quad 0x0 -+ .quad 0x0 -+ .section .debug_info -+ .long .Ldebug_end - .Ldebug_start -+.Ldebug_start: -+ .value 0x2 -+ .long .Ldebug_abbrev0 -+ .byte 0x8 -+ .uleb128 0x1 -+ .long .LASF2 -+ .byte 0x1 -+ .long .LASF3 -+ .long .LASF4 -+ .quad .Ltext0 -+ .quad .Letext0 -+ .long .Ldebug_line0 -+ .uleb128 0x2 -+ .byte 0x1 -+ .string "foo" -+ .byte 0x1 -+ .byte 0x16 -+ .byte 0x1 -+ .quad .LFB2 -+ .quad .LFE2 -+ .long .LLST0 -+ .long 0x83 -+ .uleb128 0x3 -+ .long .LASF5 -+ .byte 0x1 -+ .byte 0x15 -+ .long 0x83 -+ .byte 0x2 -+ .byte 0x91 -+ .sleb128 -52 -+.Ltag_typedef: -+ .uleb128 0x4 -+ .long .LASF6 -+ .byte 0x1 -+ .byte 0x17 -+ .long .Ltag_array_type - .debug_info -+ .uleb128 0x5 /* Abbrev Number: 5 (DW_TAG_variable) */ -+ .long .LASF0 -+ .byte 0x1 -+ .byte 0x18 -+#if 1 -+ .long .Ltag_typedef - .debug_info -+#else -+ /* Debugging only: Skip the typedef indirection. */ -+ .long .Ltag_array_type - .debug_info -+#endif -+ /* DW_AT_location: DW_FORM_block1: start */ -+ .byte 0x3 -+ .byte 0x91 -+ .sleb128 -32 -+#if 0 -+ .byte 0x6 /* DW_OP_deref */ -+#else -+ .byte 0x96 /* DW_OP_nop */ -+#endif -+ /* DW_AT_location: DW_FORM_block1: end */ -+ .uleb128 0x6 -+ .string "i" -+ .byte 0x1 -+ .byte 0x19 -+ .long 0x83 -+ .byte 0x2 -+ .byte 0x91 -+ .sleb128 -20 -+ .byte 0x0 -+ .uleb128 0x7 -+ .byte 0x4 -+ .byte 0x5 -+ .string "int" -+.Ltag_array_type: -+ .uleb128 0x8 /* Abbrev Number: 8 (DW_TAG_array_type) */ -+ .long 0xa0 + (2f - 1f) /* DW_AT_type: DW_FORM_ref4 */ -+ .long 0x9d + (2f - 1f) /* DW_AT_sibling: DW_FORM_ref4 */ -+1: /* DW_AT_data_location: DW_FORM_block1: start */ -+ .byte 2f - 3f /* length */ -+3: -+ .byte 0x97 /* DW_OP_push_object_address */ -+ .byte 0x6 /* DW_OP_deref */ -+2: /* DW_AT_data_location: DW_FORM_block1: end */ -+ .uleb128 0x9 -+ .long 0x9d + (2b - 1b) /* DW_AT_type: DW_FORM_ref4 */ -+ .byte 0x3 -+ .byte 0x91 -+ .sleb128 -40 -+ .byte 0x6 -+ .byte 0x0 -+ .uleb128 0xa -+ .byte 0x8 -+ .byte 0x7 -+ .uleb128 0xb -+ .byte 0x1 -+ .byte 0x6 -+ .long .LASF1 -+ .byte 0x0 -+.Ldebug_end: -+ .section .debug_abbrev -+ .uleb128 0x1 -+ .uleb128 0x11 -+ .byte 0x1 -+ .uleb128 0x25 -+ .uleb128 0xe -+ .uleb128 0x13 -+ .uleb128 0xb -+ .uleb128 0x3 -+ .uleb128 0xe -+ .uleb128 0x1b -+ .uleb128 0xe -+ .uleb128 0x11 -+ .uleb128 0x1 -+ .uleb128 0x12 -+ .uleb128 0x1 -+ .uleb128 0x10 -+ .uleb128 0x6 -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0x2 -+ .uleb128 0x2e -+ .byte 0x1 -+ .uleb128 0x3f -+ .uleb128 0xc -+ .uleb128 0x3 -+ .uleb128 0x8 -+ .uleb128 0x3a -+ .uleb128 0xb -+ .uleb128 0x3b -+ .uleb128 0xb -+ .uleb128 0x27 -+ .uleb128 0xc -+ .uleb128 0x11 -+ .uleb128 0x1 -+ .uleb128 0x12 -+ .uleb128 0x1 -+ .uleb128 0x40 -+ .uleb128 0x6 -+ .uleb128 0x1 -+ .uleb128 0x13 -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0x3 -+ .uleb128 0x5 -+ .byte 0x0 -+ .uleb128 0x3 -+ .uleb128 0xe -+ .uleb128 0x3a -+ .uleb128 0xb -+ .uleb128 0x3b -+ .uleb128 0xb -+ .uleb128 0x49 -+ .uleb128 0x13 -+ .uleb128 0x2 -+ .uleb128 0xa -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0x4 -+ .uleb128 0x16 -+ .byte 0x0 -+ .uleb128 0x3 -+ .uleb128 0xe -+ .uleb128 0x3a -+ .uleb128 0xb -+ .uleb128 0x3b -+ .uleb128 0xb -+ .uleb128 0x49 -+ .uleb128 0x13 -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0x5 -+ .uleb128 0x34 -+ .byte 0x0 -+ .uleb128 0x3 -+ .uleb128 0xe -+ .uleb128 0x3a -+ .uleb128 0xb -+ .uleb128 0x3b -+ .uleb128 0xb -+ .uleb128 0x49 -+ .uleb128 0x13 -+ .uleb128 0x2 -+ .uleb128 0xa -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0x6 -+ .uleb128 0x34 -+ .byte 0x0 -+ .uleb128 0x3 -+ .uleb128 0x8 -+ .uleb128 0x3a -+ .uleb128 0xb -+ .uleb128 0x3b -+ .uleb128 0xb -+ .uleb128 0x49 -+ .uleb128 0x13 -+ .uleb128 0x2 -+ .uleb128 0xa -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0x7 -+ .uleb128 0x24 -+ .byte 0x0 -+ .uleb128 0xb -+ .uleb128 0xb -+ .uleb128 0x3e -+ .uleb128 0xb -+ .uleb128 0x3 -+ .uleb128 0x8 -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0x8 /* Abbrev Number: 8 (DW_TAG_array_type) */ -+ .uleb128 0x1 -+ .byte 0x1 -+ .uleb128 0x49 /* DW_AT_type */ -+ .uleb128 0x13 /* DW_FORM_ref4 */ -+ .uleb128 0x1 /* DW_AT_sibling */ -+ .uleb128 0x13 /* DW_FORM_ref4 */ -+ .uleb128 0x50 /* DW_AT_data_location */ -+ .uleb128 0xa /* DW_FORM_block1 */ -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0x9 -+ .uleb128 0x21 -+ .byte 0x0 -+ .uleb128 0x49 /* DW_AT_type */ -+ .uleb128 0x13 /* DW_FORM_ref4 */ -+ .uleb128 0x2f -+ .uleb128 0xa -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0xa -+ .uleb128 0x24 -+ .byte 0x0 -+ .uleb128 0xb -+ .uleb128 0xb -+ .uleb128 0x3e -+ .uleb128 0xb -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0xb -+ .uleb128 0x24 -+ .byte 0x0 -+ .uleb128 0xb -+ .uleb128 0xb -+ .uleb128 0x3e -+ .uleb128 0xb -+ .uleb128 0x3 -+ .uleb128 0xe -+ .byte 0x0 -+ .byte 0x0 -+ .byte 0x0 -+ .section .debug_pubnames,"",@progbits -+ .long 0x16 -+ .value 0x2 -+ .long .Ldebug_info0 -+ .long 0xa8 -+ .long 0x2d -+ .string "foo" -+ .long 0x0 -+ .section .debug_aranges,"",@progbits -+ .long 0x2c -+ .value 0x2 -+ .long .Ldebug_info0 -+ .byte 0x8 -+ .byte 0x0 -+ .value 0x0 -+ .value 0x0 -+ .quad .Ltext0 -+ .quad .Letext0-.Ltext0 -+ .quad 0x0 -+ .quad 0x0 -+ .section .debug_str,"MS",@progbits,1 -+.LASF0: -+ .string "array" -+.LASF5: -+ .string "size" -+.LASF3: -+ .string "x86_64-vla-typedef.c" -+.LASF6: -+ .string "array_t" -+.LASF1: -+ .string "char" -+.LASF4: -+ .string "gdb.arch" -+.LASF2: -+ .string "GNU C 4.3.2 20081105 (Red Hat 4.3.2-7)" -+ .ident "GCC: (GNU) 4.3.2 20081105 (Red Hat 4.3.2-7)" -+ .section .note.GNU-stack,"",@progbits -diff --git a/gdb/testsuite/gdb.arch/x86_64-vla-typedef.c b/gdb/testsuite/gdb.arch/x86_64-vla-typedef.c -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.arch/x86_64-vla-typedef.c -@@ -0,0 +1,45 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 2008 Free Software Foundation, Inc. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . */ -+ -+#if 0 -+ -+void -+foo (int size) -+{ -+ typedef char array_t[size]; -+ array_t array; -+ int i; -+ -+ for (i = 0; i < size; i++) -+ array[i] = i; -+ -+ array[0] = 0; /* break-here */ -+} -+ -+#else -+ -+void foo (int size); -+ -+int -+main (void) -+{ -+ foo (26); -+ foo (78); -+ return 0; -+} -+ -+#endif -diff --git a/gdb/testsuite/gdb.arch/x86_64-vla-typedef.exp b/gdb/testsuite/gdb.arch/x86_64-vla-typedef.exp -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.arch/x86_64-vla-typedef.exp -@@ -0,0 +1,64 @@ -+# 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 . -+ -+# Test DW_AT_data_location accessed through DW_TAG_typedef intermediate. -+ -+if ![istarget "x86_64-*-*"] then { -+ verbose "Skipping over gdb.arch/x86_64-vla-typedef.exp test made only for x86_64." -+ return -+} -+ -+set testfile x86_64-vla-typedef -+set srcasmfile ${testfile}-foo.S -+set srcfile ${testfile}.c -+set binfile [standard_output_file ${testfile}] -+set binobjfile [standard_output_file ${testfile}-foo.o] -+if { [gdb_compile "${srcdir}/${subdir}/${srcasmfile}" "${binobjfile}" object {}] != "" } { -+ untested "Couldn't compile test program" -+ return -1 -+} -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile} ${binobjfile}" "${binfile}" executable {debug}] != "" } { -+ untested "Couldn't compile test program" -+ return -1 -+} -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfile} -+ -+if ![runto_main] { -+ untested x86_64-vla-typedef -+ return -1 -+} -+ -+gdb_breakpoint "break_here" -+ -+gdb_continue_to_breakpoint "break_here" -+ -+gdb_test "whatis array" "type = array_t" "first: whatis array" -+ -+gdb_test "ptype array" "type = char \\\[26\\\]" "first: ptype array" -+ -+gdb_test "p array\[1\]" "\\$\[0-9\] = 1 '\\\\001'" -+gdb_test "p array\[2\]" "\\$\[0-9\] = 2 '\\\\002'" -+gdb_test "p array\[3\]" "\\$\[0-9\] = 3 '\\\\003'" -+gdb_test "p array\[4\]" "\\$\[0-9\] = 4 '\\\\004'" -+ -+gdb_continue_to_breakpoint "break_here" -+ -+gdb_test "whatis array" "type = array_t" "second: whatis array" -+ -+gdb_test "ptype array" "type = char \\\[78\\\]" "second: ptype array" -diff --git a/gdb/testsuite/gdb.base/arrayidx.c b/gdb/testsuite/gdb.base/arrayidx.c ---- a/gdb/testsuite/gdb.base/arrayidx.c -+++ b/gdb/testsuite/gdb.base/arrayidx.c -@@ -17,6 +17,13 @@ - - int array[] = {1, 2, 3, 4}; - -+#ifdef __GNUC__ -+struct -+ { -+ int a[0]; -+ } unbound; -+#endif -+ - int - main (void) - { -diff --git a/gdb/testsuite/gdb.base/arrayidx.exp b/gdb/testsuite/gdb.base/arrayidx.exp ---- a/gdb/testsuite/gdb.base/arrayidx.exp -+++ b/gdb/testsuite/gdb.base/arrayidx.exp -@@ -49,4 +49,12 @@ gdb_test "print array" \ - "\\{\\\[0\\\] = 1, \\\[1\\\] = 2, \\\[2\\\] = 3, \\\[3\\\] = 4\\}" \ - "print array with array-indexes on" - -- -+set test "p unbound.a == &unbound.a\[0\]" -+gdb_test_multiple $test $test { -+ -re " = 1\r\n$gdb_prompt $" { -+ pass $test -+ } -+ -re "No symbol \"unbound\" in current context.\r\n$gdb_prompt $" { -+ unsupported "$test (no GCC)" -+ } -+} -diff --git a/gdb/testsuite/gdb.base/internal-var-field-address.c b/gdb/testsuite/gdb.base/internal-var-field-address.c -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.base/internal-var-field-address.c -@@ -0,0 +1,20 @@ -+/* 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 . */ -+ -+struct { -+ int field; -+} staticstruct = { 1 }; -diff --git a/gdb/testsuite/gdb.base/internal-var-field-address.exp b/gdb/testsuite/gdb.base/internal-var-field-address.exp -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.base/internal-var-field-address.exp -@@ -0,0 +1,26 @@ -+# 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 test internal-var-field-address -+set binfile ${test}.x -+if { [gdb_compile "${srcdir}/${subdir}/${test}.c" "[standard_output_file ${binfile}]" object {debug}] != "" } { -+ untested "Couldn't compile test program" -+ return -1 -+} -+ -+clean_restart $binfile -+ -+gdb_test {set $varstruct = staticstruct} -+gdb_test {p $varstruct.field} " = 1" -diff --git a/gdb/testsuite/gdb.base/vla-frame.c b/gdb/testsuite/gdb.base/vla-frame.c -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.base/vla-frame.c -@@ -0,0 +1,31 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ 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 . */ -+ -+#include -+ -+int -+main (int argc, char **argv) -+{ -+ char s[2 + argc]; -+ void (*f) (char *) = 0; -+ -+ memset (s, 0, sizeof (s)); -+ s[0] = 'X'; -+ -+ f (s); -+ return 0; -+} -diff --git a/gdb/testsuite/gdb.base/vla-frame.exp b/gdb/testsuite/gdb.base/vla-frame.exp -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.base/vla-frame.exp -@@ -0,0 +1,38 @@ -+# 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 . -+ -+set testfile vla-frame -+set executable ${testfile} -+ -+if { [prepare_for_testing ${testfile}.exp ${executable}] } { -+ return -1 -+} -+ -+if ![runto_main] { -+ return -1 -+} -+ -+set test "continue" -+gdb_test_multiple $test $test { -+ -re "Continuing\\.\r\n\r\nProgram received signal SIGSEGV, Segmentation fault\\.\r\n0x0+ in \\?\\? \\(\\)\r\n$gdb_prompt $" { -+ pass $test -+ } -+ -re "\r\n$gdb_prompt $" { -+ untested ${testfile}.exp -+ return -+ } -+} -+ -+gdb_test "bt full" "\r\n +s = \"X\\\\000\"\r\n.*" -diff --git a/gdb/testsuite/gdb.base/vla-overflow.c b/gdb/testsuite/gdb.base/vla-overflow.c -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.base/vla-overflow.c -@@ -0,0 +1,30 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 2008 Free Software Foundation, Inc. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . */ -+ -+#include -+ -+int -+main (int argc, char **argv) -+{ -+ int array[argc]; -+ -+ array[0] = array[0]; -+ -+ abort (); -+ -+ return 0; -+} -diff --git a/gdb/testsuite/gdb.base/vla-overflow.exp b/gdb/testsuite/gdb.base/vla-overflow.exp -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.base/vla-overflow.exp -@@ -0,0 +1,109 @@ -+# 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 . -+ -+# We could crash in: -+# #0 block_linkage_function (bl=0x0) at ../../gdb/block.c:69 -+# #1 in dwarf_block_get_frame_base (...) at ../../gdb/dwarf2block.c:97 -+# 97 framefunc = block_linkage_function (get_frame_block (frame, NULL)); -+# #2 in execute_stack_op (...) at ../../gdb/dwarf2expr.c:496 -+# #3 in dwarf_block_exec_core () at ../../gdb/dwarf2block.c:156 -+# #4 dwarf_block_exec (...) at ../../gdb/dwarf2block.c:206 -+# #5 in range_type_count_bound_internal (...) at ../../gdb/gdbtypes.c:1430 -+# #6 in create_array_type (...) at ../../gdb/gdbtypes.c:840 -+# ... -+# #21 in psymtab_to_symtab (...) at ../../gdb/symfile.c:292 -+# ... -+# #29 in backtrace_command_1 () at ../../gdb/stack.c:1273 -+ -+set testfile vla-overflow -+set shfile [standard_output_file ${testfile}-gdb.sh] -+set srcfile ${testfile}.c -+set binfile [standard_output_file ${testfile}] -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { -+ untested "Couldn't compile test program" -+ return -1 -+} -+ -+set f [open "|getconf PAGESIZE" "r"] -+gets $f pagesize -+close $f -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfile} -+ -+set pid_of_gdb [exp_pid -i [board_info host fileid]] -+ -+if { [runto_main] < 0 } { -+ untested vla-overflow -+ return -1 -+} -+ -+# Get the GDB memory size when we stay at main. -+ -+proc memory_v_pages_get {} { -+ global pid_of_gdb pagesize -+ set fd [open "/proc/$pid_of_gdb/statm"] -+ gets $fd line -+ close $fd -+ # number of pages of virtual memory -+ scan $line "%d" drs -+ return $drs -+} -+ -+set pages_found [memory_v_pages_get] -+ -+# s390x with glibc-debuginfo.s390x installed used approx. 16MB. -+set mb_reserve 40 -+verbose -log "pages_found = $pages_found, mb_reserve = $mb_reserve" -+set kb_found [expr $pages_found * $pagesize / 1024] -+set kb_permit [expr $kb_found + 1 * 1024 + $mb_reserve * 1024] -+verbose -log "kb_found = $kb_found, kb_permit = $kb_permit" -+ -+# Create the ulimit wrapper. -+set f [open $shfile "w"] -+puts $f "#! /bin/sh" -+puts $f "ulimit -v $kb_permit" -+puts $f "exec $GDB \"\$@\"" -+close $f -+remote_exec host "chmod +x $shfile" -+ -+gdb_exit -+set GDBold $GDB -+set GDB "$shfile" -+gdb_start -+set GDB $GDBold -+ -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfile} -+ -+set pid_of_gdb [exp_pid -i [board_info host fileid]] -+ -+# Check the size again after the second run. -+# We must not stop in main as it would cache `array' and never crash later. -+ -+gdb_run_cmd -+ -+verbose -log "kb_found before abort() = [expr [memory_v_pages_get] * $pagesize / 1024]" -+ -+gdb_test "" "Program received signal SIGABRT, Aborted..*" "Enter abort()" -+ -+verbose -log "kb_found in abort() = [expr [memory_v_pages_get] * $pagesize / 1024]" -+ -+# `abort' can get expressed as `*__GI_abort'. -+gdb_test "bt" "in \[^ \]*abort \\(.* in main \\(.*" "Backtrace after abort()" -+ -+verbose -log "kb_found in bt after abort() = [expr [memory_v_pages_get] * $pagesize / 1024]" -diff --git a/gdb/testsuite/gdb.base/vla.c b/gdb/testsuite/gdb.base/vla.c -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.base/vla.c -@@ -0,0 +1,55 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 2008 Free Software Foundation, Inc. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . */ -+ -+#include -+ -+void -+marker (void) -+{ -+} -+ -+void -+bar (char *a, char *b, char *c, int size) -+{ -+ memset (a, '1', size); -+ memset (b, '2', size); -+ memset (c, '3', 48); -+} -+ -+void -+foo (int size) -+{ -+ char temp1[size]; -+ char temp3[48]; -+ -+ temp1[size - 1] = '\0'; -+ { -+ char temp2[size]; -+ -+ bar (temp1, temp2, temp3, size); -+ -+ marker (); /* break-here */ -+ } -+} -+ -+int -+main (void) -+{ -+ foo (26); -+ foo (78); -+ return 0; -+} -diff --git a/gdb/testsuite/gdb.base/vla.exp b/gdb/testsuite/gdb.base/vla.exp -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.base/vla.exp -@@ -0,0 +1,62 @@ -+# 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 vla -+set srcfile ${testfile}.c -+set binfile [standard_output_file ${testfile}] -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { -+ untested "Couldn't compile test program" -+ return -1 -+} -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfile} -+ -+if ![runto_main] { -+ untested vla -+ return -1 -+} -+ -+gdb_breakpoint [gdb_get_line_number "break-here"] -+ -+gdb_continue_to_breakpoint "break-here" -+ -+gdb_test "whatis temp1" "type = char \\\[26\\\]" "first: whatis temp1" -+gdb_test "whatis temp2" "type = char \\\[26\\\]" "first: whatis temp2" -+gdb_test "whatis temp3" "type = char \\\[48\\\]" "first: whatis temp3" -+ -+gdb_test "ptype temp1" "type = char \\\[26\\\]" "first: ptype temp1" -+gdb_test "ptype temp2" "type = char \\\[26\\\]" "first: ptype temp2" -+gdb_test "ptype temp3" "type = char \\\[48\\\]" "first: ptype temp3" -+ -+gdb_test "p temp1" " = '1' " "first: print temp1" -+gdb_test "p temp2" " = '2' " "first: print temp2" -+gdb_test "p temp3" " = '3' " "first: print temp3" -+ -+gdb_continue_to_breakpoint "break-here" -+ -+gdb_test "whatis temp1" "type = char \\\[78\\\]" "second: whatis temp1" -+gdb_test "whatis temp2" "type = char \\\[78\\\]" "second: whatis temp2" -+gdb_test "whatis temp3" "type = char \\\[48\\\]" "second: whatis temp3" -+ -+gdb_test "ptype temp1" "type = char \\\[78\\\]" "second: ptype temp1" -+gdb_test "ptype temp2" "type = char \\\[78\\\]" "second: ptype temp2" -+gdb_test "ptype temp3" "type = char \\\[48\\\]" "second: ptype temp3" -+ -+gdb_test "p temp1" " = '1' " "second: print temp1" -+gdb_test "p temp2" " = '2' " "second: print temp2" -+gdb_test "p temp3" " = '3' " "second: print temp3" -diff --git a/gdb/testsuite/gdb.cp/gdb9593.cc b/gdb/testsuite/gdb.cp/gdb9593.cc -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.cp/gdb9593.cc -@@ -0,0 +1,180 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 2008, 2009 Free Software Foundation, Inc. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . -+ */ -+#include -+ -+using namespace std; -+ -+class NextOverThrowDerivates -+{ -+ -+public: -+ -+ -+ // Single throw an exception in this function. -+ void function1() -+ { -+ throw 20; -+ } -+ -+ // Throw an exception in another function. -+ void function2() -+ { -+ function1(); -+ } -+ -+ // Throw an exception in another function, but handle it -+ // locally. -+ void function3 () -+ { -+ { -+ try -+ { -+ function1 (); -+ } -+ catch (...) -+ { -+ cout << "Caught and handled function1 exception" << endl; -+ } -+ } -+ } -+ -+ void rethrow () -+ { -+ try -+ { -+ function1 (); -+ } -+ catch (...) -+ { -+ throw; -+ } -+ } -+ -+ void finish () -+ { -+ // We use this to test that a "finish" here does not end up in -+ // this frame, but in the one above. -+ try -+ { -+ function1 (); -+ } -+ catch (int x) -+ { -+ } -+ function1 (); // marker for until -+ } -+ -+ void until () -+ { -+ function1 (); -+ function1 (); // until here -+ } -+ -+}; -+NextOverThrowDerivates next_cases; -+ -+ -+int main () -+{ -+ try -+ { -+ next_cases.function1 (); -+ } -+ catch (...) -+ { -+ // Discard -+ } -+ -+ try -+ { -+ next_cases.function2 (); -+ } -+ catch (...) -+ { -+ // Discard -+ } -+ -+ try -+ { -+ // This is duplicated so we can next over one but step into -+ // another. -+ next_cases.function2 (); -+ } -+ catch (...) -+ { -+ // Discard -+ } -+ -+ next_cases.function3 (); -+ -+ try -+ { -+ next_cases.rethrow (); -+ } -+ catch (...) -+ { -+ // Discard -+ } -+ -+ try -+ { -+ // Another duplicate so we can test "finish". -+ next_cases.function2 (); -+ } -+ catch (...) -+ { -+ // Discard -+ } -+ -+ // Another test for "finish". -+ try -+ { -+ next_cases.finish (); -+ } -+ catch (...) -+ { -+ } -+ -+ // Test of "until". -+ try -+ { -+ next_cases.finish (); -+ } -+ catch (...) -+ { -+ } -+ -+ // Test of "until" with an argument. -+ try -+ { -+ next_cases.until (); -+ } -+ catch (...) -+ { -+ } -+ -+ // Test of "advance". -+ try -+ { -+ next_cases.until (); -+ } -+ catch (...) -+ { -+ } -+} -+ -diff --git a/gdb/testsuite/gdb.cp/gdb9593.exp b/gdb/testsuite/gdb.cp/gdb9593.exp -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.cp/gdb9593.exp -@@ -0,0 +1,182 @@ -+# Copyright 2008, 2009 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+ -+if $tracelevel then { -+ strace $tracelevel -+} -+ -+if { [skip_cplus_tests] } { continue } -+ -+set testfile "gdb9593" -+set srcfile ${testfile}.cc -+set binfile [standard_output_file $testfile] -+ -+# Create and source the file that provides information about the compiler -+# used to compile the test case. -+if [get_compiler_info "c++"] { -+ untested gdb9593.exp -+ return -1 -+} -+ -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } { -+ untested gdb9593.exp -+ return -1 -+} -+ -+# Some targets can't do function calls, so don't even bother with this -+# test. -+if [target_info exists gdb,cannot_call_functions] { -+ setup_xfail "*-*-*" 9593 -+ fail "This target can not call functions" -+ continue -+} -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfile} -+ -+if ![runto_main] then { -+ perror "couldn't run to main" -+ continue -+} -+ -+# See whether we have the needed unwinder hooks. -+set ok 1 -+gdb_test_multiple "print _Unwind_DebugHook" "check for unwinder hook" { -+ -re "= .*_Unwind_DebugHook.*\r\n$gdb_prompt $" { -+ pass "check for unwinder hook" -+ } -+ -re "No symbol .* in current context.\r\n$gdb_prompt $" { -+ # Pass the test so we don't get bogus fails in the results. -+ pass "check for unwinder hook" -+ set ok 0 -+ } -+} -+if {!$ok} { -+ untested gdb9593.exp -+ return -1 -+} -+ -+# See http://sourceware.org/bugzilla/show_bug.cgi?id=9593 -+ -+gdb_test "next" \ -+ ".*catch (...).*" \ -+ "next over a throw 1" -+ -+gdb_test "next" \ -+ ".*next_cases.function2.*" \ -+ "next past catch 1" -+ -+gdb_test "next" \ -+ ".*catch (...).*" \ -+ "next over a throw 2" -+ -+gdb_test "next" \ -+ ".*next_cases.function2.*" \ -+ "next past catch 2" -+ -+gdb_test "step" \ -+ ".*function1().*" \ -+ "step into function2 1" -+ -+gdb_test "next" \ -+ ".*catch (...).*" \ -+ "next over a throw 3" -+ -+gdb_test "next" \ -+ ".*next_cases.function3.*" \ -+ "next past catch 3" -+ -+gdb_test "next" \ -+ ".*next_cases.rethrow.*" \ -+ "next over a throw 4" -+ -+gdb_test "next" \ -+ ".*catch (...).*" \ -+ "next over a rethrow" -+ -+gdb_test "next" \ -+ ".*next_cases.function2.*" \ -+ "next after a rethrow" -+ -+gdb_test "step" \ -+ ".*function1().*" \ -+ "step into function2 2" -+ -+gdb_test "finish" \ -+ ".*catch (...).*" \ -+ "finish 1" -+ -+gdb_test "next" \ -+ ".*next_cases.finish ().*" \ -+ "next past catch 4" -+ -+gdb_test "step" \ -+ ".*function1 ().*" \ -+ "step into finish method" -+ -+gdb_test "finish" \ -+ ".*catch (...).*" \ -+ "finish 2" -+ -+gdb_test "next" \ -+ ".*next_cases.finish ().*" \ -+ "next past catch 5" -+ -+gdb_test "step" \ -+ ".*function1 ().*" \ -+ "step into finish, for until" -+ -+gdb_test "until" \ -+ ".*function1 ().*" \ -+ "until with no argument 1" -+ -+set line [gdb_get_line_number "marker for until" $testfile.cc] -+ -+gdb_test "until $line" \ -+ ".*function1 ().*" \ -+ "next past catch 6" -+ -+gdb_test "until" \ -+ ".*catch (...).*" \ -+ "until with no argument 2" -+ -+set line [gdb_get_line_number "until here" $testfile.cc] -+ -+gdb_test "next" \ -+ ".*next_cases.until ().*" \ -+ "next past catch 6" -+ -+gdb_test "step" \ -+ ".*function1 ().*" \ -+ "step into until" -+ -+gdb_test "until $line" \ -+ ".*catch (...).*" \ -+ "until-over-throw" -+ -+gdb_test "next" \ -+ ".*next_cases.until ().*" \ -+ "next past catch 7" -+ -+gdb_test "step" \ -+ ".*function1 ().*" \ -+ "step into until, for advance" -+ -+gdb_test "advance $line" \ -+ ".*catch (...).*" \ -+ "advance-over-throw" -diff --git a/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.S b/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.S -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.S -@@ -0,0 +1,246 @@ -+/* 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 . */ -+ -+/* Debug information */ -+ -+/* We will `break *main' at the very first instruction. */ -+#define main_length 1 -+ -+ .section .data -+vardata: -+ /* See DW_OP_lit3 + 1 (0-based). */ -+ .string "seennotseen" -+ -+ .section .debug_info -+.Lcu1_begin: -+ .4byte .Lcu1_end - .Lcu1_start /* Length of Compilation Unit */ -+.Lcu1_start: -+ .2byte 2 /* DWARF version number */ -+ .4byte .Ldebug_abbrev0 /* Offset Into Abbrev. Section */ -+ .byte 4 /* Pointer Size (in bytes) */ -+ -+ /* CU die */ -+ .uleb128 1 /* Abbrev: DW_TAG_compile_unit */ -+ .4byte .Lproducer /* DW_AT_producer */ -+ /* Use C++ to exploit a bug in parsing DW_AT_name "". */ -+ .byte 4 /* DW_AT_language (C++) - */ -+ .4byte main /* DW_AT_low_pc */ -+ .byte main_length /* DW_AT_high_pc */ -+ -+.Larray_type: -+ .uleb128 2 /* Abbrev: DW_TAG_array_type */ -+ .4byte .Lchar_type-.Lcu1_begin /* DW_AT_type */ -+ -+ .uleb128 3 /* Abbrev: DW_TAG_subrange_type */ -+ .4byte .Luint_type-.Lcu1_begin /* DW_AT_type */ -+ .byte 0 /* DW_AT_lower_bound */ -+ .4byte .Llen_var-.Lcu1_begin /* DW_AT_upper_bound */ -+ .byte 0 /* End of children of die */ -+ -+ /* DW_AT_upper_bound is referencing an optimized-out variable. */ -+.Larrayb_type: -+ .uleb128 2 /* Abbrev: DW_TAG_array_type */ -+ .4byte .Lchar_type-.Lcu1_begin /* DW_AT_type */ -+ -+ .uleb128 3 /* Abbrev: DW_TAG_subrange_type */ -+ .4byte .Luint_type-.Lcu1_begin /* DW_AT_type */ -+ .byte 0 /* DW_AT_lower_bound */ -+ .4byte .Llenb_var-.Lcu1_begin /* DW_AT_upper_bound */ -+ .byte 0 /* End of children of die */ -+ -+ /* DW_AT_upper_bound is referencing register. */ -+.Larrayreg_type: -+ .uleb128 2 /* Abbrev: DW_TAG_array_type */ -+ .4byte .Lchar_type-.Lcu1_begin /* DW_AT_type */ -+ -+ .uleb128 8 /* Abbrev: DW_TAG_subrange_type with block */ -+ .4byte .Luint_type-.Lcu1_begin /* DW_AT_type */ -+ .byte 0 /* DW_AT_lower_bound */ -+ .byte 2f - 1f /* DW_AT_upper_bound */ -+1: .byte 0x50 /* DW_OP_reg0 */ -+2: -+ .byte 0 /* End of children of die */ -+ -+.Luint_type: -+ .uleb128 4 /* Abbrev: DW_TAG_base_type */ -+ .4byte .Luint_str /* DW_AT_name */ -+ .byte 4 /* DW_AT_byte_size */ -+ .byte 7 /* DW_AT_encoding */ -+ -+.Lchar_type: -+ .uleb128 4 /* Abbrev: DW_TAG_base_type */ -+ .4byte .Lchar_str /* DW_AT_name */ -+ .byte 1 /* DW_AT_byte_size */ -+ .byte 6 /* DW_AT_encoding */ -+ -+.Llen_var: -+ .uleb128 5 /* Abbrev: DW_TAG_variable artificial */ -+ .byte 1 /* DW_AT_artificial */ -+ .4byte .Luint_type-.Lcu1_begin /* DW_AT_type */ -+ .4byte .Llen_loclist-.Lloclist /* DW_AT_location */ -+ -+ /* optimized-out variable for b_string. */ -+.Llenb_var: -+ .uleb128 7 /* Abbrev: DW_TAG_variable artificial no DW_AT_location */ -+ .byte 1 /* DW_AT_artificial */ -+ .4byte .Luint_type-.Lcu1_begin /* DW_AT_type */ -+ -+ .uleb128 6 /* Abbrev: DW_TAG_variable DW_FORM_string */ -+ .string "a_string" /* DW_AT_name */ -+ .4byte .Larray_type-.Lcu1_begin /* DW_AT_type */ -+ .byte 2f - 1f /* DW_AT_location */ -+1: .byte 3 /* DW_OP_addr */ -+ .4byte vardata /* */ -+2: -+ -+ /* DW_AT_upper_bound is referencing an optimized-out variable. */ -+ .uleb128 6 /* Abbrev: DW_TAG_variable DW_FORM_string */ -+ .string "b_string" /* DW_AT_name */ -+ .4byte .Larrayb_type-.Lcu1_begin /* DW_AT_type */ -+ .byte 2f - 1f /* DW_AT_location */ -+1: .byte 3 /* DW_OP_addr */ -+ .4byte vardata /* */ -+2: -+ -+ /* DW_AT_upper_bound is referencing register. */ -+ .uleb128 6 /* Abbrev: DW_TAG_variable DW_FORM_string */ -+ .string "reg_string" /* DW_AT_name */ -+ .4byte .Larrayreg_type-.Lcu1_begin /* DW_AT_type */ -+ .byte 2f - 1f /* DW_AT_location */ -+1: .byte 3 /* DW_OP_addr */ -+ .4byte vardata /* */ -+2: -+ -+ .byte 0 /* End of children of CU */ -+.Lcu1_end: -+ -+ .section .debug_loc -+.Lloclist: -+.Llen_loclist: -+ .4byte 0 # Location list begin address -+ .4byte main_length # Location list end address -+ .value 2f-1f # Location expression size -+1: .byte 0x33 # DW_OP_lit3 -+ .byte 0x9f # DW_OP_stack_value -+2: -+ .quad 0x0 # Location list terminator begin (*.LLST2) -+ .quad 0x0 # Location list terminator end (*.LLST2) -+ -+ .section .debug_abbrev -+.Ldebug_abbrev0: -+ .uleb128 1 /* Abbrev code */ -+ .uleb128 0x11 /* DW_TAG_compile_unit */ -+ .byte 0x1 /* has_children */ -+ .uleb128 0x25 /* DW_AT_producer */ -+ .uleb128 0xe /* DW_FORM_strp */ -+ .uleb128 0x13 /* DW_AT_language */ -+ .uleb128 0xb /* DW_FORM_data1 */ -+ .uleb128 0x11 /* DW_AT_low_pc */ -+ .uleb128 0x1 /* DW_FORM_addr */ -+ .uleb128 0x12 /* DW_AT_high_pc */ -+ .uleb128 0xb /* DW_FORM_data1 */ -+ .byte 0x0 /* Terminator */ -+ .byte 0x0 /* Terminator */ -+ -+ .uleb128 2 /* Abbrev code */ -+ .uleb128 0x1 /* TAG: DW_TAG_array_type */ -+ .byte 0x1 /* DW_children_yes */ -+ .uleb128 0x49 /* DW_AT_type */ -+ .uleb128 0x13 /* DW_FORM_ref4 */ -+ .byte 0x0 /* Terminator */ -+ .byte 0x0 /* Terminator */ -+ -+ .uleb128 3 /* Abbrev code */ -+ .uleb128 0x21 /* DW_TAG_subrange_type */ -+ .byte 0x0 /* no children */ -+ .uleb128 0x49 /* DW_AT_type */ -+ .uleb128 0x13 /* DW_FORM_ref4 */ -+ .uleb128 0x22 /* DW_AT_lower_bound */ -+ .uleb128 0xb /* DW_FORM_data1 */ -+ .uleb128 0x2f /* DW_AT_upper_bound */ -+ .uleb128 0x13 /* DW_FORM_ref4 */ -+ .byte 0x0 /* Terminator */ -+ .byte 0x0 /* Terminator */ -+ -+ .uleb128 4 /* Abbrev code */ -+ .uleb128 0x24 /* DW_TAG_base_type */ -+ .byte 0x0 /* no_children */ -+ .uleb128 0x3 /* DW_AT_name */ -+ .uleb128 0xe /* DW_FORM_strp */ -+ .uleb128 0xb /* DW_AT_byte_size */ -+ .uleb128 0xb /* DW_FORM_data1 */ -+ .uleb128 0x3e /* DW_AT_encoding */ -+ .uleb128 0xb /* DW_FORM_data1 */ -+ .byte 0x0 /* Terminator */ -+ .byte 0x0 /* Terminator */ -+ -+ .uleb128 5 /* Abbrev code */ -+ .uleb128 0x34 /* DW_TAG_variable */ -+ .byte 0x0 /* no_children */ -+ .uleb128 0x34 /* DW_AT_artificial */ -+ .uleb128 0x0c /* DW_FORM_flag */ -+ .uleb128 0x49 /* DW_AT_type */ -+ .uleb128 0x13 /* DW_FORM_ref4 */ -+ .uleb128 0x02 /* DW_AT_location */ -+ .uleb128 0x06 /* DW_FORM_data4 */ -+ .byte 0x0 /* Terminator */ -+ .byte 0x0 /* Terminator */ -+ -+ .uleb128 6 /* Abbrev code */ -+ .uleb128 0x34 /* DW_TAG_variable */ -+ .byte 0x0 /* no_children */ -+ .uleb128 0x3 /* DW_AT_name */ -+ .uleb128 0x8 /* DW_FORM_string */ -+ .uleb128 0x49 /* DW_AT_type */ -+ .uleb128 0x13 /* DW_FORM_ref4 */ -+ .uleb128 0x2 /* DW_AT_location */ -+ .uleb128 0xa /* DW_FORM_block1 */ -+ .byte 0x0 /* Terminator */ -+ .byte 0x0 /* Terminator */ -+ -+ .uleb128 7 /* Abbrev code */ -+ .uleb128 0x34 /* DW_TAG_variable */ -+ .byte 0x0 /* no_children */ -+ .uleb128 0x34 /* DW_AT_artificial */ -+ .uleb128 0x0c /* DW_FORM_flag */ -+ .uleb128 0x49 /* DW_AT_type */ -+ .uleb128 0x13 /* DW_FORM_ref4 */ -+ .byte 0x0 /* Terminator */ -+ .byte 0x0 /* Terminator */ -+ -+ .uleb128 8 /* Abbrev code */ -+ .uleb128 0x21 /* DW_TAG_subrange_type with block */ -+ .byte 0x0 /* no children */ -+ .uleb128 0x49 /* DW_AT_type */ -+ .uleb128 0x13 /* DW_FORM_ref4 */ -+ .uleb128 0x22 /* DW_AT_lower_bound */ -+ .uleb128 0xb /* DW_FORM_data1 */ -+ .uleb128 0x2f /* DW_AT_upper_bound */ -+ .uleb128 0xa /* DW_FORM_block1 */ -+ .byte 0x0 /* Terminator */ -+ .byte 0x0 /* Terminator */ -+ -+ .byte 0x0 /* Terminator */ -+ -+/* String table */ -+ .section .debug_str -+.Lproducer: -+ .string "GNU C 3.3.3" -+.Lchar_str: -+ .string "char" -+.Luint_str: -+ .string "unsigned int" -diff --git a/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.exp b/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.exp -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.exp -@@ -0,0 +1,66 @@ -+# Copyright 2010 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+# Test printing variable with dynamic bounds which reference a different -+# (artificial in the GCC case) variable containing loclist as its location. -+# This testcase uses value (not address) of the referenced variable: -+# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43762 -+ -+# This test can only be run on targets which support DWARF-2 and use gas. -+# For now pick a sampling of likely targets. -+if {![istarget *-*-linux*] -+ && ![istarget *-*-gnu*] -+ && ![istarget *-*-elf*] -+ && ![istarget *-*-openbsd*] -+ && ![istarget arm-*-eabi*] -+ && ![istarget powerpc-*-eabi*]} { -+ return 0 -+} -+ -+set testfile dw2-bound-loclist -+if { [prepare_for_testing ${testfile}.exp ${testfile} [list ${testfile}.S main.c] {}] } { -+ return -1 -+} -+ -+# Verify it behaves at least as an unbound array without inferior. -+ -+# FIXME: FSF GDB crashes due to !has_stack_frames (). -+# But in practice that should not happen. -+# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43762 -+#set test "p a_string" -+#gdb_test_multiple $test $test { -+# -re " = 0x\[0-9a-f\]+ \"seennotseen\"\r\n$gdb_prompt $" { -+# pass $test -+# } -+# -re "No registers\\.\r\n$gdb_prompt $" { -+# kfail "vlaregression" $test -+# } -+#} -+# -+#gdb_test "ptype a_string" {type = char \[variable length\]} -+ -+# Not runto_main as dw2-bound-loclist.S handles only the first byte of main. -+if ![runto "*main"] { -+ return -1 -+} -+ -+gdb_test "p a_string" { = "seen"} -+gdb_test "ptype a_string" {type = char \[4\]} -+ -+gdb_test "p b_string" { = (0x[0-9a-f]+ )?"seennotseen"} -+gdb_test "ptype b_string" {type = char \[\]} -+ -+# The register contains unpredictable value - the array size. -+gdb_test "ptype reg_string" {type = char \[-?[0-9]+\]} -diff --git a/gdb/testsuite/gdb.dwarf2/dw2-stripped.c b/gdb/testsuite/gdb.dwarf2/dw2-stripped.c -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.dwarf2/dw2-stripped.c -@@ -0,0 +1,42 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 2004 Free Software Foundation, Inc. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 2 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program; if not, write to the Free Software -+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, -+ USA. */ -+ -+ -+/* The function `func1' traced into must have debug info on offset > 0; -+ (DW_UNSND (attr)). This is the reason of `func0' existence. */ -+ -+void -+func0(int a, int b) -+{ -+} -+ -+/* `func1' being traced into must have some arguments to dump. */ -+ -+void -+func1(int a, int b) -+{ -+ func0 (a,b); -+} -+ -+int -+main(void) -+{ -+ func1 (1, 2); -+ return 0; -+} -diff --git a/gdb/testsuite/gdb.dwarf2/dw2-stripped.exp b/gdb/testsuite/gdb.dwarf2/dw2-stripped.exp -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.dwarf2/dw2-stripped.exp -@@ -0,0 +1,79 @@ -+# Copyright 2006 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 2 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program; if not, write to the Free Software -+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -+ -+# Minimal DWARF-2 unit test -+ -+# This test can only be run on targets which support DWARF-2. -+# For now pick a sampling of likely targets. -+if {![istarget *-*-linux*] -+ && ![istarget *-*-gnu*] -+ && ![istarget *-*-elf*] -+ && ![istarget *-*-openbsd*] -+ && ![istarget arm-*-eabi*] -+ && ![istarget powerpc-*-eabi*]} { -+ return 0 -+} -+ -+set testfile "dw2-stripped" -+set srcfile ${testfile}.c -+set binfile [standard_output_file ${testfile}.x] -+ -+remote_exec build "rm -f ${binfile}" -+ -+# get the value of gcc_compiled -+if [get_compiler_info ${binfile}] { -+ return -1 -+} -+ -+# This test can only be run on gcc as we use additional_flags=FIXME -+if {$gcc_compiled == 0} { -+ return 0 -+} -+ -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-ggdb3}] != "" } { -+ return -1 -+} -+ -+remote_exec build "objcopy -R .debug_loc ${binfile}" -+set strip_output [remote_exec build "objdump -h ${binfile}"] -+ -+set test "stripping test file preservation" -+if [ regexp ".debug_info " $strip_output] { -+ pass "$test (.debug_info preserved)" -+} else { -+ fail "$test (.debug_info got also stripped)" -+} -+ -+set test "stripping test file functionality" -+if [ regexp ".debug_loc " $strip_output] { -+ fail "$test (.debug_loc still present)" -+} else { -+ pass "$test (.debug_loc stripped)" -+} -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfile} -+ -+# For C programs, "start" should stop in main(). -+ -+gdb_test "start" \ -+ ".*main \\(\\) at .*" \ -+ "start" -+gdb_test "step" \ -+ "func.* \\(.*\\) at .*" \ -+ "step" -diff --git a/gdb/testsuite/gdb.dwarf2/dw2-struct-member-data-location.S b/gdb/testsuite/gdb.dwarf2/dw2-struct-member-data-location.S -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.dwarf2/dw2-struct-member-data-location.S -@@ -0,0 +1,83 @@ -+/* 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 . */ -+ -+/* Debug information */ -+ -+ .section .debug_info -+.Lcu1_begin: -+ /* CU header */ -+ .4byte .Lcu1_end - .Lcu1_start /* Length of Compilation Unit */ -+.Lcu1_start: -+ .2byte 2 /* DWARF Version */ -+ .4byte .Labbrev1_begin /* Offset into abbrev section */ -+ .byte 4 /* Pointer size */ -+ -+ /* CU die */ -+ .uleb128 1 /* Abbrev: DW_TAG_compile_unit */ -+ .ascii "dw2-struct-member-data-location.c\0" /* DW_AT_name */ -+ .ascii "GNU C 4.3.2\0" /* DW_AT_producer */ -+ .byte 1 /* DW_AT_language (C) */ -+ -+.Ltype_uchar: -+ .uleb128 2 /* Abbrev: DW_TAG_structure_type */ -+ .ascii "some_struct\0" /* DW_AT_name */ -+ -+ .uleb128 3 /* Abbrev: DW_TAG_member */ -+ .ascii "field\0" /* DW_AT_name */ -+ .byte 0 /* DW_AT_data_member_location */ -+ -+ .byte 0 /* End of children of some_struct */ -+ -+ .byte 0 /* End of children of CU */ -+ -+.Lcu1_end: -+ -+/* Abbrev table */ -+ .section .debug_abbrev -+.Labbrev1_begin: -+ .uleb128 1 /* Abbrev code */ -+ .uleb128 0x11 /* DW_TAG_compile_unit */ -+ .byte 1 /* has_children */ -+ .uleb128 0x3 /* DW_AT_name */ -+ .uleb128 0x8 /* DW_FORM_string */ -+ .uleb128 0x25 /* DW_AT_producer */ -+ .uleb128 0x8 /* DW_FORM_string */ -+ .uleb128 0x13 /* DW_AT_language */ -+ .uleb128 0xb /* DW_FORM_data1 */ -+ .byte 0x0 /* Terminator */ -+ .byte 0x0 /* Terminator */ -+ -+ .uleb128 2 /* Abbrev code */ -+ .uleb128 0x13 /* DW_TAG_structure_type */ -+ .byte 1 /* has_children */ -+ .uleb128 0x3 /* DW_AT_name */ -+ .uleb128 0x8 /* DW_FORM_string */ -+ .byte 0x0 /* Terminator */ -+ .byte 0x0 /* Terminator */ -+ -+ .uleb128 3 /* Abbrev code */ -+ .uleb128 0x0d /* DW_TAG_member */ -+ .byte 0 /* has_children */ -+ .uleb128 0x3 /* DW_AT_name */ -+ .uleb128 0x8 /* DW_FORM_string */ -+ .uleb128 0x38 /* DW_AT_data_member_location */ -+ .uleb128 0x0b /* DW_FORM_data1 */ -+ .byte 0x0 /* Terminator */ -+ .byte 0x0 /* Terminator */ -+ -+ .byte 0x0 /* Terminator */ -+ .byte 0x0 /* Terminator */ -diff --git a/gdb/testsuite/gdb.dwarf2/dw2-struct-member-data-location.exp b/gdb/testsuite/gdb.dwarf2/dw2-struct-member-data-location.exp -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.dwarf2/dw2-struct-member-data-location.exp -@@ -0,0 +1,37 @@ -+# 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 . -+ -+# This test can only be run on targets which support DWARF-2 and use gas. -+# For now pick a sampling of likely targets. -+if {![istarget *-*-linux*] -+ && ![istarget *-*-gnu*] -+ && ![istarget *-*-elf*] -+ && ![istarget *-*-openbsd*] -+ && ![istarget arm-*-eabi*] -+ && ![istarget powerpc-*-eabi*]} { -+ return 0 -+} -+ -+set testfile "dw2-struct-member-data-location" -+set srcfile ${testfile}.S -+set binfile ${testfile}.x -+ -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "[standard_output_file ${binfile}]" object {nodebug}] != "" } { -+ return -1 -+} -+ -+clean_restart $binfile -+ -+gdb_test "ptype struct some_struct" "type = struct some_struct {\[\r\n \t\]*void field;\[\r\n \t\]*}" -diff --git a/gdb/testsuite/gdb.dwarf2/dw2-subrange-no-type.S b/gdb/testsuite/gdb.dwarf2/dw2-subrange-no-type.S -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.dwarf2/dw2-subrange-no-type.S -@@ -0,0 +1,121 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ 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 . */ -+ -+/* Debug information */ -+ -+ .section .data -+vardata: -+ .rept 129 -+ .ascii "x" -+ .endr -+ .ascii "UNSEEN\0" -+ -+ .section .debug_info -+.Lcu1_begin: -+ .4byte .Lcu1_end - .Lcu1_start /* Length of Compilation Unit */ -+.Lcu1_start: -+ .2byte 2 /* DWARF version number */ -+ .4byte .Ldebug_abbrev0 /* Offset Into Abbrev. Section */ -+ .byte 4 /* Pointer Size (in bytes) */ -+ -+ /* CU die */ -+ .uleb128 1 /* Abbrev: DW_TAG_compile_unit */ -+ .ascii "GNU C 3.3.3\0" /* DW_AT_producer */ -+ .byte 2 /* DW_AT_language (C) - */ -+ -+.Larray_type: -+ .uleb128 2 /* Abbrev: DW_TAG_array_type */ -+ .4byte .Lchar_type-.Lcu1_begin /* DW_AT_type */ -+ -+ .uleb128 8 /* Abbrev: DW_TAG_subrange_type without DW_AT_type */ -+ .byte 0 /* DW_AT_lower_bound */ -+ .byte 128 /* DW_AT_upper_bound */ -+ -+ .byte 0 /* End of children of die */ -+ -+.Lchar_type: -+ .uleb128 4 /* Abbrev: DW_TAG_base_type */ -+ .ascii "char\0" /* DW_AT_name */ -+ .byte 1 /* DW_AT_byte_size */ -+ .byte 6 /* DW_AT_encoding */ -+ -+ .uleb128 6 /* Abbrev: DW_TAG_variable DW_FORM_string */ -+ .ascii "notype_string\0" /* DW_AT_name */ -+ .4byte .Larray_type-.Lcu1_begin /* DW_AT_type */ -+ .byte 2f - 1f /* DW_AT_location */ -+1: .byte 3 /* DW_OP_addr */ -+ .4byte vardata /* */ -+2: -+ -+ .byte 0 /* End of children of CU */ -+.Lcu1_end: -+ -+ .section .debug_abbrev -+.Ldebug_abbrev0: -+ .uleb128 1 /* Abbrev code */ -+ .uleb128 0x11 /* DW_TAG_compile_unit */ -+ .byte 0x1 /* has_children */ -+ .uleb128 0x25 /* DW_AT_producer */ -+ .uleb128 0x8 /* DW_FORM_string */ -+ .uleb128 0x13 /* DW_AT_language */ -+ .uleb128 0xb /* DW_FORM_data1 */ -+ .byte 0x0 /* Terminator */ -+ .byte 0x0 /* Terminator */ -+ -+ .uleb128 2 /* Abbrev code */ -+ .uleb128 0x1 /* TAG: DW_TAG_array_type */ -+ .byte 0x1 /* DW_children_yes */ -+ .uleb128 0x49 /* DW_AT_type */ -+ .uleb128 0x13 /* DW_FORM_ref4 */ -+ .byte 0x0 /* Terminator */ -+ .byte 0x0 /* Terminator */ -+ -+ .uleb128 4 /* Abbrev code */ -+ .uleb128 0x24 /* DW_TAG_base_type */ -+ .byte 0x0 /* no_children */ -+ .uleb128 0x3 /* DW_AT_name */ -+ .uleb128 0x8 /* DW_FORM_string */ -+ .uleb128 0xb /* DW_AT_byte_size */ -+ .uleb128 0xb /* DW_FORM_data1 */ -+ .uleb128 0x3e /* DW_AT_encoding */ -+ .uleb128 0xb /* DW_FORM_data1 */ -+ .byte 0x0 /* Terminator */ -+ .byte 0x0 /* Terminator */ -+ -+ .uleb128 6 /* Abbrev code */ -+ .uleb128 0x34 /* DW_TAG_variable */ -+ .byte 0x0 /* no_children */ -+ .uleb128 0x3 /* DW_AT_name */ -+ .uleb128 0x8 /* DW_FORM_string */ -+ .uleb128 0x49 /* DW_AT_type */ -+ .uleb128 0x13 /* DW_FORM_ref4 */ -+ .uleb128 0x2 /* DW_AT_location */ -+ .uleb128 0xa /* DW_FORM_block1 */ -+ .byte 0x0 /* Terminator */ -+ .byte 0x0 /* Terminator */ -+ -+ .uleb128 8 /* Abbrev code */ -+ .uleb128 0x21 /* DW_TAG_subrange_type without DW_AT_type */ -+ .byte 0x0 /* no children */ -+ .uleb128 0x22 /* DW_AT_lower_bound */ -+ .uleb128 0xb /* DW_FORM_data1 */ -+ .uleb128 0x2f /* DW_AT_upper_bound */ -+ .uleb128 0xb /* DW_FORM_data1 */ -+ .byte 0x0 /* Terminator */ -+ .byte 0x0 /* Terminator */ -+ -+ .byte 0x0 /* Terminator */ -diff --git a/gdb/testsuite/gdb.dwarf2/dw2-subrange-no-type.exp b/gdb/testsuite/gdb.dwarf2/dw2-subrange-no-type.exp -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.dwarf2/dw2-subrange-no-type.exp -@@ -0,0 +1,39 @@ -+# Copyright 2012 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+load_lib dwarf.exp -+ -+# https://bugzilla.redhat.com/show_bug.cgi?id=806920 -+# read_subrange_type reinitialization -+# of BASE_TYPE was done too late, it affects DW_TAG_subrange_type without -+# specified DW_AT_type, present only in XLF produced code. -+ -+# This test can only be run on targets which support DWARF-2 and use gas. -+if {![dwarf2_support]} { -+ return 0 -+} -+ -+set testfile dw2-subrange-no-type -+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 notype_string" {type = char \[129\]} -+gdb_test "p notype_string" " = 'x' " -diff --git a/gdb/testsuite/gdb.fortran/dwarf-stride.exp b/gdb/testsuite/gdb.fortran/dwarf-stride.exp -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/dwarf-stride.exp -@@ -0,0 +1,42 @@ -+# 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. -+ -+# This file was written by Jan Kratochvil . -+ -+# This file is part of the gdb testsuite. Array element stride must not be -+# specified in the number of elements but in a number of bytes instead. -+# Original problem: -+# (gdb) p c40pt(1) -+# $1 = '0-hello', ' ' -+# (gdb) p c40pt(2) -+# warning: Fortran array stride not divisible by the element size -+ -+set testfile dwarf-stride -+set srcfile ${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 "break-here"] -+gdb_continue_to_breakpoint "break-here" ".*break-here.*" -+gdb_test "p c40pt(1)" " = '0-hello.*" -+gdb_test "p c40pt(2)" " = '1-hello.*" -diff --git a/gdb/testsuite/gdb.fortran/dwarf-stride.f90 b/gdb/testsuite/gdb.fortran/dwarf-stride.f90 -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/dwarf-stride.f90 -@@ -0,0 +1,40 @@ -+! 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. -+! -+! File written by Alan Matsuoka. -+ -+program repro -+ -+ type small_stride -+ character*40 long_string -+ integer small_pad -+ end type small_stride -+ -+ type(small_stride), dimension (20), target :: unpleasant -+ character*40, pointer, dimension(:):: c40pt -+ -+ integer i -+ -+ do i = 0,19 -+ unpleasant(i+1)%small_pad = i+1 -+ unpleasant(i+1)%long_string = char (ichar('0') + i) // '-hello' -+ end do -+ -+ c40pt => unpleasant%long_string -+ -+ print *, c40pt ! break-here -+ -+end program repro -diff --git a/gdb/testsuite/gdb.fortran/dynamic.exp b/gdb/testsuite/gdb.fortran/dynamic.exp -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/dynamic.exp -@@ -0,0 +1,154 @@ -+# 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. -+ -+# This file was written by Jan Kratochvil . -+ -+# This file is part of the gdb testsuite. It contains tests for dynamically -+# allocated Fortran arrays. -+# It depends on the GCC dynamic Fortran arrays DWARF support: -+# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22244 -+ -+set testfile "dynamic" -+set srcfile ${testfile}.f90 -+set binfile [standard_output_file ${testfile}] -+ -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f90 quiet}] != "" } { -+ untested "Couldn't compile ${srcfile}" -+ return -1 -+} -+ -+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_breakpoint [gdb_get_line_number "varx-init"] -+gdb_continue_to_breakpoint "varx-init" -+ -+# http://www.cs.rpi.edu/~szymansk/OOF90/bugs.html#5 -+# Do not: gdb_test "p varx" "\\$\[0-9\]* = " "p varx unallocated" -+# Do not: gdb_test "ptype varx" {type = real\(kind=4\) \(:,:,:\)} "ptype varx unallocated" -+# Do not: gdb_test "p varx(1,5,17)" {no such vector element \(vector not allocated\)} "p varx(1,5,17) unallocated" -+# Do not: gdb_test "p varx(1,5,17)=1" {no such vector element \(vector not allocated\)} "p varx(1,5,17)=1 unallocated" -+# Do not: gdb_test "ptype varx(1,5,17)" {no such vector element \(vector not allocated\)} "ptype varx(1,5,17) unallocated" -+ -+gdb_breakpoint [gdb_get_line_number "varx-allocated"] -+gdb_continue_to_breakpoint "varx-allocated" -+# $1 = (( ( 0, 0, 0, 0, 0, 0) ( 0, 0, 0, 0, 0, 0) --- , 0) ) ( ( 0, 0, ...) ...) ...) -+gdb_test "ptype varx" "type = real(\\(kind=4\\)|\\*4), allocatable \\(6,5:15,17:28\\)" "ptype varx allocated" -+# Intel Fortran Compiler 10.1.008 uses -1 there, GCC uses 1. -+gdb_test "p l" "\\$\[0-9\]* = (\\.TRUE\\.|4294967295)" "p l if varx allocated" -+ -+gdb_breakpoint [gdb_get_line_number "varx-filled"] -+gdb_continue_to_breakpoint "varx-filled" -+gdb_test "p varx(2, 5, 17)" "\\$\[0-9\]* = 6" -+gdb_test "p varx(1, 5, 17)" "\\$\[0-9\]* = 7" -+gdb_test "p varx(2, 6, 18)" "\\$\[0-9\]* = 8" -+gdb_test "p varx(6, 15, 28)" "\\$\[0-9\]* = 9" -+# http://www.cs.rpi.edu/~szymansk/OOF90/bugs.html#5 -+# Do not: gdb_test "p varv" "\\$\[0-9\]* = " "p varv unassociated" -+# Do not: gdb_test "ptype varv" {type = real\(kind=4\) \(:,:,:\)} "ptype varv unassociated" -+ -+set test "output varx" -+gdb_test_multiple $test $test { -+ -re "^output varx\r\n\[() ,6789.\]*$gdb_prompt $" { -+ pass $test -+ } -+} -+ -+gdb_breakpoint [gdb_get_line_number "varv-associated"] -+gdb_continue_to_breakpoint "varv-associated" -+gdb_test "p varx(3, 7, 19)" "\\$\[0-9\]* = 6" "p varx(3, 7, 19) with varv associated" -+gdb_test "p varv(3, 7, 19)" "\\$\[0-9\]* = 6" "p varv(3, 7, 19) associated" -+# Intel Fortran Compiler 10.1.008 uses -1 there, GCC uses 1. -+gdb_test "p l" "\\$\[0-9\]* = (\\.TRUE\\.|4294967295)" "p l if varv associated" -+gdb_test "ptype varx" "type = real(\\(kind=4\\)|\\*4), allocatable \\(6,5:15,17:28\\)" "ptype varx with varv associated" -+# Intel Fortran Compiler 10.1.008 uses the pointer type. -+gdb_test "ptype varv" "type = (PTR TO -> \\( )?real(\\(kind=4\\)|\\*4) \\(6,5:15,17:28\\)\\)?" "ptype varv associated" -+ -+gdb_breakpoint [gdb_get_line_number "varv-filled"] -+gdb_continue_to_breakpoint "varv-filled" -+gdb_test "p varx(3, 7, 19)" "\\$\[0-9\]* = 10" "p varx(3, 7, 19) with varv filled" -+gdb_test "p varv(3, 7, 19)" "\\$\[0-9\]* = 10" "p varv(3, 7, 19) filled" -+ -+gdb_breakpoint [gdb_get_line_number "varv-deassociated"] -+gdb_continue_to_breakpoint "varv-deassociated" -+# The latter one is for the Intel Fortran Compiler 10.1.008 pointer type. -+gdb_test "p varv" "\\$\[0-9\]* = (|.*(Cannot access it|Unable to access the object) because the object is not associated.)" "p varv deassociated" -+gdb_test "ptype varv" {type = real\(kind=4\) \(:,:,:\)} "ptype varv deassociated" -+gdb_test "p l" "\\$\[0-9\]* = \\.FALSE\\." "p l if varv deassociated" -+gdb_test "p varv(1,5,17)" {no such vector element \(vector not associated\)} -+gdb_test "ptype varv(1,5,17)" {no such vector element \(vector not associated\)} -+ -+gdb_breakpoint [gdb_get_line_number "varx-deallocated"] -+gdb_continue_to_breakpoint "varx-deallocated" -+gdb_test "p varx" "\\$\[0-9\]* = " "p varx deallocated" -+gdb_test "ptype varx" {type = real\(kind=4\), allocatable \(:,:,:\)} "ptype varx deallocated" -+gdb_test "p l" "\\$\[0-9\]* = \\.FALSE\\." "p l if varx deallocated" -+gdb_test "p varx(1,5,17)" {no such vector element \(vector not allocated\)} "p varx(1,5,17) deallocated" -+gdb_test "ptype varx(1,5,17)" {no such vector element \(vector not allocated\)} "ptype varx(1,5,17) deallocated" -+ -+gdb_breakpoint [gdb_get_line_number "vary-passed"] -+gdb_continue_to_breakpoint "vary-passed" -+# $1 = (( ( 1, 1, 1, 1, 1, 1) ( 1, 1, 1, 1, 1, 1) --- , 1) ) ( ( 1, 1, ...) ...) ...) -+gdb_test "p vary" "\\$\[0-9\]* = \\(\[()1, .\]*\\)" -+ -+gdb_breakpoint [gdb_get_line_number "vary-filled"] -+gdb_continue_to_breakpoint "vary-filled" -+gdb_test "ptype vary" "type = real(\\(kind=4\\)|\\*4) \\(10,10\\)" -+gdb_test "p vary(1, 1)" "\\$\[0-9\]* = 8" -+gdb_test "p vary(2, 2)" "\\$\[0-9\]* = 9" -+gdb_test "p vary(1, 3)" "\\$\[0-9\]* = 10" -+# $1 = (( ( 3, 3, 3, 3, 3, 3) ( 3, 3, 3, 3, 3, 3) --- , 3) ) ( ( 3, 3, ...) ...) ...) -+gdb_test "p varw" "\\$\[0-9\]* = \\(\[()3, .\]*\\)" -+ -+gdb_breakpoint [gdb_get_line_number "varw-almostfilled"] -+gdb_continue_to_breakpoint "varw-almostfilled" -+gdb_test "ptype varw" "type = real(\\(kind=4\\)|\\*4) \\(5,4,3\\)" -+gdb_test "p varw(3,1,1)=1" "\\$\[0-9\]* = 1" -+# $1 = (( ( 6, 5, 1, 5, 5, 5) ( 5, 5, 5, 5, 5, 5) --- , 5) ) ( ( 5, 5, ...) ...) ...) -+gdb_test "p varw" "\\$\[0-9\]* = \\( *\\( *\\( *6, *5, *1,\[()5, .\]*\\)" "p varw filled" -+# "up" works with GCC but other Fortran compilers may copy the values into the -+# outer function only on the exit of the inner function. -+# We need both variants as depending on the arch we optionally may still be -+# executing the caller line or not after `finish'. -+gdb_test "finish" ".*(call bar \\(y, x\\)|call foo \\(x, z\\(2:6, 4:7, 6:8\\)\\))" -+gdb_test "p z(2,4,5)" "\\$\[0-9\]* = 3" -+gdb_test "p z(2,4,6)" "\\$\[0-9\]* = 6" -+gdb_test "p z(2,4,7)" "\\$\[0-9\]* = 5" -+gdb_test "p z(4,4,6)" "\\$\[0-9\]* = 1" -+ -+gdb_breakpoint [gdb_get_line_number "varz-almostfilled"] -+gdb_continue_to_breakpoint "varz-almostfilled" -+# GCC uses the pointer type here, Intel Fortran Compiler 10.1.008 does not. -+gdb_test "ptype varz" "type = (PTR TO -> \\( )?real(\\(kind=4\\)|\\*4) \\(\\*\\)\\)?" -+# Intel Fortran Compiler 10.1.008 has a bug here - (2:11,7:7) -+# as it produces DW_AT_lower_bound == DW_AT_upper_bound == 7. -+gdb_test "ptype vart" "type = (PTR TO -> \\( )?real(\\(kind=4\\)|\\*4) \\(2:11,7:\\*\\)\\)?" -+gdb_test "p varz" "\\$\[0-9\]* = \\(\\)" -+gdb_test "p vart" "\\$\[0-9\]* = \\(\\)" -+gdb_test "p varz(3)" "\\$\[0-9\]* = 4" -+# maps to foo::vary(1,1) -+gdb_test "p vart(2,7)" "\\$\[0-9\]* = 8" -+# maps to foo::vary(2,2) -+gdb_test "p vart(3,8)" "\\$\[0-9\]* = 9" -+# maps to foo::vary(1,3) -+gdb_test "p vart(2,9)" "\\$\[0-9\]* = 10" -diff --git a/gdb/testsuite/gdb.fortran/dynamic.f90 b/gdb/testsuite/gdb.fortran/dynamic.f90 -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/dynamic.f90 -@@ -0,0 +1,98 @@ -+! 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. -+! -+! 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 baz -+ real, target, allocatable :: varx (:, :, :) -+ real, pointer :: varv (:, :, :) -+ real, target :: varu (1, 2, 3) -+ logical :: l -+ allocate (varx (1:6, 5:15, 17:28)) ! varx-init -+ l = allocated (varx) -+ varx(:, :, :) = 6 ! varx-allocated -+ varx(1, 5, 17) = 7 -+ varx(2, 6, 18) = 8 -+ varx(6, 15, 28) = 9 -+ varv => varx ! varx-filled -+ l = associated (varv) -+ varv(3, 7, 19) = 10 ! varv-associated -+ varv => null () ! varv-filled -+ l = associated (varv) -+ deallocate (varx) ! varv-deassociated -+ l = allocated (varx) -+ varu(:, :, :) = 10 ! varx-deallocated -+ allocate (varv (1:6, 5:15, 17:28)) -+ l = associated (varv) -+ varv(:, :, :) = 6 -+ varv(1, 5, 17) = 7 -+ varv(2, 6, 18) = 8 -+ varv(6, 15, 28) = 9 -+ deallocate (varv) -+ l = associated (varv) -+ varv => varu -+ varv(1, 1, 1) = 6 -+ varv(1, 2, 3) = 7 -+ l = associated (varv) -+end subroutine baz -+subroutine foo (vary, varw) -+ real :: vary (:, :) -+ real :: varw (:, :, :) -+ vary(:, :) = 4 ! vary-passed -+ vary(1, 1) = 8 -+ vary(2, 2) = 9 -+ vary(1, 3) = 10 -+ varw(:, :, :) = 5 ! vary-filled -+ varw(1, 1, 1) = 6 -+ varw(2, 2, 2) = 7 ! varw-almostfilled -+end subroutine foo -+subroutine bar (varz, vart) -+ real :: varz (*) -+ real :: vart (2:11, 7:*) -+ varz(1:3) = 4 -+ varz(2) = 5 ! varz-almostfilled -+ vart(2,7) = vart(2,7) -+end subroutine bar -+program test -+ interface -+ subroutine foo (vary, varw) -+ real :: vary (:, :) -+ real :: varw (:, :, :) -+ end subroutine -+ end interface -+ interface -+ subroutine bar (varz, vart) -+ real :: varz (*) -+ real :: vart (2:11, 7:*) -+ end subroutine -+ end interface -+ real :: x (10, 10), y (5), z(8, 8, 8) -+ x(:,:) = 1 -+ y(:) = 2 -+ z(:,:,:) = 3 -+ call baz -+ call foo (x, z(2:6, 4:7, 6:8)) -+ call bar (y, x) -+ if (x (1, 1) .ne. 8 .or. x (2, 2) .ne. 9 .or. x (1, 2) .ne. 4) call abort -+ if (x (1, 3) .ne. 10) call abort -+ if (z (2, 4, 6) .ne. 6 .or. z (3, 5, 7) .ne. 7 .or. z (2, 4, 7) .ne. 5) call abort -+ if (any (y .ne. (/4, 5, 4, 2, 2/))) call abort -+ call foo (transpose (x), z) -+ if (x (1, 1) .ne. 8 .or. x (2, 2) .ne. 9 .or. x (1, 2) .ne. 4) call abort -+ if (x (3, 1) .ne. 10) call abort -+end -diff --git a/gdb/testsuite/gdb.fortran/string.exp b/gdb/testsuite/gdb.fortran/string.exp -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/string.exp -@@ -0,0 +1,59 @@ -+# 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. -+ -+# This file was written by Jan Kratochvil . -+ -+# This file is part of the gdb testsuite. It contains tests for Fortran -+# strings with dynamic length. -+ -+set testfile "string" -+set srcfile ${testfile}.f90 -+set binfile [standard_output_file ${testfile}] -+ -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f90 quiet}] != "" } { -+ untested "Couldn't compile ${srcfile}" -+ return -1 -+} -+ -+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_breakpoint [gdb_get_line_number "var-init"] -+gdb_continue_to_breakpoint "var-init" -+gdb_test "ptype c" "type = character(\\(kind=1\\)|\\*1)" -+gdb_test "ptype d" "type = character(\\(kind=8\\)|\\*8)" -+gdb_test "ptype e" "type = character(\\(kind=4\\)|\\*4)" -+gdb_test "ptype f" "type = character(\\(kind=4\\)|\\*4) \\(7,8:10\\)" -+gdb_test "ptype *e" "Attempt to take contents of a non-pointer value." -+gdb_test "ptype *f" "type = character(\\(kind=4\\)|\\*4) \\(7\\)" -+gdb_test "p c" "\\$\[0-9\]* = 'c'" -+gdb_test "p d" "\\$\[0-9\]* = 'd '" -+gdb_test "p e" "\\$\[0-9\]* = 'g '" -+gdb_test "p f" "\\$\[0-9\]* = \\(\\( 'h ', 'h ', 'h ', 'h ', 'h ', 'h ', 'h '\\) \\( 'h ', 'h ', 'h ', 'h ', 'h ', 'h ', 'h '\\) \\( 'h ', 'h ', 'h ', 'h ', 'h ', 'h ', 'h '\\) \\)" -+gdb_test "p *e" "Attempt to take contents of a non-pointer value." -+gdb_test "p *f" "Attempt to take contents of a non-pointer value." -+ -+gdb_breakpoint [gdb_get_line_number "var-finish"] -+gdb_continue_to_breakpoint "var-finish" -+gdb_test "p e" "\\$\[0-9\]* = 'e '" "p e re-set" -+gdb_test "p f" "\\$\[0-9\]* = \\(\\( 'f ', 'f ', 'f ', 'f ', 'f ', 'f ', 'f '\\) \\( 'f2 ', 'f ', 'f ', 'f ', 'f ', 'f ', 'f '\\) \\( 'f ', 'f ', 'f ', 'f ', 'f ', 'f ', 'f '\\) \\)" "p *f re-set" -diff --git a/gdb/testsuite/gdb.fortran/string.f90 b/gdb/testsuite/gdb.fortran/string.f90 -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/string.f90 -@@ -0,0 +1,37 @@ -+! Copyright 2008 Free Software Foundation, Inc. -+! -+! This program is free software; you can redistribute it and/or modify -+! it under the terms of the GNU General Public License as published by -+! the Free Software Foundation; either version 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 foo (e, f) -+ character (len=1) :: c -+ character (len=8) :: d -+ character (len=*) :: e -+ character (len=*) :: f (1:7, 8:10) -+ c = 'c' -+ d = 'd' -+ e = 'e' ! var-init -+ f = 'f' -+ f(1,9) = 'f2' -+ c = 'c' ! var-finish -+end subroutine foo -+ character (len=4) :: g, h (1:7, 8:10) -+ g = 'g' -+ h = 'h' -+ call foo (g, h) -+end -diff --git a/gdb/testsuite/gdb.fortran/subrange.exp b/gdb/testsuite/gdb.fortran/subrange.exp -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/subrange.exp -@@ -0,0 +1,72 @@ -+# 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 { [skip_fortran_tests] } { return -1 } -+ -+set testfile "subrange" -+set srcfile ${testfile}.f90 -+if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} {debug f90}] } { -+ return -1 -+} -+ -+if ![runto MAIN__] { -+ perror "Couldn't run to MAIN__" -+ continue -+} -+ -+# Depending on the compiler version being used, the name of the 4-byte integer -+# and real types can be printed differently. For instance, gfortran-4.1 uses -+# "int4" whereas gfortran-4.3 uses "int(kind=4)". -+set int4 "(int4|integer\\(kind=4\\))" -+ -+gdb_breakpoint [gdb_get_line_number "break-static"] -+gdb_continue_to_breakpoint "break-static" ".*break-static.*" -+ -+foreach var {a alloc ptr} { -+ global pf_prefix -+ set old_prefix $pf_prefix -+ lappend pf_prefix "$var:" -+ -+ setup_kfail "*-*-*" "vlaregression/9999" -+ gdb_test "p $var (2, 2:3)" { = \(22, 32\)} -+ setup_kfail "*-*-*" "vlaregression/9999" -+ gdb_test "p $var (2:3, 3)" { = \(32, 33\)} -+ setup_kfail "*-*-*" "vlaregression/9999" -+ gdb_test "p $var (1, 2:)" { = \(21, 31\)} -+ setup_kfail "*-*-*" "vlaregression/9999" -+ gdb_test "p $var (2, :2)" { = \(12, 22\)} -+ setup_kfail "*-*-*" "vlaregression/9999" -+ gdb_test "p $var (3, 2:2)" { = \(23\)} -+ setup_kfail "*-*-*" "vlaregression/9999" -+ gdb_test "ptype $var (3, 2:2)" " = $int4 \\(2:2\\)" -+ setup_kfail "*-*-*" "vlaregression/9999" -+ gdb_test "p $var (4, :)" { = \(14, 24, 34\)} -+ setup_kfail "*-*-*" "vlaregression/9999" -+ gdb_test "p $var (:, :)" { = \(\( *11, 12, 13, 14\) \( *21, 22, 23, 24\) \( *31, 32, 33, 34\) *\)} -+ setup_kfail "*-*-*" "vlaregression/9999" -+ gdb_test "ptype $var (:, :)" " = $int4 \\(4,3\\)" -+ setup_kfail "*-*-*" "vlaregression/9999" -+ gdb_test "p $var (:)" "Wrong number of subscripts" -+ setup_kfail "*-*-*" "vlaregression/9999" -+ gdb_test "p $var (:, :, :)" "Wrong number of subscripts" -+ -+ set pf_prefix $old_prefix -+} -+ -+gdb_test_no_output {set $a=a} -+delete_breakpoints -+gdb_unload -+setup_kfail "*-*-*" "vlaregression/9999" -+gdb_test {p $a (3, 2:2)} { = \(23\)} -diff --git a/gdb/testsuite/gdb.fortran/subrange.f90 b/gdb/testsuite/gdb.fortran/subrange.f90 -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/subrange.f90 -@@ -0,0 +1,28 @@ -+! 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 . -+ -+program test -+ integer, target :: a (4, 3) -+ integer, allocatable :: alloc (:, :) -+ integer, pointer :: ptr (:, :) -+ do 1 i = 1, 4 -+ do 1 j = 1, 3 -+ a (i, j) = j * 10 + i -+1 continue -+ allocate (alloc (4, 3)) -+ alloc = a -+ ptr => a -+ write (*,*) a ! break-static -+end -diff --git a/gdb/testsuite/gdb.mi/mi2-var-stale-type.c b/gdb/testsuite/gdb.mi/mi2-var-stale-type.c -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.mi/mi2-var-stale-type.c -@@ -0,0 +1,26 @@ -+/* Copyright 2011 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 . */ -+ -+int -+main (int argc, char **argv) -+{ -+ char vla[argc]; -+ -+ vla[0] = 0; /* break-here */ -+ -+ return 0; -+} -diff --git a/gdb/testsuite/gdb.mi/mi2-var-stale-type.exp b/gdb/testsuite/gdb.mi/mi2-var-stale-type.exp -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.mi/mi2-var-stale-type.exp -@@ -0,0 +1,57 @@ -+# 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 . -+ -+load_lib mi-support.exp -+set MIFLAGS "-i=mi2" -+ -+gdb_exit -+if [mi_gdb_start] { -+ continue -+} -+ -+set testfile "mi2-var-stale-type" -+set srcfile ${testfile}.c -+set binfile [standard_output_file ${testfile}] -+if {[build_executable ${testfile}.exp $testfile $srcfile] == -1} { -+ return -1 -+} -+ -+mi_delete_breakpoints -+mi_gdb_reinitialize_dir $srcdir/$subdir -+mi_gdb_load ${binfile} -+ -+mi_gdb_test {-interpreter-exec console "maintenance set internal-error quit yes"} \ -+ {\^done} \ -+ "maintenance set internal-error quit yes" -+ -+mi_gdb_test {-interpreter-exec console "maintenance set internal-error corefile yes"} \ -+ {\^done} \ -+ "maintenance set internal-error corefile yes" -+ -+set line [gdb_get_line_number "break-here"] -+set func "main" -+ -+mi_gdb_test "-break-insert -t $srcfile:$line" \ -+ "\\^done,bkpt=\{number=\"\[0-9\]+\",type=\"breakpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"$func\(\\\(.*\\\)\)?\",file=\".*\",fullname=\".*\",line=\"$line\",\[^\r\n\]*,original-location=\".*\"\}" \ -+ "breakpoint at $func" -+ -+if { [mi_run_cmd] < 0 } { -+ return -1 -+} -+mi_expect_stop "breakpoint-hit" $func ".*" ".*" "\[0-9\]+" { "" "disp=\"del\"" } "stop after initializing vla" -+ -+mi_create_varobj "vla" "vla" "create local variable vla" -+ -+mi_gdb_test "-var-update *" "\\^done,changelist=.*" "-var-update *" -diff --git a/gdb/testsuite/gdb.opt/array-from-register-func.c b/gdb/testsuite/gdb.opt/array-from-register-func.c -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.opt/array-from-register-func.c -@@ -0,0 +1,22 @@ -+/* This file 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 . */ -+ -+int -+func (int *arr) -+{ -+ return arr[0]; -+} -diff --git a/gdb/testsuite/gdb.opt/array-from-register.c b/gdb/testsuite/gdb.opt/array-from-register.c -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.opt/array-from-register.c -@@ -0,0 +1,28 @@ -+/* This file 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 . */ -+ -+extern int func (int *arr); -+ -+int -+main (void) -+{ -+ int arr[] = { 42 }; -+ -+ func (arr); -+ -+ return 0; -+} -diff --git a/gdb/testsuite/gdb.opt/array-from-register.exp b/gdb/testsuite/gdb.opt/array-from-register.exp -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.opt/array-from-register.exp -@@ -0,0 +1,33 @@ -+# 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. -+# -+# This file is part of the gdb testsuite. -+ -+if { [prepare_for_testing array-from-register.exp "array-from-register" \ -+ {array-from-register.c array-from-register-func.c} \ -+ {debug optimize=-O2}] } { -+ return -1 -+} -+ -+if ![runto func] then { -+ return -1 -+} -+ -+gdb_test "p arr" "\\$\[0-9\]+ = \\(int \\*\\) *0x\[0-9a-f\]+" -+ -+# Seen regression: -+# Address requested for identifier "arr" which is in register $rdi -+gdb_test "p arr\[0\]" "\\$\[0-9\]+ = 42" -diff --git a/gdb/testsuite/gdb.opt/fortran-string.exp b/gdb/testsuite/gdb.opt/fortran-string.exp -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.opt/fortran-string.exp -@@ -0,0 +1,39 @@ -+# 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. -+ -+# This file was written by Jan Kratochvil . -+ -+# Test GDB can cope with Fortran strings having their length present in a CPU -+# register. With -O0 the string length is passed on the stack. To make this -+# test meaningful the follow assertion should pass. It is not being checked -+# here as the "_s" symbol is compiler dependent: -+# (gdb) info address _s -+# Symbol "_s" is a variable in register XX. -+ -+set test fortran-string -+set srcfile ${test}.f90 -+if { [prepare_for_testing ${test}.exp ${test} ${srcfile} {debug f90 additional_flags=-O2}] } { -+ return -1 -+} -+ -+if ![runto $srcfile:[gdb_get_line_number "s = s"]] then { -+ perror "couldn't run to breakpoint MAIN__" -+ continue -+} -+ -+gdb_test "frame" ".*s='foo'.*" -+gdb_test "ptype s" "type = character\\*3" -+gdb_test "p s" "\\$\[0-9\]* = 'foo'" -diff --git a/gdb/testsuite/gdb.opt/fortran-string.f90 b/gdb/testsuite/gdb.opt/fortran-string.f90 -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.opt/fortran-string.f90 -@@ -0,0 +1,28 @@ -+! 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. -+! -+! 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*(*) s -+ s = s -+ end -+ -+ program main -+ call f ('foo') -+ end -diff --git a/gdb/testsuite/gdb.pascal/arrays.exp b/gdb/testsuite/gdb.pascal/arrays.exp -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.pascal/arrays.exp -@@ -0,0 +1,104 @@ -+# Copyright 2008, 2009 Free Software Foundation, Inc. -+# -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+if $tracelevel then { -+ strace $tracelevel -+} -+ -+load_lib "pascal.exp" -+ -+set testfile "arrays" -+set srcfile ${testfile}.pas -+set binfile [standard_output_file ${testfile}$EXEEXT] -+ -+# These tests only work with fpc, using the -gw3 compile-option -+pascal_init -+if { $pascal_compiler_is_fpc != 1 } { -+ return -1 -+} -+ -+# Detect if the fpc version is below 2.3.0 -+set fpc_generates_dwarf_for_dynamic_arrays 1 -+if { ($fpcversion_major < 2) || ( ($fpcversion_major == 2) && ($fpcversion_minor < 3))} { -+ set fpc_generates_dwarf_for_dynamic_arrays 0 -+} -+ -+ -+if {[gdb_compile_pascal "-gw3 ${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug ]] != "" } { -+ return -1 -+} -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfile} -+set bp_location1 [gdb_get_line_number "set breakpoint 1 here"] -+set bp_location2 [gdb_get_line_number "set breakpoint 2 here"] -+ -+ -+if { [gdb_breakpoint ${srcfile}:${bp_location1}] } { -+ pass "setting breakpoint 1" -+} -+if { [gdb_breakpoint ${srcfile}:${bp_location2}] } { -+ pass "setting breakpoint 2" -+} -+ -+# Verify that "start" lands inside the right procedure. -+if { [gdb_start_cmd] < 0 } { -+ untested start -+ return -1 -+} -+ -+gdb_test "" ".* at .*${srcfile}.*" "start" -+ -+gdb_test "cont" "Breakpoint .*:${bp_location1}.*" "Going to first breakpoint" -+ -+gdb_test "print StatArrInt" ".* = \\{50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61\\}" "Print static array of integer type" -+gdb_test "print StatArrInt_" ".* = \\{50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61\\}" "Print static array of integer" -+ -+gdb_test "cont" "Breakpoint .*:${bp_location2}.*" "Going to second breakpoint" -+ -+gdb_test "print StatArrChar" ".* = 'abcdefghijkl'" "Print static array of char" -+gdb_test "print Stat2dArrInt" ".* = \\{\\{0, 1, 2, 3, 4\\}, \\{1, 2, 3, 4, 5\\}, \\{2, 3, 4, 5, 6\\}, \\{3, 4, 5, 6, 7\\}, \\{4, 5, 6, 7, 8\\}, \\{5, 6, 7, 8, 9\\}, \\{6, 7, 8, 9, 10\\}, \\{7, 8, 9, 10, 11\\}, \\{8, 9, 10, 11, 12\\}, \\{9, 10, 11, 12, 13\\}, \\{10, 11, 12, 13, 14\\}, \\{11, 12, 13, 14, 15\\}\\}" "Print static 2-dimensional array of integer" -+ -+if { $fpc_generates_dwarf_for_dynamic_arrays == 0} { -+ setup_xfail "*-*-*" -+} -+gdb_test "print DynArrInt" ".* = \\{50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62\\}" "Print dynamic array of integer type" -+if { $fpc_generates_dwarf_for_dynamic_arrays == 0} { -+ setup_xfail "*-*-*" -+} -+gdb_test "print DynArrInt_" ".* = \\{50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62\\}" "Print dynamic array of integer" -+ -+if { $fpc_generates_dwarf_for_dynamic_arrays == 0} { -+ setup_xfail "*-*-*" -+} -+gdb_test "print s" ".* = 'test'#0'string'" "Print string containing null-char" -+ -+if { $fpc_generates_dwarf_for_dynamic_arrays == 0} { -+ setup_xfail "*-*-*" -+} -+gdb_test "print DynArrStr" ".* = \\{'dstr0', 'dstr1', 'dstr2', 'dstr3', 'dstr4', 'dstr5', 'dstr6', 'dstr7', 'dstr8', 'dstr9', 'dstr10', 'dstr11', 'dstr12'\\}" "Print dynamic array of string" -+ -+if { $fpc_generates_dwarf_for_dynamic_arrays == 0} { -+ setup_xfail "*-*-*" -+} -+gdb_test "print StatArrStr" ".* = \\{'str0', 'str1', 'str2', 'str3', 'str4', 'str5', 'str6', 'str7', 'str8', 'str9', 'str10', 'str11', 'str12'\\}" "Print static array of string" -+ -+if { $fpc_generates_dwarf_for_dynamic_arrays == 0} { -+ setup_xfail "*-*-*" -+} -+gdb_test "print DynArrChar" ".* = 'abcdefghijklm'" "Print dynamic array of char" -+ -diff --git a/gdb/testsuite/gdb.pascal/arrays.pas b/gdb/testsuite/gdb.pascal/arrays.pas -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.pascal/arrays.pas -@@ -0,0 +1,82 @@ -+{ -+ Copyright 2008, 2009 Free Software Foundation, Inc. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . -+} -+ -+program arrays; -+ -+{$mode objfpc}{$h+} -+ -+uses sysutils; -+ -+type TStatArrInt= array[0..11] of integer; -+ TDynArrInt= array of integer; -+ TStatArrStr= array[0..12] of string; -+ TDynArrStr= array of string; -+ TDynArrChar = array of char; -+ TStatArrChar = array [0..11] of char; -+ -+ TStat2dArrInt = array[0..11,0..4] of integer; -+ -+var StatArrInt: TStatArrInt; -+ StatArrInt_: Array[0..11] of integer; -+ DynArrInt: TDynArrInt; -+ DynArrInt_: Array of integer; -+ StatArrStr: TStatArrStr; -+ DynArrStr: TDynArrStr; -+ StatArrChar: TStatArrChar; -+ DynArrChar: TDynArrChar; -+ -+ Stat2dArrInt: TStat2dArrInt; -+ -+ s: string; -+ -+ i,j : integer; -+ -+begin -+ for i := 0 to 11 do -+ begin -+ StatArrInt[i]:= i+50; -+ StatArrInt_[i]:= i+50; -+ StatArrChar[i]:= chr(ord('a')+i); -+ for j := 0 to 4 do -+ Stat2dArrInt[i,j]:=i+j; -+ end; -+ writeln(StatArrInt_[0]); -+ writeln(StatArrInt[0]); { set breakpoint 1 here } -+ writeln(StatArrChar[0]); -+ writeln(Stat2dArrInt[0,0]); -+ -+ setlength(DynArrInt,13); -+ setlength(DynArrInt_,13); -+ setlength(DynArrStr,13); -+ setlength(DynArrChar,13); -+ for i := 0 to 12 do -+ begin -+ DynArrInt[i]:= i+50; -+ DynArrInt_[i]:= i+50; -+ DynArrChar[i]:= chr(ord('a')+i); -+ StatArrStr[i]:='str'+inttostr(i); -+ DynArrStr[i]:='dstr'+inttostr(i); -+ end; -+ writeln(DynArrInt_[1]); -+ writeln(DynArrInt[1]); -+ writeln(DynArrStr[1]); -+ writeln(StatArrStr[1]); -+ writeln(DynArrChar[1]); -+ -+ s := 'test'#0'string'; -+ writeln(s); { set breakpoint 2 here } -+end. -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 -@@ -224,6 +224,11 @@ proc gdb_unload {} { - send_gdb "y\n" answer - exp_continue - } -+ -re "A program is being debugged already..*Are you sure you want to change the file.*y or n. $"\ -+ { send_gdb "y\n" -+ verbose "\t\tUnloading symbols for program being debugged" -+ exp_continue -+ } - -re "Discard symbol table from .*y or n.*$" { - send_gdb "y\n" answer - exp_continue -diff --git a/gdb/testsuite/lib/pascal.exp b/gdb/testsuite/lib/pascal.exp ---- a/gdb/testsuite/lib/pascal.exp -+++ b/gdb/testsuite/lib/pascal.exp -@@ -37,6 +37,9 @@ proc pascal_init {} { - gdb_persistent_global pascal_compiler_is_fpc - gdb_persistent_global gpc_compiler - gdb_persistent_global fpc_compiler -+ gdb_persistent_global fpcversion_major -+ gdb_persistent_global fpcversion_minor -+ gdb_persistent_global fpcversion_release - global env - - if { $pascal_init_done == 1 } { -@@ -64,6 +67,20 @@ proc pascal_init {} { - set pascal_compiler_is_fpc 1 - verbose -log "Free Pascal compiler found" - } -+ -+ # Detect the fpc-version -+ if { $pascal_compiler_is_fpc == 1 } { -+ set fpcversion_major 1 -+ set fpcversion_minor 0 -+ set fpcversion_release 0 -+ set fpcversion [ remote_exec host $fpc_compiler "-iV" ] -+ if [regexp {.*([0-9]+)\.([0-9]+)\.([0-9]+).?} $fpcversion] { -+ regsub {.*([0-9]+)\.([0-9]+)\.([0-9]+).?\n?.?} $fpcversion {\1} fpcversion_major -+ regsub {.*([0-9]+)\.([0-9]+)\.([0-9]+).?\n?.?} $fpcversion {\2} fpcversion_minor -+ regsub {.*([0-9]+)\.([0-9]+)\.([0-9]+).?\n?.?} $fpcversion {\3} fpcversion_release -+ } -+ verbose -log "Freepascal version: $fpcversion_major.$fpcversion_minor.$fpcversion_release" -+ } - } - set pascal_init_done 1 - } diff --git a/gdb-archer.patch b/gdb-archer.patch deleted file mode 100644 index 77c0dee..0000000 --- a/gdb-archer.patch +++ /dev/null @@ -1,187 +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-archer.patch - -;; Python patches of: http://sourceware.org/gdb/wiki/ProjectArcher -;;=push - -http://sourceware.org/gdb/wiki/ProjectArcher -http://sourceware.org/gdb/wiki/ArcherBranchManagement - -GIT snapshot: -commit 718a1618b2f691a7f407213bb50f100ac59f91c3 - -tromey/python - -diff --git a/gdb/data-directory/Makefile.in b/gdb/data-directory/Makefile.in ---- a/gdb/data-directory/Makefile.in -+++ b/gdb/data-directory/Makefile.in -@@ -80,6 +80,7 @@ PYTHON_FILE_LIST = \ - gdb/unwinder.py \ - gdb/xmethod.py \ - gdb/command/__init__.py \ -+ gdb/command/ignore_errors.py \ - gdb/command/explore.py \ - gdb/command/backtrace.py \ - gdb/command/frame_filters.py \ -@@ -92,6 +93,7 @@ PYTHON_FILE_LIST = \ - gdb/function/as_string.py \ - gdb/function/caller_is.py \ - gdb/function/strfns.py \ -+ gdb/function/in_scope.py \ - gdb/printer/__init__.py \ - gdb/printer/bound_registers.py - -diff --git a/gdb/gdb-gdb.gdb.in b/gdb/gdb-gdb.gdb.in ---- a/gdb/gdb-gdb.gdb.in -+++ b/gdb/gdb-gdb.gdb.in -@@ -1,5 +1,15 @@ - echo Setting up the environment for debugging gdb.\n - -+# Set up the Python library and "require" command. -+python -+from os.path import abspath -+gdb.datadir = abspath ('@srcdir@/python/lib') -+gdb.pythonlibdir = gdb.datadir -+gdb.__path__ = [gdb.datadir + '/gdb'] -+sys.path.insert(0, gdb.datadir) -+end -+source @srcdir@/python/lib/gdb/__init__.py -+ - if !$gdb_init_done - set variable $gdb_init_done = 1 - -diff --git a/gdb/python/lib/gdb/command/ignore_errors.py b/gdb/python/lib/gdb/command/ignore_errors.py -new file mode 100644 ---- /dev/null -+++ b/gdb/python/lib/gdb/command/ignore_errors.py -@@ -0,0 +1,37 @@ -+# Ignore errors in user commands. -+ -+# Copyright (C) 2008 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+import gdb -+ -+class IgnoreErrorsCommand (gdb.Command): -+ """Execute a single command, ignoring all errors. -+Only one-line commands are supported. -+This is primarily useful in scripts.""" -+ -+ def __init__ (self): -+ super (IgnoreErrorsCommand, self).__init__ ("ignore-errors", -+ gdb.COMMAND_OBSCURE, -+ # FIXME... -+ gdb.COMPLETE_COMMAND) -+ -+ def invoke (self, arg, from_tty): -+ try: -+ gdb.execute (arg, from_tty) -+ except: -+ pass -+ -+IgnoreErrorsCommand () -diff --git a/gdb/python/lib/gdb/function/in_scope.py b/gdb/python/lib/gdb/function/in_scope.py -new file mode 100644 ---- /dev/null -+++ b/gdb/python/lib/gdb/function/in_scope.py -@@ -0,0 +1,47 @@ -+# In-scope function. -+ -+# Copyright (C) 2008 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+import gdb -+ -+class InScope (gdb.Function): -+ """Return True if all the given variables or macros are in scope. -+Takes one argument for each variable name to be checked.""" -+ -+ def __init__ (self): -+ super (InScope, self).__init__ ("in_scope") -+ -+ def invoke (self, *vars): -+ if len (vars) == 0: -+ raise (TypeError, "in_scope takes at least one argument") -+ -+ # gdb.Value isn't hashable so it can't be put in a map. -+ # Convert to string first. -+ wanted = set (map (lambda x: x.string (), vars)) -+ found = set () -+ block = gdb.selected_frame ().block () -+ while block: -+ for sym in block: -+ if (sym.is_argument or sym.is_constant -+ or sym.is_function or sym.is_variable): -+ if sym.name in wanted: -+ found.add (sym.name) -+ -+ block = block.superblock -+ -+ return wanted == found -+ -+InScope () -diff --git a/gdb/testsuite/gdb.python/py-frame.exp b/gdb/testsuite/gdb.python/py-frame.exp ---- a/gdb/testsuite/gdb.python/py-frame.exp -+++ b/gdb/testsuite/gdb.python/py-frame.exp -@@ -95,6 +95,8 @@ gdb_test "python print ('result = %s' % f0.read_var ('a'))" " = 1" "test Frame.r - - gdb_test "python print ('result = %s' % (gdb.selected_frame () == f1))" " = True" "test gdb.selected_frame" - -+gdb_test "python print ('result = %s' % (f0.block ()))" "" "test Frame.block" -+ - # Can read SP register. - gdb_test "python print ('result = %s' % (gdb.selected_frame ().read_register ('sp') == gdb.parse_and_eval ('\$sp')))" \ - " = True" \ -diff --git a/gdb/testsuite/gdb.python/py-value.exp b/gdb/testsuite/gdb.python/py-value.exp ---- a/gdb/testsuite/gdb.python/py-value.exp -+++ b/gdb/testsuite/gdb.python/py-value.exp -@@ -419,6 +419,15 @@ proc test_value_after_death {} { - "print value's type" - } - -+# Regression test for a cast failure. The bug was that if we cast a -+# value to its own type, gdb could crash. This happened because we -+# could end up double-freeing a struct value. -+proc test_cast_regression {} { -+ gdb_test "python v = gdb.Value(5)" "" "create value for cast test" -+ gdb_test "python v = v.cast(v.type)" "" "cast value for cast test" -+ gdb_test "python print(v)" "5" "print value for cast test" -+} -+ - # Regression test for invalid subscript operations. The bug was that - # the type of the value was not being checked before allowing a - # subscript operation to proceed. -@@ -606,6 +615,7 @@ test_value_in_inferior - test_value_from_buffer - test_inferior_function_call - test_value_after_death -+test_cast_regression - - # Test either C or C++ values. - diff --git a/gdb-attach-fail-reasons-5of5.patch b/gdb-attach-fail-reasons-5of5.patch deleted file mode 100644 index bf98523..0000000 --- a/gdb-attach-fail-reasons-5of5.patch +++ /dev/null @@ -1,356 +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-attach-fail-reasons-5of5.patch - -;; Print reasons for failed attach/spawn incl. SELinux deny_ptrace (BZ 786878). -;;=push+jan - -http://sourceware.org/ml/gdb-patches/2012-03/msg00171.html - -Hi, - -and here is the last bit for new SELinux 'deny_ptrace': - https://bugzilla.redhat.com/show_bug.cgi?id=786878 - -As even PTRACE_TRACEME fails in such case it needs to install hook for even -that event. - -Thanks, -Jan - -gdb/ -2012-03-06 Jan Kratochvil - - * common/linux-ptrace.c [HAVE_SELINUX_SELINUX_H]: include - selinux/selinux.h. - (linux_ptrace_attach_warnings): Call linux_ptrace_create_warnings. - (linux_ptrace_create_warnings): New. - * common/linux-ptrace.h (linux_ptrace_create_warnings): New declaration. - * config.in: Regenerate. - * configure: Regenerate. - * configure.ac: Check selinux/selinux.h and the selinux library. - * inf-ptrace.c (inf_ptrace_me): Check the ptrace result. - * linux-nat.c (linux_nat_create_inferior): New variable ex. Wrap - to_create_inferior into TRY_CATCH, call linux_ptrace_create_warnings. - -gdb/gdbserver/ - * config.in: Regenerate. - * configure: Regenerate. - * configure.ac: Check selinux/selinux.h and the selinux library. - * linux-low.c (linux_traceme): New function. - (linux_create_inferior, linux_tracefork_child): Call it instead of - direct ptrace. - -diff --git a/gdb/config.in b/gdb/config.in ---- a/gdb/config.in -+++ b/gdb/config.in -@@ -253,6 +253,9 @@ - /* Define if librpm library is being used. */ - #undef HAVE_LIBRPM - -+/* Define to 1 if you have the `selinux' library (-lselinux). */ -+#undef HAVE_LIBSELINUX -+ - /* Define to 1 if you have the header file. */ - #undef HAVE_LIBUNWIND_IA64_H - -@@ -388,6 +391,9 @@ - /* Define to 1 if you have the `scm_new_smob' function. */ - #undef HAVE_SCM_NEW_SMOB - -+/* Define to 1 if you have the header file. */ -+#undef HAVE_SELINUX_SELINUX_H -+ - /* Define to 1 if you have the `setlocale' function. */ - #undef HAVE_SETLOCALE - -diff --git a/gdb/configure b/gdb/configure ---- a/gdb/configure -+++ b/gdb/configure -@@ -16861,6 +16861,64 @@ cat >>confdefs.h <<_ACEOF - _ACEOF - - -+for ac_header in selinux/selinux.h -+do : -+ ac_fn_c_check_header_mongrel "$LINENO" "selinux/selinux.h" "ac_cv_header_selinux_selinux_h" "$ac_includes_default" -+if test "x$ac_cv_header_selinux_selinux_h" = x""yes; then : -+ cat >>confdefs.h <<_ACEOF -+#define HAVE_SELINUX_SELINUX_H 1 -+_ACEOF -+ -+fi -+ -+done -+ -+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for security_get_boolean_active in -lselinux" >&5 -+$as_echo_n "checking for security_get_boolean_active in -lselinux... " >&6; } -+if test "${ac_cv_lib_selinux_security_get_boolean_active+set}" = set; then : -+ $as_echo_n "(cached) " >&6 -+else -+ ac_check_lib_save_LIBS=$LIBS -+LIBS="-lselinux $LIBS" -+cat confdefs.h - <<_ACEOF >conftest.$ac_ext -+/* end confdefs.h. */ -+ -+/* Override any GCC internal prototype to avoid an error. -+ Use char because int might match the return type of a GCC -+ builtin and then its argument prototype would still apply. */ -+#ifdef __cplusplus -+extern "C" -+#endif -+char security_get_boolean_active (); -+int -+main () -+{ -+return security_get_boolean_active (); -+ ; -+ return 0; -+} -+_ACEOF -+if ac_fn_c_try_link "$LINENO"; then : -+ ac_cv_lib_selinux_security_get_boolean_active=yes -+else -+ ac_cv_lib_selinux_security_get_boolean_active=no -+fi -+rm -f core conftest.err conftest.$ac_objext \ -+ conftest$ac_exeext conftest.$ac_ext -+LIBS=$ac_check_lib_save_LIBS -+fi -+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_selinux_security_get_boolean_active" >&5 -+$as_echo "$ac_cv_lib_selinux_security_get_boolean_active" >&6; } -+if test "x$ac_cv_lib_selinux_security_get_boolean_active" = x""yes; then : -+ cat >>confdefs.h <<_ACEOF -+#define HAVE_LIBSELINUX 1 -+_ACEOF -+ -+ LIBS="-lselinux $LIBS" -+ -+fi -+ -+ - - # Support for --with-sysroot is a copy of GDB_AC_WITH_DIR, - # except that the argument to --with-sysroot is optional. -diff --git a/gdb/configure.ac b/gdb/configure.ac ---- a/gdb/configure.ac -+++ b/gdb/configure.ac -@@ -1900,6 +1900,10 @@ case $host_os in - esac - AC_DEFINE_UNQUOTED(GDBINIT,"$gdbinit",[The .gdbinit filename.]) - -+dnl Check security_get_boolean_active availability. -+AC_CHECK_HEADERS(selinux/selinux.h) -+AC_CHECK_LIB(selinux, security_get_boolean_active) -+ - dnl Handle optional features that can be enabled. - - # Support for --with-sysroot is a copy of GDB_AC_WITH_DIR, -diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c ---- a/gdb/linux-nat.c -+++ b/gdb/linux-nat.c -@@ -1103,7 +1103,16 @@ linux_nat_target::create_inferior (const char *exec_file, - /* Make sure we report all signals during startup. */ - pass_signals ({}); - -- inf_ptrace_target::create_inferior (exec_file, allargs, env, from_tty); -+ try -+ { -+ inf_ptrace_target::create_inferior (exec_file, allargs, env, from_tty); -+ } -+ catch (const gdb_exception_error &ex) -+ { -+ std::string result = linux_ptrace_create_warnings (); -+ -+ throw_error (ex.error, "%s%s", result.c_str (), ex.message->c_str ()); -+ } - } - - /* Callback for linux_proc_attach_tgid_threads. Attach to PTID if not -diff --git a/gdb/nat/linux-ptrace.c b/gdb/nat/linux-ptrace.c ---- a/gdb/nat/linux-ptrace.c -+++ b/gdb/nat/linux-ptrace.c -@@ -25,6 +25,10 @@ - #include - #endif - -+#ifdef HAVE_SELINUX_SELINUX_H -+# include -+#endif /* HAVE_SELINUX_SELINUX_H */ -+ - /* Stores the ptrace options supported by the running kernel. - A value of -1 means we did not check for features yet. A value - of 0 means there are no supported features. */ -@@ -50,6 +54,8 @@ linux_ptrace_attach_fail_reason (pid_t pid) - "terminated"), - (int) pid); - -+ result += linux_ptrace_create_warnings (); -+ - return result; - } - -@@ -586,6 +592,25 @@ linux_ptrace_init_warnings (void) - linux_ptrace_test_ret_to_nx (); - } - -+/* Print all possible reasons we could fail to create a traced process. */ -+ -+std::string -+linux_ptrace_create_warnings () -+{ -+ std::string result; -+ -+#ifdef HAVE_LIBSELINUX -+ /* -1 is returned for errors, 0 if it has no effect, 1 if PTRACE_ATTACH is -+ forbidden. */ -+ if (security_get_boolean_active ("deny_ptrace") == 1) -+ string_appendf (result, -+ _("the SELinux boolean 'deny_ptrace' is enabled, " -+ "you can disable this process attach protection by: " -+ "(gdb) shell sudo setsebool deny_ptrace=0\n")); -+#endif /* HAVE_LIBSELINUX */ -+ return result; -+} -+ - /* Extract extended ptrace event from wait status. */ - - int -diff --git a/gdb/nat/linux-ptrace.h b/gdb/nat/linux-ptrace.h ---- a/gdb/nat/linux-ptrace.h -+++ b/gdb/nat/linux-ptrace.h -@@ -184,6 +184,7 @@ extern std::string linux_ptrace_attach_fail_reason (pid_t pid); - extern std::string linux_ptrace_attach_fail_reason_string (ptid_t ptid, int err); - - extern void linux_ptrace_init_warnings (void); -+extern std::string linux_ptrace_create_warnings (); - extern void linux_check_ptrace_features (void); - extern void linux_enable_event_reporting (pid_t pid, int attached); - extern void linux_disable_event_reporting (pid_t pid); -diff --git a/gdbserver/config.in b/gdbserver/config.in ---- a/gdbserver/config.in -+++ b/gdbserver/config.in -@@ -143,6 +143,9 @@ - /* Define if you have the ipt library. */ - #undef HAVE_LIBIPT - -+/* Define to 1 if you have the `selinux' library (-lselinux). */ -+#undef HAVE_LIBSELINUX -+ - /* Define if the target supports branch tracing. */ - #undef HAVE_LINUX_BTRACE - -@@ -249,6 +252,9 @@ - /* Define to 1 if you have the `sbrk' function. */ - #undef HAVE_SBRK - -+/* Define to 1 if you have the header file. */ -+#undef HAVE_SELINUX_SELINUX_H -+ - /* Define to 1 if you have the `setns' function. */ - #undef HAVE_SETNS - -diff --git a/gdbserver/configure b/gdbserver/configure ---- a/gdbserver/configure -+++ b/gdbserver/configure -@@ -10683,6 +10683,64 @@ if $want_ipa ; then - fi - fi - -+for ac_header in selinux/selinux.h -+do : -+ ac_fn_c_check_header_mongrel "$LINENO" "selinux/selinux.h" "ac_cv_header_selinux_selinux_h" "$ac_includes_default" -+if test "x$ac_cv_header_selinux_selinux_h" = x""yes; then : -+ cat >>confdefs.h <<_ACEOF -+#define HAVE_SELINUX_SELINUX_H 1 -+_ACEOF -+ -+fi -+ -+done -+ -+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for security_get_boolean_active in -lselinux" >&5 -+$as_echo_n "checking for security_get_boolean_active in -lselinux... " >&6; } -+if test "${ac_cv_lib_selinux_security_get_boolean_active+set}" = set; then : -+ $as_echo_n "(cached) " >&6 -+else -+ ac_check_lib_save_LIBS=$LIBS -+LIBS="-lselinux $LIBS" -+cat confdefs.h - <<_ACEOF >conftest.$ac_ext -+/* end confdefs.h. */ -+ -+/* Override any GCC internal prototype to avoid an error. -+ Use char because int might match the return type of a GCC -+ builtin and then its argument prototype would still apply. */ -+#ifdef __cplusplus -+extern "C" -+#endif -+char security_get_boolean_active (); -+int -+main () -+{ -+return security_get_boolean_active (); -+ ; -+ return 0; -+} -+_ACEOF -+if ac_fn_c_try_link "$LINENO"; then : -+ ac_cv_lib_selinux_security_get_boolean_active=yes -+else -+ ac_cv_lib_selinux_security_get_boolean_active=no -+fi -+rm -f core conftest.err conftest.$ac_objext \ -+ conftest$ac_exeext conftest.$ac_ext -+LIBS=$ac_check_lib_save_LIBS -+fi -+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_selinux_security_get_boolean_active" >&5 -+$as_echo "$ac_cv_lib_selinux_security_get_boolean_active" >&6; } -+if test "x$ac_cv_lib_selinux_security_get_boolean_active" = x""yes; then : -+ cat >>confdefs.h <<_ACEOF -+#define HAVE_LIBSELINUX 1 -+_ACEOF -+ -+ LIBS="-lselinux $LIBS" -+ -+fi -+ -+ - - - -diff --git a/gdbserver/configure.ac b/gdbserver/configure.ac ---- a/gdbserver/configure.ac -+++ b/gdbserver/configure.ac -@@ -401,6 +401,10 @@ if $want_ipa ; then - fi - fi - -+dnl Check security_get_boolean_active availability. -+AC_CHECK_HEADERS(selinux/selinux.h) -+AC_CHECK_LIB(selinux, security_get_boolean_active) -+ - AC_SUBST(GDBSERVER_DEPFILES) - AC_SUBST(GDBSERVER_LIBS) - AC_SUBST(srv_xmlbuiltin) -diff --git a/gdbserver/linux-low.cc b/gdbserver/linux-low.cc ---- a/gdbserver/linux-low.cc -+++ b/gdbserver/linux-low.cc -@@ -932,7 +932,16 @@ linux_ptrace_fun () - { - if (ptrace (PTRACE_TRACEME, 0, (PTRACE_TYPE_ARG3) 0, - (PTRACE_TYPE_ARG4) 0) < 0) -- trace_start_error_with_name ("ptrace"); -+ { -+ int save_errno = errno; -+ -+ std::string msg (linux_ptrace_create_warnings ()); -+ -+ msg += _("Cannot trace created process"); -+ -+ errno = save_errno; -+ trace_start_error_with_name (msg.c_str ()); -+ } - - if (setpgid (0, 0) < 0) - trace_start_error_with_name ("setpgid"); diff --git a/gdb-breakpoint-fix-assert-in-jit_event_handler.patch b/gdb-breakpoint-fix-assert-in-jit_event_handler.patch deleted file mode 100644 index 80fcc2a..0000000 --- a/gdb-breakpoint-fix-assert-in-jit_event_handler.patch +++ /dev/null @@ -1,114 +0,0 @@ -[gdb/breakpoint] Fix assert in jit_event_handler - -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. - ---- - gdb/jit.c | 6 +++++- - 2 files changed, 11 insertions(+), 1 deletion(-) - -diff --git a/gdb/jit.c b/gdb/jit.c -index 296b436c796..be10f197fd6 100644 ---- a/gdb/jit.c -+++ b/gdb/jit.c -@@ -807,6 +807,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; - -@@ -833,7 +837,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-breakpoints-handle-glibc-with-debuginfo-in-create_exception_master_breakpoint.patch b/gdb-breakpoints-handle-glibc-with-debuginfo-in-create_exception_master_breakpoint.patch deleted file mode 100644 index 62d38b5..0000000 --- a/gdb-breakpoints-handle-glibc-with-debuginfo-in-create_exception_master_breakpoint.patch +++ /dev/null @@ -1,53 +0,0 @@ -[gdb/breakpoints] Handle glibc with debuginfo in create_exception_master_breakpoint - -The test-case nextoverthrow.exp is failing on targets with unstripped libc. - -This is a regression since commit 1940319c0ef "[gdb] Fix internal-error in -process_event_stop_test". - -The problem is that this code in create_exception_master_breakpoint: -... - for (objfile *sepdebug = obj->separate_debug_objfile; - sepdebug != nullptr; sepdebug = sepdebug->separate_debug_objfile) - if (create_exception_master_breakpoint_hook (sepdebug)) -... -iterates over all the separate debug object files, but fails to handle the -case that obj itself has the debug info we're looking for. - -Fix this by using the separate_debug_objfiles () range instead, which does -iterate both over obj and the obj->separate_debug_objfile chain. - -Tested on x86_64-linux. - -gdb/ChangeLog: - -2021-02-05 Tom de Vries - - PR breakpoints/27330 - * breakpoint.c (create_exception_master_breakpoint): Handle case that - glibc object file has debug info. - ---- - gdb/breakpoint.c | 9 ++++----- - 2 files changed, 10 insertions(+), 5 deletions(-) - -diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c -index 7ead1529ad1..a94bb2e3540 100644 ---- a/gdb/breakpoint.c -+++ b/gdb/breakpoint.c -@@ -3474,11 +3474,10 @@ create_exception_master_breakpoint (void) - if (create_exception_master_breakpoint_probe (obj)) - continue; - -- /* Iterate over separate debug objects and try an _Unwind_DebugHook -- kind breakpoint. */ -- for (objfile *sepdebug = obj->separate_debug_objfile; -- sepdebug != nullptr; sepdebug = sepdebug->separate_debug_objfile) -- if (create_exception_master_breakpoint_hook (sepdebug)) -+ /* Iterate over main and separate debug objects and try an -+ _Unwind_DebugHook kind breakpoint. */ -+ for (objfile *debug_objfile : obj->separate_debug_objfiles ()) -+ if (create_exception_master_breakpoint_hook (debug_objfile)) - break; - } - } diff --git a/gdb-btrobust.patch b/gdb-btrobust.patch deleted file mode 100644 index 3e98a7c..0000000 --- a/gdb-btrobust.patch +++ /dev/null @@ -1,45 +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-btrobust.patch - -;; Continue backtrace even if a frame filter throws an exception (Phil Muldoon). -;;=push - -This should fix the error with glib. An error message will still be -printed, but a default backtrace will occur in this case. - --- - -diff --git a/gdb/python/py-framefilter.c b/gdb/python/py-framefilter.c ---- a/gdb/python/py-framefilter.c -+++ b/gdb/python/py-framefilter.c -@@ -1204,6 +1204,7 @@ gdbpy_apply_frame_filter (const struct extension_language_defn *extlang, - htab_eq_pointer, - NULL)); - -+ int count_printed = 0; - while (true) - { - gdbpy_ref<> item (PyIter_Next (iterable.get ())); -@@ -1212,8 +1213,8 @@ gdbpy_apply_frame_filter (const struct extension_language_defn *extlang, - { - if (PyErr_Occurred ()) - { -- gdbpy_print_stack_or_quit (); -- return EXT_LANG_BT_ERROR; -+ gdbpy_print_stack (); -+ return count_printed > 0 ? EXT_LANG_BT_ERROR : EXT_LANG_BT_NO_FILTERS; - } - break; - } -@@ -1245,7 +1246,8 @@ gdbpy_apply_frame_filter (const struct extension_language_defn *extlang, - /* Do not exit on error printing a single frame. Print the - error and continue with other frames. */ - if (success == EXT_LANG_BT_ERROR) -- gdbpy_print_stack_or_quit (); -+ gdbpy_print_stack (); -+ count_printed++; - } - - return success; diff --git a/gdb-build-add-cxx_dialect-to-cxx.patch b/gdb-build-add-cxx_dialect-to-cxx.patch new file mode 100644 index 0000000..b58ae9b --- /dev/null +++ b/gdb-build-add-cxx_dialect-to-cxx.patch @@ -0,0 +1,193 @@ +[gdb/build] Add CXX_DIALECT to CXX + +Say we use a gcc version that (while supporting c++11) does not support c++11 +by default, and needs an -std setting to enable it. + +If gdb would use the default AX_CXX_COMPILE_STDCXX from autoconf-archive, then +we'd have: +... +CXX="g++ -std=gnu++11" +... + +That mechanism however has the following problem (quoting from commit +0bcda685399): +... +the top level Makefile passes CXX down to subdirs, and that overrides whatever +gdb/Makefile may set CXX to. The result would be that a make invocation from +the build/gdb/ directory would use "g++ -std=gnu++11" as expected, while a +make invocation at the top level would not. +... + +Commit 0bcda685399 fixes this by using a custom AX_CXX_COMPILE_STDCXX which +does: +... +CXX=g++ +CXX_DIALECT=-std=gnu++11 +... + +The problem reported in PR28318 is that using the custom instead of the +default AX_CXX_COMPILE_STDCXX makes the configure test for std::thread +support fail. + +We could simply add $CXX_DIALECT to the test for std::thread support, but +that would have to be repeated for each added c++ support test. + +Instead, fix this by doing: +... +CXX="g++ -std=gnu++11" +CXX_DIALECT=-std=gnu++11 +... + +This is somewhat awkward, since it results in -std=gnu++11 occuring twice in +some situations: +... +$ touch src/gdb/dwarf2/read.c +$ ( cd build/gdb; make V=1 dwarf2/read.o ) +g++-4.8 -std=gnu++11 -x c++ -std=gnu++11 ... +... + +However, both settings are needed: + - the switch in CXX for the std::thread tests (and other tests) + - the switch in CXX_DIALECT so it can be appended in Makefiles, to + counteract the fact that the top-level Makefile overrides CXX + +The code added in gdb/ax_cxx_compile_stdcxx.m4 is copied from the default +AX_CXX_COMPILE_STDCXX from autoconf-archive. + +Tested on x86_64-linux. + +Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28318 + +gdb/ChangeLog: + +2021-10-04 Tom de Vries + + PR build/28318 + * ax_cxx_compile_stdcxx.m4: Add CXX_DIALECT to CXX. + * configure: Regenerate. + +gdbserver/ChangeLog: + +2021-10-04 Tom de Vries + + PR build/28318 + * configure: Regenerate. + +gdbsupport/ChangeLog: + +2021-10-04 Tom de Vries + + PR build/28318 + * configure: Regenerate. + +--- + gdb/ax_cxx_compile_stdcxx.m4 | 8 ++++++++ + gdb/configure | 8 ++++++++ + gdbserver/configure | 8 ++++++++ + gdbsupport/configure | 8 ++++++++ + 7 files changed, 48 insertions(+) + +diff --git a/gdb/ax_cxx_compile_stdcxx.m4 b/gdb/ax_cxx_compile_stdcxx.m4 +index 413755a2e88..29d8e10bcc4 100644 +--- a/gdb/ax_cxx_compile_stdcxx.m4 ++++ b/gdb/ax_cxx_compile_stdcxx.m4 +@@ -94,6 +94,10 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl + CXX="$ac_save_CXX"]) + if eval test x\$$cachevar = xyes; then + CXX_DIALECT="$switch" ++ CXX="$CXX $switch" ++ if test -n "$CXXCPP" ; then ++ CXXCPP="$CXXCPP $switch" ++ fi + ac_success=yes + break + fi +@@ -118,6 +122,10 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl + CXX="$ac_save_CXX"]) + if eval test x\$$cachevar = xyes; then + CXX_DIALECT="$switch" ++ CXX="$CXX $switch" ++ if test -n "$CXXCPP" ; then ++ CXXCPP="$CXXCPP $switch" ++ fi + ac_success=yes + break + fi +diff --git a/gdb/configure b/gdb/configure +index 5d89635c043..6d4c2b17ed2 100755 +--- a/gdb/configure ++++ b/gdb/configure +@@ -5841,6 +5841,10 @@ eval ac_res=\$$cachevar + $as_echo "$ac_res" >&6; } + if eval test x\$$cachevar = xyes; then + CXX_DIALECT="$switch" ++ CXX="$CXX $switch" ++ if test -n "$CXXCPP" ; then ++ CXXCPP="$CXXCPP $switch" ++ fi + ac_success=yes + break + fi +@@ -6160,6 +6164,10 @@ eval ac_res=\$$cachevar + $as_echo "$ac_res" >&6; } + if eval test x\$$cachevar = xyes; then + CXX_DIALECT="$switch" ++ CXX="$CXX $switch" ++ if test -n "$CXXCPP" ; then ++ CXXCPP="$CXXCPP $switch" ++ fi + ac_success=yes + break + fi +diff --git a/gdbserver/configure b/gdbserver/configure +index b227167e270..f05c1a9b976 100755 +--- a/gdbserver/configure ++++ b/gdbserver/configure +@@ -5625,6 +5625,10 @@ eval ac_res=\$$cachevar + $as_echo "$ac_res" >&6; } + if eval test x\$$cachevar = xyes; then + CXX_DIALECT="$switch" ++ CXX="$CXX $switch" ++ if test -n "$CXXCPP" ; then ++ CXXCPP="$CXXCPP $switch" ++ fi + ac_success=yes + break + fi +@@ -5944,6 +5948,10 @@ eval ac_res=\$$cachevar + $as_echo "$ac_res" >&6; } + if eval test x\$$cachevar = xyes; then + CXX_DIALECT="$switch" ++ CXX="$CXX $switch" ++ if test -n "$CXXCPP" ; then ++ CXXCPP="$CXXCPP $switch" ++ fi + ac_success=yes + break + fi +diff --git a/gdbsupport/configure b/gdbsupport/configure +index a9dd02c5b72..ae6047865ae 100755 +--- a/gdbsupport/configure ++++ b/gdbsupport/configure +@@ -6520,6 +6520,10 @@ eval ac_res=\$$cachevar + $as_echo "$ac_res" >&6; } + if eval test x\$$cachevar = xyes; then + CXX_DIALECT="$switch" ++ CXX="$CXX $switch" ++ if test -n "$CXXCPP" ; then ++ CXXCPP="$CXXCPP $switch" ++ fi + ac_success=yes + break + fi +@@ -6839,6 +6843,10 @@ eval ac_res=\$$cachevar + $as_echo "$ac_res" >&6; } + if eval test x\$$cachevar = xyes; then + CXX_DIALECT="$switch" ++ CXX="$CXX $switch" ++ if test -n "$CXXCPP" ; then ++ CXXCPP="$CXXCPP $switch" ++ fi + ac_success=yes + break + fi diff --git a/gdb-build-hardcode-with-included-regex.patch b/gdb-build-hardcode-with-included-regex.patch deleted file mode 100644 index 295792d..0000000 --- a/gdb-build-hardcode-with-included-regex.patch +++ /dev/null @@ -1,153 +0,0 @@ -Index: gdb-10.1/gdb/config.in -=================================================================== ---- gdb-10.1.orig/gdb/config.in -+++ gdb-10.1/gdb/config.in -@@ -734,9 +734,6 @@ - /* Define if has the TD_VERSION error code. */ - #undef THREAD_DB_HAS_TD_VERSION - --/* Define to 1 if the regex included in libiberty should be used. */ --#undef USE_INCLUDED_REGEX -- - /* Enable extensions on AIX 3, Interix. */ - #ifndef _ALL_SOURCE - # undef _ALL_SOURCE -Index: gdb-10.1/gdb/configure -=================================================================== ---- gdb-10.1.orig/gdb/configure -+++ gdb-10.1/gdb/configure -@@ -912,7 +912,6 @@ enable_source_highlight - with_intel_pt - with_libipt_prefix - with_libipt_type --with_included_regex - with_sysroot - with_system_gdbinit - with_system_gdbinit_dir -@@ -1663,10 +1662,6 @@ Optional Packages: - --with-libipt-prefix[=DIR] search for libipt in DIR/include and DIR/lib - --without-libipt-prefix don't search for libipt in includedir and libdir - --with-libipt-type=TYPE type of library to search for (auto/static/shared) -- --without-included-regex -- don't use included regex; this is the default on -- systems with version 2 of the GNU C library (use -- with caution on other system) - --with-sysroot[=DIR] search for usr/lib et al within DIR - --with-system-gdbinit=PATH - automatically load a system-wide gdbinit file -@@ -16006,57 +16001,6 @@ if test "$ac_cv_func_setpgrp_void" = yes - fi - fi - --# Assume we'll default to using the included libiberty regex. --gdb_use_included_regex=yes -- --# However, if the system regex is GNU regex, then default to *not* --# using the included regex. --{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU regex" >&5 --$as_echo_n "checking for GNU regex... " >&6; } --if ${gdb_cv_have_gnu_regex+:} false; then : -- $as_echo_n "(cached) " >&6 --else -- cat confdefs.h - <<_ACEOF >conftest.$ac_ext --/* end confdefs.h. */ --#include --int --main () --{ --#define REGEX_INTERFACE_VERSION 1 --#if _GNU_REGEX_INTERFACE_VERSION != REGEX_INTERFACE_VERSION --# error "Version mismatch" --#endif -- ; -- return 0; --} --_ACEOF --if ac_fn_c_try_compile "$LINENO"; then : -- gdb_cv_have_gnu_regex=yes --else -- gdb_cv_have_gnu_regex=no --fi --rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext --fi --{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gdb_cv_have_gnu_regex" >&5 --$as_echo "$gdb_cv_have_gnu_regex" >&6; } --if test "$gdb_cv_have_gnu_regex" = yes; then -- gdb_use_included_regex=no --fi -- -- --# Check whether --with-included-regex was given. --if test "${with_included_regex+set}" = set; then : -- withval=$with_included_regex; gdb_with_regex=$withval --else -- gdb_with_regex=$gdb_use_included_regex --fi -- --if test "$gdb_with_regex" = yes; then -- --$as_echo "#define USE_INCLUDED_REGEX 1" >>confdefs.h -- --fi -- - # Check if defines `struct thread' with a td_pcb member. - ac_fn_c_check_member "$LINENO" "struct thread" "td_pcb" "ac_cv_member_struct_thread_td_pcb" "#include - #include -Index: gdb-10.1/gdb/configure.ac -=================================================================== ---- gdb-10.1.orig/gdb/configure.ac -+++ gdb-10.1/gdb/configure.ac -@@ -1514,35 +1514,6 @@ if test "$ac_cv_func_setpgrp_void" = yes - fi - fi - --# Assume we'll default to using the included libiberty regex. --gdb_use_included_regex=yes -- --# However, if the system regex is GNU regex, then default to *not* --# using the included regex. --AC_CACHE_CHECK( -- [for GNU regex], -- [gdb_cv_have_gnu_regex], -- [AC_TRY_COMPILE( -- [#include ], -- [#define REGEX_INTERFACE_VERSION 1 --#if _GNU_REGEX_INTERFACE_VERSION != REGEX_INTERFACE_VERSION --# error "Version mismatch" --#endif], -- gdb_cv_have_gnu_regex=yes, -- gdb_cv_have_gnu_regex=no)]) --if test "$gdb_cv_have_gnu_regex" = yes; then -- gdb_use_included_regex=no --fi -- --AC_ARG_WITH(included-regex, -- AS_HELP_STRING([--without-included-regex], [don't use included regex; this is the default on systems with version 2 of the GNU C library (use with caution on other system)]), -- gdb_with_regex=$withval, -- gdb_with_regex=$gdb_use_included_regex) --if test "$gdb_with_regex" = yes; then -- AC_DEFINE(USE_INCLUDED_REGEX, 1, -- [Define to 1 if the regex included in libiberty should be used.]) --fi -- - # Check if defines `struct thread' with a td_pcb member. - AC_CHECK_MEMBERS([struct thread.td_pcb], [], [], - [#include -Index: gdb-10.1/gdb/gdb_regex.h -=================================================================== ---- gdb-10.1.orig/gdb/gdb_regex.h -+++ gdb-10.1/gdb/gdb_regex.h -@@ -19,13 +19,7 @@ - #ifndef GDB_REGEX_H - #define GDB_REGEX_H 1 - --#ifdef USE_INCLUDED_REGEX - # include "xregex.h" --#else --/* Request 4.2 BSD regex functions. */ --# define _REGEX_RE_COMP --# include --#endif - - /* A compiled regex. This is mainly a wrapper around regex_t. The - the constructor throws on regcomp error and the destructor is diff --git a/gdb-build-make-c-exp.y-work-with-bison-3.8.patch b/gdb-build-make-c-exp.y-work-with-bison-3.8.patch new file mode 100644 index 0000000..b01f471 --- /dev/null +++ b/gdb-build-make-c-exp.y-work-with-bison-3.8.patch @@ -0,0 +1,37 @@ +Make c-exp.y work with Bison 3.8+ + +When using Bison 3.8, we get this error: + ../../gdb/c-exp.y:3455:1: error: ‘void c_print_token(FILE*, int, YYSTYPE)’ defined but not used [-Werror=unused-function] + +That's because bison 3.8 removed YYPRINT support: +https://savannah.gnu.org/forum/forum.php?forum_id=10047 + +Accordingly, this patch only defines that function for Bison < 3.8. + +--- + gdb/c-exp.y | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/gdb/c-exp.y b/gdb/c-exp.y +index 93b10f05b7d..9b4b88accfe 100644 +--- a/gdb/c-exp.y ++++ b/gdb/c-exp.y +@@ -167,7 +167,7 @@ static struct stoken operator_stoken (const char *); + static struct stoken typename_stoken (const char *); + static void check_parameter_typelist (std::vector *); + +-#ifdef YYBISON ++#if defined(YYBISON) && YYBISON < 30800 + static void c_print_token (FILE *file, int type, YYSTYPE value); + #define YYPRINT(FILE, TYPE, VALUE) c_print_token (FILE, TYPE, VALUE) + #endif +@@ -3446,7 +3446,8 @@ c_parse (struct parser_state *par_state) + return result; + } + +-#ifdef YYBISON ++#if defined(YYBISON) && YYBISON < 30800 ++ + + /* This is called via the YYPRINT macro when parser debugging is + enabled. It prints a token's value. */ diff --git a/gdb-bz1219747-attach-kills.patch b/gdb-bz1219747-attach-kills.patch deleted file mode 100644 index 41d17d6..0000000 --- a/gdb-bz1219747-attach-kills.patch +++ /dev/null @@ -1,178 +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-bz1219747-attach-kills.patch - -;; Never kill PID on: gdb exec PID (Jan Kratochvil, RH BZ 1219747). -;;=push+jan - -http://sourceware.org/ml/gdb-patches/2015-10/msg00301.html - -Hi, - -in some cases with deleted main executable GDB will want to kill the inferior. - -$ cp /bin/sleep /tmp/sleep;/tmp/sleep 1h&p=$! -$ rm /tmp/sleep -$ gdb /tmp/sleep $p -GNU gdb (GDB) 7.10.50.20151016-cvs -/tmp/sleep: No such file or directory. -Attaching to process 9694 -/tmp/sleep (deleted): No such file or directory. -A program is being debugged already. Kill it? (y or n) _ - -The first attachment of "/tmp/sleep" commandline argument errors at: - -267 if (scratch_chan < 0) -268 perror_with_name (filename); -1051 if (catch_command_errors_const (exec_file_attach, execarg, -1052 !batch_flag)) - -Then GDB tries to attach to the process $p: - -1082 if (catch_command_errors (attach_command, pid_or_core_arg, -1083 !batch_flag) == 0) - -This succeeds and since this moment GDB has a valid inferior. But despite that -the lines -1082 if (catch_command_errors (attach_command, pid_or_core_arg, -1083 !batch_flag) == 0) -still fail because consequently attach_command() fails to find the associated -executable file: - -267 if (scratch_chan < 0) -268 perror_with_name (filename); -1082 if (catch_command_errors (attach_command, pid_or_core_arg, -1083 !batch_flag) == 0) - -and therefore GDB executes the following: - -(gdb) bt -2179 if (have_inferiors ()) -2180 { -2181 if (!from_tty -2182 || !have_live_inferiors () -2183 || query (_("A program is being debugged already. Kill it? "))) -2184 iterate_over_inferiors (dispose_inferior, NULL); -2185 else -2186 error (_("Program not killed.")); -2187 } -1084 catch_command_errors (core_file_command, pid_or_core_arg, -1085 !batch_flag); - -No regressions on {x86_64,x86_64-m32,i686}-fedora24pre-linux-gnu. - -Thanks, -Jan - -gdb/ChangeLog -2015-10-16 Jan Kratochvil - - * main.c (captured_main): Run core_file_command for pid_or_core_arg - only if not have_inferiors (). - -gdb/testsuite/ChangeLog -2015-10-16 Jan Kratochvil - - * gdb.base/attach-kills.c: New. - * gdb.base/attach-kills.exp: New. - -diff --git a/gdb/main.c b/gdb/main.c ---- a/gdb/main.c -+++ b/gdb/main.c -@@ -1199,7 +1199,10 @@ captured_main_1 (struct captured_main_args *context) - { - ret = catch_command_errors (attach_command, pid_or_core_arg, - !batch_flag); -- if (ret == 0) -+ if (ret == 0 -+ /* attach_command could succeed partially and core_file_command -+ would try to kill it. */ -+ && !have_inferiors ()) - ret = catch_command_errors (core_file_command, - pid_or_core_arg, - !batch_flag); -diff --git a/gdb/testsuite/gdb.base/attach-kills.c b/gdb/testsuite/gdb.base/attach-kills.c -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.base/attach-kills.c -@@ -0,0 +1,25 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 2015 Free Software Foundation, Inc. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . */ -+ -+#include -+ -+int -+main (void) -+{ -+ sleep (600); -+ return 0; -+} -diff --git a/gdb/testsuite/gdb.base/attach-kills.exp b/gdb/testsuite/gdb.base/attach-kills.exp -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.base/attach-kills.exp -@@ -0,0 +1,49 @@ -+# Copyright (C) 2015 Free Software Foundation, Inc. -+# -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+if { ![can_spawn_for_attach] } { -+ return 0 -+} -+ -+standard_testfile -+ -+if { [build_executable ${testfile}.exp $testfile] == -1 } { -+ return -1 -+} -+ -+# Start the program running and then wait for a bit, to be sure -+# that it can be attached to. -+ -+set test_spawn_id [spawn_wait_for_attach $binfile] -+set testpid [spawn_id_get_pid $test_spawn_id] -+ -+remote_exec target "cp -pf -- $binfile $binfile-copy" -+remote_exec target "rm -f -- $binfile" -+ -+set test "start gdb" -+set res [gdb_spawn_with_cmdline_opts \ -+ "-iex \"set height 0\" -iex \"set width 0\" /DoEsNoTeXySt $testpid"] -+if { $res != 0} { -+ fail "$test (spawn)" -+ kill_wait_spawned_process $test_spawn_id -+ return -1 -+} -+gdb_test_multiple "" $test { -+ -re "\r\nAttaching to .*\r\n$gdb_prompt $" { -+ pass $test -+ } -+} -+ -+kill_wait_spawned_process $test_spawn_id diff --git a/gdb-bz601887-dwarf4-rh-test.patch b/gdb-bz601887-dwarf4-rh-test.patch index 5f46cbc..db30310 100644 --- a/gdb-bz601887-dwarf4-rh-test.patch +++ b/gdb-bz601887-dwarf4-rh-test.patch @@ -233,11 +233,11 @@ new file mode 100644 + && ![istarget *-*-openbsd*] + && ![istarget arm-*-eabi*] + && ![istarget powerpc-*-eabi*]} { -+ return 0 ++ return 0 +} + +if {![istarget x86_64-*]} { -+ return 0 ++ return 0 +} + +set testfile "rh-dwarf4-x86_64" diff --git a/gdb-bz634108-solib_address.patch b/gdb-bz634108-solib_address.patch index 4a25f21..bc7ef8a 100644 --- a/gdb-bz634108-solib_address.patch +++ b/gdb-bz634108-solib_address.patch @@ -38,4 +38,4 @@ new file mode 100644 +# Skip all tests if Python scripting is not enabled. +if { [skip_python_tests] } { continue } + -+gdb_test "python print gdb.solib_name(-1)" "None" "gdb.solib_name exists" ++gdb_test "python print (gdb.solib_name(-1))" "None" "gdb.solib_name exists" diff --git a/gdb-ccache-workaround.patch b/gdb-ccache-workaround.patch index e9df62f..8fc9c41 100644 --- a/gdb-ccache-workaround.patch +++ b/gdb-ccache-workaround.patch @@ -9,8 +9,8 @@ Subject: gdb-ccache-workaround.patch 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 +@@ -27,6 +27,14 @@ if { [test_compiler_info "gcc-*"] } { + lappend options additional_flags=-fdebug-macro } +# Workaround ccache making lineno non-zero for command-line definitions. diff --git a/gdb-config.patch b/gdb-config.patch deleted file mode 100644 index 3068b53..0000000 --- a/gdb-config.patch +++ /dev/null @@ -1,56 +0,0 @@ -diff -Nrup a/gnulib/import/m4/alloca.m4 b/gnulib/import/m4/alloca.m4 ---- a/gnulib/import/m4/alloca.m4 2019-11-18 18:49:20.000000000 -0700 -+++ b/gnulib/import/m4/alloca.m4 2020-01-11 01:07:36.200483085 -0700 -@@ -89,7 +89,7 @@ AC_CACHE_CHECK([stack direction for C al - [ac_cv_c_stack_direction], - [AC_RUN_IFELSE([AC_LANG_SOURCE( - [AC_INCLUDES_DEFAULT --int -+__attribute__ (noinline,noclone)) int - find_stack_direction (int *addr, int depth) - { - int dir, dummy = 0; -diff -Nrup a/libiberty/aclocal.m4 b/libiberty/aclocal.m4 ---- a/libiberty/aclocal.m4 2019-01-19 09:01:34.000000000 -0700 -+++ b/libiberty/aclocal.m4 2020-01-09 22:00:27.183312982 -0700 -@@ -147,7 +147,7 @@ if test $ac_cv_os_cray = yes; then - fi - - AC_CACHE_CHECK(stack direction for C alloca, ac_cv_c_stack_direction, --[AC_TRY_RUN([find_stack_direction () -+[AC_TRY_RUN([__attribute__ ((noclone,noinline)) find_stack_direction () - { - static char *addr = 0; - auto char dummy; -diff --git a/config/intdiv0.m4 b/config/intdiv0.m4 -index 55dddcf1..ba906efc 100644 ---- a/config/intdiv0.m4 -+++ b/config/intdiv0.m4 -@@ -31,10 +31,10 @@ sigfpe_handler (sig) int sig; - exit (sig != SIGFPE); - } - --int x = 1; --int y = 0; --int z; --int nan; -+volatile int x = 1; -+volatile int y = 0; -+volatile int z; -+volatile int nan; - - int main () - { -diff --git a/libiberty/configure.ac b/libiberty/configure.ac -index f1ce7601..fc20d228 100644 ---- a/libiberty/configure.ac -+++ b/libiberty/configure.ac -@@ -661,7 +661,7 @@ if test -z "${setobjs}"; then - for v in $vars; do - AC_MSG_CHECKING([for $v]) - AC_CACHE_VAL(libiberty_cv_var_$v, -- [AC_LINK_IFELSE([AC_LANG_PROGRAM([[int *p;]],[[extern int $v []; p = $v;]])], -+ [AC_LINK_IFELSE([AC_LANG_PROGRAM([[__attribute__ ((used)) int *p;]],[[extern int $v []; p = $v;]])], - [eval "libiberty_cv_var_$v=yes"], - [eval "libiberty_cv_var_$v=no"])]) - if eval "test \"`echo '$libiberty_cv_var_'$v`\" = yes"; then diff --git a/gdb-container-rh-pkg.patch b/gdb-container-rh-pkg.patch index f53cbfd..31f516c 100644 --- a/gdb-container-rh-pkg.patch +++ b/gdb-container-rh-pkg.patch @@ -9,7 +9,7 @@ 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) +@@ -14290,7 +14290,17 @@ remote_target::pid_to_exec_file (int pid) char *annex = NULL; if (packet_support (PACKET_qXfer_exec_file) != PACKET_ENABLE) diff --git a/gdb-don-t-return-non-existing-path-in-debuginfod-source-query.patch b/gdb-don-t-return-non-existing-path-in-debuginfod-source-query.patch deleted file mode 100644 index b90031b..0000000 --- a/gdb-don-t-return-non-existing-path-in-debuginfod-source-query.patch +++ /dev/null @@ -1,69 +0,0 @@ -[gdb] Don't return non-existing path in debuginfod_source_query - -When setting env var DEBUGINFOD_URLS to " " and running the testsuite, we run -into these regressions: -... -FAIL: gdb.base/list-missing-source.exp: info source -FAIL: gdb.base/source-dir.exp: info source before setting directory search list -... - -Setting var DEBUGINFOD_URLS to " " allows the debuginfod query function -debuginfod_source_query to get past its early exit. - -The function debuginfod_source_query is documented as: "If the file is -successfully retrieved, its path on the local machine is stored in DESTNAME". - -However, in case we get back -ENOENT from libdebuginfod, we still set -DESTNAME: -.... - if (fd.get () < 0 && fd.get () != -ENOENT) - printf_filtered (_("Download failed: %s. Continuing without source file %ps.\n"), - safe_strerror (-fd.get ()), - styled_string (file_name_style.style (), srcpath)); - else - *destname = make_unique_xstrdup (srcpath); - - return fd; -... - -Fix this by making debuginfod_source_query fit it's documentation and only -setting DESTNAME when successfully retrieving a file. Likewise in -debuginfod_debuginfo_query. - -gdb/ChangeLog: - -2020-11-16 Tom de Vries - - * debuginfod-support.c (debuginfod_source_query) - (debuginfod_debuginfo_query): Only set DESTNAME if successful. - ---- - gdb/debuginfod-support.c | 7 +++++-- - 1 file changed, 5 insertions(+), 2 deletions(-) - -diff --git a/gdb/debuginfod-support.c b/gdb/debuginfod-support.c -index 0dc88c2c2a1..1282fc0e9da 100644 ---- a/gdb/debuginfod-support.c -+++ b/gdb/debuginfod-support.c -@@ -120,7 +120,8 @@ debuginfod_source_query (const unsigned char *build_id, - printf_filtered (_("Download failed: %s. Continuing without source file %ps.\n"), - safe_strerror (-fd.get ()), - styled_string (file_name_style.style (), srcpath)); -- else -+ -+ if (fd.get () >= 0) - destname->reset (xstrdup (srcpath)); - - debuginfod_end (c); -@@ -154,8 +155,10 @@ debuginfod_debuginfo_query (const unsigned char *build_id, - safe_strerror (-fd.get ()), - styled_string (file_name_style.style (), filename)); - -- destname->reset (dname); -+ if (fd.get () >= 0) -+ destname->reset (dname); - debuginfod_end (c); -+ - return fd; - } - #endif diff --git a/gdb-dts-rhel6-python-compat.patch b/gdb-dts-rhel6-python-compat.patch deleted file mode 100644 index 9c7051a..0000000 --- a/gdb-dts-rhel6-python-compat.patch +++ /dev/null @@ -1,315 +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-dts-rhel6-python-compat.patch - -;; [rhel6] DTS backward Python compatibility API (BZ 1020004, Phil Muldoon). -;;=fedora - -https://bugzilla.redhat.com/show_bug.cgi?id=1020004 - -diff --git a/gdb/data-directory/Makefile.in b/gdb/data-directory/Makefile.in ---- a/gdb/data-directory/Makefile.in -+++ b/gdb/data-directory/Makefile.in -@@ -71,6 +71,8 @@ PYTHON_FILE_LIST = \ - gdb/__init__.py \ - gdb/FrameDecorator.py \ - gdb/FrameIterator.py \ -+ gdb/FrameWrapper.py \ -+ gdb/backtrace.py \ - gdb/frames.py \ - gdb/printing.py \ - gdb/prompt.py \ -@@ -79,6 +81,7 @@ PYTHON_FILE_LIST = \ - gdb/xmethod.py \ - gdb/command/__init__.py \ - gdb/command/explore.py \ -+ gdb/command/backtrace.py \ - gdb/command/frame_filters.py \ - gdb/command/pretty_printers.py \ - gdb/command/prompt.py \ -diff --git a/gdb/python/lib/gdb/FrameWrapper.py b/gdb/python/lib/gdb/FrameWrapper.py -new file mode 100644 ---- /dev/null -+++ b/gdb/python/lib/gdb/FrameWrapper.py -@@ -0,0 +1,122 @@ -+# Wrapper API for frames. -+ -+# Copyright (C) 2008, 2009 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+import gdb -+ -+# FIXME: arguably all this should be on Frame somehow. -+class FrameWrapper: -+ def __init__ (self, frame): -+ self.frame = frame; -+ -+ def write_symbol (self, stream, sym, block): -+ if len (sym.linkage_name): -+ nsym, is_field_of_this = gdb.lookup_symbol (sym.linkage_name, block) -+ if nsym.addr_class != gdb.SYMBOL_LOC_REGISTER: -+ sym = nsym -+ -+ stream.write (sym.print_name + "=") -+ try: -+ val = self.read_var (sym) -+ if val != None: -+ val = str (val) -+ # FIXME: would be nice to have a more precise exception here. -+ except RuntimeError as text: -+ val = text -+ if val == None: -+ stream.write ("???") -+ else: -+ stream.write (str (val)) -+ -+ def print_frame_locals (self, stream, func): -+ -+ try: -+ block = self.frame.block() -+ except RuntimeError: -+ block = None -+ -+ while block != None: -+ if block.is_global or block.is_static: -+ break -+ -+ for sym in block: -+ if sym.is_argument: -+ continue; -+ -+ self.write_symbol (stream, sym, block) -+ stream.write ('\n') -+ -+ def print_frame_args (self, stream, func): -+ -+ try: -+ block = self.frame.block() -+ except RuntimeError: -+ block = None -+ -+ while block != None: -+ if block.function != None: -+ break -+ block = block.superblock -+ -+ first = True -+ for sym in block: -+ if not sym.is_argument: -+ continue; -+ -+ if not first: -+ stream.write (", ") -+ -+ self.write_symbol (stream, sym, block) -+ first = False -+ -+ # FIXME: this should probably just be a method on gdb.Frame. -+ # But then we need stream wrappers. -+ def describe (self, stream, full): -+ if self.type () == gdb.DUMMY_FRAME: -+ stream.write (" \n") -+ elif self.type () == gdb.SIGTRAMP_FRAME: -+ stream.write (" \n") -+ else: -+ sal = self.find_sal () -+ pc = self.pc () -+ name = self.name () -+ if not name: -+ name = "??" -+ if pc != sal.pc or not sal.symtab: -+ stream.write (" 0x%08x in" % pc) -+ stream.write (" " + name + " (") -+ -+ func = self.function () -+ self.print_frame_args (stream, func) -+ -+ stream.write (")") -+ -+ if sal.symtab and sal.symtab.filename: -+ stream.write (" at " + sal.symtab.filename) -+ stream.write (":" + str (sal.line)) -+ -+ if not self.name () or (not sal.symtab or not sal.symtab.filename): -+ lib = gdb.solib_name (pc) -+ if lib: -+ stream.write (" from " + lib) -+ -+ stream.write ("\n") -+ -+ if full: -+ self.print_frame_locals (stream, func) -+ -+ def __getattr__ (self, name): -+ return getattr (self.frame, name) -diff --git a/gdb/python/lib/gdb/backtrace.py b/gdb/python/lib/gdb/backtrace.py -new file mode 100644 ---- /dev/null -+++ b/gdb/python/lib/gdb/backtrace.py -@@ -0,0 +1,42 @@ -+# Filtering backtrace. -+ -+# Copyright (C) 2008, 2011 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+import gdb -+import itertools -+ -+# Our only exports. -+__all__ = ['push_frame_filter', 'create_frame_filter'] -+ -+old_frame_filter = None -+ -+def push_frame_filter (constructor): -+ """Register a new backtrace filter class with the 'backtrace' command. -+The filter will be passed an iterator as an argument. The iterator -+will return gdb.Frame-like objects. The filter should in turn act as -+an iterator returning such objects.""" -+ global old_frame_filter -+ if old_frame_filter == None: -+ old_frame_filter = constructor -+ else: -+ old_frame_filter = lambda iterator, filter = frame_filter: constructor (filter(iterator)) -+ -+def create_frame_filter (iter): -+ global old_frame_filter -+ if old_frame_filter is None: -+ return iter -+ return old_frame_filter (iter) -+ -diff --git a/gdb/python/lib/gdb/command/backtrace.py b/gdb/python/lib/gdb/command/backtrace.py -new file mode 100644 ---- /dev/null -+++ b/gdb/python/lib/gdb/command/backtrace.py -@@ -0,0 +1,106 @@ -+# New backtrace command. -+ -+# Copyright (C) 2008, 2009, 2011 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+import gdb -+import gdb.backtrace -+import itertools -+from gdb.FrameIterator import FrameIterator -+from gdb.FrameWrapper import FrameWrapper -+import sys -+ -+class ReverseBacktraceParameter (gdb.Parameter): -+ """The new-backtrace command can show backtraces in 'reverse' order. -+This means that the innermost frame will be printed last. -+Note that reverse backtraces are more expensive to compute.""" -+ -+ set_doc = "Enable or disable reverse backtraces." -+ show_doc = "Show whether backtraces will be printed in reverse order." -+ -+ def __init__(self): -+ gdb.Parameter.__init__ (self, "reverse-backtrace", -+ gdb.COMMAND_STACK, gdb.PARAM_BOOLEAN) -+ # Default to compatibility with gdb. -+ self.value = False -+ -+class FilteringBacktrace (gdb.Command): -+ """Print backtrace of all stack frames, or innermost COUNT frames. -+With a negative argument, print outermost -COUNT frames. -+Use of the 'full' qualifier also prints the values of the local variables. -+Use of the 'raw' qualifier avoids any filtering by loadable modules. -+""" -+ -+ def __init__ (self): -+ # FIXME: this is not working quite well enough to replace -+ # "backtrace" yet. -+ gdb.Command.__init__ (self, "new-backtrace", gdb.COMMAND_STACK) -+ self.reverse = ReverseBacktraceParameter() -+ -+ def reverse_iter (self, iter): -+ result = [] -+ for item in iter: -+ result.append (item) -+ result.reverse() -+ return result -+ -+ def final_n (self, iter, x): -+ result = [] -+ for item in iter: -+ result.append (item) -+ return result[x:] -+ -+ def invoke (self, arg, from_tty): -+ i = 0 -+ count = 0 -+ filter = True -+ full = False -+ -+ for word in arg.split (" "): -+ if word == '': -+ continue -+ elif word == 'raw': -+ filter = False -+ elif word == 'full': -+ full = True -+ else: -+ count = int (word) -+ -+ # FIXME: provide option to start at selected frame -+ # However, should still number as if starting from newest -+ newest_frame = gdb.newest_frame() -+ iter = itertools.imap (FrameWrapper, -+ FrameIterator (newest_frame)) -+ if filter: -+ iter = gdb.backtrace.create_frame_filter (iter) -+ -+ # Now wrap in an iterator that numbers the frames. -+ iter = itertools.izip (itertools.count (0), iter) -+ -+ # Reverse if the user wanted that. -+ if self.reverse.value: -+ iter = self.reverse_iter (iter) -+ -+ # Extract sub-range user wants. -+ if count < 0: -+ iter = self.final_n (iter, count) -+ elif count > 0: -+ iter = itertools.islice (iter, 0, count) -+ -+ for pair in iter: -+ sys.stdout.write ("#%-2d" % pair[0]) -+ pair[1].describe (sys.stdout, full) -+ -+FilteringBacktrace() diff --git a/gdb-fedora-libncursesw.patch b/gdb-fedora-libncursesw.patch index 8c88b59..2351103 100644 --- a/gdb-fedora-libncursesw.patch +++ b/gdb-fedora-libncursesw.patch @@ -12,7 +12,7 @@ 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 +@@ -9544,6 +9544,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 +20,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 (); +@@ -9568,7 +9569,7 @@ return waddstr (); return 0; } _ACEOF @@ -29,7 +29,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 +@@ -9642,6 +9643,7 @@ case $host_os in esac # These are the libraries checked by Readline. @@ -37,7 +37,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 (); +@@ -9666,7 +9668,7 @@ return tgetent (); return 0; } _ACEOF @@ -49,7 +49,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 -@@ -712,7 +712,8 @@ if test x"$prefer_curses" = xyes; then +@@ -736,7 +736,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. @@ -59,7 +59,7 @@ diff --git a/gdb/configure.ac b/gdb/configure.ac if test "$ac_cv_search_waddstr" != no; then curses_found=yes -@@ -754,7 +755,8 @@ case $host_os in +@@ -778,7 +779,8 @@ case $host_os in esac # These are the libraries checked by Readline. diff --git a/gdb-fix-filename-in-not-in-executable-format-error.patch b/gdb-fix-filename-in-not-in-executable-format-error.patch deleted file mode 100644 index 48255fe..0000000 --- a/gdb-fix-filename-in-not-in-executable-format-error.patch +++ /dev/null @@ -1,27 +0,0 @@ -diff --git a/gdb/exec.c b/gdb/exec.c -index 676f3dc3f7d..7693236019b 100644 ---- a/gdb/exec.c -+++ b/gdb/exec.c -@@ -482,9 +482,8 @@ exec_file_attach (const char *filename, int from_tty) - - if (!exec_bfd) - { -- error (_("\"%ps\": could not open as an executable file: %s."), -- styled_string (file_name_style.style (), scratch_pathname), -- bfd_errmsg (bfd_get_error ())); -+ error (_("\"%s\": could not open as an executable file: %s."), -+ scratch_pathname, bfd_errmsg (bfd_get_error ())); - } - - /* gdb_realpath_keepfile resolves symlinks on the local -@@ -515,8 +514,8 @@ exec_file_attach (const char *filename, int from_tty) - "Please specify an executable to debug."), - scratch_pathname); - else -- error (_("\"%ps\": not in executable format: %s"), -- styled_string (file_name_style.style (), scratch_pathname), -+ error (_("\"%s\": not in executable format: %s"), -+ scratch_pathname, - gdb_bfd_errmsg (bfd_get_error (), matching).c_str ()); - } - diff --git a/gdb-fix-internal-error-in-process_event_stop_test.patch b/gdb-fix-internal-error-in-process_event_stop_test.patch deleted file mode 100644 index 6a677f7..0000000 --- a/gdb-fix-internal-error-in-process_event_stop_test.patch +++ /dev/null @@ -1,267 +0,0 @@ -[gdb] Fix internal-error in process_event_stop_test - -The function create_exception_master_breakpoint in gdb/breakpoint.c attempts -to set a master exception breakpoint in each objfile. It tries this using -a libgcc/unwind probe, and if that fails then using the -_Unwind_DebugHook symbol: -... - for (objfile *objfile : current_program_space->objfiles ()) - { - /* Try using probes. */ - if (/* successful */) - continue; - - /* Try using _Unwind_DebugHook */ - } -... - -The preference scheme works ok both if the objfile has debug info, and if it's -stripped. - -But it doesn't work when the objfile has a .gnu_debuglink to a .debug file -(and the .debug file is present). What happens is that: -- we first encounter objfile libgcc.debug -- we try using probes, and this fails -- so we try _Unwind_DebugHook, which succeeds -- next we encounter objfile libgcc -- we try using probes, and this succeeds. -So, we end up with a master exception breakpoint in both libgcc (using probes) -and libgcc.debug (using _Unwind_DebugHook). - -This eventually causes: -... -(gdb) PASS: gdb.cp/nextoverthrow.exp: post-check - next over a throw 3 -next^M -src/gdb/infrun.c:6384: internal-error: \ - void process_event_stop_test(execution_control_state*): \ - Assertion `ecs->event_thread->control.exception_resume_breakpoint != NULL' \ - failed.^M -A problem internal to GDB has been detected,^M -further debugging may prove unreliable.^M -Quit this debugging session? (y or n) FAIL: gdb.cp/nextoverthrow.exp: next -past catch (GDB internal error) -... - -To trigger this internal-error, we need to use gcc-10 or later to compile the -test-case, such that it contains the fix for gcc PR97774 - "Incorrect line -info for try/catch". - -Fix this by only trying to install the master exception breakpoint in -libgcc.debug using the _Unwind_DebugHook method, if the install using probes -in libgcc failed. - -Tested on x86_64-linux. - -gdb/ChangeLog: - -2021-01-08 Tom de Vries - - PR gdb/26881 - * breakpoint.c (create_exception_master_breakpoint_probe) - (create_exception_master_breakpoint_hook): Factor out - of ... - (create_exception_master_breakpoint): ... here. Only try to install - the master exception breakpoint in objfile.debug using the - _Unwind_DebugHook method, if the install using probes in objfile - failed. - ---- - gdb/breakpoint.c | 164 +++++++++++++++++++++++++++++++++---------------------- - 2 files changed, 110 insertions(+), 65 deletions(-) - -diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c -index f304c0c3559..7ead1529ad1 100644 ---- a/gdb/breakpoint.c -+++ b/gdb/breakpoint.c -@@ -3360,92 +3360,126 @@ create_std_terminate_master_breakpoint (void) - } - } - --/* Install a master breakpoint on the unwinder's debug hook. */ -+/* Install a master breakpoint on the unwinder's debug hook for OBJFILE using a -+ probe. Return true if a breakpoint was installed. */ - --static void --create_exception_master_breakpoint (void) -+static bool -+create_exception_master_breakpoint_probe (objfile *objfile) - { -- const char *const func_name = "_Unwind_DebugHook"; -+ struct breakpoint *b; -+ struct gdbarch *gdbarch; -+ struct breakpoint_objfile_data *bp_objfile_data; - -- for (objfile *objfile : current_program_space->objfiles ()) -- { -- struct breakpoint *b; -- struct gdbarch *gdbarch; -- struct breakpoint_objfile_data *bp_objfile_data; -- CORE_ADDR addr; -- struct explicit_location explicit_loc; -+ bp_objfile_data = get_breakpoint_objfile_data (objfile); - -- bp_objfile_data = get_breakpoint_objfile_data (objfile); -+ /* We prefer the SystemTap probe point if it exists. */ -+ if (!bp_objfile_data->exception_searched) -+ { -+ std::vector ret -+ = find_probes_in_objfile (objfile, "libgcc", "unwind"); - -- /* We prefer the SystemTap probe point if it exists. */ -- if (!bp_objfile_data->exception_searched) -+ if (!ret.empty ()) - { -- std::vector ret -- = find_probes_in_objfile (objfile, "libgcc", "unwind"); -+ /* We are only interested in checking one element. */ -+ probe *p = ret[0]; - -- if (!ret.empty ()) -+ if (!p->can_evaluate_arguments ()) - { -- /* We are only interested in checking one element. */ -- probe *p = ret[0]; -- -- if (!p->can_evaluate_arguments ()) -- { -- /* We cannot use the probe interface here, because it does -- not know how to evaluate arguments. */ -- ret.clear (); -- } -+ /* We cannot use the probe interface here, because it does -+ not know how to evaluate arguments. */ -+ ret.clear (); - } -- bp_objfile_data->exception_probes = ret; -- bp_objfile_data->exception_searched = 1; - } -+ bp_objfile_data->exception_probes = ret; -+ bp_objfile_data->exception_searched = 1; -+ } - -- if (!bp_objfile_data->exception_probes.empty ()) -- { -- gdbarch = objfile->arch (); -+ if (bp_objfile_data->exception_probes.empty ()) -+ return false; - -- for (probe *p : bp_objfile_data->exception_probes) -- { -- b = create_internal_breakpoint (gdbarch, -- p->get_relocated_address (objfile), -- bp_exception_master, -- &internal_breakpoint_ops); -- b->location = new_probe_location ("-probe-stap libgcc:unwind"); -- b->enable_state = bp_disabled; -- } -+ gdbarch = objfile->arch (); - -- continue; -- } -+ for (probe *p : bp_objfile_data->exception_probes) -+ { -+ b = create_internal_breakpoint (gdbarch, -+ p->get_relocated_address (objfile), -+ bp_exception_master, -+ &internal_breakpoint_ops); -+ b->location = new_probe_location ("-probe-stap libgcc:unwind"); -+ b->enable_state = bp_disabled; -+ } - -- /* Otherwise, try the hook function. */ -+ return true; -+} - -- if (msym_not_found_p (bp_objfile_data->exception_msym.minsym)) -- continue; -+/* Install a master breakpoint on the unwinder's debug hook for OBJFILE using -+ _Unwind_DebugHook. Return true if a breakpoint was installed. */ - -- gdbarch = objfile->arch (); -+static bool -+create_exception_master_breakpoint_hook (objfile *objfile) -+{ -+ const char *const func_name = "_Unwind_DebugHook"; -+ struct breakpoint *b; -+ struct gdbarch *gdbarch; -+ struct breakpoint_objfile_data *bp_objfile_data; -+ CORE_ADDR addr; -+ struct explicit_location explicit_loc; - -- if (bp_objfile_data->exception_msym.minsym == NULL) -- { -- struct bound_minimal_symbol debug_hook; -+ bp_objfile_data = get_breakpoint_objfile_data (objfile); - -- debug_hook = lookup_minimal_symbol (func_name, NULL, objfile); -- if (debug_hook.minsym == NULL) -- { -- bp_objfile_data->exception_msym.minsym = &msym_not_found; -- continue; -- } -+ if (msym_not_found_p (bp_objfile_data->exception_msym.minsym)) -+ return false; - -- bp_objfile_data->exception_msym = debug_hook; -+ gdbarch = objfile->arch (); -+ -+ if (bp_objfile_data->exception_msym.minsym == NULL) -+ { -+ struct bound_minimal_symbol debug_hook; -+ -+ debug_hook = lookup_minimal_symbol (func_name, NULL, objfile); -+ if (debug_hook.minsym == NULL) -+ { -+ bp_objfile_data->exception_msym.minsym = &msym_not_found; -+ return false; - } - -- addr = BMSYMBOL_VALUE_ADDRESS (bp_objfile_data->exception_msym); -- addr = gdbarch_convert_from_func_ptr_addr (gdbarch, addr, -- current_top_target ()); -- b = create_internal_breakpoint (gdbarch, addr, bp_exception_master, -- &internal_breakpoint_ops); -- initialize_explicit_location (&explicit_loc); -- explicit_loc.function_name = ASTRDUP (func_name); -- b->location = new_explicit_location (&explicit_loc); -- b->enable_state = bp_disabled; -+ bp_objfile_data->exception_msym = debug_hook; -+ } -+ -+ addr = BMSYMBOL_VALUE_ADDRESS (bp_objfile_data->exception_msym); -+ addr = gdbarch_convert_from_func_ptr_addr (gdbarch, addr, -+ current_top_target ()); -+ b = create_internal_breakpoint (gdbarch, addr, bp_exception_master, -+ &internal_breakpoint_ops); -+ initialize_explicit_location (&explicit_loc); -+ explicit_loc.function_name = ASTRDUP (func_name); -+ b->location = new_explicit_location (&explicit_loc); -+ b->enable_state = bp_disabled; -+ -+ return true; -+} -+ -+/* Install a master breakpoint on the unwinder's debug hook. */ -+ -+static void -+create_exception_master_breakpoint (void) -+{ -+ for (objfile *obj : current_program_space->objfiles ()) -+ { -+ /* Skip separate debug object. */ -+ if (obj->separate_debug_objfile_backlink) -+ continue; -+ -+ /* Try a probe kind breakpoint. */ -+ if (create_exception_master_breakpoint_probe (obj)) -+ continue; -+ -+ /* Iterate over separate debug objects and try an _Unwind_DebugHook -+ kind breakpoint. */ -+ for (objfile *sepdebug = obj->separate_debug_objfile; -+ sepdebug != nullptr; sepdebug = sepdebug->separate_debug_objfile) -+ if (create_exception_master_breakpoint_hook (sepdebug)) -+ break; - } - } - diff --git a/gdb-fix-section-matching-in-find_pc_sect_compunit.patch b/gdb-fix-section-matching-in-find_pc_sect_compunit.patch deleted file mode 100644 index 188b643..0000000 --- a/gdb-fix-section-matching-in-find_pc_sect_compunit.patch +++ /dev/null @@ -1,105 +0,0 @@ -[gdb/testsuite] Fix section matching in find_pc_sect_compunit_symtab - -When running test-case gdb.base/list-ambiguous.exp with target board readnow, -we run into: -... -FAIL: gdb.base/list-ambiguous.exp: list ambiguous_fun -... - -The test-case contains two static functions ambiguous_fun, one in -list-ambiguous0.c and one in list-ambiguous1.c. - -The list command is supposed to show both, but only the one from -list-ambiguous0.c is shown. - -This is due to the section check in find_pc_sect_compunit_symtab. It checks -whether the candidate compunit_symtab contains a symbol that has the required -section. This check is only done for GLOBAL_BLOCK symbols. - -The check succeeds for the compunit_symtab for list-ambiguous0.c, because it -contains main, but it fails for list-ambiguous0.c because it has no global -symbols. - -Fix this by extending the section check to STATIC_BLOCK symbols. - -Tested on x86_64-linux. - -gdb/ChangeLog: - -2020-10-27 Tom de Vries - - * symtab.c (find_pc_sect_compunit_symtab): Include STATIC_BLOCK - symbols in section check. - -gdb/testsuite/ChangeLog: - -2020-10-27 Tom de Vries - - * gdb.base/list-ambiguous-readnow.exp: New file. ---- - gdb/symtab.c | 18 ++++++++++----- - .../gdb.base/list-ambiguous-readnow.exp | 22 +++++++++++++++++++ - 4 files changed, 43 insertions(+), 6 deletions(-) - create mode 100644 gdb/testsuite/gdb.base/list-ambiguous-readnow.exp - -diff --git a/gdb/symtab.c b/gdb/symtab.c -index eda33a7eb4f..f6e24758009 100644 ---- a/gdb/symtab.c -+++ b/gdb/symtab.c -@@ -2954,13 +2954,19 @@ find_pc_sect_compunit_symtab (CORE_ADDR pc, struct obj_section *section) - struct symbol *sym = NULL; - struct block_iterator iter; - -- ALL_BLOCK_SYMBOLS (global_block, iter, sym) -+ for (int b_index = GLOBAL_BLOCK; -+ b_index <= STATIC_BLOCK && sym == NULL; -+ ++b_index) - { -- fixup_symbol_section (sym, obj_file); -- if (matching_obj_sections (SYMBOL_OBJ_SECTION (obj_file, -- sym), -- section)) -- break; -+ const struct block *b = BLOCKVECTOR_BLOCK (bv, b_index); -+ ALL_BLOCK_SYMBOLS (b, iter, sym) -+ { -+ fixup_symbol_section (sym, obj_file); -+ if (matching_obj_sections (SYMBOL_OBJ_SECTION (obj_file, -+ sym), -+ section)) -+ break; -+ } - } - if (sym == NULL) - continue; /* No symbol in this symtab matches -diff --git a/gdb/testsuite/gdb.base/list-ambiguous-readnow.exp b/gdb/testsuite/gdb.base/list-ambiguous-readnow.exp -new file mode 100644 -index 00000000000..347a71ba52a ---- /dev/null -+++ b/gdb/testsuite/gdb.base/list-ambiguous-readnow.exp -@@ -0,0 +1,22 @@ -+# 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 . -+ -+# Run list-ambiguous.exp with -readnow. -+ -+save_vars { GDBFLAGS } { -+ append GDBFLAGS " -readnow" -+ -+ source $srcdir/$subdir/list-ambiguous.exp -+} --- -2.26.2 - diff --git a/gdb-fix-selftest-fails-with-gdb-build-with-O2-flto.patch b/gdb-fix-selftest-fails-with-gdb-build-with-O2-flto.patch index fd07af4..52b25ca 100644 --- a/gdb-fix-selftest-fails-with-gdb-build-with-O2-flto.patch +++ b/gdb-fix-selftest-fails-with-gdb-build-with-O2-flto.patch @@ -1,11 +1,5 @@ Fix selftest FAILs with gdb build with -O2 -flto ---- - gdb/complaints.h | 5 +++-- - gdb/main.c | 5 +++++ - gdb/testsuite/gdb.gdb/selftest.exp | 2 +- - 3 files changed, 9 insertions(+), 3 deletions(-) - diff --git a/gdb/complaints.h b/gdb/complaints.h index 6ad056d257..cac09ff573 100644 --- a/gdb/complaints.h @@ -39,16 +33,3 @@ index 19bbb92388..9d35f9baa8 100644 static void captured_main (void *data) { -diff --git a/gdb/testsuite/gdb.gdb/selftest.exp b/gdb/testsuite/gdb.gdb/selftest.exp -index 43043e58ea..992d79f5cf 100644 ---- a/gdb/testsuite/gdb.gdb/selftest.exp -+++ b/gdb/testsuite/gdb.gdb/selftest.exp -@@ -143,7 +143,7 @@ proc test_with_self { } { - setup_xfail "i*86-pc-linuxaout-gnu" - set description "backtrace through signal handler" - gdb_test_multiple "backtrace" "$description" { -- -re "#0.*(read|poll).*in main \\(.*\\) at .*gdb\\.c.*$gdb_prompt $" { -+ -re "#0.*(read|poll).* main \\(.*\\) at .*gdb\\.c.*$gdb_prompt $" { - pass "$description" - } - } diff --git a/gdb-fix-use-of-invalid-pointer-in-remote-async-inferior-event-handler.patch b/gdb-fix-use-of-invalid-pointer-in-remote-async-inferior-event-handler.patch deleted file mode 100644 index f7bfb39..0000000 --- a/gdb-fix-use-of-invalid-pointer-in-remote-async-inferior-event-handler.patch +++ /dev/null @@ -1,28 +0,0 @@ -[gdb] Fix use of invalid pointer in remote_async_inferior_event_handler - -As proposed by palves here ( -https://sourceware.org/bugzilla/show_bug.cgi?id=26614#c20 ). - ---- - gdb/remote.c | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - -diff --git a/gdb/remote.c b/gdb/remote.c -index ba9e6d6e9b..556de6033f 100644 ---- a/gdb/remote.c -+++ b/gdb/remote.c -@@ -14163,9 +14163,13 @@ remote_async_serial_handler (struct serial *scb, void *context) - static void - remote_async_inferior_event_handler (gdb_client_data data) - { -+ remote_target *remote = (remote_target *) data; -+ /* Hold a strong reference to the remote target while handling an -+ event, since that could result in closing the connection. */ -+ auto remote_ref = target_ops_ref::new_reference (remote); -+ - inferior_event_handler (INF_REG_EVENT); - -- remote_target *remote = (remote_target *) data; - remote_state *rs = remote->get_remote_state (); - - /* inferior_event_handler may have consumed an event pending on the diff --git a/gdb-fortran-fix-print-dynamic-array.patch b/gdb-fortran-fix-print-dynamic-array.patch deleted file mode 100644 index e857e2d..0000000 --- a/gdb-fortran-fix-print-dynamic-array.patch +++ /dev/null @@ -1,14 +0,0 @@ -diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c -index 7467e518d06..fc9bd7a15f3 100644 ---- a/gdb/f-valprint.c -+++ b/gdb/f-valprint.c -@@ -117,7 +117,8 @@ f77_print_array_1 (int nss, int ndimensions, struct type *type, - LONGEST lowerbound, upperbound; - LONGEST i; - -- get_discrete_bounds (range_type, &lowerbound, &upperbound); -+ if (get_discrete_bounds (range_type, &lowerbound, &upperbound) < 0) -+ lowerbound = 0, upperbound = -1; - - if (nss != ndimensions) - { diff --git a/gdb-fortran-frame-string.patch b/gdb-fortran-frame-string.patch index 6b80383..0cbd5e7 100644 --- a/gdb-fortran-frame-string.patch +++ b/gdb-fortran-frame-string.patch @@ -39,15 +39,15 @@ new file mode 100644 +# 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. ++# 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}] } { @@ -67,7 +67,7 @@ new file mode 100644 + +# Fix rejected upstream: +# https://sourceware.org/ml/gdb-patches/2014-07/msg00768.html -+setup_kfail "rejected" *-*-* ++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 diff --git a/gdb-gcore-bash.patch b/gdb-gcore-bash.patch index db1b616..d4e9378 100644 --- a/gdb-gcore-bash.patch +++ b/gdb-gcore-bash.patch @@ -6,5 +6,5 @@ index b9770ea415..3149f6e1fe 100644 -#!/usr/bin/env bash +#!/bin/bash - # Copyright (C) 2003-2020 Free Software Foundation, Inc. + # Copyright (C) 2003-2021 Free Software Foundation, Inc. diff --git a/gdb-glibc-strstr-workaround.patch b/gdb-glibc-strstr-workaround.patch index 200c1b8..c2f50ff 100644 --- a/gdb-glibc-strstr-workaround.patch +++ b/gdb-glibc-strstr-workaround.patch @@ -10,7 +10,7 @@ diff --git a/gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp b/gdb/testsu new file mode 100644 --- /dev/null +++ b/gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp -@@ -0,0 +1,115 @@ +@@ -0,0 +1,119 @@ +# Copyright (C) 2012 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify @@ -56,6 +56,10 @@ new file mode 100644 + untested "$test (no DWARF)" + return 0 + } ++ -re "type = \\(\\)\r\n$gdb_prompt $" { ++ untested "$test (no DWARF)" ++ return 0 ++ } +} + +set addr "" @@ -124,5 +128,5 @@ new file mode 100644 + } +} + -+gdb_test {print strstr("abc","b")} { = 0x[0-9a-f]+ "bc"} -+gdb_test {print strstr("def","e")} { = 0x[0-9a-f]+ "ef"} ++gdb_test {print (char *)strstr("abc","b")} { = 0x[0-9a-f]+ "bc"} ++gdb_test {print (char *)strstr("def","e")} { = 0x[0-9a-f]+ "ef"} diff --git a/gdb-gnat-dwarf-crash-3of3.patch b/gdb-gnat-dwarf-crash-3of3.patch deleted file mode 100644 index 84e5810..0000000 --- a/gdb-gnat-dwarf-crash-3of3.patch +++ /dev/null @@ -1,219 +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-gnat-dwarf-crash-3of3.patch - -;; Fix crash of -readnow /usr/lib/debug/usr/bin/gnatbind.debug (BZ 1069211). -;;=push+jan - -http://sourceware.org/ml/gdb-patches/2014-02/msg00731.html - ---6TrnltStXW4iwmi0 -Content-Type: text/plain; charset=us-ascii -Content-Disposition: inline - -Hi, - -PR 16581: - GDB crash on inherit_abstract_dies infinite recursion - https://sourceware.org/bugzilla/show_bug.cgi?id=16581 - -fixed crash from an infinite recursion. But in rare cases the new code can -now gdb_assert() due to weird DWARF file. - -I do not yet fully understand why the DWARF is as it is but just GDB should -never crash due to invalid DWARF anyway. The "invalid" DWARF I see only in -Fedora GCC build, not in FSF GCC build, more info at: - https://bugzilla.redhat.com/show_bug.cgi?id=1069382 - http://people.redhat.com/jkratoch/gcc-debuginfo-4.8.2-7.fc20.x86_64-gnatbind.debug - -Thanks, -Jan - ---6TrnltStXW4iwmi0 -Content-Type: text/plain; charset=us-ascii -Content-Disposition: inline; filename="complaint.patch" - -gdb/ -2014-02-24 Jan Kratochvil - - * dwarf2read.c (process_die): Change gdb_assert to complaint. - -diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c ---- a/gdb/dwarf2/read.c -+++ b/gdb/dwarf2/read.c -@@ -10162,6 +10162,13 @@ class process_die_scope - static void - process_die (struct die_info *die, struct dwarf2_cu *cu) - { -+ if (die->in_process) -+ { -+ complaint (_("DIE at 0x%s attempted to be processed twice"), -+ sect_offset_str (die->sect_off)); -+ return; -+ } -+ - process_die_scope scope (die, cu); - - switch (die->tag) -diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c ---- a/gdb/linux-nat.c -+++ b/gdb/linux-nat.c -@@ -190,6 +190,12 @@ struct linux_nat_target *linux_target; - /* Does the current host support PTRACE_GETREGSET? */ - enum tribool have_ptrace_getregset = TRIBOOL_UNKNOWN; - -+#ifdef NEED_DETACH_SIGSTOP -+/* PID of the inferior stopped by SIGSTOP before attaching (or zero). */ -+static pid_t pid_was_stopped; -+ -+#endif -+ - static unsigned int debug_linux_nat; - static void - show_debug_linux_nat (struct ui_file *file, int from_tty, -@@ -1044,6 +1050,9 @@ linux_nat_post_attach_wait (ptid_t ptid, int *signalled) - if (linux_proc_pid_is_stopped (pid)) - { - linux_nat_debug_printf ("Attaching to a stopped process"); -+#ifdef NEED_DETACH_SIGSTOP -+ pid_was_stopped = ptid.pid (); -+#endif - - /* The process is definitely stopped. It is in a job control - stop, unless the kernel predates the TASK_STOPPED / -@@ -1359,6 +1368,25 @@ get_detach_signal (struct lwp_info *lp) - return gdb_signal_to_host (signo); - } - -+#ifdef NEED_DETACH_SIGSTOP -+ /* Workaround RHEL-5 kernel which has unreliable PTRACE_DETACH, SIGSTOP (that -+ many TIDs are left unstopped). See RH Bug 496732. */ -+ if (lp->ptid.pid () == pid_was_stopped) -+ { -+ int err; -+ -+ errno = 0; -+ err = kill_lwp (lp->ptid.lwp (), SIGSTOP); -+ if (debug_linux_nat) -+ { -+ fprintf_unfiltered (gdb_stdlog, -+ "SC: lwp kill %d %s\n", -+ err, -+ errno ? safe_strerror (errno) : "ERRNO-OK"); -+ } -+ } -+ -+#endif - return 0; - } - -@@ -1502,6 +1530,10 @@ linux_nat_target::detach (inferior *inf, int from_tty) - detach_one_lwp (main_lwp, &signo); - - detach_success (inf); -+ -+#ifdef NEED_DETACH_SIGSTOP -+ pid_was_stopped = 0; -+#endif - } - } - -@@ -1744,6 +1776,16 @@ linux_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signo) - return; - } - -+#ifdef NEED_DETACH_SIGSTOP -+ /* At this point, we are going to resume the inferior and if we -+ have attached to a stopped process, we no longer should leave -+ it as stopped if the user detaches. PTID variable has PID set to LWP -+ while we need to check the real PID here. */ -+ -+ if (!step && lp && pid_was_stopped == lp->ptid.pid ()) -+ pid_was_stopped = 0; -+ -+#endif - if (resume_many) - iterate_over_lwps (ptid, [=] (struct lwp_info *info) - { -@@ -3617,6 +3659,10 @@ linux_nat_target::mourn_inferior () - - /* Let the arch-specific native code know this process is gone. */ - linux_target->low_forget_process (pid); -+#ifdef NEED_DETACH_SIGSTOP -+ -+ pid_was_stopped = 0; -+#endif - } - - /* Convert a native/host siginfo object, into/from the siginfo in the -diff --git a/gdb/testsuite/gdb.threads/attach-stopped.exp b/gdb/testsuite/gdb.threads/attach-stopped.exp ---- a/gdb/testsuite/gdb.threads/attach-stopped.exp -+++ b/gdb/testsuite/gdb.threads/attach-stopped.exp -@@ -56,7 +56,65 @@ proc corefunc { threadtype } { - gdb_reinitialize_dir $srcdir/$subdir - gdb_load ${binfile} - -- # Verify that we can attach to the stopped process. -+ # Verify that we can attach to the process by first giving its -+ # executable name via the file command, and using attach with the -+ # process ID. -+ -+ set test "$threadtype: set file, before attach1 to stopped process" -+ gdb_test_multiple "file $binfile" "$test" { -+ -re "Load new symbol table from.*y or n. $" { -+ gdb_test "y" "Reading symbols from $escapedbinfile\.\.\.*done." \ -+ "$test (re-read)" -+ } -+ -re "Reading symbols from $escapedbinfile\.\.\.*done.*$gdb_prompt $" { -+ pass "$test" -+ } -+ } -+ -+ set test "$threadtype: attach1 to stopped, after setting file" -+ gdb_test_multiple "attach $testpid" "$test" { -+ -re "Attaching to program.*`?$escapedbinfile'?, process $testpid.*$gdb_prompt $" { -+ pass "$test" -+ } -+ } -+ -+ # ".*sleep.*clone.*" would fail on s390x as bt stops at START_THREAD there. -+ if {[string equal $threadtype threaded]} { -+ gdb_test "thread apply all bt" ".*sleep.*start_thread.*" "$threadtype: attach1 to stopped bt" -+ } else { -+ gdb_test "bt" ".*sleep.*main.*" "$threadtype: attach1 to stopped bt" -+ } -+ -+ # Exit and detach the process. -+ -+ gdb_exit -+ -+ # Avoid some race: -+ sleep 2 -+ -+ if [catch {open /proc/${testpid}/status r} fileid] { -+ set line2 "NOTFOUND" -+ } else { -+ gets $fileid line1; -+ gets $fileid line2; -+ close $fileid; -+ } -+ -+ set test "$threadtype: attach1, exit leaves process stopped" -+ if {[string match "*(stopped)*" $line2]} { -+ pass $test -+ } else { -+ fail $test -+ } -+ -+ # At this point, the process should still be stopped -+ -+ gdb_start -+ gdb_reinitialize_dir $srcdir/$subdir -+ gdb_load ${binfile} -+ -+ # Verify that we can attach to the process just by giving the -+ # process ID. - - set test "$threadtype: attach2 to stopped, after setting file" - gdb_test_multiple "attach $testpid" "$test" { diff --git a/gdb-handle-no-upper-bound-in-value-subscript.patch b/gdb-handle-no-upper-bound-in-value-subscript.patch deleted file mode 100644 index 81365f3..0000000 --- a/gdb-handle-no-upper-bound-in-value-subscript.patch +++ /dev/null @@ -1,43 +0,0 @@ -Handle no upper bound in value_subscript - -Fixes PR26875 - "Incorrect value printed for address of first element of -zero-length array". - -https://sourceware.org/bugzilla/show_bug.cgi?id=26875 - ---- - gdb/valarith.c | 12 +++++++++--- - 1 file changed, 9 insertions(+), 3 deletions(-) - -diff --git a/gdb/valarith.c b/gdb/valarith.c -index 0221bc6e939..32b908d6e5b 100644 ---- a/gdb/valarith.c -+++ b/gdb/valarith.c -@@ -151,18 +151,24 @@ value_subscript (struct value *array, LONGEST index) - { - struct type *range_type = tarray->index_type (); - LONGEST lowerbound, upperbound; -+ bool upperbound_p = true; -+ -+ if (get_discrete_bounds (range_type, &lowerbound, &upperbound) < 0) -+ { -+ lowerbound = range_type->bounds ()->low.const_val (); -+ upperbound_p = false; -+ } - -- get_discrete_bounds (range_type, &lowerbound, &upperbound); - if (VALUE_LVAL (array) != lval_memory) - return value_subscripted_rvalue (array, index, lowerbound); - - if (c_style == 0) - { -- if (index >= lowerbound && index <= upperbound) -+ if (index >= lowerbound && upperbound_p && index <= upperbound) - return value_subscripted_rvalue (array, index, lowerbound); - /* Emit warning unless we have an array of unknown size. - An array of unknown size has lowerbound 0 and upperbound -1. */ -- if (upperbound > -1) -+ if (upperbound_p && upperbound > -1) - warning (_("array or string index out of range")); - /* fall doing C stuff */ - c_style = 1; diff --git a/gdb-jit-reader-multilib.patch b/gdb-jit-reader-multilib.patch deleted file mode 100644 index 909498c..0000000 --- a/gdb-jit-reader-multilib.patch +++ /dev/null @@ -1,46 +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-jit-reader-multilib.patch - -;; Fix jit-reader.h for multi-lib. -;;=push+jan - -diff --git a/gdb/configure b/gdb/configure ---- a/gdb/configure -+++ b/gdb/configure -@@ -9968,10 +9968,12 @@ _ACEOF - - - --if test "x${ac_cv_sizeof_unsigned_long}" = "x8"; then -- TARGET_PTR="unsigned long" --elif test "x${ac_cv_sizeof_unsigned_long_long}" = "x8"; then -+# Try to keep TARGET_PTR the same across archs so that jit-reader.h file -+# content is the same for multilib distributions. -+if test "x${ac_cv_sizeof_unsigned_long_long}" = "x8"; then - TARGET_PTR="unsigned long long" -+elif test "x${ac_cv_sizeof_unsigned_long}" = "x8"; then -+ TARGET_PTR="unsigned long" - elif test "x${ac_cv_sizeof_unsigned___int128}" = "x16"; then - TARGET_PTR="unsigned __int128" - else -diff --git a/gdb/configure.ac b/gdb/configure.ac ---- a/gdb/configure.ac -+++ b/gdb/configure.ac -@@ -803,10 +803,12 @@ AC_CHECK_SIZEOF(unsigned long long) - AC_CHECK_SIZEOF(unsigned long) - AC_CHECK_SIZEOF(unsigned __int128) - --if test "x${ac_cv_sizeof_unsigned_long}" = "x8"; then -- TARGET_PTR="unsigned long" --elif test "x${ac_cv_sizeof_unsigned_long_long}" = "x8"; then -+# Try to keep TARGET_PTR the same across archs so that jit-reader.h file -+# content is the same for multilib distributions. -+if test "x${ac_cv_sizeof_unsigned_long_long}" = "x8"; then - TARGET_PTR="unsigned long long" -+elif test "x${ac_cv_sizeof_unsigned_long}" = "x8"; then -+ TARGET_PTR="unsigned long" - elif test "x${ac_cv_sizeof_unsigned___int128}" = "x16"; then - TARGET_PTR="unsigned __int128" - else diff --git a/gdb-lineno-makeup-test.patch b/gdb-lineno-makeup-test.patch index dfaf0a7..a18e2fe 100644 --- a/gdb-lineno-makeup-test.patch +++ b/gdb-lineno-makeup-test.patch @@ -64,10 +64,10 @@ new file mode 100644 + +/* 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'. */ + diff --git a/gdb-linux_perf-bundle.patch b/gdb-linux_perf-bundle.patch index 174cd07..4ab07ba 100644 --- a/gdb-linux_perf-bundle.patch +++ b/gdb-linux_perf-bundle.patch @@ -213,7 +213,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], [ +@@ -135,7 +135,7 @@ AC_DEFUN([GDB_AC_COMMON], [ AC_PREPROC_IFELSE([AC_LANG_SOURCE([[ #include #ifndef PERF_ATTR_SIZE_VER5 diff --git a/gdb-moribund-utrace-workaround.patch b/gdb-moribund-utrace-workaround.patch deleted file mode 100644 index 3d5b07a..0000000 --- a/gdb-moribund-utrace-workaround.patch +++ /dev/null @@ -1,25 +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-moribund-utrace-workaround.patch - -;; Workaround non-stop moribund locations exploited by kernel utrace (BZ 590623). -;;=push+jan: Currently it is still not fully safe. - -https://bugzilla.redhat.com/show_bug.cgi?id=590623 -http://sources.redhat.com/bugzilla/show_bug.cgi?id=11593 - -Bug in FSF GDB exploited by the ptrace-on-utrace interaction. - -diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c ---- a/gdb/breakpoint.c -+++ b/gdb/breakpoint.c -@@ -11948,6 +11948,8 @@ update_global_location_list (enum ugll_insert_mode insert_mode) - = 3 * (thread_count (proc_target) + 1); - else - old_loc->events_till_retirement = 1; -+ /* Red Hat Bug 590623. */ -+ old_loc->events_till_retirement *= 10; - old_loc->owner = NULL; - - moribund_locations.push_back (old_loc); diff --git a/gdb-physname-pr11734-test.patch b/gdb-physname-pr11734-test.patch index 6585b66..96dba56 100644 --- a/gdb-physname-pr11734-test.patch +++ b/gdb-physname-pr11734-test.patch @@ -12,7 +12,7 @@ diff --git a/gdb/testsuite/gdb.cp/pr11734-1.cc b/gdb/testsuite/gdb.cp/pr11734-1. new file mode 100644 --- /dev/null +++ b/gdb/testsuite/gdb.cp/pr11734-1.cc -@@ -0,0 +1,30 @@ +@@ -0,0 +1,29 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2010 Free Software Foundation, Inc. @@ -42,12 +42,11 @@ new file mode 100644 + p->foo (); + return 0; +} -+ diff --git a/gdb/testsuite/gdb.cp/pr11734-2.cc b/gdb/testsuite/gdb.cp/pr11734-2.cc new file mode 100644 --- /dev/null +++ b/gdb/testsuite/gdb.cp/pr11734-2.cc -@@ -0,0 +1,27 @@ +@@ -0,0 +1,26 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2010 Free Software Foundation, Inc. @@ -74,12 +73,11 @@ new file mode 100644 +pr11734::foo(void) +{ +} -+ diff --git a/gdb/testsuite/gdb.cp/pr11734-3.cc b/gdb/testsuite/gdb.cp/pr11734-3.cc new file mode 100644 --- /dev/null +++ b/gdb/testsuite/gdb.cp/pr11734-3.cc -@@ -0,0 +1,27 @@ +@@ -0,0 +1,26 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2010 Free Software Foundation, Inc. @@ -106,12 +104,11 @@ new file mode 100644 +pr11734::foo (int a) +{ +} -+ diff --git a/gdb/testsuite/gdb.cp/pr11734-4.cc b/gdb/testsuite/gdb.cp/pr11734-4.cc new file mode 100644 --- /dev/null +++ b/gdb/testsuite/gdb.cp/pr11734-4.cc -@@ -0,0 +1,27 @@ +@@ -0,0 +1,26 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2010 Free Software Foundation, Inc. @@ -138,7 +135,6 @@ new file mode 100644 +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 @@ -203,7 +199,7 @@ diff --git a/gdb/testsuite/gdb.cp/pr11734.h b/gdb/testsuite/gdb.cp/pr11734.h new file mode 100644 --- /dev/null +++ b/gdb/testsuite/gdb.cp/pr11734.h -@@ -0,0 +1,28 @@ +@@ -0,0 +1,27 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2010 Free Software Foundation, Inc. @@ -231,4 +227,3 @@ new file mode 100644 + void foo (int); + void foo (char *); +}; -+ diff --git a/gdb-powerpc-remove-512-bytes-region-limit-if-2nd-dawr-is-avaliable.patch b/gdb-powerpc-remove-512-bytes-region-limit-if-2nd-dawr-is-avaliable.patch deleted file mode 100644 index c17fb3b..0000000 --- a/gdb-powerpc-remove-512-bytes-region-limit-if-2nd-dawr-is-avaliable.patch +++ /dev/null @@ -1,72 +0,0 @@ -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. - ---- - gdb/ppc-linux-nat.c | 26 ++++++++++++++++++-------- - 2 files changed, 23 insertions(+), 8 deletions(-) - -Index: gdb-10.1/gdb/ppc-linux-nat.c -=================================================================== ---- gdb-10.1.orig/gdb/ppc-linux-nat.c -+++ gdb-10.1/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_w - 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_w - 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-ppc-power7-test.patch b/gdb-ppc-power7-test.patch index de30c55..2869eea 100644 --- a/gdb-ppc-power7-test.patch +++ b/gdb-ppc-power7-test.patch @@ -25,7 +25,7 @@ new file mode 100644 +# +# 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. ++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Test PowerPC Power7 instructions disassembly. + @@ -48,7 +48,7 @@ new file mode 100644 +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${objfile} -+ ++ + +# Disassemble the function. + diff --git a/gdb-python-finishbreakpoint-update.patch b/gdb-python-finishbreakpoint-update.patch new file mode 100644 index 0000000..a85f235 --- /dev/null +++ b/gdb-python-finishbreakpoint-update.patch @@ -0,0 +1,453 @@ +[gdb/python] FinishBreakPoint update + +I. + +Consider the python gdb.FinishBreakpoint class, an extension of the +gdb.Breakpoint class. + +It sets a temporary breakpoint on the return address of a frame. + +This type of breakpoints is thread-specific. + +II. + +If the FinishBreakpoint is hit, it is deleted, and the method return_value +can be used to get the value returned by the function. + +Let's demonstrate this: +... +$ cat -n test.c + 1 int foo (int a) { return a + 2; } + 2 int main () { return foo (1); } +$ gcc -g test.c +$ gdb -q -batch a.out -ex "set trace-commands on" -ex "tbreak foo" -ex run \ + -ex "python bp = gdb.FinishBreakpoint()" -ex "info breakpoints" \ + -ex continue -ex "info breakpoints" -ex "python print (bp.return_value)" ++tbreak foo +Temporary breakpoint 1 at 0x40049e: file test.c, line 1. ++run + +Temporary breakpoint 1, foo (a=1) at test.c:1 +1 int foo (int a) { return a + 2; } ++python bp = gdb.FinishBreakpoint() +Temporary breakpoint 2 at 0x4004b4: file test.c, line 2. ++info breakpoints +Num Type Disp Enb Address What +2 breakpoint del y 0x004004b4 in main at test.c:2 thread 1 + stop only in thread 1 ++continue + +Temporary breakpoint 2, 0x004004b4 in main () at test.c:2 +2 int main () { return foo (1); } ++info breakpoints +No breakpoints or watchpoints. ++python print (bp.return_value) +3 +... + +III. + +Another possibility is that the FinishBreakpoint is not hit, because the +function did not terminate, f.i. because of longjmp, C++ exceptions, or GDB +return command. + +Let's demonstrate this, using C++ exceptions: +... +$ cat -n test.c + 1 int foo (int a) { throw 1; return a + 2; } + 2 int main () { + 3 try { return foo (1); } catch (...) {}; + 4 return 1; + 5 } +$ g++ -g test.c +$ gdb -q -batch a.out -ex "set trace-commands on" -ex "tbreak foo" -ex run \ + -ex "python bp = gdb.FinishBreakpoint()" -ex "info breakpoints" \ + -ex continue -ex "info breakpoints" -ex "python print (bp.return_value)" ++tbreak foo +Temporary breakpoint 1 at 0x400712: file test.c, line 1. ++run + +Temporary breakpoint 1, foo (a=1) at test.c:1 +1 int foo (int a) { throw 1; return a + 2; } ++python bp = gdb.FinishBreakpoint() +Temporary breakpoint 2 at 0x400742: file test.c, line 3. ++info breakpoints +Num Type Disp Enb Address What +2 breakpoint del y 0x00400742 in main() at test.c:3 thread 1 + stop only in thread 1 ++continue +[Inferior 1 (process 25269) exited with code 01] +Thread-specific breakpoint 2 deleted - thread 1 no longer in the thread list. ++info breakpoints +No breakpoints or watchpoints. ++python print (bp.return_value) +None +... + +Indeed, we do not hit the FinishBreakpoint. Instead, it's deleted when the +thread disappears, like any other thread-specific breakpoint. + +I think this is a bug: the deletion is meant to be handled by FinishBreakpoint +itself. + +IV. + +Fix aforementioned bug by: +- adding an observer of the thread_exit event in FinishBreakpoint +- making sure that this observer is called before the + remove_threaded_breakpoints observer of that same event. + +This changes the behaviour to: +... ++continue +[Inferior 1 (process 30256) exited with code 01] ++info breakpoints +No breakpoints or watchpoints. ++python print (bp.return_value) +None +... + +V. + +An out_of_scope callback can be defined to make this more verbose: +... +$ cat fbp.py +class FBP(gdb.FinishBreakpoint): + def __init__(self): + gdb.FinishBreakpoint.__init__(self) + + def out_of_scope(self): + try: + frame = gdb.selected_frame () + sal = frame.find_sal () + print ("out_of_scope triggered at %s:%s" + % (sal.symtab.fullname(), sal.line)) + except gdb.error as e: + print ("out_of_scope triggered at thread/inferior exit") +... +and using that gets us: +... ++continue +[Inferior 1 (process 30742) exited with code 01] +out_of_scope triggered at thread/inferior exit ++info breakpoints +No breakpoints or watchpoints. ++python print (bp.return_value) +None +... + +VI. + +This out_of_scope event can be triggered earlier than inferior/thread exit. + +Let's demonstrate this: +... +$ cat -n test.c + 1 int bar (int a) { throw 1; return a + 2; } + 2 int foo (int a) { + 3 int res = a; + 4 try + 5 { + 6 res += bar (1); + 7 } + 8 catch (...) + 9 { + 10 } + 11 return res; + 12 } + 13 int main () { + 14 int res = 0; + 15 res += foo (1); + 16 res += 2; + 17 return res * 2; + 18 } +$ g++ -g test.c +$ gdb -q -batch -ex "source fbp.py" a.out -ex "set trace-commands on" \ + -ex "tbreak bar" -ex run -ex "python bp = FBP()" -ex "info breakpoints" \ + -ex "tbreak 16" -ex continue -ex "info breakpoints" \ + -ex "python print (bp.return_value)" ++tbreak bar +Temporary breakpoint 1 at 0x400712: file test.c, line 1. ++run + +Temporary breakpoint 1, bar (a=1) at test.c:1 +1 int bar (int a) { throw 1; return a + 2; } ++python bp = FBP() +Temporary breakpoint 2 at 0x40074f: file test.c, line 6. ++info breakpoints +Num Type Disp Enb Address What +2 breakpoint del y 0x0040074f in foo(int) at test.c:6 thread 1 + stop only in thread 1 ++tbreak 16 +Temporary breakpoint 3 at 0x400784: file test.c, line 16. ++continue + +Temporary breakpoint 3, main () at test.c:16 +16 res += 2; +out_of_scope triggered at /home/vries/gdb_versions/devel/test.c:16 ++info breakpoints +No breakpoints or watchpoints. ++python print (bp.return_value) +None +... + +Note that the out_of_scope event triggers at the breakpoint we set at +test.c:16. If we'd set that breakpoint at line 17, the out_of_scope event +would trigger at line 17 instead. + +Also note that it can't be triggered earlier, say by setting the breakpoint in +foo at line 11. We would get instead "out_of_scope triggered at +thread/inferior exit". + +VII. + +Now consider a reduced version of +src/gdb/testsuite/gdb.python/py-finish-breakpoint2.cc: +... +$ cat -n test.c + 1 #include + 2 + 3 void + 4 throw_exception_1 (int e) + 5 { + 6 throw new int (e); + 7 } + 8 + 9 int + 10 main (void) + 11 { + 12 int i; + 13 try + 14 { + 15 throw_exception_1 (10); + 16 } + 17 catch (const int *e) + 18 { + 19 std::cerr << "Exception #" << *e << std::endl; + 20 } + 21 i += 1; + 22 + 23 return i; + 24 } +$ g++ -g test.c +... + +Now let's try to see if the FinishBreakPoint triggers: +... +$ gdb -q -batch -ex "source fbp.py" a.out -ex "set trace-commands on" \ + -ex "tbreak throw_exception_1" -ex run -ex "python bp = FBP()" \ + -ex "info breakpoints" -ex continue -ex "info breakpoints" \ + -ex "python print (bp.return_value)" ++tbreak throw_exception_1 +Temporary breakpoint 1 at 0x400bd5: file test.c, line 6. ++run + +Temporary breakpoint 1, throw_exception_1 (e=10) at test.c:6 +6 throw new int (e); ++python bp = FBP() +Temporary breakpoint 2 at 0x400c2f: file test.c, line 21. ++info breakpoints +Num Type Disp Enb Address What +2 breakpoint del y 0x00400c2f in main() at test.c:21 thread 1 + stop only in thread 1 ++continue +Exception #10 + +Temporary breakpoint 2, main () at test.c:21 +21 i += 1; ++info breakpoints +No breakpoints or watchpoints. ++python print (bp.return_value) +None +... + +Surprisingly, it did. The explanation is that FinishBreakPoint is really a +frame-return-address breakpoint, and that address happens to be at line 21, +which is still executed after the throw in throw_exception_1. + +Interestingly, with -m32 the FinishBreakPoint doesn't trigger, because the +frame-return-address happens to be an instruction which is part of line 15. + +VIII. + +In conclusion, the FinishBreakpoint is a frame-return-address breakpoint. + +After being set, either: +- it triggers, or +- an out-of-scope event will be generated. + +If an out-of-scope event is generated, it will be due to incomplete function +termination. + +OTOH, incomplete function termination does not guarantee an out-of-scope event +instead of hitting the breakpoint. + +IX. + +The documentation states that 'A finish breakpoint is a temporary breakpoint +set at the return address of a frame, based on the finish command'. + +It's indeed somewhat similar to the finish command, at least in the sense that +both may stop at the frame-return-address. + +But the finish command can accurately detect function termination. + +And the finish command will stop at any other address that is the first +address not in the original function. + +The documentation needs updating to accurately describe what it does. + +X. + +A better implementation of a finish breakpoint would be one that borrows from +the finish command implementation. That one: +- installs a thread_fsm, and +- continues + +A finish breakpoint would do the same minus the continue, but it requires gdb +to handle multiple thread_fsms at a time (because other commands may wish to +install their own thread_fsm), which AFAICT is not supported yet. + +XI. + +This patch repairs a minor part of the functionality, and updates +documentation and test-cases to match actual behaviour. + +The question remains how useful the functionality is, as it is now +( see f.i. discussion at +https://sourceware.org/pipermail/gdb-patches/2021-January/175290.html ). +Perhaps it would be better to deprecate this in a follow-up patch in some form +or another, say by disabling it by default and introducing a maintenance +command that switches it on, with the warning that it is deprecated. + +Tested on x86_64-linux with native and target board unix/-m32, by rebuilding +and running the test-cases: +- gdb.python/py-finish-breakpoint.exp +- gdb.python/py-finish-breakpoint2.exp + +--- + gdb/breakpoint.c | 10 ++++++++++ + gdb/doc/python.texi | 6 ++++-- + gdb/python/py-finishbreakpoint.c | 21 +++++++++++++++++++++ + gdb/testsuite/gdb.python/py-finish-breakpoint2.exp | 16 +++++++++++++--- + 4 files changed, 48 insertions(+), 5 deletions(-) + +diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c +index dbbea6b8bff..64a9a3d394f 100644 +--- a/gdb/breakpoint.c ++++ b/gdb/breakpoint.c +@@ -15452,6 +15452,10 @@ initialize_breakpoint_ops (void) + + static struct cmd_list_element *enablebreaklist = NULL; + ++#if HAVE_PYTHON ++extern gdb::observers::token bpfinishpy_handle_thread_exit_observer_token; ++#endif ++ + /* See breakpoint.h. */ + + cmd_list_element *commands_cmd_element = nullptr; +@@ -16065,6 +16069,12 @@ This is useful for formatted output in user-defined commands.")); + + gdb::observers::about_to_proceed.attach (breakpoint_about_to_proceed, + "breakpoint"); ++#if HAVE_PYTHON ++ gdb::observers::thread_exit.attach ++ (remove_threaded_breakpoints, "breakpoint", ++ { &bpfinishpy_handle_thread_exit_observer_token }); ++#else + gdb::observers::thread_exit.attach (remove_threaded_breakpoints, + "breakpoint"); ++#endif + } +diff --git a/gdb/doc/python.texi b/gdb/doc/python.texi +index f4865b3d6a6..17a67800ba2 100644 +--- a/gdb/doc/python.texi ++++ b/gdb/doc/python.texi +@@ -5698,7 +5698,7 @@ attribute is @code{None}. This attribute is writable. + @tindex gdb.FinishBreakpoint + + A finish breakpoint is a temporary breakpoint set at the return address of +-a frame, based on the @code{finish} command. @code{gdb.FinishBreakpoint} ++a frame. @code{gdb.FinishBreakpoint} + extends @code{gdb.Breakpoint}. The underlying breakpoint will be disabled + and deleted when the execution will run out of the breakpoint scope (i.e.@: + @code{Breakpoint.stop} or @code{FinishBreakpoint.out_of_scope} triggered). +@@ -5717,7 +5717,9 @@ details about this argument. + In some circumstances (e.g.@: @code{longjmp}, C@t{++} exceptions, @value{GDBN} + @code{return} command, @dots{}), a function may not properly terminate, and + thus never hit the finish breakpoint. When @value{GDBN} notices such a +-situation, the @code{out_of_scope} callback will be triggered. ++situation, the @code{out_of_scope} callback will be triggered. Note ++though that improper function termination does not guarantee that the ++finish breakpoint is not hit. + + You may want to sub-class @code{gdb.FinishBreakpoint} and override this + method: +diff --git a/gdb/python/py-finishbreakpoint.c b/gdb/python/py-finishbreakpoint.c +index 1d8373d807e..a881103fdad 100644 +--- a/gdb/python/py-finishbreakpoint.c ++++ b/gdb/python/py-finishbreakpoint.c +@@ -398,6 +398,24 @@ bpfinishpy_handle_exit (struct inferior *inf) + bpfinishpy_detect_out_scope_cb (bp, nullptr); + } + ++/* Attached to `thread_exit' notifications, triggers all the necessary out of ++ scope notifications. */ ++ ++static void ++bpfinishpy_handle_thread_exit (struct thread_info *tp, int ignore) ++{ ++ gdbpy_enter enter_py (target_gdbarch (), current_language); ++ ++ for (breakpoint *bp : all_breakpoints_safe ()) ++ { ++ if (tp->global_num == bp->thread) ++ bpfinishpy_detect_out_scope_cb (bp, nullptr); ++ } ++} ++ ++extern gdb::observers::token bpfinishpy_handle_thread_exit_observer_token; ++gdb::observers::token bpfinishpy_handle_thread_exit_observer_token; ++ + /* Initialize the Python finish breakpoint code. */ + + int +@@ -414,6 +432,9 @@ gdbpy_initialize_finishbreakpoints (void) + "py-finishbreakpoint"); + gdb::observers::inferior_exit.attach (bpfinishpy_handle_exit, + "py-finishbreakpoint"); ++ gdb::observers::thread_exit.attach ++ (bpfinishpy_handle_thread_exit, ++ bpfinishpy_handle_thread_exit_observer_token, "py-finishbreakpoint"); + + return 0; + } +diff --git a/gdb/testsuite/gdb.python/py-finish-breakpoint2.exp b/gdb/testsuite/gdb.python/py-finish-breakpoint2.exp +index 58e086ad3b4..46c39d0d108 100644 +--- a/gdb/testsuite/gdb.python/py-finish-breakpoint2.exp ++++ b/gdb/testsuite/gdb.python/py-finish-breakpoint2.exp +@@ -50,10 +50,20 @@ gdb_test "continue" "Breakpoint .*throw_exception_1.*" "run to exception 1" + gdb_test "python print (len(gdb.breakpoints()))" "3" "check BP count" + gdb_test "python ExceptionFinishBreakpoint(gdb.newest_frame())" \ + "init ExceptionFinishBreakpoint" "set FinishBP after the exception" +-gdb_test "continue" ".*stopped at ExceptionFinishBreakpoint.*" "check FinishBreakpoint in catch()" +-gdb_test "python print (len(gdb.breakpoints()))" "3" "check finish BP removal" + +-gdb_test "continue" ".*Breakpoint.* throw_exception_1.*" "continue to second exception" ++gdb_test_multiple "continue" "continue after setting FinishBreakpoint" { ++ -re -wrap ".*stopped at ExceptionFinishBreakpoint.*" { ++ pass "$gdb_test_name (scenario 1, triggered)" ++ gdb_test "python print (len(gdb.breakpoints()))" "3" \ ++ "check finish BP removal" ++ gdb_test "continue" ".*Breakpoint.* throw_exception_1.*" \ ++ "continue to second exception" ++ } ++ -re -wrap ".*Breakpoint.* throw_exception_1.*" { ++ pass "$gdb_test_name (scenario 2, not triggered)" ++ } ++} ++ + gdb_test "python ExceptionFinishBreakpoint(gdb.newest_frame())" \ + "init ExceptionFinishBreakpoint" "set FinishBP after the exception again" + gdb_test "continue" ".*exception did not finish.*" "FinishBreakpoint with exception thrown not caught" diff --git a/gdb-rhbz1156192-recursive-dlopen-test.patch b/gdb-rhbz1156192-recursive-dlopen-test.patch index 6b92424..9855b7a 100644 --- a/gdb-rhbz1156192-recursive-dlopen-test.patch +++ b/gdb-rhbz1156192-recursive-dlopen-test.patch @@ -81,7 +81,7 @@ diff --git a/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.c b/gdb/tes new file mode 100644 --- /dev/null +++ b/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.c -@@ -0,0 +1,124 @@ +@@ -0,0 +1,125 @@ +/* Testcase for recursive dlopen calls. + + Copyright (C) 2014 Free Software Foundation, Inc. @@ -178,6 +178,7 @@ new file mode 100644 + /* Called recursively. */ + result = malloc (size); + /* Restore new hooks. */ ++ old_malloc_hook = __malloc_hook; + __malloc_hook = custom_malloc_hook; + return result; +} @@ -210,7 +211,7 @@ diff --git a/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.exp b/gdb/t new file mode 100644 --- /dev/null +++ b/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.exp -@@ -0,0 +1,137 @@ +@@ -0,0 +1,157 @@ +# Copyright 2014 Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify @@ -226,8 +227,12 @@ new file mode 100644 +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + -+if { [skip_shlib_tests] } { -+ return 0 ++if {[skip_shlib_tests]} { ++ untested "skipping shlib tests" ++ return 0 ++} elseif {[use_gdb_stub]} { ++ untested "skipping tests because of stub" ++ return 0 +} + +# Library foo @@ -262,6 +267,21 @@ new file mode 100644 + return -1 +} + ++set supported 0 ++gdb_test_multiple "run" "initial trial run" { ++ -re -wrap "exited normally.*" { ++ set supported 1 ++ pass $gdb_test_name ++ } ++ -re -wrap "exited with code.*" { ++ untested "failed at $gdb_test_name" ++ } ++} ++ ++if { $supported == 0 } { ++ return -1 ++} ++ +proc do_test { has_libfoo has_libbar } { + global hex binfile_lib2 binfile_lib1 gdb_prompt + set libbar_match "[string_to_regexp $binfile_lib2]" @@ -314,6 +334,7 @@ new file mode 100644 + gdb_test_no_output "set stop-on-solib-events 1" "setting stop-on-solib-events" + + gdb_run_cmd ++ gdb_test "" "Wait for first prompt" + foreach l $solib_event_order { + incr pass + with_test_prefix "pass #$pass" { diff --git a/gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch b/gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch index 889aa48..3a5e2d4 100644 --- a/gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch +++ b/gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch @@ -73,7 +73,7 @@ new file mode 100644 +set test "rwatch aligned.var4" +if [istarget "s390*-*-*"] { + gdb_test $test {Target does not support this type of hardware watchpoint\.} -+ untested "s390* does not support hw read watchpoint" ++ untested "s390* does not support hw read watchpoint" + return +} +gdb_test $test "Hardware read watchpoint \[0-9\]+: aligned.var4" diff --git a/gdb-rhbz1350436-type-printers-error.patch b/gdb-rhbz1350436-type-printers-error.patch index 77aab65..feb95aa 100644 --- a/gdb-rhbz1350436-type-printers-error.patch +++ b/gdb-rhbz1350436-type-printers-error.patch @@ -42,22 +42,24 @@ diff --git a/gdb/testsuite/gdb.python/py-typeprint.exp b/gdb/testsuite/gdb.pytho 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 @@ +@@ -15,8 +15,7 @@ import gdb +- -class Recognizer(object): +class StringRecognizer(object): def __init__(self): self.enabled = True -@@ -30,6 +30,26 @@ class StringTypePrinter(object): +@@ -32,7 +31,27 @@ class StringTypePrinter(object): self.enabled = True def instantiate(self): - return Recognizer() + return StringRecognizer() + gdb.type_printers.append(StringTypePrinter()) + +class OtherRecognizer(object): diff --git a/gdb-rhbz1398387-tab-crash-test.patch b/gdb-rhbz1398387-tab-crash-test.patch index ad0abe6..b3c276e 100644 --- a/gdb-rhbz1398387-tab-crash-test.patch +++ b/gdb-rhbz1398387-tab-crash-test.patch @@ -428,7 +428,7 @@ new file mode 100644 + +if { ![istarget x86_64-*-* ] || ![is_lp64_target] } { + return -+} ++} + +standard_testfile + diff --git a/gdb-rhbz1976887-field-location-kind.patch b/gdb-rhbz1976887-field-location-kind.patch new file mode 100644 index 0000000..7293ff6 --- /dev/null +++ b/gdb-rhbz1976887-field-location-kind.patch @@ -0,0 +1,30 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Alexandra=20H=C3=A1jkov=C3=A1?= +Date: Wed, 29 Sep 2021 10:58:50 +0200 +Subject: gdb-rhbz1976887-field-location-kind.patch + +;;Backport upstream patch which fixes internal-error: Unexpected +;;type field location kind (RHBZ 1976887). + +gdbtypes.c: Add the case for FIELD_LOC_KIND_DWARF_BLOCK + +The case for FIELD_LOC_KIND_DWARF_BLOCK was missing for +switch TYPE_FIELD_LOC_KIND. Thas caused an internal-error +under some circumstances. + +Fixes bug 28030. + +diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c +--- a/gdb/gdbtypes.c ++++ b/gdb/gdbtypes.c +@@ -5571,6 +5571,10 @@ copy_type_recursive (struct objfile *objfile, + xstrdup (TYPE_FIELD_STATIC_PHYSNAME (type, + i))); + break; ++ case FIELD_LOC_KIND_DWARF_BLOCK: ++ SET_FIELD_DWARF_BLOCK (new_type->field (i), ++ TYPE_FIELD_DWARF_BLOCK (type, i)); ++ break; + default: + internal_error (__FILE__, __LINE__, + _("Unexpected type field location kind: %d"), diff --git a/gdb-rhbz2012976-paper-over-fortran-lex-problems.patch b/gdb-rhbz2012976-paper-over-fortran-lex-problems.patch new file mode 100644 index 0000000..7f21dd7 --- /dev/null +++ b/gdb-rhbz2012976-paper-over-fortran-lex-problems.patch @@ -0,0 +1,185 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Kevin Buettner +Date: Mon, 11 Oct 2021 11:22:04 -0700 +Subject: gdb-rhbz2012976-paper-over-fortran-lex-problems.patch + +;; Backport gdb.fortran testsuite changes in order to avoid Fortran +;; lexical analyzer bug. + +[gdb/testsuite] Fix FAIL in gdb.mi/mi-var-child-f.exp + +When running test-case gdb.mi/mi-var-child-f.exp on openSUSE Tumbleweed +(with glibc 2.34) I run into: +... +(gdb) ^M +PASS: gdb.mi/mi-var-child-f.exp: mi runto prog_array +Expecting: ^(-var-create array \* array[^M +]+)?(\^done,name="array",numchild="[0-9]+",value=".*",type=.*,has_more="0"[^M +]+[(]gdb[)] ^M +[ ]*) +-var-create array * array^M +&"Attempt to use a type name as an expression.\n"^M +^error,msg="-var-create: unable to create variable object"^M +(gdb) ^M +FAIL: gdb.mi/mi-var-child-f.exp: create local variable array (unexpected output) +... + +The problem is that the name array is used both: +- as the name for a local variable +- as the name of a type in glibc, in file malloc/dynarray-skeleton.c, as included + by nss/nss_files/files-hosts.c. + +Fix this by ignoring the shared lib symbols. + +Likewise in a couple of other fortran tests. + +Tested on x86_64-linux. + +diff --git a/gdb/testsuite/gdb.fortran/allocated.exp b/gdb/testsuite/gdb.fortran/allocated.exp +--- a/gdb/testsuite/gdb.fortran/allocated.exp ++++ b/gdb/testsuite/gdb.fortran/allocated.exp +@@ -25,11 +25,17 @@ if {[prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \ + return -1 + } + ++# Avoid shared lib symbols. ++gdb_test_no_output "set auto-solib-add off" ++ + if ![fortran_runto_main] { + untested "could not run to main" + return -1 + } + ++# Avoid libc symbols, in particular the 'array' type. ++gdb_test_no_output "nosharedlibrary" ++ + # Set all the breakpoints. + for { set i 1 } { $i < 6 } { incr i } { + gdb_breakpoint [gdb_get_line_number "Breakpoint $i"] +diff --git a/gdb/testsuite/gdb.fortran/array-slices-bad.exp b/gdb/testsuite/gdb.fortran/array-slices-bad.exp +--- a/gdb/testsuite/gdb.fortran/array-slices-bad.exp ++++ b/gdb/testsuite/gdb.fortran/array-slices-bad.exp +@@ -25,11 +25,17 @@ if {[prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \ + return -1 + } + ++# Avoid shared lib symbols. ++gdb_test_no_output "set auto-solib-add off" ++ + if ![fortran_runto_main] { + untested "could not run to main" + return -1 + } + ++# Avoid libc symbols, in particular the 'array' type. ++gdb_test_no_output "nosharedlibrary" ++ + # 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"] +diff --git a/gdb/testsuite/gdb.fortran/array-slices-sub-slices.exp b/gdb/testsuite/gdb.fortran/array-slices-sub-slices.exp +--- a/gdb/testsuite/gdb.fortran/array-slices-sub-slices.exp ++++ b/gdb/testsuite/gdb.fortran/array-slices-sub-slices.exp +@@ -25,11 +25,17 @@ if {[prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \ + return -1 + } + ++# Avoid shared lib symbols. ++gdb_test_no_output "set auto-solib-add off" ++ + if ![fortran_runto_main] { + untested "could not run to main" + return -1 + } + ++# Avoid libc symbols, in particular the 'array' type. ++gdb_test_no_output "nosharedlibrary" ++ + # 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"] +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 +@@ -55,11 +55,17 @@ proc run_test { repack } { + + clean_restart ${binfile} + ++ # Avoid shared lib symbols. ++ gdb_test_no_output "set auto-solib-add off" ++ + if ![fortran_runto_main] { + untested "could not run to main" + return -1 + } + ++ # Avoid libc symbols, in particular the 'array' type. ++ gdb_test_no_output "nosharedlibrary" ++ + gdb_test_no_output "set fortran repack-array-slices $repack" + + # gdb_breakpoint [gdb_get_line_number "Display Message Breakpoint"] +diff --git a/gdb/testsuite/gdb.fortran/lbound-ubound.exp b/gdb/testsuite/gdb.fortran/lbound-ubound.exp +--- a/gdb/testsuite/gdb.fortran/lbound-ubound.exp ++++ b/gdb/testsuite/gdb.fortran/lbound-ubound.exp +@@ -25,12 +25,17 @@ if {[prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \ + return -1 + } + ++# Avoid shared lib symbols. ++gdb_test_no_output "set auto-solib-add off" + + if ![fortran_runto_main] { + untested "could not run to main" + return -1 + } + ++# Avoid libc symbols, in particular the 'array' type. ++gdb_test_no_output "nosharedlibrary" ++ + gdb_breakpoint [gdb_get_line_number "Test Breakpoint"] + gdb_breakpoint [gdb_get_line_number "Final Breakpoint"] + +diff --git a/gdb/testsuite/gdb.fortran/subarray.exp b/gdb/testsuite/gdb.fortran/subarray.exp +--- a/gdb/testsuite/gdb.fortran/subarray.exp ++++ b/gdb/testsuite/gdb.fortran/subarray.exp +@@ -27,16 +27,17 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug f90}]} { + return -1 + } + +-gdb_exit +-gdb_start +-gdb_reinitialize_dir $srcdir/$subdir +-gdb_load ${binfile} ++# Avoid shared lib symbols. ++gdb_test_no_output "set auto-solib-add off" + + if ![fortran_runto_main] then { + perror "couldn't run to main" + continue + } + ++# Avoid libc symbols, in particular the 'array' type. ++gdb_test_no_output "nosharedlibrary" ++ + # Try to set breakpoint at the last write statement. + + set bp_location [gdb_get_line_number "str(:)"] +diff --git a/gdb/testsuite/gdb.mi/mi-var-child-f.exp b/gdb/testsuite/gdb.mi/mi-var-child-f.exp +--- a/gdb/testsuite/gdb.mi/mi-var-child-f.exp ++++ b/gdb/testsuite/gdb.mi/mi-var-child-f.exp +@@ -36,8 +36,14 @@ if {[gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \ + mi_gdb_reinitialize_dir $srcdir/$subdir + mi_gdb_load ${binfile} + ++# Avoid shared lib symbols. ++mi_gdb_test "-gdb-set auto-solib-add off" "\\^done" ++ + mi_runto prog_array + ++# Avoid libc symbols, in particular the 'array' type. ++mi_gdb_test "nosharedlibrary" ".*\\^done" ++ + mi_create_varobj "array" "array" "create local variable array" + + diff --git a/gdb-save-restore-file-offset-while-reading-notes-in-core-file.patch b/gdb-save-restore-file-offset-while-reading-notes-in-core-file.patch deleted file mode 100644 index 26d781c..0000000 --- a/gdb-save-restore-file-offset-while-reading-notes-in-core-file.patch +++ /dev/null @@ -1,88 +0,0 @@ -Save/restore file offset while reading notes in core file - -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. - - - ---- - bfd/elfcore.h | 7 +++++++ - 2 files changed, 12 insertions(+) - -diff --git a/bfd/elfcore.h b/bfd/elfcore.h -index 3015e582ef0..4e6383415f7 100644 ---- 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-support-dw-lle-start-end.patch b/gdb-support-dw-lle-start-end.patch deleted file mode 100644 index 8e11a58..0000000 --- a/gdb-support-dw-lle-start-end.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 80d1206d7fea6eb756183e2825abdfd0f00cd976 Mon Sep 17 00:00:00 2001 -From: Andreas Schwab -Date: Mon, 21 Jun 2021 11:38:23 +0200 -Subject: [PATCH] gdb: Support DW_LLE_start_end - -Without that it is impossible to debug on riscv64. - -gdb/ - PR symtab/27999 - * dwarf2/loc.c (decode_debug_loclists_addresses): Support - DW_LLE_start_end. - -diff --git a/gdb/dwarf2/loc.c b/gdb/dwarf2/loc.c -index b7e30e3cb4a..d57cdc165ba 100644 ---- a/gdb/dwarf2/loc.c -+++ b/gdb/dwarf2/loc.c -@@ -255,9 +255,27 @@ decode_debug_loclists_addresses (dwarf2_per_cu_data *per_cu, - *new_ptr = loc_ptr; - return DEBUG_LOC_OFFSET_PAIR; - -+ case DW_LLE_start_end: -+ if (loc_ptr + 2 * addr_size > buf_end) -+ return DEBUG_LOC_BUFFER_OVERFLOW; -+ -+ if (signed_addr_p) -+ *low = extract_signed_integer (loc_ptr, addr_size, byte_order); -+ else -+ *low = extract_unsigned_integer (loc_ptr, addr_size, byte_order); -+ -+ loc_ptr += addr_size; -+ if (signed_addr_p) -+ *high = extract_signed_integer (loc_ptr, addr_size, byte_order); -+ else -+ *high = extract_unsigned_integer (loc_ptr, addr_size, byte_order); -+ -+ loc_ptr += addr_size; -+ *new_ptr = loc_ptr; -+ return DEBUG_LOC_START_END; -+ - /* Following cases are not supported yet. */ - case DW_LLE_startx_endx: -- case DW_LLE_start_end: - case DW_LLE_default_location: - default: - return DEBUG_LOC_INVALID_ENTRY; diff --git a/gdb-symtab-add-call_site_eq-and-call_site_hash.patch b/gdb-symtab-add-call_site_eq-and-call_site_hash.patch new file mode 100644 index 0000000..21c7d0f --- /dev/null +++ b/gdb-symtab-add-call_site_eq-and-call_site_hash.patch @@ -0,0 +1,110 @@ +[gdb/symtab] Add call_site_eq and call_site_hash + +In commit b4c919f7525 "[gdb/symtab] Fix htab_find_slot call in +read_call_site_scope" , I removed the comment: +... +It must be the first field as we overload core_addr_hash and core_addr_eq for +it. +... +for field pc of struct call_site. + +However, this was not tested, and when indeed moving field pc to the second +location, we run into a testsuite failure in gdb.trace/entry-values.exp. + +This is caused by core_addr_eq (the eq_f function for the htab) being +called with a pointer to the pc field (as passed into htab_find_slot) and a +pointer to a hash table element. Now that pc is no longer the first field, +the pointer to hash table element no longer points to the pc field. + +This could be fixed by simply reinstating the comment, but we're trying to +get rid of this kind of tricks that make refactoring more difficult. + +Instead, fix this by: +- reverting commit b4c919f7525, apart from the comment removal, such that + we're passing a pointer to element to htab_find_slot +- updating the htab_find_slot call in compunit_symtab::find_call_site + in a similar manner +- adding a call_site_eq and call_site_hash, and using these in the hash table + instead of core_addr_eq and core_addr_hash. + +Tested on x86_64-linux, both with and without a trigger patch that moves pc to +the second location in struct call_site. + +--- + gdb/dwarf2/read.c | 7 ++++--- + gdb/gdbtypes.h | 15 +++++++++++++++ + gdb/symtab.c | 5 ++++- + 3 files changed, 23 insertions(+), 4 deletions(-) + +diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c +index d3742bbce8c..7def1e246c4 100644 +--- a/gdb/dwarf2/read.c ++++ b/gdb/dwarf2/read.c +@@ -13287,7 +13287,7 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu) + struct gdbarch *gdbarch = objfile->arch (); + CORE_ADDR pc, baseaddr; + struct attribute *attr; +- struct call_site *call_site; ++ struct call_site *call_site, call_site_local; + void **slot; + int nparams; + struct die_info *child_die; +@@ -13312,10 +13312,11 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu) + pc = gdbarch_adjust_dwarf2_addr (gdbarch, pc); + + if (cu->call_site_htab == NULL) +- cu->call_site_htab = htab_create_alloc_ex (16, core_addr_hash, core_addr_eq, ++ cu->call_site_htab = htab_create_alloc_ex (16, call_site_hash, call_site_eq, + NULL, &objfile->objfile_obstack, + hashtab_obstack_allocate, NULL); +- slot = htab_find_slot (cu->call_site_htab, &pc, INSERT); ++ call_site_local.pc = pc; ++ slot = htab_find_slot (cu->call_site_htab, &call_site_local, INSERT); + if (*slot != NULL) + { + complaint (_("Duplicate PC %s for DW_TAG_call_site " +diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h +index f2e077c70a2..77d1e66a6b1 100644 +--- a/gdb/gdbtypes.h ++++ b/gdb/gdbtypes.h +@@ -1806,6 +1806,21 @@ struct call_site + struct call_site_parameter parameter[1]; + }; + ++static inline int ++call_site_eq (const void *a_, const void *b_) ++{ ++ const struct call_site *a = (const call_site *)a_; ++ const struct call_site *b = (const call_site *)b_; ++ return core_addr_eq (&a->pc, &b->pc); ++} ++ ++static inline hashval_t ++call_site_hash (const void *a_) ++{ ++ const struct call_site *a = (const call_site *)a_; ++ return core_addr_hash (&a->pc); ++} ++ + /* The type-specific info for TYPE_CODE_FIXED_POINT types. */ + + struct fixed_point_type_info +diff --git a/gdb/symtab.c b/gdb/symtab.c +index 1d30c8fc7a8..fe430edadb2 100644 +--- a/gdb/symtab.c ++++ b/gdb/symtab.c +@@ -334,10 +334,13 @@ search_domain_name (enum search_domain e) + call_site * + compunit_symtab::find_call_site (CORE_ADDR pc) const + { ++ struct call_site call_site_local; + if (m_call_site_htab == nullptr) + return nullptr; + +- void **slot = htab_find_slot (m_call_site_htab, &pc, NO_INSERT); ++ call_site_local.pc = pc; ++ void **slot ++ = htab_find_slot (m_call_site_htab, &call_site_local, NO_INSERT); + if (slot == nullptr) + return nullptr; + diff --git a/gdb-symtab-c-ify-call_site.patch b/gdb-symtab-c-ify-call_site.patch new file mode 100644 index 0000000..2620548 --- /dev/null +++ b/gdb-symtab-c-ify-call_site.patch @@ -0,0 +1,317 @@ +[gdb/symtab] C++-ify call_site + +- add constructor +- add member function call_site::pc () + +Tested on x86_64-linux. + +Co-Authored-By: Tom de Vries + +--- + gdb/dwarf2/frame-tailcall.c | 4 +-- + gdb/dwarf2/loc.c | 18 ++++++------ + gdb/dwarf2/read.c | 27 +++++++++--------- + gdb/gdbtypes.c | 9 ++++++ + gdb/gdbtypes.h | 67 +++++++++++++++++++++++++++++---------------- + gdb/symtab.c | 3 +- + 6 files changed, 77 insertions(+), 51 deletions(-) + +diff --git a/gdb/dwarf2/frame-tailcall.c b/gdb/dwarf2/frame-tailcall.c +index f112b4ecca4..9fe498b0924 100644 +--- a/gdb/dwarf2/frame-tailcall.c ++++ b/gdb/dwarf2/frame-tailcall.c +@@ -240,14 +240,14 @@ pretend_pc (struct frame_info *this_frame, struct tailcall_cache *cache) + gdb_assert (next_levels >= 0); + + if (next_levels < chain->callees) +- return chain->call_site[chain->length - next_levels - 1]->pc; ++ return chain->call_site[chain->length - next_levels - 1]->pc (); + next_levels -= chain->callees; + + /* Otherwise CHAIN->CALLEES are already covered by CHAIN->CALLERS. */ + if (chain->callees != chain->length) + { + if (next_levels < chain->callers) +- return chain->call_site[chain->callers - next_levels - 1]->pc; ++ return chain->call_site[chain->callers - next_levels - 1]->pc (); + next_levels -= chain->callers; + } + +diff --git a/gdb/dwarf2/loc.c b/gdb/dwarf2/loc.c +index d57cdc165ba..83b5fe1ac88 100644 +--- a/gdb/dwarf2/loc.c ++++ b/gdb/dwarf2/loc.c +@@ -920,10 +920,10 @@ call_site_to_target_addr (struct gdbarch *call_site_gdbarch, + { + struct bound_minimal_symbol msym; + +- msym = lookup_minimal_symbol_by_pc (call_site->pc - 1); ++ msym = lookup_minimal_symbol_by_pc (call_site->pc () - 1); + throw_error (NO_ENTRY_VALUE_ERROR, + _("DW_AT_call_target is not specified at %s in %s"), +- paddress (call_site_gdbarch, call_site->pc), ++ paddress (call_site_gdbarch, call_site->pc ()), + (msym.minsym == NULL ? "???" + : msym.minsym->print_name ())); + +@@ -932,12 +932,12 @@ call_site_to_target_addr (struct gdbarch *call_site_gdbarch, + { + struct bound_minimal_symbol msym; + +- msym = lookup_minimal_symbol_by_pc (call_site->pc - 1); ++ msym = lookup_minimal_symbol_by_pc (call_site->pc () - 1); + throw_error (NO_ENTRY_VALUE_ERROR, + _("DW_AT_call_target DWARF block resolving " + "requires known frame which is currently not " + "available at %s in %s"), +- paddress (call_site_gdbarch, call_site->pc), ++ paddress (call_site_gdbarch, call_site->pc ()), + (msym.minsym == NULL ? "???" + : msym.minsym->print_name ())); + +@@ -966,11 +966,11 @@ call_site_to_target_addr (struct gdbarch *call_site_gdbarch, + msym = lookup_minimal_symbol (physname, NULL, NULL); + if (msym.minsym == NULL) + { +- msym = lookup_minimal_symbol_by_pc (call_site->pc - 1); ++ msym = lookup_minimal_symbol_by_pc (call_site->pc () - 1); + throw_error (NO_ENTRY_VALUE_ERROR, + _("Cannot find function \"%s\" for a call site target " + "at %s in %s"), +- physname, paddress (call_site_gdbarch, call_site->pc), ++ physname, paddress (call_site_gdbarch, call_site->pc ()), + (msym.minsym == NULL ? "???" + : msym.minsym->print_name ())); + +@@ -1076,7 +1076,7 @@ func_verify_no_selftailcall (struct gdbarch *gdbarch, CORE_ADDR verify_addr) + static void + tailcall_dump (struct gdbarch *gdbarch, const struct call_site *call_site) + { +- CORE_ADDR addr = call_site->pc; ++ CORE_ADDR addr = call_site->pc (); + struct bound_minimal_symbol msym = lookup_minimal_symbol_by_pc (addr - 1); + + fprintf_unfiltered (gdb_stdlog, " %s(%s)", paddress (gdbarch, addr), +@@ -1252,7 +1252,7 @@ call_site_find_chain_1 (struct gdbarch *gdbarch, CORE_ADDR caller_pc, + + if (target_call_site) + { +- if (addr_hash.insert (target_call_site->pc).second) ++ if (addr_hash.insert (target_call_site->pc ()).second) + { + /* Successfully entered TARGET_CALL_SITE. */ + +@@ -1271,7 +1271,7 @@ call_site_find_chain_1 (struct gdbarch *gdbarch, CORE_ADDR caller_pc, + call_site = chain.back (); + chain.pop_back (); + +- size_t removed = addr_hash.erase (call_site->pc); ++ size_t removed = addr_hash.erase (call_site->pc ()); + gdb_assert (removed == 1); + + target_call_site = call_site->tail_call_next; +diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c +index 7def1e246c4..59ce3cf2b45 100644 +--- a/gdb/dwarf2/read.c ++++ b/gdb/dwarf2/read.c +@@ -13287,7 +13287,6 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu) + struct gdbarch *gdbarch = objfile->arch (); + CORE_ADDR pc, baseaddr; + struct attribute *attr; +- struct call_site *call_site, call_site_local; + void **slot; + int nparams; + struct die_info *child_die; +@@ -13312,10 +13311,11 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu) + pc = gdbarch_adjust_dwarf2_addr (gdbarch, pc); + + if (cu->call_site_htab == NULL) +- cu->call_site_htab = htab_create_alloc_ex (16, call_site_hash, call_site_eq, +- NULL, &objfile->objfile_obstack, ++ cu->call_site_htab = htab_create_alloc_ex (16, call_site::hash, ++ call_site::eq, NULL, ++ &objfile->objfile_obstack, + hashtab_obstack_allocate, NULL); +- call_site_local.pc = pc; ++ struct call_site call_site_local (pc, nullptr, nullptr); + slot = htab_find_slot (cu->call_site_htab, &call_site_local, INSERT); + if (*slot != NULL) + { +@@ -13345,14 +13345,16 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu) + nparams++; + } + +- call_site +- = ((struct call_site *) +- obstack_alloc (&objfile->objfile_obstack, +- sizeof (*call_site) +- + (sizeof (*call_site->parameter) * (nparams - 1)))); ++ struct call_site *call_site ++ = new (XOBNEWVAR (&objfile->objfile_obstack, ++ struct call_site, ++ sizeof (*call_site) + sizeof (call_site->parameter[0]) * nparams)) ++ struct call_site (pc, cu->per_cu, per_objfile); + *slot = call_site; +- memset (call_site, 0, sizeof (*call_site) - sizeof (*call_site->parameter)); +- call_site->pc = pc; ++ ++ /* We never call the destructor of call_site, so we must ensure it is ++ trivially destructible. */ ++ gdb_static_assert(std::is_trivially_destructible::value); + + if (dwarf2_flag_true_p (die, DW_AT_call_tail_call, cu) + || dwarf2_flag_true_p (die, DW_AT_GNU_tail_call, cu)) +@@ -13473,9 +13475,6 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu) + "block nor reference, for DIE %s [in module %s]"), + sect_offset_str (die->sect_off), objfile_name (objfile)); + +- call_site->per_cu = cu->per_cu; +- call_site->per_objfile = per_objfile; +- + for (child_die = die->child; + child_die && child_die->tag; + child_die = child_die->sibling) +diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c +index 05ce646bc59..1b3ed1b32ed 100644 +--- a/gdb/gdbtypes.c ++++ b/gdb/gdbtypes.c +@@ -37,6 +37,7 @@ + #include "cp-support.h" + #include "bcache.h" + #include "dwarf2/loc.h" ++#include "dwarf2/read.h" + #include "gdbcore.h" + #include "floatformat.h" + #include "f-lang.h" +@@ -6301,6 +6302,14 @@ objfile_type (struct objfile *objfile) + return objfile_type; + } + ++/* See gdbtypes.h. */ ++ ++CORE_ADDR ++call_site::pc () const ++{ ++ return m_pc; ++} ++ + void _initialize_gdbtypes (); + void + _initialize_gdbtypes () +diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h +index 77d1e66a6b1..a071188ffa1 100644 +--- a/gdb/gdbtypes.h ++++ b/gdb/gdbtypes.h +@@ -1775,52 +1775,71 @@ struct call_site_parameter + + struct call_site + { +- /* Address of the first instruction after this call. */ +- +- CORE_ADDR pc; ++ call_site (CORE_ADDR pc, dwarf2_per_cu_data *per_cu, ++ dwarf2_per_objfile *per_objfile) ++ : per_cu (per_cu), per_objfile (per_objfile), m_pc (pc) ++ {} ++ ++ static int ++ eq (const call_site *a, const call_site *b) ++ { ++ return core_addr_eq (&a->m_pc, &b->m_pc); ++ } ++ ++ static hashval_t ++ hash (const call_site *a) ++ { ++ return core_addr_hash (&a->m_pc); ++ } ++ ++ static int ++ eq (const void *a, const void *b) ++ { ++ return eq ((const call_site *)a, (const call_site *)b); ++ } ++ ++ static hashval_t ++ hash (const void *a) ++ { ++ return hash ((const call_site *)a); ++ } ++ ++ /* Return the address of the first instruction after this call. */ ++ ++ CORE_ADDR pc () const; + + /* * List successor with head in FUNC_TYPE.TAIL_CALL_LIST. */ + +- struct call_site *tail_call_next; ++ struct call_site *tail_call_next = nullptr; + + /* * Describe DW_AT_call_target. Missing attribute uses + FIELD_LOC_KIND_DWARF_BLOCK with FIELD_DWARF_BLOCK == NULL. */ + +- struct call_site_target target; ++ struct call_site_target target {}; + + /* * Size of the PARAMETER array. */ + +- unsigned parameter_count; ++ unsigned parameter_count = 0; + + /* * CU of the function where the call is located. It gets used + for DWARF blocks execution in the parameter array below. */ + +- dwarf2_per_cu_data *per_cu; ++ dwarf2_per_cu_data *const per_cu = nullptr; + + /* objfile of the function where the call is located. */ + +- dwarf2_per_objfile *per_objfile; ++ dwarf2_per_objfile *const per_objfile = nullptr; + ++ private: ++ /* Address of the first instruction after this call. */ ++ const CORE_ADDR m_pc; ++ ++ public: + /* * Describe DW_TAG_call_site's DW_TAG_formal_parameter. */ + +- struct call_site_parameter parameter[1]; ++ struct call_site_parameter parameter[]; + }; + +-static inline int +-call_site_eq (const void *a_, const void *b_) +-{ +- const struct call_site *a = (const call_site *)a_; +- const struct call_site *b = (const call_site *)b_; +- return core_addr_eq (&a->pc, &b->pc); +-} +- +-static inline hashval_t +-call_site_hash (const void *a_) +-{ +- const struct call_site *a = (const call_site *)a_; +- return core_addr_hash (&a->pc); +-} +- + /* The type-specific info for TYPE_CODE_FIXED_POINT types. */ + + struct fixed_point_type_info +diff --git a/gdb/symtab.c b/gdb/symtab.c +index fe430edadb2..14cc2b5bd8d 100644 +--- a/gdb/symtab.c ++++ b/gdb/symtab.c +@@ -334,11 +334,10 @@ search_domain_name (enum search_domain e) + call_site * + compunit_symtab::find_call_site (CORE_ADDR pc) const + { +- struct call_site call_site_local; + if (m_call_site_htab == nullptr) + return nullptr; + +- call_site_local.pc = pc; ++ struct call_site call_site_local (pc, nullptr, nullptr); + void **slot + = htab_find_slot (m_call_site_htab, &call_site_local, NO_INSERT); + if (slot == nullptr) diff --git a/gdb-symtab-fix-htab_find_slot-call-in-read_call_site_scope.patch b/gdb-symtab-fix-htab_find_slot-call-in-read_call_site_scope.patch new file mode 100644 index 0000000..0a652d6 --- /dev/null +++ b/gdb-symtab-fix-htab_find_slot-call-in-read_call_site_scope.patch @@ -0,0 +1,68 @@ +[gdb/symtab] Fix htab_find_slot call in read_call_site_scope + +In read_call_site_scope we have: +... + call_site_local.pc = pc; + slot = htab_find_slot (cu->call_site_htab, &call_site_local, INSERT); +... + +The call passes a call_site pointer as element. OTOH, the hashtab is created +using hash_f == core_addr_hash and eq_f == core_addr_eq, so the element +will be accessed through a CORE_ADDR pointer. + +This is not wrong (at least in C), given that pc is the first field in +call_site. + +Nevertheless, as in call_site_for_pc, make the htab_find_slot call match the +used hash_f and eq_f by using &pc instead: +... + slot = htab_find_slot (cu->call_site_htab, &pc, INSERT); +... + +Tested on x86_64-linux. + +Co-Authored-By: Tom de Vries + +--- + gdb/dwarf2/read.c | 5 ++--- + gdb/gdbtypes.h | 4 +--- + 2 files changed, 3 insertions(+), 6 deletions(-) + +diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c +index 0ce39eb9274..892d31dddf3 100644 +--- a/gdb/dwarf2/read.c ++++ b/gdb/dwarf2/read.c +@@ -13287,7 +13287,7 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu) + struct gdbarch *gdbarch = objfile->arch (); + CORE_ADDR pc, baseaddr; + struct attribute *attr; +- struct call_site *call_site, call_site_local; ++ struct call_site *call_site; + void **slot; + int nparams; + struct die_info *child_die; +@@ -13315,8 +13315,7 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu) + cu->call_site_htab = htab_create_alloc_ex (16, core_addr_hash, core_addr_eq, + NULL, &objfile->objfile_obstack, + hashtab_obstack_allocate, NULL); +- call_site_local.pc = pc; +- slot = htab_find_slot (cu->call_site_htab, &call_site_local, INSERT); ++ slot = htab_find_slot (cu->call_site_htab, &pc, INSERT); + if (*slot != NULL) + { + complaint (_("Duplicate PC %s for DW_TAG_call_site " +diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h +index 0cc00e74a20..f2e077c70a2 100644 +--- a/gdb/gdbtypes.h ++++ b/gdb/gdbtypes.h +@@ -1775,9 +1775,7 @@ struct call_site_parameter + + struct call_site + { +- /* * Address of the first instruction after this call. It must be +- the first field as we overload core_addr_hash and core_addr_eq +- for it. */ ++ /* Address of the first instruction after this call. */ + + CORE_ADDR pc; + diff --git a/gdb-symtab-fix-infinite-recursion-in-dwarf2_cu-get_builder-again.patch b/gdb-symtab-fix-infinite-recursion-in-dwarf2_cu-get_builder-again.patch deleted file mode 100644 index 1ca6fb5..0000000 --- a/gdb-symtab-fix-infinite-recursion-in-dwarf2_cu-get_builder-again.patch +++ /dev/null @@ -1,167 +0,0 @@ -[gdb/symtab] Fix infinite recursion in dwarf2_cu::get_builder(), again - -This is another attempt at fixing the problem described in commit 4cf88725da1 -"[gdb/symtab] Fix infinite recursion in dwarf2_cu::get_builder()", which was -reverted in commit 3db19b2d724. - -First off, some context. - -A DWARF CU can be viewed as a symbol table: toplevel children of a CU DIE -represent symbol table entries for that CU. Furthermore, there is a -hierarchy: a symbol table entry such as a function itself has a symbol table -containing parameters and local variables. - -The dwarf reader maintains a notion of current symbol table (that is: the -symbol table a new symbol needs to be entered into) in dwarf2_cu member -list_in_scope. - -A problem then presents itself when reading inter-CU references: -- a new symbol read from a CU B needs to be entered into the symbol table of - another CU A. -- the notion of current symbol table is tracked on a per-CU basis. -This is addressed in inherit_abstract_dies by temporarily overwriting the -list_in_scope for CU B with the one for CU A. - -The current symbol table is one aspect of the current dwarf reader context -that is tracked, but there are more, f.i. ones that are tracked via the -dwarf2_cu member m_builder, f.i. m_builder->m_local_using_directives. - -A similar problem exists in relation to inter-CU references, but a different -solution was chosen: -- to keep track of an ancestor field in dwarf2_cu, which is updated - when traversing inter-CU references, and -- to use the ancestor field in dwarf2_cu::get_builder to return the m_builder - in scope. - -There is no actual concept of a CU having an ancestor, it just marks the most -recent CU from which a CU was inter-CU-referenced. Consequently, when -following inter-CU references from a CU A to another CU B and back to CU A, -the ancestors form a cycle, which causes dwarf2_cu::get_builder to hang or -segfault, as reported in PR26327. - -ISTM that the ancestor implementation is confusing and fragile, and should -go. Furthermore, it seems that keeping track of the m_builder in scope can be -handled simply with a per-objfile variable. - -Fix the hang / segfault by: -- keeping track of the m_builder in scope using a new variable - per_obj->sym_cu, and -- using it in dwarf2_cu::get_builder. - -Tested on x86_64-linux (openSUSE Leap 15.2), no regressions for config: -- using default gcc version 7.5.0 - (with 5 unexpected FAILs) -- gcc 10.3.0 and target board - unix/-flto/-O0/-flto-partition=none/-ffat-lto-objects - (with 1000 unexpected FAILs) - -gdb/ChangeLog: - -2021-06-16 Tom de Vries - - PR symtab/26327 - * dwarf2/cu.h (dwarf2_cu::ancestor): Remove. - (dwarf2_cu::get_builder): Declare and move ... - * dwarf2/cu.c (dwarf2_cu::get_builder): ... here. Use sym_cu instead - of ancestor. Assert return value is non-null. - * dwarf2/read.c (read_file_scope): Set per_objfile->sym_cu. - (follow_die_offset, follow_die_sig_1): Remove setting of ancestor. - (dwarf2_per_objfile): Add sym_cu field. - ---- - gdb/dwarf2/read.c | 24 +++++++++--------------- - gdb/dwarf2/read.h | 3 +++ - 2 files changed, 12 insertions(+), 15 deletions(-) - -diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c -index 05a50515ce4..b81902b97d7 100644 ---- a/gdb/dwarf2/read.c -+++ b/gdb/dwarf2/read.c -@@ -595,10 +595,6 @@ struct dwarf2_cu - - struct partial_die_info *find_partial_die (sect_offset sect_off); - -- /* If this CU was inherited by another CU (via specification, -- abstract_origin, etc), this is the ancestor CU. */ -- dwarf2_cu *ancestor; -- - /* Get the buildsym_compunit for this CU. */ - buildsym_compunit *get_builder () - { -@@ -606,11 +602,10 @@ struct dwarf2_cu - if (m_builder != nullptr) - return m_builder.get (); - -- /* Otherwise, search ancestors for a valid builder. */ -- if (ancestor != nullptr) -- return ancestor->get_builder (); -+ if (per_objfile->sym_cu != nullptr) -+ return per_objfile->sym_cu->m_builder.get (); - -- return nullptr; -+ gdb_assert_not_reached (""); - } - }; - -@@ -11145,6 +11140,10 @@ read_file_scope (struct die_info *die, struct dwarf2_cu *cu) - - cu->start_symtab (fnd.name, fnd.comp_dir, lowpc); - -+ gdb_assert (per_objfile->sym_cu == nullptr); -+ scoped_restore restore_sym_cu -+ = make_scoped_restore (&per_objfile->sym_cu, cu); -+ - /* Decode line number information if present. We do this before - processing child DIEs, so that the line header table is available - for DW_AT_decl_file. */ -@@ -11160,6 +11159,7 @@ read_file_scope (struct die_info *die, struct dwarf2_cu *cu) - child_die = child_die->sibling; - } - } -+ per_objfile->sym_cu = nullptr; - - /* Decode macro information, if present. Dwarf 2 macro information - refers to information in the line number info statement program -@@ -22946,9 +22946,6 @@ follow_die_offset (sect_offset sect_off, int offset_in_dwz, - *ref_cu = target_cu; - temp_die.sect_off = sect_off; - -- if (target_cu != cu) -- target_cu->ancestor = cu; -- - return (struct die_info *) htab_find_with_hash (target_cu->die_hash, - &temp_die, - to_underlying (sect_off)); -@@ -23291,7 +23288,7 @@ follow_die_sig_1 (struct die_info *src_die, struct signatured_type *sig_type, - struct dwarf2_cu **ref_cu) - { - struct die_info temp_die; -- struct dwarf2_cu *sig_cu, *cu = *ref_cu; -+ struct dwarf2_cu *sig_cu; - struct die_info *die; - dwarf2_per_objfile *per_objfile = (*ref_cu)->per_objfile; - -@@ -23323,9 +23320,6 @@ follow_die_sig_1 (struct die_info *src_die, struct signatured_type *sig_type, - } - - *ref_cu = sig_cu; -- if (sig_cu != cu) -- sig_cu->ancestor = cu; -- - return die; - } - -diff --git a/gdb/dwarf2/read.h b/gdb/dwarf2/read.h -index fe5aab0e9a1..24ef1e3e366 100644 ---- a/gdb/dwarf2/read.h -+++ b/gdb/dwarf2/read.h -@@ -374,6 +374,9 @@ struct dwarf2_per_objfile - /* Table containing line_header indexed by offset and offset_in_dwz. */ - htab_up line_header_hash; - -+ /* The CU containing the m_builder in scope. */ -+ dwarf2_cu *sym_cu = nullptr; -+ - private: - /* Hold the corresponding compunit_symtab for each CU or TU. This - is indexed by dwarf2_per_cu_data::index. A NULL value means diff --git a/gdb-symtab-fix-language-of-frame-without-debug-info.patch b/gdb-symtab-fix-language-of-frame-without-debug-info.patch deleted file mode 100644 index 776ac80..0000000 --- a/gdb-symtab-fix-language-of-frame-without-debug-info.patch +++ /dev/null @@ -1,248 +0,0 @@ -[gdb/symtab] Fix language of frame without debug info - -On openSUSE Leap 15.2, I run into this FAIL with target board readnow and -test-case gdb.dwarf2/dw2-align.exp: -... -(gdb) set lang c++^M -Warning: the current language does not match this frame.^M -(gdb) FAIL: gdb.dwarf2/dw2-align.exp: set lang c++ -... - -Adding some extra debugging shows that the current language differs without -and with readnow: -... - Breakpoint 1, 0x00000000004004ab in main ()^M - (gdb) show lang^M --The current source language is "auto; currently c".^M -+The current source language is "auto; currently asm".^M -... - -This is explained by find_pc_compunit_symtab (0x4004ab) called from -select_frame, which: -- without readnow: returns NULL, and -- with readnow: returns the symtab for the CU crtn.S, wich has language - "MIPS assembler". - -In the former case, the symtab for crtn.S is not expanded, and -find_pc_compunit_symtab hits the default NULL return. In the latter case, the -symtab for crtn.S is expanded, and the "best match" loop in -find_pc_compunit_symtab returns that symtab as its best match. - -The GLOBAL_BLOCK for crtn.S has these outer limits of the address range: -... -(gdb) p /x b.startaddr -$6 = 0x4003c2 -(gdb) p /x b.endaddr -$7 = 0x40053d -... -and 0x4004ab indeed fits in that range, which explains why the CU is -considered a match. - -However, the actual address ranges for the CU are: -... - 00000040 ffffffffffffffff 0000000000000000 (base address) - 00000040 00000000004003c2 00000000004003c7 - 00000040 0000000000400538 000000000040053d - 00000040 -... -which confirms that the CU should not be considered a match. - -The problem is that the "best match" loop is based on the assumption that a -symtab with a better match will be found, but in this case we don't find a -better match because there's no debug info describing main. - -Fix this by preferring to use the addres map in the "best match" loop, which -will accurately tell us that addrmap_find (bv.map, 0x4004ab) == NULL. - -Tested on x86_64-linux (that is, openSUSE Leap 15.2), with and without -readnow. In the case of a readnow run, brings down the number of unexpected -failures from 66 to 38. - -The FAIL does not reproduce on f.i. Ubuntu 18.04.5, because there the exec -does not contain debug info for crtn.S. The dwarf assembly test-case mimics -the scenario described above, and reproduces the FAIL with and without --readnow, for both mentioned OS configurations. - -Also fixes PR25980 - "Overlapping Dwarf Compile Units with non-overlapping -subranges gives incorrect line information". - -gdb/ChangeLog: - -2020-10-28 Tom de Vries - - PR symtab/26772 - * symtab.c (find_pc_sect_compunit_symtab): In case there's an address - map, check it in the "best match" loop. - -gdb/testsuite/ChangeLog: - -2020-10-28 Tom de Vries - - PR symtab/26772 - * gdb.dwarf2/dw2-ranges-overlap.c: New test. - * gdb.dwarf2/dw2-ranges-overlap.exp: New file. ---- - gdb/symtab.c | 8 ++ - gdb/testsuite/gdb.dwarf2/dw2-ranges-overlap.c | 36 ++++++++ - .../gdb.dwarf2/dw2-ranges-overlap.exp | 87 +++++++++++++++++++ - 5 files changed, 143 insertions(+) - create mode 100644 gdb/testsuite/gdb.dwarf2/dw2-ranges-overlap.c - create mode 100644 gdb/testsuite/gdb.dwarf2/dw2-ranges-overlap.exp - -diff --git a/gdb/symtab.c b/gdb/symtab.c -index f6e24758009..b7aae1bed14 100644 ---- a/gdb/symtab.c -+++ b/gdb/symtab.c -@@ -2923,6 +2923,14 @@ find_pc_sect_compunit_symtab (CORE_ADDR pc, struct obj_section *section) - if (!in_range_p) - continue; - -+ if (BLOCKVECTOR_MAP (bv)) -+ { -+ if (addrmap_find (BLOCKVECTOR_MAP (bv), pc) == nullptr) -+ continue; -+ -+ return cust; -+ } -+ - CORE_ADDR range = end - start; - if (best_cust != nullptr - && range >= best_cust_range) -diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ranges-overlap.c b/gdb/testsuite/gdb.dwarf2/dw2-ranges-overlap.c -new file mode 100644 -index 00000000000..cbc4551e437 ---- /dev/null -+++ b/gdb/testsuite/gdb.dwarf2/dw2-ranges-overlap.c -@@ -0,0 +1,36 @@ -+/* -+ 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 . */ -+ -+int -+bar (int a) -+{ -+ asm ("bar_label: .globl bar_label"); -+ return a + 1; -+} -+ -+int -+foo (int a) -+{ -+ asm ("foo_label: .globl foo_label"); -+ return bar (a * 2) + 3; -+} -+ -+int -+main (void) -+{ -+ asm ("main_label: .globl main_label"); -+ return foo (5) + 1; -+} -diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ranges-overlap.exp b/gdb/testsuite/gdb.dwarf2/dw2-ranges-overlap.exp -new file mode 100644 -index 00000000000..59c10c8ae24 ---- /dev/null -+++ b/gdb/testsuite/gdb.dwarf2/dw2-ranges-overlap.exp -@@ -0,0 +1,87 @@ -+# 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 . -+load_lib dwarf.exp -+ -+# The function foo is encapsulated by two functions from CU -+# $srcfile (main and bar), but the debug info does not describe foo, so -+# foo should not be seen as part of CU $srcfile. -+# Run to foo, and check that the current language is the default auto/C. -+# If foo is considered part of CU $srcfile, the language will be auto/C++ -+# instead. -+ -+# This test can only be run on targets which support DWARF-2 and use gas. -+if {![dwarf2_support]} { -+ verbose "Skipping $gdb_test_file_name." -+ return 0 -+} -+ -+# The .c files use __attribute__. -+if [get_compiler_info] { -+ return -1 -+} -+if !$gcc_compiled { -+ verbose "Skipping $gdb_test_file_name." -+ return 0 -+} -+ -+standard_testfile .c -dw.S -+ -+set asm_file [standard_output_file $srcfile2] -+Dwarf::assemble $asm_file { -+ global srcdir subdir srcfile srcfile2 -+ declare_labels ranges_label -+ -+ # Find start address and length for our functions. -+ set main_func \ -+ [function_range main [list ${srcdir}/${subdir}/$srcfile]] -+ set foo_func \ -+ [function_range foo [list ${srcdir}/${subdir}/$srcfile]] -+ set bar_func \ -+ [function_range bar [list ${srcdir}/${subdir}/$srcfile]] -+ -+ cu {} { -+ compile_unit { -+ {language @DW_LANG_C_plus_plus} -+ {name $srcfile} -+ {ranges ${ranges_label} DW_FORM_sec_offset} -+ } { -+ subprogram { -+ {external 1 flag} -+ {name main} -+ } -+ } -+ } -+ -+ ranges {is_64 [is_64_target]} { -+ ranges_label: sequence { -+ {base [lindex $main_func 0]} -+ {range 0 [lindex $main_func 1]} -+ {base [lindex $bar_func 0]} -+ {range 0 [lindex $bar_func 1]} -+ } -+ } -+} -+ -+if { [prepare_for_testing "failed to prepare" ${testfile} \ -+ [list $srcfile $asm_file] {nodebug}] } { -+ return -1 -+} -+ -+if ![runto foo] { -+ return -1 -+} -+ -+gdb_test "show language" \ -+ "The current source language is \"auto; currently c\"\." --- -2.26.2 - diff --git a/gdb-symtab-read-cu-base-address-for-enqueued-cu.patch b/gdb-symtab-read-cu-base-address-for-enqueued-cu.patch deleted file mode 100644 index 382b267..0000000 --- a/gdb-symtab-read-cu-base-address-for-enqueued-cu.patch +++ /dev/null @@ -1,178 +0,0 @@ -[gdb/symtab] Read CU base address for enqueued CU - -Consider the test-case contained in this patch. It consists of -two CUs: -- cu1, containing a DW_TAG_variable DIE foo -- cu2, containing a DW_TAG_base_type DIE int -where the variable foo has type int, in other words, there's an inter-CU -reference. - -When expanding the symtab for cu1, expansion of the symtab for cu2 is -enqueued, and later processed by process_full_comp_unit. However, processing -of .debug_ranges fails because the range is specified relative to a base -address which is considered not to be present because -!cu->base_address.has_value (), and we run into this case in -dwarf2_ranges_process: -... - if (!base.has_value ()) - { - /* We have no valid base address for the ranges - data. */ - complaint (_("Invalid .debug_ranges data (no base address)")); - return 0; - } -... - -Fix this in process_full_comp_unit by setting cu->base_address. - -Tested on x86_64-linux. - -gdb/ChangeLog: - -2020-10-26 Tom de Vries - - * dwarf2/read.c (process_full_comp_unit): Call - dwarf2_find_base_address. - -gdb/testsuite/ChangeLog: - -2020-10-26 Tom de Vries - - * gdb.dwarf2/enqueued-cu-base-addr.exp: New file. ---- - gdb/dwarf2/read.c | 2 + - .../gdb.dwarf2/enqueued-cu-base-addr.exp | 112 ++++++++++++++++++ - 4 files changed, 123 insertions(+) - create mode 100644 gdb/testsuite/gdb.dwarf2/enqueued-cu-base-addr.exp - -diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c -index 436a116dc80..e1c528f44d2 100644 ---- a/gdb/dwarf2/read.c -+++ b/gdb/dwarf2/read.c -@@ -9929,6 +9929,8 @@ process_full_comp_unit (dwarf2_cu *cu, enum language pretend_language) - cu->language = pretend_language; - cu->language_defn = language_def (cu->language); - -+ dwarf2_find_base_address (cu->dies, cu); -+ - /* Do line number decoding in read_file_scope () */ - process_die (cu->dies, cu); - -diff --git a/gdb/testsuite/gdb.dwarf2/enqueued-cu-base-addr.exp b/gdb/testsuite/gdb.dwarf2/enqueued-cu-base-addr.exp -new file mode 100644 -index 00000000000..77fe6ff5e94 ---- /dev/null -+++ b/gdb/testsuite/gdb.dwarf2/enqueued-cu-base-addr.exp -@@ -0,0 +1,112 @@ -+# 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 . -+ -+# Check whether .debug_ranges is correctly read in during symtab expansion. -+ -+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 main.c .S -+ -+set executable ${testfile} -+set asm_file [standard_output_file ${srcfile2}] -+ -+# We need to know the size of integer types in order to write some of the -+# debugging info we'd like to generate. -+if [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] { -+ return -1 -+} -+ -+# Create the DWARF. -+Dwarf::assemble $asm_file { -+ global srcdir subdir srcfile -+ -+ declare_labels int_label -+ declare_labels ranges_label -+ -+ set main_func \ -+ [function_range main [list ${srcdir}/${subdir}/$srcfile]] -+ -+ cu {} { -+ compile_unit { -+ {language @DW_LANG_C_plus_plus} -+ {name "cu1"} -+ } { -+ DW_TAG_variable { -+ {name foo} -+ {type :$int_label} -+ {const_value 1 DW_FORM_sdata} -+ } -+ } -+ } -+ -+ cu {} { -+ compile_unit { -+ {language @DW_LANG_C_plus_plus} -+ {name "cu2"} -+ {ranges ${ranges_label} sec_offset} -+ {low_pc {[lindex $main_func 0]} DW_FORM_addr} -+ } { -+ int_label: base_type { -+ {byte_size 4 udata} -+ {encoding @DW_ATE_signed} -+ {name int} -+ } -+ } -+ } -+ -+ ranges {is_64 [is_64_target]} { -+ ranges_label: sequence { -+ {range 0 [lindex $main_func 1]} -+ } -+ } -+} -+ -+if { [prepare_for_testing "failed to prepare" ${testfile} \ -+ [list $srcfile $asm_file] {nodebug}] } { -+ return -1 -+} -+ -+clean_restart ${binfile} -+ -+# Expand cu1. This will enqueue cu2. -+gdb_test "ptype foo" "type = int" -+ -+# Now check that cu2 has an address range starting at main. -+set cu2_blockvector_re \ -+ [multi_line \ -+ "Symtab for file cu2 at $hex" \ -+ "Read from object file \[^\r\n\]*" \ -+ "Language: c\\+\\+" \ -+ "" \ -+ "Blockvector:" \ -+ "" \ -+ "block #000, \[^\r\n\]* in ($hex)..$hex" \ -+ ".*"] -+gdb_test_multiple "maint print symbols -objfile $binfile" "CU addr found" { -+ -re -wrap $cu2_blockvector_re { -+ set addr $expect_out(1,string) -+ if { $addr eq "0x0" } { -+ fail "$gdb_test_name (Found 0x0)" -+ } else { -+ gdb_test "info symbol $addr" "main in section .*" \ -+ $gdb_test_name -+ } -+ } -+} diff --git a/gdb-symtab-remove-compunit_call_site_htab.patch b/gdb-symtab-remove-compunit_call_site_htab.patch new file mode 100644 index 0000000..83fa15d --- /dev/null +++ b/gdb-symtab-remove-compunit_call_site_htab.patch @@ -0,0 +1,133 @@ +[gdb/symtab] Remove COMPUNIT_CALL_SITE_HTAB + +Remove macro COMPUNIT_CALL_SITE_HTAB, and provide access to the htab using +member functions: +- compunit_symtab::find_call_site +- compunit_symtab::set_call_site_htab + +Tested on x86_64-linux. + +Co-Authored-By: Tom de Vries + +--- + gdb/block.c | 10 +++++----- + gdb/dwarf2/read.c | 2 +- + gdb/symtab.c | 24 ++++++++++++++++++++++++ + gdb/symtab.h | 9 +++++++-- + 4 files changed, 37 insertions(+), 8 deletions(-) + +diff --git a/gdb/block.c b/gdb/block.c +index 4cb95731396..90c0c5b3250 100644 +--- a/gdb/block.c ++++ b/gdb/block.c +@@ -225,15 +225,15 @@ struct call_site * + call_site_for_pc (struct gdbarch *gdbarch, CORE_ADDR pc) + { + struct compunit_symtab *cust; +- void **slot = NULL; ++ call_site *cs = nullptr; + + /* -1 as tail call PC can be already after the compilation unit range. */ + cust = find_pc_compunit_symtab (pc - 1); + +- if (cust != NULL && COMPUNIT_CALL_SITE_HTAB (cust) != NULL) +- slot = htab_find_slot (COMPUNIT_CALL_SITE_HTAB (cust), &pc, NO_INSERT); ++ if (cust != nullptr) ++ cs = cust->find_call_site (pc); + +- if (slot == NULL) ++ if (cs == nullptr) + { + struct bound_minimal_symbol msym = lookup_minimal_symbol_by_pc (pc); + +@@ -247,7 +247,7 @@ call_site_for_pc (struct gdbarch *gdbarch, CORE_ADDR pc) + : msym.minsym->print_name ())); + } + +- return (struct call_site *) *slot; ++ return cs; + } + + /* Return the blockvector immediately containing the innermost lexical block +diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c +index 892d31dddf3..d3742bbce8c 100644 +--- a/gdb/dwarf2/read.c ++++ b/gdb/dwarf2/read.c +@@ -9457,7 +9457,7 @@ process_full_comp_unit (dwarf2_cu *cu, enum language pretend_language) + if (gcc_4_minor >= 5) + cust->epilogue_unwind_valid = 1; + +- cust->call_site_htab = cu->call_site_htab; ++ cust->set_call_site_htab (cu->call_site_htab); + } + + per_objfile->set_symtab (cu->per_cu, cust); +diff --git a/gdb/symtab.c b/gdb/symtab.c +index fa3f42207ec..1d30c8fc7a8 100644 +--- a/gdb/symtab.c ++++ b/gdb/symtab.c +@@ -331,6 +331,30 @@ search_domain_name (enum search_domain e) + + /* See symtab.h. */ + ++call_site * ++compunit_symtab::find_call_site (CORE_ADDR pc) const ++{ ++ if (m_call_site_htab == nullptr) ++ return nullptr; ++ ++ void **slot = htab_find_slot (m_call_site_htab, &pc, NO_INSERT); ++ if (slot == nullptr) ++ return nullptr; ++ ++ return (call_site *) *slot; ++} ++ ++/* See symtab.h. */ ++ ++void ++compunit_symtab::set_call_site_htab (htab_t call_site_htab) ++{ ++ gdb_assert (m_call_site_htab == nullptr); ++ m_call_site_htab = call_site_htab; ++} ++ ++/* See symtab.h. */ ++ + struct symtab * + compunit_primary_filetab (const struct compunit_symtab *cust) + { +diff --git a/gdb/symtab.h b/gdb/symtab.h +index 471ae9ef448..78ac84527ae 100644 +--- a/gdb/symtab.h ++++ b/gdb/symtab.h +@@ -1443,6 +1443,12 @@ struct symtab + + struct compunit_symtab + { ++ /* Set m_call_site_htab. */ ++ void set_call_site_htab (htab_t call_site_htab); ++ ++ /* Find call_site info for PC. */ ++ call_site *find_call_site (CORE_ADDR pc) const; ++ + /* Unordered chain of all compunit symtabs of this objfile. */ + struct compunit_symtab *next; + +@@ -1497,7 +1503,7 @@ struct compunit_symtab + unsigned int epilogue_unwind_valid : 1; + + /* struct call_site entries for this compilation unit or NULL. */ +- htab_t call_site_htab; ++ htab_t m_call_site_htab; + + /* The macro table for this symtab. Like the blockvector, this + is shared between different symtabs in a given compilation unit. +@@ -1530,7 +1536,6 @@ struct compunit_symtab + #define COMPUNIT_BLOCK_LINE_SECTION(cust) ((cust)->block_line_section) + #define COMPUNIT_LOCATIONS_VALID(cust) ((cust)->locations_valid) + #define COMPUNIT_EPILOGUE_UNWIND_VALID(cust) ((cust)->epilogue_unwind_valid) +-#define COMPUNIT_CALL_SITE_HTAB(cust) ((cust)->call_site_htab) + #define COMPUNIT_MACRO_TABLE(cust) ((cust)->macro_table) + + /* A range adapter to allowing iterating over all the file tables diff --git a/gdb-symtab-use-early-continue-in-find_pc_sect_compunit.patch b/gdb-symtab-use-early-continue-in-find_pc_sect_compunit.patch deleted file mode 100644 index bfa67cb..0000000 --- a/gdb-symtab-use-early-continue-in-find_pc_sect_compunit.patch +++ /dev/null @@ -1,149 +0,0 @@ -[gdb/symtab] Use early continue in find_pc_sect_compunit_symtab - -Function find_pc_sect_compunit_symtab contains a loop: -... - for (compunit_symtab *cust : obj_file->compunits ()) - { - ... - if (...) - { - /* Lots of code. */ - } - } -... - -Reduce indentation level and improve readability by using early continue. - -Tested on x86_64-linux. - -gdb/ChangeLog: - -2020-10-27 Tom de Vries - - * symtab.c (find_pc_sect_compunit_symtab): Use early continue. ---- - gdb/symtab.c | 94 +++++++++++++++++++++++++++------------------------ - 2 files changed, 54 insertions(+), 44 deletions(-) - -diff --git a/gdb/symtab.c b/gdb/symtab.c -index a4f8239a8a1..eda33a7eb4f 100644 ---- a/gdb/symtab.c -+++ b/gdb/symtab.c -@@ -2883,7 +2883,7 @@ struct compunit_symtab * - find_pc_sect_compunit_symtab (CORE_ADDR pc, struct obj_section *section) - { - struct compunit_symtab *best_cust = NULL; -- CORE_ADDR distance = 0; -+ CORE_ADDR best_cust_range = 0; - struct bound_minimal_symbol msymbol; - - /* If we know that this is not a text address, return failure. This is -@@ -2914,56 +2914,62 @@ find_pc_sect_compunit_symtab (CORE_ADDR pc, struct obj_section *section) - { - for (compunit_symtab *cust : obj_file->compunits ()) - { -- const struct block *b; -- const struct blockvector *bv; -+ const struct blockvector *bv = COMPUNIT_BLOCKVECTOR (cust); -+ const struct block *global_block -+ = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK); -+ CORE_ADDR start = BLOCK_START (global_block); -+ CORE_ADDR end = BLOCK_END (global_block); -+ bool in_range_p = start <= pc && pc < end; -+ if (!in_range_p) -+ continue; - -- bv = COMPUNIT_BLOCKVECTOR (cust); -- b = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK); -+ CORE_ADDR range = end - start; -+ if (best_cust != nullptr -+ && range >= best_cust_range) -+ /* Cust doesn't have a smaller range than best_cust, skip it. */ -+ continue; -+ -+ /* For an objfile that has its functions reordered, -+ find_pc_psymtab will find the proper partial symbol table -+ and we simply return its corresponding symtab. */ -+ /* In order to better support objfiles that contain both -+ stabs and coff debugging info, we continue on if a psymtab -+ can't be found. */ -+ if ((obj_file->flags & OBJF_REORDERED) && obj_file->sf) -+ { -+ struct compunit_symtab *result; -+ -+ result -+ = obj_file->sf->qf->find_pc_sect_compunit_symtab (obj_file, -+ msymbol, -+ pc, -+ section, -+ 0); -+ if (result != NULL) -+ return result; -+ } - -- if (BLOCK_START (b) <= pc -- && BLOCK_END (b) > pc -- && (distance == 0 -- || BLOCK_END (b) - BLOCK_START (b) < distance)) -+ if (section != 0) - { -- /* For an objfile that has its functions reordered, -- find_pc_psymtab will find the proper partial symbol table -- and we simply return its corresponding symtab. */ -- /* In order to better support objfiles that contain both -- stabs and coff debugging info, we continue on if a psymtab -- can't be found. */ -- if ((obj_file->flags & OBJF_REORDERED) && obj_file->sf) -+ struct symbol *sym = NULL; -+ struct block_iterator iter; -+ -+ ALL_BLOCK_SYMBOLS (global_block, iter, sym) - { -- struct compunit_symtab *result; -- -- result -- = obj_file->sf->qf->find_pc_sect_compunit_symtab (obj_file, -- msymbol, -- pc, -- section, -- 0); -- if (result != NULL) -- return result; -+ fixup_symbol_section (sym, obj_file); -+ if (matching_obj_sections (SYMBOL_OBJ_SECTION (obj_file, -+ sym), -+ section)) -+ break; - } -- if (section != 0) -- { -- struct block_iterator iter; -- struct symbol *sym = NULL; -- -- ALL_BLOCK_SYMBOLS (b, iter, sym) -- { -- fixup_symbol_section (sym, obj_file); -- if (matching_obj_sections (SYMBOL_OBJ_SECTION (obj_file, -- sym), -- section)) -- break; -- } -- if (sym == NULL) -- continue; /* No symbol in this symtab matches -+ if (sym == NULL) -+ continue; /* No symbol in this symtab matches - section. */ -- } -- distance = BLOCK_END (b) - BLOCK_START (b); -- best_cust = cust; - } -+ -+ /* Cust is best found sofar, save it. */ -+ best_cust = cust; -+ best_cust_range = range; - } - } - --- -2.26.2 - diff --git a/gdb-symtab-use-unrelocated-addresses-in-call_site.patch b/gdb-symtab-use-unrelocated-addresses-in-call_site.patch new file mode 100644 index 0000000..a31f5cd --- /dev/null +++ b/gdb-symtab-use-unrelocated-addresses-in-call_site.patch @@ -0,0 +1,194 @@ +[gdb/symtab] Use unrelocated addresses in call_site + +Consider test-case gdb.trace/entry-values.exp with target board +unix/-fPIE/-pie. + +Using this command we have an abbreviated version, and can see the correct +@entry values for foo: +... +$ gdb -q -batch outputs/gdb.trace/entry-values/entry-values \ + -ex start \ + -ex "break foo" \ + -ex "set print entry-values both" \ + -ex continue +Temporary breakpoint 1 at 0x679 + +Temporary breakpoint 1, 0x0000555555554679 in main () +Breakpoint 2 at 0x55555555463e + +Breakpoint 2, 0x000055555555463e in foo (i=0, i@entry=2, j=2, j@entry=3) +... + +Now, let's try the same again, but run directly to foo rather than stopping at +main: +... +$ gdb -q -batch outputs/gdb.trace/entry-values/entry-values \ + -ex "break foo" \ + -ex "set print entry-values both" \ + -ex run +Breakpoint 1 at 0x63e + +Breakpoint 1, 0x000055555555463e in foo (i=0, i@entry=, \ + j=2, j@entry=) +... + +So, what explains the difference? Noteworthy, this is a dwarf assembly +test-case, with debug info for foo and bar, but not for main. + +In the first case: +- we run to main +- this does not trigger expanding debug info, because there's none for main +- we set a breakpoint at foo +- this triggers expanding debug info. Relocated addresses are used in + call_site info (because the exec is started) +- we continue to foo, and manage to find the call_site info + +In the second case: +- we set a breakpoint at foo +- this triggers expanding debug info. Unrelocated addresses are used in + call_site info (because the exec is not started) +- we run to foo +- this triggers objfile_relocate1, but it doesn't update the call_site + info addresses +- we don't manage to find the call_site info + +We could fix this by adding the missing call_site relocation in +objfile_relocate1. + +This solution however is counter-trend in the sense that we're trying to +work towards the situation where when starting two instances of an executable, +we need only one instance of debug information, implying the use of +unrelocated addresses. + +So, fix this instead by using unrelocated addresses in call_site info. + +Tested on x86_64-linux. + +This fixes all remaining unix/-fno-PIE/-no-pie vs unix/-fPIE/-pie +regressions, like f.i. PR24892. + +Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=24892 + +Co-Authored-By: Tom de Vries + +--- + gdb/dwarf2/loc.c | 9 ++++++++- + gdb/dwarf2/read.c | 4 +++- + gdb/gdbtypes.c | 5 ++++- + gdb/gdbtypes.h | 10 +++++----- + gdb/symtab.c | 6 +++++- + 5 files changed, 25 insertions(+), 9 deletions(-) + +diff --git a/gdb/dwarf2/loc.c b/gdb/dwarf2/loc.c +index 83b5fe1ac88..ba94780cc75 100644 +--- a/gdb/dwarf2/loc.c ++++ b/gdb/dwarf2/loc.c +@@ -979,7 +979,14 @@ call_site_to_target_addr (struct gdbarch *call_site_gdbarch, + } + + case FIELD_LOC_KIND_PHYSADDR: +- return FIELD_STATIC_PHYSADDR (call_site->target); ++ { ++ dwarf2_per_objfile *per_objfile = call_site->per_objfile; ++ compunit_symtab *cust = per_objfile->get_symtab (call_site->per_cu); ++ int sect_idx = COMPUNIT_BLOCK_LINE_SECTION (cust); ++ CORE_ADDR delta = per_objfile->objfile->section_offsets[sect_idx]; ++ ++ return FIELD_STATIC_PHYSADDR (call_site->target) + delta; ++ } + + default: + internal_error (__FILE__, __LINE__, _("invalid call site target kind")); +diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c +index 59ce3cf2b45..e73c0855fc1 100644 +--- a/gdb/dwarf2/read.c ++++ b/gdb/dwarf2/read.c +@@ -13309,6 +13309,7 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu) + } + pc = attr->as_address () + baseaddr; + pc = gdbarch_adjust_dwarf2_addr (gdbarch, pc); ++ pc -= baseaddr; + + if (cu->call_site_htab == NULL) + cu->call_site_htab = htab_create_alloc_ex (16, call_site::hash, +@@ -13465,7 +13466,8 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu) + sect_offset_str (die->sect_off), objfile_name (objfile)); + else + { +- lowpc = gdbarch_adjust_dwarf2_addr (gdbarch, lowpc + baseaddr); ++ lowpc = (gdbarch_adjust_dwarf2_addr (gdbarch, lowpc + baseaddr) ++ - baseaddr); + SET_FIELD_PHYSADDR (call_site->target, lowpc); + } + } +diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c +index 1b3ed1b32ed..f1efbb98720 100644 +--- a/gdb/gdbtypes.c ++++ b/gdb/gdbtypes.c +@@ -6307,7 +6307,10 @@ objfile_type (struct objfile *objfile) + CORE_ADDR + call_site::pc () const + { +- return m_pc; ++ compunit_symtab *cust = this->per_objfile->get_symtab (this->per_cu); ++ CORE_ADDR delta ++ = this->per_objfile->objfile->section_offsets[COMPUNIT_BLOCK_LINE_SECTION (cust)]; ++ return m_unrelocated_pc + delta; + } + + void _initialize_gdbtypes (); +diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h +index a071188ffa1..8b1fd75bccf 100644 +--- a/gdb/gdbtypes.h ++++ b/gdb/gdbtypes.h +@@ -1777,19 +1777,19 @@ struct call_site + { + call_site (CORE_ADDR pc, dwarf2_per_cu_data *per_cu, + dwarf2_per_objfile *per_objfile) +- : per_cu (per_cu), per_objfile (per_objfile), m_pc (pc) ++ : per_cu (per_cu), per_objfile (per_objfile), m_unrelocated_pc (pc) + {} + + static int + eq (const call_site *a, const call_site *b) + { +- return core_addr_eq (&a->m_pc, &b->m_pc); ++ return core_addr_eq (&a->m_unrelocated_pc, &b->m_unrelocated_pc); + } + + static hashval_t + hash (const call_site *a) + { +- return core_addr_hash (&a->m_pc); ++ return core_addr_hash (&a->m_unrelocated_pc); + } + + static int +@@ -1831,8 +1831,8 @@ struct call_site + dwarf2_per_objfile *const per_objfile = nullptr; + + private: +- /* Address of the first instruction after this call. */ +- const CORE_ADDR m_pc; ++ /* Unrelocated address of the first instruction after this call. */ ++ const CORE_ADDR m_unrelocated_pc; + + public: + /* * Describe DW_TAG_call_site's DW_TAG_formal_parameter. */ +diff --git a/gdb/symtab.c b/gdb/symtab.c +index 14cc2b5bd8d..17607fb447b 100644 +--- a/gdb/symtab.c ++++ b/gdb/symtab.c +@@ -337,7 +337,11 @@ compunit_symtab::find_call_site (CORE_ADDR pc) const + if (m_call_site_htab == nullptr) + return nullptr; + +- struct call_site call_site_local (pc, nullptr, nullptr); ++ CORE_ADDR delta ++ = this->objfile->section_offsets[COMPUNIT_BLOCK_LINE_SECTION (this)]; ++ CORE_ADDR unrelocated_pc = pc - delta; ++ ++ struct call_site call_site_local (unrelocated_pc, nullptr, nullptr); + void **slot + = htab_find_slot (m_call_site_htab, &call_site_local, NO_INSERT); + if (slot == nullptr) diff --git a/gdb-test-dw2-aranges.patch b/gdb-test-dw2-aranges.patch index d470c1c..d88d3f4 100644 --- a/gdb-test-dw2-aranges.patch +++ b/gdb-test-dw2-aranges.patch @@ -203,7 +203,7 @@ new file mode 100644 + && ![istarget *-*-openbsd*] + && ![istarget arm-*-eabi*] + && ![istarget powerpc-*-eabi*]} { -+ return 0 ++ return 0 +} + +set testfile "dw2-aranges" diff --git a/gdb-test-for-rhbz1976887.patch b/gdb-test-for-rhbz1976887.patch new file mode 100644 index 0000000..018fdaa --- /dev/null +++ b/gdb-test-for-rhbz1976887.patch @@ -0,0 +1,592 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Alexandra=20H=C3=A1jkov=C3=A1?= +Date: Wed, 29 Sep 2021 11:14:51 +0200 +Subject: gdb-test-for-rhbz1976887.patch + +;; Backport test for RHBZ 1976887 (Kevin Buettner). + +Test case reproducing PR28030 bug + +The original reproducer for PR28030 required use of a specific +compiler version - gcc-c++-11.1.1-3.fc34 is mentioned in the PR, +though it seems probable that other gcc versions might also be able to +reproduce the bug as well. This commit introduces a test case which, +using the DWARF assembler, provides a reproducer which is independent +of the compiler version. (Well, it'll work with whatever compilers +the DWARF assembler works with.) + +To the best of my knowledge, it's also the first test case which uses +the DWARF assembler to provide debug info for a shared object. That +being the case, I provided more than the usual commentary which should +allow this case to be used as a template when a combo shared +library / DWARF assembler test case is required in the future. + +I provide some details regarding the bug in a comment near the +beginning of locexpr-dml.exp. + +This problem was difficult to reproduce; I found myself constantly +referring to the backtrace while trying to figure out what (else) I +might be missing while trying to create a reproducer. Below is a +partial backtrace which I include for posterity. + + #0 internal_error ( + file=0xc50110 "/ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/gdbtypes.c", line=5575, + fmt=0xc520c0 "Unexpected type field location kind: %d") + at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdbsupport/errors.cc:51 + #1 0x00000000006ef0c5 in copy_type_recursive (objfile=0x1635930, + type=0x274c260, copied_types=0x30bb290) + at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/gdbtypes.c:5575 + #2 0x00000000006ef382 in copy_type_recursive (objfile=0x1635930, + type=0x274ca10, copied_types=0x30bb290) + at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/gdbtypes.c:5602 + #3 0x0000000000a7409a in preserve_one_value (value=0x24269f0, + objfile=0x1635930, copied_types=0x30bb290) + at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/value.c:2529 + #4 0x000000000072012a in gdbscm_preserve_values ( + extlang=0xc55720 , objfile=0x1635930, + copied_types=0x30bb290) + at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/guile/scm-value.c:94 + #5 0x00000000006a3f82 in preserve_ext_lang_values (objfile=0x1635930, + copied_types=0x30bb290) + at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/extension.c:568 + #6 0x0000000000a7428d in preserve_values (objfile=0x1635930) + at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/value.c:2579 + #7 0x000000000082d514 in objfile::~objfile (this=0x1635930, + __in_chrg=) + at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/objfiles.c:549 + #8 0x0000000000831cc8 in std::_Sp_counted_ptr::_M_dispose (this=0x1654580) + at /usr/include/c++/11/bits/shared_ptr_base.h:348 + #9 0x00000000004e6617 in std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release (this=0x1654580) at /usr/include/c++/11/bits/shared_ptr_base.h:168 + #10 0x00000000004e1d2f in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count (this=0x190bb88, __in_chrg=) + at /usr/include/c++/11/bits/shared_ptr_base.h:705 + #11 0x000000000082feee in std::__shared_ptr::~__shared_ptr (this=0x190bb80, __in_chrg=) + at /usr/include/c++/11/bits/shared_ptr_base.h:1154 + #12 0x000000000082ff0a in std::shared_ptr::~shared_ptr ( + this=0x190bb80, __in_chrg=) + at /usr/include/c++/11/bits/shared_ptr.h:122 + #13 0x000000000085ed7e in __gnu_cxx::new_allocator > >::destroy > (this=0x114bc00, + __p=0x190bb80) at /usr/include/c++/11/ext/new_allocator.h:168 + #14 0x000000000085e88d in std::allocator_traits > > >::destroy > (__a=..., + __p=0x190bb80) at /usr/include/c++/11/bits/alloc_traits.h:531 + #15 0x000000000085e50c in std::__cxx11::list, std::allocator > >::_M_erase (this=0x114bc00, __position= + std::shared_ptr (expired, weak count 1) = {get() = 0x1635930}) + at /usr/include/c++/11/bits/stl_list.h:1925 + #16 0x000000000085df0e in std::__cxx11::list, std::allocator > >::erase (this=0x114bc00, __position= + std::shared_ptr (expired, weak count 1) = {get() = 0x1635930}) + at /usr/include/c++/11/bits/list.tcc:158 + #17 0x000000000085c748 in program_space::remove_objfile (this=0x114bbc0, + objfile=0x1635930) + at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/progspace.c:210 + #18 0x000000000082d3ae in objfile::unlink (this=0x1635930) + at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/objfiles.c:487 + #19 0x000000000082e68c in objfile_purge_solibs () + at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/objfiles.c:875 + #20 0x000000000092dd37 in no_shared_libraries (ignored=0x0, from_tty=1) + at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/solib.c:1236 + #21 0x00000000009a37fe in target_pre_inferior (from_tty=1) + at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/target.c:2496 + #22 0x00000000007454d6 in run_command_1 (args=0x0, from_tty=1, + run_how=RUN_NORMAL) + at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/infcmd.c:437 + +I'll note a few points regarding this backtrace: + +Frame #1 is where the internal error occurs. It's caused by an +unhandled case for FIELD_LOC_KIND_DWARF_BLOCK. The fix for this bug +adds support for this case. + +Frame #22 - it's a partial backtrace - shows that GDB is attempting to +(re)run the program. You can see the exact command sequence that was +used for reproducing this problem in the PR (at +https://sourceware.org/bugzilla/show_bug.cgi?id=28030), but in a +nutshell, after starting the program and advancing to the appropriate +source line, GDB was asked to step into libstdc++; a "finish" command +was issued, returning a value. The fact that a value was returned is +very important. GDB was then used to step back into libstdc++. A +breakpoint was set on a source line in the library after which a "run" +command was issued. + +Frame #19 shows a call to objfile_purge_solibs. It's aptly named. + +Frame #7 is a call to the destructor for one of the objfile solibs; it +turned out to be the one for libstdc++. + +Frames #6 thru #3 show various value preservation frames. If you look +at preserve_values() in gdb/value.c, the value history is preserved +first, followed by internal variables, followed by values for the +extension languages (python and guile). + +diff --git a/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location-lib.c b/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location-lib.c +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location-lib.c +@@ -0,0 +1,48 @@ ++/* Copyright (C) 2021 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 "locexpr-data-member-location.h" ++ ++struct A g_A = {3, 4}; ++struct B g_B = { {8, 9}, 10, 11 }; ++ ++B * ++foo () ++{ /* foo prologue */ ++ asm ("foo_label: .globl foo_label"); ++ return &g_B; /* foo return */ ++} /* foo end */ ++ ++B * ++bar (B *v) ++{ /* bar prologue */ ++ asm ("bar_label: .globl bar_label"); ++ return v; /* bar return */ ++} /* bar end */ ++ ++/* Some of the DWARF assembler procs (e.g. function_range) compile ++ this file, expecting it to be a complete program with a main() ++ function. When IS_SHAREDLIB is NOT defined, we have main() as ++ defined below. */ ++ ++#ifndef IS_SHAREDLIB ++int ++main () ++{ ++ B *b = foo (); ++} ++#endif +diff --git a/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location-main.c b/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location-main.c +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location-main.c +@@ -0,0 +1,27 @@ ++/* Copyright (C) 2021 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 "locexpr-data-member-location.h" ++ ++int ++main (void) ++{ ++ B *v1; ++ v1 = bar (foo ()); ++ ++ return 0; ++} +diff --git a/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location.exp b/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location.exp +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location.exp +@@ -0,0 +1,349 @@ ++# 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 . ++ ++# This test case uses the DWARF assembler to reproduce the problem ++# described by PR28030. The bug turned out to be that ++# FIELD_LOC_KIND_DWARF_BLOCK was not handled when recursively copying ++# a value's type when preserving the value history during the freeing ++# up of objfiles associated with a shared object. (Yes, figuring out ++# how to make this happen in a concise test case turned out to be ++# challenging.) ++# ++# The following elements proved to be necessary for reproducing the ++# problem: ++# ++# 1) A location expression needed to be used with ++# DW_AT_data_member_location rather than a simple offset. ++# Moreover, this location expression needed to use opcodes ++# which GDB's DWARF reader could not convert to a simple ++# offset. (Note, however, that GDB could probably be improved ++# to handle the opcodes chosen for this test; if decode_locdesc() ++# in dwarf2/read.c is ever updated to handle both DW_OP_pick and ++# DW_OP_drop, then this test could end up passing even if ++# the bug it's intended to test has not been fixed.) ++# ++# 2) The debug info containing the above DWARF info needed ++# to be associated with a shared object since the problem ++# occurred while GDB was preserving values during the ++# purging of shared objects. ++# ++# 3) After performing some simple gdb commands, the program is ++# run again. In the course of running the objfile destructor ++# associated with the shared object, values are preserved ++# along with their types. As noted earlier, it was during ++# the recursive type copy that the bug was observed. ++# ++# Therefore, due to #2 above, this test case creates debug info ++# which is then used by a shared object. ++ ++# This test can't be run on targets lacking shared library support. ++if [skip_shlib_tests] { ++ return 0 ++} ++ ++load_lib dwarf.exp ++ ++# This test can only be run on targets which support DWARF-2 and use gas. ++if ![dwarf2_support] { ++ return 0 ++} ++ ++# gdb_test_file_name is the name of this file without the .exp ++# extension. Use it to form basenames for the main program ++# and shared object. ++set main_basename ${::gdb_test_file_name}-main ++set lib_basename ${::gdb_test_file_name}-lib ++ ++# We're generating DWARF assembly for the shared object; therefore, ++# the source file for the library / shared object must be listed first ++# (in the standard_testfile invocation) since ${srcfile} is used by ++# get_func_info (for determining the start, end, and length of a ++# function). ++# ++# The output of Dwarf::assemble will be placed in $lib_basename.S ++# which will be ${srcfile3} after the execution of standard_testfile. ++ ++standard_testfile $lib_basename.c $main_basename.c $lib_basename.S ++ ++set libsrc "${::srcdir}/${::subdir}/${::srcfile}" ++set lib_so [standard_output_file ${lib_basename}.so] ++set asm_file [standard_output_file ${::srcfile3}] ++ ++# We need to know the size of some types in order to write some of the ++# debugging info that we're about to generate. For that, we ask GDB ++# by debugging the shared object associated with this test case. ++ ++# Compile the shared library: -DIS_SHAREDLIB prevents main() from ++# being defined. Note that debugging symbols will be present for ++# this compilation. ++if {[gdb_compile_shlib $libsrc $lib_so \ ++ {additional_flags=-DIS_SHAREDLIB debug}] != ""} { ++ untested "failed to compile shared library" ++ return ++} ++ ++# Start a fresh GDB and load the shared library. ++clean_restart $lib_so ++ ++# Using our running GDB session, determine sizes of several types. ++set long_size [get_sizeof "long" -1] ++set addr_size [get_sizeof "void *" -1] ++set struct_A_size [get_sizeof "g_A" -1] ++set struct_B_size [get_sizeof "g_B" -1] ++ ++if { $long_size == -1 || $addr_size == -1 \ ++ || $struct_A_size == -1 || $struct_B_size == -1} { ++ perror "Can't determine type sizes" ++ return ++} ++ ++# Retrieve struct offset of MBR in struct TP ++proc get_offsetof { tp mbr } { ++ return [get_integer_valueof "&((${tp} *) 0)->${mbr}" -1] ++} ++ ++# Use running GDB session to get struct offsets ++set A_a [get_offsetof A a] ++set A_x [get_offsetof A x] ++set B_a [get_offsetof B a] ++set B_b [get_offsetof B b] ++set B_x2 [get_offsetof B x2] ++ ++# Create the DWARF. ++Dwarf::assemble ${asm_file} { ++ declare_labels L ++ ++ # Find start, end, and length of functions foo and bar. ++ # These calls to get_func_info will create and set variables ++ # foo_start, bar_start, foo_end, bar_end, foo_len, and ++ # bar_len. ++ # ++ # In order to get the right answers, get_func_info (and, ++ # underneath, function_range) should use the same compiler flags ++ # as those used to make a shared object. For any targets that get ++ # this far, -fpic is probably correct. ++ # ++ # Also, it should be noted that IS_SHAREDLIB is NOT defined as one ++ # of the additional flags. Not defining IS_SHAREDLIB will cause a ++ # main() to be defined for the compilation of the shared library ++ # source file which happens as a result of using get_func_info; ++ # this is currently required in order to this facility. ++ set flags {additional_flags=-fpic debug} ++ get_func_info foo $flags ++ get_func_info bar $flags ++ ++ cu {} { ++ DW_TAG_compile_unit { ++ {DW_AT_language @DW_LANG_C_plus_plus} ++ {name ${::srcfile}} ++ {stmt_list $L DW_FORM_sec_offset} ++ } { ++ declare_labels int_label class_A_label class_B_label \ ++ B_ptr_label ++ ++ int_label: DW_TAG_base_type { ++ {DW_AT_byte_size ${::long_size} DW_FORM_udata} ++ {DW_AT_encoding @DW_ATE_signed} ++ {DW_AT_name "int"} ++ } ++ ++ class_A_label: DW_TAG_class_type { ++ {DW_AT_name "A"} ++ {DW_AT_byte_size ${::struct_A_size} DW_FORM_sdata} ++ } { ++ DW_TAG_member { ++ {DW_AT_name "a"} ++ {DW_AT_type :$int_label} ++ {DW_AT_data_member_location ${::A_a} DW_FORM_udata} ++ } ++ DW_TAG_member { ++ {DW_AT_name "x"} ++ {DW_AT_type :$int_label} ++ {DW_AT_data_member_location ${::A_x} DW_FORM_udata} ++ } ++ } ++ ++ class_B_label: DW_TAG_class_type { ++ {DW_AT_name "B"} ++ {DW_AT_byte_size ${::struct_B_size} DW_FORM_sdata} ++ } { ++ # While there are easier / better ways to specify an ++ # offset used by DW_AT_data_member_location than that ++ # used below, we need a location expression here in ++ # order to reproduce the bug. Moreover, this location ++ # expression needs to use opcodes that aren't handled ++ # by decode_locdesc() in dwarf2/read.c; if we use ++ # opcodes that _are_ handled by that function, the ++ # location expression will be converted into a simple ++ # offset - which will then (again) not reproduce the ++ # bug. At the time that this test was written, ++ # neither DW_OP_pick nor DW_OP_drop were being handled ++ # by decode_locdesc(); this is why those opcodes were ++ # chosen. ++ DW_TAG_inheritance { ++ {DW_AT_type :$class_A_label} ++ {DW_AT_data_member_location { ++ DW_OP_constu ${::B_a} ++ DW_OP_plus ++ DW_OP_pick 0 ++ DW_OP_drop} SPECIAL_expr} ++ {DW_AT_accessibility 1 DW_FORM_data1} ++ } ++ DW_TAG_member { ++ {DW_AT_name "b"} ++ {DW_AT_type :$int_label} ++ {DW_AT_data_member_location ${::B_b} DW_FORM_udata} ++ } ++ DW_TAG_member { ++ {DW_AT_name "x2"} ++ {DW_AT_type :$int_label} ++ {DW_AT_data_member_location ${::B_x2} DW_FORM_udata} ++ } ++ } ++ ++ B_ptr_label: DW_TAG_pointer_type { ++ {DW_AT_type :$class_B_label} ++ {DW_AT_byte_size ${::addr_size} DW_FORM_sdata} ++ } ++ ++ DW_TAG_variable { ++ {DW_AT_name "g_A"} ++ {DW_AT_type :$class_A_label} ++ {DW_AT_external 1 flag} ++ {DW_AT_location {DW_OP_addr [gdb_target_symbol "g_A"]} \ ++ SPECIAL_expr} ++ } ++ ++ DW_TAG_variable { ++ {DW_AT_name "g_B"} ++ {DW_AT_type :$class_B_label} ++ {DW_AT_external 1 flag} ++ {DW_AT_location {DW_OP_addr [gdb_target_symbol "g_B"]} \ ++ SPECIAL_expr} ++ } ++ ++ # We can't use MACRO_AT for the definitions of foo and bar ++ # because it doesn't provide a way to pass the appropriate ++ # flags. Therefore, we list the name, low_pc, and high_pc ++ # explicitly. ++ DW_TAG_subprogram { ++ {DW_AT_name foo} ++ {DW_AT_low_pc $foo_start DW_FORM_addr} ++ {DW_AT_high_pc $foo_end DW_FORM_addr} ++ {DW_AT_type :${B_ptr_label}} ++ {DW_AT_external 1 flag} ++ } ++ ++ DW_TAG_subprogram { ++ {DW_AT_name bar} ++ {DW_AT_low_pc $bar_start DW_FORM_addr} ++ {DW_AT_high_pc $bar_end DW_FORM_addr} ++ {DW_AT_type :${B_ptr_label}} ++ {DW_AT_external 1 flag} ++ } { ++ DW_TAG_formal_parameter { ++ {DW_AT_name v} ++ {DW_AT_type :${B_ptr_label}} ++ } ++ } ++ } ++ } ++ ++ lines {version 2} L { ++ include_dir "${::srcdir}/${::subdir}" ++ file_name "${::srcfile}" 1 ++ ++ # Generate a line table program. ++ program { ++ {DW_LNE_set_address $foo_start} ++ {line [gdb_get_line_number "foo prologue"]} ++ {DW_LNS_copy} ++ {DW_LNE_set_address foo_label} ++ {line [gdb_get_line_number "foo return"]} ++ {DW_LNS_copy} ++ {line [gdb_get_line_number "foo end"]} ++ {DW_LNS_copy} ++ {DW_LNE_set_address $foo_end} ++ {DW_LNS_advance_line 1} ++ {DW_LNS_copy} ++ {DW_LNE_end_sequence} ++ ++ {DW_LNE_set_address $bar_start} ++ {line [gdb_get_line_number "bar prologue"]} ++ {DW_LNS_copy} ++ {DW_LNE_set_address bar_label} ++ {line [gdb_get_line_number "bar return"]} ++ {DW_LNS_copy} ++ {line [gdb_get_line_number "bar end"]} ++ {DW_LNS_copy} ++ {DW_LNE_set_address $bar_end} ++ {DW_LNS_advance_line 1} ++ {DW_LNS_copy} ++ {DW_LNE_end_sequence} ++ } ++ } ++} ++ ++# Compile the shared object again, but this time include / use the ++# DWARF info that we've created above. Note that (again) ++# -DIS_SHAREDLIB is used to prevent inclusion of main() in the shared ++# object. Also note the use of the "nodebug" option. Any debugging ++# information that we need will be provided by the DWARF info created ++# above. ++if {[gdb_compile_shlib [list $libsrc $asm_file] $lib_so \ ++ {additional_flags=-DIS_SHAREDLIB nodebug}] != ""} { ++ untested "failed to compile shared library" ++ return ++} ++ ++# Compile the main program for use with the shared object. ++if [prepare_for_testing "failed to prepare" ${testfile} \ ++ ${::srcfile2} [list debug shlib=$lib_so]] { ++ return -1 ++} ++ ++# Do whatever is necessary to make sure that the shared library is ++# loaded for remote targets. ++gdb_load_shlib ${lib_so} ++ ++if ![runto_main] then { ++ fail "can't run to main" ++ return ++} ++ ++# Step into foo so that we can finish out of it. ++gdb_test "step" "foo .. at .* foo end.*" "step into foo" ++ ++# Finishing out of foo will create a value that will later need to ++# be preserved when restarting the program. ++gdb_test "finish" "= \\(class B \\*\\) ${::hex} .*" "finish out of foo" ++ ++# Dereferencing and printing the return value isn't necessary ++# for reproducing the bug, but we should make sure that the ++# return value is what we expect it to be. ++gdb_test "p *$" { = { = {a = 8, x = 9}, b = 10, x2 = 11}} \ ++ "dereference return value" ++ ++# The original PR28030 reproducer stepped back into the shared object, ++# so we'll do the same here: ++gdb_test "step" "bar \\(.*" "step into bar" ++ ++# We don't want a clean restart here since that will be too clean. ++# The original reproducer for PR28030 set a breakpoint in the shared ++# library and then restarted via "run". The command below does roughly ++# the same thing. It's at this step that an internal error would ++# occur for PR28030. The "message" argument tells runto to turn on ++# the printing of PASSes while runto is doing its job. ++runto "bar" message +diff --git a/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location.h b/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location.h +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location.h +@@ -0,0 +1,30 @@ ++/* Copyright (C) 2021 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 . */ ++ ++typedef struct A { ++ long a; ++ long x; ++} A; ++ ++typedef struct B { ++ A a; ++ long b; ++ long x2; ++} B; ++ ++extern B *foo (); ++extern B *bar (B *v); diff --git a/gdb-test-ivy-bridge.patch b/gdb-test-ivy-bridge.patch index 1c36c21..31c38e0 100644 --- a/gdb-test-ivy-bridge.patch +++ b/gdb-test-ivy-bridge.patch @@ -57,21 +57,21 @@ new file mode 100644 + vcvtps2ph $0x2,%ymm4,%xmm4 + vcvtps2ph $0x2,%ymm8,(%r8) + vcvtps2ph $0x2,%xmm4,%xmm4 -+ vcvtps2ph $0x2,%xmm4,(%rcx) ++ 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,QWORD PTR [rcx] + vcvtph2ps xmm4,[rcx] + vcvtps2ph xmm4,ymm4,0x2 -+ vcvtps2ph XMMWORD PTR [rcx],ymm4,0x2 -+ vcvtps2ph [rcx],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 ++ vcvtps2ph QWORD PTR [r8],xmm8,0x2 ++ vcvtps2ph [rcx],xmm4,0x2 + +/* gas/i386/x86-64-fsgs.s */ + .att_syntax prefix @@ -80,34 +80,34 @@ new file mode 100644 + 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 ++ 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 ebx ++ rdfsbase rbx ++ rdfsbase r8d + rdfsbase r8 -+ rdgsbase ebx -+ rdgsbase rbx -+ rdgsbase r8d ++ rdgsbase ebx ++ rdgsbase rbx ++ rdgsbase r8d + rdgsbase r8 -+ wrfsbase ebx -+ wrfsbase rbx -+ wrfsbase r8d ++ wrfsbase ebx ++ wrfsbase rbx ++ wrfsbase r8d + wrfsbase r8 -+ wrgsbase ebx -+ wrgsbase rbx -+ wrgsbase r8d ++ 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 @@ -136,7 +136,7 @@ new file mode 100644 +set testfile amd64-ivy-bridge +set test compilation +if [prepare_for_testing ${testfile}.exp ${testfile}.x ${testfile}.S [list debug "additional_flags=-m64 -nostdlib"]] { -+ fail $test ++ unsupported $test + return -1 +} +pass $test @@ -288,7 +288,7 @@ diff --git a/gdb/testsuite/gdb.arch/i386-ivy-bridge.S b/gdb/testsuite/gdb.arch/i new file mode 100644 --- /dev/null +++ b/gdb/testsuite/gdb.arch/i386-ivy-bridge.S -@@ -0,0 +1,67 @@ +@@ -0,0 +1,66 @@ +/* Copyright 2011 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify @@ -325,23 +325,23 @@ new file mode 100644 + vcvtph2ps %xmm4,%xmm6 + vcvtph2ps (%ecx),%xmm4 + vcvtps2ph $0x2,%ymm4,%xmm4 -+ vcvtps2ph $0x2,%ymm4,(%ecx) ++ vcvtps2ph $0x2,%ymm4,(%ecx) + vcvtps2ph $0x2,%xmm4,%xmm4 -+ vcvtps2ph $0x2,%xmm4,(%ecx) ++ 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,QWORD PTR [ecx] + vcvtph2ps xmm4,[ecx] + vcvtps2ph xmm4,ymm4,0x2 -+ vcvtps2ph XMMWORD PTR [ecx],ymm4,0x2 -+ vcvtps2ph [ecx],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 ++ vcvtps2ph QWORD PTR [ecx],xmm4,0x2 ++ vcvtps2ph [ecx],xmm4,0x2 + +/* gas/i386/fsgs.s */ + .att_syntax prefix @@ -351,11 +351,10 @@ new file mode 100644 + wrgsbase %ebx + + .intel_syntax noprefix -+ rdfsbase ebx -+ rdgsbase ebx -+ wrfsbase ebx -+ wrgsbase ebx -+ ++ 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 diff --git a/gdb-test-pid0-core.patch b/gdb-test-pid0-core.patch index e9e89a4..1c90683 100644 --- a/gdb-test-pid0-core.patch +++ b/gdb-test-pid0-core.patch @@ -45,22 +45,22 @@ new file mode 100644 +++ 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. ++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Some kernel core files have PID 0 - for the idle task. + diff --git a/gdb-testsuite-Fix-gdb.threads-thread-specific-bp.exp.patch b/gdb-testsuite-Fix-gdb.threads-thread-specific-bp.exp.patch new file mode 100644 index 0000000..d4f805e --- /dev/null +++ b/gdb-testsuite-Fix-gdb.threads-thread-specific-bp.exp.patch @@ -0,0 +1,62 @@ +[gdb/testsuite] Fix gdb.threads/thread-specific-bp.exp + +On OBS I ran into a failure in test-case gdb.threads/thread-specific-bp.exp: +... +(gdb) PASS: gdb.threads/thread-specific-bp.exp: non-stop: continue to end +info breakpoint^M +Num Type Disp Enb Address What^M +1 breakpoint keep y 0x0000555555555167 in main at $src:36^M + breakpoint already hit 1 time^M +2 breakpoint keep y 0x0000555555555151 in start at $src:23^M + breakpoint already hit 1 time^M +3 breakpoint keep y 0x0000555555555167 in main at $src:36 thread 2^M + stop only in thread 2^M +4 breakpoint keep y 0x000055555555515c in end at $src:29^M + breakpoint already hit 1 time^M +(gdb) [Thread 0x7ffff7db1640 (LWP 19984) exited]^M +Thread-specific breakpoint 3 deleted - thread 2 no longer in the thread list.^M +FAIL: gdb.threads/thread-specific-bp.exp: non-stop: \ + thread-specific breakpoint was deleted (timeout) +... + +Fix this by waiting for the "[Thread 0x7ffff7db1640 (LWP 19984) exited]" +message before issuing the "info breakpoint command". + +Tested on x86_64-linux. + +--- + gdb/testsuite/gdb.threads/thread-specific-bp.exp | 21 ++++++++++++++++++--- + 1 file changed, 18 insertions(+), 3 deletions(-) + +diff --git a/gdb/testsuite/gdb.threads/thread-specific-bp.exp b/gdb/testsuite/gdb.threads/thread-specific-bp.exp +index 331f9470c22..ceb2c25b066 100644 +--- a/gdb/testsuite/gdb.threads/thread-specific-bp.exp ++++ b/gdb/testsuite/gdb.threads/thread-specific-bp.exp +@@ -87,9 +87,24 @@ proc check_thread_specific_breakpoint {mode} { + set cmd "continue" + } + set test "continue to end" +- gdb_test_multiple "$cmd" $test { +- -re "Breakpoint .* end .* at .*\r\n$gdb_prompt " { +- pass $test ++ set thread_exited 0 ++ set prompt 0 ++ gdb_test_multiple "$cmd" $test -lbl { ++ -re "\\\[Thread \[^\r\n\]* exited](?=\r\n)" { ++ if { $prompt } { ++ pass $gdb_test_name ++ } else { ++ set thread_exited 1 ++ exp_continue ++ } ++ } ++ -re -wrap "" { ++ if { $thread_exited } { ++ pass $gdb_test_name ++ } else { ++ set prompt 1 ++ exp_continue ++ } + } + } + diff --git a/gdb-testsuite-add-checks-to-gdb.arch-i386-sse.exp.patch b/gdb-testsuite-add-checks-to-gdb.arch-i386-sse.exp.patch new file mode 100644 index 0000000..bea6368 --- /dev/null +++ b/gdb-testsuite-add-checks-to-gdb.arch-i386-sse.exp.patch @@ -0,0 +1,88 @@ +[gdb/testsuite] Add checks to gdb.arch/i386-sse.exp + +In test-case gdb.arch/i386-sse.exp, add the steps marked with "(added)": +- verify data array (added) +- initialize regs from data array +- verify regs +- modify regs +- verify modified regs (added) +- write back regs to data array +- verify updated data array + +This in the hope to catch more information about failures in this test-case +reported in PR28504. + +Also use gdb_test_no_output instead of gdb_test for the "modify regs" step. + +Tested on x86_64-linux. + +--- + gdb/testsuite/gdb.arch/i386-sse.exp | 33 ++++++++++++++++++++++++++------- + 1 file changed, 26 insertions(+), 7 deletions(-) + +diff --git a/gdb/testsuite/gdb.arch/i386-sse.exp b/gdb/testsuite/gdb.arch/i386-sse.exp +index fca90256505..57f62694e6e 100644 +--- a/gdb/testsuite/gdb.arch/i386-sse.exp ++++ b/gdb/testsuite/gdb.arch/i386-sse.exp +@@ -64,17 +64,26 @@ gdb_expect { + } + } + +-gdb_test "break [gdb_get_line_number "first breakpoint here"]" \ +- "Breakpoint .* at .*i386-sse.c.*" \ +- "set first breakpoint in main" +-gdb_continue_to_breakpoint "continue to first breakpoint in main" +- + if [is_amd64_regs_target] { + set nr_regs 16 + } else { + set nr_regs 8 + } + ++# Verify data array. ++for { set r 0 } { $r < $nr_regs } { incr r } { ++ gdb_test "print data\[$r\]" \ ++ ".. = \\{f = \\{$r, $r.25, $r.5, $r.75\\}\\}.*" \ ++ "check contents of data\[$r\]" ++} ++ ++# Initialize regs from data array. ++gdb_test "break [gdb_get_line_number "first breakpoint here"]" \ ++ "Breakpoint .* at .*i386-sse.c.*" \ ++ "set first breakpoint in main" ++gdb_continue_to_breakpoint "continue to first breakpoint in main" ++ ++# Verify regs. + for { set r 0 } { $r < $nr_regs } { incr r } { + gdb_test "print \$xmm$r.v4_float" \ + ".. = \\{$r, $r.25, $r.5, $r.75\\}.*" \ +@@ -84,17 +93,27 @@ for { set r 0 } { $r < $nr_regs } { incr r } { + "check int8 contents of %xmm$r" + } + ++# Modify regs. + for { set r 0 } { $r < $nr_regs } { incr r } { +- gdb_test "set var \$xmm$r.v4_float\[0\] = $r + 10" "" "set %xmm$r" ++ gdb_test_no_output "set var \$xmm$r.v4_float\[0\] = $r + 10" "set %xmm$r" + } + ++# Verify modified regs. ++for { set r 0 } { $r < $nr_regs } { incr r } { ++ gdb_test "print \$xmm$r.v4_float" \ ++ ".. = \\{[expr $r + 10], $r.25, $r.5, $r.75\\}.*" \ ++ "check contents of %xmm$r" ++} ++ ++# Write back regs to data array. + gdb_test "break [gdb_get_line_number "second breakpoint here"]" \ + "Breakpoint .* at .*i386-sse.c.*" \ + "set second breakpoint in main" + gdb_continue_to_breakpoint "continue to second breakpoint in main" + ++# Verify updated data array. + for { set r 0 } { $r < $nr_regs } { incr r } { + gdb_test "print data\[$r\]" \ + ".. = \\{f = \\{[expr $r + 10], $r.25, $r.5, $r.75\\}\\}.*" \ +- "check contents of data\[$r\]" ++ "check contents of updated data\[$r\]" + } diff --git a/gdb-testsuite-add-gdb.testsuite-dump-system-info.exp.patch b/gdb-testsuite-add-gdb.testsuite-dump-system-info.exp.patch new file mode 100644 index 0000000..5853b11 --- /dev/null +++ b/gdb-testsuite-add-gdb.testsuite-dump-system-info.exp.patch @@ -0,0 +1,81 @@ +[gdb/testsuite] Add gdb.testsuite/dump-system-info.exp + +When interpreting the testsuite results, it's often relevant what kind of +machine the testsuite ran on. On a local machine one can just do +/proc/cpuinfo, but in case of running tests using a remote system +that distributes test runs to other remote systems that are not directly +accessible, that's not possible. + +Fix this by dumping /proc/cpuinfo into the gdb.log, as well as lsb_release -a +and uname -a. + +We could do this at the start of each test run, by putting it into unix.exp +or some such. However, this might be too verbose, so we choose to put it into +its own test-case, such that it get triggered in a full testrun, but not when +running one or a subset of tests. + +We put the test-case into the gdb.testsuite directory, which is currently the +only place in the testsuite where we do not test gdb. [ Though perhaps this +could be put into a new gdb.info directory, since the test-case doesn't +actually test the testsuite. ] + +Tested on x86_64-linux. + +--- + gdb/testsuite/gdb.testsuite/dump-system-info.exp | 48 ++++++++++++++++++++++++ + 1 file changed, 48 insertions(+) + +diff --git a/gdb/testsuite/gdb.testsuite/dump-system-info.exp b/gdb/testsuite/gdb.testsuite/dump-system-info.exp +new file mode 100644 +index 00000000000..bf181469bd5 +--- /dev/null ++++ b/gdb/testsuite/gdb.testsuite/dump-system-info.exp +@@ -0,0 +1,48 @@ ++# 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 . ++ ++# The purpose of this test-case is to dump /proc/cpuinfo and similar system ++# info into gdb.log. ++ ++# Check if /proc/cpuinfo is available. ++set res [remote_exec target "test -r /proc/cpuinfo"] ++set status [lindex $res 0] ++set output [lindex $res 1] ++ ++if { $status == 0 && $output == "" } { ++ verbose -log "Cpuinfo available, dumping:" ++ remote_exec target "cat /proc/cpuinfo" ++} else { ++ verbose -log "Cpuinfo not available" ++} ++ ++set res [remote_exec target "lsb_release -a"] ++set status [lindex $res 0] ++set output [lindex $res 1] ++ ++if { $status == 0 } { ++ verbose -log "lsb_release -a availabe, dumping:\n$output" ++} else { ++ verbose -log "lsb_release -a not available" ++} ++ ++set res [remote_exec target "uname -a"] ++set status [lindex $res 0] ++set output [lindex $res 1] ++ ++if { $status == 0 } { ++ verbose -log "uname -a availabe, dumping:\n$output" ++} else { ++ verbose -log "uname -a not available" ++} diff --git a/gdb-testsuite-add-kfail-in-gdb.threads-fork-plus-threads.exp.patch b/gdb-testsuite-add-kfail-in-gdb.threads-fork-plus-threads.exp.patch new file mode 100644 index 0000000..9bde3f6 --- /dev/null +++ b/gdb-testsuite-add-kfail-in-gdb.threads-fork-plus-threads.exp.patch @@ -0,0 +1,57 @@ +[gdb/testsuite] Add KFAIL in gdb.threads/fork-plus-threads.exp + +When running test-case gdb.threads/fork-and-threads.exp on a VM with openSUSE +Tumbleweed, with the VM bound to 1 cpu with 75% execution cap, I get: +... +(gdb) info inferiors^M + Num Description Connection Executable ^M +* 1 fork-plus-threads ^M + 11 fork-plus-threads ^M +(gdb) FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: \ + only inferior 1 left +... + +The test checks that all removable inferiors are indeed removed from the +inferior list after exit, and evidently this didn't happen for inferior 11 +(which is added by fork rather than a user command, and therefore removable). + +I've investigated why that is that case, and it's because its refcount didn't +drop to 0. + +This seems like a bug to me, so add a KFAIL for this. + +Tested on x86_64-linux. + +--- + gdb/testsuite/gdb.threads/fork-plus-threads.exp | 18 +++++++++++++++--- + 1 file changed, 15 insertions(+), 3 deletions(-) + +diff --git a/gdb/testsuite/gdb.threads/fork-plus-threads.exp b/gdb/testsuite/gdb.threads/fork-plus-threads.exp +index c8e179938c6..5b2b0909a65 100644 +--- a/gdb/testsuite/gdb.threads/fork-plus-threads.exp ++++ b/gdb/testsuite/gdb.threads/fork-plus-threads.exp +@@ -119,9 +119,21 @@ proc do_test { detach-on-fork } { + gdb_test "info threads" "No threads\." \ + "no threads left" + +- gdb_test "info inferiors" \ +- "Num\[ \t\]+Description\[ \t\]+Connection\[ \t\]+Executable\[ \t\]+\r\n\\* 1 \[^\r\n\]+" \ +- "only inferior 1 left" ++ set re \ ++ [multi_line \ ++ "Num\[ \t\]+Description\[ \t\]+Connection\[ \t\]+Executable\[ \t\]+" \ ++ "\\* 1 \[^\r\n\]+"] ++ gdb_test_multiple "info inferiors" "only inferior 1 left" { ++ -re -wrap $re { ++ pass $gdb_test_name ++ } ++ -re -wrap $re.* { ++ if { ${detach-on-fork} == "off" } { ++ setup_kfail "threads/26272" *-*-* ++ } ++ fail $gdb_test_name ++ } ++ } + } + + foreach_with_prefix detach-on-fork {"on" "off"} { diff --git a/gdb-testsuite-add-nopie-in-two-test-cases.patch b/gdb-testsuite-add-nopie-in-two-test-cases.patch new file mode 100644 index 0000000..4c081bf --- /dev/null +++ b/gdb-testsuite-add-nopie-in-two-test-cases.patch @@ -0,0 +1,51 @@ +[gdb/testsuite] Add nopie in two test-cases + +When running test-case gdb.dwarf2/dw2-restrict.exp on openSUSE Leap 15.2 with +gcc-PIE installed (switching compiler default to -fPIE/-pie), I get: +... +gdb compile failed, ld: outputs/gdb.dwarf2/dw2-restrict/dw2-restrict0.o: \ + warning: relocation in read-only section `.text' +ld: warning: creating DT_TEXTREL in a PIE +UNTESTED: gdb.dwarf2/dw2-restrict.exp: failed to prepare +... + +This is due to using a hardcoded .S file that was generated with -fno-PIE. + +Fix this by adding the missing nopie. + +Likewise in gdb.arch/amd64-tailcall-noret.exp. + +Tested on x86_64-linux. + +--- + gdb/testsuite/gdb.arch/amd64-tailcall-noret.exp | 2 ++ + gdb/testsuite/gdb.dwarf2/dw2-restrict.exp | 3 ++- + 2 files changed, 4 insertions(+), 1 deletion(-) + +diff --git a/gdb/testsuite/gdb.arch/amd64-tailcall-noret.exp b/gdb/testsuite/gdb.arch/amd64-tailcall-noret.exp +index c68abce61e3..fb1d5695a11 100644 +--- a/gdb/testsuite/gdb.arch/amd64-tailcall-noret.exp ++++ b/gdb/testsuite/gdb.arch/amd64-tailcall-noret.exp +@@ -25,6 +25,8 @@ if [info exists COMPILE] { + return + } + ++lappend opts nopie ++ + if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} $opts] } { + return -1 + } +diff --git a/gdb/testsuite/gdb.dwarf2/dw2-restrict.exp b/gdb/testsuite/gdb.dwarf2/dw2-restrict.exp +index 6f98b6cfb18..2a46510c7a3 100644 +--- a/gdb/testsuite/gdb.dwarf2/dw2-restrict.exp ++++ b/gdb/testsuite/gdb.dwarf2/dw2-restrict.exp +@@ -27,7 +27,8 @@ if {![istarget x86_64-*] || ![is_lp64_target]} { + + standard_testfile .S + +-if {[prepare_for_testing "failed to prepare" $testfile $srcfile {nodebug}]} { ++if {[prepare_for_testing "failed to prepare" $testfile $srcfile \ ++ {nodebug nopie}]} { + return -1 + } + diff --git a/gdb-testsuite-catch-condition-evaluation-errors-in-gdb-assert.patch b/gdb-testsuite-catch-condition-evaluation-errors-in-gdb-assert.patch deleted file mode 100644 index fbedd91..0000000 --- a/gdb-testsuite-catch-condition-evaluation-errors-in-gdb-assert.patch +++ /dev/null @@ -1,68 +0,0 @@ -[gdb/testsuite] Catch condition evaluation errors in gdb_assert - -When running test-case gdb.base/watchpoint-stops-at-right-insn.exp, we may run -into a tcl error, which can be reproduced reliably using this trigger patch: -... -+ set hw_watch_pc "" - gdb_assert {$sw_watch_pc == $hw_watch_pc} \ - "hw watchpoint stops at right instruction" -... -such that we have: -... -ERROR: tcl error sourcing watchpoint-stops-at-right-insn.exp. -ERROR: missing operand at _@_ -in expression "0x4004b7 == _@_" - (parsing expression "0x4004b7 == ") - invoked from within -"expr $sw_watch_pc == $hw_watch_pc" - ("uplevel" body line 1) - invoked from within -"uplevel 1 expr $condition" - (procedure "gdb_assert" line 6) - invoked from within -"gdb_assert {$sw_watch_pc == $hw_watch_pc} \ - "hw watchpoint stops at right instruction"" -... - -A similar problem was fixed in commit 5f0e2eb79e "GDB/testsuite: Fix a -catastrophic step-over-no-symbols.exp failure", by making the assert condition -more robust: -... -- gdb_assert {$before_addr != $after_addr} "advanced" -+ gdb_assert {{[string is integer -strict $before_addr] \ -+ && [string is integer -strict $after_addr] \ -+ && $before_addr != $after_addr}} "advanced" -... - -Fix this instead in gdb_assert, by catching errors while evaluating the assert -condition. - -Tested on x86_64-linux. - -gdb/testsuite/ChangeLog: - -2020-09-16 Tom de Vries - - PR testsuite/26624 - * lib/gdb.exp (gdb_assert): Catch errors in condition evaluation. - ---- - gdb/testsuite/ChangeLog | 5 +++++ - gdb/testsuite/lib/gdb.exp | 4 ++-- - 2 files changed, 7 insertions(+), 2 deletions(-) - -diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp -index 653f145c1ce..59439f8e379 100644 ---- a/gdb/testsuite/lib/gdb.exp -+++ b/gdb/testsuite/lib/gdb.exp -@@ -1689,8 +1689,8 @@ proc gdb_assert { condition {message ""} } { - set message $condition - } - -- set res [uplevel 1 expr $condition] -- if {!$res} { -+ set code [catch {uplevel 1 expr $condition} res] -+ if {$code != 0 || !$res} { - fail $message - } else { - pass $message diff --git a/gdb-testsuite-detect-gdb-prompt-after-monitor-exit.patch b/gdb-testsuite-detect-gdb-prompt-after-monitor-exit.patch deleted file mode 100644 index daf7bf0..0000000 --- a/gdb-testsuite-detect-gdb-prompt-after-monitor-exit.patch +++ /dev/null @@ -1,71 +0,0 @@ -[gdb/testsuite] Detect gdb prompt after monitor exit - -With this gdbserver-support.exp patch: -... - -... -and with this in parallel: -... -$ stress -c 5 -... -we run into this and similar FAILs: -... -FAIL: gdb.multi/multi-target.exp: continue: non-stop=on: $have_prompt -... - -In more detail: -... -(gdb) PASS: gdb.multi/multi-target.exp: continue: non-stop=on: inferior 5 -Remote debugging from host ::1, port 40712^M -Process build/gdb/testsuite/outputs/gdb.multi/multi-target/multi-target \ - created; pid = 11098^M -monitor exit^M -Killing process(es): 11098^M -FAIL: gdb.multi/multi-target.exp: continue: non-stop=on: $have_prompt -spawn build/gdb/testsuite/../../gdb/gdb -nw -nx -data-directory \ - build/gdb/testsuite/../data-directory^M -... - -After issuing a "monitor exit" command, we should always get a prompt back, so -check for that. - -Tested on x86_64-linux. - -gdb/testsuite/ChangeLog: - -2020-09-16 Tom de Vries - - * lib/gdbserver-support.exp (gdbserver_exit): Make sure we - get the gdb prompt after issuing "monitor exit". - ---- - gdb/testsuite/ChangeLog | 5 +++++ - gdb/testsuite/lib/gdbserver-support.exp | 9 ++++++++- - 2 files changed, 13 insertions(+), 1 deletion(-) - -diff --git a/gdb/testsuite/lib/gdbserver-support.exp b/gdb/testsuite/lib/gdbserver-support.exp -index a2cc80f28d7..2734ca6c878 100644 ---- a/gdb/testsuite/lib/gdbserver-support.exp -+++ b/gdb/testsuite/lib/gdbserver-support.exp -@@ -451,13 +451,20 @@ proc gdbserver_exit { is_mi } { - # We use expect rather than gdb_expect because - # we want to suppress printing exception messages, otherwise, - # remote_expect, invoked by gdb_expect, prints the exceptions. -+ set have_prompt 0 - expect { - -i "$gdb_spawn_id" -re "$gdb_prompt $" { -- exp_continue -+ set have_prompt 1 -+ if { [info exists server_spawn_id] } { -+ exp_continue -+ } - } - -i "$server_spawn_id" eof { - wait -i $expect_out(spawn_id) - unset server_spawn_id -+ if { ! $have_prompt } { -+ exp_continue -+ } - } - timeout { - warning "Timed out waiting for EOF in server after $monitor_exit" diff --git a/gdb-testsuite-disable-selftests-for-factory.patch b/gdb-testsuite-disable-selftests-for-factory.patch deleted file mode 100644 index de776f9..0000000 --- a/gdb-testsuite-disable-selftests-for-factory.patch +++ /dev/null @@ -1,65 +0,0 @@ -[gdb/testsuite] Disable selftests for factory - ---- - gdb/testsuite/gdb.gdb/complaints.exp | 3 +++ - gdb/testsuite/gdb.gdb/python-interrupts.exp | 3 +++ - gdb/testsuite/gdb.gdb/python-selftest.exp | 3 +++ - gdb/testsuite/gdb.gdb/selftest.exp | 3 +++ - 4 files changed, 12 insertions(+) - -diff --git a/gdb/testsuite/gdb.gdb/complaints.exp b/gdb/testsuite/gdb.gdb/complaints.exp -index 922530caa50..f3cb8fc902c 100644 ---- a/gdb/testsuite/gdb.gdb/complaints.exp -+++ b/gdb/testsuite/gdb.gdb/complaints.exp -@@ -17,6 +17,9 @@ - # derived from xfullpath.exp (written by Joel Brobecker), derived from - # selftest.exp (written by Rob Savoye). - -+verbose "Skipping selftests for gdb build with -flto." -+return -1 -+ - load_lib selftest-support.exp - - if [target_info exists gdb,noinferiorio] { -diff --git a/gdb/testsuite/gdb.gdb/python-interrupts.exp b/gdb/testsuite/gdb.gdb/python-interrupts.exp -index 6e5ce6ee48d..3087a48eeac 100644 ---- a/gdb/testsuite/gdb.gdb/python-interrupts.exp -+++ b/gdb/testsuite/gdb.gdb/python-interrupts.exp -@@ -16,6 +16,9 @@ - # Test Python SIGINT handling. - # This is easiest if we can send SIGINT when gdb is at particular points. - -+verbose "Skipping selftests for gdb build with -flto." -+return -1 -+ - load_lib selftest-support.exp - load_lib gdb-python.exp - -diff --git a/gdb/testsuite/gdb.gdb/python-selftest.exp b/gdb/testsuite/gdb.gdb/python-selftest.exp -index ee40245bc53..0396ad2405a 100644 ---- a/gdb/testsuite/gdb.gdb/python-selftest.exp -+++ b/gdb/testsuite/gdb.gdb/python-selftest.exp -@@ -13,6 +13,9 @@ - # You should have received a copy of the GNU General Public License - # along with this program. If not, see . - -+verbose "Skipping selftests for gdb build with -flto." -+return -1 -+ - load_lib selftest-support.exp - load_lib gdb-python.exp - -diff --git a/gdb/testsuite/gdb.gdb/selftest.exp b/gdb/testsuite/gdb.gdb/selftest.exp -index 43043e58ead..a84efa2bbb6 100644 ---- a/gdb/testsuite/gdb.gdb/selftest.exp -+++ b/gdb/testsuite/gdb.gdb/selftest.exp -@@ -15,6 +15,9 @@ - - # This file was written by Rob Savoye. (rob@cygnus.com) - -+verbose "Skipping selftests for gdb build with -flto." -+return -1 -+ - load_lib selftest-support.exp - - proc test_with_self { } { diff --git a/gdb-testsuite-factor-out-dump_info-in-gdb.testsuite-dump-system-info.exp.patch b/gdb-testsuite-factor-out-dump_info-in-gdb.testsuite-dump-system-info.exp.patch new file mode 100644 index 0000000..86f3abe --- /dev/null +++ b/gdb-testsuite-factor-out-dump_info-in-gdb.testsuite-dump-system-info.exp.patch @@ -0,0 +1,70 @@ +[gdb/testsuite] Factor out dump_info in gdb.testsuite/dump-system-info.exp + +Factor out new proc dump_info in test-case gdb.testsuite/dump-system-info.exp, +and in the process: +- fix a few typos +- remove unnecessary "test -r /proc/cpuinfo" + +Tested on x86_64-linux. + +Co-Authored-By: Pedro Alves + +--- + gdb/testsuite/gdb.testsuite/dump-system-info.exp | 42 +++++++++--------------- + 1 file changed, 16 insertions(+), 26 deletions(-) + +diff --git a/gdb/testsuite/gdb.testsuite/dump-system-info.exp b/gdb/testsuite/gdb.testsuite/dump-system-info.exp +index bf181469bd5..1831479265c 100644 +--- a/gdb/testsuite/gdb.testsuite/dump-system-info.exp ++++ b/gdb/testsuite/gdb.testsuite/dump-system-info.exp +@@ -15,34 +15,24 @@ + # The purpose of this test-case is to dump /proc/cpuinfo and similar system + # info into gdb.log. + +-# Check if /proc/cpuinfo is available. +-set res [remote_exec target "test -r /proc/cpuinfo"] +-set status [lindex $res 0] +-set output [lindex $res 1] + +-if { $status == 0 && $output == "" } { +- verbose -log "Cpuinfo available, dumping:" +- remote_exec target "cat /proc/cpuinfo" +-} else { +- verbose -log "Cpuinfo not available" +-} +- +-set res [remote_exec target "lsb_release -a"] +-set status [lindex $res 0] +-set output [lindex $res 1] ++proc dump_info {cmd {what ""}} { + +-if { $status == 0 } { +- verbose -log "lsb_release -a availabe, dumping:\n$output" +-} else { +- verbose -log "lsb_release -a not available" +-} ++ if {$what == ""} { ++ set what $cmd ++ } + +-set res [remote_exec target "uname -a"] +-set status [lindex $res 0] +-set output [lindex $res 1] ++ set res [remote_exec target $cmd] ++ set status [lindex $res 0] ++ set output [lindex $res 1] + +-if { $status == 0 } { +- verbose -log "uname -a availabe, dumping:\n$output" +-} else { +- verbose -log "uname -a not available" ++ if { $status == 0 } { ++ verbose -log "$what available, dumping:\n$output" ++ } else { ++ verbose -log "$what not available" ++ } + } ++ ++dump_info "cat /proc/cpuinfo" "Cpuinfo" ++dump_info "uname -a" ++dump_info "lsb_release -a" diff --git a/gdb-testsuite-fix-control-flow-in-gdb-reverse-insn-reverse-exp.patch b/gdb-testsuite-fix-control-flow-in-gdb-reverse-insn-reverse-exp.patch deleted file mode 100644 index 75c21a2..0000000 --- a/gdb-testsuite-fix-control-flow-in-gdb-reverse-insn-reverse-exp.patch +++ /dev/null @@ -1,76 +0,0 @@ -[gdb/testsuite] Fix control-flow in gdb.reverse/insn-reverse.exp - -In gdb.reverse/insn-reverse.exp, we have loop containing a call to -gdb_test_multiple, which itself contains a break: -... - for {} {$count < 500} {incr count} { - ... - gdb_test_multiple "x/i \$pc" "" { - ... - break - } -... - -On SLE-11 with: -... -$ runtest --version -Expect version is 5.44.1.11 -Tcl version is 8.5 -Framework version is 1.4.4 -... -the break doesn't seem to have the effect of breaking out of the loop. - -The break does have the effect of terminating evaluation of the expect clause, -which means we don't set insn_array, after which we run into: -... -ERROR: tcl error sourcing /tmp/tdevries/src/gdb/testsuite/gdb.reverse/insn-reverse.exp. -ERROR: can't read "insn_array(5)": no such element in array -... - ---- - gdb/testsuite/gdb.reverse/insn-reverse.exp | 26 +++++++++++++++----------- - 1 file changed, 15 insertions(+), 11 deletions(-) - -diff --git a/gdb/testsuite/gdb.reverse/insn-reverse.exp b/gdb/testsuite/gdb.reverse/insn-reverse.exp -index 39e276964f9..d1fdebf75fe 100644 ---- a/gdb/testsuite/gdb.reverse/insn-reverse.exp -+++ b/gdb/testsuite/gdb.reverse/insn-reverse.exp -@@ -79,23 +79,27 @@ proc test { func testcase_nr } { - set count 0 - set insn_addr "" - for {} {$count < 500} {incr count} { -+ set prev_insn_addr $insn_addr -+ set insn_addr "" - gdb_test_multiple "x/i \$pc" "" { - -re ".* ($hex) <.*>:\[ \t\]*(.*)\r\n$gdb_prompt $" { -- set prev_insn_addr $insn_addr - set insn_addr $expect_out(1,string) -+ set insn_array($count) $expect_out(2,string) -+ } -+ } - -- if [expr {$last_insn == $insn_addr}] { -- break -- } -+ if [expr {$insn_addr == ""}] { -+ break -+ } - -- if [expr {$prev_insn_addr == $insn_addr}] { -- # Failed to make progress, might have run into SIGILL. -- unsupported "no progress at: $expect_out(2,string)" -- break -- } -+ if [expr {$last_insn == $insn_addr}] { -+ break -+ } - -- set insn_array($count) $expect_out(2,string) -- } -+ if [expr {$prev_insn_addr == $insn_addr}] { -+ # Failed to make progress, might have run into SIGILL. -+ unsupported "no progress at: $expect_out(2,string)" -+ break - } - - set pre_regs($count) [capture_command_output "info all-registers" ""] diff --git a/gdb-testsuite-fix-fail-in-gdb.base-annota1.exp.patch b/gdb-testsuite-fix-fail-in-gdb.base-annota1.exp.patch new file mode 100644 index 0000000..bfe2e9b --- /dev/null +++ b/gdb-testsuite-fix-fail-in-gdb.base-annota1.exp.patch @@ -0,0 +1,48 @@ +[gdb/testsuite] Fix FAIL in gdb.base/annota1.exp + +On openSUSE tumbleweed I run into: +... +FAIL: gdb.base/annota1.exp: run until main breakpoint (timeout) +... +due to a message related to libthread_db: +... +^Z^Zstarting^M +[Thread debugging using libthread_db enabled]^M +Using host libthread_db library "/lib64/libthread_db.so.1".^M +^M +^Z^Zframes-invalid^M +... +which is not matched by the regexp. + +Fix this by updating the regexp. + +Tested on x86_64-linux. + +--- + gdb/testsuite/gdb.base/annota1.exp | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/gdb/testsuite/gdb.base/annota1.exp b/gdb/testsuite/gdb.base/annota1.exp +index 6e30c164ec9..046e942a321 100644 +--- a/gdb/testsuite/gdb.base/annota1.exp ++++ b/gdb/testsuite/gdb.base/annota1.exp +@@ -138,6 +138,10 @@ set warning_gdb_index_re \ + "to use the section anyway\\."] + set reading_re \ + "Reading \[^\r\n\]+" ++set libthread_db_re \ ++ [multi_line \ ++ "\\\[Thread debugging using libthread_db enabled\\\]" \ ++ "Using host libthread_db library \[^\r\n\]+"] + + set run_re \ + [list \ +@@ -145,7 +149,7 @@ set run_re \ + "\(\(\r\n$reading_re\)|\(\r\n$warning_slow_re\)\)*" \ + "\(\r\n$warning_gdb_index_re\)?" \ + "\(\(\r\n\r\n\032\032frames-invalid\)|\(\r\n\r\n\032\032breakpoints-invalid\)\)*\r\n\r\n" \ +- "\032\032starting\(\(\r\n$reading_re\)|\(\r\n$warning_slow_re\)\)*" \ ++ "\032\032starting\(\(\r\n$reading_re\)|\(\r\n$warning_slow_re\)|\r\n$libthread_db_re\)*" \ + "\(\(\r\n\r\n\032\032frames-invalid\)|\(\r\n\r\n\032\032breakpoints-invalid\)\)*\r\n\r\n" \ + "\032\032breakpoint 1\r\n\r\n" \ + "Breakpoint 1, \r\n" \ diff --git a/gdb-testsuite-fix-fail-in-gdb.threads-fork-and-threads.exp.patch b/gdb-testsuite-fix-fail-in-gdb.threads-fork-and-threads.exp.patch new file mode 100644 index 0000000..9a6e75a --- /dev/null +++ b/gdb-testsuite-fix-fail-in-gdb.threads-fork-and-threads.exp.patch @@ -0,0 +1,144 @@ +[gdb/testsuite] Fix FAIL in gdb.threads/fork-and-threads.exp + +As reported in PR26272, when running test-case +gdb.threads/fork-and-threads.exp on a VM with openSUSE Tumbleweed, with the VM +bound to 1 cpu with 75% execution cap, I get: +... +[Inferior 1 (process 21928) exited normally]PASS: \ + gdb.threads/fork-plus-threads.exp: detach-on-fork=off: inferior 1 exited +PASS: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: \ + no failure to remove breakpoints +PASS: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: \ + no spurious thread stop +^M +info threads^M + Id Target Id Frame ^M + 11.11 Thread 0x7ffff3470700 (LWP 22041) (running)^M +^M +No selected thread. See `help thread'.^M +(gdb) FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: \ + no threads left +[Inferior 11 (process 21990) exited normally]^M +info inferiors^M + Num Description Connection Executable ^M +* 1 fork-plus-threads ^M + 11 fork-plus-threads ^M +(gdb) FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: \ + only inferior 1 left (the program exited) +... + +The initial process (inferior 1) creates 10 child processes, and then waits on +the child processes. Consequently, the initial process is also the last +process to exit. + +However, in the log above we see: +... +[Inferior 1 (process 21928) exited normally] + ... +[Inferior 11 (process 21990) exited normally] +... +This seems counter-intuitive: if inferior 1 is the last to exit, shouldn't we +see it last? + +However, looking at the debug infrun log: +... +[infrun] fetch_inferior_event: enter + [infrun] scoped_disable_commit_resumed: reason=handling event + [infrun] do_target_wait: Found 2 inferiors, starting at #0 + [infrun] random_pending_event_thread: None found. + [infrun] print_target_wait_results: target_wait (-1.0.0 [process -1], status) = + [infrun] print_target_wait_results: 17202.17202.0 [Thread 0x7ffff7c79740 (LWP 17202)], + [infrun] print_target_wait_results: status->kind = exited, status = 0 + [infrun] handle_inferior_event: status->kind = exited, status = 0 +[Inferior 1 (process 17202) exited normally] + [infrun] stop_waiting: stop_waiting + [infrun] reset: reason=handling event + [infrun] maybe_set_commit_resumed_all_targets: enabling commit-resumed for target native + [infrun] maybe_call_commit_resumed_all_targets: calling commit_resumed for target native +[infrun] fetch_inferior_event: exit +[infrun] fetch_inferior_event: enter + [infrun] scoped_disable_commit_resumed: reason=handling event + [infrun] random_pending_event_thread: None found. + [infrun] print_target_wait_results: target_wait (-1.0.0 [process -1], status) = + [infrun] print_target_wait_results: 17215.17215.0 [Thread 0x7ffff7c79740 (LWP 17215)], + [infrun] print_target_wait_results: status->kind = exited, status = 0 + [infrun] handle_inferior_event: status->kind = exited, status = 0 +[Inferior 11 (process 17215) exited normally] +... +this seems plausible. + +Doing a waitpid with a pid of -1 will wait for any child process, and if +both inferior 1 and 11 have exited, and not yet been reaped, waitpid may +return any of the two. + +Fix the first FAIL by waiting for all inferiors to exit, rather than waiting +for inferior 1 to exit, assuming it's the last. + +Tested on x86_64-linux. + +--- + gdb/testsuite/gdb.threads/fork-plus-threads.exp | 31 ++++++++++++++----------- + 1 file changed, 17 insertions(+), 14 deletions(-) + +diff --git a/gdb/testsuite/gdb.threads/fork-plus-threads.exp b/gdb/testsuite/gdb.threads/fork-plus-threads.exp +index 7fe3c603bcd..8540fbf3082 100644 +--- a/gdb/testsuite/gdb.threads/fork-plus-threads.exp ++++ b/gdb/testsuite/gdb.threads/fork-plus-threads.exp +@@ -33,6 +33,7 @@ proc do_test { detach-on-fork } { + global GDBFLAGS + global srcfile testfile + global gdb_prompt ++ global decimal + + set saved_gdbflags $GDBFLAGS + set GDBFLAGS [concat $GDBFLAGS " -ex \"set non-stop on\""] +@@ -51,6 +52,12 @@ proc do_test { detach-on-fork } { + } + + gdb_test_no_output "set detach-on-fork ${detach-on-fork}" ++ if { ${detach-on-fork} == "on" } { ++ set expected_exits 1 ++ } else { ++ set expected_exits 11 ++ } ++ + set test "continue &" + gdb_test_multiple $test $test { + -re "$gdb_prompt " { +@@ -77,26 +84,22 @@ proc do_test { detach-on-fork } { + set saw_cannot_remove_breakpoints 0 + set saw_thread_stopped 0 + +- set test "inferior 1 exited" +- gdb_test_multiple "" $test { +- -re "Cannot remove breakpoints" { ++ set nr_exits 0 ++ gdb_test_multiple "" "last inferior exited" -lbl { ++ -re "^\r\nCannot remove breakpoints \[^\r\n\]+\\.(?=\r\n)" { + set saw_cannot_remove_breakpoints 1 + exp_continue + } +- -re "Thread \[^\r\n\]+ stopped\\." { ++ -re "^\r\n\\\[Thread \[^\r\n\]+ stopped\\.(?=\r\n)" { + set saw_thread_stopped 1 + exp_continue + } +- -re "(Thread|LWP) \[^\r\n\]+ exited" { +- # Avoid timeout with check-read1 +- exp_continue +- } +- -re "New (Thread|LWP) \[^\r\n\]+" { +- # Avoid timeout with check-read1 +- exp_continue +- } +- -re "Inferior 1 \(\[^\r\n\]+\) exited normally" { +- pass $test ++ -re "^\r\n\\\[Inferior $decimal \(\[^\r\n\]+\) exited normally\\\](?=\r\n)" { ++ incr nr_exits ++ if { $nr_exits < $expected_exits } { ++ exp_continue ++ } ++ pass $gdb_test_name + } + } + diff --git a/gdb-testsuite-fix-fail-in-gdb.tui-corefile-run.exp.patch b/gdb-testsuite-fix-fail-in-gdb.tui-corefile-run.exp.patch new file mode 100644 index 0000000..3951dc9 --- /dev/null +++ b/gdb-testsuite-fix-fail-in-gdb.tui-corefile-run.exp.patch @@ -0,0 +1,64 @@ +[gdb/testsuite] Fix FAIL in gdb.tui/corefile-run.exp + +When running test-case gdb.tui/corefile-run.exp on openSUSE Tumbleweed, +I run into: +... +PASS: gdb.tui/corefile-run.exp: load corefile +FAIL: gdb.tui/corefile-run.exp: run until the end +... + +What's going on is easier to see when also doing dump_screen if +check_contents passes, and inspecting state at the preceding PASS: +... + +-------------------------------------------------------------------------+ + exec No process In: L?? PC: ?? + [New LWP 16629] + [Thread debugging using libthread_db enabled] + Using host libthread_db library "/lib64/libthread_db.so.1". + Core was generated by `/data/gdb_versions/devel/build/gdb/testsuite/output + s/gdb.tui/corefile-run/corefi'. + Program terminated with signal SIGTRAP, Trace/breakpoint trap. + #0 main () + --Type for more, q to quit, c to continue without paging-- +... + +The problem is that we're getting a pagination prompt, and the subsequent run +command is interpreted as an answer to that prompt. + +Fix this by: +- detecting the gdb prompt in response to "load corefile", such that + we detect the failure earlier, and +- doing a "set pagination off" in Term::clean_restart. + +Tested on x86_64-linux. + +--- + gdb/testsuite/gdb.tui/corefile-run.exp | 2 +- + gdb/testsuite/lib/tuiterm.exp | 1 + + 2 files changed, 2 insertions(+), 1 deletion(-) + +diff --git a/gdb/testsuite/gdb.tui/corefile-run.exp b/gdb/testsuite/gdb.tui/corefile-run.exp +index d53149fb648..b3da6d1e67c 100644 +--- a/gdb/testsuite/gdb.tui/corefile-run.exp ++++ b/gdb/testsuite/gdb.tui/corefile-run.exp +@@ -55,7 +55,7 @@ gdb_assert {![string match "No Source Available" $text]} \ + "initial source listing" + + Term::command "core-file $core" +-Term::check_contents "load corefile" "21 *return 0" ++Term::check_contents "load corefile" "21 *return 0.*$gdb_prompt .*" + + Term::command "run" + Term::check_contents "run until the end" \ +diff --git a/gdb/testsuite/lib/tuiterm.exp b/gdb/testsuite/lib/tuiterm.exp +index 222583f291f..ad5cbb72ea5 100644 +--- a/gdb/testsuite/lib/tuiterm.exp ++++ b/gdb/testsuite/lib/tuiterm.exp +@@ -595,6 +595,7 @@ namespace eval Term { + } else { + ::clean_restart $executable + } ++ ::gdb_test_no_output "set pagination off" + } + } + diff --git a/gdb-testsuite-fix-failure-in-gdb-base-step-over-no-symbols-exp.patch b/gdb-testsuite-fix-failure-in-gdb-base-step-over-no-symbols-exp.patch deleted file mode 100644 index 1ab7ef1..0000000 --- a/gdb-testsuite-fix-failure-in-gdb-base-step-over-no-symbols-exp.patch +++ /dev/null @@ -1,52 +0,0 @@ -gdb/testsuite: fix failure in gdb.base/step-over-no-symbols.exp - -This test fails on my machine: - - p /x $pc^M - $2 = 0x55555555514e^M - (gdb) PASS: gdb.base/step-over-no-symbols.exp: displaced=off: get after PC - FAIL: gdb.base/step-over-no-symbols.exp: displaced=off: advanced - -This is due to the check added in 5f0e2eb79e6b ("GDB/testsuite: Fix a -catastrophic step-over-no-symbols.exp failure"), that makes sure the PC -values are integer. As documented in the TCL doc [1], "string is -integer" returns 1 if the string is a valid 32-bit integer format. The -PC values are greater than 32 bits, so are not recognized as integers by -that test. - - % string is integer -strict 0x55555555 - 1 - % string is integer -strict 0x555555555 - 0 - -Replace the "string is integer" test with a regexp one, that verifies -the PC is a hex value. - -[1] https://www.tcl.tk/man/tcl/TclCmd/string.htm#M21 - -gdb/testsuite/ChangeLog: - - * gdb.base/step-over-no-symbols.exp (test_step_over): Replace - integer format test with regexp. - -Change-Id: I71f8197e7b52e97b4901980544a8d1072aabd362 - ---- - gdb/testsuite/gdb.base/step-over-no-symbols.exp | 4 ++-- - 2 files changed, 7 insertions(+), 2 deletions(-) - -diff --git a/gdb/testsuite/gdb.base/step-over-no-symbols.exp b/gdb/testsuite/gdb.base/step-over-no-symbols.exp -index bc715d7afed..a2201dcaebe 100644 ---- a/gdb/testsuite/gdb.base/step-over-no-symbols.exp -+++ b/gdb/testsuite/gdb.base/step-over-no-symbols.exp -@@ -78,8 +78,8 @@ proc test_step_over { displaced } { - - set after_addr [get_pc "get after PC"] - -- gdb_assert {{[string is integer -strict $before_addr] \ -- && [string is integer -strict $after_addr] \ -+ gdb_assert {{[regexp "^${hex}$" $before_addr] \ -+ && [regexp "^${hex}$" $after_addr] \ - && $before_addr != $after_addr}} "advanced" - } - diff --git a/gdb-testsuite-fix-gdb-dlang-watch-loc-exp-on-ppc64.patch b/gdb-testsuite-fix-gdb-dlang-watch-loc-exp-on-ppc64.patch deleted file mode 100644 index 8f1d633..0000000 --- a/gdb-testsuite-fix-gdb-dlang-watch-loc-exp-on-ppc64.patch +++ /dev/null @@ -1,123 +0,0 @@ -[gdb/testsuite] Fix gdb.dlang/watch-loc.exp on ppc64 - -On ppc64, we run into: -... -/tmp/ccKXURmw.s: Assembler messages:^M -/tmp/ccKXURmw.s:99: Error: can't resolve \ - `_Dmain_end' {.text section} - `_Dmain' {.opd section}^M -compiler exited with status 1 -... - -The unresolvable entity comes from the .debug_aranges section hardcoded in -watch-loc.c: -... -" .4byte _Dmain \n" // Address -" .4byte _Dmain_end - _Dmain \n" // Length -... -where _Dmain is the function label for function _Dmain, and _Dmain_end is a -label after function _Dmain: -... -int _Dmain (void) -{ - asm ("_Dmain_label: .globl _Dmain_label"); - return 0; -} - -asm ("_Dmain_end: .globl _Dmain_end"); -... - -The problem is that the two labels are not in the same section, because _Dmain -ends up in the .opd section, which "contains the official procedure -descriptors. A pointer to a function shall reference a procedure descriptor in -this section." - -Fix this by using function_range instead to get the length. - -Also, fix the address part to not use _Dmain, but instead use the function -start as returned by function_range. - -Tested on x86_64-linux. - -gdb/testsuite/ChangeLog: - -2020-09-16 Tom de Vries - - PR testsuite/26617 - * gdb.dlang/watch-loc.c: Only add .debug_aranges if - WITH_DEBUG_SECTIONS is defined. - (xstr, str): New macro. - (.debug_aranges): Use DMAIN_START_0/1/2 and DMAIN_LENGTH - to get start and size of _Dmain. - * gdb.dlang/watch-loc.exp: Pass DMAIN_START_0/1/2 and DMAIN_LENGTH - using additional_flags. - ---- - gdb/testsuite/ChangeLog | 11 +++++++++++ - gdb/testsuite/gdb.dlang/watch-loc.c | 8 ++++++-- - gdb/testsuite/gdb.dlang/watch-loc.exp | 17 ++++++++++++++++- - 3 files changed, 33 insertions(+), 3 deletions(-) - -diff --git a/gdb/testsuite/gdb.dlang/watch-loc.c b/gdb/testsuite/gdb.dlang/watch-loc.c -index de594f35ae6..0a58f27d9fa 100644 ---- a/gdb/testsuite/gdb.dlang/watch-loc.c -+++ b/gdb/testsuite/gdb.dlang/watch-loc.c -@@ -36,6 +36,9 @@ main (void) - return _Dmain (); - } - -+#ifdef WITH_DEBUG_SECTIONS -+#define xstr(s) str(s) -+#define str(s) #s - /* The .debug_names-based index support depends on .debug_aranges - generated by GCC. (.gdb_index includes a gdb-generated map - instead.) */ -@@ -52,10 +55,11 @@ asm ( - " .byte 0 \n" // Size of Segment Descriptor - " .2byte 0 \n" // Pad to 16 byte boundary - " .2byte 0 \n" --" .4byte _Dmain \n" // Address --" .4byte _Dmain_end - _Dmain \n" // Length -+" .4byte " xstr(DMAIN_START_0) xstr(DMAIN_START_1) xstr(DMAIN_START_2) "\n" // Address -+" .4byte " xstr(DMAIN_LENGTH) "\n" // Length - " .4byte 0 \n" - " .4byte 0 \n" - ".Laranges_end: \n" - " .popsection \n" - ); -+#endif -diff --git a/gdb/testsuite/gdb.dlang/watch-loc.exp b/gdb/testsuite/gdb.dlang/watch-loc.exp -index d65f3c674fd..dcd93789ce4 100644 ---- a/gdb/testsuite/gdb.dlang/watch-loc.exp -+++ b/gdb/testsuite/gdb.dlang/watch-loc.exp -@@ -27,6 +27,10 @@ if {![dwarf2_support]} { - - standard_testfile watch-loc.c watch-loc-dw.S - -+lassign [function_range _Dmain ${srcdir}/${subdir}/${srcfile}] \ -+ dmain_start dmain_length -+ -+ - # Make some DWARF for the test. - set asm_file [standard_output_file $srcfile2] - Dwarf::assemble $asm_file { -@@ -62,8 +66,19 @@ Dwarf::assemble $asm_file { - } - } - -+set dmain_start_list [split $dmain_start] -+set dmain_start_0 [lindex $dmain_start_list 0] -+set dmain_start_1 [lindex $dmain_start_list 1] -+set dmain_start_2 [lindex $dmain_start_list 2] -+ - if { [prepare_for_testing "failed to prepare" ${testfile} \ -- [list $srcfile $asm_file] {nodebug}] } { -+ [list $srcfile $asm_file] \ -+ "nodebug \ -+ additional_flags=-DWITH_DEBUG_SECTIONS \ -+ additional_flags=-DDMAIN_START_0=$dmain_start_0 \ -+ additional_flags=-DDMAIN_START_1=$dmain_start_1 \ -+ additional_flags=-DDMAIN_START_2=$dmain_start_2 \ -+ additional_flags=-DDMAIN_LENGTH=$dmain_length"] } { - return -1 - } - diff --git a/gdb-testsuite-fix-gdb-reverse-insn-reverse-x86-c-for-m32.patch b/gdb-testsuite-fix-gdb-reverse-insn-reverse-x86-c-for-m32.patch deleted file mode 100644 index c081601..0000000 --- a/gdb-testsuite-fix-gdb-reverse-insn-reverse-x86-c-for-m32.patch +++ /dev/null @@ -1,95 +0,0 @@ -[gdb/testsuite] Fix gdb.reverse/insn-reverse-x86.c for -m32 - -When running test-case gdb.reverse/insn-reverse.exp with target board -unix/-m32, we get: -... -spawn -ignore SIGHUP gcc -fno-stack-protector -fdiagnostics-color=never \ - -c -g -m32 -o insn-reverse0.o insn-reverse.c^M -insn-reverse-x86.c: Assembler messages:^M -insn-reverse-x86.c:88: Error: bad register name `%r8w'^M -.... - -Fix this by guarding x86_64 assembly in insn-reverse-x86.c with #ifdef -__x86_64__. - -Tested on x86_64-linux, with native and unix/-m32. - -gdb/testsuite/ChangeLog: - -2020-11-25 Tom de Vries - - * gdb.reverse/insn-reverse-x86.c: Guard x86_64 assembly with #ifdef - __x86_64__. - ---- - gdb/testsuite/gdb.reverse/insn-reverse-x86.c | 8 ++++++++ - 1 file changed, 8 insertions(+) - -diff --git a/gdb/testsuite/gdb.reverse/insn-reverse-x86.c b/gdb/testsuite/gdb.reverse/insn-reverse-x86.c -index 22ba97a50d7..4392cb66def 100644 ---- a/gdb/testsuite/gdb.reverse/insn-reverse-x86.c -+++ b/gdb/testsuite/gdb.reverse/insn-reverse-x86.c -@@ -85,6 +85,7 @@ rdrand (void) - __asm__ volatile ("rdrand %%sp;" : "=r" (number)); - __asm__ volatile ("mov %%ax, %%sp;" : "=r" (number)); - -+#ifdef __x86_64__ - __asm__ volatile ("rdrand %%r8w;" : "=r" (number)); - __asm__ volatile ("rdrand %%r9w;" : "=r" (number)); - __asm__ volatile ("rdrand %%r10w;" : "=r" (number)); -@@ -93,6 +94,7 @@ rdrand (void) - __asm__ volatile ("rdrand %%r13w;" : "=r" (number)); - __asm__ volatile ("rdrand %%r14w;" : "=r" (number)); - __asm__ volatile ("rdrand %%r15w;" : "=r" (number)); -+#endif - - /* 32-bit random numbers. */ - __asm__ volatile ("rdrand %%eax;" : "=r" (number)); -@@ -100,6 +102,7 @@ rdrand (void) - __asm__ volatile ("rdrand %%ecx;" : "=r" (number)); - __asm__ volatile ("rdrand %%edx;" : "=r" (number)); - -+#ifdef __x86_64__ - __asm__ volatile ("mov %%rdi, %%rax;" : "=r" (number)); - __asm__ volatile ("rdrand %%edi;" : "=r" (number)); - __asm__ volatile ("mov %%rax, %%rdi;" : "=r" (number)); -@@ -155,6 +158,7 @@ rdrand (void) - __asm__ volatile ("rdrand %%r13;" : "=r" (number)); - __asm__ volatile ("rdrand %%r14;" : "=r" (number)); - __asm__ volatile ("rdrand %%r15;" : "=r" (number)); -+#endif - } - - /* Test rdseed support for various output registers. */ -@@ -190,6 +194,7 @@ rdseed (void) - __asm__ volatile ("rdseed %%sp;" : "=r" (seed)); - __asm__ volatile ("mov %%ax, %%sp;" : "=r" (seed)); - -+#ifdef __x86_64__ - __asm__ volatile ("rdseed %%r8w;" : "=r" (seed)); - __asm__ volatile ("rdseed %%r9w;" : "=r" (seed)); - __asm__ volatile ("rdseed %%r10w;" : "=r" (seed)); -@@ -198,6 +203,7 @@ rdseed (void) - __asm__ volatile ("rdseed %%r13w;" : "=r" (seed)); - __asm__ volatile ("rdseed %%r14w;" : "=r" (seed)); - __asm__ volatile ("rdseed %%r15w;" : "=r" (seed)); -+#endif - - /* 32-bit random seeds. */ - __asm__ volatile ("rdseed %%eax;" : "=r" (seed)); -@@ -205,6 +211,7 @@ rdseed (void) - __asm__ volatile ("rdseed %%ecx;" : "=r" (seed)); - __asm__ volatile ("rdseed %%edx;" : "=r" (seed)); - -+#ifdef __x86_64__ - __asm__ volatile ("mov %%rdi, %%rax;" : "=r" (seed)); - __asm__ volatile ("rdseed %%edi;" : "=r" (seed)); - __asm__ volatile ("mov %%rax, %%rdi;" : "=r" (seed)); -@@ -260,6 +267,7 @@ rdseed (void) - __asm__ volatile ("rdseed %%r13;" : "=r" (seed)); - __asm__ volatile ("rdseed %%r14;" : "=r" (seed)); - __asm__ volatile ("rdseed %%r15;" : "=r" (seed)); -+#endif - } - - /* Initialize arch-specific bits. */ diff --git a/gdb-testsuite-fix-gdb.ada-big_packed_array.exp-xfail-for-m32.patch b/gdb-testsuite-fix-gdb.ada-big_packed_array.exp-xfail-for-m32.patch new file mode 100644 index 0000000..722b04e --- /dev/null +++ b/gdb-testsuite-fix-gdb.ada-big_packed_array.exp-xfail-for-m32.patch @@ -0,0 +1,53 @@ +[gdb/testsuite] Fix gdb.ada/big_packed_array.exp xfail for -m32 + +With test-case gdb.ada/big_packed_array.exp and target board unix/-m32 I run +into: +... +(gdb) print bad^M +$2 = (0 => 0 , 160)^M +(gdb) FAIL: gdb.ada/big_packed_array.exp: scenario=minimal: print bad +... + +The problem is that while the variable is an array of 196 bits (== 24.5 bytes), +the debug information describes it as 25 unsigned char. This is PR +gcc/101643, and the test-case contains an xfail for this, which catches only: +... +(gdb) print bad^M +$2 = (0 => 0 )^M +... + +Fix this by updating the xfail pattern. + +Tested on x86_64-linux. + +--- + gdb/testsuite/gdb.ada/big_packed_array.exp | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/gdb/testsuite/gdb.ada/big_packed_array.exp b/gdb/testsuite/gdb.ada/big_packed_array.exp +index 32ff0dd3e1c..e62f053166b 100644 +--- a/gdb/testsuite/gdb.ada/big_packed_array.exp ++++ b/gdb/testsuite/gdb.ada/big_packed_array.exp +@@ -43,6 +43,7 @@ foreach_with_prefix scenario {all minimal} { + + set re "= \\(false \\)" + set re_xfail "= \\(0 => 0 \\)" ++ set re_xfail2 "= \\(0 => 0 , ($decimal)\\)" + gdb_test_multiple "print bad" "" { + -re -wrap $re { + pass $gdb_test_name +@@ -54,5 +55,14 @@ foreach_with_prefix scenario {all minimal} { + } + fail $gdb_test_name + } ++ -re -wrap $re_xfail2 { ++ set last $expect_out(1,string) ++ if { $have_xfail && [string is integer $last] \ ++ && [expr ($last & 0xf) == 0] } { ++ # gcc/101643 ++ setup_xfail *-*-* ++ } ++ fail $gdb_test_name ++ } + } + } diff --git a/gdb-testsuite-fix-gdb.arch-amd64-stap-three-arg-disp.s.patch b/gdb-testsuite-fix-gdb.arch-amd64-stap-three-arg-disp.s.patch deleted file mode 100644 index 0dadfdb..0000000 --- a/gdb-testsuite-fix-gdb.arch-amd64-stap-three-arg-disp.s.patch +++ /dev/null @@ -1,71 +0,0 @@ -[gdb/testsuite] Fix gdb.arch/amd64-stap-three-arg-disp.S - -On SLE-11 I ran into: -... -(gdb) print $_probe_arg0^M -Cannot access memory at address 0x8000003fe05c^M -(gdb) FAIL: gdb.arch/amd64-stap-special-operands.exp: probe: three_arg: \ - print $_probe_arg0 -... - -The memory cannot be accessed because the address used to evaluate -$_probe_arg0 at the probe point is incorrect. - -The address is calculated using this expression: -... -.asciz "-4@-4(%rbp,%ebx,0)" -... -which uses $ebx, but $ebx is uninitialized at the probe point. - -The test-case does contain a "movl $0, %ebx" insn to set $ebx to 0, but that -insn is placed after the probe point. We could fix this by moving the insn -to before the probe point. But, $ebx is also a callee-save register, so -normally, if we modify it, we also need to save and restore it, which is -currently not done. This is currently not harmful, because we don't run the -test-case further than the probe point, but it's bound to cause confusion. - -So, fix this instead by using $eax instead in the expression, and moving the -insn setting $eax to 0 to before the probe point. - -gdb/testsuite/ChangeLog: - -2021-01-11 Tom de Vries - - PR testsuite/26968 - * gdb.arch/amd64-stap-three-arg-disp.S: Remove insn modifying $ebx. - Move insn setting $eax to before probe point. - ---- - gdb/testsuite/gdb.arch/amd64-stap-three-arg-disp.S | 5 ++--- - 1 file changed, 2 insertions(+), 3 deletions(-) - -diff --git a/gdb/testsuite/gdb.arch/amd64-stap-three-arg-disp.S b/gdb/testsuite/gdb.arch/amd64-stap-three-arg-disp.S -index cf3856f41e9..17b64048082 100644 ---- a/gdb/testsuite/gdb.arch/amd64-stap-three-arg-disp.S -+++ b/gdb/testsuite/gdb.arch/amd64-stap-three-arg-disp.S -@@ -15,6 +15,7 @@ main: - movl %edi, -20(%rbp) - movq %rsi, -32(%rbp) - movl $10, -4(%rbp) -+ movl $0, %eax - #APP - # 8 "amd64-stap-three-arg-disp.c" 1 - 990: nop -@@ -28,7 +29,7 @@ main: - .8byte 0 - .asciz "test" - .asciz "three_arg" --.asciz "-4@-4(%rbp,%ebx,0)" -+.asciz "-4@-4(%rbp,%eax,0)" - 994: .balign 4 - .popsection - -@@ -45,8 +46,6 @@ _.stapsdt.base: .space 1 - - # 0 "" 2 - #NO_APP -- movl $0, %eax -- movl $0, %ebx - popq %rbp - .cfi_def_cfa 7, 8 - # SUCC: EXIT [100.0%] diff --git a/gdb-testsuite-fix-gdb.base-dcache-flush.exp.patch b/gdb-testsuite-fix-gdb.base-dcache-flush.exp.patch new file mode 100644 index 0000000..777588a --- /dev/null +++ b/gdb-testsuite-fix-gdb.base-dcache-flush.exp.patch @@ -0,0 +1,48 @@ +[gdb/testsuite] Fix gdb.base/dcache-flush.exp + +When running test-case gdb.base/dcache-flush.exp on ubuntu 18.04.5, I run into: +... +(gdb) PASS: gdb.base/dcache-flush.exp: p var2 +info dcache^M +Dcache 4096 lines of 64 bytes each.^M +Contains data for Thread 0x7ffff7fc6b80 (LWP 3551)^M +Line 0: address 0x7fffffffd4c0 [47 hits]^M +Line 1: address 0x7fffffffd500 [31 hits]^M +Line 2: address 0x7fffffffd5c0 [7 hits]^M +Cache state: 3 active lines, 85 hits^M +(gdb) FAIL: gdb.base/dcache-flush.exp: check dcache before flushing +... +The regexp expects "Contains data for process $decimal". + +This is another case of thread_db_target::pid_to_str being used. + +Fix this by updating the regexp. + +Tested on x86_64-linux. + +--- + gdb/testsuite/gdb.base/dcache-flush.exp | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/gdb/testsuite/gdb.base/dcache-flush.exp b/gdb/testsuite/gdb.base/dcache-flush.exp +index 4ac10b9fab1..ff59b2bb7ae 100644 +--- a/gdb/testsuite/gdb.base/dcache-flush.exp ++++ b/gdb/testsuite/gdb.base/dcache-flush.exp +@@ -34,7 +34,7 @@ gdb_test "p var2" " = 3" + gdb_test "info dcache" \ + [multi_line \ + "Dcache $decimal lines of $decimal bytes each." \ +- "Contains data for process $decimal" \ ++ "Contains data for (process $decimal|Thread \[^\r\n\]*)" \ + "Line 0: address $hex \[$decimal hits\].*" \ + "Cache state: $decimal active lines, $decimal hits" ] \ + "check dcache before flushing" +@@ -58,7 +58,7 @@ with_test_prefix "refilling" { + gdb_test "info dcache" \ + [multi_line \ + "Dcache $decimal lines of $decimal bytes each." \ +- "Contains data for process $decimal" \ ++ "Contains data for (process $decimal|Thread \[^\r\n\]*)" \ + "Line 0: address $hex \[$decimal hits\].*" \ + "Cache state: $decimal active lines, $decimal hits" ] \ + "check dcache before refilling" diff --git a/gdb-testsuite-fix-gdb.base-step-over-syscall.exp-with-m32-amd-case.patch b/gdb-testsuite-fix-gdb.base-step-over-syscall.exp-with-m32-amd-case.patch new file mode 100644 index 0000000..5b3cbb9 --- /dev/null +++ b/gdb-testsuite-fix-gdb.base-step-over-syscall.exp-with-m32-amd-case.patch @@ -0,0 +1,71 @@ +[gdb/testsuite] Fix gdb.base/step-over-syscall.exp with -m32, AMD case + +On an OBS machine with openSUSE Leap 15.2 and target board unix/-m32 I run +into: +... +(gdb) x/2i $pc^M +=> 0xf7fd5155 <__kernel_vsyscall+5>: syscall ^M + 0xf7fd5157 <__kernel_vsyscall+7>: int $0x80^M +(gdb) PASS: gdb.base/step-over-syscall.exp: fork: displaced=off: \ + pc before/after syscall instruction +stepi^M +[Detaching after fork from child process 19924]^M +0xf7fd5159 in __kernel_vsyscall ()^M +1: x/i $pc^M +=> 0xf7fd5159 <__kernel_vsyscall+9>: pop %ebp^M +(gdb) PASS: gdb.base/step-over-syscall.exp: fork: displaced=off: stepi fork insn +print /x $pc^M +$2 = 0xf7fd5159^M +(gdb) PASS: gdb.base/step-over-syscall.exp: fork: displaced=off: pc after stepi +FAIL: gdb.base/step-over-syscall.exp: fork: displaced=off: \ + pc after stepi matches insn addr a +fter syscall +... + +This is essentially a duplicate of the problem solved by commit 14852123287 +"[gdb/testsuite] Fix gdb.base/step-over-syscall.exp with -m32", only here the +insn before "int $0x80" is syscall instead of sysenter. + +The background here is that we're executing this code in the linux kernel +(from ./arch/x86/entry/vdso/vdso32/system_call.S): +... + #define SYSENTER_SEQUENCE "movl %esp, %ebp; sysenter" + #define SYSCALL_SEQUENCE "movl %ecx, %ebp; syscall" + + /* If SYSENTER (Intel) or SYSCALL32 (AMD) is available, use it. */ + ALTERNATIVE_2 "", SYSENTER_SEQUENCE, X86_FEATURE_SYSENTER32, \ + SYSCALL_SEQUENCE, X86_FEATURE_SYSCALL32 + ALTERNATIVE "", SYSENTER_SEQUENCE, X86_FEATURE_SEP +... +and depending on the active feature, we either have sysenter or syscall. + +Fix this by recognizing the "syscall", "int $0x80" sequence. + +Tested on x86_64-linux. + +--- + gdb/testsuite/gdb.base/step-over-syscall.exp | 9 +++++---- + 1 file changed, 5 insertions(+), 4 deletions(-) + +diff --git a/gdb/testsuite/gdb.base/step-over-syscall.exp b/gdb/testsuite/gdb.base/step-over-syscall.exp +index ecfb7be481d..a4821d7cd5a 100644 +--- a/gdb/testsuite/gdb.base/step-over-syscall.exp ++++ b/gdb/testsuite/gdb.base/step-over-syscall.exp +@@ -162,12 +162,13 @@ proc setup { syscall } { + } + + # If we encounter a sequence: +- # 0xf7fd5155 <__kernel_vsyscall+5>: sysenter ++ # 0xf7fd5155 <__kernel_vsyscall+5>: sysenter / syscall + # 0xf7fd5157 <__kernel_vsyscall+7>: int $0x80 + # 0xf7fd5159 <__kernel_vsyscall+9>: pop %ebp +- # then a stepi at sysenter will step over the int insn, so make sure +- # next_insn_addr points after the int insn. +- if { $actual_syscall_insn == "sysenter" } { ++ # then a stepi at sysenter/syscall will step over the int insn, ++ # so make sure next_insn_addr points after the int insn. ++ if { $actual_syscall_insn == "sysenter" ++ || $actual_syscall_insn == "syscall" } { + set test "pc after sysenter instruction" + set re_int_insn "\[ \t\]*int\[ \t\]\[^\r\n\]*" + set re [multi_line \ diff --git a/gdb-testsuite-fix-gdb.gdb-selftest.exp.patch b/gdb-testsuite-fix-gdb.gdb-selftest.exp.patch new file mode 100644 index 0000000..2ef35ea --- /dev/null +++ b/gdb-testsuite-fix-gdb.gdb-selftest.exp.patch @@ -0,0 +1,44 @@ +[gdb/testsuite] Fix gdb.gdb/selftest.exp + +With a gdb build with CFLAGS "-O2 -g -flto=auto", I run into: +... + #7 gdb_main (args=0x7fffffffd220) at src/gdb/main.c:1368^M + #8 main (argc=, argv=) at src/gdb/gdb.c:32^M + (gdb) FAIL: gdb.gdb/selftest.exp: backtrace through signal handler +... +which means that this regexp in proc test_with_self fails: +... + -re "#0.*(read|poll).*in main \\(.*\\) at .*gdb\\.c.*$gdb_prompt $" { +... + +The problem is that gdb_main has been inlined into main, and consequently the +backtrace uses: +... + #x ... +... +instead of +... + #x
in ... +... + +Fix this by updating the regexp to not require "in" before " main". + +Tested on x86_64-linux. + +--- + gdb/testsuite/gdb.gdb/selftest.exp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/gdb/testsuite/gdb.gdb/selftest.exp b/gdb/testsuite/gdb.gdb/selftest.exp +index bee3010bca1..35b06e53e90 100644 +--- a/gdb/testsuite/gdb.gdb/selftest.exp ++++ b/gdb/testsuite/gdb.gdb/selftest.exp +@@ -143,7 +143,7 @@ proc test_with_self { } { + setup_xfail "i*86-pc-linuxaout-gnu" + set description "backtrace through signal handler" + gdb_test_multiple "backtrace" "$description" { +- -re "#0.*(read|poll).*in main \\(.*\\) at .*gdb\\.c.*$gdb_prompt $" { ++ -re "#0.*(read|poll).* main \\(.*\\) at .*gdb\\.c.*$gdb_prompt $" { + pass "$description" + } + } diff --git a/gdb-testsuite-fix-gdb.python-py-events.exp.patch b/gdb-testsuite-fix-gdb.python-py-events.exp.patch new file mode 100644 index 0000000..d8e0bf9 --- /dev/null +++ b/gdb-testsuite-fix-gdb.python-py-events.exp.patch @@ -0,0 +1,50 @@ +[gdb/testsuite] Fix gdb.python/py-events.exp + +With test-case gdb.python/py-events.exp on ubuntu 18.04.5 we run into: +... +(gdb) info threads^M + Id Target Id Frame ^M +* 1 Thread 0x7ffff7fc3740 (LWP 31467) "py-events" do_nothing () at \ + src/gdb/testsuite/gdb.python/py-events-shlib.c:19^M +(gdb) FAIL: gdb.python/py-events.exp: get current thread +... + +The info thread commands uses "Thread" instead of "process" because +libpthread is already loaded: +... +new objfile name: /lib/x86_64-linux-gnu/libdl.so.2^M +[Thread debugging using libthread_db enabled]^M +Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".^M +event type: new_objfile^M +new objfile name: /lib/x86_64-linux-gnu/libpthread.so.0^M +... +and consequently thread_db_target::pid_to_str is used. + +Fix this by parsing the "Thread" expression. + +Tested on x86_64-linux. + +--- + gdb/testsuite/gdb.python/py-events.exp | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/gdb/testsuite/gdb.python/py-events.exp b/gdb/testsuite/gdb.python/py-events.exp +index 753709361f5..d6dc9fd4252 100644 +--- a/gdb/testsuite/gdb.python/py-events.exp ++++ b/gdb/testsuite/gdb.python/py-events.exp +@@ -82,9 +82,13 @@ delete_breakpoints + # Test inferior call events + + gdb_test_multiple "info threads" "get current thread" { +- -re "\[^\n\r\]*process (\[0-9\]+)\[^\n\r\]*do_nothing.*$gdb_prompt $" { ++ -re -wrap "process ($decimal)\[^\n\r\]*do_nothing.*" { + set process_id $expect_out(1,string) +- pass "get current thread" ++ pass $gdb_test_name ++ } ++ -re -wrap "Thread $hex \\(LWP ($decimal)\\)\[^\n\r\]*do_nothing.*" { ++ set process_id $expect_out(1,string) ++ pass $gdb_test_name + } + } + diff --git a/gdb-testsuite-fix-gdb.server-server-kill.exp-with-m32.patch b/gdb-testsuite-fix-gdb.server-server-kill.exp-with-m32.patch new file mode 100644 index 0000000..7bf3c7b --- /dev/null +++ b/gdb-testsuite-fix-gdb.server-server-kill.exp-with-m32.patch @@ -0,0 +1,51 @@ +[gdb/testsuite] Fix gdb.server/server-kill.exp with -m32 + +When running test-case gdb.server/server-kill.exp with target board unix/-m32, +I run into: +... +0xf7fd6b20 in _start () from /lib/ld-linux.so.2^M +(gdb) Executing on target: kill -9 13082 (timeout = 300) +builtin_spawn -ignore SIGHUP kill -9 13082^M +bt^M +(gdb) FAIL: gdb.server/server-kill.exp: kill_pid_of=server: test_unwind_syms: bt +... + +The test-case expects the backtrace command to trigger remote communication, +which then should result in a "Remote connection closed" or similar. + +However, no remote communication is triggered, because we hit the "Check that +this frame is unwindable" case in get_prev_frame_always_1. + +We don't hit this problem in the kill_pid_of=inferior case, because there we +run to main before doing the backtrace. + +Fix this by doing the same in the kill_pid_of=server case. + +Tested on x86_64-linux. + +--- + gdb/testsuite/gdb.server/server-kill.exp | 10 ++++++---- + 1 file changed, 6 insertions(+), 4 deletions(-) + +diff --git a/gdb/testsuite/gdb.server/server-kill.exp b/gdb/testsuite/gdb.server/server-kill.exp +index 655821cc6f9..4125e5bf92d 100644 +--- a/gdb/testsuite/gdb.server/server-kill.exp ++++ b/gdb/testsuite/gdb.server/server-kill.exp +@@ -69,11 +69,13 @@ proc prepare {} { + + gdbserver_run "" + +- if { $::kill_pid_of == "inferior" } { +- # Continue past server_pid assignment. +- gdb_breakpoint ${srcfile}:[gdb_get_line_number "i = 0;"] +- gdb_continue_to_breakpoint "after server_pid assignment" ++ # Continue past server_pid assignment. We do this for both scenarios, ++ # to avoid doing a backtrace from _start, which may not trigger remote ++ # communication. ++ gdb_breakpoint ${srcfile}:[gdb_get_line_number "i = 0;"] ++ gdb_continue_to_breakpoint "after server_pid assignment" + ++ if { $::kill_pid_of == "inferior" } { + # Get the pid of GDBServer. + set test "p server_pid" + set server_pid 0 diff --git a/gdb-testsuite-fix-gdb.threads-check-libthread-db.exp-with-glibc-2.34.patch b/gdb-testsuite-fix-gdb.threads-check-libthread-db.exp-with-glibc-2.34.patch new file mode 100644 index 0000000..c763826 --- /dev/null +++ b/gdb-testsuite-fix-gdb.threads-check-libthread-db.exp-with-glibc-2.34.patch @@ -0,0 +1,49 @@ +[gdb/testsuite] Fix gdb.threads/check-libthread-db.exp with glibc 2.34 + +When running test-case gdb.threads/check-libthread-db.exp on openSUSE +Tumbleweed (with glibc 2.34) I get: +... +(gdb) continue^M +Continuing.^M +[Thread debugging using libthread_db enabled]^M +Using host libthread_db library "/lib64/libthread_db.so.1".^M +Stopped due to shared library event:^M + Inferior loaded /lib64/libm.so.6^M + /lib64/libc.so.6^M +(gdb) FAIL: gdb.threads/check-libthread-db.exp: user-initiated check: continue +... + +The check expect the inferior to load libpthread, but since glibc 2.34 +libpthread has been integrated into glibc, and consequently it's no longer +a dependency: +... +$ ldd outputs/gdb.threads/check-libthread-db/check-libthread-db + linux-vdso.so.1 (0x00007ffe4cae4000) + libm.so.6 => /lib64/libm.so.6 (0x00007f167c77c000) + libc.so.6 => /lib64/libc.so.6 (0x00007f167c572000) + /lib64/ld-linux-x86-64.so.2 (0x00007f167c86e000) +... + +Fix this by updating the regexp to expect libpthread or libc. + +Tested on x86_64-linux. + +--- + gdb/testsuite/gdb.threads/check-libthread-db.exp | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/gdb/testsuite/gdb.threads/check-libthread-db.exp b/gdb/testsuite/gdb.threads/check-libthread-db.exp +index 6ecf40db6a9..423c29978c8 100644 +--- a/gdb/testsuite/gdb.threads/check-libthread-db.exp ++++ b/gdb/testsuite/gdb.threads/check-libthread-db.exp +@@ -58,7 +58,9 @@ with_test_prefix "user-initiated check" { + + # User-initiated check with NPTL possibly uninitialized. + gdb_test "continue" \ +- ".*Stopped due to shared library event.*Inferior loaded .*libpthread.*" ++ [multi_line \ ++ "Stopped due to shared library event:" \ ++ " Inferior loaded .*(libpthread|libc).*"] + + gdb_test_sequence "maint check libthread-db" \ + "libpthread.so possibly not initialized" \ diff --git a/gdb-testsuite-fix-gdb.threads-linux-dp.exp.patch b/gdb-testsuite-fix-gdb.threads-linux-dp.exp.patch new file mode 100644 index 0000000..2234630 --- /dev/null +++ b/gdb-testsuite-fix-gdb.threads-linux-dp.exp.patch @@ -0,0 +1,53 @@ +[gdb/testsuite] Fix gdb.threads/linux-dp.exp + +On openSUSE Tumbleweed with glibc-debuginfo installed I get: +... + (gdb) PASS: gdb.threads/linux-dp.exp: continue to breakpoint: thread 5's print + where^M + #0 print_philosopher (n=3, left=33 '!', right=33 '!') at linux-dp.c:105^M + #1 0x0000000000401628 in philosopher (data=0x40537c) at linux-dp.c:148^M + #2 0x00007ffff7d56b37 in start_thread (arg=) \ + at pthread_create.c:435^M + #3 0x00007ffff7ddb640 in clone3 () \ + at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81^M + (gdb) PASS: gdb.threads/linux-dp.exp: first thread-specific breakpoint hit +... +while without debuginfo installed I get instead: +... + (gdb) PASS: gdb.threads/linux-dp.exp: continue to breakpoint: thread 5's print + where^M + #0 print_philosopher (n=3, left=33 '!', right=33 '!') at linux-dp.c:105^M + #1 0x0000000000401628 in philosopher (data=0x40537c) at linux-dp.c:148^M + #2 0x00007ffff7d56b37 in start_thread () from /lib64/libc.so.6^M + #3 0x00007ffff7ddb640 in clone3 () from /lib64/libc.so.6^M + (gdb) FAIL: gdb.threads/linux-dp.exp: first thread-specific breakpoint hit +... + +The problem is that the regexp used: +... + "\(from .*libpthread\|at pthread_create\|in pthread_create\)" +... +expects the 'from' part to match libpthread, but in glibc 2.34 libpthread has +been merged into libc. + +Fix this by updating the regexp. + +Tested on x86_64-linux. + +--- + gdb/testsuite/gdb.threads/linux-dp.exp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/gdb/testsuite/gdb.threads/linux-dp.exp b/gdb/testsuite/gdb.threads/linux-dp.exp +index 099971dca39..b01e87fa9ea 100644 +--- a/gdb/testsuite/gdb.threads/linux-dp.exp ++++ b/gdb/testsuite/gdb.threads/linux-dp.exp +@@ -226,7 +226,7 @@ gdb_continue_to_breakpoint "thread 5's print" + # If you do have debug info, the output obviously depends more on the + # exact library in use; under NPTL, you get: + # #2 0x0012b7fc in start_thread (arg=0x21) at pthread_create.c:264 +-gdb_test "where" "print_philosopher.*philosopher.* \(from .*libpthread\|at pthread_create\|in pthread_create\).*" \ ++gdb_test "where" "print_philosopher.*philosopher.* \(from .*libpthread\|at pthread_create\|in pthread_create|from .*libc\\.\).*" \ + "first thread-specific breakpoint hit" + + # Make sure it's catching the right thread. Try hitting the diff --git a/gdb-testsuite-fix-port-detection-in-gdb.debuginfod-fetch_src_and_symbols.exp.patch b/gdb-testsuite-fix-port-detection-in-gdb.debuginfod-fetch_src_and_symbols.exp.patch new file mode 100644 index 0000000..5f63a9d --- /dev/null +++ b/gdb-testsuite-fix-port-detection-in-gdb.debuginfod-fetch_src_and_symbols.exp.patch @@ -0,0 +1,52 @@ +[gdb/testsuite] Fix port detection in gdb.debuginfod/fetch_src_and_symbols.exp + +On OBS I ran into this failure with test-case +gdb.debuginfod/fetch_src_and_symbols.exp: +... +Failed to listen for connections: Address already in use^M +[Thu Oct 21 11:48:49 2021] (559/559): started http server on IPv6 port=8000^M + ... +FAIL: gdb.debuginfod/fetch_src_and_symbols.exp: local_url: find port timeout +... + +The test-case is trying to start debuginfod on a port to see if it's +available, and it handles either this message: + "started http server on IPv4 IPv6 port=$port" +meaning success, or: + "failed to bind to port" +meaning failure, in which case the debuginfod instance is killed, and we try +the next port. + +The test-case only uses the v4 address 127.0.0.1, so fix this by: +- accepting "started http server on IPv4 port=$port" +- rejecting "started http server on IPv6 port=$port" + +Tested on x86_64-linux. + +--- + gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.exp | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.exp b/gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.exp +index 81d4791eb6d..bb0c0c7ff29 100644 +--- a/gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.exp ++++ b/gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.exp +@@ -180,12 +180,17 @@ proc local_url { } { + spawn debuginfod -vvvv -d $db -p $port -F $debugdir + expect { + "started http server on IPv4 IPv6 port=$port" { set found 1 } +- "failed to bind to port" { kill_wait_spawned_process $spawn_id } ++ "started http server on IPv4 port=$port" { set found 1 } ++ "started http server on IPv6 port=$port" {} ++ "failed to bind to port" {} + timeout { + fail "find port timeout" + return -1 + } + } ++ if { ! $found } { ++ kill_wait_spawned_process $spawn_id ++ } + } + + set metrics [list "ready 1" \ diff --git a/gdb-testsuite-fix-race-in-gdb.threads-detach-step-over.exp.patch b/gdb-testsuite-fix-race-in-gdb.threads-detach-step-over.exp.patch new file mode 100644 index 0000000..a8ec0d6 --- /dev/null +++ b/gdb-testsuite-fix-race-in-gdb.threads-detach-step-over.exp.patch @@ -0,0 +1,72 @@ +[gdb/testsuite] Fix race in gdb.threads/detach-step-over.exp + +On OBS with openSUSE Leap 15.2 and target board unix/m32, I run into: +... +FAIL: gdb.threads/detach-step-over.exp: \ + breakpoint-condition-evaluation=host: target-non-stop=off: non-stop=off: \ + displaced=off: iter 1: all threads running +... + +I can easily reproduce this by doing: +... + + # Wait a bit, to give time for the threads to hit the + # breakpoint. +- sleep 1 + + set running_count 0 + set interrupted 0 +... + +Fix this by counting the running threads in a loop. + +Tested on x86_64-linux. + +--- + gdb/testsuite/gdb.threads/detach-step-over.exp | 24 ++++++++++++++++++++++-- + 1 file changed, 22 insertions(+), 2 deletions(-) + +diff --git a/gdb/testsuite/gdb.threads/detach-step-over.exp b/gdb/testsuite/gdb.threads/detach-step-over.exp +index 27718551188..9c5f98efeef 100644 +--- a/gdb/testsuite/gdb.threads/detach-step-over.exp ++++ b/gdb/testsuite/gdb.threads/detach-step-over.exp +@@ -203,7 +203,8 @@ proc test {condition_eval target_non_stop non_stop displaced} { + + set running_count 0 + set interrupted 0 +- gdb_test_multiple "info threads" "all threads running" { ++ set running_expected [expr ($n_threads + 1) * 2] ++ gdb_test_multiple "info threads" "threads running" { + -re "\\(running\\)" { + incr running_count + exp_continue +@@ -225,9 +226,28 @@ proc test {condition_eval target_non_stop non_stop displaced} { + } + } + -re "$gdb_prompt $" { +- gdb_assert {$running_count == ($n_threads + 1) * 2} $gdb_test_name + } + } ++ if { $interrupted == 0 } { ++ while { $running_count < $running_expected } { ++ sleep 1 ++ set prev_running_count $running_count ++ set running_count 0 ++ gdb_test_multiple "info threads" "threads running" { ++ -re "\\(running\\)" { ++ incr running_count ++ exp_continue ++ } ++ -re "$gdb_prompt $" { ++ } ++ } ++ if { $running_count == $prev_running_count } { ++ break ++ } ++ } ++ gdb_assert {$running_count == $running_expected} \ ++ "all threads running" ++ } + + gdb_test "detach" "Detaching from.*" + diff --git a/gdb-testsuite-fix-unset-of-debuginfod_urls-in-default_gdb_init.patch b/gdb-testsuite-fix-unset-of-debuginfod_urls-in-default_gdb_init.patch deleted file mode 100644 index 9e78d09..0000000 --- a/gdb-testsuite-fix-unset-of-debuginfod_urls-in-default_gdb_init.patch +++ /dev/null @@ -1,33 +0,0 @@ -[gdb/testsuite] Fix unset of DEBUGINFOD_URLS in default_gdb_init - -In commit cfcbd506fb0 "[gdb/testsuite] Ignore DEBUGINFOD_URLS" I added -unsetting of env(DEBUGINFOD_URLS), but it doesn't work because I forgot to -add :: in front. - -Fix this, and rewrite using "unset -nocomplain" instead of unsetenv, which -allows us to drop the "info exists" test. - -2021-04-01 Tom de Vries - - * lib/gdb.exp (default_gdb_init): Use ::env. Use unset - -nocomplain ::env(V) instead of unsetenv V. - ---- - gdb/testsuite/lib/gdb.exp | 4 +--- - 1 file changed, 1 insertion(+), 3 deletions(-) - -diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp -index 6b0bc8c0af5..ee7358e7673 100644 ---- a/gdb/testsuite/lib/gdb.exp -+++ b/gdb/testsuite/lib/gdb.exp -@@ -5082,9 +5082,7 @@ proc default_gdb_init { test_file_name } { - - # If DEBUGINFOD_URLS is set, gdb will try to download sources and - # debug info for f.i. system libraries. Prevent this. -- if { [info exists env(DEBUGINFOD_URLS)] } { -- unsetenv DEBUGINFOD_URLS -- } -+ unset -nocomplain ::env(DEBUGINFOD_URLS) - - # Ensure that GDBHISTFILE and GDBHISTSIZE are removed from the - # environment, we don't want these modifications to the history diff --git a/gdb-testsuite-fix-xfail-handling-in-gdb.threads-gcore-thread.exp.patch b/gdb-testsuite-fix-xfail-handling-in-gdb.threads-gcore-thread.exp.patch deleted file mode 100644 index d249880..0000000 --- a/gdb-testsuite-fix-xfail-handling-in-gdb.threads-gcore-thread.exp.patch +++ /dev/null @@ -1,80 +0,0 @@ -[gdb/testsuite] Fix xfail handling in gdb.threads/gcore-thread.exp - -When running test-case gdb.threads/gcore-thread.exp on openSUSE Tumbleweed, -I run into these XFAILs: -... -XFAIL: gdb.threads/gcore-thread.exp: clear __stack_user.next -XFAIL: gdb.threads/gcore-thread.exp: clear stack_used.next -... - -Apart from the xfail, the test-case also sets core0file to "": -... - -re "No symbol \"${symbol}\" in current context\\.\r\n$gdb_prompt $" { - xfail $test - # Do not do the verification. - set core0file "" - } -... - -After which we run into this FAIL, because gdb_core_cmd fails to load a -core file called "": -... -(gdb) core ^M -No core file now.^M -(gdb) FAIL: gdb.threads/gcore-thread.exp: core0file: \ - re-load generated corefile -... - -Fix this FAIL by skipping gdb_core_cmd if the core file is "". - -Tested on x86_64-linux. - -gdb/testsuite/ChangeLog: - -2021-04-06 Tom de Vries - - PR testsuite/27691 - * gdb.threads/gcore-thread.exp: Don't call gdb_core_cmd with core - file "". - ---- - gdb/testsuite/gdb.threads/gcore-thread.exp | 20 ++++++++++++++++---- - 1 file changed, 16 insertions(+), 4 deletions(-) - -diff --git a/gdb/testsuite/gdb.threads/gcore-thread.exp b/gdb/testsuite/gdb.threads/gcore-thread.exp -index 942bfb127b8..1bdeff1d460 100644 ---- a/gdb/testsuite/gdb.threads/gcore-thread.exp -+++ b/gdb/testsuite/gdb.threads/gcore-thread.exp -@@ -114,11 +114,13 @@ if {"$core0file" != ""} { - # Now restart gdb and load the corefile. - clean_restart ${testfile} - --foreach name { corefile core0file } { with_test_prefix $name { -- set core_loaded [gdb_core_cmd [subst $$name] "re-load generated corefile"] -+proc load_core { filename } { -+ global horiz nl -+ -+ set core_loaded [gdb_core_cmd $filename "re-load generated corefile"] - if { $core_loaded == -1 } { - # No use proceeding from here. -- continue -+ return - } - - # FIXME: now what can we test about the thread state? -@@ -139,4 +141,14 @@ foreach name { corefile core0file } { with_test_prefix $name { - - gdb_test "info threads" "\\* ${horiz} thread2 .*${nl}" \ - "thread2 is current thread in corefile" --}} -+} -+ -+foreach name { corefile core0file } { -+ set filename [subst $$name] -+ if { $filename == "" } { -+ continue -+ } -+ with_test_prefix $name { -+ load_core $filename -+ } -+} diff --git a/gdb-testsuite-gdb-base-morestack-exp-no-clang.patch b/gdb-testsuite-gdb-base-morestack-exp-no-clang.patch deleted file mode 100644 index c979e17..0000000 --- a/gdb-testsuite-gdb-base-morestack-exp-no-clang.patch +++ /dev/null @@ -1,43 +0,0 @@ -diff --git a/gdb/testsuite/gdb.base/morestack.c b/gdb/testsuite/gdb.base/morestack.c -index 1cc33df29c9..63c3e23c903 100644 ---- a/gdb/testsuite/gdb.base/morestack.c -+++ b/gdb/testsuite/gdb.base/morestack.c -@@ -22,7 +22,6 @@ - #include - #include - #include --#include - #include - - /* Use a noinline function to ensure that the buffer is not removed -@@ -63,7 +62,6 @@ down (int i) - - if (last && last < (void *) buf) - { -- printf ("%d: %p < %p\n", i, last, buf); - marker_hit (); - } - last = buf; -diff --git a/gdb/testsuite/gdb.base/morestack.exp b/gdb/testsuite/gdb.base/morestack.exp -index 95ec9adc62b..bdbb9870c57 100644 ---- a/gdb/testsuite/gdb.base/morestack.exp -+++ b/gdb/testsuite/gdb.base/morestack.exp -@@ -21,17 +21,13 @@ if {$gcc_compiled == 0} { - return -1 - } - --if { [have_fuse_ld_gold] == 0} { -- return -1 --} -- - standard_testfile - - # -fuse-ld=gold is used for calling printf code built without -fsplit-stack - # which could crash otherwise. See GCC documentation of -fsplit-stack. - set opts "additional_flags=-fsplit-stack" - if { [prepare_for_testing "failed to prepare" ${testfile} $srcfile \ -- [list $opts additional_flags=-fuse-ld=gold]] } { -+ [list $opts]] } { - return -1 - } - diff --git a/gdb-testsuite-gdb-tui-new-layout-exp-partly-require-tcl86.patch b/gdb-testsuite-gdb-tui-new-layout-exp-partly-require-tcl86.patch deleted file mode 100644 index 7651700..0000000 --- a/gdb-testsuite-gdb-tui-new-layout-exp-partly-require-tcl86.patch +++ /dev/null @@ -1,25 +0,0 @@ -Index: gdb-10.1/gdb/testsuite/gdb.tui/new-layout.exp -=================================================================== ---- gdb-10.1.orig/gdb/testsuite/gdb.tui/new-layout.exp -+++ gdb-10.1/gdb/testsuite/gdb.tui/new-layout.exp -@@ -42,12 +42,14 @@ gdb_test "tui new-layout example src 1 s - "Window \"src\" seen twice in layout" - gdb_test "tui new-layout example src 1" \ - "New layout does not contain the \"cmd\" window" --gdb_test "tui new-layout example src 1}" \ -- "Extra '}' in layout specification" --gdb_test "tui new-layout example {src 1} 1}" \ -- "Extra '}' in layout specification" --gdb_test "tui new-layout example {src 1" \ -- "Missing '}' in layout specification" -+if { [tcl_version_at_least 8 6] } { -+ gdb_test "tui new-layout example src 1\}" \ -+ "Extra '\}' in layout specification" -+ gdb_test "tui new-layout example {src 1} 1\}" \ -+ "Extra '\}' in layout specification" -+ gdb_test "tui new-layout example \{src 1" \ -+ "Missing '\}' in layout specification" -+} - - gdb_test_no_output "tui new-layout example asm 1 status 0 cmd 1" - diff --git a/gdb-testsuite-handle-recursive-internal-problem-in-gdb_internal_error_resync.patch b/gdb-testsuite-handle-recursive-internal-problem-in-gdb_internal_error_resync.patch new file mode 100644 index 0000000..c4c8838 --- /dev/null +++ b/gdb-testsuite-handle-recursive-internal-problem-in-gdb_internal_error_resync.patch @@ -0,0 +1,68 @@ +[gdb/testsuite] Handle recursive internal problem in gdb_internal_error_resync + +I came across this problem when testing gdb.base/gdb-sigterm.exp +on a machine with a pre-release version of glib-2.34 installed: + +A problem internal to GDB has been detected, +further debugging may prove unreliable. +Quit this debugging session? (y or n) Recursive internal problem. +FAIL: gdb.base/gdb-sigterm.exp: expect eof #0 (GDB internal error) +Resyncing due to internal error. +ERROR: : spawn id exp11 not open + while executing +"expect { +-i exp11 -timeout 10 + -re "Quit this debugging session\\? \\(y or n\\) $" { + send_gdb "n\n" answer + incr count + } + -re "Create..." + ("uplevel" body line 1) + invoked from within +"uplevel $body" NONE : spawn id exp11 not open +ERROR: Could not resync from internal error (timeout) +gdb.base/gdb-sigterm.exp: expect eof #0: stepped 9 times +UNRESOLVED: gdb.base/gdb-sigterm.exp: 50 SIGTERM passes + +I don't have a problem with the latter ERROR nor the UNRESOLVED +messages. However the first ERROR regarding the exp11 spawn id +not being open is not especially useful. + +This commit handles the "Recursive internal problem" case, avoiding +the problematic ERROR shown above. + +With this commit in place, the log messages look like this instead: + +A problem internal to GDB has been detected, +further debugging may prove unreliable. +Quit this debugging session? (y or n) Recursive internal problem. +FAIL: gdb.base/gdb-sigterm.exp: expect eof #15 (GDB internal error) +Resyncing due to internal error. +ERROR: Could not resync from internal error (recursive internal problem) +gdb.base/gdb-sigterm.exp: expect eof #15: stepped 12 times +UNRESOLVED: gdb.base/gdb-sigterm.exp: 50 SIGTERM passes + +gdb/testsuite/ChangeLog: + + * lib/gdb.exp (gdb_internal_error_resync): Handle "Recursive + internal problem". + +--- + gdb/testsuite/lib/gdb.exp | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp +index dbf4016aca1..7a8332dd573 100644 +--- a/gdb/testsuite/lib/gdb.exp ++++ b/gdb/testsuite/lib/gdb.exp +@@ -756,6 +756,10 @@ proc gdb_internal_error_resync {} { + set count 0 + while {$count < 10} { + gdb_expect { ++ -re "Recursive internal problem\\." { ++ perror "Could not resync from internal error (recursive internal problem)" ++ return 0 ++ } + -re "Quit this debugging session\\? \\(y or n\\) $" { + send_gdb "n\n" answer + incr count diff --git a/gdb-testsuite-handle-runto-fail-in-gdb.mi-mi-var-cp.exp.patch b/gdb-testsuite-handle-runto-fail-in-gdb.mi-mi-var-cp.exp.patch new file mode 100644 index 0000000..cc54b46 --- /dev/null +++ b/gdb-testsuite-handle-runto-fail-in-gdb.mi-mi-var-cp.exp.patch @@ -0,0 +1,164 @@ +[gdb/testsuite] Handle runto fail in gdb.mi/mi-var-cp.exp + +On OBS I ran into: +... +PASS: gdb.mi/mi-var-cp.exp: run to mi-var-cp.cc:81 (set breakpoint) +UNRESOLVED: gdb.mi/mi-var-cp.exp: unable to start target +... +followed by 81 FAILs and two more UNRESOLVEDs. + +I didn't manage to reproduce this, but I did notice that the initial +problem causing the UNRESOLVED caused all subsequent UNRESOLVEDs and FAILs. + +I emulated the problem by commenting out the send_gdb "run\n" in +mi_run_cmd_full. + +Fix this by: +- handling mi_run_cmd failure in mi_get_inline_test +- handling mi_run_inline_test failure in gdb.mi/mi-var-cp.exp, and + other test-cases using mi_get_inline_test + +Tested on x86_64-linux. + +--- + gdb/testsuite/gdb.mi/mi-var-child.exp | 4 +++- + gdb/testsuite/gdb.mi/mi-var-cmd.exp | 18 ++++++++++++++---- + gdb/testsuite/gdb.mi/mi-var-cp.exp | 18 +++++++++++++----- + gdb/testsuite/gdb.mi/mi-var-rtti.exp | 22 +++++++++++++++------- + gdb/testsuite/lib/mi-support.exp | 6 +++++- + 5 files changed, 50 insertions(+), 18 deletions(-) + +diff --git a/gdb/testsuite/gdb.mi/mi-var-child.exp b/gdb/testsuite/gdb.mi/mi-var-child.exp +index 8632fe26cf8..63cea065c3f 100644 +--- a/gdb/testsuite/gdb.mi/mi-var-child.exp ++++ b/gdb/testsuite/gdb.mi/mi-var-child.exp +@@ -1205,7 +1205,9 @@ mi_varobj_update * {psnp->ptrs.0.next.next.long_ptr} \ + + mi_prepare_inline_tests $srcfile + +-mi_run_inline_test child_deletion ++if { [mi_run_inline_test child_deletion] < 0 } { ++ return -1 ++} + + + mi_gdb_exit +diff --git a/gdb/testsuite/gdb.mi/mi-var-cmd.exp b/gdb/testsuite/gdb.mi/mi-var-cmd.exp +index fe0826d480d..fbf57aa25ac 100644 +--- a/gdb/testsuite/gdb.mi/mi-var-cmd.exp ++++ b/gdb/testsuite/gdb.mi/mi-var-cmd.exp +@@ -587,14 +587,24 @@ proc set_frozen {varobjs flag} { + } + + mi_prepare_inline_tests $srcfile +-mi_run_inline_test frozen + +-mi_run_inline_test bitfield ++set inline_tests { ++ frozen ++ bitfield ++} ++ ++# Needs to be last, following tests rely on this. ++lappend inline_tests floating ++ ++foreach inline_test $inline_tests { ++ if { [mi_run_inline_test $inline_test] < 0 } { ++ return -1 ++ } ++} + + # Since the inline test framework does not really work with +-# function calls, first to inline tests and then do the reminder ++# function calls, first to inline tests and then do the remainder + # manually. +-mi_run_inline_test floating + set do_at_tests_callee_breakpoint [gdb_get_line_number "breakpoint inside callee"] + mi_gdb_test "-break-insert var-cmd.c:$do_at_tests_callee_breakpoint" ".*" \ + "inside breakpoint inside callee" +diff --git a/gdb/testsuite/gdb.mi/mi-var-cp.exp b/gdb/testsuite/gdb.mi/mi-var-cp.exp +index 4e8abe8d961..8fdd0f863a7 100644 +--- a/gdb/testsuite/gdb.mi/mi-var-cp.exp ++++ b/gdb/testsuite/gdb.mi/mi-var-cp.exp +@@ -38,11 +38,19 @@ mi_gdb_load ${binfile} + + mi_prepare_inline_tests $srcfile + +-mi_run_inline_test reference_update +-mi_run_inline_test base_in_reference +-mi_run_inline_test reference_to_pointer +-mi_run_inline_test reference_to_struct +-mi_run_inline_test path_expression ++set inline_tests { ++ reference_update ++ base_in_reference ++ reference_to_pointer ++ reference_to_struct ++ path_expression ++} ++ ++foreach inline_test $inline_tests { ++ if { [mi_run_inline_test $inline_test] < 0 } { ++ return -1 ++ } ++} + + set lineno [gdb_get_line_number "/* anonymous_structs_and_unions */"] + mi_create_breakpoint "$srcfile:$lineno" \ +diff --git a/gdb/testsuite/gdb.mi/mi-var-rtti.exp b/gdb/testsuite/gdb.mi/mi-var-rtti.exp +index b574e5c4edb..a0a2e132aaf 100644 +--- a/gdb/testsuite/gdb.mi/mi-var-rtti.exp ++++ b/gdb/testsuite/gdb.mi/mi-var-rtti.exp +@@ -109,13 +109,21 @@ proc check_new_derived_with_rtti {var_name var_type testname} { + "delete varobj for ${var_name} (with RTTI) in $testname" + } + +-mi_run_inline_test use_rtti_for_ptr +-mi_run_inline_test use_rtti_for_ref +-mi_run_inline_test use_rtti_for_ptr_child +-mi_run_inline_test use_rtti_for_ref_child +-mi_run_inline_test use_rtti_with_multiple_inheritence +-mi_run_inline_test type_update_when_use_rtti +-mi_run_inline_test skip_type_update_when_not_use_rtti ++set inline_tests { ++ use_rtti_for_ptr ++ use_rtti_for_ref ++ use_rtti_for_ptr_child ++ use_rtti_for_ref_child ++ use_rtti_with_multiple_inheritence ++ type_update_when_use_rtti ++ skip_type_update_when_not_use_rtti ++} ++ ++foreach inline_test $inline_tests { ++ if { [mi_run_inline_test $inline_test] < 0 } { ++ return -1 ++ } ++} + + mi_gdb_exit + return 0 +diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp +index 288c651d4d4..28e23b11005 100644 +--- a/gdb/testsuite/lib/mi-support.exp ++++ b/gdb/testsuite/lib/mi-support.exp +@@ -1945,7 +1945,9 @@ proc mi_run_inline_test { testcase } { + if {$first==1} { + # Start the program afresh. + mi_tbreak "$mi_autotest_source:$line" +- mi_run_cmd ++ if { [mi_run_cmd] < 0 } { ++ return -1 ++ } + set line_now [mi_get_stop_line "$testcase: step to $line"] + set first 0 + } elseif {$line_now!=$line} { +@@ -1972,6 +1974,8 @@ proc mi_run_inline_test { testcase } { + # will need more experience to be sure. + eval $statements + } ++ ++ return 0 + } + + proc get_mi_thread_list {name} { diff --git a/gdb-testsuite-handle-sigill-in-gdb-reverse-insn-reverse-exp.patch b/gdb-testsuite-handle-sigill-in-gdb-reverse-insn-reverse-exp.patch deleted file mode 100644 index c3137f5..0000000 --- a/gdb-testsuite-handle-sigill-in-gdb-reverse-insn-reverse-exp.patch +++ /dev/null @@ -1,170 +0,0 @@ -[gdb/testsuite] Handle SIGILL in gdb.reverse/insn-reverse.exp - -Consider test-case gdb.reverse/insn-reverse.exp. - -It runs a number of subtests, dependent on the architecture, f.i. for -x86_64 it runs subtests rdrand and rdseed. - -For each subtest, it checks whether the subtest is supported and otherwise -bails out of that subtest. - -However, there may be a problem with the support test or the information it -relies on, and if it states that a subtest is supported while it is actually -not, we may run into a SIGILL, as f.i. described in PR21166, which results in -tcl errors like this: -... -ERROR: tcl error sourcing src/gdb/testsuite/gdb.reverse/insn-reverse.exp. -ERROR: can't read "insn_array(5)": no such element in array -... - -We can emulate this by inserting a sigfpe in function rdrand in -insn-reverse-x86.c, like this: -... - volatile int a = 0; volatile int b = 1; volatile int c = b / a; -... - -The problem is that the loop in the test-case attempts to stepi over of all -insn in rdrand, but because of the signal it will never get to the last insn. - -Handle this by detecting that the stepi made no progress, and bailing out of -the loop. - -Furthermore, make running of the subtests independent, such that a SIGILL in -subtest rdrand does not affect running of subtest rdseed. - -Tested on x86_64-linux. - -gdb/testsuite/ChangeLog: - -2020-11-25 Tom de Vries - - * gdb.reverse/insn-reverse.c (test_nr): New var. - (usage, parse_args): New function. - (main): Call parse_args. Only run test for test_nr. - * gdb.reverse/insn-reverse.exp: Detect lack of progress in stepi loop - and bail out. Run subtests individually, using an inferior arg - specifying the subtest. - ---- - gdb/testsuite/gdb.reverse/insn-reverse.c | 43 +++++++++++++++++++++++++++--- - gdb/testsuite/gdb.reverse/insn-reverse.exp | 15 +++++++++-- - 2 files changed, 52 insertions(+), 6 deletions(-) - -diff --git a/gdb/testsuite/gdb.reverse/insn-reverse.c b/gdb/testsuite/gdb.reverse/insn-reverse.c -index 08d382d080b..b3881d44251 100644 ---- a/gdb/testsuite/gdb.reverse/insn-reverse.c -+++ b/gdb/testsuite/gdb.reverse/insn-reverse.c -@@ -15,6 +15,9 @@ - You should have received a copy of the GNU General Public License - along with this program. If not, see . */ - -+#include -+#include -+ - typedef void (*testcase_ftype) (void); - - /* The arch-specific files need to implement both the initialize function -@@ -45,16 +48,48 @@ initialize (void) - array is defined together with them. */ - static int n_testcases = (sizeof (testcases) / sizeof (testcase_ftype)); - -+static void -+usage (void) -+{ -+ printf ("usage: insn-reverse <0-%d>\n", n_testcases - 1); -+} -+ -+static int test_nr; -+ -+static void -+parse_args (int argc, char **argv) -+{ -+ if (argc != 2) -+ { -+ usage (); -+ exit (1); -+ } -+ -+ char *tail; -+ test_nr = strtol (argv[1], &tail, 10); -+ if (*tail != '\0') -+ { -+ usage (); -+ exit (1); -+ } -+ -+ int in_range_p = 0 <= test_nr && test_nr < n_testcases; -+ if (!in_range_p) -+ { -+ usage (); -+ exit (1); -+ } -+} -+ - int --main () -+main (int argc, char **argv) - { -- int i = 0; -+ parse_args (argc, argv); - - /* Initialize any required arch-specific bits. */ - initialize (); - -- for (i = 0; i < n_testcases; i++) -- testcases[i] (); -+ testcases[test_nr] (); - - return 0; - } -diff --git a/gdb/testsuite/gdb.reverse/insn-reverse.exp b/gdb/testsuite/gdb.reverse/insn-reverse.exp -index 174b7957517..5627f9d2605 100644 ---- a/gdb/testsuite/gdb.reverse/insn-reverse.exp -+++ b/gdb/testsuite/gdb.reverse/insn-reverse.exp -@@ -50,11 +50,14 @@ proc read_testcase { n } { - # the contents of registers are saved, and test compares them. If - # there is any differences, a FAIL is emitted. - --proc test { func } { -+proc test { func testcase_nr } { - global hex decimal - global gdb_prompt - - with_test_prefix "$func" { -+ gdb_start_cmd $testcase_nr -+ gdb_test "" "" "wait for prompt" -+ - gdb_breakpoint $func - gdb_test "continue" - -@@ -74,15 +77,23 @@ proc test { func } { - - # Registers contents before each forward single step. - set count 0 -+ set insn_addr "" - for {} {$count < 500} {incr count} { - gdb_test_multiple "x/i \$pc" "" { - -re ".* ($hex) <.*>:\[ \t\]*(.*)\r\n$gdb_prompt $" { -+ set prev_insn_addr $insn_addr - set insn_addr $expect_out(1,string) - - if [expr {$last_insn == $insn_addr}] { - break - } - -+ if [expr {$prev_insn_addr == $insn_addr}] { -+ # Failed to make progress, might have run into SIGILL. -+ unsupported "no progress at: $expect_out(2,string)" -+ break -+ } -+ - set insn_array($count) $expect_out(2,string) - } - } -@@ -125,5 +136,5 @@ if { ${n_testcases} == 0 } { - for { set i 0 } { ${i} < ${n_testcases} } { incr i } { - set testcase [read_testcase $i] - -- test $testcase -+ test $testcase $i - } diff --git a/gdb-testsuite-handle-supports_memtag-in-gdb.base-gdb-caching-proc.exp.patch b/gdb-testsuite-handle-supports_memtag-in-gdb.base-gdb-caching-proc.exp.patch new file mode 100644 index 0000000..9ff1c98 --- /dev/null +++ b/gdb-testsuite-handle-supports_memtag-in-gdb.base-gdb-caching-proc.exp.patch @@ -0,0 +1,56 @@ +[gdb/testsuite] Handle supports_memtag in gdb.base/gdb-caching-proc.exp + +In test-case gdb.base/gdb-caching-proc.exp, we run all procs declared with +gdb_caching_proc. Some of these require a gdb instance, some not. + +We could just do a clean_restart every time, but that would amount to 44 gdb +restarts. We try to minimize this by doing this only for the few procs that +need it, and hardcoding those in the test-case. + +For those procs, we do a clean_restart, execute the proc, and then do a +gdb_exit, to make sure the gdb instance doesn't linger such that we detect +procs that need a gdb instance but are not listed in the test-case. + +However, that doesn't work in the case of gnat_runtime_has_debug_info. This +proc doesn't require a gdb instance because it starts its own. But it doesn't +clean up the gdb instance, and since it's not listed, the test-case +doesn't clean up the gdb instance eiter. Consequently, the proc +supports_memtag (which should be listed, but isn't) uses the gdb instance +started by gnat_runtime_has_debug_info rather than throwing an error. Well, +unless gnat_runtime_has_debug_info fails before starting a gdb instance, in +which case we do run into the error. + +Fix this by: +- doing gdb_exit unconditionally +- fixing the resulting error by adding supports_memtag in the test-case to + the "needing gdb instance" list + +Tested on x86_64-linux. + +--- + gdb/testsuite/gdb.base/gdb-caching-proc.exp | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +diff --git a/gdb/testsuite/gdb.base/gdb-caching-proc.exp b/gdb/testsuite/gdb.base/gdb-caching-proc.exp +index 82675dfc061..a3f08f5db32 100644 +--- a/gdb/testsuite/gdb.base/gdb-caching-proc.exp ++++ b/gdb/testsuite/gdb.base/gdb-caching-proc.exp +@@ -85,6 +85,7 @@ proc test_file { file } { + switch $procname { + "is_address_zero_readable" { set setup_gdb 1 } + "target_is_gdbserver" { set setup_gdb 1 } ++ "supports_memtag" { set setup_gdb 1 } + default {set setup_gdb 0 } + } + +@@ -94,9 +95,7 @@ proc test_file { file } { + + test_proc $procname + +- if { $setup_gdb } { +- gdb_exit +- } ++ gdb_exit + } + } + } diff --git a/gdb-testsuite-ignore-debuginfod_urls.patch b/gdb-testsuite-ignore-debuginfod_urls.patch deleted file mode 100644 index d40f749..0000000 --- a/gdb-testsuite-ignore-debuginfod_urls.patch +++ /dev/null @@ -1,49 +0,0 @@ -[gdb/testsuite] Ignore DEBUGINFOD_URLS - -On openSUSE Tumbleweed, DEBUGINFOD_URLS is now defined by default: -... -$ echo $DEBUGINFOD_URLS -https://debuginfod.opensuse.org/ -... - -With DEBUGINFOD_URLS defined we run into: -... -FAIL: gdb.mi/mi-sym-info.exp: List all functions from debug information only \ - (timeout) -... -as reported in PR27667. - -There's a latency of ~0.5s per request, which is ok-ish for interactive usage. -But the symbol-info-functions command ends up issuing 21 source requests, -which means we easily run into the 10s timeout. - -Fix this by unsetting DEBUGINFOD_URLS in default_gdb_init. - -gdb/testsuite/ChangeLog: - -2021-03-31 Tom de Vries - - PR testsuite/27667 - * lib/gdb.exp (default_gdb_init): Unset DEBUGINFOD_URLS. - ---- - gdb/testsuite/lib/gdb.exp | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp -index 653f145c1ce..6b0bc8c0af5 100644 ---- a/gdb/testsuite/lib/gdb.exp -+++ b/gdb/testsuite/lib/gdb.exp -@@ -5080,6 +5080,12 @@ proc default_gdb_init { test_file_name } { - # tests. - setenv TERM "dumb" - -+ # If DEBUGINFOD_URLS is set, gdb will try to download sources and -+ # debug info for f.i. system libraries. Prevent this. -+ if { [info exists env(DEBUGINFOD_URLS)] } { -+ unsetenv DEBUGINFOD_URLS -+ } -+ - # Ensure that GDBHISTFILE and GDBHISTSIZE are removed from the - # environment, we don't want these modifications to the history - # settings. diff --git a/gdb-testsuite-prevent-compilation-fails-with-unix-fpie-pie.patch b/gdb-testsuite-prevent-compilation-fails-with-unix-fpie-pie.patch new file mode 100644 index 0000000..78478c2 --- /dev/null +++ b/gdb-testsuite-prevent-compilation-fails-with-unix-fpie-pie.patch @@ -0,0 +1,125 @@ +[gdb/testsuite] Prevent compilation fails with unix/-fPIE/-pie + +A regular test-case will produce an executable, and depending on the compiler +default, it will be a PIE or not. A test-case can force one or the other +using the pie and nopie options. + +However, when running with target board unix/-fPIE/-pie, the nopie option will +have no effect, and likewise for target board unix/-fno-PIE/-no-pie and the +pie option. + +When say we run test-case gdb.base/attach-pie-noexec.exp, which passes the pie +option with target board unix/-fno-PIE/-no-pie we get: +... + Running src/gdb/testsuite/gdb.base/attach-pie-noexec.exp ... + gdb compile failed, pie failed to generate PIE executable + + === gdb Summary === + + # of untested testcases 1 +... + +However, this works only when we actually manage to generate an executable. + +There are other test-cases, like f.i. gdb.arch/amd64-disp-step.exp that +specify nopie, but will generate a compilation failure with target board +unix/-fPIE/-pie due to using a hard-coded .S file: +... + Running src/gdb/testsuite/gdb.arch/amd64-disp-step.exp ... + gdb compile failed, ld: outputs/gdb.arch/amd64-disp-step/amd64-disp-step0.o: \ + relocation R_X86_64_32S against `.text' can not be used when making a PIE \ + object; recompile with -fPIE + collect2: error: ld returned 1 exit status + + === gdb Summary === + + # of untested testcases 1 +... + +Hide this compilation error by: +- adding a gdb_caching_proc pie_forced, and +- using it in gdb_compile to bail out before even trying compilation +such that we simply have: +... +UNTESTED: gdb.arch/amd64-disp-step.exp: failed to prepare +... + +Likewise, add nopie_forced. + +Tested on x86_64-linux. + +--- + gdb/testsuite/lib/gdb.exp | 53 +++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 53 insertions(+) + +diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp +index 2b94f79d132..dbf4016aca1 100644 +--- a/gdb/testsuite/lib/gdb.exp ++++ b/gdb/testsuite/lib/gdb.exp +@@ -4407,6 +4407,17 @@ proc gdb_compile {source dest type options} { + lappend options "$flag" + } + ++ if { $pie != -1 && [nopie_forced] } { ++ set result "pie unsupported" ++ verbose -log "gdb_compile: $result" ++ return $result ++ } ++ if { $nopie != -1 && [pie_forced] } { ++ set result "nopie unsupported" ++ verbose -log "gdb_compile: $result" ++ return $result ++ } ++ + if { $type == "executable" } { + if { ([istarget "*-*-mingw*"] + || [istarget "*-*-*djgpp"] +@@ -7928,6 +7939,48 @@ gdb_caching_proc have_fuse_ld_gold { + return [gdb_simple_compile $me $src executable $flags] + } + ++# Helper function for pie_forced. ++proc pie_forced_0 { } { return 0 } ++ ++# Return 1 if nopie fails to prevent a PIE, 0 if nopie prevented a PIE, ++# and -1 if an error occurred. ++gdb_caching_proc pie_forced { ++ set me "pie_forced" ++ set src { int main() { return 0; } } ++ # gdb_compile calls pie_forced when nopie is passed, so pretend it ++ # returns 0, to allow us to find out the actual pie_forced value. ++ with_override pie_forced pie_forced_0 { ++ gdb_simple_compile $me $src executable nopie ++ } ++ set res [exec_is_pie $obj] ++ if { $res == -1 } { ++ return -1 ++ } ++ set res [expr $res == 1] ++ return $res ++} ++ ++# Helper function for nopie_forced. ++proc nopie_forced_0 {} { return 0 } ++ ++# Return 1 if pie fails to generated a PIE, 0 if pie generated a PIE, ++# and -1 if an error occurred. ++gdb_caching_proc nopie_forced { ++ set me "nopie_forced" ++ set src { int main() { return 0; } } ++ # gdb_compile calls nopie_forced when pie is passed, so pretend it ++ # returns 0, to allow us to find out the actual nopie_forced value. ++ with_override nopie_forced nopie_forced_0 { ++ gdb_simple_compile $me $src executable pie ++ } ++ set res [exec_is_pie $obj] ++ if { $res == -1 } { ++ return -1 ++ } ++ set res [expr $res == 0] ++ return $res ++} ++ + # Return 1 if compiler supports scalar_storage_order attribute, otherwise + # return 0. + gdb_caching_proc supports_scalar_storage_order_attribute { diff --git a/gdb-testsuite-prevent-pagination-in-gdb-internalflags.patch b/gdb-testsuite-prevent-pagination-in-gdb-internalflags.patch deleted file mode 100644 index 0629150..0000000 --- a/gdb-testsuite-prevent-pagination-in-gdb-internalflags.patch +++ /dev/null @@ -1,66 +0,0 @@ -[gdb/testsuite] Prevent pagination in GDB_INTERNALFLAGS - -When running test-case gdb.base/corefile.exp with target board readnow, we run -into: -... -Reading symbols from outputs/gdb.base/corefile/corefile...^M -Expanding full symbols from outputs/gdb.base/corefile/corefile...^M -[New LWP 2293]^M -Core was generated by `outputs/gdb.base/corefile/co'.^M -Program terminated with signal SIGABRT, Aborted.^M ---Type for more, q to quit, c to continue without paging--\ - FAIL: gdb.base/corefile.exp: (timeout) starting with -core -... - -In commit bd447abb24 "Make gdb.base/corefile.exp work on terminals with few -rows", pagination (in the same test-case) is prevented using: -... -set stty_init "rows 25 cols 80" -... -but this doesn't work in our case because using -readnow adds an extra line -"Expanding full symbols". - -The test passes when increasing rows to 26. However, increasing the rows by -some n only fixes the problem for n lines, and things will break again if -somehow we end up with n + 1 lines. - -Instead, fix this by setting heigth and width in INTERNAL_GDBFLAGS. This -solution was not chosen in commit bd447abb24 because it doesn't handle -pagination due to the introduction text. But it does handle the pagination -due to the extra "Expanding full symbols", and any other line printed during -and after file loading. - -Tested on x86_64-linux, with and without readnow. - -With -readnow, fixes timeout FAILs in gdb.base/corefile.exp and -gdb.base/reread-readsym.exp. - -gdb/testsuite/ChangeLog: - -2020-10-26 Tom de Vries - - * lib/gdb.exp (INTERNAL_GDBFLAGS): Set heigth and width. - ---- - gdb/testsuite/lib/gdb.exp | 8 +++++++- - 2 files changed, 11 insertions(+), 1 deletion(-) - -diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp -index f53df59f181..197542eec3b 100644 ---- a/gdb/testsuite/lib/gdb.exp -+++ b/gdb/testsuite/lib/gdb.exp -@@ -124,7 +124,13 @@ set BUILD_DATA_DIRECTORY "[pwd]/../data-directory" - # INTERNAL_GDBFLAGS contains flags that the testsuite requires. - global INTERNAL_GDBFLAGS - if ![info exists INTERNAL_GDBFLAGS] { -- set INTERNAL_GDBFLAGS "-nw -nx -data-directory $BUILD_DATA_DIRECTORY" -+ set INTERNAL_GDBFLAGS \ -+ [join [list \ -+ "-nw" \ -+ "-nx" \ -+ "-data-directory $BUILD_DATA_DIRECTORY" \ -+ {-iex "set height 0"} \ -+ {-iex "set width 0"}]] - } - - # The variable gdb_prompt is a regexp which matches the gdb prompt. diff --git a/gdb-testsuite-refactor-regexp-in-gdb.base-annota1.exp.patch b/gdb-testsuite-refactor-regexp-in-gdb.base-annota1.exp.patch new file mode 100644 index 0000000..8d4ee2d --- /dev/null +++ b/gdb-testsuite-refactor-regexp-in-gdb.base-annota1.exp.patch @@ -0,0 +1,79 @@ +[gdb/testsuite] Refactor regexp in gdb.base/annota1.exp + +Refactor regexp in gdb.base/annota1.exp to reduce indentation and repetition. + +Tested on x86_64-linux. + +--- + gdb/testsuite/gdb.base/annota1.exp | 56 ++++++++++++++++++++++++-------------- + 1 file changed, 35 insertions(+), 21 deletions(-) + +diff --git a/gdb/testsuite/gdb.base/annota1.exp b/gdb/testsuite/gdb.base/annota1.exp +index 383a0f4e607..6e30c164ec9 100644 +--- a/gdb/testsuite/gdb.base/annota1.exp ++++ b/gdb/testsuite/gdb.base/annota1.exp +@@ -129,29 +129,43 @@ gdb_test_multiple "info break" "breakpoint info" { + #exp_internal 1 + set binexp [string_to_regexp $binfile] + +-set run_re [join [list "\r\n\032\032post-prompt\r\nStarting program: $binexp " \ +- "\(\(\r\nReading \[^\r\n\]+\)|\(\r\nwarning: File transfers from remote targets can be slow\[^\r\n\]+\)\)*" \ +- "\(\r\nwarning: Skipping \[^\r\n\]+ .gdb_index section in \[^\r\n\]+\r\nDo \"set use-deprecated-index-sections on\" before the file is read\r\nto use the section anyway\\.\)?" \ +- "\(\(\r\n\r\n\032\032frames-invalid\)|\(\r\n\r\n\032\032breakpoints-invalid\)\)*\r\n\r\n" \ +- "\032\032starting\(\(\r\nReading \[^\r\n\]+\)|\(\r\nwarning: File transfers from remote targets can be slow\[^\r\n\]+\)\)*" \ +- "\(\(\r\n\r\n\032\032frames-invalid\)|\(\r\n\r\n\032\032breakpoints-invalid\)\)*\r\n\r\n" \ +- "\032\032breakpoint 1\r\n\r\n" \ +- "Breakpoint 1, \r\n" \ +- "\032\032frame-begin 0 $hex\r\n\r\n" \ +- "\032\032frame-function-name\r\n" \ +- "main\r\n" \ +- "\032\032frame-args\r\n \\(\\)\r\n" \ +- "\032\032frame-source-begin\r\n at \r\n" \ +- "\032\032frame-source-file\r\n.*annota1.c\r\n" \ +- "\032\032frame-source-file-end\r\n:\r\n" \ +- "\032\032frame-source-line\r\n$main_line\r\n" \ +- "\032\032frame-source-end\r\n\r\n\r\n" \ +- "\032\032source.*$srcfile:$main_line:.*:beg:$hex\r\n\r\n" \ +- "\032\032frame-end\r\n\r\n" \ +- "\032\032stopped.*$gdb_prompt$" ] "" ] ++set warning_slow_re \ ++ "warning: File transfers from remote targets can be slow\[^\r\n\]+" ++set warning_gdb_index_re \ ++ [multi_line \ ++ "warning: Skipping \[^\r\n\]+ .gdb_index section in \[^\r\n\]+" \ ++ "Do \"set use-deprecated-index-sections on\" before the file is read" \ ++ "to use the section anyway\\."] ++set reading_re \ ++ "Reading \[^\r\n\]+" ++ ++set run_re \ ++ [list \ ++ "\r\n\032\032post-prompt\r\nStarting program: $binexp " \ ++ "\(\(\r\n$reading_re\)|\(\r\n$warning_slow_re\)\)*" \ ++ "\(\r\n$warning_gdb_index_re\)?" \ ++ "\(\(\r\n\r\n\032\032frames-invalid\)|\(\r\n\r\n\032\032breakpoints-invalid\)\)*\r\n\r\n" \ ++ "\032\032starting\(\(\r\n$reading_re\)|\(\r\n$warning_slow_re\)\)*" \ ++ "\(\(\r\n\r\n\032\032frames-invalid\)|\(\r\n\r\n\032\032breakpoints-invalid\)\)*\r\n\r\n" \ ++ "\032\032breakpoint 1\r\n\r\n" \ ++ "Breakpoint 1, \r\n" \ ++ "\032\032frame-begin 0 $hex\r\n\r\n" \ ++ "\032\032frame-function-name\r\n" \ ++ "main\r\n" \ ++ "\032\032frame-args\r\n \\(\\)\r\n" \ ++ "\032\032frame-source-begin\r\n at \r\n" \ ++ "\032\032frame-source-file\r\n.*annota1.c\r\n" \ ++ "\032\032frame-source-file-end\r\n:\r\n" \ ++ "\032\032frame-source-line\r\n$main_line\r\n" \ ++ "\032\032frame-source-end\r\n\r\n\r\n" \ ++ "\032\032source.*$srcfile:$main_line:.*:beg:$hex\r\n\r\n" \ ++ "\032\032frame-end\r\n\r\n" \ ++ "\032\032stopped"] ++ ++set run_re [join $run_re ""] + + gdb_test_multiple "run" "run until main breakpoint" { +- -re $run_re { ++ -re $run_re.*$gdb_prompt$ { + pass $gdb_test_name + } + } diff --git a/gdb-testsuite-support-fpie-fno-pie-pie-no-pie-in-gdb_compile_rust.patch b/gdb-testsuite-support-fpie-fno-pie-pie-no-pie-in-gdb_compile_rust.patch new file mode 100644 index 0000000..13de7e8 --- /dev/null +++ b/gdb-testsuite-support-fpie-fno-pie-pie-no-pie-in-gdb_compile_rust.patch @@ -0,0 +1,95 @@ +[gdb/testsuite] Support -fPIE/-fno-PIE/-pie/-no-pie in gdb_compile_rust + +When running gdb.rust/*.exp test-cases with target board unix/-fPIE/-pie, I +run into: +... +builtin_spawn -ignore SIGHUP rustc --color never gdb.rust/watch.rs \ + -g -lm -fPIE -pie -o outputs/gdb.rust/watch/watch^M +error: Unrecognized option: 'f'^M +^M +compiler exited with status 1 +... + +The problem is that -fPIE and -fpie are gcc options, but for rust we use +rustc, which has different compilation options. + +Fix this by translating the gcc options to rustc options in gdb_compile_rust, +similar to how that is done for ada in target_compile_ada_from_dir. + +Likewise for unix/-fno-PIE/-no-pie. + +Tested on x86_64-linux, with: +- native +- unix/-fPIE/-pie +- unix/-fno-PIE/-no-pie +specifically, on openSUSE Leap 15.2 both with package gcc-PIE: +- installed (making gcc default to PIE) +- uninstalled (making gcc default to non-PIE). +and rustc 1.52.1. + +--- + gdb/testsuite/lib/rust-support.exp | 47 +++++++++++++++++++++++++++++++++++--- + 1 file changed, 44 insertions(+), 3 deletions(-) + +diff --git a/gdb/testsuite/lib/rust-support.exp b/gdb/testsuite/lib/rust-support.exp +index 2896ac82453..2f78d6dde0e 100644 +--- a/gdb/testsuite/lib/rust-support.exp ++++ b/gdb/testsuite/lib/rust-support.exp +@@ -27,13 +27,54 @@ proc set_lang_rust {} { + } + + proc gdb_compile_rust {sources dest options} { ++ set res -1 ++ + if {[llength $sources] > 1} { + error "gdb rust setup can only compile one source file at a time" + } +- if {[gdb_compile [lindex $sources 0] $dest executable $options] != ""} { +- return -1 ++ ++ global board ++ set board [target_info name] ++ set multilib_flags_orig [board_info $board multilib_flags] ++ set multilib_flags {} ++ foreach op $multilib_flags_orig { ++ # Pretend rustc supports -pie/-no-pie/-fPIE/-fno-PIE. ++ switch $op { ++ "-pie" - "-no-pie" { ++ # Pass it to linker. ++ lappend multilib_flags -C link-arg=$op ++ } ++ "-fno-PIE" { ++ # Translate to rustc codegen equivalent. ++ ++ # The rustc documentation insists that we should use static ++ # here, but that causes segfaults leading to: ++ # UNTESTED: gdb.rust/rawids.exp: could not run to breakpoint ++ # UNTESTED: gdb.rust/pp.exp: could not run to breakpoint ++ # Instead, we use dynamic-no-pic which does seem to work. ++ lappend multilib_flags -C relocation-model=dynamic-no-pic ++ } ++ "-fPIE" { ++ # Translate to rustc codegen equivalent. ++ lappend multilib_flags -C relocation-model=pic ++ } ++ default { ++ # Pass unmodified. ++ lappend multilib_flags $op ++ } ++ } ++ } ++ ++ save_target_board_info { multilib_flags } { ++ unset_board_info multilib_flags ++ set_board_info multilib_flags "$multilib_flags" ++ if {[gdb_compile [lindex $sources 0] $dest executable \ ++ $options] == ""} { ++ set res "" ++ } + } +- return "" ++ ++ return $res + } + + # Return the version of LLVM used by the Rust compiler. Note that diff --git a/gdb-testsuite-update-test-gdb.base-step-over-syscall.exp.patch b/gdb-testsuite-update-test-gdb.base-step-over-syscall.exp.patch new file mode 100644 index 0000000..2374c54 --- /dev/null +++ b/gdb-testsuite-update-test-gdb.base-step-over-syscall.exp.patch @@ -0,0 +1,241 @@ +gdb/testsuite: update test gdb.base/step-over-syscall.exp + +I was looking at PR gdb/19675 and the related test +gdb.base/step-over-syscall.exp. This test includes a call to kfail +when we are testing a displaced step over a clone syscall. + +While looking at the test I removed the call to kfail and ran the +test, and was surprised that the test passed. + +I ran the test a few times and it does sometimes fail, but mostly it +passed fine. + +PR gdb/19675 describes how, when we displaced step over a clone, the +new thread is created with a $pc in the displaced step buffer. GDB +then fails to "fix" this $pc (for the new thread), and the thread will +be set running with its current $pc value. This means that the new +thread will just start executing from whatever happens to be after the +displaced stepping buffer. + +In the original PR gdb/19675 bug report Yao Qi was seeing the new +thread cause a segfault, the problem is, what actually happens is +totally undefined. + +On my machine, I'm seeing the new thread reenter main, it then starts +trying to run the test again (in the new thread). This just happens +to be safe enough (in this simple test) that most of the time the +inferior doesn't crash. + +In this commit I try to make the test slightly more likely to fail by +doing a couple of things. + +First, I added a static variable to main, this is set true when the +first thread enters main, if a second thread ever enters main then I +force an abort. + +Second, when the test is finishing I want to ensure that the new +threads have had a chance to do "something bad" if they are going to. +So I added a global counter, as each thread starts successfully it +decrements the counter. The main thread does not proceed to the final +marker function (where GDB has placed a breakpoint) until all threads +have started successfully. This means that if the newly created +thread doesn't successfully enter clone_fn then the counter will never +reach zero and the test will timeout. + +With these two changes my hope is that the test should fail more +reliably, and so, I have also changed the test to call setup_kfail +before the specific steps that we expect to misbehave instead of just +calling kfail and skipping parts of the test completely. The benefit +of this is that if/when we fix GDB this test will start to KPASS and +we'll know to update this test to remove the setup_kfail call. + +--- + gdb/testsuite/gdb.base/step-over-clone.c | 39 ++++++++++++++++ + gdb/testsuite/gdb.base/step-over-syscall.exp | 69 +++++++++++++++++++++++----- + 2 files changed, 97 insertions(+), 11 deletions(-) + +diff --git a/gdb/testsuite/gdb.base/step-over-clone.c b/gdb/testsuite/gdb.base/step-over-clone.c +index 581bf5fdde5..ef6fd922eb1 100644 +--- a/gdb/testsuite/gdb.base/step-over-clone.c ++++ b/gdb/testsuite/gdb.base/step-over-clone.c +@@ -19,6 +19,7 @@ + #include + #include + #include ++#include + + static void + marker () +@@ -26,9 +27,22 @@ marker () + + #define STACK_SIZE 0x1000 + ++/* These are used to signal that the threads have started correctly. The ++ GLOBAL_THREAD_COUNT is set to the number of threads in main, then ++ decremented (under a lock) in each new thread. */ ++pthread_mutex_t global_lock = PTHREAD_MUTEX_INITIALIZER; ++int global_thread_count = 0; ++ + static int + clone_fn (void *unused) + { ++ /* Signal that this thread has started correctly. */ ++ if (pthread_mutex_lock (&global_lock) != 0) ++ abort (); ++ global_thread_count--; ++ if (pthread_mutex_unlock (&global_lock) != 0) ++ abort (); ++ + return 0; + } + +@@ -38,9 +52,21 @@ main (void) + int i, pid; + unsigned char *stack[6]; + ++ /* Due to bug gdb/19675 the cloned thread _might_ try to reenter main ++ (this depends on where the displaced instruction is placed for ++ execution). However, if we do reenter main then lets ensure we fail ++ hard rather then just silently executing the code below. */ ++ static int started = 0; ++ if (!started) ++ started = 1; ++ else ++ abort (); ++ + for (i = 0; i < (sizeof (stack) / sizeof (stack[0])); i++) + stack[i] = malloc (STACK_SIZE); + ++ global_thread_count = (sizeof (stack) / sizeof (stack[0])); ++ + for (i = 0; i < (sizeof (stack) / sizeof (stack[0])); i++) + { + pid = clone (clone_fn, stack[i] + STACK_SIZE, CLONE_FILES | CLONE_VM, +@@ -50,5 +76,18 @@ main (void) + for (i = 0; i < (sizeof (stack) / sizeof (stack[0])); i++) + free (stack[i]); + ++ /* Set an alarm so we don't end up stuck waiting for threads that might ++ never start correctly. */ ++ alarm (120); ++ ++ /* Now wait for all the threads to start up. */ ++ while (global_thread_count != 0) ++ { ++ /* Force memory barrier so GLOBAL_THREAD_COUNT will be refetched. */ ++ asm volatile ("" ::: "memory"); ++ sleep (1); ++ } ++ ++ /* Call marker, this is what GDB is waiting for. */ + marker (); + } +diff --git a/gdb/testsuite/gdb.base/step-over-syscall.exp b/gdb/testsuite/gdb.base/step-over-syscall.exp +index a4821d7cd5a..7e9746e8dd9 100644 +--- a/gdb/testsuite/gdb.base/step-over-syscall.exp ++++ b/gdb/testsuite/gdb.base/step-over-syscall.exp +@@ -41,11 +41,50 @@ if { [istarget "i\[34567\]86-*-linux*"] || [istarget "x86_64-*-linux*"] } { + return -1 + } + +-proc_with_prefix check_pc_after_cross_syscall { syscall syscall_insn_next_addr } { ++proc_with_prefix check_pc_after_cross_syscall { displaced syscall syscall_insn_next_addr } { ++ global gdb_prompt ++ + set syscall_insn_next_addr_found [get_hexadecimal_valueof "\$pc" "0"] + ++ # After the 'stepi' we expect thread 1 to still be selected. ++ # However, when displaced stepping over a clone bug gdb/19675 ++ # means this might not be the case. ++ # ++ # Which thread we end up in depends on a race between the original ++ # thread-1, and the new thread (created by the clone), so we can't ++ # guarantee which thread we will be in at this point. ++ # ++ # For the fork/vfork syscalls, which are correctly handled by ++ # displaced stepping we will always be in thread-1 or the original ++ # process at this point. ++ set curr_thread "unknown" ++ gdb_test_multiple "info threads" "" { ++ -re "Id\\s+Target Id\\s+Frame\\s*\r\n" { ++ exp_continue ++ } ++ -re "^\\* (\\d+)\\s+\[^\r\n\]+\r\n" { ++ set curr_thread $expect_out(1,string) ++ exp_continue ++ } ++ -re "^\\s+\\d+\\s+\[^\r\n\]+\r\n" { ++ exp_continue ++ } ++ -re "$gdb_prompt " { ++ } ++ } ++ ++ # If we are displaced stepping over a clone, and we ended up in ++ # the wrong thread then the following check of the $pc value will ++ # fail. ++ if { $displaced == "on" && $syscall == "clone" && $curr_thread != 1 } { ++ # GDB doesn't support stepping over clone syscall with ++ # displaced stepping. ++ setup_kfail "*-*-*" "gdb/19675" ++ } ++ + gdb_assert {$syscall_insn_next_addr != 0 \ +- && $syscall_insn_next_addr == $syscall_insn_next_addr_found} \ ++ && $syscall_insn_next_addr == $syscall_insn_next_addr_found \ ++ && $curr_thread == 1} \ + "single step over $syscall final pc" + } + +@@ -204,7 +243,12 @@ proc step_over_syscall { syscall } { + + set testfile "step-over-$syscall" + +- if [build_executable ${testfile}.exp ${testfile} ${testfile}.c {debug}] { ++ set options [list debug] ++ if { $syscall == "clone" } { ++ lappend options "pthreads" ++ } ++ ++ if [build_executable ${testfile}.exp ${testfile} ${testfile}.c $options] { + untested "failed to compile" + return -1 + } +@@ -214,13 +258,6 @@ proc step_over_syscall { syscall } { + continue + } + +- if { $displaced == "on" && $syscall == "clone" } { +- # GDB doesn't support stepping over clone syscall with +- # displaced stepping. +- kfail "gdb/19675" "single step over clone" +- continue +- } +- + set ret [setup $syscall] + + set syscall_insn_addr [lindex $ret 0] +@@ -257,12 +294,22 @@ proc step_over_syscall { syscall } { + if {[gdb_test "stepi" "x/i .*=>.*" "single step over $syscall"] != 0} { + return -1 + } +- check_pc_after_cross_syscall $syscall $syscall_insn_next_addr ++ check_pc_after_cross_syscall $displaced $syscall $syscall_insn_next_addr + + # Delete breakpoint syscall insns to avoid interference to other syscalls. + delete_breakpoints + + gdb_test "break marker" "Breakpoint.*at.* file .*${testfile}.c, line.*" ++ ++ # If we are displaced stepping over a clone syscall then ++ # we expect the following check to fail. See also the ++ # code in check_pc_after_cross_syscall. ++ if { $displaced == "on" && $syscall == "clone" } { ++ # GDB doesn't support stepping over clone syscall with ++ # displaced stepping. ++ setup_kfail "*-*-*" "gdb/19675" ++ } ++ + gdb_test "continue" "Continuing\\..*Breakpoint \[0-9\]+, marker \\(\\) at.*" \ + "continue to marker ($syscall)" + } diff --git a/gdb-testsuite-use-compiler-generated-instead-of-gas-generated-stabs.patch b/gdb-testsuite-use-compiler-generated-instead-of-gas-generated-stabs.patch new file mode 100644 index 0000000..db2b84d --- /dev/null +++ b/gdb-testsuite-use-compiler-generated-instead-of-gas-generated-stabs.patch @@ -0,0 +1,74 @@ +[gdb/testsuite] Use compiler-generated instead of gas-generated stabs + +The test-case gdb.dwarf2/dw2-ranges.exp is the only one in the gdb testsuite +that uses gas-generated stabs. + +While the use seems natural alongside the use of gas-generated dwarf in the +same test-case, there are a few known issues, filed on the gdb side as: +- PR symtab/12497 - "stabs: PIE relocation does not work" +- PR symtab/28221 - "[readnow, stabs] FAIL: gdb.dwarf2/dw2-ranges.exp: \ + info line func" +and on the gas side as: +- PR gas/28233 - "[gas, --gstabs] Generate stabs more similar to gcc" + +The test-case contains a KFAIL for PR12497, but it's outdated and fails to +trigger. + +The intention of the test-case is to test gas-generated dwarf, and using +gcc-generated stabs instead of gas-generated stabs works fine. + +Supporting compiler-generated stabs is already a corner-case for gdb, and +there's no current commitment/incentive to support/workaround gas-generated +stabs, which can be considered a corner-case of a corner-case. + +Work around these problem by using compiler-generated stabs in the test-case. + +Tested on x86_64-linux. + +gdb/testsuite/ChangeLog: + +2021-08-22 Tom de Vries + + * gdb.dwarf2/dw2-ranges.exp: Use compiler-generated stabs. + +--- + gdb/testsuite/gdb.dwarf2/dw2-ranges.exp | 15 +++------------ + 1 file changed, 3 insertions(+), 12 deletions(-) + +diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ranges.exp b/gdb/testsuite/gdb.dwarf2/dw2-ranges.exp +index 8566e0034cf..288fc941afa 100644 +--- a/gdb/testsuite/gdb.dwarf2/dw2-ranges.exp ++++ b/gdb/testsuite/gdb.dwarf2/dw2-ranges.exp +@@ -35,7 +35,6 @@ if !$gcc_compiled { + standard_testfile .c -2.c -3.c + set asmfile [standard_output_file ${testfile}.s] + set asmfile2 [standard_output_file ${testfile}2.s] +-set asmfile3 [standard_output_file ${testfile}3.s] + set objfile [standard_output_file ${testfile}.o] + set objfile2 [standard_output_file ${testfile}2.o] + set objfile3 [standard_output_file ${testfile}3.o] +@@ -55,8 +54,7 @@ if {[gdb_compile "${srcdir}/${subdir}/${srcfile2}" "${asmfile2}" assembly {}] != + # STABS compilation is intentional as it tests the STABS lookup where is no + # partial_symtab->psymtabs_addrmap supported for that CU (Compilation Unit) in + # a file containing psymtabs_addrmap-supporting DWARF CUs. +-if {[gdb_compile "${srcdir}/${subdir}/${srcfile3}" "${asmfile3}" assembly {}] != "" +- || [gdb_compile "${asmfile3}" "${objfile3}" object {additional_flags=-gstabs}] != "" } { ++if {[gdb_compile "${srcdir}/${subdir}/${srcfile3}" "${objfile3}" object {additional_flags=-gstabs}] != "" } { + return -1 + } + +@@ -82,12 +80,5 @@ gdb_test "info line func" "Line \[0-9\]* of .* starts at address .* and ends at + gdb_test "info line main2" "Line \[0-9\]* of .* starts at address .* and ends at .*" + gdb_test "info line func2" "Line \[0-9\]* of .* starts at address .* and ends at .*" + +-set test "info line main3" +-gdb_test_multiple $test $test { +- -re "Line \[0-9\]* of .* starts at address .* and ends at .*\r\n$gdb_prompt $" { +- pass $test +- } +- -re "Line \[0-9\]* of .* is at address .* but contains no code\\.\r\n$gdb_prompt $" { +- kfail symtab/12497 $test +- } +-} ++gdb_test "info line main3" \ ++ "Line \[0-9\]* of .* starts at address .* and ends at .*" diff --git a/gdb-threads-fix-lin_thread_get_thread_signals-for-glibc-2.28.patch b/gdb-threads-fix-lin_thread_get_thread_signals-for-glibc-2.28.patch deleted file mode 100644 index 40222e7..0000000 --- a/gdb-threads-fix-lin_thread_get_thread_signals-for-glibc-2.28.patch +++ /dev/null @@ -1,167 +0,0 @@ -[gdb/threads] Fix lin_thread_get_thread_signals for glibc 2.28 - -When running test-case gdb.threads/create-fail.exp on openSUSE Factory -(with glibc version 2.32) I run into: -... -(gdb) continue -Continuing. -[New Thread 0x7ffff7c83700 (LWP 626354)] -[New Thread 0x7ffff7482700 (LWP 626355)] -[Thread 0x7ffff7c83700 (LWP 626354) exited] -[New Thread 0x7ffff6c81700 (LWP 626356)] -[Thread 0x7ffff7482700 (LWP 626355) exited] -[New Thread 0x7ffff6480700 (LWP 626357)] -[Thread 0x7ffff6c81700 (LWP 626356) exited] -[New Thread 0x7ffff5c7f700 (LWP 626358)] -[Thread 0x7ffff6480700 (LWP 626357) exited] -pthread_create: 22: Invalid argument - -Thread 6 "create-fail" received signal SIG32, Real-time event 32. -[Switching to Thread 0x7ffff5c7f700 (LWP 626358)] -0x00007ffff7d87695 in clone () from /lib64/libc.so.6 -(gdb) FAIL: gdb.threads/create-fail.exp: iteration 1: run till end -... -The problem is that glibc-internal signal SIGCANCEL is not recognized by gdb. - -There's code in check_thread_signals that is supposed to take care of that, -but it's not working because this code in lin_thread_get_thread_signals has -stopped working: -... - /* NPTL reserves the first two RT signals, but does not provide any - way for the debugger to query the signal numbers - fortunately - they don't change. */ - sigaddset (set, __SIGRTMIN); - sigaddset (set, __SIGRTMIN + 1); -... - -Since glibc commit d2dc5467c6 "Filter out NPTL internal signals (BZ #22391)" -(first released as part of glibc 2.28), a sigaddset with a glibc-internal -signal has no other effect than setting errno to EINVALID. - -Fix this by eliminating the usage of sigset_t in check_thread_signals and -lin_thread_get_thread_signals. - -The same problem was observed on Ubuntu 20.04. - -Tested on x86_64-linux, openSUSE Factory. -Tested on aarch64-linux, Ubuntu 20.04 and Ubuntu 18.04. - -gdb/ChangeLog: - -2021-02-12 Tom de Vries - - PR threads/26228 - * linux-nat.c (lin_thread_get_thread_signals): Remove. - (lin_thread_signals): New static var. - (lin_thread_get_thread_signal_num, lin_thread_get_thread_signal): - New function. - * linux-nat.h (lin_thread_get_thread_signals): Remove. - (lin_thread_get_thread_signal_num, lin_thread_get_thread_signal): - Declare. - * linux-thread-db.c (check_thread_signals): Use - lin_thread_get_thread_signal_num and lin_thread_get_thread_signal. - ---- - gdb/linux-nat.c | 26 +++++++++++++++++--------- - gdb/linux-nat.h | 7 +++++-- - gdb/linux-thread-db.c | 21 +++++---------------- - 3 files changed, 27 insertions(+), 27 deletions(-) - -diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c -index b81014024c7..36f769c285a 100644 ---- a/gdb/linux-nat.c -+++ b/gdb/linux-nat.c -@@ -4418,16 +4418,24 @@ Enables printf debugging output."), - the GNU/Linux Threads library and therefore doesn't really belong - here. */ - --/* Return the set of signals used by the threads library in *SET. */ -+/* NPTL reserves the first two RT signals, but does not provide any -+ way for the debugger to query the signal numbers - fortunately -+ they don't change. */ -+static int lin_thread_signals[] = { __SIGRTMIN, __SIGRTMIN + 1 }; - --void --lin_thread_get_thread_signals (sigset_t *set) -+/* See linux-nat.h. */ -+ -+unsigned int -+lin_thread_get_thread_signal_num (void) - { -- sigemptyset (set); -+ return sizeof (lin_thread_signals) / sizeof (lin_thread_signals[0]); -+} - -- /* NPTL reserves the first two RT signals, but does not provide any -- way for the debugger to query the signal numbers - fortunately -- they don't change. */ -- sigaddset (set, __SIGRTMIN); -- sigaddset (set, __SIGRTMIN + 1); -+/* See linux-nat.h. */ -+ -+int -+lin_thread_get_thread_signal (unsigned int i) -+{ -+ gdb_assert (i < lin_thread_get_thread_signal_num ()); -+ return lin_thread_signals[i]; - } -diff --git a/gdb/linux-nat.h b/gdb/linux-nat.h -index 1af9e830c83..6efc28f41ae 100644 ---- a/gdb/linux-nat.h -+++ b/gdb/linux-nat.h -@@ -304,8 +304,11 @@ void check_for_thread_db (void); - true on success, false if the process isn't using libpthread. */ - extern int thread_db_notice_clone (ptid_t parent, ptid_t child); - --/* Return the set of signals used by the threads library. */ --extern void lin_thread_get_thread_signals (sigset_t *mask); -+/* Return the number of signals used by the threads library. */ -+extern unsigned int lin_thread_get_thread_signal_num (void); -+ -+/* Return the i-th signal used by the threads library. */ -+extern int lin_thread_get_thread_signal (unsigned int i); - - /* Find process PID's pending signal set from /proc/pid/status. */ - void linux_proc_pending_signals (int pid, sigset_t *pending, -diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c -index b3cda05cd6e..5498308cf37 100644 ---- a/gdb/linux-thread-db.c -+++ b/gdb/linux-thread-db.c -@@ -161,8 +161,6 @@ static thread_db_target the_thread_db_target; - /* Non-zero if we have determined the signals used by the threads - library. */ - static int thread_signals; --static sigset_t thread_stop_set; --static sigset_t thread_print_set; - - struct thread_db_info - { -@@ -1224,23 +1222,14 @@ check_thread_signals (void) - { - if (!thread_signals) - { -- sigset_t mask; - int i; - -- lin_thread_get_thread_signals (&mask); -- sigemptyset (&thread_stop_set); -- sigemptyset (&thread_print_set); -- -- for (i = 1; i < NSIG; i++) -+ for (i = 0; i < lin_thread_get_thread_signal_num (); i++) - { -- if (sigismember (&mask, i)) -- { -- if (signal_stop_update (gdb_signal_from_host (i), 0)) -- sigaddset (&thread_stop_set, i); -- if (signal_print_update (gdb_signal_from_host (i), 0)) -- sigaddset (&thread_print_set, i); -- thread_signals = 1; -- } -+ int sig = lin_thread_get_thread_signal (i); -+ signal_stop_update (gdb_signal_from_host (sig), 0); -+ signal_print_update (gdb_signal_from_host (sig), 0); -+ thread_signals = 1; - } - } - } diff --git a/gdb-try-to-load-libthread_db-only-after-reading-all-shared-libraries-when-attaching.patch b/gdb-try-to-load-libthread_db-only-after-reading-all-shared-libraries-when-attaching.patch deleted file mode 100644 index a4388ac..0000000 --- a/gdb-try-to-load-libthread_db-only-after-reading-all-shared-libraries-when-attaching.patch +++ /dev/null @@ -1,77 +0,0 @@ -gdb: try to load libthread_db only after reading all shared libraries when attaching - -https://sourceware.org/pipermail/gdb-patches/2021-March/177369.html - ---- - gdb/infcmd.c | 7 ++----- - gdb/linux-thread-db.c | 24 +++++++++++++++++++----- - 2 files changed, 21 insertions(+), 10 deletions(-) - -diff --git a/gdb/infcmd.c b/gdb/infcmd.c -index cfc31699925..345cdc23b0d 100644 ---- a/gdb/infcmd.c -+++ b/gdb/infcmd.c -@@ -347,6 +347,8 @@ post_create_inferior (struct target_ops *target, int from_tty) - if the now pushed target supports hardware watchpoints. */ - breakpoint_re_set (); - -+ current_inferior ()->needs_setup = 0; -+ - gdb::observers::inferior_created.notify (target, from_tty); - } - -@@ -2414,11 +2416,6 @@ proceed_after_attach (inferior *inf) - void - setup_inferior (int from_tty) - { -- struct inferior *inferior; -- -- inferior = current_inferior (); -- inferior->needs_setup = 0; -- - /* If no exec file is yet known, try to determine it from the - process itself. */ - if (get_exec_file (0) == NULL) -diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c -index 5498308cf37..61c0237b0e3 100644 ---- a/gdb/linux-thread-db.c -+++ b/gdb/linux-thread-db.c -@@ -1010,8 +1010,19 @@ 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 &except) -+ { -+ if (libthread_db_debug) -+ { -+ exception_fprintf (gdb_stdlog, except, -+ "Warning: try_thread_db_load: "); -+ } -+ } - - /* This library "refused" to work on current inferior. */ - delete_thread_db_info (current_inferior ()->process_target (), -@@ -1182,10 +1193,13 @@ 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 ()); -+ if (inf->needs_setup) -+ 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-tui-fix-breakpoint-display-functionality.patch b/gdb-tui-fix-breakpoint-display-functionality.patch new file mode 100644 index 0000000..44c914b --- /dev/null +++ b/gdb-tui-fix-breakpoint-display-functionality.patch @@ -0,0 +1,115 @@ +[gdb/tui] Fix breakpoint display functionality + +In commit 81e6b8eb208 "Make tui-winsource not use breakpoint_chain", a loop +body was transformed into a lambda function body: +... +- for (bp = breakpoint_chain; +- bp != NULL; +- bp = bp->next) ++ iterate_over_breakpoints ([&] (breakpoint *bp) -> bool +... +and consequently: +- a continue was replaced by a return, and +- a final return was added. + +Then in commit 240edef62f0 "gdb: remove iterate_over_breakpoints function", we +transformed back to a loop body: +... +- iterate_over_breakpoints ([&] (breakpoint *bp) -> bool ++ for (breakpoint *bp : all_breakpoints ()) +... +but without reverting the changes that introduced the two returns. + +Consequently, breakpoints no longer show up in the tui source window. + +Fix this by reverting the changes that introduced the two returns. + +Build on x86_64-linux, tested with all .exp test-cases that contain +tuiterm_env. + +Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28483 + +gdb/ChangeLog: + +2021-10-22 Tom de Vries + + PR tui/28483 + * tui/tui-winsource.c (tui_source_window_base::update_breakpoint_info): + Fix returns in loop body. + +gdb/testsuite/ChangeLog: + +2021-10-22 Tom de Vries + + PR tui/28483 + * gdb.tui/break.exp: New file. + +--- + gdb/testsuite/gdb.tui/break.exp | 37 +++++++++++++++++++++++++++++++++++++ + gdb/tui/tui-winsource.c | 3 +-- + 2 files changed, 38 insertions(+), 2 deletions(-) + +diff --git a/gdb/testsuite/gdb.tui/break.exp b/gdb/testsuite/gdb.tui/break.exp +new file mode 100644 +index 00000000000..de4821c570a +--- /dev/null ++++ b/gdb/testsuite/gdb.tui/break.exp +@@ -0,0 +1,37 @@ ++# 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 . ++ ++# Verify that breakpoint marker is shown. ++ ++tuiterm_env ++ ++standard_testfile tui-layout.c ++ ++if {[build_executable "failed to prepare" ${testfile} ${srcfile}] == -1} { ++ return -1 ++} ++ ++Term::clean_restart 24 80 $testfile ++if {![Term::enter_tui]} { ++ unsupported "TUI not supported" ++ return ++} ++ ++set text [Term::get_all_lines] ++gdb_assert {![string match "No Source Available" $text]} \ ++ "initial source listing" ++ ++Term::command "b main" ++Term::check_contents "break marker present" "\\|b\\+" +diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c +index afd51e95980..955b68901fe 100644 +--- a/gdb/tui/tui-winsource.c ++++ b/gdb/tui/tui-winsource.c +@@ -460,7 +460,7 @@ tui_source_window_base::update_breakpoint_info + for (breakpoint *bp : all_breakpoints ()) + { + if (bp == being_deleted) +- return false; ++ continue; + + for (bp_location *loc : bp->locations ()) + { +@@ -478,7 +478,6 @@ tui_source_window_base::update_breakpoint_info + mode |= TUI_BP_HARDWARE; + } + } +- return false; + } + + if (line->break_mode != mode) diff --git a/gdb-tui-fix-len_without_escapes-in-tui-disasm.c.patch b/gdb-tui-fix-len_without_escapes-in-tui-disasm.c.patch deleted file mode 100644 index 64f6bdf..0000000 --- a/gdb-tui-fix-len_without_escapes-in-tui-disasm.c.patch +++ /dev/null @@ -1,71 +0,0 @@ -[gdb/tui] Fix len_without_escapes in tui-disasm.c - -On openSUSE Tumbleweed I run into: -... -FAIL: gdb.tui/basic.exp: asm window shows main -ERROR: invalid command name "_csi_L" -... - -Using a minimal example, we get: -... -$ gdb -q outputs/gdb.tui/basic/basic -ex "tui enable" -ex "layout asm" - -src/gdb/ui-style.c:243: internal-error: bool \ - ui_file_style::parse(const char*, size_t*): Assertion `match == 0' failed. -... - -The problem is in len_without_escapes, where we detect the start of an escape -sequence, but then pass ptr to style.parse while ptr no longer points to the -escape due to the ptr++ in the while condition: -... - while ((c = *ptr++) != '\0') - { - if (c == '\033') - { - ui_file_style style; - size_t n_read; - if (style.parse (ptr, &n_read)) -... - -Fix this by removing the ++ in the while condition, and adding ptr++ in the -loop body where appropriate. - -Tested on x86_64-linux. - -gdb/ChangeLog: - -2021-04-06 Tom de Vries - - PR tui/27680 - * tui/tui-disasm.c (len_without_escapes): Pass ptr pointing at escape - to style.parse. - ---- - gdb/tui/tui-disasm.c | 7 +++++-- - 2 files changed, 11 insertions(+), 2 deletions(-) - -diff --git a/gdb/tui/tui-disasm.c b/gdb/tui/tui-disasm.c -index 65b300cb008..163552aede4 100644 ---- a/gdb/tui/tui-disasm.c -+++ b/gdb/tui/tui-disasm.c -@@ -61,7 +61,7 @@ len_without_escapes (const std::string &str) - const char *ptr = str.c_str (); - char c; - -- while ((c = *ptr++) != '\0') -+ while ((c = *ptr) != '\0') - { - if (c == '\033') - { -@@ -77,7 +77,10 @@ len_without_escapes (const std::string &str) - } - } - else -- ++len; -+ { -+ ++len; -+ ++ptr; -+ } - } - return len; - } diff --git a/gdb-vla-intel-fix-print-char-array.patch b/gdb-vla-intel-fix-print-char-array.patch deleted file mode 100644 index f667e76..0000000 --- a/gdb-vla-intel-fix-print-char-array.patch +++ /dev/null @@ -1,59 +0,0 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Sergio Durigan Junior -Date: Thu, 7 Dec 2017 16:20:31 -0500 -Subject: gdb-vla-intel-fix-print-char-array.patch - -;; Revert upstream commit 469412dd9ccc4de5874fd3299b105833f36b34cd - -Revert commit (only the part touching gdb/f-valprint.c): - - commit 469412dd9ccc4de5874fd3299b105833f36b34cd - Author: Christoph Weinmann - Date: Fri Sep 8 15:11:47 2017 +0200 - - Remove C/C++ relevant code in Fortran specific file. - - Remove code relevant for printing C/C++ Integer values in a - Fortran specific file to unify printing of Fortran values. - This does not change the output. - -And adjust its testcase. - -diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c ---- a/gdb/f-valprint.c -+++ b/gdb/f-valprint.c -@@ -310,7 +310,21 @@ f_value_print_inner (struct value *val, struct ui_file *stream, int recurse, - value_print_scalar_formatted (val, &opts, 0, stream); - } - else -- value_print_scalar_formatted (val, options, 0, stream); -+ { -+ value_print_scalar_formatted (val, options, 0, stream); -+ /* C and C++ has no single byte int type, char is used instead. -+ Since we don't know whether the value is really intended to -+ be used as an integer or a character, print the character -+ equivalent as well. */ -+ if (TYPE_LENGTH (type) == 1) -+ { -+ LONGEST c; -+ -+ fputs_filtered (" ", stream); -+ c = unpack_long (type, valaddr); -+ LA_PRINT_CHAR ((unsigned char) c, type, stream); -+ } -+ } - break; - - case TYPE_CODE_STRUCT: -diff --git a/gdb/testsuite/gdb.fortran/printing-types.exp b/gdb/testsuite/gdb.fortran/printing-types.exp ---- a/gdb/testsuite/gdb.fortran/printing-types.exp -+++ b/gdb/testsuite/gdb.fortran/printing-types.exp -@@ -30,7 +30,7 @@ if {![fortran_runto_main]} then { - gdb_breakpoint [gdb_get_line_number "write"] - gdb_continue_to_breakpoint "write" - --gdb_test "print oneByte" " = 1" -+gdb_test "print oneByte" " = 1 \'\\\\001\'" - gdb_test "print twobytes" " = 2" - gdb_test "print chvalue" " = \'a\'" - gdb_test "print logvalue" " = \.TRUE\." diff --git a/gdb-vla-intel-fortran-strides.patch b/gdb-vla-intel-fortran-strides.patch deleted file mode 100644 index df7dc0d..0000000 --- a/gdb-vla-intel-fortran-strides.patch +++ /dev/null @@ -1,1778 +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-vla-intel-fortran-strides.patch - -;; VLA (Fortran dynamic arrays) from Intel + archer-jankratochvil-vla tests. -;;=push - -git diff --stat -p gdb/master...gdb/users/bheckel/fortran-strides -dbfd7140bf4c0500d1f5d192be781f83f78f7922 - - gdb/dwarf2loc.c | 46 ++- - gdb/dwarf2loc.h | 6 + - gdb/dwarf2read.c | 13 +- - gdb/eval.c | 391 +++++++++++++++++++++----- - gdb/expprint.c | 20 +- - gdb/expression.h | 18 +- - gdb/f-exp.y | 42 ++- - gdb/f-valprint.c | 8 +- - gdb/gdbtypes.c | 34 ++- - gdb/gdbtypes.h | 18 +- - gdb/parse.c | 24 +- - gdb/rust-exp.y | 12 +- - gdb/rust-lang.c | 17 +- - gdb/testsuite/gdb.fortran/static-arrays.exp | 421 ++++++++++++++++++++++++++++ - gdb/testsuite/gdb.fortran/static-arrays.f90 | 55 ++++ - gdb/testsuite/gdb.fortran/vla-ptype.exp | 4 + - gdb/testsuite/gdb.fortran/vla-sizeof.exp | 4 + - gdb/testsuite/gdb.fortran/vla-stride.exp | 44 +++ - gdb/testsuite/gdb.fortran/vla-stride.f90 | 29 ++ - gdb/testsuite/gdb.fortran/vla.f90 | 10 + - gdb/valarith.c | 10 +- - gdb/valops.c | 197 +++++++++++-- - gdb/value.h | 2 + - 23 files changed, 1242 insertions(+), 183 deletions(-) - -diff --git a/gdb/eval.c b/gdb/eval.c ---- a/gdb/eval.c -+++ b/gdb/eval.c -@@ -371,29 +371,323 @@ init_array_element (struct value *array, struct value *element, - return index; - } - -+/* Evaluates any operation on Fortran arrays or strings with at least -+ one user provided parameter. Expects the input ARRAY to be either -+ an array, or a string. Evaluates EXP by incrementing POS, and -+ writes the content from the elt stack into a local struct. NARGS -+ specifies number of literal or range arguments the user provided. -+ NARGS must be the same number as ARRAY has dimensions. */ -+ - static struct value * --value_f90_subarray (struct value *array, -- struct expression *exp, int *pos, enum noside noside) -+value_f90_subarray (struct value *array, struct expression *exp, -+ int *pos, int nargs, 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)); -+ int i, dim_count = 0; -+ struct value *new_array = array; -+ struct type *array_type = check_typedef (value_type (new_array)); -+ struct type *elt_type; -+ -+ typedef struct -+ { -+ enum range_type f90_range_type; -+ LONGEST low, high, stride; -+ } subscript_range; -+ -+ typedef enum subscript_kind -+ { -+ SUBSCRIPT_RANGE, /* e.g. "(lowbound:highbound)" */ -+ SUBSCRIPT_INDEX /* e.g. "(literal)" */ -+ } kind; -+ -+ /* Local struct to hold user data for Fortran subarray dimensions. */ -+ struct subscript_store -+ { -+ /* For every dimension, we are either working on a range or an index -+ expression, so we store this info separately for later. */ -+ enum subscript_kind kind; -+ -+ /* We also store either the lower and upper bound info, or the index -+ number. Before evaluation of the input values, we do not know if we are -+ actually working on a range of ranges, or an index in a range. So as a -+ first step we store all input in a union. The array calculation itself -+ deals with this later on. */ -+ union element_range -+ { -+ subscript_range range; -+ LONGEST number; -+ } U; -+ } *subscript_array; -+ -+ /* Check if the number of arguments provided by the user matches -+ the number of dimension of the array. A string has only one -+ dimension. */ -+ if (nargs != calc_f77_array_dims (value_type (new_array))) -+ error (_("Wrong number of subscripts")); -+ -+ subscript_array = (struct subscript_store*) alloca (sizeof (*subscript_array) * nargs); -+ -+ /* Parse the user input into the SUBSCRIPT_ARRAY to store it. We need -+ to evaluate it first, as the input is from left-to-right. The -+ array is stored from right-to-left. So we have to use the user -+ input in reverse order. Later on, we need the input information to -+ re-calculate the output array. For multi-dimensional arrays, we -+ can be dealing with any possible combination of ranges and indices -+ for every dimension. */ -+ for (i = 0; i < nargs; i++) -+ { -+ struct subscript_store *index = &subscript_array[i]; -+ -+ /* The user input is a range, with or without lower and upper bound. -+ E.g.: "p arry(2:5)", "p arry( :5)", "p arry( : )", etc. */ -+ if (exp->elts[*pos].opcode == OP_RANGE) -+ { -+ int pc = (*pos) + 1; -+ subscript_range *range; -+ -+ index->kind = SUBSCRIPT_RANGE; -+ range = &index->U.range; -+ -+ *pos += 3; -+ range->f90_range_type = (enum range_type) exp->elts[pc].longconst; -+ -+ /* If a lower bound was provided by the user, the bit has been -+ set and we can assign the value from the elt stack. Same for -+ upper bound. */ -+ if ((range->f90_range_type & SUBARRAY_LOW_BOUND) -+ == SUBARRAY_LOW_BOUND) -+ range->low = value_as_long (evaluate_subexp (nullptr, exp, -+ pos, noside)); -+ if ((range->f90_range_type & SUBARRAY_HIGH_BOUND) -+ == SUBARRAY_HIGH_BOUND) -+ range->high = value_as_long (evaluate_subexp (nullptr, exp, -+ pos, noside)); -+ -+ /* Assign the user's stride value if provided. */ -+ if ((range->f90_range_type & SUBARRAY_STRIDE) == SUBARRAY_STRIDE) -+ range->stride = value_as_long (evaluate_subexp (nullptr, exp, -+ pos, noside)); -+ -+ /* Assign the default stride value '1'. */ -+ else -+ range->stride = 1; - -- 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)); -+ /* Check the provided stride value is illegal, aka '0'. */ -+ if (range->stride == 0) -+ error (_("Stride must not be 0")); -+ } -+ /* User input is an index. E.g.: "p arry(5)". */ -+ else -+ { -+ struct value *val; -+ -+ index->kind = SUBSCRIPT_INDEX; -+ -+ /* Evaluate each subscript; it must be a legal integer in F77. This -+ ensures the validity of the provided index. */ -+ val = evaluate_subexp_with_coercion (exp, pos, noside); -+ index->U.number = value_as_long (val); -+ } -+ -+ } -+ -+ /* Traverse the array from right to left and set the high and low bounds -+ for later use. */ -+ for (i = nargs - 1; i >= 0; i--) -+ { -+ struct subscript_store *index = &subscript_array[i]; -+ struct type *index_type = array_type->index_type (); -+ -+ switch (index->kind) -+ { -+ case SUBSCRIPT_RANGE: -+ { -+ -+ /* When we hit the first range specified by the user, we must -+ treat any subsequent user entry as a range. We simply -+ increment DIM_COUNT which tells us how many times we are -+ calling VALUE_SLICE_1. */ -+ subscript_range *range = &index->U.range; -+ -+ /* If no lower bound was provided by the user, we take the -+ default boundary. Same for the high bound. */ -+ if ((range->f90_range_type & SUBARRAY_LOW_BOUND) == 0) -+ range->low = index_type->bounds ()->low.const_val (); -+ -+ if ((range->f90_range_type & SUBARRAY_HIGH_BOUND) == 0) -+ range->high = index_type->bounds ()->high.const_val (); -+ -+ /* Both user provided low and high bound have to be inside the -+ array bounds. Throw an error if not. */ -+ if (range->low < index_type->bounds ()->low.const_val () -+ || range->low > index_type->bounds ()->high.const_val () -+ || range->high < index_type->bounds ()->low.const_val () -+ || range->high > index_type->bounds ()->high.const_val ()) -+ error (_("provided bound(s) outside array bound(s)")); -+ -+ /* For a negative stride the lower boundary must be larger than the -+ upper boundary. -+ For a positive stride the lower boundary must be smaller than the -+ upper boundary. */ -+ if ((range->stride < 0 && range->low < range->high) -+ || (range->stride > 0 && range->low > range->high)) -+ error (_("Wrong value provided for stride and boundaries")); -+ -+ } -+ break; -+ -+ case SUBSCRIPT_INDEX: -+ break; -+ -+ } -+ -+ array_type = TYPE_TARGET_TYPE (array_type); -+ } -+ -+ /* Reset ARRAY_TYPE before slicing.*/ -+ array_type = check_typedef (value_type (new_array)); -+ -+ /* Traverse the array from right to left and evaluate each corresponding -+ user input. VALUE_SUBSCRIPT is called for every index, until a range -+ expression is evaluated. After a range expression has been evaluated, -+ every subsequent expression is also treated as a range. */ -+ for (i = nargs - 1; i >= 0; i--) -+ { -+ struct subscript_store *index = &subscript_array[i]; -+ struct type *index_type = array_type->index_type (); -+ -+ switch (index->kind) -+ { -+ case SUBSCRIPT_RANGE: -+ { -+ -+ /* When we hit the first range specified by the user, we must -+ treat any subsequent user entry as a range. We simply -+ increment DIM_COUNT which tells us how many times we are -+ calling VALUE_SLICE_1. */ -+ subscript_range *range = &index->U.range; -+ -+ /* DIM_COUNT counts every user argument that is treated as a range. -+ This is necessary for expressions like 'print array(7, 8:9). -+ Here the first argument is a literal, but must be treated as a -+ range argument to allow the correct output representation. */ -+ dim_count++; -+ -+ new_array -+ = value_slice_1 (new_array, range->low, -+ range->high - range->low + 1, -+ range->stride, dim_count); -+ } -+ break; -+ -+ case SUBSCRIPT_INDEX: -+ { -+ /* DIM_COUNT only stays '0' when no range argument was processed -+ before, starting from the last dimension. This way we can -+ reduce the number of dimensions from the result array. -+ However, if a range has been processed before an index, we -+ treat the index like a range with equal low- and high bounds -+ to get the value offset right. */ -+ if (dim_count == 0) -+ new_array -+ = value_subscripted_rvalue (new_array, index->U.number, -+ f77_get_lowerbound (value_type -+ (new_array))); -+ else -+ { -+ dim_count++; -+ -+ /* We might end up here, because we have to treat the provided -+ index like a range. But now VALUE_SUBSCRIPTED_RVALUE -+ cannot do the range checks for us. So we have to make sure -+ ourselves that the user provided index is inside the -+ array bounds. Throw an error if not. */ -+ if (index->U.number < index_type->bounds ()->low.const_val () -+ && index->U.number > index_type->bounds ()->high.const_val ()) -+ error (_("provided bound(s) outside array bound(s)")); -+ -+ if (index->U.number > index_type->bounds ()->low.const_val () -+ && index->U.number > index_type->bounds ()->high.const_val ()) -+ error (_("provided bound(s) outside array bound(s)")); -+ -+ new_array = value_slice_1 (new_array, -+ index->U.number, -+ 1, /* COUNT is '1' element */ -+ 1, /* STRIDE set to '1' */ -+ dim_count); -+ } -+ -+ } -+ break; -+ } -+ array_type = TYPE_TARGET_TYPE (array_type); -+ } -+ -+ /* With DIM_COUNT > 1 we currently have a one dimensional array, but expect -+ an array of arrays, depending on how many ranges have been provided by -+ the user. So we need to rebuild the array dimensions for printing it -+ correctly. -+ Starting from right to left in the user input, after we hit the first -+ range argument every subsequent argument is also treated as a range. -+ E.g.: -+ "p ary(3, 7, 2:15)" in Fortran has only 1 dimension, but we calculated 3 -+ ranges. -+ "p ary(3, 7:12, 4)" in Fortran has only 1 dimension, but we calculated 2 -+ ranges. -+ "p ary(2:4, 5, 7)" in Fortran has only 1 dimension, and we calculated 1 -+ range. */ -+ if (dim_count > 1) -+ { -+ struct value *v = NULL; -+ -+ elt_type = TYPE_TARGET_TYPE (value_type (new_array)); - -- return value_slice (array, low_bound, high_bound - low_bound + 1); -+ /* Every SUBSCRIPT_RANGE in the user input signifies an actual range in -+ the output array. So we traverse the SUBSCRIPT_ARRAY again, looking -+ for a range entry. When we find one, we use the range info to create -+ an additional range_type to set the correct bounds and dimensions for -+ the output array. In addition, we may have a stride value that is not -+ '1', forcing us to adjust the number of elements in a range, according -+ to the stride value. */ -+ for (i = 0; i < nargs; i++) -+ { -+ struct subscript_store *index = &subscript_array[i]; -+ -+ if (index->kind == SUBSCRIPT_RANGE) -+ { -+ struct type *range_type, *interim_array_type; -+ -+ int new_length; -+ -+ /* The length of a sub-dimension with all elements between the -+ bounds plus the start element itself. It may be modified by -+ a user provided stride value. */ -+ new_length = index->U.range.high - index->U.range.low; -+ -+ new_length /= index->U.range.stride; -+ -+ range_type -+ = create_static_range_type (NULL, -+ elt_type, -+ index->U.range.low, -+ index->U.range.low + new_length); -+ -+ interim_array_type = create_array_type (NULL, -+ elt_type, -+ range_type); -+ -+ interim_array_type->set_code ( value_type (new_array)->code ()); -+ -+ v = allocate_value (interim_array_type); -+ -+ elt_type = value_type (v); -+ } -+ -+ } -+ value_contents_copy (v, 0, new_array, 0, TYPE_LENGTH (elt_type)); -+ return v; -+ } -+ -+ return new_array; - } - - -@@ -1233,19 +1527,6 @@ evaluate_funcall (type *expect_type, expression *exp, int *pos, - 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 true if type is integral or reference to integral */ - - static bool -@@ -1953,33 +2234,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 value_f90_subarray (arg1, exp, pos, nargs, noside); - - case TYPE_CODE_PTR: - case TYPE_CODE_FUNC: -@@ -2400,49 +2656,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) -@@ -3360,6 +3573,9 @@ 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/expprint.c b/gdb/expprint.c ---- a/gdb/expprint.c -+++ b/gdb/expprint.c -@@ -576,17 +576,14 @@ 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 & SUBARRAY_HIGH_BOUND_EXCLUSIVE) -+ == SUBARRAY_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 & SUBARRAY_LOW_BOUND) == SUBARRAY_LOW_BOUND) - 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 & SUBARRAY_HIGH_BOUND) == SUBARRAY_HIGH_BOUND) - print_subexp (exp, pos, stream, PREC_ABOVE_COMMA); - fputs_filtered (")", stream); - return; -@@ -1103,22 +1100,24 @@ dump_subexp_body_standard (struct expression *exp, - - switch (range_type) - { -- case BOTH_BOUND_DEFAULT: -+ case SUBARRAY_NONE_BOUND: - fputs_filtered ("Range '..'", stream); - break; -- case LOW_BOUND_DEFAULT: -+ case SUBARRAY_HIGH_BOUND: - fputs_filtered ("Range '..EXP'", stream); - break; -- case LOW_BOUND_DEFAULT_EXCLUSIVE: -- fputs_filtered ("ExclusiveRange '..EXP'", stream); -- break; -- case HIGH_BOUND_DEFAULT: -+ case SUBARRAY_LOW_BOUND: - fputs_filtered ("Range 'EXP..'", stream); - break; -- case NONE_BOUND_DEFAULT: -+ case (SUBARRAY_LOW_BOUND -+ | SUBARRAY_HIGH_BOUND -+ | SUBARRAY_HIGH_BOUND_EXCLUSIVE): -+ fputs_filtered ("ExclusiveRange '..EXP'", stream); -+ break; -+ case (SUBARRAY_LOW_BOUND | SUBARRAY_HIGH_BOUND): - fputs_filtered ("Range 'EXP..EXP'", stream); - break; -- case NONE_BOUND_DEFAULT_EXCLUSIVE: -+ case (SUBARRAY_HIGH_BOUND | SUBARRAY_HIGH_BOUND_EXCLUSIVE): - fputs_filtered ("ExclusiveRange 'EXP..EXP'", stream); - break; - default: -@@ -1126,11 +1125,9 @@ dump_subexp_body_standard (struct expression *exp, - break; - } - -- if (range_type == HIGH_BOUND_DEFAULT -- || range_type == NONE_BOUND_DEFAULT) -+ if ((range_type & SUBARRAY_LOW_BOUND) == SUBARRAY_LOW_BOUND) - elt = dump_subexp (exp, stream, elt); -- if (range_type == LOW_BOUND_DEFAULT -- || range_type == NONE_BOUND_DEFAULT) -+ if ((range_type & SUBARRAY_HIGH_BOUND) == SUBARRAY_HIGH_BOUND) - 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 -@@ -167,28 +167,27 @@ extern void dump_raw_expression (struct expression *, - struct ui_file *, const char *); - extern void dump_prefix_expression (struct expression *, struct ui_file *); - --/* In an OP_RANGE expression, either bound could be empty, indicating -- that its value is by default that of the corresponding bound of the -- array or string. Also, the upper end of the range can be exclusive -- or inclusive. So we have six sorts of subrange. This enumeration -- type is to identify this. */ -+/* In an OP_RANGE expression, either bound can be provided by the -+ user, or not. In addition to this, the user can also specify a -+ stride value to indicated only certain elements of the array. -+ Also, the upper end of the range can be exclusive or inclusive. -+ This enumeration type is to identify this. */ - - enum range_type --{ -- /* 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, --}; -+ { -+ SUBARRAY_NONE_BOUND = 0x0, /* "( : )" */ -+ SUBARRAY_LOW_BOUND = 0x1, /* "(low:)" */ -+ SUBARRAY_HIGH_BOUND = 0x2, /* "(:high)" */ -+ SUBARRAY_STRIDE = 0x4, /* "(::stride)" */ -+ /* The low bound was not given and the high bound is exclusive. -+ In this case we always use (SUBARRAY_HIGH_BOUND | -+ SUBARRAY_HIGH_BOUND_EXCLUSIVE). */ -+ SUBARRAY_HIGH_BOUND_EXCLUSIVE = 0x8, -+ /* Both bounds were given. The low bound is inclusive and the high -+ bound is exclusive. In this case, we use (SUBARRAY_LOW_BOUND | -+ SUBARRAY_HIGH_BOUND | SUBARRAY_HIGH_BOUND_EXCLUSIVE). */ -+ // SUBARRAY_LOW_BOUND_EXCLUSIVE = (SUBARRAY_LOW_BOUND -+ // | SUBARRAY_HIGH_BOUND_EXCLUSIVE), -+ }; - - #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 -@@ -282,31 +282,63 @@ arglist : subrange - - arglist : arglist ',' exp %prec ABOVE_COMMA - { pstate->arglist_len++; } -+ | arglist ',' subrange %prec ABOVE_COMMA -+ { pstate->arglist_len++; } - ; - - /* 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, -+ SUBARRAY_LOW_BOUND | SUBARRAY_HIGH_BOUND); - 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, SUBARRAY_LOW_BOUND); - 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, SUBARRAY_HIGH_BOUND); - 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, SUBARRAY_NONE_BOUND); -+ write_exp_elt_opcode (pstate, OP_RANGE); } -+ ; -+ -+/* Each subrange type can have a stride argument. */ -+subrange: exp ':' exp ':' exp %prec ABOVE_COMMA -+ { write_exp_elt_opcode (pstate, OP_RANGE); -+ write_exp_elt_longcst (pstate, SUBARRAY_LOW_BOUND -+ | SUBARRAY_HIGH_BOUND -+ | SUBARRAY_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, SUBARRAY_LOW_BOUND -+ | SUBARRAY_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, SUBARRAY_HIGH_BOUND -+ | SUBARRAY_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, SUBARRAY_STRIDE); - write_exp_elt_opcode (pstate, OP_RANGE); } - ; - -diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c ---- a/gdb/f-valprint.c -+++ b/gdb/f-valprint.c -@@ -129,6 +129,11 @@ f77_print_array_1 (int nss, int ndimensions, struct type *type, - byte_stride = dim_size; - size_t offs = 0; - -+ if (byte_stride) -+ dim_size = byte_stride; -+ else -+ dim_size = TYPE_LENGTH (TYPE_TARGET_TYPE (type)); -+ - for (i = lowerbound; - (i < upperbound + 1 && (*elts) < options->print_max); - i++) -diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c ---- a/gdb/gdbtypes.c -+++ b/gdb/gdbtypes.c -@@ -1006,7 +1006,8 @@ create_static_range_type (struct type *result_type, struct type *index_type, - low.set_const_val (low_bound); - high.set_const_val (high_bound); - -- result_type = create_range_type (result_type, index_type, &low, &high, 0); -+ result_type = create_range_type (result_type, index_type, -+ &low, &high, 0); - - return result_type; - } -diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h ---- a/gdb/gdbtypes.h -+++ b/gdb/gdbtypes.h -@@ -1615,6 +1615,15 @@ extern unsigned type_align (struct type *); - space in struct type. */ - extern bool set_type_align (struct type *, ULONGEST); - -+#define TYPE_BYTE_STRIDE(range_type) \ -+ TYPE_RANGE_DATA(range_type)->stride.data.const_val -+#define TYPE_BYTE_STRIDE_BLOCK(range_type) \ -+ TYPE_RANGE_DATA(range_type)->stride.data.locexpr -+#define TYPE_BYTE_STRIDE_LOCLIST(range_type) \ -+ TYPE_RANGE_DATA(range_type)->stride.data.loclist -+#define TYPE_BYTE_STRIDE_KIND(range_type) \ -+ TYPE_RANGE_DATA(range_type)->stride.kind -+ - /* Property accessors for the type data location. */ - #define TYPE_DATA_LOCATION(thistype) \ - ((thistype)->dyn_prop (DYN_PROP_DATA_LOCATION)) -@@ -1633,6 +1642,26 @@ extern bool set_type_align (struct type *, ULONGEST); - #define TYPE_ASSOCIATED_PROP(thistype) \ - ((thistype)->dyn_prop (DYN_PROP_ASSOCIATED)) - -+/* Accessors for struct range_bounds data attached to an array type's -+ index type. */ -+ -+#define TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED(arraytype) \ -+ ((arraytype)->index_type ()->bounds ()->high.kind () == PROP_UNDEFINED) -+#define TYPE_ARRAY_LOWER_BOUND_IS_UNDEFINED(arraytype) \ -+ (arraytype->index_type ()->bounds ().low.kind () == PROP_UNDEFINED) -+#define TYPE_ARRAY_STRIDE_IS_UNDEFINED(arraytype) \ -+ (TYPE_BYTE_STRIDE(arraytype->index_type ()) == 0) -+ -+ -+#define TYPE_ARRAY_UPPER_BOUND_VALUE(arraytype) \ -+ (TYPE_HIGH_BOUND((arraytype)->index_type ())) -+ -+#define TYPE_ARRAY_LOWER_BOUND_VALUE(arraytype) \ -+ (TYPE_LOW_BOUND((arraytype)->index_type ())) -+ -+#define TYPE_ARRAY_BIT_STRIDE(arraytype) \ -+ (TYPE_BIT_STRIDE((arraytype)->index_type ())) -+ - /* C++ */ - - #define TYPE_SELF_TYPE(thistype) internal_type_self_type (thistype) -diff --git a/gdb/parse.c b/gdb/parse.c ---- a/gdb/parse.c -+++ b/gdb/parse.c -@@ -919,24 +919,20 @@ operator_length_standard (const struct expression *expr, int endpos, - - case OP_RANGE: - oplen = 3; -+ args = 0; - 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; -- } -+ /* Increment the argument counter for each argument -+ provided by the user. */ -+ if ((range_type & SUBARRAY_LOW_BOUND) == SUBARRAY_LOW_BOUND) -+ args++; -+ -+ if ((range_type & SUBARRAY_HIGH_BOUND) == SUBARRAY_HIGH_BOUND) -+ args++; -+ -+ if ((range_type & SUBARRAY_STRIDE) == SUBARRAY_STRIDE) -+ 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,28 @@ 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 = SUBARRAY_NONE_BOUND; - - if (operation->left.op != NULL) - { - convert_ast_to_expression (operation->left.op, top); -- kind = HIGH_BOUND_DEFAULT; -+ kind = SUBARRAY_LOW_BOUND; - } - 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 == SUBARRAY_NONE_BOUND) -+ { -+ kind = (range_type) SUBARRAY_HIGH_BOUND; -+ if (!operation->inclusive) -+ kind = (range_type) (kind | SUBARRAY_HIGH_BOUND_EXCLUSIVE); -+ } - else - { -- gdb_assert (kind == HIGH_BOUND_DEFAULT); -- kind = (operation->inclusive -- ? NONE_BOUND_DEFAULT : NONE_BOUND_DEFAULT_EXCLUSIVE); -+ gdb_assert (kind == SUBARRAY_LOW_BOUND); -+ kind = (range_type) (kind | SUBARRAY_HIGH_BOUND); -+ if (!operation->inclusive) -+ kind = (range_type) (kind | SUBARRAY_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 & SUBARRAY_LOW_BOUND) == SUBARRAY_LOW_BOUND) - 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 & SUBARRAY_HIGH_BOUND) == SUBARRAY_HIGH_BOUND) - high = evaluate_subexp (nullptr, exp, pos, noside); -- bool inclusive = (kind == NONE_BOUND_DEFAULT || kind == LOW_BOUND_DEFAULT); -+ bool inclusive = (!((kind & SUBARRAY_HIGH_BOUND_EXCLUSIVE) == SUBARRAY_HIGH_BOUND_EXCLUSIVE)); - - if (noside == EVAL_SKIP) - return value_from_longest (builtin_type (exp->gdbarch)->builtin_int, 1); -@@ -1177,7 +1175,7 @@ rust_compute_range (struct type *type, struct value *range, - - *low = 0; - *high = 0; -- *kind = BOTH_BOUND_DEFAULT; -+ *kind = SUBARRAY_NONE_BOUND; - - if (type->num_fields () == 0) - return; -@@ -1185,15 +1183,14 @@ 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 = SUBARRAY_LOW_BOUND; - *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 = (range_type) (*kind | SUBARRAY_HIGH_BOUND); - *high = value_as_long (value_field (range, i)); - - if (rust_inclusive_range_type_p (type)) -@@ -1211,7 +1208,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; -+ enum range_type kind = SUBARRAY_NONE_BOUND; - LONGEST high = 0; - int want_slice = 0; - -@@ -1309,7 +1306,7 @@ rust_subscript (struct expression *exp, int *pos, enum noside noside, - error (_("Cannot subscript non-array type")); - - if (want_slice -- && (kind == BOTH_BOUND_DEFAULT || kind == LOW_BOUND_DEFAULT)) -+ && ((kind & SUBARRAY_LOW_BOUND) != SUBARRAY_LOW_BOUND)) - 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 & SUBARRAY_HIGH_BOUND) != SUBARRAY_HIGH_BOUND) - high = high_bound; - if (high < 0) - error (_("High index less than zero")); -diff --git a/gdb/testsuite/gdb.fortran/static-arrays.exp b/gdb/testsuite/gdb.fortran/static-arrays.exp -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/static-arrays.exp -@@ -0,0 +1,421 @@ -+# Copyright 2015 Free Software Foundation, Inc. -+# -+# Contributed by Intel Corp. -+# -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+standard_testfile static-arrays.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 "BP1"] -+gdb_continue_to_breakpoint "BP1" ".*BP1.*" -+ -+# Tests subarrays of one dimensional arrays with subrange variations -+gdb_test "print ar1" "\\$\[0-9\]+ = \\(1, 2, 3, 4, 5, 6, 7, 8, 9\\)" \ -+ "print ar1." -+gdb_test "print ar1\(4:7\)" "\\$\[0-9\]+ = \\(4, 5, 6, 7\\)" \ -+ "print ar1\(4:7\)" -+gdb_test "print ar1\(8:\)" "\\$\[0-9\]+ = \\(8, 9\\).*" \ -+ "print ar1\(8:\)" -+gdb_test "print ar1\(:3\)" "\\$\[0-9\]+ = \\(1, 2, 3\\).*" \ -+ "print ar1\(:3\)" -+gdb_test "print ar1\(:\)" "\\$\[0-9\]+ = \\(1, 2, 3, 4, 5, 6, 7, 8, 9\\)" \ -+ "print ar1\(:\)" -+ -+# Check assignment -+gdb_test_no_output "set \$my_ary = ar1\(3:8\)" -+gdb_test "print \$my_ary" \ -+ "\\$\[0-9\]+ = \\(3, 4, 5, 6, 7, 8\\)" \ -+ "Assignment of subarray to variable" -+gdb_test_no_output "set ar1\(5\) = 42" -+ gdb_test "print ar1\(3:8\)" \ -+ "\\$\[0-9\]+ = \\(3, 4, 42, 6, 7, 8\\)" \ -+ "print ar1\(3:8\) after assignment" -+gdb_test "print \$my_ary" \ -+ "\\$\[0-9\]+ = \\(3, 4, 5, 6, 7, 8\\)" \ -+ "Assignment of subarray to variable after original array changed" -+ -+# Test for subarrays of one dimensional arrays with literals -+ gdb_test "print ar1\(3\)" "\\$\[0-9\]+ = 3" \ -+ "print ar1\(3\)" -+ -+# Tests for subranges of 2 dimensional arrays with subrange variations -+gdb_test "print ar2\(2:3, 3:4\)" \ -+ "\\$\[0-9\]+ = \\(\\( 23, 33\\) \\( 24, 34\\) \\)" \ -+ "print ar2\(2:3, 3:4\)." -+gdb_test "print ar2\(8:9,8:\)" \ -+ "\\$\[0-9\]+ = \\(\\( 88, 98\\) \\( 89, 99\\) \\)" \ -+ "print ar2\(8:9,8:\)" -+gdb_test "print ar2\(8:9,:2\)" \ -+ "\\$\[0-9\]+ = \\(\\( 81, 91\\) \\( 82, 92\\) \\)" \ -+ "print ar2\(8:9,:2\)" -+ -+gdb_test "print ar2\(8:,8:9\)" \ -+ "\\$\[0-9\]+ = \\(\\( 88, 98\\) \\( 89, 99\\) \\)" \ -+ "print ar2\(8:,8:9\)" -+gdb_test "print ar2\(8:,8:\)" \ -+ "\\$\[0-9\]+ = \\(\\( 88, 98\\) \\( 89, 99\\) \\)" \ -+ "print ar2\(8:,8:\)" -+gdb_test "print ar2\(8:,:2\)" \ -+ "\\$\[0-9\]+ = \\(\\( 81, 91\\) \\( 82, 92\\) \\)" \ -+ "print ar2\(8:,:2\)" -+ -+gdb_test "print ar2\(:2,2:3\)" \ -+ "\\$\[0-9\]+ = \\(\\( 12, 22\\) \\( 13, 23\\) \\)" \ -+ "print ar2\(:2,2:3\)" -+gdb_test "print ar2\(:2,8:\)" \ -+ "\\$\[0-9\]+ = \\(\\( 18, 28\\) \\( 19, 29\\) \\)" \ -+ "print ar2\(:2,8:\)" -+gdb_test "print ar2\(:2,:2\)" \ -+ "\\$\[0-9\]+ = \\(\\( 11, 21\\) \\( 12, 22\\) \\)" \ -+ "print ar2\(:2,:2\)" -+ -+# Test subranges of 2 dimensional arrays with literals and subrange variations -+gdb_test "print ar2\(7, 3:6\)" \ -+ "\\$\[0-9\]+ = \\(73, 74, 75, 76\\)" \ -+ "print ar2\(7, 3:6\)" -+gdb_test "print ar2\(7,8:\)" \ -+ "\\$\[0-9\]+ = \\(78, 79\\)" \ -+ "print ar2\(7,8:\)" -+gdb_test "print ar2\(7,:2\)" \ -+ "\\$\[0-9\]+ = \\(71, 72\\)" \ -+ "print ar2\(7,:2\)" -+ -+gdb_test "print ar2\(7:8,4\)" \ -+ "\\$\[0-9\]+ = \\(74, 84\\)" \ -+ "print ar2(7:8,4\)" -+gdb_test "print ar2\(8:,4\)" \ -+ "\\$\[0-9\]+ = \\(84, 94\\)" \ -+ "print ar2\(8:,4\)" -+gdb_test "print ar2\(:2,4\)" \ -+ "\\$\[0-9\]+ = \\(14, 24\\)" \ -+ "print ar2\(:2,4\)" -+gdb_test "print ar2\(3,4\)" \ -+ "\\$\[0-9\]+ = 34" \ -+ "print ar2\(3,4\)" -+ -+# Test subarrays of 3 dimensional arrays with literals and subrange variations -+gdb_test "print ar3\(2:4,3:4,7:8\)" \ -+ "\\$\[0-9\]+ = \\(\\( \\( 237, 337, 437\\) \\( 247, 347, 447\\)\ -+ \\) \\( \\( 238, 338, 438\\) \\( 248, 348, 448\\) \\) \\)" \ -+ "print ar3\(2:4,3:4,7:8\)" -+gdb_test "print ar3\(2:3,4:5,8:\)" \ -+ "\\$\[0-9\]+ = \\(\\( \\( 248, 348\\) \\( 258, 358\\) \\) \\(\ -+ \\( 249, 349\\) \\( 259, 359\\) \\) \\)" \ -+ "print ar3\(2:3,4:5,8:\)" -+gdb_test "print ar3\(2:3,4:5,:2\)" \ -+ "\\$\[0-9\]+ = \\(\\( \\( 241, 341\\) \\( 251, 351\\) \\) \\(\ -+ \\( 242, 342\\) \\( 252, 352\\) \\) \\)" \ -+ "print ar3\(2:3,4:5,:2\)" -+ -+gdb_test "print ar3\(2:3,8:,7:8\)" \ -+ "\\$\[0-9\]+ = \\(\\( \\( 287, 387\\) \\( 297, 397\\) \\) \\(\ -+ \\( 288, 388\\) \\( 298, 398\\) \\) \\)" \ -+ "print ar3\(2:3,8:,7:8\)" -+gdb_test "print ar3\(2:3,8:,8:\)" \ -+ "\\$\[0-9\]+ = \\(\\( \\( 288, 388\\) \\( 298, 398\\) \\) \\(\ -+ \\( 289, 389\\) \\( 299, 399\\) \\) \\)" \ -+ "print ar3\(2:3,8:,8:\)" -+gdb_test "print ar3\(2:3,8:,:2\)" \ -+ "\\$\[0-9\]+ = \\(\\( \\( 281, 381\\) \\( 291, 391\\) \\) \\(\ -+ \\( 282, 382\\) \\( 292, 392\\) \\) \\)" \ -+ "print ar3\(2:3,8:,:2\)" -+ -+gdb_test "print ar3\(2:3,:2,7:8\)" \ -+ "\\$\[0-9\]+ = \\(\\( \\( 217, 317\\) \\( 227, 327\\) \\) \\(\ -+ \\( 218, 318\\) \\( 228, 328\\) \\) \\)" \ -+ "print ar3\(2:3,:2,7:8\)" -+gdb_test "print ar3\(2:3,:2,8:\)" \ -+ "\\$\[0-9\]+ = \\(\\( \\( 218, 318\\) \\( 228, 328\\) \\) \\(\ -+ \\( 219, 319\\) \\( 229, 329\\) \\) \\)" \ -+ "print ar3\(2:3,:2,8:\)" -+gdb_test "print ar3\(2:3,:2,:2\)" \ -+ "\\$\[0-9\]+ = \\(\\( \\( 211, 311\\) \\( 221, 321\\) \\) \\(\ -+ \\( 212, 312\\) \\( 222, 322\\) \\) \\)" \ -+ "print ar3\(2:3,:2,:2\)" -+ -+gdb_test "print ar3\(8:,3:4,7:8\)" \ -+ "\\$\[0-9\]+ = \\(\\( \\( 837, 937\\) \\( 847, 947\\) \\) \\(\ -+ \\( 838, 938\\) \\( 848, 948\\) \\) \\)" \ -+ "print ar3\(8:,3:4,7:8\)" -+gdb_test "print ar3\(8:,4:5,8:\)" \ -+ "\\$\[0-9\]+ = \\(\\( \\( 848, 948\\) \\( 858, 958\\) \\) \\(\ -+ \\( 849, 949\\) \\( 859, 959\\) \\) \\)" \ -+ "print ar3\(8:,4:5,8:\)" -+gdb_test "print ar3\(8:,4:5,:2\)" \ -+ "\\$\[0-9\]+ = \\(\\( \\( 841, 941\\) \\( 851, 951\\) \\) \\(\ -+ \\( 842, 942\\) \\( 852, 952\\) \\) \\)" \ -+ "print ar3\(8:,4:5,:2\)" -+ -+gdb_test "print ar3\(8:,8:,7:8\)" \ -+ "\\$\[0-9\]+ = \\(\\( \\( 887, 987\\) \\( 897, 997\\) \\) \\(\ -+ \\( 888, 988\\) \\( 898, 998\\) \\) \\)" \ -+ "print ar3\(8:,8:,7:8\)" -+gdb_test "print ar3\(8:,8:,8:\)" \ -+ "\\$\[0-9\]+ = \\(\\( \\( 888, 988\\) \\( 898, 998\\) \\) \\(\ -+ \\( 889, 989\\) \\( 899, 999\\) \\) \\)" \ -+ "print ar3\(8:,8:,8:\)" -+gdb_test "print ar3\(8:,8:,:2\)" \ -+ "\\$\[0-9\]+ = \\(\\( \\( 881, 981\\) \\( 891, 991\\) \\) \\(\ -+ \\( 882, 982\\) \\( 892, 992\\) \\) \\)" \ -+ "print ar3\(8:,8:,:2\)" -+ -+gdb_test "print ar3\(8:,:2,7:8\)" \ -+ "\\$\[0-9\]+ = \\(\\( \\( 817, 917\\) \\( 827, 927\\) \\) \\(\ -+ \\( 818, 918\\) \\( 828, 928\\) \\) \\)" \ -+ "print ar3\(8:,:2,7:8\)" -+gdb_test "print ar3\(8:,:2,8:\)" \ -+ "\\$\[0-9\]+ = \\(\\( \\( 818, 918\\) \\( 828, 928\\) \\) \\(\ -+ \\( 819, 919\\) \\( 829, 929\\) \\) \\)" \ -+ "print ar3\(8:,:2,8:\)" -+gdb_test "print ar3\(8:,:2,:2\)" \ -+ "\\$\[0-9\]+ = \\(\\( \\( 811, 911\\) \\( 821, 921\\) \\) \\(\ -+ \\( 812, 912\\) \\( 822, 922\\) \\) \\)" \ -+ "print ar3\(8:,:2,:2\)" -+ -+ -+gdb_test "print ar3\(:2,3:4,7:8\)" \ -+ "\\$\[0-9\]+ = \\(\\( \\( 137, 237\\) \\( 147, 247\\) \\) \\(\ -+ \\( 138, 238\\) \\( 148, 248\\) \\) \\)" \ -+ "print ar3 \(:2,3:4,7:8\)." -+gdb_test "print ar3\(:2,3:4,8:\)" \ -+ "\\$\[0-9\]+ = \\(\\( \\( 138, 238\\) \\( 148, 248\\) \\) \\(\ -+ \\( 139, 239\\) \\( 149, 249\\) \\) \\)" \ -+ "print ar3\(:2,3:4,8:\)" -+gdb_test "print ar3\(:2,3:4,:2\)" \ -+ "\\$\[0-9\]+ = \\(\\( \\( 131, 231\\) \\( 141, 241\\) \\) \\(\ -+ \\( 132, 232\\) \\( 142, 242\\) \\) \\)" \ -+ "print ar3\(:2,3:4,:2\)" -+ -+gdb_test "print ar3\(:2,8:,7:8\)" "\\$\[0-9\]+ = \\(\\( \\( 187, 287\\) \\(\ -+ 197, 297\\) \\) \\( \\( 188, 288\\) \\( 198, 298\\) \\) \\)" \ -+ "print ar3\(:2,8:,7:8\)" -+gdb_test "print ar3\(:2,8:,8:\)" "\\$\[0-9\]+ = \\(\\( \\( 188, 288\\) \\( 198,\ -+ 298\\) \\) \\( \\( 189, 289\\) \\( 199, 299\\) \\) \\)" \ -+ "print ar3\(:2,8:,8:\)" -+gdb_test "print ar3\(:2,8:,:2\)" "\\$\[0-9\]+ = \\(\\( \\( 181, 281\\) \\( 191,\ -+ 291\\) \\) \\( \\( 182, 282\\) \\( 192, 292\\) \\) \\)" \ -+ "print ar3\(:2,8:,:2\)" -+ -+gdb_test "print ar3\(:2,:2,7:8\)" \ -+ "\\$\[0-9\]+ = \\(\\( \\( 117, 217\\) \\( 127, 227\\) \\) \\(\ -+ \\( 118, 218\\) \\( 128, 228\\) \\) \\)" \ -+ "print ar3\(:2,:2,7:8\)" -+gdb_test "print ar3\(:2,:2,8:\)" \ -+ "\\$\[0-9\]+ = \\(\\( \\( 118, 218\\) \\( 128, 228\\) \\) \\(\ -+ \\( 119, 219\\) \\( 129, 229\\) \\) \\)" \ -+ "print ar3\(:2,:2,8:\)" -+gdb_test "print ar3\(:2,:2,:2\)" \ -+ "\\$\[0-9\]+ = \\(\\( \\( 111, 211\\) \\( 121, 221\\) \\) \\(\ -+ \\( 112, 212\\) \\( 122, 222\\) \\) \\)" \ -+ "print ar3\(:2,:2,:2\)" -+ -+#Tests for subarrays of 3 dimensional arrays with literals and subranges -+gdb_test "print ar3\(3,3:4,7:8\)" \ -+ "\\$\[0-9\]+ = \\(\\( 337, 347\\) \\( 338, 348\\) \\)" \ -+ "print ar3\(3,3:4,7:8\)" -+gdb_test "print ar3\(3,4:5,8:\)" \ -+ "\\$\[0-9\]+ = \\(\\( 348, 358\\) \\( 349, 359\\) \\)" \ -+ "print ar3\(3,4:5,8:\)" -+gdb_test "print ar3\(3,4:5,:2\)" \ -+ "\\$\[0-9\]+ = \\(\\( 341, 351\\) \\( 342, 352\\) \\)" \ -+ "print ar3\(3,4:5,:2\)" -+gdb_test "print ar3\(3,4:5,3\)" \ -+ "\\$\[0-9\]+ = \\(343, 353\\)" \ -+ "print ar3\(3,4:5,3\)" -+ -+gdb_test "print ar3\(2,8:,7:8\)" \ -+ "\\$\[0-9\]+ = \\(\\( 287, 297\\) \\( 288, 298\\) \\)" \ -+ "print ar3\(2,8:,7:8\)" -+gdb_test "print ar3\(2,8:,8:\)" \ -+ "\\$\[0-9\]+ = \\(\\( 288, 298\\) \\( 289, 299\\) \\)" \ -+ "print ar3\(2,8:,8:\)" -+gdb_test "print ar3\(2,8:,:2\)"\ -+ "\\$\[0-9\]+ = \\(\\( 281, 291\\) \\( 282, 292\\) \\)" \ -+ "print ar3\(2,8:,:2\)" -+gdb_test "print ar3\(2,8:,3\)" \ -+ "\\$\[0-9\]+ = \\(283, 293\\)" \ -+ "print ar3\(2,8:,3\)" -+ -+gdb_test "print ar3\(2,:2,7:8\)" \ -+ "\\$\[0-9\]+ = \\(\\( 217, 227\\) \\( 218, 228\\) \\)" \ -+ "print ar3\(2,:2,7:8\)" -+gdb_test "print ar3\(2,:2,8:\)" \ -+ "\\$\[0-9\]+ = \\(\\( 218, 228\\) \\( 219, 229\\) \\)" \ -+ "print ar3\(2,:2,8:\)" -+gdb_test "print ar3\(2,:2,:2\)" \ -+ "\\$\[0-9\]+ = \\(\\( 211, 221\\) \\( 212, 222\\) \\)" \ -+ "print ar3\(2,:2,:2\)" -+gdb_test "print ar3\(2,:2,3\)" \ -+ "\\$\[0-9\]+ = \\(213, 223\\)" \ -+ "print ar3\(2,:2,3\)" -+ -+gdb_test "print ar3\(3,4,7:8\)" \ -+ "\\$\[0-9\]+ = \\(347, 348\\)" \ -+ "print ar3\(3,4,7:8\)" -+gdb_test "print ar3\(3,4,8:\)" \ -+ "\\$\[0-9\]+ = \\(348, 349\\)" \ -+i "print ar3\(3,4,8:\)" -+gdb_test "print ar3\(3,4,:2\)" \ -+ "\\$\[0-9\]+ = \\(341, 342\\)" \ -+ "print ar3\(3,4,:2\)" -+gdb_test "print ar3\(5,6,7\)" \ -+ "\\$\[0-9\]+ = 567" \ -+ "print ar3\(5,6,7\)" -+ -+gdb_test "print ar3\(3:4,6,7:8\)" \ -+ "\\$\[0-9\]+ = \\(\\( 367, 467\\) \\( 368, 468\\) \\)" \ -+ "print ar3\(3:4,6,7:8\)" -+gdb_test "print ar3\(3:4,6,8:\)" \ -+ "\\$\[0-9\]+ = \\(\\( 368, 468\\) \\( 369, 469\\) \\)" \ -+ "print ar3\(3:4,6,8:\)" -+gdb_test "print ar3\(3:4,6,:2\)" \ -+ "\\$\[0-9\]+ = \\(\\( 361, 461\\) \\( 362, 462\\) \\)" \ -+ "print ar3\(3:4,6,:2\)" -+gdb_test "print ar3\(3:4,6,5\)" \ -+ "\\$\[0-9\]+ = \\(365, 465\\)" \ -+ "print ar3\(3:4,6,5\)" -+ -+gdb_test "print ar3\(8:,6,7:8\)" \ -+ "\\$\[0-9\]+ = \\(\\( 867, 967\\) \\( 868, 968\\) \\)" \ -+ "print ar3\(8:,6,7:8\)" -+gdb_test "print ar3\(8:,6,8:\)" \ -+ "\\$\[0-9\]+ = \\(\\( 868, 968\\) \\( 869, 969\\) \\)" \ -+ "print ar3\(8:,6,8:\)" -+gdb_test "print ar3\(8:,6,:2\)" \ -+ "\\$\[0-9\]+ = \\(\\( 861, 961\\) \\( 862, 962\\) \\)" \ -+ "print ar3\(8:,6,:2\)" -+gdb_test "print ar3\(8:,6,5\)" \ -+ "\\$\[0-9\]+ = \\(865, 965\\)" \ -+ "print ar3\(8:,6,5\)" -+ -+gdb_test "print ar3\(:2,6,7:8\)" \ -+ "\\$\[0-9\]+ = \\(\\( 167, 267\\) \\( 168, 268\\) \\)" \ -+ "print ar3\(:2,6,7:8\)" -+gdb_test "print ar3\(:2,6,8:\)" \ -+ "\\$\[0-9\]+ = \\(\\( 168, 268\\) \\( 169, 269\\) \\)" \ -+ "print ar3\(:2,6,8:\)" -+gdb_test "print ar3\(:2,6,:2\)" \ -+ "\\$\[0-9\]+ = \\(\\( 161, 261\\) \\( 162, 262\\) \\)" \ -+ "print ar3\(:2,6,:2\)" -+gdb_test "print ar3\(:2,6,5\)" \ -+ "\\$\[0-9\]+ = \\(165, 265\\)" \ -+ "print ar3\(:2,6,5\)" -+ -+gdb_test "print ar3\(3:4,5:6,4\)" \ -+ "\\$\[0-9\]+ = \\(\\( 354, 454\\) \\( 364, 464\\) \\)" \ -+ "print ar2\(3:4,5:6,4\)" -+gdb_test "print ar3\(8:,5:6,4\)" \ -+ "\\$\[0-9\]+ = \\(\\( 854, 954\\) \\( 864, 964\\) \\)" \ -+ "print ar2\(8:,5:6,4\)" -+gdb_test "print ar3\(:2,5:6,4\)" \ -+ "\\$\[0-9\]+ = \\(\\( 154, 254\\) \\( 164, 264\\) \\)" \ -+ "print ar2\(:2,5:6,4\)" -+ -+# Stride > 1 -+gdb_test "print ar1\(2:6:2\)" \ -+ "\\$\[0-9\]+ = \\(2, 4, 6\\)" \ -+ "print ar1\(2:6:2\)" -+gdb_test "print ar2\(2:6:2,3:4\)" \ -+ "\\$\[0-9\]+ = \\(\\( 23, 43, 63\\) \\( 24, 44, 64\\) \\)" \ -+ "print ar2\(2:6:2,3:4\)" -+gdb_test "print ar2\(2:6:2,3\)" \ -+ "\\$\[0-9\]+ = \\(23, 43, 63\\)" \ -+ "print ar2\(2:6:2,3\)" -+gdb_test "print ar3\(2:6:2,3:5:2,4:7:3\)" \ -+ "\\$\[0-9\]+ = \\(\\( \\( 234, 434, 634\\) \\( 254, 454, 654\\)\ -+ \\) \\( \\( 237, 437, 637\\) \\( 257, 457, 657\\) \\) \\)" \ -+ "print ar3\(2:6:2,3:5:2,4:7:3\)" -+gdb_test "print ar3\(2:6:2,5,4:7:3\)" \ -+ "\\$\[0-9\]+ = \\(\\( 254, 454, 654\\) \\( 257, 457, 657\\)\ -+ \\)" \ -+ "print ar3\(2:6:2,5,4:7:3\)" -+ -+# Stride < 0 -+gdb_test "print ar1\(8:2:-2\)" \ -+ "\\$\[0-9\]+ = \\(8, 6, 4, 2\\)" \ -+ "print ar1\(8:2:-2\)" -+gdb_test "print ar2\(8:2:-2,3:4\)" \ -+ "\\$\[0-9\]+ = \\(\\( 83, 63, 43, 23\\) \\( 84, 64, 44, 24\\)\ -+ \\)" \ -+ "print ar2\(8:2:-2,3:4\)" -+gdb_test "print ar2\(2:6:2,3\)" \ -+ "\\$\[0-9\]+ = \\(23, 43, 63\\)" \ -+ "print ar2\(2:6:2,3\)" -+gdb_test "print ar3\(2:3,7:3:-4,4:7:3\)" \ -+ "\\$\[0-9\]+ = \\(\\( \\( 274, 374\\) \\( 234, 334\\) \\) \\(\ -+ \\( 277, 377\\) \\( 237, 337\\) \\) \\)" \ -+ "print ar3\(2:3,7:3:-4,4:7:3\)" -+gdb_test "print ar3\(2:6:2,5,7:4:-3\)" \ -+ "\\$\[0-9\]+ = \\(\\( 257, 457, 657\\) \\( 254, 454, 654\\)\ -+ \\)" \ -+ "print ar3\(2:6:2,5,7:4:-3\)" -+ -+# Tests with negative and mixed indices -+gdb_test "p ar4\(2:4, -2:1, -15:-14\)" \ -+ "\\$\[0-9\]+ = \\(\\( \\( 261, 361, 461\\) \\( 271, 371, 471\\)\ -+ \\( 281, 381, 481\\) \\( 291, 391, 491\\) \\) \\( \\( 262,\ -+ 362, 462\\) \\( 272, 372, 472\\) \\( 282, 382, 482\\) \\( 292,\ -+ 392, 492\\) \\) \\)" \ -+ "print ar4(2:4, -2:1, -15:-14)" -+ -+gdb_test "p ar4\(7,-6:2:3,-7\)" \ -+ "\\$\[0-9\]+ = \\(729, 759, 789\\)" \ -+ "print ar4(7,-6:2:3,-7)" -+ -+gdb_test "p ar4\(9:2:-2, -6:2:3, -6:-15:-3\)" \ -+ "\\$\[0-9\]+ = \\(\\( \\( 930, 730, 530, 330\\) \\( 960, 760,\ -+ 560, 360\\) \\( 990, 790, 590, 390\\) \\) \\( \\( 927, 727,\ -+ 527, 327\\) \\( 957, 757, 557, 357\\) \\( 987, 787, 587,\ -+ 387\\) \\) \\( \\( 924, 724, 524, 324\\) \\( 954, 754, 554,\ -+ 354\\) \\( 984, 784, 584, 384\\) \\) \\( \\( 921, 721, 521,\ -+ 321\\) \\( 951, 751, 551, 351\\) \\( 981, 781, 581, 381\\) \\)\ -+ \\)" \ -+ "print ar4(9:2:-2, -6:2:3, -6:-15:-3)" -+ -+gdb_test "p ar4\(:,:,:\)" \ -+ "\\$\[0-9\]+ = \\(\\( \\( 111, 211, 311, 411, 511, 611, 711,\ -+ 811, .*" \ -+ "print ar4(:,:,:)" -+ -+# Provoke error messages for bad user input -+gdb_test "print ar1\(0:4\)" \ -+ "provided bound\\(s\\) outside array bound\\(s\\)" \ -+ "print ar1\(0:4\)" -+gdb_test "print ar1\(8:12\)" \ -+ "provided bound\\(s\\) outside array bound\\(s\\)" \ -+ "print ar1\(8:12\)" -+gdb_test "print ar1\(8:2:\)" \ -+ "A syntax error in expression, near `\\)'." \ -+ "print ar1\(8:2:\)" -+gdb_test "print ar1\(8:2:2\)" \ -+ "Wrong value provided for stride and boundaries" \ -+ "print ar1\(8:2:2\)" -+gdb_test "print ar1\(2:8:-2\)" \ -+ "Wrong value provided for stride and boundaries" \ -+ "print ar1\(2:8:-2\)" -+gdb_test "print ar1\(2:7:0\)" \ -+ "Stride must not be 0" \ -+ "print ar1\(2:7:0\)" -+gdb_test "print ar1\(3:7\) = 42" \ -+ "Invalid cast." \ -+ "Assignment of value to subarray" -diff --git a/gdb/testsuite/gdb.fortran/static-arrays.f90 b/gdb/testsuite/gdb.fortran/static-arrays.f90 -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/static-arrays.f90 -@@ -0,0 +1,55 @@ -+! Copyright 2015 Free Software Foundation, Inc. -+! -+! Contributed by Intel Corp. -+! -+! This program is free software; you can 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 . -+ -+subroutine sub -+ integer, dimension(9) :: ar1 -+ integer, dimension(9,9) :: ar2 -+ integer, dimension(9,9,9) :: ar3 -+ integer, dimension(10,-7:3, -15:-5) :: ar4 -+ integer :: i,j,k -+ -+ ar1 = 1 -+ ar2 = 1 -+ ar3 = 1 -+ ar4 = 4 -+ -+ ! Resulting array ar3 looks like ((( 111, 112, 113, 114,...))) -+ do i = 1, 9, 1 -+ ar1(i) = i -+ do j = 1, 9, 1 -+ ar2(i,j) = i*10 + j -+ do k = 1, 9, 1 -+ ar3(i,j,k) = i*100 + j*10 + k -+ end do -+ end do -+ end do -+ -+ do i = 1, 10, 1 -+ do j = -7, 3, 1 -+ do k = -15, -5, 1 -+ ar4(i,j,k) = i*100 + (j+8)*10 + (k+16) -+ end do -+ end do -+ end do -+ -+ ar1(1) = 11 !BP1 -+ return -+end -+ -+program testprog -+ call sub -+end -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 -@@ -35,7 +35,8 @@ gdb_test "print sizeof(vla1)" " = 0" "print sizeof non-allocated vla1" - gdb_test "print sizeof(vla1(3,2,1))" \ - "no such vector element \\(vector not allocated\\)" \ - "print sizeof non-allocated indexed vla1" --gdb_test "print sizeof(vla1(3:4,2,1))" "array not allocated" \ -+gdb_test "print sizeof(vla1(3:4,2,1))" \ -+ "provided bound\\(s\\) outside array bound\\(s\\)" \ - "print sizeof non-allocated sliced vla1" - - # Try to access value in allocated VLA -@@ -44,7 +45,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) -@@ -52,7 +53,8 @@ gdb_test "print sizeof(pvla)" " = 0" "print sizeof non-associated pvla" - gdb_test "print sizeof(pvla(3,2,1))" \ - "no such vector element \\(vector not associated\\)" \ - "print sizeof non-associated indexed pvla" --gdb_test "print sizeof(pvla(3:4,2,1))" "array not associated" \ -+gdb_test "print sizeof(pvla(3:4,2,1))" \ -+ "provided bound\\(s\\) outside array bound\\(s\\)" \ - "print sizeof non-associated sliced pvla" - - # Try to access values in pointer to VLA and compare them -@@ -61,7 +63,8 @@ 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/testsuite/gdb.fortran/vla-stride.exp b/gdb/testsuite/gdb.fortran/vla-stride.exp -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/vla-stride.exp -@@ -0,0 +1,47 @@ -+# 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 . -+ -+standard_testfile ".f90" -+ -+if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \ -+ {debug f90 quiet}] } { -+ return -1 -+} -+ -+if ![runto MAIN__] then { -+ perror "couldn't run to breakpoint MAIN__" -+ continue -+} -+ -+gdb_test_no_output "set max-value-size unlimited" \ -+ "set max-value-size to unlimited" -+ -+gdb_breakpoint [gdb_get_line_number "re-reverse-elements"] -+gdb_continue_to_breakpoint "re-reverse-elements" -+gdb_test "print pvla" " = \\\(1, 2, 3, 4, 5, 6, 7, 8, 9, 10\\\)" \ -+ "print re-reverse-elements" -+gdb_test "print pvla(1)" " = 1" "print first re-reverse-element" -+gdb_test "print pvla(10)" " = 10" "print last re-reverse-element" -+ -+gdb_breakpoint [gdb_get_line_number "odd-elements"] -+gdb_continue_to_breakpoint "odd-elements" -+gdb_test "print pvla" " = \\\(1, 3, 5, 7, 9\\\)" "print odd-elements" -+gdb_test "print pvla(1)" " = 1" "print first odd-element" -+gdb_test "print pvla(5)" " = 9" "print last odd-element" -+ -+gdb_breakpoint [gdb_get_line_number "single-element"] -+gdb_continue_to_breakpoint "single-element" -+gdb_test "print pvla" " = \\\(5\\\)" "print single-element" -+gdb_test "print pvla(1)" " = 5" "print one single-element" -diff --git a/gdb/testsuite/gdb.fortran/vla-stride.f90 b/gdb/testsuite/gdb.fortran/vla-stride.f90 -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/vla-stride.f90 -@@ -0,0 +1,29 @@ -+! 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 . -+ -+program vla_stride -+ integer, target, allocatable :: vla (:) -+ integer, pointer :: pvla (:) -+ -+ allocate(vla(10)) -+ vla = (/ (I, I = 1,10) /) -+ -+ pvla => vla(10:1:-1) -+ pvla => pvla(10:1:-1) -+ pvla => vla(1:10:2) ! re-reverse-elements -+ pvla => vla(5:4:-2) ! odd-elements -+ -+ pvla => null() ! single-element -+end program vla_stride -diff --git a/gdb/valops.c b/gdb/valops.c ---- a/gdb/valops.c -+++ b/gdb/valops.c -@@ -3756,13 +3756,42 @@ value_of_this_silent (const struct language_defn *lang) - - struct value * - value_slice (struct value *array, int lowbound, int length) -+{ -+ /* Pass unaltered arguments to VALUE_SLICE_1, plus a default stride -+ value of '1', which returns every element between LOWBOUND and -+ (LOWBOUND + LENGTH). We also provide a default CALL_COUNT of '1' -+ as we are only considering the highest dimension, or we are -+ working on a one dimensional array. So we call VALUE_SLICE_1 -+ exactly once. */ -+ return value_slice_1 (array, lowbound, length, 1, 1); -+} -+ -+/* VALUE_SLICE_1 is called for each array dimension to calculate the number -+ of elements as defined by the subscript expression. -+ CALL_COUNT is used to determine if we are calling the function once, e.g. -+ we are working on the current dimension of ARRAY, or if we are calling -+ the function repeatedly. In the later case we need to take elements -+ from the TARGET_TYPE of ARRAY. -+ With a CALL_COUNT greater than 1 we calculate the offsets for every element -+ that should be in the result array. Then we fetch the contents and then -+ copy them into the result array. The result array will have one dimension -+ less than the input array, so later on we need to recreate the indices and -+ ranges in the calling function. */ -+ -+struct value * -+value_slice_1 (struct value *array, int lowbound, int length, -+ int stride_length, int call_count) - { - struct type *slice_range_type, *slice_type, *range_type; -- LONGEST lowerbound, upperbound; -- struct value *slice; -- struct type *array_type; -+ struct type *array_type = check_typedef (value_type (array)); -+ struct type *elt_type = check_typedef (TYPE_TARGET_TYPE (array_type)); -+ unsigned int elt_size, elt_offs; -+ LONGEST ary_high_bound, ary_low_bound; -+ struct value *v; -+ int slice_range_size, i = 0, row_count = 1, elem_count = 1; - -- array_type = check_typedef (value_type (array)); -+ /* Check for legacy code if we are actually dealing with an array or -+ string. */ - if (array_type->code () != TYPE_CODE_ARRAY - && array_type->code () != TYPE_CODE_STRING) - error (_("cannot take slice of non-array")); -@@ -3772,45 +3801,155 @@ value_slice (struct value *array, int lowbound, int length) - if (type_not_associated (array_type)) - error (_("array not associated")); - -- range_type = array_type->index_type (); -- if (get_discrete_bounds (range_type, &lowerbound, &upperbound) < 0) -- error (_("slice from bad array or bitstring")); -+ ary_low_bound = array_type->index_type ()->bounds ()->low.const_val (); -+ ary_high_bound = array_type->index_type ()->bounds ()->high.const_val (); -+ -+ /* When we are working on a multi-dimensional array, we need to get the -+ attributes of the underlying type. */ -+ if (call_count > 1) -+ { -+ ary_low_bound = elt_type->index_type ()->bounds ()->low.const_val (); -+ ary_high_bound = elt_type->index_type ()->bounds ()->high.const_val (); -+ elt_type = check_typedef (TYPE_TARGET_TYPE (elt_type)); -+ row_count = TYPE_LENGTH (array_type) -+ / TYPE_LENGTH (TYPE_TARGET_TYPE (array_type)); -+ } -+ -+ /* With a stride of '1', the number of elements per result row is equal to -+ the LENGTH of the subarray. With non-default stride values, we skip -+ elements, but have to add the start element to the total number of -+ elements per row. */ -+ if (stride_length == 1) -+ elem_count = length; -+ else -+ elem_count = ((length - 1) / stride_length) + 1; -+ -+ elt_size = TYPE_LENGTH (elt_type); -+ elt_offs = lowbound - ary_low_bound; -+ -+ elt_offs *= elt_size; - -- if (lowbound < lowerbound || length < 0 -- || lowbound + length - 1 > upperbound) -- error (_("slice out of range")); -+ /* Check for valid user input. In case of Fortran this was already done -+ in the calling function. */ -+ if (call_count == 1 -+ && (!TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (array_type) -+ && elt_offs >= TYPE_LENGTH (array_type))) -+ error (_("no such vector element")); -+ -+ /* CALL_COUNT is 1 when we are dealing either with the highest dimension -+ of the array, or a one dimensional array. Set RANGE_TYPE accordingly. -+ In both cases we calculate how many rows/elements will be in the output -+ array by setting slice_range_size. */ -+ if (call_count == 1) -+ { -+ range_type = array_type->index_type (); -+ slice_range_size = ary_low_bound + elem_count - 1; -+ -+ /* Check if the array bounds are valid. */ -+ if (get_discrete_bounds (range_type, &ary_low_bound, &ary_high_bound) < 0) -+ error (_("slice from bad array or bitstring")); -+ } -+ /* When CALL_COUNT is greater than 1, we are dealing with an array of arrays. -+ So we need to get the type below the current one and set the RANGE_TYPE -+ accordingly. */ -+ else -+ { -+ range_type = TYPE_TARGET_TYPE (array_type)->index_type (); -+ slice_range_size = ary_low_bound + (row_count * elem_count) - 1; -+ ary_low_bound = range_type->bounds ()->low.const_val (); -+ } - - /* FIXME-type-allocation: need a way to free this type when we are -- done with it. */ -- slice_range_type = create_static_range_type (NULL, -- TYPE_TARGET_TYPE (range_type), -- lowbound, -- lowbound + length - 1); -+ done with it. */ - -+ slice_range_type = create_static_range_type (NULL, TYPE_TARGET_TYPE (range_type), -+ ary_low_bound, slice_range_size); - { -- struct type *element_type = TYPE_TARGET_TYPE (array_type); -- LONGEST offset -- = (lowbound - lowerbound) * TYPE_LENGTH (check_typedef (element_type)); -+ struct type *element_type; - -- slice_type = create_array_type (NULL, -- element_type, -- slice_range_type); -- slice_type->set_code (array_type->code ()); -+ /* When both CALL_COUNT and STRIDE_LENGTH equal 1, we can use the legacy -+ code for subarrays. */ -+ if (call_count == 1 && stride_length == 1) -+ { -+ element_type = TYPE_TARGET_TYPE (array_type); -+ -+ slice_type = create_array_type (NULL, element_type, slice_range_type); -+ -+ slice_type->set_code (array_type->code ()); - -- if (VALUE_LVAL (array) == lval_memory && value_lazy (array)) -- slice = allocate_value_lazy (slice_type); -+ if (VALUE_LVAL (array) == lval_memory && value_lazy (array)) -+ v = allocate_value_lazy (slice_type); -+ else -+ { -+ v = allocate_value (slice_type); -+ value_contents_copy (v, -+ value_embedded_offset (v), -+ array, -+ value_embedded_offset (array) + elt_offs, -+ elt_size * longest_to_int (length)); -+ } -+ -+ } -+ /* With a CALL_COUNT or STRIDE_LENGTH are greater than 1 we are working -+ on a range of ranges. So we copy the relevant elements into the -+ new array we return. */ - else - { -- slice = allocate_value (slice_type); -- value_contents_copy (slice, 0, array, offset, -- type_length_units (slice_type)); -+ int j, offs_store = elt_offs; -+ LONGEST dst_offset = 0; -+ LONGEST src_row_length = TYPE_LENGTH (TYPE_TARGET_TYPE (array_type)); -+ -+ if (call_count == 1) -+ { -+ /* When CALL_COUNT is equal to 1 we are working on the current range -+ and use these elements directly. */ -+ element_type = TYPE_TARGET_TYPE (array_type); -+ } -+ else -+ { -+ /* Working on an array of arrays, the type of the elements is the type -+ of the subarrays' type. */ -+ element_type = TYPE_TARGET_TYPE (TYPE_TARGET_TYPE (array_type)); -+ } -+ -+ slice_type = create_array_type (NULL, element_type, slice_range_type); -+ -+ /* If we have a one dimensional array, we copy its type code. For a -+ multi dimensional array we copy the embedded type's type code. */ -+ if (call_count == 1) -+ slice_type->set_code (array_type->code ()); -+ else -+ slice_type->set_code ((TYPE_TARGET_TYPE (array_type)->code ())); -+ -+ v = allocate_value (slice_type); -+ -+ /* Iterate through the rows of the outer array and set the new offset -+ for each row. */ -+ for (i = 0; i < row_count; i++) -+ { -+ elt_offs = offs_store + i * src_row_length; -+ -+ /* Iterate through the elements in each row to copy only those. */ -+ for (j = 1; j <= elem_count; j++) -+ { -+ /* Fetches the contents of ARRAY and copies them into V. */ -+ value_contents_copy (v, dst_offset, array, elt_offs, elt_size); -+ elt_offs += elt_size * stride_length; -+ dst_offset += elt_size; -+ } -+ } - } - -- set_value_component_location (slice, array); -- set_value_offset (slice, value_offset (array) + offset); -+ set_value_component_location (v, array); -+ if (VALUE_LVAL (v) == lval_register) -+ { -+ VALUE_REGNUM (v) = VALUE_REGNUM (array); -+ VALUE_NEXT_FRAME_ID (v) = VALUE_NEXT_FRAME_ID (array); -+ } -+ set_value_offset (v, value_offset (array) + elt_offs); - } - -- return slice; -+ return v; - } - - /* See value.h. */ -diff --git a/gdb/value.h b/gdb/value.h ---- a/gdb/value.h -+++ b/gdb/value.h -@@ -1144,6 +1144,8 @@ extern struct value *varying_to_slice (struct value *); - - extern struct value *value_slice (struct value *, int, int); - -+extern struct value *value_slice_1 (struct value *, int, int, int, int); -+ - /* Create a complex number. The type is the complex type; the values - are cast to the underlying scalar type before the complex number is - created. */ diff --git a/gdb-vla-intel-fortran-vla-strings.patch b/gdb-vla-intel-fortran-vla-strings.patch deleted file mode 100644 index 83239ed..0000000 --- a/gdb-vla-intel-fortran-vla-strings.patch +++ /dev/null @@ -1,1086 +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-vla-intel-fortran-vla-strings.patch - -;;=push - -git diff --stat -p gdb/master...gdb/users/bheckel/fortran-vla-strings -0ad7d8d1a3a36c6e04e3b6d37d8825f18d595723 - - gdb/NEWS | 2 + - gdb/c-valprint.c | 22 +++++ - gdb/dwarf2read.c | 158 +++++++++++++++++++++++++----- - gdb/f-typeprint.c | 93 +++++++++--------- - gdb/gdbtypes.c | 44 ++++++++- - gdb/testsuite/gdb.cp/vla-cxx.cc | 9 ++ - gdb/testsuite/gdb.cp/vla-cxx.exp | 9 ++ - gdb/testsuite/gdb.fortran/pointers.exp | 143 +++++++++++++++++++++++++++ - gdb/testsuite/gdb.fortran/pointers.f90 | 109 +++++++++++++++++++++ - gdb/testsuite/gdb.fortran/print_type.exp | 100 +++++++++++++++++++ - gdb/testsuite/gdb.fortran/vla-ptype.exp | 12 +-- - gdb/testsuite/gdb.fortran/vla-strings.exp | 103 +++++++++++++++++++ - gdb/testsuite/gdb.fortran/vla-strings.f90 | 39 ++++++++ - gdb/testsuite/gdb.fortran/vla-type.exp | 7 +- - gdb/testsuite/gdb.fortran/vla-value.exp | 12 ++- - gdb/testsuite/gdb.mi/mi-var-child-f.exp | 7 +- - gdb/testsuite/gdb.mi/mi-vla-fortran.exp | 27 ++--- - gdb/typeprint.c | 19 ++++ - gdb/valops.c | 16 ++- - gdb/valprint.c | 6 -- - 20 files changed, 827 insertions(+), 110 deletions(-) - -diff --git a/gdb/NEWS b/gdb/NEWS ---- a/gdb/NEWS -+++ b/gdb/NEWS -@@ -985,6 +985,8 @@ SH-5/SH64 running OpenBSD SH-5/SH64 support in sh*-*-openbsd* - - *** Changes in GDB 8.1 - -+* Fortran: Support pointers to dynamic types. -+ - * GDB now supports dynamically creating arbitrary register groups specified - in XML target descriptions. This allows for finer grain grouping of - registers on systems with a large amount of registers. -diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c ---- a/gdb/c-valprint.c -+++ b/gdb/c-valprint.c -@@ -572,6 +572,28 @@ c_value_print (struct value *val, struct ui_file *stream, - else - { - /* normal case */ -+ if (type->code () == TYPE_CODE_PTR -+ && 1 == is_dynamic_type (type)) -+ { -+ CORE_ADDR addr; -+ if (NULL != TYPE_DATA_LOCATION (TYPE_TARGET_TYPE (type))) -+ addr = value_address (val); -+ else -+ addr = value_as_address (val); -+ -+ /* We resolve the target-type only when the -+ pointer is associated. */ -+ if ((addr != 0) -+ && (0 == type_not_associated (type))) -+ TYPE_TARGET_TYPE (type) = -+ resolve_dynamic_type (TYPE_TARGET_TYPE (type), -+ {}, addr); -+ } -+ else -+ { -+ /* Do nothing. References are already resolved from the beginning, -+ only pointers are resolved when we actual need the target. */ -+ } - fprintf_filtered (stream, "("); - type_print (value_type (val), "", stream, -1); - fprintf_filtered (stream, ") "); -diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c ---- a/gdb/dwarf2/read.c -+++ b/gdb/dwarf2/read.c -@@ -1562,7 +1562,10 @@ static void read_signatured_type (signatured_type *sig_type, - - static int attr_to_dynamic_prop (const struct attribute *attr, - struct die_info *die, struct dwarf2_cu *cu, -- struct dynamic_prop *prop, struct type *type); -+ struct dynamic_prop *prop, -+ struct type *default_type, -+ const gdb_byte *additional_data, -+ int additional_data_size); - - /* memory allocation interface */ - -@@ -13631,7 +13634,7 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu) - newobj->static_link - = XOBNEW (&objfile->objfile_obstack, struct dynamic_prop); - attr_to_dynamic_prop (attr, die, cu, newobj->static_link, -- cu->addr_type ()); -+ cu->addr_type (), NULL, 0); - } - - cu->list_in_scope = cu->get_builder ()->get_local_symbols (); -@@ -16073,7 +16076,7 @@ read_structure_type (struct die_info *die, struct dwarf2_cu *cu) - else - { - struct dynamic_prop prop; -- if (attr_to_dynamic_prop (attr, die, cu, &prop, cu->addr_type ())) -+ if (attr_to_dynamic_prop (attr, die, cu, &prop, cu->addr_type (), NULL, 0)) - type->add_dyn_prop (DYN_PROP_BYTE_SIZE, prop); - TYPE_LENGTH (type) = 0; - } -@@ -16764,7 +16767,7 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu) - byte_stride_prop - = (struct dynamic_prop *) alloca (sizeof (struct dynamic_prop)); - stride_ok = attr_to_dynamic_prop (attr, die, cu, byte_stride_prop, -- prop_type); -+ prop_type, NULL, 0); - if (!stride_ok) - { - complaint (_("unable to read array DW_AT_byte_stride " -@@ -17522,7 +17525,7 @@ read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu) - struct attribute *attr; - struct dynamic_prop prop; - bool length_is_constant = true; -- LONGEST length; -+ ULONGEST length = UINT_MAX; - - /* There are a couple of places where bit sizes might be made use of - when parsing a DW_TAG_string_type, however, no producer that we know -@@ -17543,6 +17546,10 @@ read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu) - } - } - -+ index_type = objfile_type (objfile)->builtin_int; -+ range_type = create_static_range_type (NULL, index_type, 1, length); -+ -+ /* If DW_AT_string_length is defined, the length is stored in memory. */ - attr = dwarf2_attr (die, DW_AT_string_length, cu); - if (attr != nullptr && !attr->form_is_constant ()) - { -@@ -17569,13 +17576,68 @@ read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu) - } - - /* Convert the attribute into a dynamic property. */ -- if (!attr_to_dynamic_prop (attr, die, cu, &prop, prop_type)) -+ if (!attr_to_dynamic_prop (attr, die, cu, &prop, prop_type, NULL, 0)) - length = 1; - else - length_is_constant = false; - } - else if (attr != nullptr) - { -+ if (attr->form_is_block ()) -+ { -+ struct attribute *byte_size, *bit_size; -+ struct dynamic_prop high; -+ -+ byte_size = dwarf2_attr (die, DW_AT_byte_size, cu); -+ bit_size = dwarf2_attr (die, DW_AT_bit_size, cu); -+ -+ /* DW_AT_byte_size should never occur in combination with -+ DW_AT_bit_size. */ -+ if (byte_size != NULL && bit_size != NULL) -+ complaint (_("DW_AT_byte_size AND " -+ "DW_AT_bit_size found together at the same time.")); -+ -+ /* If DW_AT_string_length AND DW_AT_byte_size exist together, -+ DW_AT_byte_size describes the number of bytes that should be read -+ from the length memory location. */ -+ if (byte_size != NULL) -+ { -+ /* Build new dwarf2_locexpr_baton structure with additions to the -+ data attribute, to reflect DWARF specialities to get address -+ sizes. */ -+ const gdb_byte append_ops[] = -+ { -+ /* DW_OP_deref_size: size of an address on the target machine -+ (bytes), where the size will be specified by the next -+ operand. */ -+ DW_OP_deref_size, -+ /* Operand for DW_OP_deref_size. */ -+ (gdb_byte) DW_UNSND(byte_size) }; -+ -+ if (!attr_to_dynamic_prop (attr, die, cu, &high, index_type, -+ append_ops, ARRAY_SIZE(append_ops))) -+ complaint (_("Could not parse DW_AT_byte_size")); -+ } -+ else if (bit_size != NULL) -+ complaint (_("DW_AT_string_length AND " -+ "DW_AT_bit_size found but not supported yet.")); -+ /* If DW_AT_string_length WITHOUT DW_AT_byte_size exist, the default -+ is the address size of the target machine. */ -+ else -+ { -+ const gdb_byte append_ops[] = -+ { DW_OP_deref }; -+ -+ if (!attr_to_dynamic_prop (attr, die, cu, &high, index_type, -+ append_ops, ARRAY_SIZE(append_ops))) -+ complaint (_("Could not parse DW_AT_string_length")); -+ } -+ -+ range_type->bounds ()->high = high; -+ } -+ else -+ range_type->bounds ()->high.set_const_val (DW_UNSND(attr)); -+ - /* This DW_AT_string_length just contains the length with no - indirection. There's no need to create a dynamic property in this - case. Pass 0 for the default value as we know it will not be -@@ -17589,6 +17651,14 @@ read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu) - } - else - { -+ /* Check for the DW_AT_byte_size attribute, which represents the length -+ in this case. */ -+ attr = dwarf2_attr (die, DW_AT_byte_size, cu); -+ if (attr) -+ range_type->bounds ()->high.set_const_val (DW_UNSND(attr)); -+ else -+ range_type->bounds ()->high.set_const_val (1); -+ - /* Use 1 as a fallback length if we have nothing else. */ - length = 1; - } -@@ -17603,6 +17673,7 @@ read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu) - low_bound.set_const_val (1); - range_type = create_range_type (NULL, index_type, &low_bound, &prop, 0); - } -+ - char_type = language_string_char_type (cu->language_defn, gdbarch); - type = create_string_type (NULL, char_type, range_type); - -@@ -18078,7 +18149,8 @@ read_base_type (struct die_info *die, struct dwarf2_cu *cu) - static int - attr_to_dynamic_prop (const struct attribute *attr, struct die_info *die, - struct dwarf2_cu *cu, struct dynamic_prop *prop, -- struct type *default_type) -+ struct type *default_type, -+ const gdb_byte *additional_data, int additional_data_size) - { - struct dwarf2_property_baton *baton; - dwarf2_per_objfile *per_objfile = cu->per_objfile; -@@ -18108,6 +18180,26 @@ attr_to_dynamic_prop (const struct attribute *attr, struct die_info *die, - break; - } - -+ if (additional_data != NULL && additional_data_size > 0) -+ { -+ gdb_byte *data; -+ -+ data = (gdb_byte *) obstack_alloc( -+ &cu->per_objfile->objfile->objfile_obstack, -+ DW_BLOCK (attr)->size + additional_data_size); -+ memcpy (data, DW_BLOCK (attr)->data, DW_BLOCK (attr)->size); -+ memcpy (data + DW_BLOCK (attr)->size, additional_data, -+ additional_data_size); -+ -+ baton->locexpr.data = data; -+ baton->locexpr.size = DW_BLOCK (attr)->size + additional_data_size; -+ } -+ else -+ { -+ baton->locexpr.data = DW_BLOCK (attr)->data; -+ baton->locexpr.size = DW_BLOCK (attr)->size; -+ } -+ - prop->set_locexpr (baton); - gdb_assert (prop->baton () != NULL); - } -@@ -18142,11 +18234,31 @@ attr_to_dynamic_prop (const struct attribute *attr, struct die_info *die, - baton->property_type = die_type (target_die, target_cu); - baton->locexpr.per_cu = cu->per_cu; - baton->locexpr.per_objfile = per_objfile; -- baton->locexpr.size = DW_BLOCK (target_attr)->size; -- baton->locexpr.data = DW_BLOCK (target_attr)->data; - baton->locexpr.is_reference = true; -+ -+ if (additional_data != NULL && additional_data_size > 0) -+ { -+ gdb_byte *data; -+ -+ data = (gdb_byte *) obstack_alloc (&cu->per_objfile->objfile->objfile_obstack, -+ DW_BLOCK (target_attr)->size + additional_data_size); -+ memcpy (data, DW_BLOCK (target_attr)->data, -+ DW_BLOCK (target_attr)->size); -+ memcpy (data + DW_BLOCK (target_attr)->size, -+ additional_data, additional_data_size); -+ -+ baton->locexpr.data = data; -+ baton->locexpr.size = (DW_BLOCK (target_attr)->size -+ + additional_data_size); -+ } -+ else -+ { -+ baton->locexpr.data = DW_BLOCK (target_attr)->data; -+ baton->locexpr.size = DW_BLOCK (target_attr)->size; -+ } -+ - prop->set_locexpr (baton); -- gdb_assert (prop->baton () != NULL); -+ gdb_assert (prop->baton() != NULL); - } - else - { -@@ -18308,8 +18420,8 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) - } - - attr = dwarf2_attr (die, DW_AT_lower_bound, cu); -- if (attr != nullptr) -- attr_to_dynamic_prop (attr, die, cu, &low, base_type); -+ if (attr) -+ attr_to_dynamic_prop (attr, die, cu, &low, base_type, NULL, 0); - else if (!low_default_is_valid) - complaint (_("Missing DW_AT_lower_bound " - "- DIE at %s [in module %s]"), -@@ -18318,10 +18430,10 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) - - struct attribute *attr_ub, *attr_count; - attr = attr_ub = dwarf2_attr (die, DW_AT_upper_bound, cu); -- if (!attr_to_dynamic_prop (attr, die, cu, &high, base_type)) -+ if (!attr_to_dynamic_prop (attr, die, cu, &high, base_type, NULL, 0)) - { - attr = attr_count = dwarf2_attr (die, DW_AT_count, cu); -- if (attr_to_dynamic_prop (attr, die, cu, &high, base_type)) -+ if (attr_to_dynamic_prop (attr, die, cu, &high, base_type, NULL, 0)) - { - /* If bounds are constant do the final calculation here. */ - if (low.kind () == PROP_CONST && high.kind () == PROP_CONST) -@@ -18372,7 +18484,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) - { - struct type *prop_type = cu->addr_sized_int_type (false); - attr_to_dynamic_prop (attr_byte_stride, die, cu, &byte_stride_prop, -- prop_type); -+ prop_type, NULL, 0); - } - - struct dynamic_prop bit_stride_prop; -@@ -18392,7 +18504,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) - { - struct type *prop_type = cu->addr_sized_int_type (false); - attr_to_dynamic_prop (attr_bit_stride, die, cu, &bit_stride_prop, -- prop_type); -+ prop_type, NULL, 0); - } - } - -@@ -24424,7 +24536,7 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu) - if (attr != NULL) - { - struct type *prop_type = cu->addr_sized_int_type (false); -- if (attr_to_dynamic_prop (attr, die, cu, &prop, prop_type)) -+ if (attr_to_dynamic_prop (attr, die, cu, &prop, prop_type, NULL, 0)) - type->add_dyn_prop (DYN_PROP_ALLOCATED, prop); - } - -@@ -24433,13 +24545,13 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu) - if (attr != NULL) - { - struct type *prop_type = cu->addr_sized_int_type (false); -- if (attr_to_dynamic_prop (attr, die, cu, &prop, prop_type)) -+ if (attr_to_dynamic_prop (attr, die, cu, &prop, prop_type, NULL, 0)) - type->add_dyn_prop (DYN_PROP_ASSOCIATED, prop); - } - - /* Read DW_AT_data_location and set in type. */ - attr = dwarf2_attr (die, DW_AT_data_location, cu); -- if (attr_to_dynamic_prop (attr, die, cu, &prop, cu->addr_type ())) -+ if (attr_to_dynamic_prop (attr, die, cu, &prop, cu->addr_type (), NULL, 0)) - type->add_dyn_prop (DYN_PROP_DATA_LOCATION, prop); - - if (per_objfile->die_type_hash == NULL) -diff --git a/gdb/f-typeprint.c b/gdb/f-typeprint.c ---- a/gdb/f-typeprint.c -+++ b/gdb/f-typeprint.c -@@ -217,8 +217,9 @@ f_type_print_varspec_suffix (struct type *type, struct ui_file *stream, - else - { - LONGEST lower_bound = f77_get_lowerbound (type); -+ - if (lower_bound != 1) /* Not the default. */ -- fprintf_filtered (stream, "%s:", plongest (lower_bound)); -+ fprintf_filtered (stream, "%s:", plongest (lower_bound)); - - /* Make sure that, if we have an assumed size array, we - print out a warning and print the upperbound as '*'. */ -@@ -229,7 +230,7 @@ f_type_print_varspec_suffix (struct type *type, struct ui_file *stream, - { - LONGEST upper_bound = f77_get_upperbound (type); - -- fputs_filtered (plongest (upper_bound), stream); -+ fprintf_filtered (stream, "%s", plongest (upper_bound)); - } - } - -@@ -249,7 +250,7 @@ f_type_print_varspec_suffix (struct type *type, struct ui_file *stream, - case TYPE_CODE_REF: - f_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, 1, 0, - arrayprint_recurse_level, false); -- fprintf_filtered (stream, " )"); -+ fprintf_filtered (stream, ")"); - break; - - case TYPE_CODE_FUNC: -diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c ---- a/gdb/gdbtypes.c -+++ b/gdb/gdbtypes.c -@@ -1977,7 +1977,8 @@ is_dynamic_type_internal (struct type *type, int top_level) - type = check_typedef (type); - - /* We only want to recognize references at the outermost level. */ -- if (top_level && type->code () == TYPE_CODE_REF) -+ if (top_level && -+ (type->code () == TYPE_CODE_REF || type-> code() == TYPE_CODE_PTR)) - type = check_typedef (TYPE_TARGET_TYPE (type)); - - /* Types that have a dynamic TYPE_DATA_LOCATION are considered -@@ -2017,10 +2018,10 @@ is_dynamic_type_internal (struct type *type, int top_level) - || is_dynamic_type_internal (TYPE_TARGET_TYPE (type), 0)); - } - -- case TYPE_CODE_STRING: - /* Strings are very much like an array of characters, and can be - treated as one here. */ - case TYPE_CODE_ARRAY: -+ case TYPE_CODE_STRING: - { - gdb_assert (type->num_fields () == 1); - -@@ -2183,11 +2184,15 @@ resolve_dynamic_array_or_string (struct type *type, - - ary_dim = check_typedef (TYPE_TARGET_TYPE (elt_type)); - -- if (ary_dim != NULL && ary_dim->code () == TYPE_CODE_ARRAY) -+ if (ary_dim != NULL && (ary_dim->code () == TYPE_CODE_ARRAY -+ || ary_dim->code () == TYPE_CODE_STRING)) - elt_type = resolve_dynamic_array_or_string (ary_dim, addr_stack); - else - elt_type = TYPE_TARGET_TYPE (type); - -+ if (type->code () == TYPE_CODE_STRING) -+ return create_string_type (type, elt_type, range_type); -+ - prop = type->dyn_prop (DYN_PROP_BYTE_STRIDE); - if (prop != NULL) - { -@@ -2533,6 +2538,25 @@ resolve_dynamic_struct (struct type *type, - return resolved_type; - } - -+/* Worker for pointer types. */ -+ -+static struct type * -+resolve_dynamic_pointer (struct type *type, -+ struct property_addr_info *addr_stack) -+{ -+ struct dynamic_prop *prop; -+ CORE_ADDR value; -+ -+ type = copy_type (type); -+ -+ /* Resolve associated property. */ -+ prop = TYPE_ASSOCIATED_PROP (type); -+ if (prop != NULL && dwarf2_evaluate_property (prop, NULL, addr_stack, &value)) -+ prop->set_const_val (value); -+ -+ return type; -+} -+ - /* Worker for resolved_dynamic_type. */ - - static struct type * -@@ -2594,6 +2618,9 @@ resolve_dynamic_type_internal (struct type *type, - case TYPE_CODE_ARRAY: - resolved_type = resolve_dynamic_array_or_string (type, addr_stack); - break; -+ case TYPE_CODE_PTR: -+ resolved_type = resolve_dynamic_pointer (type, addr_stack); -+ break; - - case TYPE_CODE_RANGE: - resolved_type = resolve_dynamic_range (type, addr_stack); -diff --git a/gdb/testsuite/gdb.cp/vla-cxx.cc b/gdb/testsuite/gdb.cp/vla-cxx.cc ---- a/gdb/testsuite/gdb.cp/vla-cxx.cc -+++ b/gdb/testsuite/gdb.cp/vla-cxx.cc -@@ -15,6 +15,10 @@ - You should have received a copy of the GNU General Public License - along with this program. If not, see . */ - -+extern "C" { -+#include -+} -+ - struct container; - - struct element -@@ -40,11 +44,16 @@ int main(int argc, char **argv) - typedef typeof (vla) &vlareftypedef; - vlareftypedef vlaref2 (vla); - container c; -+ typeof (vla) *ptr = NULL; -+ -+ // Before pointer assignment -+ ptr = &vla; - - for (int i = 0; i < z; ++i) - vla[i] = 5 + 2 * i; - - // vlas_filled - vla[0] = 2 * vla[0]; -+ - return vla[2]; - } -diff --git a/gdb/testsuite/gdb.cp/vla-cxx.exp b/gdb/testsuite/gdb.cp/vla-cxx.exp ---- a/gdb/testsuite/gdb.cp/vla-cxx.exp -+++ b/gdb/testsuite/gdb.cp/vla-cxx.exp -@@ -23,6 +23,12 @@ if ![runto_main] { - return -1 - } - -+gdb_breakpoint [gdb_get_line_number "Before pointer assignment"] -+gdb_continue_to_breakpoint "Before pointer assignment" -+gdb_test "ptype ptr" "int \\(\\*\\)\\\[variable length\\\]" "ptype ptr, Before pointer assignment" -+gdb_test "print ptr" "\\(int \\(\\*\\)\\\[variable length\\\]\\) 0x0" "print ptr, Before pointer assignment" -+gdb_test "print *ptr" "Cannot access memory at address 0x0" "print *ptr, Before pointer assignment" -+ - gdb_breakpoint [gdb_get_line_number "vlas_filled"] - gdb_continue_to_breakpoint "vlas_filled" - -@@ -33,3 +39,6 @@ gdb_test "print vlaref" " = \\(int \\(&\\)\\\[3\\\]\\) @$hex: \\{5, 7, 9\\}" - # bug being tested, it's better not to depend on the exact spelling. - gdb_test "print vlaref2" " = \\(.*\\) @$hex: \\{5, 7, 9\\}" - gdb_test "print c" " = \\{e = \\{c = @$hex\\}\\}" -+gdb_test "ptype ptr" "int \\(\\*\\)\\\[3\\\]" -+gdb_test "print ptr" "\\(int \\(\\*\\)\\\[3\\\]\\) $hex" -+gdb_test "print *ptr" " = \\{5, 7, 9\\}" -diff --git a/gdb/testsuite/gdb.fortran/pointers.exp b/gdb/testsuite/gdb.fortran/pointers.exp -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/pointers.exp -@@ -0,0 +1,143 @@ -+# 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 . -+ -+standard_testfile "pointers.f90" -+load_lib fortran.exp -+ -+if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \ -+ {debug f90 quiet}] } { -+ return -1 -+} -+ -+if ![runto_main] { -+ untested "could not run to main" -+ return -1 -+} -+ -+# Depending on the compiler being used, the type names can be printed differently. -+set logical [fortran_logical4] -+set real [fortran_real4] -+set int [fortran_int4] -+set complex [fortran_complex4] -+ -+ -+gdb_breakpoint [gdb_get_line_number "Before pointer assignment"] -+gdb_continue_to_breakpoint "Before pointer assignment" -+gdb_test "print logp" "= \\(PTR TO -> \\( $logical\\)\\) 0x0" "print logp, not associated" -+gdb_test "print *logp" "Cannot access memory at address 0x0" "print *logp, not associated" -+gdb_test "print comp" "= \\(PTR TO -> \\( $complex\\)\\) 0x0" "print comp, not associated" -+gdb_test "print *comp" "Cannot access memory at address 0x0" "print *comp, not associated" -+gdb_test "print charp" "= \\(PTR TO -> \\( character\\*1\\)\\) 0x0" "print charp, not associated" -+gdb_test "print *charp" "Cannot access memory at address 0x0" "print *charp, not associated" -+gdb_test "print charap" "= \\(PTR TO -> \\( character\\*3\\)\\) 0x0" "print charap, not associated" -+gdb_test "print *charap" "Cannot access memory at address 0x0" "print *charap, not associated" -+gdb_test "print intp" "= \\(PTR TO -> \\( $int\\)\\) 0x0" "print intp, not associated" -+gdb_test "print *intp" "Cannot access memory at address 0x0" "print *intp, not associated" -+set test "print intap, not associated" -+gdb_test_multiple "print intap" $test { -+ -re " = \\(PTR TO -> \\( $int \\(:,:\\)\\)\\) \r\n$gdb_prompt $" { -+ pass $test -+ } -+ -re " = \r\n$gdb_prompt $" { -+ pass $test -+ } -+} -+gdb_test "print realp" "= \\(PTR TO -> \\( $real\\)\\) 0x0" "print realp, not associated" -+gdb_test "print *realp" "Cannot access memory at address 0x0" "print *realp, not associated" -+gdb_test "print \$my_var = intp" "= \\(PTR TO -> \\( $int\\)\\) 0x0" -+set test "print cyclicp1, not associated" -+gdb_test_multiple "print cyclicp1" $test { -+ -re "= \\( i = -?\\d+, p = 0x0 \\)\r\n$gdb_prompt $" { -+ pass $test -+ } -+ -re "= \\( i = -?\\d+, p = \\)\r\n$gdb_prompt $" { -+ pass $test -+ } -+} -+set test "print cyclicp1%p, not associated" -+gdb_test_multiple "print cyclicp1%p" $test { -+ -re "= \\(PTR TO -> \\( Type typewithpointer\\)\\) 0x0\r\n$gdb_prompt $" { -+ pass $test -+ } -+ -re "= \\(PTR TO -> \\( Type typewithpointer\\)\\) \r\n$gdb_prompt $" { -+ pass $test -+ } -+} -+ -+ -+gdb_breakpoint [gdb_get_line_number "Before value assignment"] -+gdb_continue_to_breakpoint "Before value assignment" -+gdb_test "print *(twop)%ivla2" "= " -+ -+ -+gdb_breakpoint [gdb_get_line_number "After value assignment"] -+gdb_continue_to_breakpoint "After value assignment" -+gdb_test "print logp" "= \\(PTR TO -> \\( $logical\\)\\) $hex\( <.*>\)?" -+gdb_test "print *logp" "= \\.TRUE\\." -+gdb_test "print comp" "= \\(PTR TO -> \\( $complex\\)\\) $hex\( <.*>\)?" -+gdb_test "print *comp" "= \\(1,2\\)" -+gdb_test "print charp" "= \\(PTR TO -> \\( character\\*1\\)\\) $hex\( <.*>\)?" -+gdb_test "print *charp" "= 'a'" -+gdb_test "print charap" "= \\(PTR TO -> \\( character\\*3\\)\\) $hex\( <.*>\)?" -+gdb_test "print *charap" "= 'abc'" -+gdb_test "print intp" "= \\(PTR TO -> \\( $int\\)\\) $hex\( <.*>\)?" -+gdb_test "print *intp" "= 10" -+set test_name "print intap, associated" -+gdb_test_multiple "print intap" $test_name { -+ -re "= \\(\\( 1, 1, 3(, 1){7}\\) \\( 1(, 1){9}\\) \\)\r\n$gdb_prompt $" { -+ pass $test_name -+ } -+ -re "= \\(PTR TO -> \\( $int \\(10,2\\)\\)\\) $hex\( <.*>\)?\r\n$gdb_prompt $" { -+ gdb_test "print *intap" "= \\(\\( 1, 1, 3(, 1){7}\\) \\( 1(, 1){9}\\) \\)" -+ pass $test_name -+ } -+} -+set test_name "print intvlap, associated" -+gdb_test_multiple "print intvlap" $test_name { -+ -re "= \\(2, 2, 2, 4(, 2){6}\\)\r\n$gdb_prompt $" { -+ pass $test_name -+ } -+ -re "= \\(PTR TO -> \\( $int \\(10\\)\\)\\) $hex\( <.*>\)?\r\n$gdb_prompt $" { -+ gdb_test "print *intvlap" "= \\(2, 2, 2, 4(, 2){6}\\)" -+ pass $test_name -+ } -+} -+gdb_test "print realp" "= \\(PTR TO -> \\( $real\\)\\) $hex\( <.*>\)?" -+gdb_test "print *realp" "= 3\\.14000\\d+" -+gdb_test "print arrayOfPtr(2)%p" "= \\(PTR TO -> \\( Type two\\)\\) $hex\( <.*>\)?" -+gdb_test "print *(arrayOfPtr(2)%p)" "= \\( ivla1 = \\(11, 12, 13\\), ivla2 = \\(\\( 211, 221\\) \\( 212, 222\\) \\) \\)" -+set test_name "print arrayOfPtr(3)%p" -+gdb_test_multiple $test_name $test_name { -+ -re "= \\(PTR TO -> \\( Type two\\)\\) \r\n$gdb_prompt $" { -+ pass $test_name -+ } -+ -re "= \\(PTR TO -> \\( Type two\\)\\) 0x0\r\n$gdb_prompt $" { -+ pass $test_name -+ } -+} -+set test_name "print *(arrayOfPtr(3)%p), associated" -+gdb_test_multiple "print *(arrayOfPtr(3)%p)" $test_name { -+ -re "Cannot access memory at address 0x0\r\n$gdb_prompt $" { -+ pass $test_name -+ } -+ -re "Attempt to take contents of a not associated pointer.\r\n$gdb_prompt $" { -+ pass $test_name -+ } -+} -+gdb_test "print cyclicp1" "= \\( i = 1, p = $hex\( <.*>\)? \\)" -+gdb_test "print cyclicp1%p" "= \\(PTR TO -> \\( Type typewithpointer\\)\\) $hex\( <.*>\)?" -+gdb_test "print *((integer*) &inta + 2)" "= 3" "print temporary pointer, array" -+gdb_test "print *((integer*) &intvla + 3)" "= 4" "print temporary pointer, allocated vla" -+gdb_test "print \$pc" "= \\(PTR TO -> \\( void \\(\\) \\(\\)\\)\\) $hex " "Print program counter" -diff --git a/gdb/testsuite/gdb.fortran/pointers.f90 b/gdb/testsuite/gdb.fortran/pointers.f90 ---- a/gdb/testsuite/gdb.fortran/pointers.f90 -+++ b/gdb/testsuite/gdb.fortran/pointers.f90 -@@ -20,21 +20,34 @@ program pointers - integer, allocatable :: ivla2 (:, :) - end type two - -+ type :: typeWithPointer -+ integer i -+ type(typeWithPointer), pointer:: p -+ end type typeWithPointer -+ -+ type :: twoPtr -+ type (two), pointer :: p -+ end type twoPtr -+ - logical, target :: logv - complex, target :: comv - character, target :: charv - character (len=3), target :: chara - integer, target :: intv - integer, target, dimension (10,2) :: inta -- real, target :: realv -- type(two), target :: twov -+ integer, target, allocatable, dimension (:) :: intvla -+ real, target :: realv -+ type(two), target :: twov -+ type(twoPtr) :: arrayOfPtr (3) -+ type(typeWithPointer), target:: cyclicp1,cyclicp2 - - logical, pointer :: logp - complex, pointer :: comp -- character, pointer :: charp -- character (len=3), pointer :: charap -+ character, pointer:: charp -+ character (len=3), pointer:: charap - integer, pointer :: intp - integer, pointer, dimension (:,:) :: intap -+ integer, pointer, dimension (:) :: intvlap - real, pointer :: realp - type(two), pointer :: twop - -@@ -44,8 +57,14 @@ program pointers - nullify (charap) - nullify (intp) - nullify (intap) -+ nullify (intvlap) - nullify (realp) - nullify (twop) -+ nullify (arrayOfPtr(1)%p) -+ nullify (arrayOfPtr(2)%p) -+ nullify (arrayOfPtr(3)%p) -+ nullify (cyclicp1%p) -+ nullify (cyclicp2%p) - - logp => logv ! Before pointer assignment - comp => comv -@@ -53,8 +72,14 @@ program pointers - charap => chara - intp => intv - intap => inta -+ intvlap => intvla - realp => realv - twop => twov -+ arrayOfPtr(2)%p => twov -+ cyclicp1%i = 1 -+ cyclicp1%p => cyclicp2 -+ cyclicp2%i = 2 -+ cyclicp2%p => cyclicp1 - - logv = associated(logp) ! Before value assignment - comv = cmplx(1,2) -@@ -63,6 +88,10 @@ program pointers - intv = 10 - inta(:,:) = 1 - inta(3,1) = 3 -+ allocate (intvla(10)) -+ intvla(:) = 2 -+ intvla(4) = 4 -+ intvlap => intvla - realv = 3.14 - - allocate (twov%ivla1(3)) -diff --git a/gdb/testsuite/gdb.fortran/print_type.exp b/gdb/testsuite/gdb.fortran/print_type.exp ---- a/gdb/testsuite/gdb.fortran/print_type.exp -+++ b/gdb/testsuite/gdb.fortran/print_type.exp -@@ -1,5 +1,6 @@ - # Copyright 2019-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 -@@ -42,7 +43,7 @@ set complex [fortran_complex4] - # matches the string TYPE. - proc check_pointer_type { var_name type } { - gdb_test "ptype ${var_name}" \ -- "type = PTR TO -> \\( ${type} \\)" -+ "type = PTR TO -> \\( ${type}\\)" - } - - gdb_breakpoint [gdb_get_line_number "Before pointer assignment"] -@@ -87,7 +88,8 @@ gdb_test "ptype twop" \ - [multi_line "type = PTR TO -> \\( Type two" \ - " $int, allocatable :: ivla1\\(:\\)" \ - " $int, allocatable :: ivla2\\(:,:\\)" \ -- "End Type two \\)"] -+ "End Type two\\)"] -+ - - gdb_breakpoint [gdb_get_line_number "After value assignment"] - gdb_continue_to_breakpoint "After value assignment" -@@ -99,11 +101,11 @@ gdb_test "ptype intv" "type = $int" - gdb_test "ptype inta" "type = $int \\(10,2\\)" - gdb_test "ptype realv" "type = $real" - --gdb_test "ptype logp" "type = PTR TO -> \\( $logical \\)" --gdb_test "ptype comp" "type = PTR TO -> \\( $complex \\)" --gdb_test "ptype charp" "type = PTR TO -> \\( character\\*1 \\)" --gdb_test "ptype charap" "type = PTR TO -> \\( character\\*3 \\)" --gdb_test "ptype intp" "type = PTR TO -> \\( $int \\)" -+gdb_test "ptype logp" "type = PTR TO -> \\( $logical\\)" -+gdb_test "ptype comp" "type = PTR TO -> \\( $complex\\)" -+gdb_test "ptype charp" "type = PTR TO -> \\( character\\*1\\)" -+gdb_test "ptype charap" "type = PTR TO -> \\( character\\*3\\)" -+gdb_test "ptype intp" "type = PTR TO -> \\( $int\\)" - set test "ptype intap" - gdb_test_multiple $test $test { - -re "type = $int \\(10,2\\)\r\n$gdb_prompt $" { -@@ -113,4 +115,4 @@ gdb_test_multiple $test $test { - pass $test - } - } --gdb_test "ptype realp" "type = PTR TO -> \\( $real \\)" -+gdb_test "ptype realp" "type = PTR TO -> \\( $real\\)" -diff --git a/gdb/testsuite/gdb.fortran/vla-strings.exp b/gdb/testsuite/gdb.fortran/vla-strings.exp -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/vla-strings.exp -@@ -0,0 +1,103 @@ -+# 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 . -+ -+standard_testfile ".f90" -+ -+if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \ -+ {debug f90 quiet}] } { -+ return -1 -+} -+ -+# check that all fortran standard datatypes will be -+# handled correctly when using as VLA's -+ -+if ![runto_main] { -+ untested "could not run to main" -+ return -1 -+} -+ -+gdb_breakpoint [gdb_get_line_number "var_char-allocated-1"] -+gdb_continue_to_breakpoint "var_char-allocated-1" -+set test "whatis var_char first time" -+gdb_test_multiple "whatis var_char" $test { -+ -re "type = PTR TO -> \\( character\\*10\\)\r\n$gdb_prompt $" { -+ pass $test -+ } -+ -re "type = character\\*10\r\n$gdb_prompt $" { -+ pass $test -+ } -+} -+set test "ptype var_char first time" -+gdb_test_multiple "ptype var_char" $test { -+ -re "type = PTR TO -> \\( character\\*10\\)\r\n$gdb_prompt $" { -+ pass $test -+ } -+ -re "type = character\\*10\r\n$gdb_prompt $" { -+ pass $test -+ } -+} -+ -+ -+gdb_test "next" "\\d+.*var_char = 'foo'.*" \ -+ "next to allocation status of var_char" -+gdb_test "print l" " = \\.TRUE\\." "print allocation status first time" -+ -+ -+gdb_breakpoint [gdb_get_line_number "var_char-filled-1"] -+gdb_continue_to_breakpoint "var_char-filled-1" -+set test "print var_char, var_char-filled-1" -+gdb_test_multiple "print var_char" $test { -+ -re "= \\(PTR TO -> \\( character\\*3\\)\\) $hex\r\n$gdb_prompt $" { -+ gdb_test "print *var_char" "= 'foo'" "print *var_char, var_char-filled-1" -+ pass $test -+ } -+ -re "= 'foo'\r\n$gdb_prompt $" { -+ pass $test -+ } -+} -+set test "ptype var_char, var_char-filled-1" -+gdb_test_multiple "ptype var_char" $test { -+ -re "type = PTR TO -> \\( character\\*3\\)\r\n$gdb_prompt $" { -+ pass $test -+ } -+ -re "type = character\\*3\r\n$gdb_prompt $" { -+ pass $test -+ } -+} -+gdb_test "print var_char(1)" " = 102 'f'" "print var_char(1)" -+gdb_test "print var_char(3)" " = 111 'o'" "print var_char(3)" -+ -+ -+gdb_breakpoint [gdb_get_line_number "var_char-filled-2"] -+gdb_continue_to_breakpoint "var_char-filled-2" -+set test "print var_char, var_char-filled-2" -+gdb_test_multiple "print var_char" $test { -+ -re "= \\(PTR TO -> \\( character\\*6\\)\\) $hex\r\n$gdb_prompt $" { -+ gdb_test "print *var_char" "= 'foobar'" "print *var_char, var_char-filled-2" -+ pass $test -+ } -+ -re "= 'foobar'\r\n$gdb_prompt $" { -+ pass $test -+ } -+} -+set test "ptype var_char, var_char-filled-2" -+gdb_test_multiple "ptype var_char" $test { -+ -re "type = PTR TO -> \\( character\\*6\\)\r\n$gdb_prompt $" { -+ pass $test -+ } -+ -re "type = character\\*6\r\n$gdb_prompt $" { -+ pass $test -+ } -+} -diff --git a/gdb/testsuite/gdb.fortran/vla-strings.f90 b/gdb/testsuite/gdb.fortran/vla-strings.f90 -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/vla-strings.f90 -@@ -0,0 +1,39 @@ -+! 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 . -+ -+program vla_strings -+ character(len=:), target, allocatable :: var_char -+ character(len=:), pointer :: var_char_p -+ logical :: l -+ -+ allocate(character(len=10) :: var_char) -+ l = allocated(var_char) ! var_char-allocated-1 -+ var_char = 'foo' -+ deallocate(var_char) ! var_char-filled-1 -+ l = allocated(var_char) ! var_char-deallocated -+ allocate(character(len=42) :: var_char) -+ l = allocated(var_char) -+ var_char = 'foobar' -+ var_char = '' ! var_char-filled-2 -+ var_char = 'bar' ! var_char-empty -+ deallocate(var_char) -+ allocate(character(len=21) :: var_char) -+ l = allocated(var_char) ! var_char-allocated-3 -+ var_char = 'johndoe' -+ var_char_p => var_char -+ l = associated(var_char_p) ! var_char_p-associated -+ var_char_p => null() -+ l = associated(var_char_p) ! var_char_p-not-associated -+end program vla_strings -diff --git a/gdb/testsuite/gdb.fortran/vla-value.exp b/gdb/testsuite/gdb.fortran/vla-value.exp ---- a/gdb/testsuite/gdb.fortran/vla-value.exp -+++ b/gdb/testsuite/gdb.fortran/vla-value.exp -@@ -37,7 +37,7 @@ gdb_breakpoint [gdb_get_line_number "vla1-init"] - gdb_continue_to_breakpoint "vla1-init" - gdb_test "print vla1" " = " "print non-allocated vla1" - gdb_test "print &vla1" \ -- " = \\\(PTR TO -> \\\( $real, allocatable \\\(:,:,:\\\) \\\)\\\) $hex" \ -+ " = \\\(PTR TO -> \\\( $real, allocatable \\\(:,:,:\\\)\\\)\\\) $hex" \ - "print non-allocated &vla1" - gdb_test "print vla1(1,1,1)" "no such vector element \\\(vector not allocated\\\)" \ - "print member in non-allocated vla1 (1)" -@@ -58,7 +58,7 @@ with_timeout_factor 15 { - "step over value assignment of vla1" - } - gdb_test "print &vla1" \ -- " = \\\(PTR TO -> \\\( $real, allocatable \\\(10,10,10\\\) \\\)\\\) $hex" \ -+ " = \\\(PTR TO -> \\\( $real, allocatable \\\(10,10,10\\\)\\\)\\\) $hex" \ - "print allocated &vla1" - gdb_test "print vla1(3, 6, 9)" " = 1311" "print allocated vla1(3,6,9)" - gdb_test "print vla1(1, 3, 8)" " = 1311" "print allocated vla1(1,3,8)" -@@ -78,7 +78,7 @@ gdb_test "print vla1(9, 9, 9)" " = 999" \ - # Try to access values in undefined pointer to VLA (dangling) - gdb_test "print pvla" " = " "print undefined pvla" - gdb_test "print &pvla" \ -- " = \\\(PTR TO -> \\\( $real \\\(:,:,:\\\) \\\)\\\) $hex" \ -+ " = \\\(PTR TO -> \\\( $real \\\(:,:,:\\\)\\\)\\\) $hex" \ - "print non-associated &pvla" - gdb_test "print pvla(1, 3, 8)" "no such vector element \\\(vector not associated\\\)" \ - "print undefined pvla(1,3,8)" -@@ -87,7 +87,7 @@ gdb_test "print pvla(1, 3, 8)" "no such vector element \\\(vector not associated - gdb_breakpoint [gdb_get_line_number "pvla-associated"] - gdb_continue_to_breakpoint "pvla-associated" - gdb_test "print &pvla" \ -- " = \\\(PTR TO -> \\\( $real \\\(10,10,10\\\) \\\)\\\) $hex" \ -+ " = \\\(PTR TO -> \\\( $real \\\(10,10,10\\\)\\\)\\\) $hex" \ - "print associated &pvla" - gdb_test "print pvla(3, 6, 9)" " = 42" "print associated pvla(3,6,9)" - gdb_test "print pvla(1, 3, 8)" " = 1001" "print associated pvla(1,3,8)" -diff --git a/gdb/typeprint.c b/gdb/typeprint.c ---- a/gdb/typeprint.c -+++ b/gdb/typeprint.c -@@ -565,6 +565,25 @@ whatis_exp (const char *exp, int show) - printf_filtered (" */\n"); - } - -+ /* Resolve any dynamic target type, as we might print -+ additional information about the target. -+ For example, in Fortran and C we are printing the dimension of the -+ dynamic array the pointer is pointing to. */ -+ if (type->code () == TYPE_CODE_PTR -+ && is_dynamic_type (type) == 1) -+ { -+ CORE_ADDR addr; -+ if (NULL != TYPE_DATA_LOCATION (TYPE_TARGET_TYPE(type))) -+ addr = value_address (val); -+ else -+ addr = value_as_address (val); -+ -+ if (addr != 0 -+ && type_not_associated (type) == 0) -+ TYPE_TARGET_TYPE (type) = resolve_dynamic_type (TYPE_TARGET_TYPE (type), -+ {}, addr); -+ } -+ - LA_PRINT_TYPE (type, "", gdb_stdout, show, 0, &flags); - printf_filtered ("\n"); - } -diff --git a/gdb/valops.c b/gdb/valops.c ---- a/gdb/valops.c -+++ b/gdb/valops.c -@@ -1553,6 +1553,19 @@ value_ind (struct value *arg1) - if (base_type->code () == TYPE_CODE_PTR) - { - struct type *enc_type; -+ CORE_ADDR addr; -+ -+ if (type_not_associated (base_type)) -+ error (_("Attempt to take contents of a not associated pointer.")); -+ -+ if (NULL != TYPE_DATA_LOCATION (TYPE_TARGET_TYPE (base_type))) -+ addr = value_address (arg1); -+ else -+ addr = value_as_address (arg1); -+ -+ if (addr != 0) -+ TYPE_TARGET_TYPE (base_type) = -+ resolve_dynamic_type (TYPE_TARGET_TYPE (base_type), {}, addr); - - /* We may be pointing to something embedded in a larger object. - Get the real type of the enclosing object. */ -@@ -1570,8 +1583,7 @@ value_ind (struct value *arg1) - else - { - /* Retrieve the enclosing object pointed to. */ -- base_addr = (value_as_address (arg1) -- - value_pointed_to_offset (arg1)); -+ base_addr = (addr - value_pointed_to_offset (arg1)); - } - arg2 = value_at_lazy (enc_type, base_addr); - enc_type = value_type (arg2); -diff --git a/gdb/valprint.c b/gdb/valprint.c ---- a/gdb/valprint.c -+++ b/gdb/valprint.c -@@ -1046,12 +1046,6 @@ value_check_printable (struct value *val, struct ui_file *stream, - return 0; - } - -- if (type_not_associated (value_type (val))) -- { -- val_print_not_associated (stream); -- return 0; -- } -- - if (type_not_allocated (value_type (val))) - { - val_print_not_allocated (stream); diff --git a/gdb-vla-intel-stringbt-fix.patch b/gdb-vla-intel-stringbt-fix.patch deleted file mode 100644 index 95e503b..0000000 --- a/gdb-vla-intel-stringbt-fix.patch +++ /dev/null @@ -1,167 +0,0 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Jan Kratochvil -Date: Fri, 1 Aug 2014 23:02:17 +0200 -Subject: gdb-vla-intel-stringbt-fix.patch - -;;=push+jan - -http://sourceware.org/ml/gdb-patches/2014-08/msg00025.html - -On Fri, 01 Aug 2014 09:20:19 +0200, Keven Boell wrote: -> I just tried it on Fedora 20 i686. Applied the patch, you mentioned, on top of -> the Fortran VLA series and executed your dynamic-other-frame test. Everything -> is working fine here, I cannot reproduce the crash. - -I have it reproducible on Fedora 20 i686 with plain -CFLAGS=-g ./configure;make;cd gdb/testsuite;make site.exp;runtest gdb.fortran/dynamic-other-frame.exp - -Besides that I have updated the testcase with - gdb_test_no_output "set print frame-arguments all" -so that there is no longer needed the patch: - [patch] Display Fortran strings in backtraces - https://sourceware.org/ml/gdb-patches/2014-07/msg00709.html - -The fix below has no regressions for me. Unfortunately I do not see why you -cannot reproduce it. - -Thanks, -Jan - -diff --git a/gdb/dwarf2/loc.c b/gdb/dwarf2/loc.c ---- a/gdb/dwarf2/loc.c -+++ b/gdb/dwarf2/loc.c -@@ -2249,6 +2249,20 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame, - ctx.per_cu = per_cu; - ctx.obj_address = 0; - -+frame_id old_frame_id (get_frame_id (deprecated_safe_get_selected_frame ())); -+class RestoreCall { -+private: -+ const std::function func; -+public: -+ RestoreCall(std::function func_):func(func_) {} -+ ~RestoreCall() { func(); } -+} restore_frame([=]() { -+ frame_info *old_frame (frame_find_by_id (old_frame_id)); -+ if (old_frame != NULL) -+ select_frame (old_frame); -+}); -+if (frame != NULL) select_frame (frame); -+ - scoped_value_mark free_values; - - ctx.gdbarch = per_objfile->objfile->arch (); -diff --git a/gdb/testsuite/gdb.fortran/dynamic-other-frame-stub.f90 b/gdb/testsuite/gdb.fortran/dynamic-other-frame-stub.f90 -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/dynamic-other-frame-stub.f90 -@@ -0,0 +1,24 @@ -+! 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. -+! -+! 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 bar -+ real :: dummy -+ dummy = 1 -+end subroutine bar -diff --git a/gdb/testsuite/gdb.fortran/dynamic-other-frame.exp b/gdb/testsuite/gdb.fortran/dynamic-other-frame.exp -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/dynamic-other-frame.exp -@@ -0,0 +1,39 @@ -+# 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. -+ -+set testfile "dynamic-other-frame" -+set srcfile1 ${testfile}.f90 -+set srcfile2 ${testfile}-stub.f90 -+set objfile2 [standard_output_file ${testfile}-stub.o] -+set executable ${testfile} -+set binfile [standard_output_file ${executable}] -+ -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile2}" "${objfile2}" object {f90}] != "" -+ || [gdb_compile "${srcdir}/${subdir}/${srcfile1} ${objfile2}" "${binfile}" executable {debug f90}] != "" } { -+ untested "Couldn't compile ${srcfile1} or ${srcfile2}" -+ return -1 -+} -+ -+clean_restart ${executable} -+ -+gdb_test_no_output "set print frame-arguments all" -+ -+if ![runto bar_] then { -+ perror "couldn't run to bar_" -+ continue -+} -+ -+gdb_test "bt" {foo \(string='hello'.*} -diff --git a/gdb/testsuite/gdb.fortran/dynamic-other-frame.f90 b/gdb/testsuite/gdb.fortran/dynamic-other-frame.f90 -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/dynamic-other-frame.f90 -@@ -0,0 +1,36 @@ -+! 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. -+! -+! 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 foo (string) -+ interface -+ subroutine bar -+ end subroutine -+ end interface -+ character string*(*) -+ call bar ! stop-here -+end subroutine foo -+program test -+ interface -+ subroutine foo (string) -+ character string*(*) -+ end subroutine -+ end interface -+ call foo ('hello') -+end diff --git a/gdb-vla-intel-tests.patch b/gdb-vla-intel-tests.patch deleted file mode 100644 index d9b6f33..0000000 --- a/gdb-vla-intel-tests.patch +++ /dev/null @@ -1,350 +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-vla-intel-tests.patch - -;;=fedoratest - -diff --git a/gdb/testsuite/gdb.fortran/ptr-indentation.exp b/gdb/testsuite/gdb.fortran/ptr-indentation.exp ---- a/gdb/testsuite/gdb.fortran/ptr-indentation.exp -+++ b/gdb/testsuite/gdb.fortran/ptr-indentation.exp -@@ -37,5 +37,5 @@ gdb_continue_to_breakpoint "BP1" - gdb_test "ptype tinsta" \ - [multi_line "type = Type tuserdef" \ - " $int :: i" \ -- " PTR TO -> \\( $real :: ptr \\)" \ -+ " PTR TO -> \\( $real :: ptr\\)" \ - "End Type tuserdef"] -diff --git a/gdb/testsuite/gdb.fortran/ptype-on-functions.exp b/gdb/testsuite/gdb.fortran/ptype-on-functions.exp ---- a/gdb/testsuite/gdb.fortran/ptype-on-functions.exp -+++ b/gdb/testsuite/gdb.fortran/ptype-on-functions.exp -@@ -42,7 +42,7 @@ gdb_test "ptype say_numbers" \ - "type = void \\(integer\\(kind=4\\), integer\\(kind=4\\), integer\\(kind=4\\)\\)" - - gdb_test "ptype fun_ptr" \ -- "type = PTR TO -> \\( integer\\(kind=4\\) \\(\\) \\(REF TO -> \\( integer\\(kind=4\\) \\)\\) \\)" -+ "type = PTR TO -> \\( integer\\(kind=4\\) \\(\\) \\(REF TO -> \\( integer\\(kind=4\\)\\)\\)\\)" - - gdb_test "ptype say_string" \ - "type = void \\(character\\*\\(\\*\\), integer\\(kind=\\d+\\)\\)" -diff --git a/gdb/testsuite/gdb.fortran/vla-func.exp b/gdb/testsuite/gdb.fortran/vla-func.exp -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/vla-func.exp -@@ -0,0 +1,61 @@ -+# Copyright 2014 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+standard_testfile ".f90" -+ -+if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \ -+ {debug f90 quiet}] } { -+ return -1 -+} -+ -+if ![runto MAIN__] then { -+ perror "couldn't run to breakpoint MAIN__" -+ continue -+} -+ -+# Check VLA passed to first Fortran function. -+gdb_breakpoint [gdb_get_line_number "func1-vla-passed"] -+gdb_continue_to_breakpoint "func1-vla-passed" -+gdb_test "print vla" " = \\( *\\( *22, *22, *22,\[()22, .\]*\\)" \ -+ "print vla (func1)" -+gdb_test "ptype vla" "type = integer\\\(kind=4\\\), allocatable \\\(10,10\\\)" \ -+ "ptype vla (func1)" -+ -+gdb_breakpoint [gdb_get_line_number "func1-vla-modified"] -+gdb_continue_to_breakpoint "func1-vla-modified" -+gdb_test "print vla(5,5)" " = 55" "print vla(5,5) (func1)" -+gdb_test "print vla(7,7)" " = 77" "print vla(5,5) (func1)" -+ -+# Check if the values are correct after returning from func1 -+gdb_breakpoint [gdb_get_line_number "func1-returned"] -+gdb_continue_to_breakpoint "func1-returned" -+gdb_test "print ret" " = .TRUE." "print ret after func1 returned" -+ -+# Check VLA passed to second Fortran function -+gdb_breakpoint [gdb_get_line_number "func2-vla-passed"] -+gdb_continue_to_breakpoint "func2-vla-passed" -+gdb_test "print vla" \ -+ " = \\\(44, 44, 44, 44, 44, 44, 44, 44, 44, 44\\\)" \ -+ "print vla (func2)" -+gdb_test "ptype vla" "type = integer\\\(kind=4\\\) \\\(10\\\)" \ -+ "ptype vla (func2)" -+ -+# Check if the returned VLA has the correct values and ptype. -+gdb_breakpoint [gdb_get_line_number "func2-returned"] -+gdb_continue_to_breakpoint "func2-returned" -+gdb_test "print vla3" " = \\\(1, 2, 44, 4, 44, 44, 44, 8, 44, 44\\\)" \ -+ "print vla3 (after func2)" -+gdb_test "ptype vla3" "type = integer\\\(kind=4\\\), allocatable \\\(10\\\)" \ -+ "ptype vla3 (after func2)" -diff --git a/gdb/testsuite/gdb.fortran/vla-func.f90 b/gdb/testsuite/gdb.fortran/vla-func.f90 -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/vla-func.f90 -@@ -0,0 +1,71 @@ -+! 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. -+ -+logical function func1 (vla) -+ implicit none -+ integer, allocatable :: vla (:, :) -+ func1 = allocated(vla) -+ vla(5,5) = 55 ! func1-vla-passed -+ vla(7,7) = 77 -+ return ! func1-vla-modified -+end function func1 -+ -+function func2(vla) -+ implicit none -+ integer :: vla (:) -+ integer :: func2(size(vla)) -+ integer :: k -+ -+ vla(1) = 1 ! func2-vla-passed -+ vla(2) = 2 -+ vla(4) = 4 -+ vla(8) = 8 -+ -+ func2 = vla -+end function func2 -+ -+program vla_func -+ implicit none -+ interface -+ logical function func1 (vla) -+ integer, allocatable :: vla (:, :) -+ end function -+ end interface -+ interface -+ function func2 (vla) -+ integer :: vla (:) -+ integer func2(size(vla)) -+ end function -+ end interface -+ -+ logical :: ret -+ integer, allocatable :: vla1 (:, :) -+ integer, allocatable :: vla2 (:) -+ integer, allocatable :: vla3 (:) -+ -+ ret = .FALSE. -+ -+ allocate (vla1 (10,10)) -+ vla1(:,:) = 22 -+ -+ allocate (vla2 (10)) -+ vla2(:) = 44 -+ -+ ret = func1(vla1) -+ vla3 = func2(vla2) ! func1-returned -+ -+ ret = .TRUE. ! func2-returned -+end program vla_func -diff --git a/gdb/testsuite/gdb.fortran/vla-ptr-info.exp b/gdb/testsuite/gdb.fortran/vla-ptr-info.exp ---- a/gdb/testsuite/gdb.fortran/vla-ptr-info.exp -+++ b/gdb/testsuite/gdb.fortran/vla-ptr-info.exp -@@ -33,5 +33,5 @@ set real4 [fortran_real4] - # Check the status of a pointer to a dynamic array. - gdb_breakpoint [gdb_get_line_number "pvla-associated"] - gdb_continue_to_breakpoint "pvla-associated" --gdb_test "print &pvla" " = \\(PTR TO -> \\( $real4 \\(10,10,10\\) \\)\\) ${hex}" \ -+gdb_test "print &pvla" " = \\(PTR TO -> \\( $real4 \\(10,10,10\\)\\)\\) ${hex}" \ - "print pvla pointer information" -diff --git a/gdb/testsuite/gdb.fortran/vla-stringsold.exp b/gdb/testsuite/gdb.fortran/vla-stringsold.exp -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/vla-stringsold.exp -@@ -0,0 +1,101 @@ -+# Copyright 2014 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+standard_testfile ".f90" -+ -+if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \ -+ {debug f90 quiet}] } { -+ return -1 -+} -+ -+# check that all fortran standard datatypes will be -+# handled correctly when using as VLA's -+ -+if ![runto MAIN__] then { -+ perror "couldn't run to breakpoint MAIN__" -+ continue -+} -+ -+gdb_breakpoint [gdb_get_line_number "var_char-allocated-1"] -+gdb_continue_to_breakpoint "var_char-allocated-1" -+gdb_test "print var_char" \ -+ " = \\(PTR TO -> \\( character\\*10\\)\\) ${hex}" \ -+ "print var_char after allocated first time" -+gdb_test "whatis var_char" "type = PTR TO -> \\( character\\*10\\)" \ -+ "whatis var_char first time" -+gdb_test "ptype var_char" "type = PTR TO -> \\( character\\*10\\)" \ -+ "ptype var_char first time" -+gdb_test "next" "\\d+.*var_char = 'foo'.*" \ -+ "next to allocation status of var_char" -+gdb_test "print l" " = .TRUE." "print allocation status first time" -+ -+gdb_breakpoint [gdb_get_line_number "var_char-filled-1"] -+gdb_continue_to_breakpoint "var_char-filled-1" -+gdb_test "print var_char" \ -+ " = \\(PTR TO -> \\( character\\*3\\)\\) ${hex}" \ -+ "print var_char after filled first time" -+gdb_test "print *var_char" " = 'foo'" \ -+ "print *var_char after filled first time" -+gdb_test "whatis var_char" "type = PTR TO -> \\( character\\*3\\)" \ -+ "whatis var_char after filled first time" -+gdb_test "ptype var_char" "type = PTR TO -> \\( character\\*3\\)" \ -+ "ptype var_char after filled first time" -+gdb_test "print var_char(1)" " = 102 'f'" "print var_char(1)" -+gdb_test "print var_char(3)" " = 111 'o'" "print var_char(3)" -+ -+gdb_breakpoint [gdb_get_line_number "var_char-filled-2"] -+gdb_continue_to_breakpoint "var_char-filled-2" -+gdb_test "print var_char" \ -+ " = \\(PTR TO -> \\( character\\*6\\)\\) ${hex}" \ -+ "print var_char after allocated second time" -+gdb_test "print *var_char" " = 'foobar'" \ -+ "print *var_char after allocated second time" -+gdb_test "whatis var_char" "type = PTR TO -> \\( character\\*6\\)" \ -+ "whatis var_char second time" -+gdb_test "ptype var_char" "type = PTR TO -> \\( character\\*6\\)" \ -+ "ptype var_char second time" -+ -+gdb_breakpoint [gdb_get_line_number "var_char-empty"] -+gdb_continue_to_breakpoint "var_char-empty" -+gdb_test "print var_char" \ -+ " = \\(PTR TO -> \\( character\\*0\\)\\) ${hex}" \ -+ "print var_char after set empty" -+gdb_test "print *var_char" " = \"\"" "print *var_char after set empty" -+gdb_test "whatis var_char" "type = PTR TO -> \\( character\\*0\\)" \ -+ "whatis var_char after set empty" -+gdb_test "ptype var_char" "type = PTR TO -> \\( character\\*0\\)" \ -+ "ptype var_char after set empty" -+ -+gdb_breakpoint [gdb_get_line_number "var_char-allocated-3"] -+gdb_continue_to_breakpoint "var_char-allocated-3" -+gdb_test "print var_char" \ -+ " = \\(PTR TO -> \\( character\\*21\\)\\) ${hex}" \ -+ "print var_char after allocated third time" -+gdb_test "whatis var_char" "type = PTR TO -> \\( character\\*21\\)" \ -+ "whatis var_char after allocated third time" -+gdb_test "ptype var_char" "type = PTR TO -> \\( character\\*21\\)" \ -+ "ptype var_char after allocated third time" -+ -+gdb_breakpoint [gdb_get_line_number "var_char_p-associated"] -+gdb_continue_to_breakpoint "var_char_p-associated" -+gdb_test "print var_char_p" \ -+ " = \\(PTR TO -> \\( character\\*7\\)\\) ${hex}" \ -+ "print var_char_p after associated" -+gdb_test "print *var_char_p" " = 'johndoe'" \ -+ "print *var_char_ after associated" -+gdb_test "whatis var_char_p" "type = PTR TO -> \\( character\\*7\\)" \ -+ "whatis var_char_p after associated" -+gdb_test "ptype var_char_p" "type = PTR TO -> \\( character\\*7\\)" \ -+ "ptype var_char_p after associated" -diff --git a/gdb/testsuite/gdb.fortran/vla-stringsold.f90 b/gdb/testsuite/gdb.fortran/vla-stringsold.f90 -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/vla-stringsold.f90 -@@ -0,0 +1,40 @@ -+! 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. -+ -+program vla_strings -+ character(len=:), target, allocatable :: var_char -+ character(len=:), pointer :: var_char_p -+ logical :: l -+ -+ allocate(character(len=10) :: var_char) -+ l = allocated(var_char) ! var_char-allocated-1 -+ var_char = 'foo' -+ deallocate(var_char) ! var_char-filled-1 -+ l = allocated(var_char) ! var_char-deallocated -+ allocate(character(len=42) :: var_char) -+ l = allocated(var_char) -+ var_char = 'foobar' -+ var_char = '' ! var_char-filled-2 -+ var_char = 'bar' ! var_char-empty -+ deallocate(var_char) -+ allocate(character(len=21) :: var_char) -+ l = allocated(var_char) ! var_char-allocated-3 -+ var_char = 'johndoe' -+ var_char_p => var_char -+ l = associated(var_char_p) ! var_char_p-associated -+ var_char_p => null() -+ l = associated(var_char_p) ! var_char_p-not-associated -+end program vla_strings -diff --git a/gdb/testsuite/gdb.fortran/whatis_type.exp b/gdb/testsuite/gdb.fortran/whatis_type.exp ---- a/gdb/testsuite/gdb.fortran/whatis_type.exp -+++ b/gdb/testsuite/gdb.fortran/whatis_type.exp -@@ -44,7 +44,7 @@ gdb_test "whatis t2" "type = Type t2" - gdb_test "whatis t2v" "type = Type t2" - gdb_test "whatis t3" "type = Type t3" - gdb_test "whatis t3v" "type = Type t3" --gdb_test "whatis t3p" "type = PTR TO -> \\( Type t3 \\)" -+gdb_test "whatis t3p" "type = PTR TO -> \\( Type t3\\)" - - gdb_test "ptype t1" \ - [multi_line "type = Type t1" \ -@@ -73,4 +73,4 @@ gdb_test "ptype t3p" \ - [multi_line "type = PTR TO -> \\( Type t3" \ - " $int :: t3_i" \ - " Type t2 :: t2_n" \ -- "End Type t3 \\)"] -+ "End Type t3\\)"] diff --git a/gdb.changes b/gdb.changes index 0a5286e..313f866 100644 --- a/gdb.changes +++ b/gdb.changes @@ -1,3 +1,266 @@ +------------------------------------------------------------------- +Fri Oct 22 07:03:55 UTC 2021 - Tom de Vries + +- Disable big endian powerpc. +- Maintenance scripts: + * Fix patch filtering in clean.sh. + * Add KFAIL in qa.sh. +- Patches added: + * gdb-testsuite-add-checks-to-gdb.arch-i386-sse.exp.patch + * gdb-testsuite-add-gdb.testsuite-dump-system-info.exp.patch + * gdb-testsuite-add-kfail-in-gdb.threads-fork-plus-threads.exp.patch + * gdb-testsuite-factor-out-dump_info-in-gdb.testsuite-dump-system-info.exp.patch + * gdb-testsuite-fix-fail-in-gdb.threads-fork-and-threads.exp.patch + * gdb-testsuite-fix-gdb.threads-linux-dp.exp.patch + * gdb-testsuite-fix-port-detection-in-gdb.debuginfod-fetch_src_and_symbols.exp.patch + * gdb-testsuite-handle-recursive-internal-problem-in-gdb_internal_error_resync.patch + * gdb-testsuite-handle-runto-fail-in-gdb.mi-mi-var-cp.exp.patch + * gdb-tui-fix-breakpoint-display-functionality.patch + * gdb-testsuite-Fix-gdb.threads-thread-specific-bp.exp.patch +- Patches dropped: + * fix-gdb.threads-linux-dp.exp.patch + +------------------------------------------------------------------- +Wed Oct 20 15:48:40 UTC 2021 - Tom de Vries + +- Added maintenance script: + * qa.sh +- Drop 32bit packages for s390x. + +------------------------------------------------------------------- +Tue Oct 19 08:00:06 UTC 2021 - Tom de Vries + +- Fix SLE-15 s390x: unresolvable, nothing provides + glibc-devel-static-32bit. +- Disable test-case gdb.base/break-interp.exp for SLE-11. + It causes a + "glibc detected *** expect: double free or corruption (out)" in + expect and a subsequent runtest abort. This might be the cause + of the package build failure due to + "Job seems to be stuck here, killed. (after 8hrs of inactivity)" +- Patches added: + * gdb-testsuite-fix-gdb.base-step-over-syscall.exp-with-m32-amd-case.patch + * gdb-testsuite-fix-gdb.ada-big_packed_array.exp-xfail-for-m32.patch + * gdb-testsuite-fix-race-in-gdb.threads-detach-step-over.exp.patch + * fix-gdb.multi-multi-term-settings.exp-race.patch + * gdb-testsuite-update-test-gdb.base-step-over-syscall.exp.patch + +------------------------------------------------------------------- +Mon Oct 18 17:46:06 UTC 2021 - Tom de Vries - 11.1 + +- Rebase to 11.1 release (as in fedora 35 @ 9cd9368): + * GDB now supports general memory tagging functionality if the + underlying architecture supports the proper primitives and hooks. + Currently this is enabled only for AArch64 MTE. + * GDB will now look for the .gdbinit file in a config directory + before looking for ~/.gdbinit. The file is searched for in + the following locations: $XDG_CONFIG_HOME/gdb/gdbinit, + $HOME/.config/gdb/gdbinit, $HOME/.gdbinit. + * GDB will now load and process commands from + ~/.config/gdb/gdbearlyinit or ~/.gdbearlyinit if these files + are present. These files are processed earlier than any of + the other initialization files and can affect parts of GDB's + startup that previously had already been completed before the + initialization files were read, for example styling of the + initial GDB greeting. + * GDB now has two new options "--early-init-command" and + "--early-init-eval-command" with corresponding short options + "-eix" and "-eiex" that allow options (that would normally + appear in a gdbearlyinit file) to be passed on the command + line. + * set startup-quietly on|off + show startup-quietly + When 'on', this causes GDB to act as if "-silent" were passed + on the command line. This command needs to be added to an + early initialization file (e.g. ~/.config/gdb/gdbearlyinit) + in order to affect GDB. + * For RISC-V targets, the target feature + "org.gnu.gdb.riscv.vector" is now understood by GDB, and can + be used to describe the vector registers of a target. + * TUI windows now support mouse actions. The mouse wheel + scrolls the appropriate window. + * Key combinations that do not have a specific action on the + focused window are passed to GDB. For example, you now can + use Ctrl-Left/Ctrl-Right to move between words in the command + window regardless of which window is in focus. Previously + you would need to focus on the command window for such key + combinations to work. + * set python ignore-environment on|off + show python ignore-environment + When 'on', this causes GDB's builtin Python to ignore any + environment variables that would otherwise affect how Python + behaves. This command needs to be added to an early + initialization file (e.g. ~/.config/gdb/gdbearlyinit) in + order to affect GDB. + * set python dont-write-bytecode auto|on|off + show python dont-write-bytecode + When 'on', this causes GDB's builtin Python to not write any + byte-code (.pyc files) to disk. This command needs to be + added to an early initialization file + (e.g. ~/.config/gdb/gdbearlyinit) in order to affect GDB. + When 'off' byte-code will always be written. + When set to 'auto' (the default) Python will check the + PYTHONDONTWRITEBYTECODE environment variable. + * break [PROBE_MODIFIER] [LOCATION] [thread THREADNUM] + [-force-condition] [if CONDITION] + This command would previously refuse setting a breakpoint if + the CONDITION expression is invalid at a location. It now + accepts and defines the breakpoint if there is at least one + location at which the CONDITION is valid. The locations + for which the CONDITION is invalid, are automatically + disabled. If CONDITION is invalid at all of the locations, + setting the breakpoint is still rejected. However, the + '-force-condition' flag can be used in this case for forcing + GDB to define the breakpoint, making all the current + locations automatically disabled. This may be useful if the + user knows the condition will become meaningful at a future + location, e.g. due to a shared library load. +- Update libipt to v2.0.4. Dropped obsoleted patch: + * v1.5-libipt-static.patch +- Obsoleted fedora patches dropped: + * gdb-moribund-utrace-workaround.patch + * gdb-save-restore-file-offset-while-reading-notes-in-core-file.patch + * gdb-vla-intel-fix-print-char-array.patch + * gdb-vla-intel-fortran-strides.patch + * gdb-vla-intel-fortran-vla-strings.patch + * gdb-vla-intel-stringbt-fix.patch + * gdb-vla-intel-tests.patch +- Obsoleted fedora fixup patches dropped: + * fixup-2-gdb-archer-vla-tests.patch + * fixup-2-gdb-rhbz1156192-recursive-dlopen-test.patch + * fixup-3-gdb-archer-vla-tests.patch + * fixup-gdb-6.3-test-pie-20050107.patch + * fixup-gdb-6.3-threaded-watchpoints2-20050225.patch + * fixup-gdb-6.5-sharedlibrary-path.patch + * fixup-gdb-6.8-bz442765-threaded-exec-test.patch + * fixup-gdb-archer-vla-tests.patch + * fixup-gdb-base-gnu-ifunc-strstr-workaround-exp.patch + * fixup-gdb-btrobust.patch + * fixup-gdb-bz634108-solib_address.patch + * fixup-gdb-dts-rhel6-python-compat.patch + * fixup-gdb-gnat-dwarf-crash-3of3.patch + * fixup-gdb-rhbz1156192-recursive-dlopen-test.patch + * fixup-gdb-test-ivy-bridge.patch + * fixup-gdb-vla-intel-fortran-vla-strings.patch + * fixup-gdb-vla-intel-tests.patch +- Obsoleted patches dropped: + * amd64-linux-siginfo-include-order.patch + * gdb-powerpc-remove-512-bytes-region-limit-if-2nd-dawr-is-avaliable.patch + * gdb-support-dw-lle-start-end.patch + * gdb-symtab-fix-infinite-recursion-in-dwarf2_cu-get_builder-again.patch + * gdb-symtab-fix-language-of-frame-without-debug-info.patch + * gdb-symtab-read-cu-base-address-for-enqueued-cu.patch + * gdb-symtab-use-early-continue-in-find_pc_sect_compunit.patch + * gdb-testsuite-catch-condition-evaluation-errors-in-gdb-assert.patch + * gdb-testsuite-detect-gdb-prompt-after-monitor-exit.patch + * gdb-testsuite-disable-selftests-for-factory.patch + * gdb-testsuite-fix-control-flow-in-gdb-reverse-insn-reverse-exp.patch + * gdb-testsuite-fix-failure-in-gdb-base-step-over-no-symbols-exp.patch + * gdb-testsuite-fix-gdb-dlang-watch-loc-exp-on-ppc64.patch + * gdb-testsuite-fix-gdb-reverse-insn-reverse-x86-c-for-m32.patch + * gdb-testsuite-fix-gdb.arch-amd64-stap-three-arg-disp.s.patch + * gdb-testsuite-fix-unset-of-debuginfod_urls-in-default_gdb_init.patch + * gdb-testsuite-fix-xfail-handling-in-gdb.threads-gcore-thread.exp.patch + * gdb-testsuite-gdb-base-morestack-exp-no-clang.patch + * gdb-testsuite-gdb-tui-new-layout-exp-partly-require-tcl86.patch + * gdb-testsuite-handle-sigill-in-gdb-reverse-insn-reverse-exp.patch + * gdb-testsuite-ignore-debuginfod_urls.patch + * gdb-testsuite-prevent-pagination-in-gdb-internalflags.patch + * gdb-threads-fix-lin_thread_get_thread_signals-for-glibc-2.28.patch + * gdb-try-to-load-libthread_db-only-after-reading-all-shared-libraries-when-attaching.patch + * gdb-tui-fix-len_without_escapes-in-tui-disasm.c.patch +- Fedora patches updated: + * gdb-6.3-bz140532-ppc-unwinding-test.patch + * gdb-6.3-bz202689-exec-from-pthread-test.patch + * gdb-6.3-gstack-20050411.patch + * gdb-6.3-inheritancetest-20050726.patch + * gdb-6.3-mapping-zero-inode-test.patch + * gdb-6.3-test-dtorfix-20050121.patch + * gdb-6.3-test-movedir-20050125.patch + * gdb-6.3-threaded-watchpoints2-20050225.patch + * gdb-6.5-bz109921-DW_AT_decl_file-test.patch + * gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch + * gdb-6.5-bz218379-ppc-solib-trampoline-test.patch + * gdb-6.5-bz243845-stale-testing-zombie-test.patch + * gdb-6.5-ia64-libunwind-leak-test.patch + * gdb-6.5-last-address-space-byte-test.patch + * gdb-6.5-readline-long-line-crash-test.patch + * gdb-6.5-section-num-fixup-test.patch + * gdb-6.5-sharedlibrary-path.patch + * gdb-6.6-buildid-locate-rpm-scl.patch + * gdb-6.6-buildid-locate-rpm.patch + * gdb-6.6-buildid-locate-solib-missing-ids.patch + * gdb-6.6-buildid-locate.patch + * gdb-6.6-bz229517-gcore-without-terminal.patch + * gdb-6.6-bz230000-power6-disassembly-test.patch + * gdb-6.6-bz237572-ppc-atomic-sequence-test.patch + * gdb-6.8-bz442765-threaded-exec-test.patch + * gdb-bz601887-dwarf4-rh-test.patch + * gdb-bz634108-solib_address.patch + * gdb-ccache-workaround.patch + * gdb-container-rh-pkg.patch + * gdb-fedora-libncursesw.patch + * gdb-fortran-frame-string.patch + * gdb-glibc-strstr-workaround.patch + * gdb-lineno-makeup-test.patch + * gdb-linux_perf-bundle.patch + * gdb-physname-pr11734-test.patch + * gdb-ppc-power7-test.patch + * gdb-rhbz1156192-recursive-dlopen-test.patch + * gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch + * gdb-rhbz1350436-type-printers-error.patch + * gdb-rhbz1398387-tab-crash-test.patch + * gdb-test-dw2-aranges.patch + * gdb-test-ivy-bridge.patch + * gdb-test-pid0-core.patch +- Patches updated: + * gdb-fix-selftest-fails-with-gdb-build-with-O2-flto.patch + * gdb-gcore-bash.patch +- Fedora patches added: + * gdb-6.3-attach-see-vdso-test.patch + * gdb-6.3-inferior-notification-20050721.patch + * gdb-6.5-gcore-buffer-limit-test.patch + * gdb-6.5-missed-trap-on-step-test.patch + * gdb-rhbz1976887-field-location-kind.patch + * gdb-rhbz2012976-paper-over-fortran-lex-problems.patch + * gdb-test-for-rhbz1976887.patch +- Fedora fixup patches added: + * fixup-2-gdb-6.6-buildid-locate.patch + * fixup-gdb-glibc-strstr-workaround.patch + * fixup-gdb-linux_perf-bundle.patch + * fixup-gdb-rhbz1325795-framefilters-test.patch + * fixup-gdb-rhbz1553104-s390x-arch12-test.patch +- Patches added: + * fix-gdb.mi-new-ui-mi-sync.exp.patch + * fix-gdb.threads-linux-dp.exp.patch + * gdb-add-index.sh-fix-bashism.patch + * gdb-build-add-cxx_dialect-to-cxx.patch + * gdb-build-make-c-exp.y-work-with-bison-3.8.patch + * gdb-python-finishbreakpoint-update.patch + * gdb-symtab-add-call_site_eq-and-call_site_hash.patch + * gdb-symtab-c-ify-call_site.patch + * gdb-symtab-fix-htab_find_slot-call-in-read_call_site_scope.patch + * gdb-symtab-remove-compunit_call_site_htab.patch + * gdb-symtab-use-unrelocated-addresses-in-call_site.patch + * gdb-testsuite-add-nopie-in-two-test-cases.patch + * gdb-testsuite-fix-fail-in-gdb.base-annota1.exp.patch + * gdb-testsuite-fix-fail-in-gdb.tui-corefile-run.exp.patch + * gdb-testsuite-fix-gdb.base-dcache-flush.exp.patch + * gdb-testsuite-fix-gdb.gdb-selftest.exp.patch + * gdb-testsuite-fix-gdb.python-py-events.exp.patch + * gdb-testsuite-fix-gdb.server-server-kill.exp-with-m32.patch + * gdb-testsuite-fix-gdb.threads-check-libthread-db.exp-with-glibc-2.34.patch + * gdb-testsuite-handle-supports_memtag-in-gdb.base-gdb-caching-proc.exp.patch + * gdb-testsuite-prevent-compilation-fails-with-unix-fpie-pie.patch + * gdb-testsuite-refactor-regexp-in-gdb.base-annota1.exp.patch + * gdb-testsuite-support-fpie-fno-pie-pie-no-pie-in-gdb_compile_rust.patch + * gdb-testsuite-use-compiler-generated-instead-of-gas-generated-stabs.patch +- Fedora patches replaced: + * fixup-gdb-6.6-buildid-locate.patch +- Added maintenance scripts: + * import-patches.sh + * clean.sh + ------------------------------------------------------------------- Tue Jul 20 13:46:59 UTC 2021 - Andreas Schwab diff --git a/gdb.spec b/gdb.spec index 7d727c2..b46106e 100644 --- a/gdb.spec +++ b/gdb.spec @@ -64,7 +64,7 @@ Group: Development/Languages/C and C++ %endif Name: gdb%{name_suffix} -Version: 10.1 +Version: 11.1 Release: 0 # The release always contains a leading reserved number, start it at 1. @@ -123,7 +123,7 @@ Source4: gdbinit Source5: gdbinit.without-python # libipt: Intel Processor Trace Decoder Library -%global libipt_version 2.0.2 +%global libipt_version 2.0.4 Source7: v%{libipt_version}.tar.gz # Infrastructure to sync patches from the Fedora rpm @@ -131,6 +131,12 @@ Source10: patchlist.pl Source11: patchname_get.sh Source12: baselibs.conf Source13: gdb-rpmlintrc + +# Infrastructure to maintain package. +Source14: clean.sh +Source15: import-patches.sh +Source16: qa.sh + %if %{build_testsuite} NoSource: 0 NoSource: 2 @@ -142,96 +148,86 @@ NoSource: 10 NoSource: 11 NoSource: 12 NoSource: 13 +NoSource: 14 +NoSource: 15 +NoSource: 16 %endif +# Fedora import from branch f35, commit 9cd9368 "Rebase to FSF GDB 11.1." + #Fedora Packages begin -Patch2: gdb-vla-intel-fortran-strides.patch -Patch3: gdb-vla-intel-fortran-vla-strings.patch -Patch4: gdb-vla-intel-stringbt-fix.patch -Patch5: gdb-6.3-gstack-20050411.patch -Patch6: gdb-6.3-test-pie-20050107.patch -Patch7: gdb-6.3-test-self-20050110.patch -Patch8: gdb-6.3-test-dtorfix-20050121.patch -Patch9: gdb-6.3-test-movedir-20050125.patch -Patch10: gdb-6.3-threaded-watchpoints2-20050225.patch -Patch11: gdb-6.3-inheritancetest-20050726.patch -Patch12: gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch -Patch13: gdb-6.5-sharedlibrary-path.patch -Patch15: gdb-6.5-last-address-space-byte-test.patch -Patch16: gdb-6.5-readline-long-line-crash-test.patch -Patch17: gdb-6.5-bz218379-ppc-solib-trampoline-test.patch -Patch18: gdb-6.5-bz218379-solib-trampoline-lookup-lock-fix.patch -Patch19: gdb-6.5-bz109921-DW_AT_decl_file-test.patch -Patch20: gdb-6.3-bz140532-ppc-unwinding-test.patch -Patch21: gdb-6.3-bz202689-exec-from-pthread-test.patch -Patch22: gdb-6.6-bz230000-power6-disassembly-test.patch -Patch23: gdb-6.6-bz229517-gcore-without-terminal.patch -Patch24: gdb-6.6-testsuite-timeouts.patch -Patch25: gdb-6.6-bz237572-ppc-atomic-sequence-test.patch -Patch26: gdb-6.5-bz243845-stale-testing-zombie-test.patch -Patch27: gdb-6.6-buildid-locate.patch -Patch28: gdb-6.6-buildid-locate-solib-missing-ids.patch -Patch29: gdb-6.6-buildid-locate-rpm.patch -Patch31: gdb-6.7-ppc-clobbered-registers-O2-test.patch -Patch32: gdb-6.7-testsuite-stable-results.patch -Patch33: gdb-6.5-ia64-libunwind-leak-test.patch -Patch34: gdb-6.3-mapping-zero-inode-test.patch -Patch35: gdb-6.3-focus-cmd-prev-test.patch -Patch36: gdb-6.8-bz442765-threaded-exec-test.patch -Patch37: gdb-6.5-section-num-fixup-test.patch -Patch39: gdb-simultaneous-step-resume-breakpoint-test.patch -Patch40: gdb-core-open-vdso-warning.patch -Patch42: gdb-ccache-workaround.patch -Patch43: gdb-archer-pie-addons.patch -Patch44: gdb-archer-pie-addons-keep-disabled.patch -Patch45: gdb-lineno-makeup-test.patch -Patch46: gdb-ppc-power7-test.patch -Patch47: gdb-moribund-utrace-workaround.patch -Patch48: gdb-archer-next-over-throw-cxx-exec.patch -Patch49: gdb-bz601887-dwarf4-rh-test.patch -Patch50: gdb-6.6-buildid-locate-core-as-arg.patch -Patch51: gdb-6.6-buildid-locate-rpm-librpm-workaround.patch -Patch52: gdb-test-bt-cfi-without-die.patch -Patch53: gdb-bz634108-solib_address.patch -Patch54: gdb-test-pid0-core.patch -Patch55: gdb-test-dw2-aranges.patch -Patch56: gdb-test-expr-cumulative-archer.patch -Patch57: gdb-physname-pr11734-test.patch -Patch58: gdb-physname-pr12273-test.patch -Patch59: gdb-test-ivy-bridge.patch -Patch60: gdb-runtest-pie-override.patch -Patch61: gdb-attach-fail-reasons-5of5.patch -Patch62: gdb-glibc-strstr-workaround.patch -Patch63: gdb-rhel5.9-testcase-xlf-var-inside-mod.patch -Patch64: gdb-rhbz-818343-set-solib-absolute-prefix-testcase.patch -Patch65: gdb-rhbz947564-findvar-assertion-frame-failed-testcase.patch -Patch66: gdb-gnat-dwarf-crash-3of3.patch -Patch67: gdb-rhbz1007614-memleak-infpy_read_memory-test.patch -Patch69: gdb-archer-vla-tests.patch -Patch70: gdb-vla-intel-tests.patch -Patch71: gdb-btrobust.patch -Patch72: gdb-fortran-frame-string.patch -Patch73: gdb-rhbz1156192-recursive-dlopen-test.patch -Patch74: gdb-jit-reader-multilib.patch -Patch75: gdb-rhbz1149205-catch-syscall-after-fork-test.patch -Patch76: gdb-rhbz1186476-internal-error-unqualified-name-re-set-test.patch -Patch77: gdb-rhbz1350436-type-printers-error.patch -Patch78: gdb-rhbz1084404-ppc64-s390x-wrong-prologue-skip-O2-g-3of3.patch -Patch79: gdb-bz1219747-attach-kills.patch -Patch80: gdb-fedora-libncursesw.patch -Patch81: gdb-opcodes-clflushopt-test.patch -Patch82: gdb-dts-rhel6-python-compat.patch -Patch83: gdb-6.6-buildid-locate-rpm-scl.patch -Patch84: gdb-6.8-quit-never-aborts.patch -Patch85: gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch -Patch86: gdb-container-rh-pkg.patch -Patch87: gdb-rhbz1325795-framefilters-test.patch -Patch88: gdb-linux_perf-bundle.patch -Patch90: gdb-rhbz1398387-tab-crash-test.patch -Patch91: gdb-archer.patch -Patch92: gdb-vla-intel-fix-print-char-array.patch -Patch93: gdb-rhbz1553104-s390x-arch12-test.patch -Patch94: gdb-config.patch +Patch2: gdb-6.3-gstack-20050411.patch +Patch3: gdb-6.3-test-dtorfix-20050121.patch +Patch4: gdb-6.3-test-movedir-20050125.patch +Patch5: gdb-6.3-threaded-watchpoints2-20050225.patch +Patch6: gdb-6.3-inferior-notification-20050721.patch +Patch7: gdb-6.3-inheritancetest-20050726.patch +Patch8: gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch +Patch9: gdb-6.5-sharedlibrary-path.patch +Patch11: gdb-6.5-last-address-space-byte-test.patch +Patch12: gdb-6.5-readline-long-line-crash-test.patch +Patch13: gdb-6.5-bz218379-ppc-solib-trampoline-test.patch +Patch14: gdb-6.5-bz109921-DW_AT_decl_file-test.patch +Patch15: gdb-6.3-bz140532-ppc-unwinding-test.patch +Patch16: gdb-6.3-bz202689-exec-from-pthread-test.patch +Patch17: gdb-6.6-bz230000-power6-disassembly-test.patch +Patch18: gdb-6.6-bz229517-gcore-without-terminal.patch +Patch19: gdb-6.6-testsuite-timeouts.patch +Patch20: gdb-6.6-bz237572-ppc-atomic-sequence-test.patch +Patch21: gdb-6.3-attach-see-vdso-test.patch +Patch22: gdb-6.5-bz243845-stale-testing-zombie-test.patch +Patch23: gdb-6.6-buildid-locate.patch +Patch24: gdb-6.6-buildid-locate-solib-missing-ids.patch +Patch25: gdb-6.6-buildid-locate-rpm.patch +Patch27: gdb-6.7-ppc-clobbered-registers-O2-test.patch +Patch28: gdb-6.7-testsuite-stable-results.patch +Patch29: gdb-6.5-ia64-libunwind-leak-test.patch +Patch30: gdb-6.5-missed-trap-on-step-test.patch +Patch31: gdb-6.5-gcore-buffer-limit-test.patch +Patch32: gdb-6.3-mapping-zero-inode-test.patch +Patch33: gdb-6.3-focus-cmd-prev-test.patch +Patch34: gdb-6.8-bz442765-threaded-exec-test.patch +Patch35: gdb-6.5-section-num-fixup-test.patch +Patch37: gdb-simultaneous-step-resume-breakpoint-test.patch +Patch38: gdb-core-open-vdso-warning.patch +Patch39: gdb-ccache-workaround.patch +Patch40: gdb-lineno-makeup-test.patch +Patch41: gdb-ppc-power7-test.patch +Patch42: gdb-archer-next-over-throw-cxx-exec.patch +Patch43: gdb-bz601887-dwarf4-rh-test.patch +Patch44: gdb-6.6-buildid-locate-rpm-librpm-workaround.patch +Patch45: gdb-test-bt-cfi-without-die.patch +Patch46: gdb-bz634108-solib_address.patch +Patch47: gdb-test-pid0-core.patch +Patch48: gdb-test-dw2-aranges.patch +Patch49: gdb-test-expr-cumulative-archer.patch +Patch50: gdb-physname-pr11734-test.patch +Patch51: gdb-physname-pr12273-test.patch +Patch52: gdb-test-ivy-bridge.patch +Patch53: gdb-runtest-pie-override.patch +Patch54: gdb-glibc-strstr-workaround.patch +Patch55: gdb-rhel5.9-testcase-xlf-var-inside-mod.patch +Patch56: gdb-rhbz-818343-set-solib-absolute-prefix-testcase.patch +Patch57: gdb-rhbz947564-findvar-assertion-frame-failed-testcase.patch +Patch58: gdb-rhbz1007614-memleak-infpy_read_memory-test.patch +Patch60: gdb-fortran-frame-string.patch +Patch61: gdb-rhbz1156192-recursive-dlopen-test.patch +Patch62: gdb-rhbz1149205-catch-syscall-after-fork-test.patch +Patch63: gdb-rhbz1186476-internal-error-unqualified-name-re-set-test.patch +Patch64: gdb-rhbz1350436-type-printers-error.patch +Patch65: gdb-rhbz1084404-ppc64-s390x-wrong-prologue-skip-O2-g-3of3.patch +Patch66: gdb-fedora-libncursesw.patch +Patch67: gdb-opcodes-clflushopt-test.patch +Patch68: gdb-6.6-buildid-locate-rpm-scl.patch +Patch69: gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch +Patch70: gdb-container-rh-pkg.patch +Patch71: gdb-rhbz1325795-framefilters-test.patch +Patch72: gdb-linux_perf-bundle.patch +Patch74: gdb-rhbz1398387-tab-crash-test.patch +Patch75: gdb-rhbz1553104-s390x-arch12-test.patch +Patch76: gdb-rhbz1976887-field-location-kind.patch +Patch77: gdb-test-for-rhbz1976887.patch +Patch78: gdb-rhbz2012976-paper-over-fortran-lex-problems.patch #Fedora Packages end # Fedora Packages not copied: @@ -243,8 +239,6 @@ Patch94: gdb-config.patch # - gdb-6.8-bz466901-backtrace-full-prelinked.patch # # Broken: -# - gdb-bz533176-fortran-omp-step.patch -# reported at https://sourceware.org/bugzilla/show_bug.cgi?id=26851 # - gdb-6.5-BEA-testsuite.patch # over-specific test-case in a shell script # @@ -253,85 +247,113 @@ Patch94: gdb-config.patch # Fedora patches fixup -Patch501: fixup-2-gdb-archer-vla-tests.patch -Patch502: fixup-gdb-6.5-sharedlibrary-path.patch -Patch503: fixup-gdb-6.6-buildid-locate.patch -Patch504: fixup-gdb-dts-rhel6-python-compat.patch -Patch505: fixup-gdb-base-gnu-ifunc-strstr-workaround-exp.patch -Patch506: fixup-gdb-vla-intel-fortran-vla-strings.patch -Patch507: fixup-gdb-archer-vla-tests.patch -Patch508: fixup-gdb-6.3-test-pie-20050107.patch -Patch509: fixup-gdb-btrobust.patch -Patch510: fixup-gdb-bz634108-solib_address.patch -Patch511: fixup-gdb-gnat-dwarf-crash-3of3.patch -Patch512: fixup-gdb-6.8-bz442765-threaded-exec-test.patch -Patch513: fixup-gdb-vla-intel-tests.patch -Patch514: fixup-gdb-6.3-threaded-watchpoints2-20050225.patch -Patch515: fixup-3-gdb-archer-vla-tests.patch -Patch516: fixup-gdb-rhbz1156192-recursive-dlopen-test.patch -Patch517: fixup-2-gdb-rhbz1156192-recursive-dlopen-test.patch -Patch518: fixup-gdb-test-ivy-bridge.patch +Patch500: fixup-gdb-linux_perf-bundle.patch +Patch501: fixup-gdb-6.6-buildid-locate.patch +Patch502: fixup-2-gdb-6.6-buildid-locate.patch +Patch503: fixup-gdb-rhbz1325795-framefilters-test.patch +Patch504: fixup-gdb-rhbz1553104-s390x-arch12-test.patch +Patch505: fixup-gdb-glibc-strstr-workaround.patch # openSUSE specific +# Hardcodes /bin/bash, given that path is known. Patch1000: gdb-gcore-bash.patch -Patch1002: gdb-6.6-buildid-locate-rpm-suse.patch -Patch1003: gdb-testsuite-ada-pie.patch +# Make gdb emit zypper install hints, rather than debuginfo-install hints. +Patch1001: gdb-6.6-buildid-locate-rpm-suse.patch + +# openSUSE specific -- testsuite + +# Silences ada pie compilation FAILs. Todo: Fix ada pie compilation. +Patch1100: gdb-testsuite-ada-pie.patch +# Strictly speaking, not a testsuite patch, but purpose is to enable gdb.gdb +# testcases. +Patch1101: gdb-fix-selftest-fails-with-gdb-build-with-O2-flto.patch +# The test-case expects init or systemd as process, but we run into a case +# where it's bash instead. This doesn't look harmful, so allow it. +# It would be nice to upstream this, but in order to do that I'd like to have +# an explanation of why this happens, so for now, park this here. +Patch1102: gdb-testsuite-fix-gdb-server-ext-run-exp-for-obs.patch # Patches to upstream -Patch1500: gdb-fix-selftest-fails-with-gdb-build-with-O2-flto.patch -Patch1501: gdb-fortran-fix-print-dynamic-array.patch -Patch1502: gdb-don-t-return-non-existing-path-in-debuginfod-source-query.patch -Patch1504: gdb-fix-filename-in-not-in-executable-format-error.patch -Patch1505: gdb-handle-no-upper-bound-in-value-subscript.patch -Patch1506: gdb-fortran-handle-dw-at-string-length-with-loclistptr.patch -Patch1507: gdb-symtab-set-default-dwarf-max-cache-age-1000.patch -Patch1508: gdb-testsuite-gdb-base-morestack-exp-no-clang.patch -Patch1509: gdb-testsuite-handle-sigill-in-gdb-reverse-insn-reverse-exp.patch -Patch1510: gdb-testsuite-fix-gdb-reverse-insn-reverse-x86-c-for-m32.patch -Patch1511: gdb-testsuite-gdb-tui-new-layout-exp-partly-require-tcl86.patch -Patch1512: gdb-tui-enable-work-around-libncurses-segfault.patch -Patch1513: gdb-testsuite-fix-control-flow-in-gdb-reverse-insn-reverse-exp.patch -Patch1514: gdb-fix-use-of-invalid-pointer-in-remote-async-inferior-event-handler.patch -Patch1515: gdb-try-to-load-libthread_db-only-after-reading-all-shared-libraries-when-attaching.patch +# https://sourceware.org/bugzilla/show_bug.cgi?id=25703 +Patch1500: gdb-symtab-set-default-dwarf-max-cache-age-1000.patch +# https://bugzilla.suse.com/show_bug.cgi?id=1179210 +Patch1501: gdb-tui-enable-work-around-libncurses-segfault.patch +# Fixes: gdb.x86_64: W: potential-bashisms /usr/bin/gdb-add-index +Patch1503: gdb-add-index.sh-fix-bashism.patch +# Fixes: +# FAIL: gdb.mi/new-ui-mi-sync.exp: sync-command=run: add-inferior (timeout) +Patch1504: fix-gdb.mi-new-ui-mi-sync.exp.patch +# Fixes: +# FAIL: gdb.base/step-over-syscall.exp: fork: displaced=off: \ +# pc after stepi matches insn addr after syscall +Patch1505: gdb-testsuite-fix-gdb.base-step-over-syscall.exp-with-m32-amd-case.patch +# Fixes: +# FAIL: gdb.threads/detach-step-over.exp: \ +# breakpoint-condition-evaluation=host: target-non-stop=off: non-stop=off: \ +# displaced=off: iter 1: all threads running +Patch1506: gdb-testsuite-fix-race-in-gdb.threads-detach-step-over.exp.patch -# Backports from master +# Backports from release branch -Patch2000: gdb-testsuite-prevent-pagination-in-gdb-internalflags.patch -Patch2002: gdb-testsuite-catch-condition-evaluation-errors-in-gdb-assert.patch -Patch2003: gdb-testsuite-detect-gdb-prompt-after-monitor-exit.patch -Patch2004: gdb-testsuite-fix-gdb-dlang-watch-loc-exp-on-ppc64.patch -Patch2005: gdb-symtab-read-cu-base-address-for-enqueued-cu.patch -Patch2006: gdb-symtab-use-early-continue-in-find_pc_sect_compunit.patch -Patch2007: gdb-fix-section-matching-in-find_pc_sect_compunit.patch -Patch2008: gdb-symtab-fix-language-of-frame-without-debug-info.patch -Patch2009: gdb-testsuite-fix-failure-in-gdb-base-step-over-no-symbols-exp.patch -Patch2010: gdb-powerpc-remove-512-bytes-region-limit-if-2nd-dawr-is-avaliable.patch -Patch2011: gdb-fix-internal-error-in-process_event_stop_test.patch -Patch2012: gdb-breakpoints-handle-glibc-with-debuginfo-in-create_exception_master_breakpoint.patch -Patch2013: gdb-testsuite-fix-gdb.arch-amd64-stap-three-arg-disp.s.patch -Patch2014: gdb-testsuite-fix-xfail-handling-in-gdb.threads-gcore-thread.exp.patch -Patch2015: gdb-threads-fix-lin_thread_get_thread_signals-for-glibc-2.28.patch -Patch2016: gdb-testsuite-ignore-debuginfod_urls.patch -Patch2017: gdb-testsuite-fix-unset-of-debuginfod_urls-in-default_gdb_init.patch -Patch2018: gdb-tui-fix-len_without_escapes-in-tui-disasm.c.patch -Patch2019: gdb-build-hardcode-with-included-regex.patch -Patch2020: gdb-breakpoint-fix-assert-in-jit_event_handler.patch -Patch2021: gdb-save-restore-file-offset-while-reading-notes-in-core-file.patch -Patch2022: gdb-symtab-fix-infinite-recursion-in-dwarf2_cu-get_builder-again.patch -Patch2023: gdb-support-dw-lle-start-end.patch -Patch2024: amd64-linux-siginfo-include-order.patch +Patch1900: gdb-build-add-cxx_dialect-to-cxx.patch +Patch1901: gdb-tui-fix-breakpoint-display-functionality.patch -# Testsuite patches +# Backports from master, available in next release. -Patch2500: gdb-testsuite-fix-gdb-server-ext-run-exp-for-obs.patch -%if 0%{?suse_version} > 1500 -Patch2501: gdb-testsuite-disable-selftests-for-factory.patch -%endif +Patch2000: gdb-testsuite-fix-gdb.gdb-selftest.exp.patch +Patch2001: gdb-testsuite-refactor-regexp-in-gdb.base-annota1.exp.patch +Patch2002: gdb-testsuite-fix-fail-in-gdb.base-annota1.exp.patch +Patch2003: gdb-testsuite-fix-gdb.base-dcache-flush.exp.patch +Patch2004: gdb-testsuite-fix-fail-in-gdb.tui-corefile-run.exp.patch +Patch2005: gdb-testsuite-fix-gdb.threads-check-libthread-db.exp-with-glibc-2.34.patch +Patch2006: gdb-testsuite-fix-gdb.python-py-events.exp.patch +Patch2007: gdb-testsuite-handle-supports_memtag-in-gdb.base-gdb-caching-proc.exp.patch +Patch2008: gdb-symtab-fix-htab_find_slot-call-in-read_call_site_scope.patch +Patch2009: gdb-symtab-remove-compunit_call_site_htab.patch +Patch2010: gdb-symtab-add-call_site_eq-and-call_site_hash.patch +Patch2011: gdb-symtab-c-ify-call_site.patch +Patch2012: gdb-symtab-use-unrelocated-addresses-in-call_site.patch +Patch2013: gdb-testsuite-add-nopie-in-two-test-cases.patch +Patch2014: gdb-testsuite-use-compiler-generated-instead-of-gas-generated-stabs.patch +Patch2015: gdb-testsuite-support-fpie-fno-pie-pie-no-pie-in-gdb_compile_rust.patch +Patch2016: gdb-testsuite-fix-gdb.server-server-kill.exp-with-m32.patch +Patch2017: gdb-testsuite-fix-gdb.ada-big_packed_array.exp-xfail-for-m32.patch +Patch2018: fix-gdb.multi-multi-term-settings.exp-race.patch +Patch2019: gdb-testsuite-update-test-gdb.base-step-over-syscall.exp.patch +Patch2020: gdb-testsuite-fix-gdb.threads-linux-dp.exp.patch +Patch2021: gdb-testsuite-add-gdb.testsuite-dump-system-info.exp.patch +Patch2022: gdb-testsuite-factor-out-dump_info-in-gdb.testsuite-dump-system-info.exp.patch -# libipt support -Patch3000: v1.5-libipt-static.patch +# Backports from master, not yet available in next release. + +# + +# Backport from gdb-patches + +# https://sourceware.org/pipermail/gdb-patches/2021-October/182474.html +Patch2100: gdb-build-make-c-exp.y-work-with-bison-3.8.patch +# https://sourceware.org/pipermail/gdb-patches/2021-September/182226.html +Patch2101: gdb-python-finishbreakpoint-update.patch +# https://sourceware.org/pipermail/gdb-patches/2021-October/182444.html +Patch2102: gdb-testsuite-prevent-compilation-fails-with-unix-fpie-pie.patch +# https://sourceware.org/pipermail/gdb-patches/2021-October/182572.html +Patch2103: gdb-fortran-handle-dw-at-string-length-with-loclistptr.patch +# https://sourceware.org/pipermail/gdb-patches/2021-August/181576.html +Patch2104: gdb-testsuite-handle-recursive-internal-problem-in-gdb_internal_error_resync.patch +# https://sourceware.org/pipermail/gdb-patches/2021-October/182800.html +Patch2105: gdb-testsuite-handle-runto-fail-in-gdb.mi-mi-var-cp.exp.patch +# https://sourceware.org/pipermail/gdb-patches/2021-October/182847.html +Patch2106: gdb-testsuite-fix-fail-in-gdb.threads-fork-and-threads.exp.patch +# https://sourceware.org/pipermail/gdb-patches/2021-October/182846.html +Patch2107: gdb-testsuite-add-kfail-in-gdb.threads-fork-plus-threads.exp.patch +# https://sourceware.org/pipermail/gdb-patches/2021-October/182855.html +Patch2108: gdb-testsuite-fix-port-detection-in-gdb.debuginfod-fetch_src_and_symbols.exp.patch +# https://sourceware.org/pipermail/gdb-patches/2021-October/182857.html +Patch2109: gdb-testsuite-add-checks-to-gdb.arch-i386-sse.exp.patch +# https://sourceware.org/pipermail/gdb-patches/2021-October/182868.html +Patch2110: gdb-testsuite-Fix-gdb.threads-thread-specific-bp.exp.patch BuildRequires: bison BuildRequires: flex @@ -396,6 +418,9 @@ BuildRequires: cmake ExclusiveArch: noarch i386 x86_64 ppc ppc64 ia64 s390 s390x %endif # 0%{?el5:1} +# Disable big-endian ppc. +ExcludeArch: ppc ppc64 + %ifarch s390x %if %{suse_version} > 1500 BuildRequires: babeltrace-devel @@ -459,32 +484,32 @@ BuildRequires: %{gcc}-objc BuildRequires: %{gcc}-ada %endif -%if 0%{?is_opensuse} -# openSUSE for s390x doesn't build 32bit libs %define supported_32bit_arch x86_64 ppc64 -%else -%define supported_32bit_arch x86_64 ppc64 s390x -%endif %if 0%{!?disable_32bit:1} -%if 0%{suse_version} > 1110 %ifarch %{supported_32bit_arch} + %if 0%{suse_version} >= 1330 # Older distros miss this pseudo package, the Ada # testsuite won't work completely BuildRequires: %{gcc}-ada-32bit %endif + +%if 0%{suse_version} > 1110 BuildRequires: %{gcc}-c++-32bit +%endif + %if 0%{suse_version} >= 1210 && 0%{suse_version} != 1315 -# glibc-devel-static-32bit is (currently?) unavailable for Leap 15.3/s390x. BuildRequires: glibc-devel-static-32bit %endif -%endif -%endif -%endif + +%endif # supported_32bit_arch +%endif # !disable_32bit + %if 0%{suse_version} >= 1210 BuildRequires: glibc-devel-static %endif + %if 0%{?suse_version} > 1500 # The gccgo command is used by make check for some gdb.go test-cases, so we # need the gcc-go package. However, the gccgo command was missing from the @@ -616,10 +641,10 @@ find -name "*.info*"|xargs rm -f %patch7 -p1 %patch8 -p1 %patch9 -p1 -%patch10 -p1 %patch11 -p1 %patch12 -p1 %patch13 -p1 +%patch14 -p1 %patch15 -p1 %patch16 -p1 %patch17 -p1 @@ -631,19 +656,20 @@ find -name "*.info*"|xargs rm -f %patch23 -p1 %patch24 -p1 %patch25 -p1 -%patch26 -p1 %patch27 -p1 %patch28 -p1 %patch29 -p1 +%patch30 -p1 %patch31 -p1 %patch32 -p1 %patch33 -p1 %patch34 -p1 %patch35 -p1 -%patch36 -p1 %patch37 -p1 +%patch38 -p1 %patch39 -p1 %patch40 -p1 +%patch41 -p1 %patch42 -p1 %patch43 -p1 %patch44 -p1 @@ -661,7 +687,6 @@ find -name "*.info*"|xargs rm -f %patch56 -p1 %patch57 -p1 %patch58 -p1 -%patch59 -p1 %patch60 -p1 %patch61 -p1 %patch62 -p1 @@ -670,73 +695,44 @@ find -name "*.info*"|xargs rm -f %patch65 -p1 %patch66 -p1 %patch67 -p1 +%patch68 -p1 %patch69 -p1 %patch70 -p1 %patch71 -p1 %patch72 -p1 -%patch73 -p1 %patch74 -p1 %patch75 -p1 %patch76 -p1 %patch77 -p1 %patch78 -p1 -%patch79 -p1 -%patch80 -p1 -%patch81 -p1 -%patch82 -p1 -%patch83 -p1 -%patch84 -p1 -%patch85 -p1 -%patch86 -p1 -%patch87 -p1 -%patch88 -p1 -%patch90 -p1 -%patch91 -p1 -%patch92 -p1 -%patch93 -p1 -%patch94 -p1 #Fedora patching end +%patch500 -p1 %patch501 -p1 %patch502 -p1 %patch503 -p1 %patch504 -p1 %patch505 -p1 -%patch506 -p1 -%patch507 -p1 -%patch508 -p1 -%patch509 -p1 -%patch510 -p1 -%patch511 -p1 -%patch512 -p1 -%patch513 -p1 -%patch514 -p1 -%patch515 -p1 -%patch516 -p1 -%patch517 -p1 -%patch518 -p1 %patch1000 -p1 -%patch1002 -p1 -%patch1003 -p1 +%patch1001 -p1 + +%patch1100 -p1 +%patch1101 -p1 +%patch1102 -p1 %patch1500 -p1 %patch1501 -p1 -%patch1502 -p1 +%patch1503 -p1 %patch1504 -p1 %patch1505 -p1 %patch1506 -p1 -%patch1507 -p1 -%patch1508 -p1 -%patch1509 -p1 -%patch1510 -p1 -%patch1511 -p1 -%patch1512 -p1 -%patch1513 -p1 -%patch1514 -p1 -%patch1515 -p1 + +%patch1900 -p1 +%patch1901 -p1 %patch2000 -p1 +%patch2001 -p1 %patch2002 -p1 %patch2003 -p1 %patch2004 -p1 @@ -758,21 +754,23 @@ find -name "*.info*"|xargs rm -f %patch2020 -p1 %patch2021 -p1 %patch2022 -p1 -%patch2023 -p1 -%patch2024 -p1 -%patch2500 -p1 -%if 0%{?suse_version} > 1500 -%patch2501 -p1 -%endif +%patch2100 -p1 +%patch2101 -p1 +%patch2102 -p1 +%patch2103 -p1 +%patch2104 -p1 +%patch2105 -p1 +%patch2106 -p1 +%patch2107 -p1 +%patch2108 -p1 +%patch2109 -p1 +%patch2110 -p1 #unpack libipt %if 0%{have_libipt} tar xzf %{SOURCE7} -( - cd processor-trace-%{libipt_version} -%patch3000 -p1 -) +mv libipt-%{libipt_version} processor-trace-%{libipt_version} %endif find -name "*.orig" | xargs rm -f @@ -786,6 +784,12 @@ rm -f bfd/doc/*.info-* rm -f gdb/doc/*.info rm -f gdb/doc/*.info-* +# Fixes problem building release tarball with --with-system-readline. +# Reported here: +# - https://sourceware.org/pipermail/gdb/2021-July/049552.html +# - https://sourceware.org/bugzilla/show_bug.cgi?id=27808 +rm -f gdb/doc/GDBvn.texi + %build # Identify the build directory with the version of gdb as well as the @@ -912,7 +916,7 @@ $(: ppc64 host build crashes on ppc variant of libexpat.so ) \ --without-rpm \ %endif %ifarch ia64 - --with-libunwind \ + --with-libunwind-ia64 \ %else --without-libunwind \ %endif @@ -1142,11 +1146,14 @@ $CC -o ./orphanripper %{SOURCE2} -Wall -lutil -ggdb2 # Disable some problematic testcases. # RUNTESTFLAGS='--ignore ...' is not used below as it gets separated by the # `check//...' target spawn and too much escaping there would be dense. - for test in \ - gdb.base/readline-overflow.exp \ - gdb.base/bigcore.exp \ - gdb.threads/attach-many-short-lived-threads.exp \ - ; do + DISABLE_TESTS= + DISABLE_TESTS="$DISABLE_TESTS gdb.base/readline-overflow.exp" + DISABLE_TESTS="$DISABLE_TESTS gdb.base/bigcore.exp" + DISABLE_TESTS="$DISABLE_TESTS gdb.threads/attach-many-short-lived-threads.exp" + %if 0%{suse_version} == 1110 + DISABLE_TESTS="$DISABLE_TESTS gdb.base/break-interp.exp" + %endif + for test in $DISABLE_TESTS; do mv -f ../../gdb/testsuite/$test ../../gdb/testsuite/$test-DISABLED || : done @@ -1249,7 +1256,7 @@ rm -f $RPM_BUILD_ROOT%{_infodir}/bfd* rm -f $RPM_BUILD_ROOT%{_infodir}/standard* rm -f $RPM_BUILD_ROOT%{_infodir}/configure* rm -rf $RPM_BUILD_ROOT%{_includedir} -rm -rf $RPM_BUILD_ROOT/%{_libdir}/lib{bfd*,opcodes*,iberty*} +rm -rf $RPM_BUILD_ROOT/%{_libdir}/lib{bfd*,opcodes*,iberty*,ctf*} %if %{build_testsuite} rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/gdbinit diff --git a/import-patches.sh b/import-patches.sh new file mode 100644 index 0000000..e275854 --- /dev/null +++ b/import-patches.sh @@ -0,0 +1,70 @@ +#!/bin/sh + +# Invoke as: +# $ ./import-patches.sh [ --dry-run ] /00*.patch + +dryrun=false +case "$1" in + -dryrun|-dry-run|--dryrun|--dry-run) + dryrun=true + shift + ;; +esac + +n="$1" +shift + +files="$*" + +rm -Rf tmp.patches +mkdir tmp.patches + +tmp= +for f in $files; do + dir=$(dirname "$f") + f=$(basename "$f") + orig_f="$f" + + # Remove numeric prefix. + f=$(echo "$f" \ + | sed 's/^[0-9]*-//') + + # To lowercase. + f=$(echo "$f" \ + | tr '[:upper:]' '[:lower:]') + + # Fix patch.patch. + f=$(echo "$f" \ + | sed 's/\.patch\.patch/.patch/') + + # Copy. + cp "$dir"/"$orig_f" tmp.patches/"$f" + + tmp="$tmp $f" +done +files="$tmp" + +i=$n +for f in $files; do + printf "Patch%-11s%s\n" "$i:" "$f" + + i=$((i + 1)) +done + +i=$n +for f in $files; do + echo "%patch$i -p1" + + i=$((i + 1)) +done + +if $dryrun; then + exit +fi + +for f in $files; do + mv tmp.patches/"$f" . + osc add "$f" +done + +rmdir tmp.patches diff --git a/qa.sh b/qa.sh new file mode 100644 index 0000000..b288a29 --- /dev/null +++ b/qa.sh @@ -0,0 +1,256 @@ +#!/bin/bash + +if [ $# -eq 0 ]; then + echo "usage: $0 <1-5> [dir]" + echo "Verify remote results at:" + echo " ./binaries-testsuite.distro.arch/gdb-testresults" + echo "1: gdb.sum: Check for 'FAIL: .* internal error' (all configs)" + echo "2: gdb.sum: Check for 'ERROR:' (all configs)" + echo "3: gdb.log: Check for 'internal-error:' (all configs)" + echo "4: gdb.sum: Check FAIL and ERROR (known clean configs)" + echo "Verify local results at:" + echo " \$dir" + echo "5: gdb.sum: Check FAIL and ERROR" + exit 1 +fi + +n="$1" +shift + +if [ "$n" -eq 5 ]; then + dir="$1" + shift +fi + +echo_line () +{ + for n in "$@"; do + echo "$n" + done +} + +join () +{ + local char + char="$1" + shift + + local res + res="" + + local first + first=true + for elem in "$@"; do + if $first; then + first=false + else + res+="$char" + fi + res+="$elem" + done + echo "$res" +} + +report_sum () +{ + local sum + sum="$1" + + echo + echo "$sum:" + + if [ ! -f "$sum" ]; then + echo "MISSING" + return + fi + + kfail_re=$(join "|" "${kfail[@]}") + echo FAILs: + grep ^FAIL: "$sum" \ + | grep -E -v "$kfail_re" + echo ERROR COUNT: + grep -c ^ERROR: "$sum" +} + +kfail=( + # https://sourceware.org/bugzilla/show_bug.cgi?id=26971 + "FAIL: gdb.arch/amd64-init-x87-values.exp: check_x87_regs_around_init: check post FLD1 value of .fop" + "FAIL: gdb.arch/amd64-init-x87-values.exp: check_x87_regs_around_init: check post FLD1 value of .fioff" + # https://sourceware.org/bugzilla/show_bug.cgi?id=24845 + "FAIL: gdb.base/step-over-syscall.exp: clone: displaced=off: single step over clone" + # https://sourceware.org/bugzilla/show_bug.cgi?id=19436#c1 + "FAIL: gdb.cp/no-dmgl-verbose.exp: setting breakpoint at 'f\(std::string\)'" + # https://sourceware.org/bugzilla/show_bug.cgi?id=25504 + "FAIL: gdb.threads/process-dies-while-detaching.exp: single-process: continue: .*: continue" + # https://sourceware.org/bugzilla/show_bug.cgi?id=28065 + "FAIL: gdb.threads/access-mem-running-thread-exit.exp:" + # https://sourceware.org/bugzilla/show_bug.cgi?id=27813 + "FAIL: gdb.cp/cpcompletion.exp:" + # https://sourceware.org/bugzilla/show_bug.cgi?id=25503 + "FAIL: gdb.threads/signal-while-stepping-over-bp-other-thread.exp: step \(pattern 3\)" + # https://sourceware.org/bugzilla/show_bug.cgi?id=26915 + "FAIL: gdb.threads/schedlock.exp: schedlock=off: cmd=next: call_function=0: other threads ran - unlocked" + # https://sourceware.org/bugzilla/show_bug.cgi?id=28479 + "FAIL: gdb.mi/mi-nonstop.exp: wait for thread exit \(timeout\)" + + # https://sourceware.org/bugzilla/show_bug.cgi?id=26284 + # https://sourceware.org/bugzilla/show_bug.cgi?id=28275 + # https://sourceware.org/bugzilla/show_bug.cgi?id=28343 + "FAIL: gdb.threads/detach-step-over.exp: .*internal error" + # https://sourceware.org/bugzilla/show_bug.cgi?id=26363 + "FAIL: gdb.xml/tdesc-reload.exp: .*internal error" + # https://sourceware.org/bugzilla/show_bug.cgi?id=26761 + "FAIL: gdb.base/gdb-sigterm.exp: .*internal error" +) + +kfail_factory=( + # https://sourceware.org/bugzilla/show_bug.cgi?id=27027 + # https://sourceware.org/bugzilla/show_bug.cgi?id=28464 + "FAIL: gdb.ada/mi_var_access.exp: Create varobj \(unexpected output\)" + # https://sourceware.org/bugzilla/show_bug.cgi?id=28463 + "FAIL: gdb.ada/set_pckd_arr_elt.exp: scenario=minimal: print va.t\(1\) := 15" + "FAIL: gdb.ada/set_pckd_arr_elt.exp: scenario=minimal: continue to update_small for va.t" + # https://sourceware.org/bugzilla/show_bug.cgi?id=28108 + "FAIL: gdb.base/langs.exp: up to foo in langs.exp" + "FAIL: gdb.base/langs.exp: up to cppsub_ in langs.exp" + "FAIL: gdb.base/langs.exp: up to fsub in langs.exp" + # https://sourceware.org/bugzilla/show_bug.cgi?id=27539 + "FAIL: gdb.cp/typeid.exp: before starting: print &typeid\(i\)" + "FAIL: gdb.cp/typeid.exp: before starting: print &typeid\(i\) == &typeid\(typeof\(i\)\)" + "FAIL: gdb.cp/typeid.exp: before starting: print &typeid\(cp\)" + "FAIL: gdb.cp/typeid.exp: before starting: print &typeid\(cp\) == &typeid\(typeof\(cp\)\)" + "FAIL: gdb.cp/typeid.exp: before starting: print &typeid\(ccp\)" + "FAIL: gdb.cp/typeid.exp: before starting: print &typeid\(ccp\) == &typeid\(typeof\(ccp\)\)" + # https://sourceware.org/bugzilla/show_bug.cgi?id=28461 + "FAIL: gdb.reverse/fstatat-reverse.exp: continue to breakpoint: marker2" + # https://sourceware.org/pipermail/gdb-patches/2021-October/182449.html + "FAIL: gdb.threads/current-lwp-dead.exp: continue to breakpoint: fn_return" + # Similar error message to the one above, see if fixing that one fixes this. + "FAIL: gdb.threads/clone-new-thread-event.exp: catch SIGUSR1" + # https://sourceware.org/bugzilla/show_bug.cgi?id=27238 + "FAIL: gdb.go/package.exp: setting breakpoint at package2.Foo" + "FAIL: gdb.go/package.exp: going to first breakpoint \(the program exited\)" + # https://sourceware.org/bugzilla/show_bug.cgi?id=28468 + "FAIL: gdb.threads/signal-command-handle-nopass.exp: step-over (yes|no): signal SIGUSR1" + # https://sourceware.org/bugzilla/show_bug.cgi?id=28477 + "FAIL: gdb.base/step-over-syscall.exp: clone: displaced=off: continue to marker \(clone\)" + # https://sourceware.org/bugzilla/show_bug.cgi?id=28478 + "FAIL: gdb.gdb/selftest.exp: backtrace through signal handler" + # https://sourceware.org/bugzilla/show_bug.cgi?id=26867 + "FAIL: gdb.threads/signal-sigtrap.exp: sigtrap thread 1: signal SIGTRAP reaches handler" +) + +case $n in + 1) + # 'FAIL: .* internal error' in gdb.sum. + # Test fail due to internal error. + # + kfail_re=$(join "|" "${kfail[@]}") + grep "^FAIL:.*internal error" binaries-testsuite*/gdb-testresults/*.sum \ + | grep -E -v "$kfail_re" + ;; + + 2) + # 'ERROR:' in gdb.sum. + # A dejagnu or tcl ERROR, may hide real problems. + # + kfail+=( + # https://sourceware.org/bugzilla/show_bug.cgi?id=28355 + "openSUSE_Factory_ARM.aarch64.*UNRESOLVED: gdb.server/.*.exp: (ensure inferior is running|set sysroot remote)" + # https://sourceware.org/bugzilla/show_bug.cgi?id=28323 + "SLE-12.x86_64.*gdb.ada/mi_dyn_arr.exp" + ) + + kfail_re=$(join "|" "${kfail[@]}") + grep -A1 "ERROR:.*no longer" binaries-testsuite*/gdb-testresults/*.sum \ + | grep -E -v "ERROR|\--" | grep -E -v "$kfail_re" + ;; + + 3) + # 'internal-error' in gdb.log + # Catch all internal-errors, not just the ones reported by dejagnu. + # + kfail+=( + # https://sourceware.org/bugzilla/show_bug.cgi?id=26284 + "infrun.c:[0-9]*: internal-error: int finish_step_over\(.*\): Assertion \`ecs->event_thread->control.trap_expected' failed." + # https://sourceware.org/bugzilla/show_bug.cgi?id=26363 + ".i586.*i386-linux-nat.c:[0-9]*: internal-error: Got request for bad register number 41." + # https://sourceware.org/bugzilla/show_bug.cgi?id=26761 + "thread.c:[0-9]*: internal-error: .* inferior_thread\(\): Assertion \`current_thread_ \!= nullptr' failed." + # https://sourceware.org/bugzilla/show_bug.cgi?id=19675 + "linux-nat.c:[0-9]*: internal-error: wait returned unexpected status" + ) + + kfail_re=$(join "|" "${kfail[@]}") + grep -aH internal-error: binaries-testsuite.*/gdb-testresults/*.log \ + | grep -v "maint.c:[0-9]" \ + | grep -E -v "$kfail_re" + ;; + + 4) + sums=() + + # Note: below we avoid gdb-x86_64-suse-linux-m32.sum (the pie variant). + # That one hasn't been cleaned up. + + # Known clean config: Leap 15.1 x86_64. + config=openSUSE_Leap_15.1.x86_64/gdb-testresults + sums+=("$config/gdb-x86_64-suse-linux-m64.-fno-PIE.-no-pie.sum" + "$config/gdb-x86_64-suse-linux-m64.sum" + "$config/gdb-x86_64-suse-linux-m32.-fno-PIE.-no-pie.sum") + + # Known clean config: Leap 15.2 x86_64. + config=openSUSE_Leap_15.2.x86_64/gdb-testresults + sums+=("$config/gdb-x86_64-suse-linux-m64.-fno-PIE.-no-pie.sum" + "$config/gdb-x86_64-suse-linux-m64.sum" + "$config/gdb-x86_64-suse-linux-m32.-fno-PIE.-no-pie.sum") + + # Known clean config: Leap 15.3 x86_64 + config=openSUSE_Leap_15.3.x86_64/gdb-testresults + sums+=("$config/gdb-x86_64-suse-linux-m64.-fno-PIE.-no-pie.sum" + "$config/gdb-x86_64-suse-linux-m64.sum" + "$config/gdb-x86_64-suse-linux-m32.-fno-PIE.-no-pie.sum") + + # Known clean config: SLE 15 x86_64. + config=SLE-15.x86_64/gdb-testresults + sums+=("$config/gdb-x86_64-suse-linux-m64.-fno-PIE.-no-pie.sum" + "$config/gdb-x86_64-suse-linux-m64.sum" + "$config/gdb-x86_64-suse-linux-m32.-fno-PIE.-no-pie.sum") + + # Known cleanish config: Factory x86_64. + config=openSUSE_Factory.x86_64/gdb-testresults + sums+=("$config/gdb-x86_64-suse-linux-m64.-fno-PIE.-no-pie.sum" + "$config/gdb-x86_64-suse-linux-m64.sum" + "$config/gdb-x86_64-suse-linux-m32.-fno-PIE.-no-pie.sum") + + kfail+=("${kfail_factory[@]}") + + for sum in "${sums[@]}"; do + sum=binaries-testsuite.$sum + report_sum "$sum" + done + ;; + + 5) + sums=() + + mapfile -t < <(echo_line "$dir"/*-m64.-fno-PIE.-no-pie.sum) + sums+=("${MAPFILE[@]}") + mapfile -t < <(echo_line "$dir"/*-m64.sum) + sums+=("${MAPFILE[@]}") + mapfile -t < <(echo_line "$dir"/*-m32.-fno-PIE.-no-pie.sum) + sums+=("${MAPFILE[@]}") + + # Assume this is factory. + kfail+=("${kfail_factory[@]}") + + for sum in "${sums[@]}"; do + report_sum "$sum" + done + ;; + + *) + echo "Don't know how to handle arg: $n" + exit 1 + ;; +esac diff --git a/v1.5-libipt-static.patch b/v1.5-libipt-static.patch deleted file mode 100644 index 6a0e9c4..0000000 --- a/v1.5-libipt-static.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- processor-trace-1.5/libipt/src/posix/init.c-orig 2016-04-07 08:52:14.000000000 +0200 -+++ processor-trace-1.5/libipt/src/posix/init.c 2016-08-23 09:04:11.540176668 +0200 -@@ -29,7 +29,7 @@ - #include "pt_ild.h" - - --static void __attribute__((constructor)) init(void) -+void __libipt_init(void) - { - /* Initialize the Intel(R) Processor Trace instruction decoder. */ - pt_ild_init(); diff --git a/v2.0.2.tar.gz b/v2.0.2.tar.gz deleted file mode 100644 index 567a654..0000000 --- a/v2.0.2.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:8650195c4bc59b817c4819b778fddb8045c7fc6ecce78043bba89e2215af3ba1 -size 355877 diff --git a/v2.0.4.tar.gz b/v2.0.4.tar.gz new file mode 100644 index 0000000..5376cac --- /dev/null +++ b/v2.0.4.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3716f3b4de964061f60dbbfc5f1bd57b271824e98f08d2a5af321a50014dd9ac +size 343202 From 68d205396bbbb3f0bfc9e190429fd0493326cb4a88dedcec485f433adfc32b74 Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Fri, 29 Oct 2021 21:19:08 +0000 Subject: [PATCH 2/2] - Mention removed fedora patches: * gdb-6.3-test-self-20050110.patch * gdb-bz1219747-attach-kills.patch * gdb-6.6-buildid-locate-core-as-arg.patch * gdb-attach-fail-reasons-5of5.patch * gdb-archer-pie-addons.patch * gdb-jit-reader-multilib.patch * gdb-6.5-bz218379-solib-trampoline-lookup-lock-fix.patch * gdb-archer.patch * gdb-config.patch * gdb-6.8-quit-never-aborts.patch - Mention removed patches: * gdb-breakpoint-fix-assert-in-jit_event_handler.patch * gdb-fix-section-matching-in-find_pc_sect_compunit.patch * gdb-fortran-fix-print-dynamic-array.patch * gdb-build-hardcode-with-included-regex.patch * gdb-handle-no-upper-bound-in-value-subscript.patch * gdb-fix-internal-error-in-process_event_stop_test.patch * gdb-don-t-return-non-existing-path-in-debuginfod-source-query.patch * gdb-archer-pie-addons-keep-disabled.patch * gdb-fix-filename-in-not-in-executable-format-error.patch * gdb-fix-use-of-invalid-pointer-in-remote-async-inferior-event-handler.patch * gdb-breakpoints-handle-glibc-with-debuginfo-in-create_exception_master_breakpoint.patch - Maintenance scripts: * Add KFAILs in qa.sh. * Add missing '-a' in gdb.log greps in qa.sh. * Fix error handling in qa.sh. - Patches added: * gdb-testsuite-handle-sigill-in-two-gdb.arch-powerpc-test-cases.patch * gdb-testsuite-work-around-skip_prologue-problems-in-gdb.threads-process-dies-while-detaching.exp.patch OBS-URL: https://build.opensuse.org/package/show/devel:gcc/gdb?expand=0&rev=291 --- ...l-in-two-gdb.arch-powerpc-test-cases.patch | 73 +++++++++++++++++ ...ads-process-dies-while-detaching.exp.patch | 80 +++++++++++++++++++ gdb.changes | 34 ++++++++ gdb.spec | 6 ++ qa.sh | 12 ++- 5 files changed, 201 insertions(+), 4 deletions(-) create mode 100644 gdb-testsuite-handle-sigill-in-two-gdb.arch-powerpc-test-cases.patch create mode 100644 gdb-testsuite-work-around-skip_prologue-problems-in-gdb.threads-process-dies-while-detaching.exp.patch diff --git a/gdb-testsuite-handle-sigill-in-two-gdb.arch-powerpc-test-cases.patch b/gdb-testsuite-handle-sigill-in-two-gdb.arch-powerpc-test-cases.patch new file mode 100644 index 0000000..7976e67 --- /dev/null +++ b/gdb-testsuite-handle-sigill-in-two-gdb.arch-powerpc-test-cases.patch @@ -0,0 +1,73 @@ +[gdb/testsuite] Handle SIGILL in two gdb.arch powerpc test-cases + +On powerpc64le-linux, with test-case gdb.arch/powerpc-addpcis.exp I run into +SIGILL: +... +(gdb) PASS: gdb.arch/powerpc-addpcis.exp: get hexadecimal valueof "$r3" +stepi^M +^M +Program terminated with signal SIGILL, Illegal instruction.^M +The program no longer exists.^M +(gdb) PASS: gdb.arch/powerpc-addpcis.exp: set r4 +... +because it's a power9 insn, and I'm running on a power8 machine. + +Fix this by handling the SIGILL. Likewise in gdb.arch/powerpc-lnia.exp. + +Tested on powerpc64le-linux. + +--- + gdb/testsuite/gdb.arch/powerpc-addpcis.exp | 14 +++++++++++++- + gdb/testsuite/gdb.arch/powerpc-lnia.exp | 14 +++++++++++++- + 2 files changed, 26 insertions(+), 2 deletions(-) + +diff --git a/gdb/testsuite/gdb.arch/powerpc-addpcis.exp b/gdb/testsuite/gdb.arch/powerpc-addpcis.exp +index d1bc7f49ce6..ff7052ce475 100644 +--- a/gdb/testsuite/gdb.arch/powerpc-addpcis.exp ++++ b/gdb/testsuite/gdb.arch/powerpc-addpcis.exp +@@ -50,7 +50,19 @@ gdb_breakpoint $bp1 + gdb_breakpoint $bp2 + gdb_breakpoint $bp3 + +-gdb_test "stepi" "" "set r3 " ++set insn_supported 1 ++gdb_test_multiple "stepi" "set r3" { ++ -re "Program received signal SIGILL, Illegal instruction\\..*" { ++ set insn_supported 0 ++ } ++ -re -wrap "" { ++ pass $gdb_test_name ++ } ++} ++if { ! $insn_supported } { ++ unsupported "illegal instruction" ++ return ++} + set check_r3 [get_hexadecimal_valueof "\$r3" "default0"] + gdb_test "stepi" "" "set r4" + set check_r4 [get_hexadecimal_valueof "\$r4" "default0"] +diff --git a/gdb/testsuite/gdb.arch/powerpc-lnia.exp b/gdb/testsuite/gdb.arch/powerpc-lnia.exp +index 0f56d834046..4ab4f8d92be 100644 +--- a/gdb/testsuite/gdb.arch/powerpc-lnia.exp ++++ b/gdb/testsuite/gdb.arch/powerpc-lnia.exp +@@ -54,7 +54,19 @@ gdb_breakpoint $bp3 + + # single-step through the lnia instructions, and retrieve the + # register values as we proceed. +-gdb_test "stepi" "" "set r3" ++set insn_supported 1 ++gdb_test_multiple "stepi" "set r3" { ++ -re "Program received signal SIGILL, Illegal instruction\\..*" { ++ set insn_supported 0 ++ } ++ -re -wrap "" { ++ pass $gdb_test_name ++ } ++} ++if { ! $insn_supported } { ++ unsupported "illegal instruction" ++ return ++} + set check_r3 [get_hexadecimal_valueof "\$r3" "default0"] + gdb_test "stepi" "" "set r4" + set check_r4 [get_hexadecimal_valueof "\$r4" "default0"] diff --git a/gdb-testsuite-work-around-skip_prologue-problems-in-gdb.threads-process-dies-while-detaching.exp.patch b/gdb-testsuite-work-around-skip_prologue-problems-in-gdb.threads-process-dies-while-detaching.exp.patch new file mode 100644 index 0000000..1517176 --- /dev/null +++ b/gdb-testsuite-work-around-skip_prologue-problems-in-gdb.threads-process-dies-while-detaching.exp.patch @@ -0,0 +1,80 @@ +[gdb/testsuite] Work around skip_prologue problems in gdb.threads/process-dies-while-detaching.exp + +On powerpc64le-linux, I run into: +... +[Inferior 1 (process 5156) exited normally]^M +(gdb) FAIL: gdb.threads/process-dies-while-detaching.exp: single-process: \ + detach: detach: continue to breakpoint: _exit (the program exited) +... + +What happens is the following: +- a breakpoint is set on _exit, +- a continue is issued +- the continue is supposed to hit the breakpoint, but instead + the program exits. + +I traced this down to the breakpoint on _exit being set too far from function +entry. This is caused by the skip_prologue function (in rs6000-tdep.c) +optimistically ignoring insns it doesn't recognize. In particular, it walks +past the system call instruction "sc" which initiates the actual exit. + +While this needs fixing, we don't want to be testing this behaviour in this +test-case. + +[ Initially I tried to fix it by setting a breakpoint on "*_exit" instead, but +that one only sets one location. The breakpoint on "_exit" sets two +locations, one in /lib64/libc.so.6 and one in /lib64/ld64.so.2. I tried on +x86_64 and there the breakpoint on "*_exit" mapped to the /lib64/libc.so.6 +location, and the test-case passed. But on powerpc it mapped to the +/lib64/ld64.so.2 location and I still got the same failures. ] + +Fix this by setting two breakpoints on the calls to _exit and exit instead. + +Tested on x86_64-linux and powerpc64le-linux. + +--- + gdb/testsuite/gdb.threads/process-dies-while-detaching.c | 4 ++-- + gdb/testsuite/gdb.threads/process-dies-while-detaching.exp | 8 ++++++-- + 2 files changed, 8 insertions(+), 4 deletions(-) + +diff --git a/gdb/testsuite/gdb.threads/process-dies-while-detaching.c b/gdb/testsuite/gdb.threads/process-dies-while-detaching.c +index 502b4622614..c4c0b0a648b 100644 +--- a/gdb/testsuite/gdb.threads/process-dies-while-detaching.c ++++ b/gdb/testsuite/gdb.threads/process-dies-while-detaching.c +@@ -46,7 +46,7 @@ void * + thread_function (void *arg) + { + pthread_barrier_wait (&start_threads_barrier); +- _exit (0); ++ _exit (0); /* Exit in thread. */ + } + + /* The fork child's entry point. */ +@@ -63,7 +63,7 @@ child_function (void) + pthread_create (&threads[i], NULL, thread_function, NULL); + pthread_barrier_wait (&start_threads_barrier); + +- exit (0); ++ exit (0); /* Exit in child. */ + } + + /* This is defined by the .exp file if testing the multi-process +diff --git a/gdb/testsuite/gdb.threads/process-dies-while-detaching.exp b/gdb/testsuite/gdb.threads/process-dies-while-detaching.exp +index ac1aad26ec5..458d3bbeb56 100644 +--- a/gdb/testsuite/gdb.threads/process-dies-while-detaching.exp ++++ b/gdb/testsuite/gdb.threads/process-dies-while-detaching.exp +@@ -126,8 +126,12 @@ proc detach_and_expect_exit {inf_output_re test} { + # Run to _exit in the child. + + proc continue_to_exit_bp {} { +- gdb_breakpoint "_exit" temporary +- gdb_continue_to_breakpoint "_exit" ".*_exit.*" ++ set line [gdb_get_line_number "Exit in child"] ++ gdb_breakpoint $line temporary ++ set line [gdb_get_line_number "Exit in thread"] ++ gdb_breakpoint $line temporary ++ gdb_continue_to_breakpoint "exit" ".*exit.*" ++ delete_breakpoints + } + + # If testing single-process, simply detach from the process. diff --git a/gdb.changes b/gdb.changes index 313f866..4a23a6e 100644 --- a/gdb.changes +++ b/gdb.changes @@ -1,3 +1,37 @@ +------------------------------------------------------------------- +Thu Oct 28 13:40:28 UTC 2021 - Tom de Vries + +- Mention removed fedora patches: + * gdb-6.3-test-self-20050110.patch + * gdb-bz1219747-attach-kills.patch + * gdb-6.6-buildid-locate-core-as-arg.patch + * gdb-attach-fail-reasons-5of5.patch + * gdb-archer-pie-addons.patch + * gdb-jit-reader-multilib.patch + * gdb-6.5-bz218379-solib-trampoline-lookup-lock-fix.patch + * gdb-archer.patch + * gdb-config.patch + * gdb-6.8-quit-never-aborts.patch +- Mention removed patches: + * gdb-breakpoint-fix-assert-in-jit_event_handler.patch + * gdb-fix-section-matching-in-find_pc_sect_compunit.patch + * gdb-fortran-fix-print-dynamic-array.patch + * gdb-build-hardcode-with-included-regex.patch + * gdb-handle-no-upper-bound-in-value-subscript.patch + * gdb-fix-internal-error-in-process_event_stop_test.patch + * gdb-don-t-return-non-existing-path-in-debuginfod-source-query.patch + * gdb-archer-pie-addons-keep-disabled.patch + * gdb-fix-filename-in-not-in-executable-format-error.patch + * gdb-fix-use-of-invalid-pointer-in-remote-async-inferior-event-handler.patch + * gdb-breakpoints-handle-glibc-with-debuginfo-in-create_exception_master_breakpoint.patch +- Maintenance scripts: + * Add KFAILs in qa.sh. + * Add missing '-a' in gdb.log greps in qa.sh. + * Fix error handling in qa.sh. +- Patches added: + * gdb-testsuite-handle-sigill-in-two-gdb.arch-powerpc-test-cases.patch + * gdb-testsuite-work-around-skip_prologue-problems-in-gdb.threads-process-dies-while-detaching.exp.patch + ------------------------------------------------------------------- Fri Oct 22 07:03:55 UTC 2021 - Tom de Vries diff --git a/gdb.spec b/gdb.spec index b46106e..d8dfadd 100644 --- a/gdb.spec +++ b/gdb.spec @@ -354,6 +354,10 @@ Patch2108: gdb-testsuite-fix-port-detection-in-gdb.debuginfod-fetch_src_and Patch2109: gdb-testsuite-add-checks-to-gdb.arch-i386-sse.exp.patch # https://sourceware.org/pipermail/gdb-patches/2021-October/182868.html Patch2110: gdb-testsuite-Fix-gdb.threads-thread-specific-bp.exp.patch +#https://sourceware.org/pipermail/gdb-patches/2021-October/182919.html +Patch2111: gdb-testsuite-work-around-skip_prologue-problems-in-gdb.threads-process-dies-while-detaching.exp.patch +#https://sourceware.org/pipermail/gdb-patches/2021-October/182921.html +Patch2112: gdb-testsuite-handle-sigill-in-two-gdb.arch-powerpc-test-cases.patch BuildRequires: bison BuildRequires: flex @@ -766,6 +770,8 @@ find -name "*.info*"|xargs rm -f %patch2108 -p1 %patch2109 -p1 %patch2110 -p1 +%patch2111 -p1 +%patch2112 -p1 #unpack libipt %if 0%{have_libipt} diff --git a/qa.sh b/qa.sh index b288a29..1fba067 100644 --- a/qa.sh +++ b/qa.sh @@ -17,7 +17,7 @@ fi n="$1" shift -if [ "$n" -eq 5 ]; then +if [ "$n" = "5" ]; then dir="$1" shift fi @@ -90,6 +90,7 @@ kfail=( "FAIL: gdb.threads/signal-while-stepping-over-bp-other-thread.exp: step \(pattern 3\)" # https://sourceware.org/bugzilla/show_bug.cgi?id=26915 "FAIL: gdb.threads/schedlock.exp: schedlock=off: cmd=next: call_function=0: other threads ran - unlocked" + "FAIL: gdb.threads/schedlock.exp: schedlock=off: cmd=step: other threads ran - unlocked" # https://sourceware.org/bugzilla/show_bug.cgi?id=28479 "FAIL: gdb.mi/mi-nonstop.exp: wait for thread exit \(timeout\)" @@ -138,6 +139,9 @@ kfail_factory=( "FAIL: gdb.gdb/selftest.exp: backtrace through signal handler" # https://sourceware.org/bugzilla/show_bug.cgi?id=26867 "FAIL: gdb.threads/signal-sigtrap.exp: sigtrap thread 1: signal SIGTRAP reaches handler" + # https://sourceware.org/bugzilla/show_bug.cgi?id=28510 + FAIL: gdb.debuginfod/fetch_src_and_symbols.exp: local_url: br main + FAIL: gdb.debuginfod/fetch_src_and_symbols.exp: local_url: l ) case $n in @@ -182,9 +186,9 @@ case $n in ) kfail_re=$(join "|" "${kfail[@]}") - grep -aH internal-error: binaries-testsuite.*/gdb-testresults/*.log \ - | grep -v "maint.c:[0-9]" \ - | grep -E -v "$kfail_re" + grep -a -H internal-error: binaries-testsuite.*/gdb-testresults/*.log \ + | grep -a -v "maint.c:[0-9]" \ + | grep -a -E -v "$kfail_re" ;; 4)